Main Page   Class Hierarchy   Compound List   File List   Compound Members  

gfxGLWindowGLUI.h

00001 //////////////////////////////////////////////////////////////////////
00002 // Copyright (c) 2002-2003 David Pritchard <drpritch@alumni.uwaterloo.ca>
00003 // 
00004 // This program is free software; you can redistribute it and/or
00005 // modify it under the terms of the GNU Lesser General Public License
00006 // as published by the Free Software Foundation; either
00007 // version 2 of the License, or (at your option) any later
00008 // version.
00009 // 
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU Lesser General Public License for more details.
00014 // 
00015 // You should have received a copy of the GNU Lesser General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019 #ifndef freecloth_gfx_gfxGLWindowGLUI_h
00020 #define freecloth_gfx_gfxGLWindowGLUI_h
00021 
00022 #ifndef freecloth_gfx_package_h
00023 #include <freecloth/gfx/package.h>
00024 #endif
00025 
00026 #ifndef freecloth_gfx_gfxGLWindowGLUT_h
00027 #include <freecloth/gfx/gfxGLWindowGLUT.h>
00028 #endif
00029 
00030 ////////////////////////////////////////////////////////////////////////////////
00031 // FORWARD DECLARATIONS
00032 
00033 
00034 FREECLOTH_NAMESPACE_START
00035     class GeMatrix4;
00036 FREECLOTH_NAMESPACE_END
00037 
00038 ////////////////////////////////////////////////////////////////////////////////
00039 /*!
00040  * \class GfxGLWindowGLUI freecloth/gfx/gfxGLWindowGLUI.h
00041  * \brief Window class for GLUI
00042  *
00043  * GLUI has an awful C++ API, and some terrible user interface controls,
00044  * but it's the simplest portable windowing API I could find.
00045  */
00046 class GfxGLWindowGLUI : public GfxGLWindowGLUT {
00047 
00048 public:
00049 
00050     //----- types and enumerations -----
00051     typedef GfxGLWindowGLUT BaseClass;
00052     typedef UInt32 ControlID;
00053     typedef UInt32 PanelID;
00054 
00055     enum TranslateType {
00056         TR_XY,
00057         TR_X,
00058         TR_Y,
00059         TR_Z
00060     };
00061     enum EditType {
00062         EDIT_TEXT,
00063         EDIT_INT,
00064         EDIT_FLOAT
00065     };
00066     enum BorderType {
00067         BORDER_NONE,
00068         BORDER_RAISED,
00069         BORDER_EMBOSSED
00070     };
00071     enum {
00072         PANEL_NONE = ~0U,
00073         CTRL_NONE = ~0U
00074     };
00075 
00076     //----- member functions -----
00077 
00078     GfxGLWindowGLUI(
00079         const GfxConfig&,
00080         const String& title
00081     );
00082     ~GfxGLWindowGLUI();
00083 
00084     // Add UI controls
00085     void addGroup( BorderType, PanelID, PanelID parent = PANEL_NONE );
00086     void addPanel( const String& label, PanelID, PanelID parent = PANEL_NONE );
00087     void addRollout(
00088         const String& label,
00089         PanelID,
00090         bool open,
00091         PanelID parent = PANEL_NONE
00092     );
00093     void addColumn( bool showDivider = true, PanelID = PANEL_NONE );
00094     void addButton( const String& label, ControlID, PanelID = PANEL_NONE );
00095     void addRotate( const String& label, ControlID, PanelID = PANEL_NONE );
00096     void addTranslate(
00097         const String& label,
00098         TranslateType,
00099         ControlID,
00100         PanelID = PANEL_NONE
00101     );
00102     void addText(
00103         const String& label,
00104         ControlID = CTRL_NONE,
00105         PanelID = PANEL_NONE
00106     );
00107     void addEditText( const String& label, ControlID, PanelID = PANEL_NONE );
00108     void addEditInt( const String& label, ControlID, PanelID = PANEL_NONE );
00109     void addEditFloat( const String& label, ControlID, PanelID = PANEL_NONE );
00110     void addEditBox(
00111         const String& label,
00112         EditType,
00113         ControlID,
00114         PanelID = PANEL_NONE
00115     );
00116     void addCheckbox( const String& label, ControlID, PanelID = PANEL_NONE );
00117     void addRadioGroup( ControlID, PanelID = PANEL_NONE );
00118     void addRadioButton( ControlID group, const String& label );
00119 
00120     void setRotate( ControlID, const GeMatrix4& );
00121     void setTranslateX( ControlID, Float );
00122     void setTranslateY( ControlID, Float );
00123     void setTranslateZ( ControlID, Float );
00124     void setText( ControlID, const String& );
00125     void setCheckbox( ControlID, bool );
00126     void setRadioGroup( ControlID, UInt32 );
00127     void setEditText( ControlID, const String& );
00128     void setEditInt( ControlID, Int32 );
00129     void setEditFloat( ControlID, Float );
00130     void setEditIntLimits(
00131         ControlID,
00132         Int32 low,
00133         Int32 high,
00134         bool wrap = false
00135     );
00136     void setEditFloatLimits(
00137         ControlID,
00138         Float low,
00139         Float high,
00140         bool wrap = false
00141     );
00142 
00143     GeMatrix4 getRotate( ControlID ) const;
00144     Float getTranslateX( ControlID ) const;
00145     Float getTranslateY( ControlID ) const;
00146     Float getTranslateZ( ControlID ) const;
00147     bool getCheckbox( ControlID ) const;
00148     UInt32 getRadioGroup( ControlID ) const;
00149     String getEditText( ControlID ) const;
00150     Int32 getEditInt( ControlID ) const;
00151     Float getEditFloat( ControlID ) const;
00152 
00153 protected:
00154 
00155     //----- static member functions -----
00156 
00157     static void reshapeCB( int w, int h );
00158     static void controlCB( int control );
00159 
00160     //----- member functions -----
00161 
00162     virtual void registerIdleCB();
00163     virtual void registerCBs();
00164 
00165 private:
00166 
00167     //----- classes -----
00168     class Imp;
00169 
00170     //----- member functions -----
00171 
00172     // Disallowed.
00173     GfxGLWindowGLUI( const GfxGLWindowGLUI& );
00174     GfxGLWindowGLUI& operator = ( const GfxGLWindowGLUI& );
00175 
00176     //----- data members -----
00177 
00178     Imp* _imp;
00179 };
00180 
00181 #endif

Generated on Wed Apr 23 15:58:52 2003 for Freecloth by doxygen1.3-rc3