Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

editor.h

00001 #ifndef DEF_EDITOR_H 00002 #define DEF_EDITOR_H 1 00003 00004 #define EDIT_RESET_ACTIONS 0x00000001 00005 #define EDIT_MOUSE_MOTION 0x00000002 00006 #define EDIT_BOX 0x00000004 00007 #define EDIT_ACT_BOX 0x00000008 00008 #define EDIT_SEL_ACT_BOX 0x00000010 00009 #define EDIT_PLACE_OBJECT 0x00000020 00010 #define EDIT_REMOVE_OBJECTS 0x00000040 00011 #define EDIT_SELECT_START 0x00000080 00012 #define EDIT_SELECT_END 0x00000100 00013 #define EDIT_MOVE_START 0x00000200 00014 #define EDIT_MOVE_END 0x00000400 00015 00019 class Box { 00020 friend class Editor; 00021 friend class GraphicsEngine; 00022 public: 00023 Box(Sint16,Sint16); 00024 virtual ~Box(); 00026 string title; 00028 virtual void act(Sint8) = 0; 00029 virtual void input(Uint16) { } 00030 Uint8 getSize() { 00031 return entries.size(); 00032 } 00033 const SDL_Rect& getArea(); 00034 Sint8 getCurrentEntry(Sint16,Sint16); 00035 protected: 00037 SDL_Surface* surface; 00039 std::vector<string> entries; 00041 Font* font; 00043 Font* font_title; 00045 Font* font_high; 00047 SDL_Rect area; 00049 virtual void update(); 00051 bool centered; 00052 }; 00053 00057 class EditBox : public Box { 00058 public: 00059 EditBox(Sint16,Sint16); 00060 virtual void act(Sint8); 00061 }; 00062 00066 class PlaceBox : public Box { 00067 public: 00068 PlaceBox(Sint16,Sint16); 00069 virtual void act(Sint8); 00070 }; 00071 00075 class TextInputBox : public Box { 00076 public: 00077 TextInputBox(Sint16,Sint16); 00078 virtual ~TextInputBox(); 00079 virtual void act(Sint8); 00080 virtual void input(Uint16); 00081 virtual void evaluateEntry(); 00082 protected: 00083 Sint8 currententry; 00084 std::vector<string> etitles; 00085 std::vector<string> einput; 00086 virtual void update(); 00087 }; 00088 00092 class ObjectBox : public TextInputBox { 00093 public: 00094 ObjectBox(string,Sint16,Sint16,ParameterMap& parameters); 00095 protected: 00096 virtual void evaluateEntry(); 00097 string objname; 00098 }; 00099 00103 class SaveAsBox : public TextInputBox { 00104 public: 00105 SaveAsBox(Sint16,Sint16); 00106 protected: 00107 virtual void evaluateEntry(); 00108 }; 00109 00113 class OpenMapBox : public TextInputBox { 00114 public: 00115 OpenMapBox(Sint16,Sint16); 00116 protected: 00117 virtual void evaluateEntry(); 00118 }; 00119 00123 class NewMapBox : public TextInputBox { 00124 public: 00125 NewMapBox(Sint16,Sint16); 00126 protected: 00127 virtual void evaluateEntry(); 00128 }; 00129 00130 00134 class Editor { 00135 public: 00136 Editor(); 00137 ~Editor(); 00138 void reinit(); 00139 void run_action(Uint32 action, Uint16 x=0, Uint16 y=0); 00140 Uint32 getActionMPressed(Uint8 button) { 00141 if (button>=1 && button <6) return action_mouse_pressed[button]; 00142 else return NOTHING; 00143 } 00144 Uint32 getActionMReleased(Uint8 button) { 00145 if (button>=1 && button <6) return action_mouse_released[button]; 00146 else return NOTHING; 00147 } 00149 Box* setBox(Box* newbox); 00151 void closeBox(); 00152 bool hasBox() { 00153 if (box && box->surface) return true; 00154 else return false; 00155 } 00156 Box* box; 00158 string save_name; 00160 string place_name; 00162 ParameterMap place_parameters; 00164 void appendtoBuf(string); 00165 string getBufLine(string match); 00167 bool changeBuf(string,string); 00168 /* TODO: add header modifiers */ 00170 string removefromBuf(string); 00172 int saveBuf(string); 00174 Uint32 action_mouse_pressed[6]; 00176 Uint32 action_mouse_released[6]; 00177 std::set<string> selection; 00178 bool select_start; 00179 SDL_Rect select_rect; 00180 Sint16 select_start_x; 00181 Sint16 select_start_y; 00182 bool move_start; 00183 Sint16 move_start_x; 00184 Sint16 move_start_y; 00185 SDL_Surface* mask_surface; 00186 Object* move_object; 00187 private: 00188 Sint16 getBufLineNr(string); 00189 void updateSelection(Sint16 x, Sint16 y); 00190 bool updateMove(Sint16 x, Sint16 y); 00191 }; 00192 00193 #endif

Generated on Sun Feb 5 13:02:35 2006 for Lost Penguins by doxygen 1.3.8