00001 #ifndef OglGui_SixButtonCross_h
00002 #define OglGui_SixButtonCross_h
00003
00004 #ifndef OglGui_Button_h
00005 #include "OglGui/Button.h"
00006 #endif
00007
00008 namespace OglGui
00009 {
00010
00011 class SixButtonCross : public Window
00012 {
00013 public:
00014
00015 SixButtonCross(int x, int y, int w, int h, int btnBrdType=BEV_RAISED,
00016 int brdType=0, int margin=4) :
00017 Window(x, y, w, h)
00018 {
00019 Init(w, h, brdType, btnBrdType, margin);
00020 }
00021
00022 SixButtonCross(Window* parent, int x, int y, int w, int h,
00023 int btnBrdType=BEV_RAISED, int brdType=0, int margin=4) :
00024 Window(parent, x, y, w, h)
00025 {
00026 Init(w, h, brdType, btnBrdType, margin);
00027 }
00028
00029 void SetTexts(strconst s0, strconst s1, strconst s2,
00030 strconst s3, strconst s4, strconst s5)
00031 {
00032 mButtons[0]->SetText(s0);
00033 mButtons[1]->SetText(s1);
00034 mButtons[2]->SetText(s2);
00035 mButtons[3]->SetText(s3);
00036 mButtons[4]->SetText(s4);
00037 mButtons[5]->SetText(s5);
00038 }
00039
00040 Button* Btn(int id) const
00041 {
00042 if(id<0 || id>5)
00043 return 0;
00044 return mButtons[id];
00045 }
00046
00047 void SetBtnBorderType(int type)
00048 {
00049 for (int i=0; i<6; i++)
00050 mButtons[i]->SetBorderType(type);
00051 }
00052
00053 void SetBtnBorderFillShaded(int type)
00054 {
00055 for (int i=0; i<6; i++)
00056 mButtons[i]->SetBorderFillShaded(type);
00057 }
00058
00059 private:
00060 Button* mButtons[6];
00061
00062 void Init(int w, int h, int brdType, int btnT, int margin)
00063 {
00064 int sX = (w-2*margin)/3;
00065 int sY = (h-2*margin)/3;
00066 int x = margin;
00067 int y = margin;
00068
00069 SetBorderType(brdType);
00070
00071 mButtons[0] = new Button(this,x+sX, y+3*sY/2,sX, sY/2, "F", btnT,true);
00072 mButtons[1] = new Button(this,x+sX, y+sY, sX, sY/2, "B", btnT,true);
00073 mButtons[2] = new Button(this,x, y+sY, sX, sY, "L", btnT,true);
00074 mButtons[3] = new Button(this,x+2*sX,y+sY, sX, sY, "R", btnT,true);
00075 mButtons[4] = new Button(this,x+sX, y+2*sY, sX, sY, "U", btnT,true);
00076 mButtons[5] = new Button(this,x+sX, y, sX, sY, "D", btnT,true);
00077 ScaleChildren();
00078 SetAllowChildScaling(false);
00079 }
00080 };
00081
00082 }
00083 #endif