Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

GroupBox.h

Go to the documentation of this file.
00001 #ifndef OglGui_GroupBox_h
00002 #define OglGui_GroupBox_h
00003 
00004 #ifndef OglGui_Window_h
00005 #include "OglGui/Window.h"
00006 #endif
00007 
00008 namespace OglGui
00009 {
00010 
00011 class GroupBox: public Window
00012 {
00013 public:
00014 
00015     GroupBox(int x, int y, int w, int h, strconst label,
00016              int borderType=BEV_ETCHED, float roundness=0)
00017         : Window(x, y, w, h, true)
00018     {
00019         Init(label, borderType, roundness);
00020     }
00021 
00022     GroupBox(Window* parent, int w, int h, strconst label,
00023              int borderType=BEV_ETCHED, float roundness=0)
00024         : Window(parent, w, h, true)
00025     {
00026         Init(label, borderType, roundness);
00027     }
00028 
00029     GroupBox(Window* parent, int x, int y, int w, int h, strconst label,
00030              int borderType=BEV_ETCHED, float roundness=0)
00031         : Window(parent, x, y, w, h, true)
00032     {
00033         Init(label, borderType, roundness);
00034     }
00035 
00036     void SetText(strconst txt)
00037     {
00038         mLabel = txt;
00039     }
00040 
00041     // specialization of base classes
00042 
00043     virtual void DisplayFunc()
00044     {
00045         int     wndH = mOglWnd->height;
00046         int     tW, tH;
00047 
00048         Window::DisplayFunc();
00049 
00050         OGC oldOGC;
00051         OGCSave(&oldOGC);
00052 
00053         oglSys.GetTextExtent(mOglWnd, (char *) mLabel.c_str(), &tW, &tH);
00054         if (mDoTextShadow)
00055             oglSys.ShadowPrintf(mOglWnd, 12, wndH-tH, mShadowColor,
00056                                 GetForeground(), "%s", (char *) mLabel.c_str());
00057         else
00058             oglSys.PosColPrintf(mOglWnd, 12, wndH-tH, GetForeground(),
00059                                 "%s", (char *) mLabel.c_str());
00060 
00061         OGCRestore(&oldOGC);
00062     }
00063 
00064 private:
00065 
00066     void Init(strconst label, int borderType, float r)
00067     {
00068         if (r != 0.0f)
00069             SetRoundness(r, r, r, r);
00070 
00071         mLabel = label;
00072         mDoTextShadow = true;
00073         mShadowColor = oglLIGHTGREY;
00074 
00075         SetBorderType(borderType);
00076         SetDisableOGLViewKeys(true);
00077         SetDisableOGLViewMouse(true);
00078     }
00079 
00080     std::string mLabel;
00081     bool        mDoTextShadow;
00082     ULONG       mShadowColor;
00083 
00084 };
00085 
00086 } // namespace OglGui
00087 
00088 #endif // GroupBox_h

Generated on Fri Mar 19 09:31:35 2010 for ImpalaSrc by  doxygen 1.5.1