Gui.h

Go to the documentation of this file.
00001 #ifndef GUI_H_
00002 #define GUI_H_
00003 
00004 #include <QMainWindow>
00005 #include <QDockWidget>
00006 #include <QStack>
00007 
00008 #include <common/common.h>
00009 
00010 class  Canvas;
00011 class  CanvasContainer;
00012 struct ParseData;
00013 
00014 /// Top level GUI application
00015 class Gui : public QMainWindow {
00016    Q_OBJECT
00017    
00018    public:
00019       // Expects four characters to be passed in
00020       inline explicit Gui(const std::string &title = "Milton Renderer")
00021       {
00022          _init(title);
00023          
00024          show();
00025       }
00026       
00027       virtual ~Gui()
00028       { }
00029       
00030       /// Add a canvas to the GUI with a default title
00031       void addCanvas(Canvas *canvas);
00032       /// Add a canvas to the GUI with the provided title
00033       void addCanvas(Canvas *canvas, const char *title);
00034       /// Load a scene with the given filename, returns a bool
00035       /// and SceneData (out argument)
00036       //bool loadScene(const char *sceneFile, ParseData &outData);
00037       
00038    public slots:
00039       void loadPressed();
00040       void savePressed();
00041       void renderPressed();
00042       
00043       void drawModeChanged();
00044       void enableAccelPreviewChanged();
00045       void enableDefaultLightingChanged();
00046       void selectComboBox(int);
00047       
00048    signals:
00049       void drawModeChanged(int style);
00050       void render();
00051       
00052    protected:
00053       void _init(const std::string &title);
00054       void _redrawAll();
00055       Canvas *_getActiveCanvas(const char *text);
00056       
00057    private:
00058       QStack<CanvasContainer *> m_canvases;
00059       QAction *m_wire;
00060       QAction *m_enableAccelPreview;
00061       QAction *m_enableDefaultLighting;
00062       int      m_selectedCombo;
00063       std::string m_lastSaved;
00064 };
00065 
00066 class CanvasContainer : public QDockWidget {
00067    
00068    Q_OBJECT
00069    
00070    public:
00071       CanvasContainer(Canvas *canvas, const char* title = NULL);
00072       virtual ~CanvasContainer();
00073       
00074       Canvas *getCanvas() const;
00075       char   *getTitle()  const;
00076       
00077    private slots:
00078       void synchronizeSize(int, int);
00079    
00080    protected:
00081       void setupContainer();
00082       
00083       // @overridden from QWidget
00084       virtual QSize sizeHint() const;
00085       virtual QSize minimumSize() const;
00086       virtual QSize maximumSize() const;
00087       
00088       Canvas *m_canvas;
00089       QString m_title;
00090 };
00091 
00092 #endif // GUI_H_
00093 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6