00001 /* 00002 * ffse 00003 * Copyright (C) 2004-2005 emuWorks 00004 * http://games.technoplaza.net/ 00005 * 00006 * This file is part of ffse. 00007 * 00008 * ffse is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * ffse is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with ffse; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 // $Id: MainFrame.hh,v 1.17 2007/02/18 22:02:58 technoplaza Exp $ 00024 00025 #ifndef _MAIN_FRAME_HH 00026 #define _MAIN_FRAME_HH 00027 00028 namespace ffse { 00029 class SaveSlot; 00030 00031 /** 00032 * The main frame and primary view for the application. 00033 */ 00034 class MainFrame : public wxFrame { 00035 DECLARE_DYNAMIC_CLASS(MainFrame) 00036 DECLARE_EVENT_TABLE() 00037 00038 friend class FileDropTarget; 00039 00040 private: 00041 wxCheckBox *weaponEquippedCheck[4], *armorEquippedCheck[4]; 00042 00043 wxChoice *classChoice, *conditionChoice; 00044 wxChoice *weaponChoice[4], *armorChoice[4]; 00045 wxChoice *knownMagicChoice[8][3]; 00046 00047 wxMenuItem *fileCloseItem, *fileSaveItem, *fileSaveAsItem; 00048 wxMenuItem *memberItems[4]; 00049 00050 wxSlider *healSlider, *pureSlider, *softSlider; 00051 wxSlider *tentSlider, *cabinSlider, *houseSlider; 00052 wxSlider *currentMagicSlider[8], *maxMagicSlider[8]; 00053 00054 wxTextCtrl *goldText, *nameText, *currentHPText, *maxHPText; 00055 wxTextCtrl *strengthText, *agilityText, *intelligenceText; 00056 wxTextCtrl *vitalityText, *luckText, *experienceText; 00057 wxTextCtrl *damageText, *hitPercentText; 00058 00059 wxString sramFile; 00060 SaveSlot *game; 00061 char *sram; 00062 int member; 00063 bool open; 00064 00065 /** 00066 * Creates the controls used by this MainFrame. 00067 */ 00068 void CreateControls(); 00069 00070 /** 00071 * Checks if an SRAM file is currently open. 00072 * 00073 * @return true if open; false otherwise. 00074 */ 00075 bool isOpen() { return open; } 00076 00077 /** 00078 * Sets whether an SRAM file is open or not. 00079 * 00080 * @param open true if open; false otherwise. 00081 */ 00082 void setOpen(bool open); 00083 00084 /** 00085 * Loads the data for a particular member. 00086 * 00087 * @param member The member whose data to load. 00088 */ 00089 void loadCharacterData(int member = 0); 00090 00091 /** 00092 * Loads the game data into the frame controls. 00093 */ 00094 void loadGameData(); 00095 00096 /** 00097 * Loads an SRAM file. 00098 * 00099 * @param filename The SRAM file to load. 00100 */ 00101 void load(wxString &filename); 00102 00103 /** 00104 * Callback triggered when open is selected from the file menu. 00105 * 00106 * @param event The associated command event. 00107 */ 00108 void fileOpen(wxCommandEvent &event); 00109 00110 /** 00111 * Closes the currently open SRAM file. 00112 * 00113 * @return true if closed; false otherwise. 00114 */ 00115 bool close(); 00116 00117 /** 00118 * Callback triggered when close is selected from the file menu. 00119 * 00120 * @param event The associated command event. 00121 */ 00122 void fileClose(wxCommandEvent &event); 00123 00124 /** 00125 * Checks if all party members have valid equipment. Invalid 00126 * equipment only refers to duplicate equipped items, not to 00127 * invalid selections based on what a character's class can equip. 00128 * 00129 * @return true if valid; false otherwise. 00130 */ 00131 bool isValidEquipment(); 00132 00133 /** 00134 * Saves the current SRAM to file. 00135 * 00136 * @param filename The filename to save to. 00137 * 00138 * @return true if the SRAM was saved; false otherwise. 00139 */ 00140 bool save(wxString &filename); 00141 00142 /** 00143 * Callback triggered when save is selected from the file menu. 00144 * 00145 * @param event The associated command event. 00146 */ 00147 void fileSave(wxCommandEvent &event); 00148 00149 /** 00150 * Callback triggered when "save as" is selected from the file menu. 00151 * 00152 * @param event The associated command event. 00153 */ 00154 void fileSaveAs(wxCommandEvent &event); 00155 00156 /** 00157 * Callback triggered when exit is selected from the file menu. 00158 * 00159 * @param event The associated command event. 00160 */ 00161 void fileExit(wxCommandEvent &event); 00162 00163 /** 00164 * Callback triggered when the window is being closed. 00165 * 00166 * @param event The associated command event. 00167 */ 00168 void windowClosing(wxCloseEvent &event); 00169 00170 /** 00171 * Callback triggered when one of the character menu items is 00172 * selected. 00173 * 00174 * @param event The associated command event. 00175 */ 00176 void memberChange(wxCommandEvent &event); 00177 00178 /** 00179 * Callback triggered when about is selected from the help menu. 00180 * 00181 * @param event The associated command event. 00182 */ 00183 void helpAbout(wxCommandEvent &event); 00184 00185 /** 00186 * Callback triggered when the amount of gold is changed. 00187 * 00188 * @param event The associated command event. 00189 */ 00190 void goldChange(wxCommandEvent &event); 00191 00192 /** 00193 * Callback triggered when an quantity item is changed. 00194 * 00195 * @param event The associated scroll event. 00196 */ 00197 void itemQuantityChange(wxScrollEvent &event); 00198 00199 /** 00200 * Callback triggered when an item is changed. 00201 * 00202 * @param event The associated command event. 00203 */ 00204 void itemHaveChange(wxCommandEvent &event); 00205 00206 /** 00207 * Callback when a member's name is changed. 00208 * 00209 * @param event The associated command event. 00210 */ 00211 void nameChange(wxCommandEvent &event); 00212 00213 /** 00214 * Callback triggered when class or condition is changed. 00215 * 00216 * @param event The associated command event. 00217 */ 00218 void conditionChange(wxCommandEvent &event); 00219 00220 /** 00221 * Callback triggered when a stat change occurs. 00222 * 00223 * @param event The associated command event. 00224 */ 00225 void statChange(wxCommandEvent &event); 00226 00227 /** 00228 * Callback triggered when a weapon change occurs. 00229 * 00230 * @param event The associated command event. 00231 */ 00232 void weaponChange(wxCommandEvent &event); 00233 00234 /** 00235 * Callback triggered when an equipped weapon change occurs. 00236 * 00237 * @param event The associated command event. 00238 */ 00239 void weaponEquippedChange(wxCommandEvent &event); 00240 00241 /** 00242 * Callback triggered when an armor change occurs. 00243 * 00244 * @param event The associated command event. 00245 */ 00246 void armorChange(wxCommandEvent &event); 00247 00248 /** 00249 * Callback triggered when an equipped armor change occurs. 00250 * 00251 * @param event The associated command event. 00252 */ 00253 void armorEquippedChange(wxCommandEvent &event); 00254 00255 /** 00256 * Callback triggered when the current magic level is changed. 00257 * 00258 * @param event The associated scroll event. 00259 */ 00260 void currentMagicChange(wxScrollEvent &event); 00261 00262 /** 00263 * Callback triggered when the max magic level is changed. 00264 * 00265 * @param event The associated scroll event. 00266 */ 00267 void maxMagicChange(wxScrollEvent &event); 00268 00269 /** 00270 * Callback triggered when the known magic is changed. 00271 * 00272 * @param event The associated command event. 00273 */ 00274 void knownMagicChange(wxCommandEvent &event); 00275 00276 00277 00278 public: 00279 /** 00280 * Constructor for a MainFrame. 00281 */ 00282 MainFrame(); 00283 }; 00284 } 00285 00286 #endif 00287