From: spixx Date: Sun, 26 Nov 2006 13:50:59 +0000 (+0000) Subject: Added File and Help menus. X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3ef0adbfd26e9398df310dc0a1afd93a90f63855;p=lsystem3d.git Added File and Help menus. Minor cleanup. --- diff --git a/src/gui.h b/src/gui.h index 1eae6e0..6f809ec 100644 --- a/src/gui.h +++ b/src/gui.h @@ -22,12 +22,16 @@ #ifndef GUI_H #define GUI_H +#include + #include "fx.h" #include "lindenmayersystem.h" #include "lsystemparameters.h" #include "renderingsurface.h" +using namespace std; + /** @@ -44,23 +48,35 @@ public: enum { ID_GENERATE = FXMainWindow::ID_LAST, - ID_HELP, + ID_LOAD, + ID_SAVE, + ID_QUIT, + ID_HELP_USAGE, + ID_HELP_RULES, ID_LAST }; - + + /** * Constructor - * @param application the FOX application object + * @param application the application object * @param renderingSurface the rendering surface - * @param lsystem the Lindenmayer-system + * @param lsystem the Lindenmayer system generator */ GUI(FXApp *application, RenderingSurface *renderingSurface, LindenmayerSystem *lsystem); - + + /** + * Destructor + */ + virtual ~GUI(); + + /** * Create and initialize the window */ - void create(); - + virtual void create(); + + /** * Called by the system when the "Generate" button is pressed * @param sender the sender object @@ -68,16 +84,52 @@ public: * @param data event related data * @return */ - long onGenerateButtonPressed(FXObject *sender, FXSelector selector, void *data); - + long onGenerate(FXObject *sender, FXSelector selector, void *data); + + /** + * Called by the system when the File->Load menu command is selected + * @param sender the sender object + * @param selector message type and id + * @param data event related data + * @return + */ + long onLoad(FXObject *sender, FXSelector selector, void *data); + /** - * Called by the system when the "Help" button is pressed + * Called by the system when the File->Save menu command is selected * @param sender the sender object * @param selector message type and id * @param data event related data * @return */ - long onHelpButtonPressed(FXObject *sender, FXSelector selector, void *data); + long onSave(FXObject *sender, FXSelector selector, void *data); + + /** + * Called by the system when the close button or the File->Quit menu command is selected + * @param sender the sender object + * @param selector message type and id + * @param data event related data + * @return + */ + long onQuit(FXObject *sender, FXSelector selector, void *data); + + /** + * Called by the system when the Help->Usage menu command is selected + * @param sender the sender object + * @param selector message type and id + * @param data event related data + * @return + */ + long onHelpUsage(FXObject *sender, FXSelector selector, void *data); + + /** + * Called by the system when the Help->Rules menu command is selected + * @param sender the sender object + * @param selector message type and id + * @param data event related data + * @return + */ + long onHelpRules(FXObject *sender, FXSelector selector, void *data); protected: @@ -86,10 +138,19 @@ protected: */ GUI() {} -private: + + /** + * Load L-system from file and sync with GUI + * @param filename path of the L-system file + */ + void loadLSystem(string filename); + // GUI widgets + FXMenuPane *_fileMenuPane; // File menu + FXMenuPane *_helpMenuPane; // Help menu + FXTextField *_axiomTextField; // Axiom FXText *_rulesText; // Rules FXRealSpinner *_angleRealSpinner; // Angle @@ -98,11 +159,12 @@ private: FXRealSpinner *_diameterRealSpinner; // Diameter FXRealSpinner *_diameterFactorRealSpinner; // Diameter factor - FXMessageBox *_helpMessageBox; // Help dialog + FXMessageBox *_helpUsageMessageBox; // Usage help dialog + FXMessageBox *_helpRulesMessageBox; // Rules help dialog - LindenmayerSystem *_lsystem; // The Lindenmayer-system - LSystemParameters _lsystemParameters; // Saves/loads l-system parameters from file + LindenmayerSystem *_lsystem; // The Lindenmayer system generator + LSystemParameters _lsystemParameters; // Saver and loader for L-system parameters RenderingSurface *_renderingSurface; // The rendering surface };