make wxStatusBarPane a 'full class' with getters and protected data; document it; provide more accessors in wxStatusBar (closes #10574)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59566 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2009-03-15 17:54:05 +00:00
parent bff248644e
commit b31eaa5c34
6 changed files with 121 additions and 28 deletions

View File

@@ -6,6 +6,42 @@
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxStatusBarPane
A status bar pane data container used by wxStatusBar.
*/
class wxStatusBarPane
{
public:
/**
Constructs the pane with the given @a style and @a width.
*/
wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0);
/**
Returns the pane width; it maybe negative, indicating a variable-width field.
*/
int GetWidth() const;
/**
Returns the pane style.
*/
int GetStyle() const;
/**
Returns the stack of strings pushed on this pane.
Note that this stack does include also the string currently displayed in this pane
as the version stored in the native status bar control is possibly ellipsized.
Also note that GetStack().Last() is the top of the stack (i.e. the string shown
in the status bar).
*/
const wxArrayString& GetStack() const
{ return m_arrStack; }
};
/**
@class wxStatusBar
@@ -25,7 +61,7 @@
@library{wxcore}
@category{miscwnd}
@see wxFrame, @ref page_samples_statbar
@see wxStatusBarPane, wxFrame, @ref page_samples_statbar
*/
class wxStatusBar : public wxWindow
{
@@ -84,10 +120,11 @@ public:
virtual bool GetFieldRect(int i, wxRect& rect) const;
/**
Returns the number of fields in the status bar.
Returns the wxStatusBarPane representing the @a n-th field.
*/
int GetFieldsCount() const;
const wxStatusBarPane& GetField(int n) const
{ return m_panes[n]; }
/**
Returns the string associated with a status bar field.
@@ -101,6 +138,31 @@ public:
*/
virtual wxString GetStatusText(int i = 0) const;
/**
Returns the stack of strings pushed (see PushStatusText()) on the
@a n-th field.
See wxStatusBarPane::GetStack() for more info.
*/
const wxArrayString& GetStatusStack(int n) const
{ return m_panes[n].GetStack(); }
/**
Returns the width of the @a n-th field.
See wxStatusBarPane::GetWidth() for more info.
*/
int GetStatusWidth(int n) const
{ return m_panes[n].GetWidth(); }
/**
Returns the style of the @a n-th field.
See wxStatusBarPane::GetStyle() for more info.
*/
int GetStatusStyle(int n) const
{ return m_panes[n].GetStyle(); }
/**
Sets the field text to the top of the stack, and pops the stack of saved
strings.