| 1 | // Copyright (C) 2006 Erik Dahlberg |
| 2 | // |
| 3 | // This file is part of LSystem3d. |
| 4 | // |
| 5 | // LSystem3D is free software; you can redistribute it and/or |
| 6 | // modify it under the terms of the GNU General Public License |
| 7 | // as published by the Free Software Foundation; either version 2 |
| 8 | // of the License, or (at your option) any later version. |
| 9 | // |
| 10 | // LSystem3D is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU General Public License |
| 16 | // along with LSystem3D; if not, write to the Free Software |
| 17 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | #ifndef GUI_H |
| 23 | #define GUI_H |
| 24 | |
| 25 | #include "fx.h" |
| 26 | |
| 27 | #include "lindenmayersystem.h" |
| 28 | #include "lsystemparameters.h" |
| 29 | #include "renderingsurface.h" |
| 30 | |
| 31 | |
| 32 | |
| 33 | /** |
| 34 | * The GUI window |
| 35 | */ |
| 36 | class GUI : public FXMainWindow |
| 37 | { |
| 38 | // macro to set up class declaration |
| 39 | FXDECLARE(GUI) |
| 40 | |
| 41 | public: |
| 42 | |
| 43 | // message ID's |
| 44 | enum |
| 45 | { |
| 46 | ID_GENERATE = FXMainWindow::ID_LAST, |
| 47 | ID_LAST |
| 48 | }; |
| 49 | |
| 50 | /** |
| 51 | * Constructor |
| 52 | * @param application the FOX application object |
| 53 | * @param renderingSurface the rendering surface |
| 54 | * @param lsystem the Lindenmayer-system |
| 55 | */ |
| 56 | GUI(FXApp *application, RenderingSurface *renderingSurface, LindenmayerSystem *lsystem); |
| 57 | |
| 58 | /** |
| 59 | * Create and initialize the window |
| 60 | */ |
| 61 | void create(); |
| 62 | |
| 63 | /** |
| 64 | * Called by the system when the "generate"-button is pressed |
| 65 | * @param sender the sender object |
| 66 | * @param selector message type and id |
| 67 | * @param data event related data |
| 68 | * @return |
| 69 | */ |
| 70 | long onGenerateButtonPressed(FXObject *sender, FXSelector selector, void *data); |
| 71 | |
| 72 | protected: |
| 73 | |
| 74 | /** |
| 75 | * Constructor |
| 76 | */ |
| 77 | GUI() {} |
| 78 | |
| 79 | private: |
| 80 | |
| 81 | // GUI widgets |
| 82 | |
| 83 | FXTextField *_axiomTextField; // Axiom |
| 84 | FXText *_rulesText; // Rules |
| 85 | FXRealSpinner *_angleRealSpinner; // Angle |
| 86 | FXSpinner *_iterationsSpinner; // Iterations |
| 87 | |
| 88 | FXRealSpinner *_diameterRealSpinner; // Diameter |
| 89 | FXRealSpinner *_diameterFactorRealSpinner; // Diameter factor //TODO: "diameter factor"? |
| 90 | |
| 91 | |
| 92 | LindenmayerSystem *_lsystem; // The Lindenmayer-system |
| 93 | LSystemParameters _lsystemParameters; // Saves/loads l-system parameters from file |
| 94 | RenderingSurface *_renderingSurface; // The rendering surface |
| 95 | }; |
| 96 | |
| 97 | |
| 98 | |
| 99 | #endif |