- enum
- {
- WINDOW = 0,
- SEPARATOR
- };
-
- // wxWindow constructor. This initialises the class as a wxWindow type
- wxFoldWindowItem(wxWindow *wnd, int flags = wxFPB_ALIGN_WIDTH, int ySpacing = wxFPB_DEFAULT_YSPACING,
- int leftSpacing = wxFPB_DEFAULT_LEFTSPACING, int rightSpacing = wxFPB_DEFAULT_RIGHTSPACING)
- : _wnd(wnd)
- , _type(WINDOW)
- , _ySpacing(ySpacing)
- , _leftSpacing(leftSpacing)
- , _rightSpacing(rightSpacing)
- , _flags(flags)
- , _lineWidth(0)
- , _lineY(0)
- {
- };
-
- // separator constructor. This initialises the class as a separator type
- wxFoldWindowItem(int y, const wxColour &lineColor = *wxBLACK, int ySpacing = wxFPB_DEFAULT_YSPACING,
- int leftSpacing = wxFPB_DEFAULT_LEFTLINESPACING,
- int rightSpacing = wxFPB_DEFAULT_RIGHTLINESPACING)
- : _wnd(0)
- , _type(SEPARATOR)
- , _ySpacing(ySpacing)
- , _leftSpacing(leftSpacing)
- , _rightSpacing(rightSpacing)
- , _flags(wxFPB_ALIGN_WIDTH)
- , _sepLineColour(lineColor)
- , _lineWidth(0)
- , _lineY(y)
- {
- };
-
- // TODO: Make a c'tor for a captioned splitter
-
- int GetType() const {
- return _type;
- };
-
- int GetLineY() const {
- return _lineY;
- };
-
- int GetLineWidth() const {
- return _lineWidth;
- };
-
- const wxColour &GetLineColour() const {
- return _sepLineColour;
- };
-
- int GetLeftSpacing() const {
- return _leftSpacing;
- };
-
- int GetRightSpacing() const {
- return _rightSpacing;
- };
-
- int GetYSpacing() const {
- return _ySpacing;
- };
-
- // returns the window height if type is wxFoldWindowItem::WINDOW
- // and returns the total size plus the extra spacing
-
- int GetWindowHeight() const {
- int value = 0;
- if(_type == WINDOW)
- {
- wxCHECK(_wnd, 0);
- wxSize size = _wnd->GetSize();
- value = size.GetHeight() + _ySpacing;
- }
- else if(_type == SEPARATOR)
- value = 1 + _ySpacing;
-
- return value;
- };
-
- // resize the element, whatever it is. A separator or
- // line will be always alligned by width
-
- void ResizeItem(int width) {
- if((_flags & wxFPB_ALIGN_WIDTH))
- {
- // allign by taking full width
- int myWidth = width - _leftSpacing - _rightSpacing;
-
- if(myWidth < 0)
- myWidth = 10; // can't have negative width
-
- if(_type == SEPARATOR)
- _lineWidth = myWidth;
- else
- {
- wxCHECK2(_wnd, return);
- _wnd->SetSize(wxSize(myWidth, -1));
- }
- }
- };
+ enum
+ {
+ WINDOW = 0,
+ SEPARATOR
+ };
+
+ // wxWindow constructor. This initialises the class as a wxWindow type
+ wxFoldWindowItem(wxWindow *wnd, int flags = wxFPB_ALIGN_WIDTH, int ySpacing = wxFPB_DEFAULT_YSPACING,
+ int leftSpacing = wxFPB_DEFAULT_LEFTSPACING, int rightSpacing = wxFPB_DEFAULT_RIGHTSPACING)
+ : _wnd(wnd)
+ , _type(WINDOW)
+ , _flags(flags)
+ , _leftSpacing(leftSpacing)
+ , _rightSpacing(rightSpacing)
+ , _ySpacing(ySpacing)
+ , _lineWidth(0)
+ , _lineY(0)
+ {
+ };
+
+ // separator constructor. This initialises the class as a separator type
+ wxFoldWindowItem(int y, const wxColour &lineColor = *wxBLACK, int ySpacing = wxFPB_DEFAULT_YSPACING,
+ int leftSpacing = wxFPB_DEFAULT_LEFTLINESPACING,
+ int rightSpacing = wxFPB_DEFAULT_RIGHTLINESPACING)
+ : _wnd(0)
+ , _type(SEPARATOR)
+ , _flags(wxFPB_ALIGN_WIDTH)
+ , _leftSpacing(leftSpacing)
+ , _rightSpacing(rightSpacing)
+ , _ySpacing(ySpacing)
+ , _lineWidth(0)
+ , _lineY(y)
+ , _sepLineColour(lineColor)
+ {
+ };
+
+ // TODO: Make a c'tor for a captioned splitter
+
+ int GetType() const {
+ return _type;
+ };
+
+ int GetLineY() const {
+ return _lineY;
+ };
+
+ int GetLineWidth() const {
+ return _lineWidth;
+ };
+
+ const wxColour &GetLineColour() const {
+ return _sepLineColour;
+ };
+
+ int GetLeftSpacing() const {
+ return _leftSpacing;
+ };
+
+ int GetRightSpacing() const {
+ return _rightSpacing;
+ };
+
+ int GetYSpacing() const {
+ return _ySpacing;
+ };
+
+ // returns the window height if type is wxFoldWindowItem::WINDOW
+ // and returns the total size plus the extra spacing
+
+ int GetWindowHeight() const {
+ int value = 0;
+ if(_type == WINDOW)
+ {
+ wxCHECK(_wnd, 0);
+ wxSize size = _wnd->GetSize();
+ value = size.GetHeight() + _ySpacing;
+ }
+ else if(_type == SEPARATOR)
+ value = 1 + _ySpacing;
+
+ return value;
+ };
+
+ // resize the element, whatever it is. A separator or
+ // line will be always alligned by width
+
+ void ResizeItem(int width) {
+ if((_flags & wxFPB_ALIGN_WIDTH))
+ {
+ // allign by taking full width
+ int myWidth = width - _leftSpacing - _rightSpacing;
+
+ if(myWidth < 0)
+ myWidth = 10; // can't have negative width
+
+ if(_type == SEPARATOR)
+ _lineWidth = myWidth;
+ else
+ {
+ wxCHECK2(_wnd, return);
+ _wnd->SetSize(wxSize(myWidth, wxDefaultCoord));
+ }
+ }
+ };