Always use wxFULL_REPAINT_ON_RESIZE for generic status bar.
[wxWidgets.git] / include / wx / statusbr.h
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$
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_STATUSBR_H_BASE_
13 #define _WX_STATUSBR_H_BASE_
14
15 #include "wx/defs.h"
16
17 #if wxUSE_STATUSBAR
18
19 #include "wx/window.h"
20 #include "wx/list.h"
21 #include "wx/dynarray.h"
22
23 extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxStatusBarNameStr[];
24
25 WX_DECLARE_LIST(wxString, wxListString);
26
27 // ----------------------------------------------------------------------------
28 // wxStatusBar constants
29 // ----------------------------------------------------------------------------
30
31 // style flags for fields
32 #define wxSB_NORMAL 0x0000
33 #define wxSB_FLAT 0x0001
34 #define wxSB_RAISED 0x0002
35
36 // ----------------------------------------------------------------------------
37 // wxStatusBar: a window near the bottom of the frame used for status info
38 // ----------------------------------------------------------------------------
39
40 class WXDLLEXPORT wxStatusBarBase : public wxWindow
41 {
42 public:
43 wxStatusBarBase();
44
45 virtual ~wxStatusBarBase();
46
47 // field count
48 // -----------
49
50 // set the number of fields and call SetStatusWidths(widths) if widths are
51 // given
52 virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
53 int GetFieldsCount() const { return m_nFields; }
54
55 // field text
56 // ----------
57
58 virtual void SetStatusText(const wxString& text, int number = 0) = 0;
59 virtual wxString GetStatusText(int number = 0) const = 0;
60
61 void PushStatusText(const wxString& text, int number = 0);
62 void PopStatusText(int number = 0);
63
64 // fields widths
65 // -------------
66
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[]);
74
75 // field styles
76 // ------------
77
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[]);
83
84 // geometry
85 // --------
86
87 // Get the position and size of the field's internal bounding rectangle
88 virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
89
90 // sets the minimal vertical size of the status bar
91 virtual void SetMinHeight(int height) = 0;
92
93 // get the dimensions of the horizontal and vertical borders
94 virtual int GetBorderX() const = 0;
95 virtual int GetBorderY() const = 0;
96
97 // don't want status bars to accept the focus at all
98 virtual bool AcceptsFocus() const { return false; }
99
100 protected:
101 // set the widths array to NULL
102 void InitWidths();
103
104 // free the status widths arrays
105 void FreeWidths();
106
107 // reset the widths
108 void ReinitWidths() { FreeWidths(); InitWidths(); }
109
110 // same, for field styles
111 void InitStyles();
112 void FreeStyles();
113 void ReinitStyles() { FreeStyles(); InitStyles(); }
114
115 // same, for text stacks
116 void InitStacks();
117 void FreeStacks();
118 void ReinitStacks() { FreeStacks(); InitStacks(); }
119
120 // calculate the real field widths for the given total available size
121 wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
122
123 // use these functions to access the stacks of field strings
124 wxListString *GetStatusStack(int i) const;
125 wxListString *GetOrCreateStatusStack(int i);
126
127 // the current number of fields
128 int m_nFields;
129
130 // the widths of the fields in pixels if !NULL, all fields have the same
131 // width otherwise
132 int *m_statusWidths;
133
134 // the styles of the fields
135 int *m_statusStyles;
136
137 // stacks of previous values for PushStatusText/PopStatusText
138 // this is created on demand, use GetStatusStack/GetOrCreateStatusStack
139 wxListString **m_statusTextStacks;
140
141 DECLARE_NO_COPY_CLASS(wxStatusBarBase)
142 };
143
144 // ----------------------------------------------------------------------------
145 // include the actual wxStatusBar class declaration
146 // ----------------------------------------------------------------------------
147
148 #if defined(__WXUNIVERSAL__)
149 #define wxStatusBarUniv wxStatusBar
150
151 #include "wx/univ/statusbr.h"
152 #elif defined(__WXPALMOS__)
153 #define wxStatusBarPalm wxStatusBar
154
155 #include "wx/palmos/statusbr.h"
156 #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
157 #define wxStatusBar95 wxStatusBar
158
159 #include "wx/msw/statbr95.h"
160 #elif defined(__WXMAC__)
161 #define wxStatusBarMac wxStatusBar
162
163 #include "wx/generic/statusbr.h"
164 #include "wx/mac/statusbr.h"
165 #else
166 #define wxStatusBarGeneric wxStatusBar
167
168 #include "wx/generic/statusbr.h"
169 #endif
170
171 #endif // wxUSE_STATUSBAR
172
173 #endif
174 // _WX_STATUSBR_H_BASE_