]> git.saurik.com Git - wxWidgets.git/blob - include/wx/statusbr.h
added missing wx/sizer.h header
[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 WX_DECLARE_LIST(wxString, wxListString);
24
25 // ----------------------------------------------------------------------------
26 // wxStatusBar constants
27 // ----------------------------------------------------------------------------
28
29 // style flags for fields
30 #define wxSB_NORMAL 0x0000
31 #define wxSB_FLAT 0x0001
32 #define wxSB_RAISED 0x0002
33
34 // ----------------------------------------------------------------------------
35 // wxStatusBar: a window near the bottom of the frame used for status info
36 // ----------------------------------------------------------------------------
37
38 class WXDLLEXPORT wxStatusBarBase : public wxWindow
39 {
40 public:
41 wxStatusBarBase();
42
43 virtual ~wxStatusBarBase();
44
45 // field count
46 // -----------
47
48 // set the number of fields and call SetStatusWidths(widths) if widths are
49 // given
50 virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
51 int GetFieldsCount() const { return m_nFields; }
52
53 // field text
54 // ----------
55
56 virtual void SetStatusText(const wxString& text, int number = 0) = 0;
57 virtual wxString GetStatusText(int number = 0) const = 0;
58
59 void PushStatusText(const wxString& text, int number = 0);
60 void PopStatusText(int number = 0);
61
62 // fields widths
63 // -------------
64
65 // set status field widths as absolute numbers: positive widths mean that
66 // the field has the specified absolute width, negative widths are
67 // interpreted as the sizer options, i.e. the extra space (total space
68 // minus the sum of fixed width fields) is divided between the fields with
69 // negative width according to the abs value of the width (field with width
70 // -2 grows twice as much as one with width -1 &c)
71 virtual void SetStatusWidths(int n, const int widths[]);
72
73 // field styles
74 // ------------
75
76 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
77 // border around a field, wxSB_FLAT for no border around a field, so that it
78 // appears flat or wxSB_POPOUT to make the field appear raised.
79 // Setting field styles only works on wxMSW
80 virtual void SetStatusStyles(int n, const int styles[]);
81
82 // geometry
83 // --------
84
85 // Get the position and size of the field's internal bounding rectangle
86 virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
87
88 // sets the minimal vertical size of the status bar
89 virtual void SetMinHeight(int height) = 0;
90
91 // get the dimensions of the horizontal and vertical borders
92 virtual int GetBorderX() const = 0;
93 virtual int GetBorderY() const = 0;
94
95 // don't want status bars to accept the focus at all
96 virtual bool AcceptsFocus() const { return false; }
97
98 protected:
99 // set the widths array to NULL
100 void InitWidths();
101
102 // free the status widths arrays
103 void FreeWidths();
104
105 // reset the widths
106 void ReinitWidths() { FreeWidths(); InitWidths(); }
107
108 // same, for field styles
109 void InitStyles();
110 void FreeStyles();
111 void ReinitStyles() { FreeStyles(); InitStyles(); }
112
113 // same, for text stacks
114 void InitStacks();
115 void FreeStacks();
116 void ReinitStacks() { FreeStacks(); InitStacks(); }
117
118 // calculate the real field widths for the given total available size
119 wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
120
121 // use these functions to access the stacks of field strings
122 wxListString *GetStatusStack(int i) const;
123 wxListString *GetOrCreateStatusStack(int i);
124
125 // the current number of fields
126 int m_nFields;
127
128 // the widths of the fields in pixels if !NULL, all fields have the same
129 // width otherwise
130 int *m_statusWidths;
131
132 // the styles of the fields
133 int *m_statusStyles;
134
135 // stacks of previous values for PushStatusText/PopStatusText
136 // this is created on demand, use GetStatusStack/GetOrCreateStatusStack
137 wxListString **m_statusTextStacks;
138
139 DECLARE_NO_COPY_CLASS(wxStatusBarBase)
140 };
141
142 // ----------------------------------------------------------------------------
143 // include the actual wxStatusBar class declaration
144 // ----------------------------------------------------------------------------
145
146 #if defined(__WXUNIVERSAL__)
147 #define wxStatusBarUniv wxStatusBar
148
149 #include "wx/univ/statusbr.h"
150 #elif defined(__WXPALMOS__)
151 #define wxStatusBarPalm wxStatusBar
152
153 #include "wx/palmos/statusbr.h"
154 #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
155 #define wxStatusBar95 wxStatusBar
156
157 #include "wx/msw/statbr95.h"
158 #elif defined(__WXMAC__)
159 #define wxStatusBarMac wxStatusBar
160
161 #include "wx/generic/statusbr.h"
162 #include "wx/mac/statusbr.h"
163 #else
164 #define wxStatusBarGeneric wxStatusBar
165
166 #include "wx/generic/statusbr.h"
167 #endif
168
169 #endif // wxUSE_STATUSBAR
170
171 #endif
172 // _WX_STATUSBR_H_BASE_