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