]> git.saurik.com Git - wxWidgets.git/blame - include/wx/statusbr.h
undo the last change as it results in buildbot configuration error
[wxWidgets.git] / include / wx / statusbr.h
CommitLineData
ed791986
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/statusbr.h
3// Purpose: wxStatusBar class interface
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 05.02.00
7// RCS-ID: $Id$
99d80019 8// Copyright: (c) Vadim Zeitlin
65571936 9// Licence: wxWindows licence
ed791986
VZ
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_STATUSBR_H_BASE_
13#define _WX_STATUSBR_H_BASE_
c801d85f 14
3304646d 15#include "wx/defs.h"
ed791986 16
1e6feb95
VZ
17#if wxUSE_STATUSBAR
18
3304646d 19#include "wx/window.h"
1f361cdd 20#include "wx/list.h"
ed39ff57 21#include "wx/dynarray.h"
1f361cdd 22
23318a53 23extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusBarNameStr[];
53b6d7a2 24
c2919ab3
VZ
25// ----------------------------------------------------------------------------
26// wxStatusBar constants
27// ----------------------------------------------------------------------------
28
c94bdf2a
FM
29// wxStatusBar styles
30#define wxST_SIZEGRIP 0x0010
31#define wxST_SHOW_TIPS 0x0020
32
33#define wxST_DEFAULT_STYLE (wxST_SIZEGRIP|wxST_SHOW_TIPS|wxFULL_REPAINT_ON_RESIZE)
34
c2919ab3
VZ
35// style flags for fields
36#define wxSB_NORMAL 0x0000
37#define wxSB_FLAT 0x0001
38#define wxSB_RAISED 0x0002
39
7b6fefbe
FM
40// ----------------------------------------------------------------------------
41// wxStatusBarPane: an helper for wxStatusBar
42// ----------------------------------------------------------------------------
43
7235c54d 44class WXDLLIMPEXP_CORE wxStatusBarPane
7b6fefbe 45{
b31eaa5c
FM
46 // only wxStatusBarBase can access our internal members and modify them:
47 friend class WXDLLIMPEXP_FWD_CORE wxStatusBarBase;
48
7b6fefbe
FM
49public:
50 wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0)
c94bdf2a
FM
51 : m_nStyle(style), m_nWidth(width)
52 { m_arrStack.Add(wxEmptyString); m_bEllipsized=false; }
b31eaa5c
FM
53
54 int GetWidth() const
55 { return m_nWidth; }
56 int GetStyle() const
57 { return m_nStyle; }
58
59 const wxArrayString& GetStack() const
60 { return m_arrStack; }
61
c94bdf2a
FM
62 // implementation-only getter:
63 bool IsEllipsized() const
64 { return m_bEllipsized; }
65
66 // NOTE: there are no setters in wxStatusBarPane;
67 // use wxStatusBar functions to modify a wxStatusBarPane
7b6fefbe 68
b31eaa5c
FM
69protected:
70 int m_nStyle;
71 int m_nWidth; // the width maybe negative, indicating a variable-width field
7b6fefbe
FM
72
73 // this is the array of the stacked strings of this pane; note that this
0cd15959
FM
74 // stack does include also the string currently displayed in this pane
75 // as the version stored in the native status bar control is possibly
c94bdf2a 76 // ellipsized; note that m_arrStack.Last() is the top of the stack
0cd15959 77 // (i.e. the string shown in the status bar)
b31eaa5c 78 wxArrayString m_arrStack;
c94bdf2a
FM
79
80 // was the m_arrStack.Last() string shown in the status bar control ellipsized?
81 bool m_bEllipsized;
7b6fefbe
FM
82};
83
84WX_DECLARE_OBJARRAY(wxStatusBarPane, wxStatusBarPaneArray);
85
ed791986
VZ
86// ----------------------------------------------------------------------------
87// wxStatusBar: a window near the bottom of the frame used for status info
88// ----------------------------------------------------------------------------
89
53a2db12 90class WXDLLIMPEXP_CORE wxStatusBarBase : public wxWindow
ed791986
VZ
91{
92public:
71e03035
VZ
93 wxStatusBarBase();
94
95 virtual ~wxStatusBarBase();
96
97 // field count
98 // -----------
ed791986 99
71e03035
VZ
100 // set the number of fields and call SetStatusWidths(widths) if widths are
101 // given
102 virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
7b6fefbe 103 int GetFieldsCount() const { return m_panes.GetCount(); }
ed791986 104
71e03035
VZ
105 // field text
106 // ----------
107
30800ba5
FM
108 // NOTE: even if it is not pure virtual, SetStatusText() must be overloaded by
109 // the derived classes to update the given text in the native control
0cd15959 110 virtual void SetStatusText(const wxString& text, int number = 0)
b31eaa5c 111 { m_panes[number].GetStack().Last() = text; }
0cd15959 112 virtual wxString GetStatusText(int number = 0) const
b31eaa5c
FM
113 { return m_panes[number].GetStack().Last(); }
114 const wxArrayString& GetStatusStack(int n) const
115 { return m_panes[n].GetStack(); }
ed791986 116
1f361cdd
MB
117 void PushStatusText(const wxString& text, int number = 0);
118 void PopStatusText(int number = 0);
119
71e03035
VZ
120 // fields widths
121 // -------------
122
123 // set status field widths as absolute numbers: positive widths mean that
124 // the field has the specified absolute width, negative widths are
125 // interpreted as the sizer options, i.e. the extra space (total space
126 // minus the sum of fixed width fields) is divided between the fields with
127 // negative width according to the abs value of the width (field with width
128 // -2 grows twice as much as one with width -1 &c)
129 virtual void SetStatusWidths(int n, const int widths[]);
b31eaa5c
FM
130
131 int GetStatusWidth(int n) const
132 { return m_panes[n].GetWidth(); }
71e03035 133
c2919ab3
VZ
134 // field styles
135 // ------------
136
d775fa82
WS
137 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
138 // border around a field, wxSB_FLAT for no border around a field, so that it
c2919ab3
VZ
139 // appears flat or wxSB_POPOUT to make the field appear raised.
140 // Setting field styles only works on wxMSW
141 virtual void SetStatusStyles(int n, const int styles[]);
b31eaa5c
FM
142
143 int GetStatusStyle(int n) const
144 { return m_panes[n].GetStyle(); }
c2919ab3 145
71e03035
VZ
146 // geometry
147 // --------
ed791986
VZ
148
149 // Get the position and size of the field's internal bounding rectangle
150 virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
151
152 // sets the minimal vertical size of the status bar
153 virtual void SetMinHeight(int height) = 0;
154
155 // get the dimensions of the horizontal and vertical borders
156 virtual int GetBorderX() const = 0;
157 virtual int GetBorderY() const = 0;
c94bdf2a
FM
158
159 wxSize GetBorders() const
160 { return wxSize(GetBorderX(), GetBorderY()); }
ed791986 161
b31eaa5c
FM
162 // miscellaneous
163 // -------------
164
165 const wxStatusBarPane& GetField(int n) const
166 { return m_panes[n]; }
167
168 // wxWindow overrides:
169
1e6feb95 170 // don't want status bars to accept the focus at all
d775fa82 171 virtual bool AcceptsFocus() const { return false; }
1e6feb95 172
b31eaa5c 173 // the client size of a toplevel window doesn't include the status bar
c04c7a3d
VS
174 virtual bool CanBeOutsideClientArea() const { return true; }
175
ed791986 176protected:
3c75d8ba
PC
177 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
178
71e03035
VZ
179 // calculate the real field widths for the given total available size
180 wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
c94bdf2a
FM
181
182 // an internal utility used to keep track of which panes have labels
183 // which were last rendered as ellipsized...
184 void SetEllipsizedFlag(int n, bool ellipsized)
185 { m_panes[n].m_bEllipsized = ellipsized; }
71e03035 186
7b6fefbe
FM
187 // the array with the pane infos:
188 wxStatusBarPaneArray m_panes;
1f361cdd 189
7b6fefbe
FM
190 // if true overrides the width info of the wxStatusBarPanes
191 bool m_bSameWidthForAllPanes;
22f3361e 192
c0c133e1 193 wxDECLARE_NO_COPY_CLASS(wxStatusBarBase);
ed791986
VZ
194};
195
71e03035
VZ
196// ----------------------------------------------------------------------------
197// include the actual wxStatusBar class declaration
198// ----------------------------------------------------------------------------
199
200#if defined(__WXUNIVERSAL__)
201 #define wxStatusBarUniv wxStatusBar
71e03035 202 #include "wx/univ/statusbr.h"
4055ed82 203#elif defined(__WXPALMOS__)
ffecfa5a 204 #define wxStatusBarPalm wxStatusBar
771be77f 205 #include "wx/palmos/statusbr.h"
71e03035 206#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
936f6353 207 #include "wx/msw/statusbar.h"
656fc51c 208#elif defined(__WXMAC__)
71e03035 209 #define wxStatusBarMac wxStatusBar
5fde6fcc 210 #include "wx/generic/statusbr.h"
ef0e9220 211 #include "wx/osx/statusbr.h"
ed791986 212#else
71e03035 213 #define wxStatusBarGeneric wxStatusBar
71e03035 214 #include "wx/generic/statusbr.h"
ed791986
VZ
215#endif
216
71e03035 217#endif // wxUSE_STATUSBAR
1e6feb95 218
c801d85f 219#endif
34138703 220 // _WX_STATUSBR_H_BASE_