initial version
[lsystem3d.git] / src / gui.h
diff --git a/src/gui.h b/src/gui.h
new file mode 100644 (file)
index 0000000..b5664c8
--- /dev/null
+++ b/src/gui.h
@@ -0,0 +1,99 @@
+// Copyright (C) 2006 Erik Dahlberg
+// 
+// This file is part of LSystem3d.
+// 
+// LSystem3D is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+// 
+// LSystem3D is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with LSystem3D; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+
+
+#ifndef GUI_H
+#define GUI_H
+
+#include "fx.h"
+
+#include "lindenmayersystem.h"
+#include "lsystemparameters.h"
+#include "renderingsurface.h"
+
+
+
+/**
+ * The GUI window
+ */
+class GUI : public FXMainWindow
+{
+    // macro to set up class declaration
+    FXDECLARE(GUI)
+    
+public:
+    
+    // message ID's
+    enum
+    {
+        ID_GENERATE = FXMainWindow::ID_LAST,
+        ID_LAST
+    };
+
+    /**
+     * Constructor
+     * @param application the FOX application object
+     * @param renderingSurface the rendering surface
+     * @param lsystem the Lindenmayer-system
+     */
+    GUI(FXApp *application, RenderingSurface *renderingSurface, LindenmayerSystem *lsystem);
+
+    /**
+     * Create and initialize the window
+     */
+    void create();
+
+    /**
+     * Called by the system when the "generate"-button is pressed
+     * @param sender the sender object
+     * @param selector message type and id
+     * @param data event related data
+     * @return 
+     */
+    long onGenerateButtonPressed(FXObject *sender, FXSelector selector, void *data);
+
+protected:
+    
+    /**
+     * Constructor
+     */
+    GUI() {}
+    
+private:
+    
+    // GUI widgets
+    
+    FXTextField *_axiomTextField;       // Axiom
+    FXText *_rulesText;                 // Rules
+    FXRealSpinner *_angleRealSpinner;   // Angle
+    FXSpinner *_iterationsSpinner;      // Iterations
+    
+    FXRealSpinner *_diameterRealSpinner;        // Diameter
+    FXRealSpinner *_diameterFactorRealSpinner;  // Diameter factor //TODO: "diameter factor"?
+    
+    
+    LindenmayerSystem *_lsystem;            // The Lindenmayer-system
+    LSystemParameters _lsystemParameters;   // Saves/loads l-system parameters from file
+    RenderingSurface *_renderingSurface;    // The rendering surface
+};
+
+
+
+#endif