1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStatusBar class interface
4 // Author: Vadim Zeitlin
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_STATUSBR_H_BASE_
13 #define _WX_STATUSBR_H_BASE_
19 #include "wx/window.h"
21 #include "wx/dynarray.h"
23 extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusBarNameStr
[];
25 // ----------------------------------------------------------------------------
26 // wxStatusBar constants
27 // ----------------------------------------------------------------------------
29 // style flags for fields
30 #define wxSB_NORMAL 0x0000
31 #define wxSB_FLAT 0x0001
32 #define wxSB_RAISED 0x0002
34 // ----------------------------------------------------------------------------
35 // wxStatusBarPane: an helper for wxStatusBar
36 // ----------------------------------------------------------------------------
38 class WXDLLIMPEXP_CORE wxStatusBarPane
40 // only wxStatusBarBase can access our internal members and modify them:
41 friend class WXDLLIMPEXP_FWD_CORE wxStatusBarBase
;
44 wxStatusBarPane(int style
= wxSB_NORMAL
, size_t width
= 0)
45 : m_nStyle(style
), m_nWidth(width
) { m_arrStack
.Add(wxEmptyString
); }
52 const wxArrayString
& GetStack() const
53 { return m_arrStack
; }
55 // use wxStatusBar setter functions to modify a wxStatusBarPane
59 int m_nWidth
; // the width maybe negative, indicating a variable-width field
61 // this is the array of the stacked strings of this pane; note that this
62 // stack does include also the string currently displayed in this pane
63 // as the version stored in the native status bar control is possibly
64 // ellipsized; note that arrStack.Last() is the top of the stack
65 // (i.e. the string shown in the status bar)
66 wxArrayString m_arrStack
;
69 WX_DECLARE_OBJARRAY(wxStatusBarPane
, wxStatusBarPaneArray
);
71 // ----------------------------------------------------------------------------
72 // wxStatusBar: a window near the bottom of the frame used for status info
73 // ----------------------------------------------------------------------------
75 class WXDLLIMPEXP_CORE wxStatusBarBase
: public wxWindow
80 virtual ~wxStatusBarBase();
85 // set the number of fields and call SetStatusWidths(widths) if widths are
87 virtual void SetFieldsCount(int number
= 1, const int *widths
= NULL
);
88 int GetFieldsCount() const { return m_panes
.GetCount(); }
93 virtual void SetStatusText(const wxString
& text
, int number
= 0)
94 { m_panes
[number
].GetStack().Last() = text
; }
95 virtual wxString
GetStatusText(int number
= 0) const
96 { return m_panes
[number
].GetStack().Last(); }
97 const wxArrayString
& GetStatusStack(int n
) const
98 { return m_panes
[n
].GetStack(); }
100 void PushStatusText(const wxString
& text
, int number
= 0);
101 void PopStatusText(int number
= 0);
106 // set status field widths as absolute numbers: positive widths mean that
107 // the field has the specified absolute width, negative widths are
108 // interpreted as the sizer options, i.e. the extra space (total space
109 // minus the sum of fixed width fields) is divided between the fields with
110 // negative width according to the abs value of the width (field with width
111 // -2 grows twice as much as one with width -1 &c)
112 virtual void SetStatusWidths(int n
, const int widths
[]);
114 int GetStatusWidth(int n
) const
115 { return m_panes
[n
].GetWidth(); }
120 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
121 // border around a field, wxSB_FLAT for no border around a field, so that it
122 // appears flat or wxSB_POPOUT to make the field appear raised.
123 // Setting field styles only works on wxMSW
124 virtual void SetStatusStyles(int n
, const int styles
[]);
126 int GetStatusStyle(int n
) const
127 { return m_panes
[n
].GetStyle(); }
132 // Get the position and size of the field's internal bounding rectangle
133 virtual bool GetFieldRect(int i
, wxRect
& rect
) const = 0;
135 // sets the minimal vertical size of the status bar
136 virtual void SetMinHeight(int height
) = 0;
138 // get the dimensions of the horizontal and vertical borders
139 virtual int GetBorderX() const = 0;
140 virtual int GetBorderY() const = 0;
145 const wxStatusBarPane
& GetField(int n
) const
146 { return m_panes
[n
]; }
148 // wxWindow overrides:
150 // don't want status bars to accept the focus at all
151 virtual bool AcceptsFocus() const { return false; }
153 // the client size of a toplevel window doesn't include the status bar
154 virtual bool CanBeOutsideClientArea() const { return true; }
157 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
159 // calculate the real field widths for the given total available size
160 wxArrayInt
CalculateAbsWidths(wxCoord widthTotal
) const;
162 // the array with the pane infos:
163 wxStatusBarPaneArray m_panes
;
165 // if true overrides the width info of the wxStatusBarPanes
166 bool m_bSameWidthForAllPanes
;
168 wxDECLARE_NO_COPY_CLASS(wxStatusBarBase
);
171 // ----------------------------------------------------------------------------
172 // include the actual wxStatusBar class declaration
173 // ----------------------------------------------------------------------------
175 #if defined(__WXUNIVERSAL__)
176 #define wxStatusBarUniv wxStatusBar
177 #include "wx/univ/statusbr.h"
178 #elif defined(__WXPALMOS__)
179 #define wxStatusBarPalm wxStatusBar
180 #include "wx/palmos/statusbr.h"
181 #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
182 #include "wx/msw/statusbar.h"
183 #elif defined(__WXMAC__)
184 #define wxStatusBarMac wxStatusBar
185 #include "wx/generic/statusbr.h"
186 #include "wx/osx/statusbr.h"
188 #define wxStatusBarGeneric wxStatusBar
189 #include "wx/generic/statusbr.h"
192 #endif // wxUSE_STATUSBAR
195 // _WX_STATUSBR_H_BASE_