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