00001
00002
00003
00004
00005 #ifndef OglGui_Columns_h
00006 #define OglGui_Columns_h
00007
00008 #ifndef OglGui_ColumnHeaders_h
00009 #include "OglGui/ColumnHeaders.h"
00010 #endif
00011
00012 namespace OglGui {
00013
00014 class Columns : public Window
00015 {
00016 public:
00017 Columns(int x, int y, int w, int h) :
00018 Window(x,y,w,h)
00019 {
00020 Init(120,24);
00021 }
00022
00023 Columns(Window* parent, int w, int h) :
00024 Window(parent,w,h)
00025 {
00026 Init(120,24);
00027 }
00028
00029 Columns(Window* parent, int x, int y, int w, int h) :
00030 Window(parent,x,y,w,h)
00031 {
00032 Init(120,24);
00033 }
00034
00035 ColumnHeaders* Headers() { return mHeaders; }
00036 SizableStaticText* Header(int idx) { return mHeaders->Header(idx); }
00037 SizableStaticText* Header(strconst str) { return mHeaders->Header(str); }
00038
00039 SizableStaticText*
00040 CreateHeader(strconst label, int labelW = -1)
00041 {
00042 return mHeaders->CreateHeader(label,labelW);
00043 }
00044
00045 Window* CreateColumn(strconst str, int labelW=-1)
00046 {
00047 Window* wnd = new Window(this,0,0,40,40);
00048 CreateColumn(wnd, str, labelW);
00049 return wnd;
00050 }
00051
00052
00053 void CreateColumn(Window* wnd, strconst str, int labelW=-1)
00054 {
00055 if (labelW==-1)
00056 labelW = mLabelWidth;
00057
00058 SizableStaticText* colHdr = mHeaders->CreateHeader(str,labelW);
00059
00060 int hdrH = mHeaders->H();
00061 wnd->SetDimensions(colHdr->X(),0,labelW,H()-hdrH);
00062 wnd->ConnectTo(mHeaders,T2B);
00063 wnd->ConnectTo(colHdr,L2L|R2R);
00064 }
00065
00066 protected:
00067 ColumnHeaders* mHeaders;
00068 int mLabelWidth;
00069 int mLabelHeight;
00070
00071 private:
00072 void Init(int labelW, int labelH)
00073 {
00074 mLabelWidth = labelW;
00075 mLabelHeight = labelH;
00076 mHeaders = new ColumnHeaders(this,0,H()-labelH,W(),labelH);
00077 mHeaders->ConnectTo(this,L2L|R2R|B2T|T2T);
00078 SetBorderType(BEV_ETCHED);
00079 }
00080 };
00081
00082 }
00083 #endif
00084