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

CrossControl.h

Go to the documentation of this file.
00001 #ifndef OglGui_CrossControl_h
00002 #define OglGui_CrossControl_h
00003 
00004 #ifndef OglGui_GroupBox_h
00005 #include "OglGui/GroupBox.h"
00006 #endif
00007 
00008 #ifndef OglGui_SixButtonCross_h
00009 #include "OglGui/SixButtonCross.h"
00010 #endif
00011 
00012 namespace OglGui
00013 {
00014 
00015 class CrossControl : public  Window, ButtonListener
00016 {
00017 public:
00018 
00019     CrossControl(int x, int y, int w, int h, Window* target=0, int btnNr=1,
00020                  strconst grpTitle="Control", bool extraBtn=false,
00021                  strconst extraTitle="Reset" ) :
00022         Window(x, y, w, h)
00023         {
00024                 Init(w, h, target, btnNr, grpTitle, extraBtn, extraTitle);
00025         }
00026 
00027     CrossControl(Window *parent, int w, int h, Window* target=0, int btnNr=1,
00028                  strconst grpTitle="Control", bool extraBtn=false,
00029                  strconst extraTitle="Reset") :
00030         Window(parent, w, h)
00031         {
00032                 Init(w, h, target, btnNr, grpTitle, extraBtn, extraTitle);
00033         }
00034 
00035     CrossControl(Window *parent,int x,int y,int w,int h,Window* target=0,
00036                  int btnNr=1, strconst grpTitle="Control", bool extraBtn=false,
00037                  strconst extraTitle="Reset") :
00038         Window(parent, x, y, w, h)
00039         {
00040                 Init(w, h, target, btnNr, grpTitle, extraBtn, extraTitle);
00041         }
00042 
00043     // For derived components
00044     virtual void ButtonSelectionEvent(Button *src, void* userData)
00045     {
00046     }
00047 
00048     virtual void SetTargetWindow(Window* targetWnd)
00049     {
00050         mTargetWnd = targetWnd;
00051     }
00052 
00053     void SetGroupBorderShading(ULONG brdBg, int fillShaded)
00054     {
00055         mButtonGroup->SetBorderBackground(brdBg);
00056         mButtonGroup->SetBorderFillShaded(fillShaded);
00057     }
00058 
00059     GroupBox* ButtonGroup()
00060     {
00061         return mButtonGroup;
00062     }
00063 
00064     SixButtonCross* ButtonCross()
00065     {
00066         return mButtonCross;
00067     }
00068 
00069     Button* ResetButton()
00070     {
00071         return mResetButton;
00072     }
00073 
00074 
00075 protected:
00076     Window*         mTargetWnd;
00077     GroupBox*       mButtonGroup;
00078     SixButtonCross* mButtonCross;
00079     Button*         mResetButton;
00080 
00081 private:
00082         void Init(int w, int h, Window* targetWnd, int btnNr,
00083               strconst grpTitle, bool extraBtn, strconst btnTitle)
00084         {
00085         int     m = 4;
00086         float   partH =  extraBtn ? h/5.0f : 4;
00087 
00088         SetTargetWindow(targetWnd);
00089 
00090         mButtonGroup = new GroupBox(this, m, (int)partH, w-2*m,
00091                                     (int)(h-partH-m), grpTitle, BEV_LINE, 10);
00092         mButtonCross = new SixButtonCross(mButtonGroup, 0, 0, w-2*m,
00093                                           (int)(h-partH-m-16), BEV_RAISED);
00094         InitCross(mButtonCross, btnNr);
00095 
00096         mResetButton = 0;
00097         if (extraBtn && btnTitle != "")
00098         {
00099             mResetButton = new Button(this, m, m, w-2*m, (int)(partH-2*m),
00100                                       btnTitle, BEV_LINE, false);
00101             mResetButton->SetButtonListener(this, (void*)(btnNr+6));
00102         }
00103         ScaleChildren(0,true);
00104         SetAllowChildScaling(false);
00105         }
00106 
00107     void
00108     InitCross(SixButtonCross* cross, int startId)
00109     {
00110         for (int i=0 ; i<6 ; i++)
00111         {
00112             cross->Btn(i)->SetButtonListener(this, (void*)(startId + i));
00113             cross->Btn(i)->SetRepeatMode(true);
00114         }
00115     }
00116 };
00117 
00118 } // namespace OglGui
00119 
00120 #endif

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