1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxStatusBar class interface
4 // Author: Vadim Zeitlin
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_STATUSBR_H_BASE_
13 #define _WX_STATUSBR_H_BASE_
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "statbar.h"
19 #include "wx/window.h"
24 #include "wx/dynarray.h"
26 WX_DECLARE_LIST(wxString
, wxListString
);
28 // ----------------------------------------------------------------------------
29 // wxStatusBar constants
30 // ----------------------------------------------------------------------------
32 // style flags for fields
33 #define wxSB_NORMAL 0x0000
34 #define wxSB_FLAT 0x0001
35 #define wxSB_RAISED 0x0002
37 // ----------------------------------------------------------------------------
38 // wxStatusBar: a window near the bottom of the frame used for status info
39 // ----------------------------------------------------------------------------
41 class WXDLLEXPORT wxStatusBarBase
: public wxWindow
46 virtual ~wxStatusBarBase();
51 // set the number of fields and call SetStatusWidths(widths) if widths are
53 virtual void SetFieldsCount(int number
= 1, const int *widths
= NULL
);
54 int GetFieldsCount() const { return m_nFields
; }
59 virtual void SetStatusText(const wxString
& text
, int number
= 0) = 0;
60 virtual wxString
GetStatusText(int number
= 0) const = 0;
62 void PushStatusText(const wxString
& text
, int number
= 0);
63 void PopStatusText(int number
= 0);
68 // set status field widths as absolute numbers: positive widths mean that
69 // the field has the specified absolute width, negative widths are
70 // interpreted as the sizer options, i.e. the extra space (total space
71 // minus the sum of fixed width fields) is divided between the fields with
72 // negative width according to the abs value of the width (field with width
73 // -2 grows twice as much as one with width -1 &c)
74 virtual void SetStatusWidths(int n
, const int widths
[]);
79 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
80 // border around a field, wxSB_FLAT for no border around a field, so that it
81 // appears flat or wxSB_POPOUT to make the field appear raised.
82 // Setting field styles only works on wxMSW
83 virtual void SetStatusStyles(int n
, const int styles
[]);
88 // Get the position and size of the field's internal bounding rectangle
89 virtual bool GetFieldRect(int i
, wxRect
& rect
) const = 0;
91 // sets the minimal vertical size of the status bar
92 virtual void SetMinHeight(int height
) = 0;
94 // get the dimensions of the horizontal and vertical borders
95 virtual int GetBorderX() const = 0;
96 virtual int GetBorderY() const = 0;
98 // don't want status bars to accept the focus at all
99 virtual bool AcceptsFocus() const { return false; }
102 // set the widths array to NULL
105 // free the status widths arrays
109 void ReinitWidths() { FreeWidths(); InitWidths(); }
111 // same, for field styles
114 void ReinitStyles() { FreeStyles(); InitStyles(); }
116 // same, for text stacks
119 void ReinitStacks() { FreeStacks(); InitStacks(); }
121 // calculate the real field widths for the given total available size
122 wxArrayInt
CalculateAbsWidths(wxCoord widthTotal
) const;
124 // use these functions to access the stacks of field strings
125 wxListString
*GetStatusStack(int i
) const;
126 wxListString
*GetOrCreateStatusStack(int i
);
128 // the current number of fields
131 // the widths of the fields in pixels if !NULL, all fields have the same
135 // the styles of the fields
138 // stacks of previous values for PushStatusText/PopStatusText
139 // this is created on demand, use GetStatusStack/GetOrCreateStatusStack
140 wxListString
**m_statusTextStacks
;
142 DECLARE_NO_COPY_CLASS(wxStatusBarBase
)
145 // ----------------------------------------------------------------------------
146 // include the actual wxStatusBar class declaration
147 // ----------------------------------------------------------------------------
149 #if defined(__WXUNIVERSAL__)
150 #define wxStatusBarUniv wxStatusBar
152 #include "wx/univ/statusbr.h"
153 #elif defined(__PALMOS__)
154 #define wxStatusBarPalm wxStatusBar
156 #include "wx/palmos/statusbr.h"
157 #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
158 #define wxStatusBar95 wxStatusBar
160 #include "wx/msw/statbr95.h"
161 #elif defined(__WXMAC__)
162 #define wxStatusBarMac wxStatusBar
164 #include "wx/generic/statusbr.h"
165 #include "wx/mac/statusbr.h"
167 #define wxStatusBarGeneric wxStatusBar
169 #include "wx/generic/statusbr.h"
172 #endif // wxUSE_STATUSBAR
175 // _WX_STATUSBR_H_BASE_