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 wxChar
) wxStatusBarNameStr
[];
25 WX_DECLARE_LIST(wxString
, wxListString
);
27 // ----------------------------------------------------------------------------
28 // wxStatusBar constants
29 // ----------------------------------------------------------------------------
31 // style flags for fields
32 #define wxSB_NORMAL 0x0000
33 #define wxSB_FLAT 0x0001
34 #define wxSB_RAISED 0x0002
36 // ----------------------------------------------------------------------------
37 // wxStatusBar: a window near the bottom of the frame used for status info
38 // ----------------------------------------------------------------------------
40 class WXDLLEXPORT wxStatusBarBase
: public wxWindow
45 virtual ~wxStatusBarBase();
50 // set the number of fields and call SetStatusWidths(widths) if widths are
52 virtual void SetFieldsCount(int number
= 1, const int *widths
= NULL
);
53 int GetFieldsCount() const { return m_nFields
; }
58 virtual void SetStatusText(const wxString
& text
, int number
= 0) = 0;
59 virtual wxString
GetStatusText(int number
= 0) const = 0;
61 void PushStatusText(const wxString
& text
, int number
= 0);
62 void PopStatusText(int number
= 0);
67 // set status field widths as absolute numbers: positive widths mean that
68 // the field has the specified absolute width, negative widths are
69 // interpreted as the sizer options, i.e. the extra space (total space
70 // minus the sum of fixed width fields) is divided between the fields with
71 // negative width according to the abs value of the width (field with width
72 // -2 grows twice as much as one with width -1 &c)
73 virtual void SetStatusWidths(int n
, const int widths
[]);
78 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
79 // border around a field, wxSB_FLAT for no border around a field, so that it
80 // appears flat or wxSB_POPOUT to make the field appear raised.
81 // Setting field styles only works on wxMSW
82 virtual void SetStatusStyles(int n
, const int styles
[]);
87 // Get the position and size of the field's internal bounding rectangle
88 virtual bool GetFieldRect(int i
, wxRect
& rect
) const = 0;
90 // sets the minimal vertical size of the status bar
91 virtual void SetMinHeight(int height
) = 0;
93 // get the dimensions of the horizontal and vertical borders
94 virtual int GetBorderX() const = 0;
95 virtual int GetBorderY() const = 0;
97 // don't want status bars to accept the focus at all
98 virtual bool AcceptsFocus() const { return false; }
100 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
101 virtual bool CanBeOutsideClientArea() const { return true; }
104 // set the widths array to NULL
107 // free the status widths arrays
111 void ReinitWidths() { FreeWidths(); InitWidths(); }
113 // same, for field styles
116 void ReinitStyles() { FreeStyles(); InitStyles(); }
118 // same, for text stacks
121 void ReinitStacks() { FreeStacks(); InitStacks(); }
123 // calculate the real field widths for the given total available size
124 wxArrayInt
CalculateAbsWidths(wxCoord widthTotal
) const;
126 // use these functions to access the stacks of field strings
127 wxListString
*GetStatusStack(int i
) const;
128 wxListString
*GetOrCreateStatusStack(int i
);
130 // the current number of fields
133 // the widths of the fields in pixels if !NULL, all fields have the same
137 // the styles of the fields
140 // stacks of previous values for PushStatusText/PopStatusText
141 // this is created on demand, use GetStatusStack/GetOrCreateStatusStack
142 wxListString
**m_statusTextStacks
;
144 DECLARE_NO_COPY_CLASS(wxStatusBarBase
)
147 // ----------------------------------------------------------------------------
148 // include the actual wxStatusBar class declaration
149 // ----------------------------------------------------------------------------
151 #if defined(__WXUNIVERSAL__)
152 #define wxStatusBarUniv wxStatusBar
154 #include "wx/univ/statusbr.h"
155 #elif defined(__WXPALMOS__)
156 #define wxStatusBarPalm wxStatusBar
158 #include "wx/palmos/statusbr.h"
159 #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
160 #define wxStatusBar95 wxStatusBar
162 #include "wx/msw/statbr95.h"
163 #elif defined(__WXMAC__)
164 #define wxStatusBarMac wxStatusBar
166 #include "wx/generic/statusbr.h"
167 #include "wx/mac/statusbr.h"
169 #define wxStatusBarGeneric wxStatusBar
171 #include "wx/generic/statusbr.h"
174 #endif // wxUSE_STATUSBAR
177 // _WX_STATUSBR_H_BASE_