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_
15 #include "wx/window.h"
20 #include "wx/dynarray.h"
22 WX_DECLARE_LIST(wxString
, wxListString
);
24 // ----------------------------------------------------------------------------
25 // wxStatusBar constants
26 // ----------------------------------------------------------------------------
28 // style flags for fields
29 #define wxSB_NORMAL 0x0000
30 #define wxSB_FLAT 0x0001
31 #define wxSB_RAISED 0x0002
33 // ----------------------------------------------------------------------------
34 // wxStatusBar: a window near the bottom of the frame used for status info
35 // ----------------------------------------------------------------------------
37 class WXDLLEXPORT wxStatusBarBase
: public wxWindow
42 virtual ~wxStatusBarBase();
47 // set the number of fields and call SetStatusWidths(widths) if widths are
49 virtual void SetFieldsCount(int number
= 1, const int *widths
= NULL
);
50 int GetFieldsCount() const { return m_nFields
; }
55 virtual void SetStatusText(const wxString
& text
, int number
= 0) = 0;
56 virtual wxString
GetStatusText(int number
= 0) const = 0;
58 void PushStatusText(const wxString
& text
, int number
= 0);
59 void PopStatusText(int number
= 0);
64 // set status field widths as absolute numbers: positive widths mean that
65 // the field has the specified absolute width, negative widths are
66 // interpreted as the sizer options, i.e. the extra space (total space
67 // minus the sum of fixed width fields) is divided between the fields with
68 // negative width according to the abs value of the width (field with width
69 // -2 grows twice as much as one with width -1 &c)
70 virtual void SetStatusWidths(int n
, const int widths
[]);
75 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
76 // border around a field, wxSB_FLAT for no border around a field, so that it
77 // appears flat or wxSB_POPOUT to make the field appear raised.
78 // Setting field styles only works on wxMSW
79 virtual void SetStatusStyles(int n
, const int styles
[]);
84 // Get the position and size of the field's internal bounding rectangle
85 virtual bool GetFieldRect(int i
, wxRect
& rect
) const = 0;
87 // sets the minimal vertical size of the status bar
88 virtual void SetMinHeight(int height
) = 0;
90 // get the dimensions of the horizontal and vertical borders
91 virtual int GetBorderX() const = 0;
92 virtual int GetBorderY() const = 0;
94 // don't want status bars to accept the focus at all
95 virtual bool AcceptsFocus() const { return false; }
98 // set the widths array to NULL
101 // free the status widths arrays
105 void ReinitWidths() { FreeWidths(); InitWidths(); }
107 // same, for field styles
110 void ReinitStyles() { FreeStyles(); InitStyles(); }
112 // same, for text stacks
115 void ReinitStacks() { FreeStacks(); InitStacks(); }
117 // calculate the real field widths for the given total available size
118 wxArrayInt
CalculateAbsWidths(wxCoord widthTotal
) const;
120 // use these functions to access the stacks of field strings
121 wxListString
*GetStatusStack(int i
) const;
122 wxListString
*GetOrCreateStatusStack(int i
);
124 // the current number of fields
127 // the widths of the fields in pixels if !NULL, all fields have the same
131 // the styles of the fields
134 // stacks of previous values for PushStatusText/PopStatusText
135 // this is created on demand, use GetStatusStack/GetOrCreateStatusStack
136 wxListString
**m_statusTextStacks
;
138 DECLARE_NO_COPY_CLASS(wxStatusBarBase
)
141 // ----------------------------------------------------------------------------
142 // include the actual wxStatusBar class declaration
143 // ----------------------------------------------------------------------------
145 #if defined(__WXUNIVERSAL__)
146 #define wxStatusBarUniv wxStatusBar
148 #include "wx/univ/statusbr.h"
149 #elif defined(__WXPALMOS__)
150 #define wxStatusBarPalm wxStatusBar
152 #include "wx/palmos/statusbr.h"
153 #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
154 #define wxStatusBar95 wxStatusBar
156 #include "wx/msw/statbr95.h"
157 #elif defined(__WXMAC__)
158 #define wxStatusBarMac wxStatusBar
160 #include "wx/generic/statusbr.h"
161 #include "wx/mac/statusbr.h"
163 #define wxStatusBarGeneric wxStatusBar
165 #include "wx/generic/statusbr.h"
168 #endif // wxUSE_STATUSBAR
171 // _WX_STATUSBR_H_BASE_