]> git.saurik.com Git - wxWidgets.git/blob - include/wx/statusbr.h
Removed some commented-out code
[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) wxWindows team
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_STATUSBR_H_BASE_
13 #define _WX_STATUSBR_H_BASE_
14
15 #if defined(__GNUG__) && !defined(__APPLE__)
16 #pragma interface "statbar.h"
17 #endif
18
19 #include "wx/window.h"
20
21 #if wxUSE_STATUSBAR
22
23 #include "wx/list.h"
24 #include "wx/dynarray.h"
25
26 WX_DECLARE_LIST(wxString, wxListString);
27
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:
35 wxStatusBarBase();
36
37 virtual ~wxStatusBarBase();
38
39 // field count
40 // -----------
41
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);
45 int GetFieldsCount() const { return m_nFields; }
46
47 // field text
48 // ----------
49
50 virtual void SetStatusText(const wxString& text, int number = 0) = 0;
51 virtual wxString GetStatusText(int number = 0) const = 0;
52
53 void PushStatusText(const wxString& text, int number = 0);
54 void PopStatusText(int number = 0);
55
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 // --------
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
80 // don't want status bars to accept the focus at all
81 virtual bool AcceptsFocus() const { return FALSE; }
82
83 protected:
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
93 // same, for text stacks
94 void InitStacks();
95 void FreeStacks();
96 void ReinitStacks() { FreeStacks(); InitStacks(); }
97
98 // calculate the real field widths for the given total available size
99 wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
100
101 // use these functions to access the stacks of field strings
102 wxListString *GetStatusStack(int i) const;
103 wxListString *GetOrCreateStatusStack(int i);
104
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;
111
112 // stacks of previous values for PushStatusText/PopStatusText
113 // this is created on demand, use GetStatusStack/GetOrCreateStatusStack
114 wxListString **m_statusTextStacks;
115
116 DECLARE_NO_COPY_CLASS(wxStatusBarBase)
117 };
118
119 // ----------------------------------------------------------------------------
120 // include the actual wxStatusBar class declaration
121 // ----------------------------------------------------------------------------
122
123 #if defined(__WXUNIVERSAL__)
124 #define wxStatusBarUniv wxStatusBar
125 #define sm_classwxStatusBarUniv sm_classwxStatusBar
126
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"
133 #elif defined(__WXMAC__)
134 #define wxStatusBarMac wxStatusBar
135 #define sm_classwxStatusBarMac sm_classwxStatusBar
136
137 #include "wx/generic/statusbr.h"
138 #include "wx/mac/statusbr.h"
139 #else
140 #define wxStatusBarGeneric wxStatusBar
141 #define sm_classwxStatusBarGeneric sm_classwxStatusBar
142
143 #include "wx/generic/statusbr.h"
144 #endif
145
146 #endif // wxUSE_STATUSBAR
147
148 #endif
149 // _WX_STATUSBR_H_BASE_