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
) { arrStack
.Add(wxEmptyString
); }
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 include also the string currently displayed in this pane
49 // as the version stored in the native status bar control is possibly
50 // ellipsized; note that arrStack.Last() is the top of the stack
51 // (i.e. the string shown in the status bar)
52 wxArrayString arrStack
;
55 WX_DECLARE_OBJARRAY(wxStatusBarPane
, wxStatusBarPaneArray
);
57 // ----------------------------------------------------------------------------
58 // wxStatusBar: a window near the bottom of the frame used for status info
59 // ----------------------------------------------------------------------------
61 class WXDLLIMPEXP_CORE wxStatusBarBase
: public wxWindow
66 virtual ~wxStatusBarBase();
71 // set the number of fields and call SetStatusWidths(widths) if widths are
73 virtual void SetFieldsCount(int number
= 1, const int *widths
= NULL
);
74 int GetFieldsCount() const { return m_panes
.GetCount(); }
79 virtual void SetStatusText(const wxString
& text
, int number
= 0)
80 { m_panes
[number
].arrStack
.Last() = text
; }
81 virtual wxString
GetStatusText(int number
= 0) const
82 { return m_panes
[number
].arrStack
.Last(); }
84 void PushStatusText(const wxString
& text
, int number
= 0);
85 void PopStatusText(int number
= 0);
90 // set status field widths as absolute numbers: positive widths mean that
91 // the field has the specified absolute width, negative widths are
92 // interpreted as the sizer options, i.e. the extra space (total space
93 // minus the sum of fixed width fields) is divided between the fields with
94 // negative width according to the abs value of the width (field with width
95 // -2 grows twice as much as one with width -1 &c)
96 virtual void SetStatusWidths(int n
, const int widths
[]);
101 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
102 // border around a field, wxSB_FLAT for no border around a field, so that it
103 // appears flat or wxSB_POPOUT to make the field appear raised.
104 // Setting field styles only works on wxMSW
105 virtual void SetStatusStyles(int n
, const int styles
[]);
110 // Get the position and size of the field's internal bounding rectangle
111 virtual bool GetFieldRect(int i
, wxRect
& rect
) const = 0;
113 // sets the minimal vertical size of the status bar
114 virtual void SetMinHeight(int height
) = 0;
116 // get the dimensions of the horizontal and vertical borders
117 virtual int GetBorderX() const = 0;
118 virtual int GetBorderY() const = 0;
120 // don't want status bars to accept the focus at all
121 virtual bool AcceptsFocus() const { return false; }
123 virtual bool CanBeOutsideClientArea() const { return true; }
126 virtual wxBorder
GetDefaultBorder() const { return wxBORDER_NONE
; }
128 // calculate the real field widths for the given total available size
129 wxArrayInt
CalculateAbsWidths(wxCoord widthTotal
) const;
131 // the array with the pane infos:
132 wxStatusBarPaneArray m_panes
;
134 // if true overrides the width info of the wxStatusBarPanes
135 bool m_bSameWidthForAllPanes
;
137 wxDECLARE_NO_COPY_CLASS(wxStatusBarBase
);
140 // ----------------------------------------------------------------------------
141 // include the actual wxStatusBar class declaration
142 // ----------------------------------------------------------------------------
144 #if defined(__WXUNIVERSAL__)
145 #define wxStatusBarUniv wxStatusBar
146 #include "wx/univ/statusbr.h"
147 #elif defined(__WXPALMOS__)
148 #define wxStatusBarPalm wxStatusBar
149 #include "wx/palmos/statusbr.h"
150 #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
151 #include "wx/msw/statusbar.h"
152 #elif defined(__WXMAC__)
153 #define wxStatusBarMac wxStatusBar
154 #include "wx/generic/statusbr.h"
155 #include "wx/osx/statusbr.h"
157 #define wxStatusBarGeneric wxStatusBar
158 #include "wx/generic/statusbr.h"
161 #endif // wxUSE_STATUSBAR
164 // _WX_STATUSBR_H_BASE_