]> git.saurik.com Git - wxWidgets.git/blame - include/wx/statusbr.h
Minor corrections to make dist after reports
[wxWidgets.git] / include / wx / statusbr.h
CommitLineData
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$
99d80019 8// Copyright: (c) Vadim Zeitlin
65571936 9// Licence: wxWindows licence
ed791986
VZ
10/////////////////////////////////////////////////////////////////////////////
11
34138703
JS
12#ifndef _WX_STATUSBR_H_BASE_
13#define _WX_STATUSBR_H_BASE_
c801d85f 14
3304646d 15#include "wx/defs.h"
ed791986 16
1e6feb95
VZ
17#if wxUSE_STATUSBAR
18
3304646d 19#include "wx/window.h"
1f361cdd 20#include "wx/list.h"
ed39ff57 21#include "wx/dynarray.h"
1f361cdd 22
53b6d7a2
PC
23extern WXDLLIMPEXP_DATA_CORE(const wxChar) wxStatusBarNameStr[];
24
1f361cdd
MB
25WX_DECLARE_LIST(wxString, wxListString);
26
c2919ab3
VZ
27// ----------------------------------------------------------------------------
28// wxStatusBar constants
29// ----------------------------------------------------------------------------
30
31// style flags for fields
32#define wxSB_NORMAL 0x0000
33#define wxSB_FLAT 0x0001
34#define wxSB_RAISED 0x0002
35
ed791986
VZ
36// ----------------------------------------------------------------------------
37// wxStatusBar: a window near the bottom of the frame used for status info
38// ----------------------------------------------------------------------------
39
53a2db12 40class WXDLLIMPEXP_CORE wxStatusBarBase : public wxWindow
ed791986
VZ
41{
42public:
71e03035
VZ
43 wxStatusBarBase();
44
45 virtual ~wxStatusBarBase();
46
47 // field count
48 // -----------
ed791986 49
71e03035
VZ
50 // set the number of fields and call SetStatusWidths(widths) if widths are
51 // given
52 virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
ed791986
VZ
53 int GetFieldsCount() const { return m_nFields; }
54
71e03035
VZ
55 // field text
56 // ----------
57
ed791986
VZ
58 virtual void SetStatusText(const wxString& text, int number = 0) = 0;
59 virtual wxString GetStatusText(int number = 0) const = 0;
60
1f361cdd
MB
61 void PushStatusText(const wxString& text, int number = 0);
62 void PopStatusText(int number = 0);
63
71e03035
VZ
64 // fields widths
65 // -------------
66
67 // set status field widths as absolute numbers: positive widths mean that
68 // the field has the specified absolute width, negative widths are
69 // interpreted as the sizer options, i.e. the extra space (total space
70 // minus the sum of fixed width fields) is divided between the fields with
71 // negative width according to the abs value of the width (field with width
72 // -2 grows twice as much as one with width -1 &c)
73 virtual void SetStatusWidths(int n, const int widths[]);
74
c2919ab3
VZ
75 // field styles
76 // ------------
77
d775fa82
WS
78 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
79 // border around a field, wxSB_FLAT for no border around a field, so that it
c2919ab3
VZ
80 // appears flat or wxSB_POPOUT to make the field appear raised.
81 // Setting field styles only works on wxMSW
82 virtual void SetStatusStyles(int n, const int styles[]);
83
71e03035
VZ
84 // geometry
85 // --------
ed791986
VZ
86
87 // Get the position and size of the field's internal bounding rectangle
88 virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
89
90 // sets the minimal vertical size of the status bar
91 virtual void SetMinHeight(int height) = 0;
92
93 // get the dimensions of the horizontal and vertical borders
94 virtual int GetBorderX() const = 0;
95 virtual int GetBorderY() const = 0;
96
1e6feb95 97 // don't want status bars to accept the focus at all
d775fa82 98 virtual bool AcceptsFocus() const { return false; }
1e6feb95 99
c04c7a3d
VS
100 virtual bool CanBeOutsideClientArea() const { return true; }
101
ed791986 102protected:
3c75d8ba
PC
103 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
104
71e03035
VZ
105 // set the widths array to NULL
106 void InitWidths();
107
108 // free the status widths arrays
109 void FreeWidths();
110
111 // reset the widths
112 void ReinitWidths() { FreeWidths(); InitWidths(); }
113
c2919ab3
VZ
114 // same, for field styles
115 void InitStyles();
116 void FreeStyles();
117 void ReinitStyles() { FreeStyles(); InitStyles(); }
118
1f361cdd
MB
119 // same, for text stacks
120 void InitStacks();
121 void FreeStacks();
122 void ReinitStacks() { FreeStacks(); InitStacks(); }
123
71e03035
VZ
124 // calculate the real field widths for the given total available size
125 wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
126
1f361cdd
MB
127 // use these functions to access the stacks of field strings
128 wxListString *GetStatusStack(int i) const;
129 wxListString *GetOrCreateStatusStack(int i);
130
71e03035
VZ
131 // the current number of fields
132 int m_nFields;
133
134 // the widths of the fields in pixels if !NULL, all fields have the same
135 // width otherwise
136 int *m_statusWidths;
1f361cdd 137
d775fa82 138 // the styles of the fields
c2919ab3
VZ
139 int *m_statusStyles;
140
1f361cdd
MB
141 // stacks of previous values for PushStatusText/PopStatusText
142 // this is created on demand, use GetStatusStack/GetOrCreateStatusStack
143 wxListString **m_statusTextStacks;
22f3361e
VZ
144
145 DECLARE_NO_COPY_CLASS(wxStatusBarBase)
ed791986
VZ
146};
147
71e03035
VZ
148// ----------------------------------------------------------------------------
149// include the actual wxStatusBar class declaration
150// ----------------------------------------------------------------------------
151
152#if defined(__WXUNIVERSAL__)
153 #define wxStatusBarUniv wxStatusBar
ed791986 154
71e03035 155 #include "wx/univ/statusbr.h"
4055ed82 156#elif defined(__WXPALMOS__)
ffecfa5a
JS
157 #define wxStatusBarPalm wxStatusBar
158
771be77f 159 #include "wx/palmos/statusbr.h"
71e03035 160#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
936f6353 161 #include "wx/msw/statusbar.h"
656fc51c 162#elif defined(__WXMAC__)
71e03035 163 #define wxStatusBarMac wxStatusBar
71e03035 164
5fde6fcc 165 #include "wx/generic/statusbr.h"
ef0e9220 166 #include "wx/osx/statusbr.h"
ed791986 167#else
71e03035 168 #define wxStatusBarGeneric wxStatusBar
ed791986 169
71e03035 170 #include "wx/generic/statusbr.h"
ed791986
VZ
171#endif
172
71e03035 173#endif // wxUSE_STATUSBAR
1e6feb95 174
c801d85f 175#endif
34138703 176 // _WX_STATUSBR_H_BASE_