]>
Commit | Line | Data |
---|---|---|
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$ | |
8 | // Copyright: (c) wxWindows team | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
34138703 JS |
12 | #ifndef _WX_STATUSBR_H_BASE_ |
13 | #define _WX_STATUSBR_H_BASE_ | |
c801d85f | 14 | |
af49c4b8 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
71e03035 VZ |
16 | #pragma interface "statbar.h" |
17 | #endif | |
18 | ||
ed791986 VZ |
19 | #include "wx/window.h" |
20 | ||
1e6feb95 VZ |
21 | #if wxUSE_STATUSBAR |
22 | ||
1f361cdd | 23 | #include "wx/list.h" |
ed39ff57 | 24 | #include "wx/dynarray.h" |
1f361cdd MB |
25 | |
26 | WX_DECLARE_LIST(wxString, wxListString); | |
27 | ||
ed791986 VZ |
28 | // ---------------------------------------------------------------------------- |
29 | // wxStatusBar: a window near the bottom of the frame used for status info | |
30 | // ---------------------------------------------------------------------------- | |
31 | ||
32 | class WXDLLEXPORT wxStatusBarBase : public wxWindow | |
33 | { | |
34 | public: | |
71e03035 VZ |
35 | wxStatusBarBase(); |
36 | ||
37 | virtual ~wxStatusBarBase(); | |
38 | ||
39 | // field count | |
40 | // ----------- | |
ed791986 | 41 | |
71e03035 VZ |
42 | // set the number of fields and call SetStatusWidths(widths) if widths are |
43 | // given | |
44 | virtual void SetFieldsCount(int number = 1, const int *widths = NULL); | |
ed791986 VZ |
45 | int GetFieldsCount() const { return m_nFields; } |
46 | ||
71e03035 VZ |
47 | // field text |
48 | // ---------- | |
49 | ||
ed791986 VZ |
50 | virtual void SetStatusText(const wxString& text, int number = 0) = 0; |
51 | virtual wxString GetStatusText(int number = 0) const = 0; | |
52 | ||
1f361cdd MB |
53 | void PushStatusText(const wxString& text, int number = 0); |
54 | void PopStatusText(int number = 0); | |
55 | ||
71e03035 VZ |
56 | // fields widths |
57 | // ------------- | |
58 | ||
59 | // set status field widths as absolute numbers: positive widths mean that | |
60 | // the field has the specified absolute width, negative widths are | |
61 | // interpreted as the sizer options, i.e. the extra space (total space | |
62 | // minus the sum of fixed width fields) is divided between the fields with | |
63 | // negative width according to the abs value of the width (field with width | |
64 | // -2 grows twice as much as one with width -1 &c) | |
65 | virtual void SetStatusWidths(int n, const int widths[]); | |
66 | ||
67 | // geometry | |
68 | // -------- | |
ed791986 VZ |
69 | |
70 | // Get the position and size of the field's internal bounding rectangle | |
71 | virtual bool GetFieldRect(int i, wxRect& rect) const = 0; | |
72 | ||
73 | // sets the minimal vertical size of the status bar | |
74 | virtual void SetMinHeight(int height) = 0; | |
75 | ||
76 | // get the dimensions of the horizontal and vertical borders | |
77 | virtual int GetBorderX() const = 0; | |
78 | virtual int GetBorderY() const = 0; | |
79 | ||
1e6feb95 VZ |
80 | // don't want status bars to accept the focus at all |
81 | virtual bool AcceptsFocus() const { return FALSE; } | |
82 | ||
ed791986 | 83 | protected: |
71e03035 VZ |
84 | // set the widths array to NULL |
85 | void InitWidths(); | |
86 | ||
87 | // free the status widths arrays | |
88 | void FreeWidths(); | |
89 | ||
90 | // reset the widths | |
91 | void ReinitWidths() { FreeWidths(); InitWidths(); } | |
92 | ||
1f361cdd MB |
93 | // same, for text stacks |
94 | void InitStacks(); | |
95 | void FreeStacks(); | |
96 | void ReinitStacks() { FreeStacks(); InitStacks(); } | |
97 | ||
71e03035 VZ |
98 | // calculate the real field widths for the given total available size |
99 | wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const; | |
100 | ||
1f361cdd MB |
101 | // use these functions to access the stacks of field strings |
102 | wxListString *GetStatusStack(int i) const; | |
103 | wxListString *GetOrCreateStatusStack(int i); | |
104 | ||
71e03035 VZ |
105 | // the current number of fields |
106 | int m_nFields; | |
107 | ||
108 | // the widths of the fields in pixels if !NULL, all fields have the same | |
109 | // width otherwise | |
110 | int *m_statusWidths; | |
1f361cdd MB |
111 | |
112 | // stacks of previous values for PushStatusText/PopStatusText | |
113 | // this is created on demand, use GetStatusStack/GetOrCreateStatusStack | |
114 | wxListString **m_statusTextStacks; | |
22f3361e VZ |
115 | |
116 | DECLARE_NO_COPY_CLASS(wxStatusBarBase) | |
ed791986 VZ |
117 | }; |
118 | ||
71e03035 VZ |
119 | // ---------------------------------------------------------------------------- |
120 | // include the actual wxStatusBar class declaration | |
121 | // ---------------------------------------------------------------------------- | |
122 | ||
123 | #if defined(__WXUNIVERSAL__) | |
124 | #define wxStatusBarUniv wxStatusBar | |
125 | #define sm_classwxStatusBarUniv sm_classwxStatusBar | |
ed791986 | 126 | |
71e03035 VZ |
127 | #include "wx/univ/statusbr.h" |
128 | #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR | |
129 | #define wxStatusBar95 wxStatusBar | |
130 | #define sm_classwxStatusBar95 sm_classwxStatusBar | |
131 | ||
132 | #include "wx/msw/statbr95.h" | |
656fc51c | 133 | #elif defined(__WXMAC__) |
71e03035 VZ |
134 | #define wxStatusBarMac wxStatusBar |
135 | #define sm_classwxStatusBarMac sm_classwxStatusBar | |
136 | ||
5fde6fcc | 137 | #include "wx/generic/statusbr.h" |
a02bb143 | 138 | #include "wx/mac/statusbr.h" |
ed791986 | 139 | #else |
71e03035 VZ |
140 | #define wxStatusBarGeneric wxStatusBar |
141 | #define sm_classwxStatusBarGeneric sm_classwxStatusBar | |
ed791986 | 142 | |
71e03035 | 143 | #include "wx/generic/statusbr.h" |
ed791986 VZ |
144 | #endif |
145 | ||
71e03035 | 146 | #endif // wxUSE_STATUSBAR |
1e6feb95 | 147 | |
c801d85f | 148 | #endif |
34138703 | 149 | // _WX_STATUSBR_H_BASE_ |