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 // ----------------------------------------------------------------------------
41 wxStatusBarPane(int style
= wxSB_NORMAL
, size_t width
= 0)
42 : nStyle(style
), nWidth(width
) {}
45 int nWidth
; // the width maybe negative, indicating a variable-width field
47 // this is the array of the stacked strings of this pane; note that this
48 // stack does not include the string currently displayed in this pane
49 // as it's stored in the native status bar control
50 wxArrayString arrStack
;
53 WX_DECLARE_OBJARRAY(wxStatusBarPane
, wxStatusBarPaneArray
);
55 // ----------------------------------------------------------------------------
56 // wxStatusBar: a window near the bottom of the frame used for status info
57 // ----------------------------------------------------------------------------
59 class WXDLLIMPEXP_CORE wxStatusBarBase
: public wxWindow
64 virtual ~wxStatusBarBase();
69 // set the number of fields and call SetStatusWidths(widths) if widths are
71 virtual void SetFieldsCount(int number
= 1, const int *widths
= NULL
);
72 int GetFieldsCount() const { return m_panes
.GetCount(); }
77 virtual void SetStatusText(const wxString
& text
, int number
= 0) = 0;
78 virtual wxString
GetStatusText(int number
= 0) const = 0;
80 void PushStatusText(const wxString
& text
, int number
= 0);
81 void PopStatusText(int number
= 0);
86 // set status field widths as absolute numbers: positive widths mean that
87 // the field has the specified absolute width, negative widths are
88 // interpreted as the sizer options, i.e. the extra space (total space
89 // minus the sum of fixed width fields) is divided between the fields with
90 // negative width according to the abs value of the width (field with width
91 // -2 grows twice as much as one with width -1 &c)
92 virtual void SetStatusWidths(int n
, const int widths
[]);
97 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
98 // border around a field, wxSB_FLAT for no border around a field, so that it
99 // appears flat or wxSB_POPOUT to make the field appear raised.
100 // Setting field styles only works on wxMSW
101 virtual void SetStatusStyles(int n
, const int styles
[]);
106 // Get the position and size of the field's internal bounding rectangle
107 virtual bool GetFieldRect(int i
, wxRect
& rect
) const = 0;
109 // sets the minimal vertical size of the status bar
110 virtual void SetMinHeight(int height
) = 0;
112 // get the dimensions of the horizontal and vertical borders
113 virtual int GetBorderX() const = 0;
114 virtual int GetBorderY() const = 0;
116 // don't want status bars to accept the focus at all
117 virtual bool AcceptsFocus() const { return false; }
119 virtual bool CanBeOutsideClientArea() const { return true; }
122 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
124 // calculate the real field widths for the given total available size
125 wxArrayInt
CalculateAbsWidths(wxCoord widthTotal
) const;
127 // the array with the pane infos:
128 wxStatusBarPaneArray m_panes
;
130 // if true overrides the width info of the wxStatusBarPanes
131 bool m_bSameWidthForAllPanes
;
133 DECLARE_NO_COPY_CLASS(wxStatusBarBase
)
136 // ----------------------------------------------------------------------------
137 // include the actual wxStatusBar class declaration
138 // ----------------------------------------------------------------------------
140 #if defined(__WXUNIVERSAL__)
141 #define wxStatusBarUniv wxStatusBar
142 #include "wx/univ/statusbr.h"
143 #elif defined(__WXPALMOS__)
144 #define wxStatusBarPalm wxStatusBar
145 #include "wx/palmos/statusbr.h"
146 #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
147 #include "wx/msw/statusbar.h"
148 #elif defined(__WXMAC__)
149 #define wxStatusBarMac wxStatusBar
150 #include "wx/generic/statusbr.h"
151 #include "wx/osx/statusbr.h"
153 #define wxStatusBarGeneric wxStatusBar
154 #include "wx/generic/statusbr.h"
157 #endif // wxUSE_STATUSBAR
160 // _WX_STATUSBR_H_BASE_