gfx_gui_opengl.hh

Go to the documentation of this file.
00001 /*
00010  * LEGAL:   COPYRIGHT (C) 2004 JIM E. BROOKS
00011  *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
00012  *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
00013  ******************************************************************************/
00014 
00015 #ifndef GFX_GUI_OPENGL_HH
00016 #define GFX_GUI_OPENGL_HH 1
00017 
00018 #include "gfx_gui.hh"
00019 
00020 namespace gfx {
00021 
00025 class Gui : public GuiBase
00026 {
00027 
00028 typedef GuiBase Parent;
00029 public:
00030                     Gui( const Rect<int>& viewport, const Rect<int>& window );
00031                     ~Gui();
00032     void            Draw( void ) { Parent::Draw(); }
00033     Vector2         MousePos2ViewportPos( const Vector2& in );
00034 
00035 private:
00036     void            NewFonts( void );
00037     void            DeleteFonts( void );
00038 
00039 public:
00040     CLASS_CONST RGBA msRgbaButton;
00041     CLASS_CONST RGBA msRgbaButtonClicked;
00042     CLASS_CONST RGBA msRgbaButtonHilite;
00043     CLASS_CONST RGBA msRgbaButtonBg;
00044     CLASS_CONST RGBA msRgbaButtonBgHilite;
00045     CLASS_CONST RGBA msRgbaButtonInsens;
00046     CLASS_CONST RGBA msRgbaButtonBgInsens;
00047 
00048 private:
00049     // --------- actual fonts ---------------------
00050     // GL-117 font #1 with different sizes.
00051     Font*           mFontText;
00052     Font*           mFontButton;
00053     // GL-117 font #2 with different sizes.
00054     // Similar to but more narrow than font #1.
00055     Font*           mFontTextThin;
00056     // --------- actual fonts ---------------------
00057 };
00058 
00064 class GuiButton : public GuiButtonBase
00065 {
00066 
00067 typedef GuiButtonBase Parent;
00068 friend class Gui;
00069 friend class GuiBase;
00070 friend class GuiScreen;
00071 
00072 private:
00073                     GuiButton( GuiScreen& screen, fp x, fp y, eFontMode fontMode, fnMouseButtonCallback callback );
00074                     ~GuiButton();
00075     void            Draw( void );
00076     void            ResetRGBA( void );
00077 
00078 private:
00081     class Refresh
00082     {
00083     public:
00084                 Refresh( void );
00085                 ~Refresh();
00086         bool    IfStale( const GuiButton& button ) const;
00087         void    Update( const GuiButton& button );
00088     private:
00089         string          mText;
00090         Vector2         mPos;
00091         uint            mReshapeCnt;
00092     };
00093     friend class Refresh;
00094 
00095 private:
00096     Refresh             mRefresh;    
00097     Font::PrintArgs     mPrintArgs;  
00098 };
00099 
00100 } // namespace gfx
00101 
00102 #endif // GFX_GUI_OPENGL_HH
Palomino 3D Engine documents generated by doxygen 1.5.3 on Fri Nov 23 11:26:10 2007