mainframe.hh

Go to the documentation of this file.
00001 /*
00002  * dwsrame - Dragon Warrior SRAM Editor
00003  * Copyright (C) 2006-2007 emuWorks
00004  * http://games.technoplaza.net/
00005  *
00006  * This file is part of dwsrame.
00007  *
00008  * dwsrame is free software; you can redistribute it and/or modify it under the
00009  * terms of the GNU General Public License as published by the Free Software
00010  * Foundation; either version 2 of the License, or (at your option) any later
00011  * version.
00012  *
00013  * dwsrame is distributed in the hope that it will be useful, but WITHOUT ANY
00014  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00015  * A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License along with
00018  * dwsrame; if not, write to the Free Software Foundation, Inc.,
00019  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00020  */
00021 
00022 // $Id: mainframe.hh,v 1.15 2007/02/03 02:09:00 technoplaza Exp $
00023 
00024 #ifndef _DWSRAME_MAINFRAME_HH_
00025 #define _DWSRAME_MAINFRAME_HH_
00026 
00027 namespace dwsrame {
00028     class SRAMFile;
00029     
00030     /// The main frame for the application
00031     class MainFrame : public wxFrame {
00032         DECLARE_CLASS(MainFrame)
00033         DECLARE_EVENT_TABLE()
00034         
00035         friend class SRAMFileTarget;
00036         
00037     private:
00038         wxString sramFile;
00039         SRAMFile *sram;
00040         bool enableEvents;
00041         
00042         /**
00043          * Closes the current SRAM file.
00044          *
00045          * @return true if the file was closed; false otherwise.
00046          */
00047         bool closeSRAM();
00048         
00049         /**
00050          * Loads game data from the SRAM.
00051          *
00052          * @param game The game slot to load.
00053          */
00054         void loadGame(int game);
00055     
00056         /**
00057          * Loads the XRC controls and initializes this MainFrame.
00058          */
00059         void loadXRC();
00060         
00061         /**
00062          * Opens a Dragon Warrior SRAM file for editing.
00063          *
00064          * @param filename The filename to open.
00065          */
00066         void openSRAM(const wxString &filename);
00067         
00068         /**
00069          * Saves the current SRAM to disk.
00070          *
00071          * @return true if the SRAM was saved; false otherwise.
00072          */
00073         bool saveSRAM();
00074         
00075         /**
00076          * Checks the fields for valid data.
00077          *
00078          * @return true if all the fields are valid; false otherwise.
00079          */
00080         bool hasValidData();
00081         
00082         /**
00083          * Called when the hero's armor is changed.
00084          */
00085         void onArmorChange(wxCommandEvent &);
00086         
00087         /**
00088          * Called when the frame is about to be closed.
00089          *
00090          * @param event The triggering wxCloseEvent.
00091          */
00092         void onClose(wxCloseEvent &event);
00093         
00094         /**
00095          * Called when the hero's experience is changed.
00096          */
00097         void onExperienceEdit(wxCommandEvent &);
00098         
00099         /**
00100          * Called when the file menu's close command is triggered.
00101          */
00102         void onFileClose(wxCommandEvent &);
00103         
00104         /**
00105          * Called when the file menu's exit command is triggered.
00106          */
00107         void onFileExit(wxCommandEvent &);
00108         
00109         /**
00110          * Called to set the state of the file menu.
00111          *
00112          * @param event The triggering wxUpdateUIEvent.
00113          */
00114         void onFileMenuUpdate(wxUpdateUIEvent &event);
00115         
00116         /**
00117          * Called when the file menu's open command is triggered.
00118          */
00119         void onFileOpen(wxCommandEvent &);
00120         
00121         /**
00122          * Called when the file menu's save command is triggered.
00123          */
00124         void onFileSave(wxCommandEvent &);
00125         
00126         /**
00127          * Called when the file menu's save as command is triggered.
00128          */
00129         void onFileSaveAs(wxCommandEvent &);
00130         
00131         /**
00132          * Called to set the state of the game menu.
00133          *
00134          * @param event The triggering wxUpdateUIEvent.
00135          */
00136         void onGameMenuUpdate(wxUpdateUIEvent &event);
00137         
00138         /**
00139          * Called when one of the game slots from the game menu is selected.
00140          *
00141          * @param event The triggering wxCommandEvent.
00142          */
00143         void onGameSelect(wxCommandEvent &event);
00144         
00145         /**
00146          * Called when the hero's gold is changed.
00147          */
00148         void onGoldEdit(wxCommandEvent &);
00149         
00150         /**
00151          * Called when Gwaelin's location is changed.
00152          */
00153         void onGwaelinChange(wxCommandEvent &);
00154         
00155         /**
00156          * Called when the help menu's about command is triggered.
00157          */
00158         void onHelpAbout(wxCommandEvent &);
00159         
00160         /**
00161          * Called when the hero's herbs are changed.
00162          */
00163         void onHerbsEdit(wxCommandEvent &);
00164         
00165         /**
00166          * Called when the hero's HP is changed.
00167          */
00168         void onHPEdit(wxCommandEvent &);
00169         
00170         /**
00171          * Called when one of the hero's inventory items is changed.
00172          *
00173          * @param event The triggering wxCommandEvent.
00174          */
00175         void onInventoryChange(wxCommandEvent &event);
00176         
00177         /**
00178          * Called when the hero's keys are changed.
00179          */
00180         void onKeysEdit(wxCommandEvent &);
00181         
00182         /**
00183          * Called when the hero's MP is changed.
00184          */
00185         void onMPEdit(wxCommandEvent &);
00186         
00187         /**
00188          * Called when the hero's name is changed.
00189          */
00190         void onNameEdit(wxCommandEvent &);
00191         
00192         /**
00193          * Called when one of the quest markers is changed.
00194          *
00195          * @param event The triggering wxCommandEvent.
00196          */
00197         void onQuestMarkerChange(wxCommandEvent &event);
00198         
00199         /**
00200          * Called when the hero's shield is changed.
00201          */
00202         void onShieldChange(wxCommandEvent &);
00203         
00204         /**
00205          * Called when the hero's weapon is changed.
00206          */
00207         void onWeaponChange(wxCommandEvent &);
00208         
00209     public:
00210         /**
00211          * Creates a new MainFrame.
00212          */
00213         MainFrame();
00214     };
00215     
00216     inline void MainFrame::onFileClose(wxCommandEvent &)
00217         { closeSRAM(); }
00218     
00219     inline void MainFrame::onFileExit(wxCommandEvent &)
00220         { Close(); }
00221         
00222     inline void MainFrame::onFileSave(wxCommandEvent &)
00223         { saveSRAM(); }
00224 }
00225 
00226 #endif
00227 

Generated on Sun Feb 18 02:57:55 2007 for dwsrame by  doxygen 1.5.1-p1