]> git.saurik.com Git - wxWidgets.git/blame - include/wx/statusbr.h
don't use annoying and unneeded in C++ casts of NULL to "T *"
[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
23318a53 23extern WXDLLIMPEXP_DATA_CORE(const char) wxStatusBarNameStr[];
53b6d7a2 24
c2919ab3
VZ
25// ----------------------------------------------------------------------------
26// wxStatusBar constants
27// ----------------------------------------------------------------------------
28
29// style flags for fields
30#define wxSB_NORMAL 0x0000
31#define wxSB_FLAT 0x0001
32#define wxSB_RAISED 0x0002
33
7b6fefbe
FM
34// ----------------------------------------------------------------------------
35// wxStatusBarPane: an helper for wxStatusBar
36// ----------------------------------------------------------------------------
37
38class wxStatusBarPane
39{
40public:
41 wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0)
42 : nStyle(style), nWidth(width) {}
43
44 int nStyle;
45 int nWidth; // the width maybe negative, indicating a variable-width field
46
47 // this is the array of the stacked strings of this pane; note that this
48 // stack does not include the string currently displayed in this pane
49 // as it's stored in the native status bar control
50 wxArrayString arrStack;
51};
52
53WX_DECLARE_OBJARRAY(wxStatusBarPane, wxStatusBarPaneArray);
54
ed791986
VZ
55// ----------------------------------------------------------------------------
56// wxStatusBar: a window near the bottom of the frame used for status info
57// ----------------------------------------------------------------------------
58
53a2db12 59class WXDLLIMPEXP_CORE wxStatusBarBase : public wxWindow
ed791986
VZ
60{
61public:
71e03035
VZ
62 wxStatusBarBase();
63
64 virtual ~wxStatusBarBase();
65
66 // field count
67 // -----------
ed791986 68
71e03035
VZ
69 // set the number of fields and call SetStatusWidths(widths) if widths are
70 // given
71 virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
7b6fefbe 72 int GetFieldsCount() const { return m_panes.GetCount(); }
ed791986 73
71e03035
VZ
74 // field text
75 // ----------
76
ed791986
VZ
77 virtual void SetStatusText(const wxString& text, int number = 0) = 0;
78 virtual wxString GetStatusText(int number = 0) const = 0;
79
1f361cdd
MB
80 void PushStatusText(const wxString& text, int number = 0);
81 void PopStatusText(int number = 0);
82
71e03035
VZ
83 // fields widths
84 // -------------
85
86 // set status field widths as absolute numbers: positive widths mean that
87 // the field has the specified absolute width, negative widths are
88 // interpreted as the sizer options, i.e. the extra space (total space
89 // minus the sum of fixed width fields) is divided between the fields with
90 // negative width according to the abs value of the width (field with width
91 // -2 grows twice as much as one with width -1 &c)
92 virtual void SetStatusWidths(int n, const int widths[]);
93
c2919ab3
VZ
94 // field styles
95 // ------------
96
d775fa82
WS
97 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
98 // border around a field, wxSB_FLAT for no border around a field, so that it
c2919ab3
VZ
99 // appears flat or wxSB_POPOUT to make the field appear raised.
100 // Setting field styles only works on wxMSW
101 virtual void SetStatusStyles(int n, const int styles[]);
102
71e03035
VZ
103 // geometry
104 // --------
ed791986
VZ
105
106 // Get the position and size of the field's internal bounding rectangle
107 virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
108
109 // sets the minimal vertical size of the status bar
110 virtual void SetMinHeight(int height) = 0;
111
112 // get the dimensions of the horizontal and vertical borders
113 virtual int GetBorderX() const = 0;
114 virtual int GetBorderY() const = 0;
115
1e6feb95 116 // don't want status bars to accept the focus at all
d775fa82 117 virtual bool AcceptsFocus() const { return false; }
1e6feb95 118
c04c7a3d
VS
119 virtual bool CanBeOutsideClientArea() const { return true; }
120
ed791986 121protected:
3c75d8ba
PC
122 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
123
71e03035
VZ
124 // calculate the real field widths for the given total available size
125 wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
126
7b6fefbe
FM
127 // the array with the pane infos:
128 wxStatusBarPaneArray m_panes;
1f361cdd 129
7b6fefbe
FM
130 // if true overrides the width info of the wxStatusBarPanes
131 bool m_bSameWidthForAllPanes;
22f3361e
VZ
132
133 DECLARE_NO_COPY_CLASS(wxStatusBarBase)
ed791986
VZ
134};
135
71e03035
VZ
136// ----------------------------------------------------------------------------
137// include the actual wxStatusBar class declaration
138// ----------------------------------------------------------------------------
139
140#if defined(__WXUNIVERSAL__)
141 #define wxStatusBarUniv wxStatusBar
71e03035 142 #include "wx/univ/statusbr.h"
4055ed82 143#elif defined(__WXPALMOS__)
ffecfa5a 144 #define wxStatusBarPalm wxStatusBar
771be77f 145 #include "wx/palmos/statusbr.h"
71e03035 146#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
936f6353 147 #include "wx/msw/statusbar.h"
656fc51c 148#elif defined(__WXMAC__)
71e03035 149 #define wxStatusBarMac wxStatusBar
5fde6fcc 150 #include "wx/generic/statusbr.h"
ef0e9220 151 #include "wx/osx/statusbr.h"
ed791986 152#else
71e03035 153 #define wxStatusBarGeneric wxStatusBar
71e03035 154 #include "wx/generic/statusbr.h"
ed791986
VZ
155#endif
156
71e03035 157#endif // wxUSE_STATUSBAR
1e6feb95 158
c801d85f 159#endif
34138703 160 // _WX_STATUSBR_H_BASE_