]> git.saurik.com Git - wxWidgets.git/blob - include/wx/statusbr.h
a5593c27cf92a79a7a26d0df3c2b322a7a3dc0f0
[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 char) wxStatusBarNameStr[];
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 // wxStatusBarPane: an helper for wxStatusBar
36 // ----------------------------------------------------------------------------
37
38 class wxStatusBarPane
39 {
40 public:
41 wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0)
42 : nStyle(style), nWidth(width) {}
43
44 int nStyle;
45 int nWidth; // the width maybe negative, indicating a variable-width field
46
47 // this is the array of the stacked strings of this pane; note that this
48 // stack does not include the string currently displayed in this pane
49 // as it's stored in the native status bar control
50 wxArrayString arrStack;
51 };
52
53 WX_DECLARE_OBJARRAY(wxStatusBarPane, wxStatusBarPaneArray);
54
55 // ----------------------------------------------------------------------------
56 // wxStatusBar: a window near the bottom of the frame used for status info
57 // ----------------------------------------------------------------------------
58
59 class WXDLLIMPEXP_CORE wxStatusBarBase : public wxWindow
60 {
61 public:
62 wxStatusBarBase();
63
64 virtual ~wxStatusBarBase();
65
66 // field count
67 // -----------
68
69 // set the number of fields and call SetStatusWidths(widths) if widths are
70 // given
71 virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
72 int GetFieldsCount() const { return m_panes.GetCount(); }
73
74 // field text
75 // ----------
76
77 virtual void SetStatusText(const wxString& text, int number = 0) = 0;
78 virtual wxString GetStatusText(int number = 0) const = 0;
79
80 void PushStatusText(const wxString& text, int number = 0);
81 void PopStatusText(int number = 0);
82
83 // fields widths
84 // -------------
85
86 // set status field widths as absolute numbers: positive widths mean that
87 // the field has the specified absolute width, negative widths are
88 // interpreted as the sizer options, i.e. the extra space (total space
89 // minus the sum of fixed width fields) is divided between the fields with
90 // negative width according to the abs value of the width (field with width
91 // -2 grows twice as much as one with width -1 &c)
92 virtual void SetStatusWidths(int n, const int widths[]);
93
94 // field styles
95 // ------------
96
97 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
98 // border around a field, wxSB_FLAT for no border around a field, so that it
99 // appears flat or wxSB_POPOUT to make the field appear raised.
100 // Setting field styles only works on wxMSW
101 virtual void SetStatusStyles(int n, const int styles[]);
102
103 // geometry
104 // --------
105
106 // Get the position and size of the field's internal bounding rectangle
107 virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
108
109 // sets the minimal vertical size of the status bar
110 virtual void SetMinHeight(int height) = 0;
111
112 // get the dimensions of the horizontal and vertical borders
113 virtual int GetBorderX() const = 0;
114 virtual int GetBorderY() const = 0;
115
116 // don't want status bars to accept the focus at all
117 virtual bool AcceptsFocus() const { return false; }
118
119 virtual bool CanBeOutsideClientArea() const { return true; }
120
121 protected:
122 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
123
124 // calculate the real field widths for the given total available size
125 wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
126
127 // the array with the pane infos:
128 wxStatusBarPaneArray m_panes;
129
130 // if true overrides the width info of the wxStatusBarPanes
131 bool m_bSameWidthForAllPanes;
132
133 DECLARE_NO_COPY_CLASS(wxStatusBarBase)
134 };
135
136 // ----------------------------------------------------------------------------
137 // include the actual wxStatusBar class declaration
138 // ----------------------------------------------------------------------------
139
140 #if defined(__WXUNIVERSAL__)
141 #define wxStatusBarUniv wxStatusBar
142 #include "wx/univ/statusbr.h"
143 #elif defined(__WXPALMOS__)
144 #define wxStatusBarPalm wxStatusBar
145 #include "wx/palmos/statusbr.h"
146 #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
147 #include "wx/msw/statusbar.h"
148 #elif defined(__WXMAC__)
149 #define wxStatusBarMac wxStatusBar
150 #include "wx/generic/statusbr.h"
151 #include "wx/osx/statusbr.h"
152 #else
153 #define wxStatusBarGeneric wxStatusBar
154 #include "wx/generic/statusbr.h"
155 #endif
156
157 #endif // wxUSE_STATUSBAR
158
159 #endif
160 // _WX_STATUSBR_H_BASE_