1 // CoMET - The Crimson Fields Map Editing Tool 2 // Copyright (C) 2002-2007 Jens Granseuer 3 // 4 // This program is free software; you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation; either version 2 of the License, or 7 // (at your option) any later version. 8 // 9 // This program is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with this program; if not, write to the Free Software 16 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 // 18 19 /////////////////////////////////////////////////////////////// 20 // extwindow2.h - extended window classes for CoMET 21 /////////////////////////////////////////////////////////////// 22 23 #ifndef _INCLUDE_ED_EXTWINDOW2_H 24 #define _INCLUDE_ED_EXTWINDOW2_H 25 26 #include "window.h" 27 #include "button.h" 28 #include "misc.h" 29 #include "mission.h" 30 #include "mapview.h" 31 32 class ListExchangeWindow : public Window, public WidgetHook { 33 public: 34 ListExchangeWindow( TLWList &l1, TLWList &l2, const char *label1, 35 const char *label2, View *view ); SetHook(WidgetHook * hook)36 void SetHook( WidgetHook *hook ) const { ok->SetHook(hook); } 37 38 private: 39 GUI_Status WidgetActivated( Widget *widget, Window *win ); 40 41 enum { 42 B_ID_OK = 1, 43 B_ID_RIGHT, 44 B_ID_LEFT 45 }; 46 47 ButtonWidget *ok; 48 TextListWidget *wd_l1; 49 TextListWidget *wd_l2; 50 TLWList &list1; 51 TLWList &list2; 52 }; 53 54 class ListSelectWindow : public Window, public WidgetHook { 55 public: 56 ListSelectWindow( const char *title, TLWList &list, 57 short defid, bool nullok, WidgetHook *hook, 58 short button, View *view ); 59 Selected(void)60 TLWNode *Selected( void ) const { return current; } 61 62 private: 63 GUI_Status WidgetActivated( Widget *widget, Window *win ); 64 65 short button; 66 bool nullok; 67 TextListWidget *lw; 68 const TLWList &list; 69 WidgetHook *client; 70 TLWNode *current; 71 }; 72 73 // create a new mission 74 class NewMissionWindow : public Window, public WidgetHook { 75 public: 76 NewMissionWindow( View *view ); 77 SetHook(WidgetHook * hook,short id)78 void SetHook( WidgetHook *hook, short id ) 79 { this->hook = hook; ok_id = id; } 80 GetMission(void)81 Mission *GetMission( void ) const { return mission; } 82 83 private: 84 Mission *NewMission( const Point &size, const string &tset, 85 const string &uset ); 86 Point GetMapSize( void ) const; GetTileSet(void)87 const char *GetTileSet( void ) const { return tileset->String(); } GetUnitSet(void)88 const char *GetUnitSet( void ) const { return unitset->String(); } 89 90 GUI_Status WidgetActivated( Widget *button, Window *win ); 91 92 enum { 93 B_ID_UNITSET = 1, 94 B_ID_TILESET, 95 B_ID_UNITSET_OK, 96 B_ID_TILESET_OK, 97 B_ID_RANDOM, 98 B_ID_OK 99 }; 100 101 Mission *mission; 102 103 NumberWidget *m_width; 104 NumberWidget *m_height; 105 StringWidget *tileset; 106 StringWidget *unitset; 107 CheckboxWidget *gen_random; 108 SliderWidget *gen_water; 109 SliderWidget *gen_roughness; 110 WidgetHook *hook; 111 short ok_id; 112 }; 113 114 class EdMissionSetupWindow : public Window, public WidgetHook { 115 public: 116 EdMissionSetupWindow( Mission &mission, View *view ); 117 118 private: 119 GUI_Status WidgetActivated( Widget *widget, Window *win ); 120 121 enum { 122 B_ID_NAME, 123 B_ID_INFO, 124 B_ID_PLAYER1, 125 B_ID_PLAYER2, 126 B_ID_BRIEF1, 127 B_ID_BRIEF2, 128 B_ID_CAMPAIGN_NAME, 129 B_ID_CAMPAIGN_INFO, 130 B_ID_SHOWMSG, 131 B_ID_SET, 132 S_ID_SEQUEL, 133 B_ID_PLAYERS, 134 S_ID_MUSIC, 135 B_ID_CAMPAIGN, 136 B_ID_SKIRMISH 137 }; 138 139 Mission &mission; 140 141 StringWidget *nextmap; 142 TextScrollWidget *msg; 143 CycleWidget *showmsg; 144 145 TLWList tlist; 146 }; 147 148 class EdBuildingWindow : public Window, public WidgetHook { 149 public: 150 EdBuildingWindow( Building &bld, Mission &mission, View *view ); 151 152 private: 153 GUI_Status WidgetActivated( Widget *widget, Window *win ); 154 155 enum { 156 B_ID_PLAYER = 1, 157 B_ID_WORKSHOP, 158 B_ID_FACTORY, 159 B_ID_CRYSTALS, 160 B_ID_OK, 161 B_ID_NAME, 162 B_ID_NAME_OK, 163 B_ID_UNITS, 164 N_ID_MAXCRYSTALS, 165 B_ID_FACTORY_UNITS 166 }; 167 168 Building &b; 169 Mission &mission; 170 171 StringWidget *b_name; 172 CycleWidget *b_player; 173 NumberWidget *b_crystals; 174 NumberWidget *b_maxcrystals; 175 NumberWidget *b_mining; 176 ButtonWidget *b_factory_units; 177 178 TLWList fact_list_ok; 179 TLWList fact_list_na; 180 TLWList msg_list; 181 }; 182 183 184 class EdUnitWindow : public Window, public WidgetHook { 185 public: 186 EdUnitWindow( Unit &unit, Mission &mission, View *view ); 187 SetMapView(MapView & mapview)188 void SetMapView( MapView &mapview ) { mv = &mapview; } 189 190 private: 191 GUI_Status WidgetActivated( Widget *button, Window *win ); 192 193 enum { 194 B_ID_PLAYER = 1, 195 B_ID_DIRECTION, 196 B_ID_SIZE, 197 B_ID_XP, 198 N_ID_CRYSTALS, 199 B_ID_UNITS, 200 B_ID_OK 201 }; 202 203 Unit &u; 204 Mission &mission; 205 MapView *mv; // we need this to update the map display 206 // if e.g. owner or direction changes 207 CycleWidget *u_player; 208 }; 209 210 211 class EdEventsWindow : public Window, public WidgetHook { 212 public: 213 EdEventsWindow( Mission &mission, View *view ); 214 215 private: 216 GUI_Status WidgetActivated( Widget *button, Window *win ); 217 218 enum { 219 B_ID_NEW = 1, 220 B_ID_EDIT, 221 B_ID_DELETE, 222 B_ID_OK 223 }; 224 225 TextListWidget *e_list; 226 TLWList nodes; 227 Mission &mission; 228 }; 229 230 231 class SelectEventWindow : public Window, public WidgetHook { 232 public: 233 SelectEventWindow( Mission &mission, View *view ); 234 235 private: 236 GUI_Status WidgetActivated( Widget *button, Window *win ); 237 void BuildTLWList( TLWList &list ) const; 238 239 enum { 240 B_ID_TRIGGER = 1, 241 B_ID_OK, 242 B_ID_CANCEL 243 }; 244 245 TextListWidget *e_list; 246 CycleWidget *e_trigger; 247 TLWList nodes; 248 Mission &mission; 249 }; 250 251 class EdUnitsWindow : public Window, public WidgetHook { 252 public: 253 EdUnitsWindow( Mission &mission, MapObject &container, View *view ); 254 255 private: 256 GUI_Status WidgetActivated( Widget *button, Window *win ); 257 void BuildTLWList( TLWList &list ) const; 258 259 enum { 260 B_ID_NEW = 1, 261 B_ID_EDIT, 262 B_ID_DELETE, 263 B_ID_OK 264 }; 265 266 TextListWidget *e_list; 267 TLWList nodes; 268 TLWList utypes; 269 Mission &mission; 270 MapObject &container; 271 }; 272 273 class SelectUnitWindow : public Window, public WidgetHook { 274 public: 275 SelectUnitWindow( Mission &mission, WidgetHook *hook, View *view ); 276 SelectUnitWindow( Mission &mission, TLWList &list, 277 WidgetHook *hook, View *view ); 278 279 const UnitType *Selected( void ) const; 280 281 private: 282 GUI_Status WidgetActivated( Widget *button, Window *win ); 283 void Init( TLWList &list, WidgetHook *hook ); 284 285 enum { 286 B_ID_CANCEL = 1 287 }; 288 289 TextListWidget *e_list; 290 TLWList nodes; 291 Mission &mission; 292 }; 293 294 class EdMsgWindow : public Window, public WidgetHook { 295 public: 296 EdMsgWindow( Locale &locale, View *view ); 297 298 private: 299 void Draw( void ); 300 void BuildLangsList( void ); 301 void BuildMsgsList( void ); 302 GUI_Status WidgetActivated( Widget *button, Window *win ); 303 304 enum { 305 B_ID_LANG_NEW = 1, 306 B_ID_LANG_DELETE, 307 B_ID_MSG_ADD, 308 B_ID_MSG_MODIFY, 309 L_ID_LANGS, 310 L_ID_MSGS 311 }; 312 313 TextListWidget *w_langs; 314 TextListWidget *w_msgs; 315 StringWidget *w_msg; 316 StringWidget *w_lid; 317 Locale &locale; 318 319 TLWList l_langs; 320 TLWList l_msgs; 321 Language *cur_lang; 322 int cur_msg_id; 323 }; 324 325 #endif // _INCLUDE_ED_EXTWINDOW2_H 326 327