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