wxFoldBar now also horizontal (with API methods renamed to mean length rather than height) and more with wxWidgets coding standards. Sample adjustement to changing orientation.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
// Name: captionbar.h
|
||||
// Purpose: wxFoldPanel
|
||||
// Author: Jorgen Bodde
|
||||
// Modified by:
|
||||
// Modified by: ABX - 19/12/2004 : possibility of horizontal orientation
|
||||
// : wxWidgets coding standards
|
||||
// Created: 22/06/2004
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Jorgen Bodde
|
||||
@@ -27,44 +28,44 @@
|
||||
|
||||
enum
|
||||
{
|
||||
/** Specifies the bars as gradient vertical filled caption bars going from top to bottom. The gradient
|
||||
/** Specifies the bars as gradient vertical filled caption bars going from top to bottom. The gradient
|
||||
starts with first colour, and ends with second colour */
|
||||
wxCAPTIONBAR_GRADIENT_V = 1,
|
||||
/** Specifies the gradient going from left to right. The gradient starts with first colour, and
|
||||
/** Specifies the gradient going from left to right. The gradient starts with first colour, and
|
||||
ends with second colour on the right */
|
||||
wxCAPTIONBAR_GRADIENT_H,
|
||||
/** Fills the captionbar with a single colour. The first colour is used for this fill */
|
||||
wxCAPTIONBAR_SINGLE,
|
||||
/** Draws a rectangle only using the second colour. The first colour is not used*/
|
||||
wxCAPTIONBAR_RECTANGLE,
|
||||
/** Fills the captionbar with a single colour (first colour) and draws a rectangle around it
|
||||
/** Fills the captionbar with a single colour (first colour) and draws a rectangle around it
|
||||
using the second colour. */
|
||||
wxCAPTIONBAR_FILLED_RECTANGLE
|
||||
};
|
||||
|
||||
/** \class wxCaptionBarStyle
|
||||
This class encapsulates the styles you wish to set for the wxCaptionBar (this is the part of the wxFoldPanel
|
||||
where the caption is displayed). It can either be applied at creation time be reapplied when styles need to
|
||||
be changed.
|
||||
|
||||
At construction time, all styles are set to their default transparency. This means none of the styles will be
|
||||
This class encapsulates the styles you wish to set for the wxCaptionBar (this is the part of the wxFoldPanel
|
||||
where the caption is displayed). It can either be applied at creation time be reapplied when styles need to
|
||||
be changed.
|
||||
|
||||
At construction time, all styles are set to their default transparency. This means none of the styles will be
|
||||
applied to the wxCaptionBar in question, meaning it will be created using the default internals. When setting i.e
|
||||
the color, font or panel style, these styles become active to be used.
|
||||
the color, font or panel style, these styles become active to be used.
|
||||
*/
|
||||
class wxCaptionBarStyle
|
||||
{
|
||||
private:
|
||||
// boolean flags for default transparency on styles
|
||||
bool _firstColourUsed,
|
||||
_secondColourUsed,
|
||||
_textColourUsed,
|
||||
_captionFontUsed,
|
||||
_captionStyleUsed;
|
||||
bool m_firstColourUsed,
|
||||
m_secondColourUsed,
|
||||
m_textColourUsed,
|
||||
m_captionFontUsed,
|
||||
m_captionStyleUsed;
|
||||
|
||||
wxFont _captionFont;
|
||||
wxColour _firstColour, _secondColour, _textColour;
|
||||
wxFont m_captionFont;
|
||||
wxColour m_firstColour, m_secondColour, m_textColour;
|
||||
|
||||
int _captionStyle;
|
||||
int m_captionStyle;
|
||||
|
||||
public:
|
||||
/** Default constructor for this class */
|
||||
@@ -77,41 +78,41 @@ public:
|
||||
};
|
||||
|
||||
void ResetDefaults() {
|
||||
_firstColourUsed = false;
|
||||
_secondColourUsed = false;
|
||||
_textColourUsed = false;
|
||||
_captionFontUsed = false;
|
||||
_captionStyleUsed = false;
|
||||
_captionStyle = wxCAPTIONBAR_GRADIENT_V;
|
||||
m_firstColourUsed = false;
|
||||
m_secondColourUsed = false;
|
||||
m_textColourUsed = false;
|
||||
m_captionFontUsed = false;
|
||||
m_captionStyleUsed = false;
|
||||
m_captionStyle = wxCAPTIONBAR_GRADIENT_V;
|
||||
};
|
||||
|
||||
/** Copy operator. Only the styles in use in the source object are being copied to the destination object. All other
|
||||
|
||||
/** Copy operator. Only the styles in use in the source object are being copied to the destination object. All other
|
||||
styles are not copied */
|
||||
void operator=(const wxCaptionBarStyle &s) {
|
||||
if(s._captionStyleUsed)
|
||||
if(s.m_captionStyleUsed)
|
||||
{
|
||||
_captionStyleUsed = true;
|
||||
_captionStyle = s._captionStyle;
|
||||
m_captionStyleUsed = true;
|
||||
m_captionStyle = s.m_captionStyle;
|
||||
}
|
||||
if(s._captionFontUsed)
|
||||
if(s.m_captionFontUsed)
|
||||
{
|
||||
_captionFontUsed = true;
|
||||
_captionFont = s._captionFont;
|
||||
m_captionFontUsed = true;
|
||||
m_captionFont = s.m_captionFont;
|
||||
}
|
||||
if(s._firstColourUsed)
|
||||
if(s.m_firstColourUsed)
|
||||
{
|
||||
_firstColourUsed = true;
|
||||
_firstColour = s._firstColour;
|
||||
m_firstColourUsed = true;
|
||||
m_firstColour = s.m_firstColour;
|
||||
}
|
||||
if(s._secondColourUsed)
|
||||
if(s.m_secondColourUsed)
|
||||
{
|
||||
_secondColourUsed = true;
|
||||
_secondColour = s._secondColour;
|
||||
m_secondColourUsed = true;
|
||||
m_secondColour = s.m_secondColour;
|
||||
}
|
||||
if(s._textColourUsed)
|
||||
if(s.m_textColourUsed)
|
||||
{
|
||||
_textColourUsed = true;
|
||||
_textColour = s._textColour;
|
||||
m_textColourUsed = true;
|
||||
m_textColour = s.m_textColour;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -120,94 +121,94 @@ public:
|
||||
/** Set font for the caption bar. If this is not set, the font property is undefined
|
||||
and will not be used. Use CaptionFontUsed() to check if this style is used */
|
||||
void SetCaptionFont(const wxFont &font) {
|
||||
_captionFont = font;
|
||||
_captionFontUsed = true;
|
||||
m_captionFont = font;
|
||||
m_captionFontUsed = true;
|
||||
};
|
||||
|
||||
/** Checks if the caption bar font is set */
|
||||
bool CaptionFontUsed() const {
|
||||
return _captionFontUsed;
|
||||
return m_captionFontUsed;
|
||||
};
|
||||
|
||||
/** Returns the font for the caption bar. Please be warned this will result in an assertion failure when
|
||||
this property is not previously set
|
||||
this property is not previously set
|
||||
\sa SetCaptionFont(), CaptionFontUsed() */
|
||||
wxFont GetCaptionFont() const {
|
||||
wxASSERT(_captionFontUsed);
|
||||
return _captionFont;
|
||||
wxASSERT(m_captionFontUsed);
|
||||
return m_captionFont;
|
||||
};
|
||||
|
||||
// ------- FirstColour -------
|
||||
|
||||
/** Set first colour for the caption bar. If this is not set, the colour property is
|
||||
undefined and will not be used. Use FirstColourUsed() to check if this
|
||||
/** Set first colour for the caption bar. If this is not set, the colour property is
|
||||
undefined and will not be used. Use FirstColourUsed() to check if this
|
||||
style is used */
|
||||
void SetFirstColour(const wxColour &col) {
|
||||
_firstColour = col;
|
||||
_firstColourUsed = true;
|
||||
m_firstColour = col;
|
||||
m_firstColourUsed = true;
|
||||
};
|
||||
|
||||
/** Checks if the first colour of the caption bar is set */
|
||||
bool FirstColourUsed() const {
|
||||
return _firstColourUsed;
|
||||
return m_firstColourUsed;
|
||||
};
|
||||
|
||||
/** Returns the first colour for the caption bar. Please be warned this will
|
||||
/** Returns the first colour for the caption bar. Please be warned this will
|
||||
result in an assertion failure when this property is not previously set.
|
||||
\sa SetCaptionFirstColour(), CaptionFirstColourUsed() */
|
||||
wxColour GetFirstColour() const {
|
||||
wxASSERT(_firstColourUsed);
|
||||
return _firstColour;
|
||||
wxASSERT(m_firstColourUsed);
|
||||
return m_firstColour;
|
||||
};
|
||||
|
||||
// ------- SecondColour -------
|
||||
|
||||
/** Set second colour for the caption bar. If this is not set, the colour property is undefined and
|
||||
/** Set second colour for the caption bar. If this is not set, the colour property is undefined and
|
||||
will not be used. Use SecondColourUsed() to check if this style is used */
|
||||
void SetSecondColour(const wxColour &col) {
|
||||
_secondColour = col;
|
||||
_secondColourUsed = true;
|
||||
m_secondColour = col;
|
||||
m_secondColourUsed = true;
|
||||
};
|
||||
|
||||
/** Checks if the second colour of the caption bar is set */
|
||||
bool SecondColourUsed() const {
|
||||
return _secondColourUsed;
|
||||
return m_secondColourUsed;
|
||||
};
|
||||
|
||||
/** Returns the second colour for the caption bar. Please be warned this will result in
|
||||
/** Returns the second colour for the caption bar. Please be warned this will result in
|
||||
an assertion failure when this property is not previously set.
|
||||
\sa SetSecondColour(), SecondColourUsed() */
|
||||
wxColour GetSecondColour() const {
|
||||
wxASSERT(_secondColourUsed);
|
||||
return _secondColour;
|
||||
wxASSERT(m_secondColourUsed);
|
||||
return m_secondColour;
|
||||
};
|
||||
|
||||
// ------- Caption Text Colour -------
|
||||
|
||||
/** Set caption colour for the caption bar. If this is not set, the colour property is
|
||||
/** Set caption colour for the caption bar. If this is not set, the colour property is
|
||||
undefined and will not be used. Use CaptionColourUsed() to check if this style is used */
|
||||
void SetCaptionColour(const wxColour &col) {
|
||||
_textColour = col;
|
||||
_textColourUsed = true;
|
||||
m_textColour = col;
|
||||
m_textColourUsed = true;
|
||||
};
|
||||
|
||||
/** Checks if the caption colour of the caption bar is set */
|
||||
bool CaptionColourUsed() const {
|
||||
return _textColourUsed;
|
||||
return m_textColourUsed;
|
||||
};
|
||||
|
||||
/** Returns the caption colour for the caption bar. Please be warned this will
|
||||
/** Returns the caption colour for the caption bar. Please be warned this will
|
||||
result in an assertion failure when this property is not previously set.
|
||||
\sa SetCaptionColour(), CaptionColourUsed() */
|
||||
wxColour GetCaptionColour() const {
|
||||
wxASSERT(_textColourUsed);
|
||||
return _textColour;
|
||||
wxASSERT(m_textColourUsed);
|
||||
return m_textColour;
|
||||
};
|
||||
|
||||
// ------- CaptionStyle -------
|
||||
|
||||
/** Set caption style for the caption bar. If this is not set, the property is
|
||||
undefined and will not be used. Use CaptionStyleUsed() to check if this style is used.
|
||||
/** Set caption style for the caption bar. If this is not set, the property is
|
||||
undefined and will not be used. Use CaptionStyleUsed() to check if this style is used.
|
||||
The following styles can be applied:
|
||||
- wxCAPTIONBAR_GRADIENT_V: Draws a vertical gradient from top to bottom
|
||||
- wxCAPTIONBAR_GRADIENT_H: Draws a horizontal gradient from left to right
|
||||
@@ -216,21 +217,21 @@ public:
|
||||
- wxCAPTIONBAR_FILLED_RECTANGLE: Draws a filled rectangle and a border around it
|
||||
*/
|
||||
void SetCaptionStyle(int style) {
|
||||
_captionStyle = style;
|
||||
_captionStyleUsed = true;
|
||||
m_captionStyle = style;
|
||||
m_captionStyleUsed = true;
|
||||
};
|
||||
|
||||
/** Checks if the caption style of the caption bar is set */
|
||||
bool CaptionStyleUsed() const {
|
||||
return _captionStyleUsed;
|
||||
return m_captionStyleUsed;
|
||||
};
|
||||
|
||||
/** Returns the caption style for the caption bar. Please be warned this will
|
||||
/** Returns the caption style for the caption bar. Please be warned this will
|
||||
result in an assertion failure when this property is not previously set.
|
||||
\sa SetCaptionStyle(), CaptionStyleUsed() */
|
||||
int GetCaptionStyle() const {
|
||||
wxASSERT(_captionStyleUsed);
|
||||
return _captionStyle;
|
||||
wxASSERT(m_captionStyleUsed);
|
||||
return m_captionStyle;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -238,7 +239,7 @@ public:
|
||||
|
||||
/** \class wxCaptionBar
|
||||
This class is a graphical caption component that consists of a caption and a clickable arrow.
|
||||
|
||||
|
||||
The wxCaptionBar fires an event EVT_CAPTIONBAR which is a wxCaptionBarEvent. This event can be caught
|
||||
and the parent window can act upon the collapsed or expanded state of the bar (which is actually just
|
||||
the icon which changed). The parent panel can reduce size or expand again.
|
||||
@@ -252,20 +253,20 @@ public:
|
||||
class WXDLLIMPEXP_FOLDBAR wxCaptionBar: public wxWindow
|
||||
{
|
||||
private:
|
||||
wxString _caption;
|
||||
wxImageList *_foldIcons;
|
||||
wxSize _oldSize;
|
||||
//wxFont _captionFont;
|
||||
int _rightIndent;
|
||||
int _iconWidth, _iconHeight;
|
||||
//int _captionStyle;
|
||||
wxString m_caption;
|
||||
wxImageList *m_foldIcons;
|
||||
wxSize m_oldSize;
|
||||
//wxFont m_captionFont;
|
||||
int m_rightIndent;
|
||||
int m_iconWidth, m_iconHeight;
|
||||
//int m_captionStyle;
|
||||
|
||||
//wxColour _firstColour, _secondColour, _textColour;
|
||||
//wxColour m_firstColour, m_secondColour, m_textColour;
|
||||
|
||||
/** True when the caption is in collapsed state (means at the bottom of the wxFoldPanel */
|
||||
bool _collapsed;
|
||||
bool m_collapsed;
|
||||
|
||||
wxCaptionBarStyle _style;
|
||||
wxCaptionBarStyle m_captionStyle;
|
||||
|
||||
/** Fills the background of the caption with either a gradient, or a solid color */
|
||||
void FillCaptionBackground(wxPaintDC &dc);
|
||||
@@ -282,38 +283,40 @@ private:
|
||||
|
||||
public:
|
||||
/** Constructor of wxCaptionBar. To create a wxCaptionBar with the arrow images, simply pass an image list
|
||||
which contains at least two bitmaps. The bitmaps contain the expanded and collapsed icons needed to
|
||||
which contains at least two bitmaps. The bitmaps contain the expanded and collapsed icons needed to
|
||||
represent it's state. If you don't want images, simply pass a null pointer and the bitmap is disabled. */
|
||||
wxCaptionBar(wxWindow* parent, const wxString &caption, wxImageList *images,
|
||||
wxCaptionBar(wxWindow* parent, const wxString &caption, wxImageList *images,
|
||||
wxWindowID id = wxID_ANY, const wxCaptionBarStyle &cbstyle = wxEmptyCaptionBarStyle,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER);
|
||||
|
||||
~wxCaptionBar();
|
||||
|
||||
/** Set wxCaptionBar styles with wxCapionBarSyle class. All styles that are actually set, are applied. If you
|
||||
/** Set wxCaptionBar styles with wxCapionBarSyle class. All styles that are actually set, are applied. If you
|
||||
set applyDefault to true, all other (not defined) styles will be set to default. If it is false,
|
||||
the styles which are not set in the wxCaptionBarStyle will be ignored */
|
||||
void SetCaptionStyle(bool applyDefault, wxCaptionBarStyle style = wxEmptyCaptionBarStyle) {
|
||||
ApplyCaptionStyle(style, applyDefault);
|
||||
Refresh();
|
||||
};
|
||||
|
||||
/** Returns the current style of the captionbar in a wxCaptionBarStyle class. This can be used to change and set back the
|
||||
|
||||
/** Returns the current style of the captionbar in a wxCaptionBarStyle class. This can be used to change and set back the
|
||||
changes. */
|
||||
wxCaptionBarStyle GetCaptionStyle() {
|
||||
return _style;
|
||||
return m_captionStyle;
|
||||
};
|
||||
|
||||
bool IsVertical() const;
|
||||
|
||||
#if 0
|
||||
/** Sets a pointer to an image list resource (a non owned pointer) to the collapsed and expand icon bitmap.
|
||||
The reason why it will be assigned a pointer is that it is very likely that multiple caption bars will
|
||||
The reason why it will be assigned a pointer is that it is very likely that multiple caption bars will
|
||||
be used and if they all have their own bitmap resources it will eat up more memory then needed. It will
|
||||
also ease the use of shared icon change, when there is any need to.
|
||||
|
||||
If no wxImageList is assigned, there will be no fold icons and only the doubleclick on the panel
|
||||
will work to collapse / expand.
|
||||
|
||||
The image list must contain 2 bitmaps. Index 0 will be the expanded state, and index 1 will be the
|
||||
|
||||
If no wxImageList is assigned, there will be no fold icons and only the doubleclick on the panel
|
||||
will work to collapse / expand.
|
||||
|
||||
The image list must contain 2 bitmaps. Index 0 will be the expanded state, and index 1 will be the
|
||||
collapsed state of the bitmap. The size of the bitmap is taken in account when the minimal height and
|
||||
widht is calculated.
|
||||
|
||||
@@ -322,10 +325,10 @@ public:
|
||||
all the windows accordingly */
|
||||
|
||||
void SetFoldIcons(wxImageList *images) {
|
||||
_foldIcons = images;
|
||||
_iconWidth = _iconHeight = 0;
|
||||
if(_foldIcons)
|
||||
_foldIcons->GetSize(0, _iconWidth, _iconHeight);
|
||||
m_foldIcons = images;
|
||||
m_iconWidth = m_iconHeight = 0;
|
||||
if(m_foldIcons)
|
||||
m_foldIcons->GetSize(0, m_iconWidth, m_iconHeight);
|
||||
|
||||
Refresh();
|
||||
};
|
||||
@@ -334,37 +337,37 @@ public:
|
||||
|
||||
/** Returns wether the status of the bar is expanded or collapsed */
|
||||
bool IsCollapsed() const {
|
||||
return _collapsed;
|
||||
return m_collapsed;
|
||||
};
|
||||
|
||||
/** Sets the amount of pixels on the right from which the bitmap is trailing. If this is 0, it will be
|
||||
drawn all the way to the right, default is equal to wxFPB_BMP_RIGHTSPACE. Assign this before
|
||||
/** Sets the amount of pixels on the right from which the bitmap is trailing. If this is 0, it will be
|
||||
drawn all the way to the right, default is equal to wxFPB_BMP_RIGHTSPACE. Assign this before
|
||||
assigning an image list to prevent a redraw */
|
||||
|
||||
void SetRightIndent(int pixels) {
|
||||
wxCHECK2(pixels >= 0, return);
|
||||
_rightIndent = pixels;
|
||||
m_rightIndent = pixels;
|
||||
// issue a refresh (if we have a bmp)
|
||||
if(_foldIcons)
|
||||
if(m_foldIcons)
|
||||
Refresh();
|
||||
};
|
||||
|
||||
|
||||
/** Return the best size for this panel, based upon the font assigned to this window, and the
|
||||
/** Return the best size for this panel, based upon the font assigned to this window, and the
|
||||
caption string */
|
||||
wxSize DoGetBestSize() const;
|
||||
|
||||
/** This sets the internal state / representation to collapsed. This does not trigger a wxCaptionBarEvent
|
||||
to be sent to the parent */
|
||||
void Collapse() {
|
||||
_collapsed = true;
|
||||
m_collapsed = true;
|
||||
RedrawIconBitmap();
|
||||
};
|
||||
|
||||
/** This sets the internal state / representation to expanded. This does not trigger a wxCaptionBarEvent
|
||||
to be sent to the parent */
|
||||
void Expand() {
|
||||
_collapsed = false;
|
||||
m_collapsed = false;
|
||||
RedrawIconBitmap();
|
||||
};
|
||||
|
||||
@@ -380,10 +383,10 @@ public:
|
||||
private:
|
||||
/** The paint event for flat or gradient fill */
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
|
||||
|
||||
/** For clicking the icon, the mouse event must be intercepted */
|
||||
void OnMouseEvent(wxMouseEvent& event);
|
||||
|
||||
|
||||
/** Maybe when focus (don't know how yet) a cursor left or backspace will collapse or expand */
|
||||
void OnChar(wxKeyEvent& event);
|
||||
|
||||
@@ -398,7 +401,7 @@ protected:
|
||||
/***********************************************************************************************************/
|
||||
|
||||
/** \class wxCaptionBarEvent
|
||||
This event will be sent when a EVT_CAPTIONBAR is mapped in the parent. It is to notify the parent
|
||||
This event will be sent when a EVT_CAPTIONBAR is mapped in the parent. It is to notify the parent
|
||||
that the bar is now in collapsed or expanded state. The parent should re-arrange the associated
|
||||
windows accordingly */
|
||||
|
||||
@@ -406,49 +409,49 @@ class WXDLLIMPEXP_FOLDBAR wxCaptionBarEvent : public wxCommandEvent
|
||||
{
|
||||
|
||||
private:
|
||||
bool _collapsed;
|
||||
wxCaptionBar *_bar;
|
||||
void *_tag;
|
||||
bool m_collapsed;
|
||||
wxCaptionBar *m_captionBar;
|
||||
void *m_tag;
|
||||
|
||||
public:
|
||||
wxCaptionBarEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
|
||||
: wxCommandEvent(commandType, id)
|
||||
, _collapsed(false)
|
||||
, _bar(0)
|
||||
, _tag(0)
|
||||
, m_collapsed(false)
|
||||
, m_captionBar(NULL)
|
||||
, m_tag(0)
|
||||
{ }
|
||||
|
||||
|
||||
/** Constructor for clone copy */
|
||||
wxCaptionBarEvent(const wxCaptionBarEvent &event);
|
||||
|
||||
|
||||
/** Clone function */
|
||||
virtual wxEvent *Clone() const {
|
||||
return new wxCaptionBarEvent(*this);
|
||||
};
|
||||
|
||||
/** Returns wether the bar is expanded or collapsed. True means expanded */
|
||||
bool GetFoldStatus() const {
|
||||
wxCHECK(_bar, false);
|
||||
return !_bar->IsCollapsed();
|
||||
bool GetFoldStatus() const {
|
||||
wxCHECK(m_captionBar, false);
|
||||
return !m_captionBar->IsCollapsed();
|
||||
};
|
||||
|
||||
/** Returns the bar associated with this event */
|
||||
wxCaptionBar *GetBar() const {
|
||||
return _bar;
|
||||
wxCaptionBar *GetCaptionBar() const {
|
||||
return m_captionBar;
|
||||
};
|
||||
|
||||
void SetTag(void *tag) {
|
||||
_tag = tag;
|
||||
m_tag = tag;
|
||||
};
|
||||
|
||||
void *GetTag() const {
|
||||
return _tag;
|
||||
return m_tag;
|
||||
};
|
||||
|
||||
/** Sets the bar associated with this event, should not used
|
||||
by any other then the originator of the event */
|
||||
void SetBar(wxCaptionBar *bar) {
|
||||
_bar = bar;
|
||||
void SetCaptionBar(wxCaptionBar *bar) {
|
||||
m_captionBar = bar;
|
||||
};
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxCaptionBarEvent)
|
||||
|
@@ -2,7 +2,8 @@
|
||||
// Name: foldpanelbar.h
|
||||
// Purpose: wxFoldPanel
|
||||
// Author: Jorgen Bodde
|
||||
// Modified by:
|
||||
// Modified by: ABX - 19/12/2004 : possibility of horizontal orientation
|
||||
// : wxWidgets coding standards
|
||||
// Created: 22/06/2004
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Jorgen Bodde
|
||||
@@ -12,12 +13,6 @@
|
||||
#ifndef __WXFOLDPANELBAR_H__
|
||||
#define __WXFOLDPANELBAR_H__
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
|
||||
#include "foldpanelitem.h"
|
||||
|
||||
/** Not yet supported but added for future reference. Single fold forces other panels to close when
|
||||
they are open, and only opens the current panel. This will allow the open panel to gain the full
|
||||
size left in the client area */
|
||||
@@ -26,6 +21,10 @@
|
||||
/** All panels are stacked to the bottom. When they are expanded again they show up at the top */
|
||||
#define wxFPB_COLLAPSE_TO_BOTTOM 0x0002
|
||||
|
||||
/** Orientation flag **/
|
||||
#define wxFPB_HORIZONTAL wxHORIZONTAL /* 0x0004 */
|
||||
#define wxFPB_VERTICAL wxVERTICAL /* 0x0008 */
|
||||
|
||||
/** Not yet supported, but added for future reference. Single fold plus panels will be stacked at the bottom */
|
||||
#define wxFPB_EXCLUSIVE_FOLD wxFPB_SINGLE_FOLD | wxFPB_COLLAPSE_TO_BOTTOM
|
||||
|
||||
@@ -34,6 +33,8 @@
|
||||
|
||||
#define wxFPB_DEFAULT_STYLE wxTAB_TRAVERSAL | wxNO_BORDER
|
||||
|
||||
#include "wx/foldbar/foldpanelitem.h"
|
||||
|
||||
/** \class wxFoldPanel
|
||||
This class is used to return a reference to the fold panel that is added by wxFoldPanelBar::AddFoldPanel(). Use
|
||||
wxFoldPanel::IsOk() to check wether the result is ok to be used in further operations. Use wxFoldPanel::GetItem()
|
||||
@@ -43,43 +44,43 @@
|
||||
class wxFoldPanel
|
||||
{
|
||||
private:
|
||||
wxFoldPanelItem *_item;
|
||||
wxFoldPanelItem *m_item;
|
||||
|
||||
public:
|
||||
/** Constructor, usually not directly used by the developer. */
|
||||
wxFoldPanel(wxFoldPanelItem *item)
|
||||
: _item(item)
|
||||
: m_item(item)
|
||||
{
|
||||
}
|
||||
|
||||
/** Returns true if this is a valid wxFoldPanelItem reference. */
|
||||
bool IsOk() const {
|
||||
return (_item != 0);
|
||||
return (m_item != 0);
|
||||
};
|
||||
|
||||
/** Copy operator to assign one instance to the other, this is needed because these classes are passed
|
||||
as instance not by reference. */
|
||||
virtual void operator=(const wxFoldPanel &item) {
|
||||
_item = item._item;
|
||||
m_item = item.m_item;
|
||||
};
|
||||
|
||||
#ifndef _NO_DOXYGEN_
|
||||
// not allowed to be seen by doxygen
|
||||
wxFoldPanelItem *GetItem() const {
|
||||
return _item;
|
||||
return m_item;
|
||||
};
|
||||
#endif
|
||||
|
||||
/** Use this method to obtain the wxPanel derived class to which you need to add your components. For example;<br>
|
||||
|
||||
\code
|
||||
wxFoldPanel item = _pnl->AddFoldPanel(wxT("Test me"), false);
|
||||
_pnl->AddFoldPanelWindow(item, new wxButton(item.GetParent(), wxID_ANY, wxT("Press Me")));
|
||||
wxFoldPanel item = m_pnl->AddFoldPanel(wxT("Test me"), false);
|
||||
m_pnl->AddFoldPanelWindow(item, new wxButton(item.GetParent(), wxID_ANY, wxT("Press Me")));
|
||||
\endcode
|
||||
*/
|
||||
wxFoldPanelItem *GetParent() const {
|
||||
wxASSERT(_item);
|
||||
return _item;
|
||||
wxASSERT(m_item);
|
||||
return m_item;
|
||||
};
|
||||
|
||||
|
||||
@@ -107,14 +108,14 @@ private:
|
||||
DECLARE_CLASS( wxFoldPanelBar )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
wxImageList *_images;
|
||||
wxFoldPanelItemArray _panels;
|
||||
wxBoxSizer* _panelSizer;
|
||||
wxPanel *_foldPanel, *_bottomPanel;
|
||||
wxFlexGridSizer* _mainSizer;
|
||||
bool _controlCreated;
|
||||
wxBitmap *_moreBmp;
|
||||
int _extraStyle;
|
||||
wxImageList *m_images;
|
||||
wxFoldPanelItemArray m_panels;
|
||||
wxBoxSizer* m_panelSizer;
|
||||
wxPanel *m_foldPanel, *m_bottomPanel;
|
||||
wxFlexGridSizer* m_mainSizer;
|
||||
bool m_controlCreated;
|
||||
wxBitmap *m_moreBmp;
|
||||
int m_extraStyle;
|
||||
|
||||
private:
|
||||
/** Refreshes all the panels from given index down to last one */
|
||||
@@ -123,10 +124,10 @@ private:
|
||||
/** Refreshes all the panels from given pointer down to last one in the list */
|
||||
void RefreshPanelsFrom(wxFoldPanelItem *item);
|
||||
|
||||
/** Returns the height of the panels that are expanded and collapsed. This is useful to determine
|
||||
quickly what size is used to display, and what is left at the bottom to allign
|
||||
/** Returns the length of the panels that are expanded and collapsed. This is useful to determine
|
||||
quickly what size is used to display, and what is left at the bottom (right) to allign
|
||||
the collapsed panels. */
|
||||
int GetPanelsHeight(int &collapsed, int &expanded);
|
||||
int GetPanelsLength(int &collapsed, int &expanded);
|
||||
|
||||
/** Reposition all the collapsed panels to the bottom. When it is not possible to
|
||||
allign them to the bottom, stick them behind the visible panels. The Rect holds the
|
||||
@@ -182,49 +183,54 @@ public:
|
||||
\code
|
||||
|
||||
// create the wxFoldPanelBar
|
||||
_pnl = new wxFoldPanelBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFPB_DEFAULT_STYLE, wxFPB_COLLAPSE_TO_BOTTOM);
|
||||
m_pnl = new wxFoldPanelBar(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxFPB_DEFAULT_STYLE, wxFPB_COLLAPSE_TO_BOTTOM);
|
||||
|
||||
// add a foldpanel to the control. "Test me" is the caption and it is initially not collapsed.
|
||||
wxFoldPanel item = _pnl->AddFoldPanel(wxT("Test me"), false);
|
||||
wxFoldPanel item = m_pnl->AddFoldPanel(wxT("Test me"), false);
|
||||
|
||||
// now add a button to the fold panel. Mind that the button should be made child of the
|
||||
// wxFoldPanel and not of the main form.
|
||||
_pnl->AddFoldPanelWindow(item, new wxButton(item.GetParent(), ID_COLLAPSEME, wxT("Collapse Me")));
|
||||
m_pnl->AddFoldPanelWindow(item, new wxButton(item.GetParent(), ID_COLLAPSEME, wxT("Collapse Me")));
|
||||
|
||||
// add a separator between the two controls. This is purely a visual line that can have a certain
|
||||
// color and also the indents and width alligning like a control.
|
||||
_pnl->AddFoldPanelSeperator(item);
|
||||
m_pnl->AddFoldPanelSeperator(item);
|
||||
|
||||
// now add a text ctrl. Also very easy. Allign this on width so that when the control gets wider
|
||||
// the text control also sizes along.
|
||||
_pnl->AddFoldPanelWindow(item, new wxTextCtrl(item.GetParent(), wxID_ANY, wxT("Comment")), wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_YSPACING, 20);
|
||||
m_pnl->AddFoldPanelWindow(item, new wxTextCtrl(item.GetParent(), wxID_ANY, wxT("Comment")), wxFPB_ALIGN_WIDTH, wxFPB_DEFAULT_SPACING, 20);
|
||||
|
||||
\endcode
|
||||
*/
|
||||
int AddFoldPanelWindow(const wxFoldPanel &panel, wxWindow *window, int flags = wxFPB_ALIGN_WIDTH,
|
||||
int ySpacing = wxFPB_DEFAULT_YSPACING, int leftSpacing = wxFPB_DEFAULT_LEFTSPACING,
|
||||
int Spacing = wxFPB_DEFAULT_SPACING, int leftSpacing = wxFPB_DEFAULT_LEFTSPACING,
|
||||
int rightSpacing = wxFPB_DEFAULT_RIGHTSPACING);
|
||||
|
||||
/** Adds a seperator line to the current wxFoldPanel. The seperator is a simple line which is drawn and is no
|
||||
real component. It can be used to seperate groups of controls which belong to eachother. The colour is
|
||||
adjustable, and it takes the same ySpacing, leftSpacing and rightSpacing as AddFoldPanelWindow(). */
|
||||
int AddFoldPanelSeperator(const wxFoldPanel &panel, const wxColour &color = wxColour(167,167,167),
|
||||
int ySpacing = wxFPB_DEFAULT_YSPACING, int leftSpacing = wxFPB_DEFAULT_LEFTLINESPACING,
|
||||
int Spacing = wxFPB_DEFAULT_SPACING, int leftSpacing = wxFPB_DEFAULT_LEFTLINESPACING,
|
||||
int rightSpacing = wxFPB_DEFAULT_RIGHTLINESPACING);
|
||||
|
||||
/** Returns the number of panels currently present in the wxFoldPanelBar. This is independent if they are
|
||||
visible or hidden. */
|
||||
size_t GetCount() const {
|
||||
return _panels.GetCount();
|
||||
return m_panels.GetCount();
|
||||
};
|
||||
|
||||
inline bool IsVertical() const
|
||||
{
|
||||
return HasFlag(wxFPB_VERTICAL);
|
||||
}
|
||||
|
||||
/** Returns the wxFoldPanel reference belonging to the current index. An empty panel is returned when the
|
||||
index is out of bounds. Use GetCount() to get the amount of panels present. Collapsing and folding the
|
||||
panel does not change the order in which they are indexed. So it is safe enough to keep a reference
|
||||
to the panel by number. */
|
||||
wxFoldPanel Item(size_t i) {
|
||||
wxCHECK((int)i >= 0 && i < GetCount(), wxFoldPanel(0));
|
||||
return wxFoldPanel(_panels.Item(i));
|
||||
return wxFoldPanel(m_panels.Item(i));
|
||||
};
|
||||
|
||||
/** Collapses the given wxFoldPanel reference, and updates the foldpanel bar. In the wxFPB_COLLAPSE_TO_BOTTOM
|
||||
@@ -271,7 +277,6 @@ public:
|
||||
return fp.GetItem()->GetCaptionStyle();
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
void OnPressCaption(wxCaptionBarEvent &event);
|
||||
void OnSizePanel(wxSizeEvent &event);
|
||||
|
@@ -2,7 +2,8 @@
|
||||
// Name: foldpanelitem.h
|
||||
// Purpose: wxFoldPanel
|
||||
// Author: Jorgen Bodde
|
||||
// Modified by:
|
||||
// Modified by: ABX - 19/12/2004 : possibility of horizontal orientation
|
||||
// : wxWidgets coding standards
|
||||
// Created: 22/06/2004
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Jorgen Bodde
|
||||
@@ -12,18 +13,14 @@
|
||||
#ifndef __WXFOLDPANELITEM_H__
|
||||
#define __WXFOLDPANELITEM_H__
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/wx.h"
|
||||
#endif
|
||||
#include "wx/foldbar/captionbar.h"
|
||||
|
||||
#include "captionbar.h"
|
||||
|
||||
#define wxFPB_ALIGN_LEFT 0
|
||||
#define wxFPB_ALIGN_LEFT 0
|
||||
#define wxFPB_ALIGN_WIDTH 1
|
||||
|
||||
#define wxFPB_DEFAULT_LEFTSPACING 5
|
||||
#define wxFPB_DEFAULT_RIGHTSPACING 10
|
||||
#define wxFPB_DEFAULT_YSPACING 8
|
||||
#define wxFPB_DEFAULT_SPACING 8
|
||||
|
||||
#define wxFPB_DEFAULT_LEFTLINESPACING 2
|
||||
#define wxFPB_DEFAULT_RIGHTLINESPACING 2
|
||||
@@ -31,116 +28,117 @@
|
||||
class wxFoldWindowItem
|
||||
{
|
||||
private:
|
||||
wxWindow *_wnd;
|
||||
int _type, _flags;
|
||||
int _leftSpacing,
|
||||
_rightSpacing,
|
||||
_ySpacing;
|
||||
int _lineWidth, _lineY;
|
||||
wxColour _sepLineColour;
|
||||
wxWindow *m_wndItem;
|
||||
int m_type, m_flags;
|
||||
int m_leftSpacing,
|
||||
m_rightSpacing,
|
||||
m_Spacing;
|
||||
int m_lineLength, m_lineY;
|
||||
wxColour m_sepLineColour;
|
||||
|
||||
public:
|
||||
enum
|
||||
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)
|
||||
wxFoldWindowItem(wxWindow *wnd, int flags = wxFPB_ALIGN_WIDTH, int Spacing = wxFPB_DEFAULT_SPACING,
|
||||
int leftSpacing = wxFPB_DEFAULT_LEFTSPACING, int rightSpacing = wxFPB_DEFAULT_RIGHTSPACING)
|
||||
: m_wndItem(wnd)
|
||||
, m_type(WINDOW)
|
||||
, m_flags(flags)
|
||||
, m_leftSpacing(leftSpacing)
|
||||
, m_rightSpacing(rightSpacing)
|
||||
, m_Spacing(Spacing)
|
||||
, m_lineLength(0)
|
||||
, m_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)
|
||||
wxFoldWindowItem(int y, const wxColour &lineColor = *wxBLACK, int Spacing = wxFPB_DEFAULT_SPACING,
|
||||
int leftSpacing = wxFPB_DEFAULT_LEFTLINESPACING,
|
||||
int rightSpacing = wxFPB_DEFAULT_RIGHTLINESPACING)
|
||||
: m_wndItem(NULL)
|
||||
, m_type(SEPARATOR)
|
||||
, m_flags(wxFPB_ALIGN_WIDTH)
|
||||
, m_leftSpacing(leftSpacing)
|
||||
, m_rightSpacing(rightSpacing)
|
||||
, m_Spacing(Spacing)
|
||||
, m_lineLength(0)
|
||||
, m_lineY(y)
|
||||
, m_sepLineColour(lineColor)
|
||||
{
|
||||
};
|
||||
|
||||
// TODO: Make a c'tor for a captioned splitter
|
||||
|
||||
int GetType() const {
|
||||
return _type;
|
||||
return m_type;
|
||||
};
|
||||
|
||||
int GetLineY() const {
|
||||
return _lineY;
|
||||
return m_lineY;
|
||||
};
|
||||
|
||||
int GetLineWidth() const {
|
||||
return _lineWidth;
|
||||
int GetLineLength() const {
|
||||
return m_lineLength;
|
||||
};
|
||||
|
||||
const wxColour &GetLineColour() const {
|
||||
return _sepLineColour;
|
||||
return m_sepLineColour;
|
||||
};
|
||||
|
||||
int GetLeftSpacing() const {
|
||||
return _leftSpacing;
|
||||
return m_leftSpacing;
|
||||
};
|
||||
|
||||
int GetRightSpacing() const {
|
||||
return _rightSpacing;
|
||||
return m_rightSpacing;
|
||||
};
|
||||
|
||||
int GetYSpacing() const {
|
||||
return _ySpacing;
|
||||
int GetSpacing() const {
|
||||
return m_Spacing;
|
||||
};
|
||||
|
||||
// returns the window height if type is wxFoldWindowItem::WINDOW
|
||||
// returns space needed by the window if type is wxFoldWindowItem::WINDOW
|
||||
// and returns the total size plus the extra spacing
|
||||
|
||||
int GetWindowHeight() const {
|
||||
int GetWindowLength(bool vertical) const {
|
||||
int value = 0;
|
||||
if(_type == WINDOW)
|
||||
if(m_type == WINDOW)
|
||||
{
|
||||
wxCHECK(_wnd, 0);
|
||||
wxSize size = _wnd->GetSize();
|
||||
value = size.GetHeight() + _ySpacing;
|
||||
wxCHECK(m_wndItem, 0);
|
||||
wxSize size = m_wndItem->GetSize();
|
||||
value = ( vertical ? size.GetHeight() : size.GetWidth() ) + m_Spacing;
|
||||
}
|
||||
else if(_type == SEPARATOR)
|
||||
value = 1 + _ySpacing;
|
||||
else if(m_type == SEPARATOR)
|
||||
value = 1 + m_Spacing;
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
// resize the element, whatever it is. A separator or
|
||||
// line will be always alligned by width
|
||||
// line will be always alligned by width or hight
|
||||
// depending on orientation of the whole panel
|
||||
|
||||
void ResizeItem(int width) {
|
||||
if((_flags & wxFPB_ALIGN_WIDTH))
|
||||
void ResizeItem(int size, bool vertical) {
|
||||
if(m_flags & wxFPB_ALIGN_WIDTH)
|
||||
{
|
||||
// allign by taking full width
|
||||
int myWidth = width - _leftSpacing - _rightSpacing;
|
||||
int mySize = size - m_leftSpacing - m_rightSpacing;
|
||||
|
||||
if(myWidth < 0)
|
||||
myWidth = 10; // can't have negative width
|
||||
if(mySize < 0)
|
||||
mySize = 10; // can't have negative width
|
||||
|
||||
if(_type == SEPARATOR)
|
||||
_lineWidth = myWidth;
|
||||
if(m_type == SEPARATOR)
|
||||
m_lineLength = mySize;
|
||||
else
|
||||
{
|
||||
wxCHECK2(_wnd, return);
|
||||
_wnd->SetSize(wxSize(myWidth, wxDefaultCoord));
|
||||
wxCHECK2(m_wndItem, return);
|
||||
m_wndItem->SetSize(vertical?mySize:wxDefaultCoord, vertical?wxDefaultCoord:mySize);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -154,27 +152,27 @@ WX_DECLARE_OBJARRAY(wxFoldWindowItem, wxFoldWindowItemArray);
|
||||
|
||||
/** \wxFoldPanelItem
|
||||
This class is a child sibling of the wxFoldPanelBar class. It will be containing a wxCaptionBar class
|
||||
for receiving of events, and a the rest of the area can be populated by a wxPanel derived class.
|
||||
for receiving of events, and a the rest of the area can be populated by a wxPanel derived class.
|
||||
*/
|
||||
|
||||
class WXDLLIMPEXP_FOLDBAR wxFoldPanelItem: public wxPanel
|
||||
{
|
||||
private:
|
||||
wxCaptionBar *_captionBar;
|
||||
wxCaptionBar *m_captionBar;
|
||||
|
||||
bool _controlCreated;
|
||||
int _yUserSize,
|
||||
_yPanelSize,
|
||||
_yLastInsertPos;
|
||||
int _yPos;
|
||||
bool _userSized;
|
||||
bool m_controlCreated;
|
||||
int m_userSize,
|
||||
m_panelSize,
|
||||
m_lastInsertPos;
|
||||
int m_itemPos;
|
||||
bool m_userSized;
|
||||
|
||||
private:
|
||||
DECLARE_CLASS( wxFoldPanelItem )
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
||||
|
||||
private:
|
||||
wxFoldWindowItemArray _items;
|
||||
wxFoldWindowItemArray m_items;
|
||||
|
||||
void OnSize(wxSizeEvent &event);
|
||||
void OnPressCaption(wxCaptionBarEvent &event);
|
||||
@@ -182,75 +180,77 @@ private:
|
||||
|
||||
public:
|
||||
// constructors and destructors
|
||||
wxFoldPanelItem( wxWindow *parent, const wxString &caption, wxImageList *icons = 0, bool collapsedInitially = false,
|
||||
wxFoldPanelItem( wxWindow *parent, const wxString &caption, wxImageList *icons = 0, bool collapsedInitially = false,
|
||||
const wxCaptionBarStyle &style = wxEmptyCaptionBarStyle);
|
||||
virtual ~wxFoldPanelItem();
|
||||
|
||||
|
||||
/** Add a window item to the list of items on this panel. The flags are wxFPB_ALIGN_LEFT for a non sizing
|
||||
window element, and wxFPB_ALIGN_WIDTH for a width alligned item. The ySpacing parameter reserves a number
|
||||
of pixels before the window element, and leftSpacing is an indent. rightSpacing is only relevant when the
|
||||
style wxFPB_ALIGN_WIDTH is chosen. */
|
||||
void AddWindow(wxWindow *window, int flags, int ySpacing, int leftSpacing, int rightSpacing);
|
||||
|
||||
|
||||
void AddSeparator(const wxColour &color, int ySpacing, int leftSpacing, int rightSpacing);
|
||||
|
||||
/** Repositions this wxFoldPanelBar and reports the height occupied for the next wxFoldPanelBar in the
|
||||
/** Repositions this wxFoldPanelBar and reports the length occupied for the next wxFoldPanelBar in the
|
||||
list */
|
||||
int Reposition(int y);
|
||||
int Reposition(int pos);
|
||||
|
||||
void ResizePanel();
|
||||
|
||||
/** Return expanded or collapsed status. If the panel is expanded, true is returned */
|
||||
bool IsExpanded() const {
|
||||
return !_captionBar->IsCollapsed();
|
||||
return !m_captionBar->IsCollapsed();
|
||||
};
|
||||
|
||||
/** Return Y pos */
|
||||
|
||||
int GetY() const {
|
||||
return _yPos;
|
||||
int GetItemPos() const {
|
||||
return m_itemPos;
|
||||
};
|
||||
|
||||
// this should not be called by the user, because it doesn't trigger the parent
|
||||
// this should not be called by the user, because it doesn't trigger the parent
|
||||
// to tell it that we are collapsed or expanded, it only changes visual state
|
||||
void Collapse() {
|
||||
_captionBar->Collapse();
|
||||
m_captionBar->Collapse();
|
||||
ResizePanel();
|
||||
};
|
||||
|
||||
// this should not be called by the user, because it doesn't trigger the parent
|
||||
// this should not be called by the user, because it doesn't trigger the parent
|
||||
// to tell it that we are collapsed or expanded, it only changes visual state
|
||||
void Expand() {
|
||||
_captionBar->Expand();
|
||||
m_captionBar->Expand();
|
||||
ResizePanel();
|
||||
};
|
||||
|
||||
/* Return size of panel */
|
||||
|
||||
int GetPanelHeight() const {
|
||||
if(_captionBar->IsCollapsed())
|
||||
return GetCaptionHeight();
|
||||
else if(_userSized)
|
||||
return _yUserSize;
|
||||
return _yPanelSize;
|
||||
int GetPanelLength() const {
|
||||
if(m_captionBar->IsCollapsed())
|
||||
return GetCaptionLength();
|
||||
else if(m_userSized)
|
||||
return m_userSize;
|
||||
return m_panelSize;
|
||||
};
|
||||
|
||||
// returns height of caption only. This is for folding calulation
|
||||
bool IsVertical() const;
|
||||
|
||||
// returns space of caption only. This is for folding calulation
|
||||
// purposes
|
||||
|
||||
int GetCaptionHeight() const {
|
||||
wxSize size = _captionBar->GetSize();
|
||||
return size.GetHeight();
|
||||
int GetCaptionLength() const {
|
||||
wxSize size = m_captionBar->GetSize();
|
||||
return IsVertical() ? size.GetHeight() : size.GetWidth();
|
||||
};
|
||||
|
||||
void ApplyCaptionStyle(const wxCaptionBarStyle &style) {
|
||||
wxCHECK2(_captionBar, return);
|
||||
_captionBar->SetCaptionStyle(false, style);
|
||||
wxCHECK2(m_captionBar, return);
|
||||
m_captionBar->SetCaptionStyle(false, style);
|
||||
};
|
||||
|
||||
wxCaptionBarStyle GetCaptionStyle() {
|
||||
wxCHECK(_captionBar, wxEmptyCaptionBarStyle);
|
||||
return _captionBar->GetCaptionStyle();
|
||||
wxCHECK(m_captionBar, wxEmptyCaptionBarStyle);
|
||||
return m_captionBar->GetCaptionStyle();
|
||||
};
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user