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.15 2005/08/04 03:08:00 technoplaza Exp $ 00024 00025 #ifndef _MAIN_FRAME_HH 00026 #define _MAIN_FRAME_HH 00027 00028 #include <wx/xrc/xmlres.h> 00029 #include <wx/frame.h> 00030 #include <wx/notebook.h> 00031 #include <wx/statusbr.h> 00032 00033 #include "FileDropTarget.hh" 00034 #include "../model/SaveSlot.hh" 00035 00036 namespace ffse { 00037 class SaveSlot; 00038 00039 /** 00040 * The main frame and primary view for the application. 00041 */ 00042 class MainFrame : public wxFrame { 00043 public: 00044 /** 00045 * Constructor for a MainFrame. 00046 */ 00047 MainFrame(); 00048 00049 /** 00050 * Creates the controls used by this MainFrame. 00051 */ 00052 void CreateControls(); 00053 00054 friend class FileDropTarget; 00055 00056 private: 00057 DECLARE_DYNAMIC_CLASS(MainFrame) 00058 DECLARE_EVENT_TABLE() 00059 00060 /** 00061 * Checks if an SRAM file is currently open. 00062 * 00063 * @return true if open; false otherwise. 00064 */ 00065 bool isOpen() { return open; } 00066 00067 /** 00068 * Sets whether an SRAM file is open or not. 00069 * 00070 * @param open true if open; false otherwise. 00071 */ 00072 void setOpen(bool open); 00073 00074 /** 00075 * Loads the data for a particular member. 00076 * 00077 * @param member The member whose data to load. 00078 */ 00079 void loadCharacterData(int member = 0); 00080 00081 /** 00082 * Loads the game data into the frame controls. 00083 */ 00084 void loadGameData(); 00085 00086 /** 00087 * Loads an SRAM file. 00088 * 00089 * @param filename The SRAM file to load. 00090 */ 00091 void load(wxString &filename); 00092 00093 /** 00094 * Callback triggered when open is selected from the file menu. 00095 * 00096 * @param event The associated command event. 00097 */ 00098 void fileOpen(wxCommandEvent &event); 00099 00100 /** 00101 * Closes the currently open SRAM file. 00102 * 00103 * @return true if closed; false otherwise. 00104 */ 00105 bool close(); 00106 00107 /** 00108 * Callback triggered when close is selected from the file menu. 00109 * 00110 * @param event The associated command event. 00111 */ 00112 void fileClose(wxCommandEvent &event); 00113 00114 /** 00115 * Checks if all party members have valid equipment. Invalid 00116 * equipment only refers to duplicate equipped items, not to 00117 * invalid selections based on what a character's class can equip. 00118 * 00119 * @return true if valid; false otherwise. 00120 */ 00121 bool isValidEquipment(); 00122 00123 /** 00124 * Saves the current SRAM to file. 00125 * 00126 * @param filename The filename to save to. 00127 * 00128 * @return true if the SRAM was saved; false otherwise. 00129 */ 00130 bool save(wxString &filename); 00131 00132 /** 00133 * Callback triggered when save is selected from the file menu. 00134 * 00135 * @param event The associated command event. 00136 */ 00137 void fileSave(wxCommandEvent &event); 00138 00139 /** 00140 * Callback triggered when "save as" is selected from the file menu. 00141 * 00142 * @param event The associated command event. 00143 */ 00144 void fileSaveAs(wxCommandEvent &event); 00145 00146 /** 00147 * Callback triggered when exit is selected from the file menu. 00148 * 00149 * @param event The associated command event. 00150 */ 00151 void fileExit(wxCommandEvent &event); 00152 00153 /** 00154 * Callback triggered when the window is being closed. 00155 * 00156 * @param event The associated command event. 00157 */ 00158 void windowClosing(wxCloseEvent &event); 00159 00160 /** 00161 * Callback triggered when one of the character menu items is 00162 * selected. 00163 * 00164 * @param event The associated command event. 00165 */ 00166 void memberChange(wxCommandEvent &event); 00167 00168 /** 00169 * Callback triggered when about is selected from the help menu. 00170 * 00171 * @param event The associated command event. 00172 */ 00173 void helpAbout(wxCommandEvent &event); 00174 00175 /** 00176 * Callback triggered when the amount of gold is changed. 00177 * 00178 * @param event The associated command event. 00179 */ 00180 void goldChange(wxCommandEvent &event); 00181 00182 /** 00183 * Callback triggered when an quantity item is changed. 00184 * 00185 * @param event The associated scroll event. 00186 */ 00187 void itemQuantityChange(wxScrollEvent &event); 00188 00189 /** 00190 * Callback triggered when an item is changed. 00191 * 00192 * @param event The associated command event. 00193 */ 00194 void itemHaveChange(wxCommandEvent &event); 00195 00196 /** 00197 * Callback when a member's name is changed. 00198 * 00199 * @param event The associated command event. 00200 */ 00201 void nameChange(wxCommandEvent &event); 00202 00203 /** 00204 * Callback triggered when class or condition is changed. 00205 * 00206 * @param event The associated command event. 00207 */ 00208 void conditionChange(wxCommandEvent &event); 00209 00210 /** 00211 * Callback triggered when a stat change occurs. 00212 * 00213 * @param event The associated command event. 00214 */ 00215 void statChange(wxCommandEvent &event); 00216 00217 /** 00218 * Callback triggered when a weapon change occurs. 00219 * 00220 * @param event The associated command event. 00221 */ 00222 void weaponChange(wxCommandEvent &event); 00223 00224 /** 00225 * Callback triggered when an equipped weapon change occurs. 00226 * 00227 * @param event The associated command event. 00228 */ 00229 void weaponEquippedChange(wxCommandEvent &event); 00230 00231 /** 00232 * Callback triggered when an armor change occurs. 00233 * 00234 * @param event The associated command event. 00235 */ 00236 void armorChange(wxCommandEvent &event); 00237 00238 /** 00239 * Callback triggered when an equipped armor change occurs. 00240 * 00241 * @param event The associated command event. 00242 */ 00243 void armorEquippedChange(wxCommandEvent &event); 00244 00245 /** 00246 * Callback triggered when the current magic level is changed. 00247 * 00248 * @param event The associated scroll event. 00249 */ 00250 void currentMagicChange(wxScrollEvent &event); 00251 00252 /** 00253 * Callback triggered when the max magic level is changed. 00254 * 00255 * @param event The associated scroll event. 00256 */ 00257 void maxMagicChange(wxScrollEvent &event); 00258 00259 /** 00260 * Callback triggered when the known magic is changed. 00261 * 00262 * @param event The associated command event. 00263 */ 00264 void knownMagicChange(wxCommandEvent &event); 00265 00266 wxString sramFile; 00267 char *sram; 00268 SaveSlot *game; 00269 int member; 00270 00271 bool open; 00272 00273 wxNotebook *notebook; 00274 00275 wxMenuItem *fileCloseItem; 00276 wxMenuItem *fileSaveItem; 00277 wxMenuItem *fileSaveAsItem; 00278 wxMenuItem *memberItems[4]; 00279 00280 wxTextCtrl *goldText; 00281 00282 wxSlider *healSlider; 00283 wxSlider *pureSlider; 00284 wxSlider *softSlider; 00285 wxSlider *tentSlider; 00286 wxSlider *cabinSlider; 00287 wxSlider *houseSlider; 00288 00289 wxCheckBox *luteCheck; 00290 wxCheckBox *crownCheck; 00291 wxCheckBox *crystalCheck; 00292 wxCheckBox *herbCheck; 00293 wxCheckBox *keyCheck; 00294 wxCheckBox *tntCheck; 00295 wxCheckBox *adamentCheck; 00296 wxCheckBox *slabCheck; 00297 wxCheckBox *rubyCheck; 00298 wxCheckBox *rodCheck; 00299 wxCheckBox *floaterCheck; 00300 wxCheckBox *chimeCheck; 00301 wxCheckBox *tailCheck; 00302 wxCheckBox *cubeCheck; 00303 wxCheckBox *bottleCheck; 00304 wxCheckBox *oxyaleCheck; 00305 wxCheckBox *canoeCheck; 00306 wxCheckBox *fireOrbCheck; 00307 wxCheckBox *waterOrbCheck; 00308 wxCheckBox *windOrbCheck; 00309 wxCheckBox *earthOrbCheck; 00310 00311 wxTextCtrl *nameText; 00312 wxChoice *classChoice; 00313 wxChoice *conditionChoice; 00314 00315 wxTextCtrl *currentHPText; 00316 wxTextCtrl *maxHPText; 00317 wxTextCtrl *strengthText; 00318 wxTextCtrl *agilityText; 00319 wxTextCtrl *intelligenceText; 00320 wxTextCtrl *vitalityText; 00321 wxTextCtrl *luckText; 00322 wxTextCtrl *experienceText; 00323 wxTextCtrl *damageText; 00324 wxTextCtrl *hitPercentText; 00325 00326 wxChoice *weaponChoice[4]; 00327 wxCheckBox *weaponEquippedCheck[4]; 00328 00329 wxChoice *armorChoice[4]; 00330 wxCheckBox *armorEquippedCheck[4]; 00331 00332 wxSlider *currentMagicSlider[8]; 00333 wxSlider *maxMagicSlider[8]; 00334 00335 wxChoice *knownMagicChoice[8][3]; 00336 00337 wxStatusBar* statusbar; 00338 00339 /** 00340 * XPM icon used for the Frame icon. 00341 */ 00342 static const char *ICON[]; 00343 }; 00344 } 00345 00346 #endif 00347