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 WX_DECLARE_LIST(wxString
, wxListString
);
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 // wxStatusBar: a window near the bottom of the frame used for status info
36 // ----------------------------------------------------------------------------
38 class WXDLLEXPORT wxStatusBarBase
: public wxWindow
43 virtual ~wxStatusBarBase();
48 // set the number of fields and call SetStatusWidths(widths) if widths are
50 virtual void SetFieldsCount(int number
= 1, const int *widths
= NULL
);
51 int GetFieldsCount() const { return m_nFields
; }
56 virtual void SetStatusText(const wxString
& text
, int number
= 0) = 0;
57 virtual wxString
GetStatusText(int number
= 0) const = 0;
59 void PushStatusText(const wxString
& text
, int number
= 0);
60 void PopStatusText(int number
= 0);
65 // set status field widths as absolute numbers: positive widths mean that
66 // the field has the specified absolute width, negative widths are
67 // interpreted as the sizer options, i.e. the extra space (total space
68 // minus the sum of fixed width fields) is divided between the fields with
69 // negative width according to the abs value of the width (field with width
70 // -2 grows twice as much as one with width -1 &c)
71 virtual void SetStatusWidths(int n
, const int widths
[]);
76 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
77 // border around a field, wxSB_FLAT for no border around a field, so that it
78 // appears flat or wxSB_POPOUT to make the field appear raised.
79 // Setting field styles only works on wxMSW
80 virtual void SetStatusStyles(int n
, const int styles
[]);
85 // Get the position and size of the field's internal bounding rectangle
86 virtual bool GetFieldRect(int i
, wxRect
& rect
) const = 0;
88 // sets the minimal vertical size of the status bar
89 virtual void SetMinHeight(int height
) = 0;
91 // get the dimensions of the horizontal and vertical borders
92 virtual int GetBorderX() const = 0;
93 virtual int GetBorderY() const = 0;
95 // don't want status bars to accept the focus at all
96 virtual bool AcceptsFocus() const { return false; }
99 // set the widths array to NULL
102 // free the status widths arrays
106 void ReinitWidths() { FreeWidths(); InitWidths(); }
108 // same, for field styles
111 void ReinitStyles() { FreeStyles(); InitStyles(); }
113 // same, for text stacks
116 void ReinitStacks() { FreeStacks(); InitStacks(); }
118 // calculate the real field widths for the given total available size
119 wxArrayInt
CalculateAbsWidths(wxCoord widthTotal
) const;
121 // use these functions to access the stacks of field strings
122 wxListString
*GetStatusStack(int i
) const;
123 wxListString
*GetOrCreateStatusStack(int i
);
125 // the current number of fields
128 // the widths of the fields in pixels if !NULL, all fields have the same
132 // the styles of the fields
135 // stacks of previous values for PushStatusText/PopStatusText
136 // this is created on demand, use GetStatusStack/GetOrCreateStatusStack
137 wxListString
**m_statusTextStacks
;
139 DECLARE_NO_COPY_CLASS(wxStatusBarBase
)
142 // ----------------------------------------------------------------------------
143 // include the actual wxStatusBar class declaration
144 // ----------------------------------------------------------------------------
146 #if defined(__WXUNIVERSAL__)
147 #define wxStatusBarUniv wxStatusBar
149 #include "wx/univ/statusbr.h"
150 #elif defined(__WXPALMOS__)
151 #define wxStatusBarPalm wxStatusBar
153 #include "wx/palmos/statusbr.h"
154 #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
155 #define wxStatusBar95 wxStatusBar
157 #include "wx/msw/statbr95.h"
158 #elif defined(__WXMAC__)
159 #define wxStatusBarMac wxStatusBar
161 #include "wx/generic/statusbr.h"
162 #include "wx/mac/statusbr.h"
164 #define wxStatusBarGeneric wxStatusBar
166 #include "wx/generic/statusbr.h"
169 #endif // wxUSE_STATUSBAR
172 // _WX_STATUSBR_H_BASE_