]> git.saurik.com Git - wxWidgets.git/blame - include/wx/statusbr.h
made definition of wxUSE_LOG_DEBUG dependent on wxDEBUG_LEVEL and added wxUSE_LOG_TRA...
[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
7235c54d 38class WXDLLIMPEXP_CORE wxStatusBarPane
7b6fefbe 39{
b31eaa5c
FM
40 // only wxStatusBarBase can access our internal members and modify them:
41 friend class WXDLLIMPEXP_FWD_CORE wxStatusBarBase;
42
7b6fefbe
FM
43public:
44 wxStatusBarPane(int style = wxSB_NORMAL, size_t width = 0)
b31eaa5c
FM
45 : m_nStyle(style), m_nWidth(width) { m_arrStack.Add(wxEmptyString); }
46
47 int GetWidth() const
48 { return m_nWidth; }
49 int GetStyle() const
50 { return m_nStyle; }
51
52 const wxArrayString& GetStack() const
53 { return m_arrStack; }
54
55 // use wxStatusBar setter functions to modify a wxStatusBarPane
7b6fefbe 56
b31eaa5c
FM
57protected:
58 int m_nStyle;
59 int m_nWidth; // the width maybe negative, indicating a variable-width field
7b6fefbe
FM
60
61 // this is the array of the stacked strings of this pane; note that this
0cd15959
FM
62 // stack does include also the string currently displayed in this pane
63 // as the version stored in the native status bar control is possibly
64 // ellipsized; note that arrStack.Last() is the top of the stack
65 // (i.e. the string shown in the status bar)
b31eaa5c 66 wxArrayString m_arrStack;
7b6fefbe
FM
67};
68
69WX_DECLARE_OBJARRAY(wxStatusBarPane, wxStatusBarPaneArray);
70
ed791986
VZ
71// ----------------------------------------------------------------------------
72// wxStatusBar: a window near the bottom of the frame used for status info
73// ----------------------------------------------------------------------------
74
53a2db12 75class WXDLLIMPEXP_CORE wxStatusBarBase : public wxWindow
ed791986
VZ
76{
77public:
71e03035
VZ
78 wxStatusBarBase();
79
80 virtual ~wxStatusBarBase();
81
82 // field count
83 // -----------
ed791986 84
71e03035
VZ
85 // set the number of fields and call SetStatusWidths(widths) if widths are
86 // given
87 virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
7b6fefbe 88 int GetFieldsCount() const { return m_panes.GetCount(); }
ed791986 89
71e03035
VZ
90 // field text
91 // ----------
92
0cd15959 93 virtual void SetStatusText(const wxString& text, int number = 0)
b31eaa5c 94 { m_panes[number].GetStack().Last() = text; }
0cd15959 95 virtual wxString GetStatusText(int number = 0) const
b31eaa5c
FM
96 { return m_panes[number].GetStack().Last(); }
97 const wxArrayString& GetStatusStack(int n) const
98 { return m_panes[n].GetStack(); }
ed791986 99
1f361cdd
MB
100 void PushStatusText(const wxString& text, int number = 0);
101 void PopStatusText(int number = 0);
102
71e03035
VZ
103 // fields widths
104 // -------------
105
106 // set status field widths as absolute numbers: positive widths mean that
107 // the field has the specified absolute width, negative widths are
108 // interpreted as the sizer options, i.e. the extra space (total space
109 // minus the sum of fixed width fields) is divided between the fields with
110 // negative width according to the abs value of the width (field with width
111 // -2 grows twice as much as one with width -1 &c)
112 virtual void SetStatusWidths(int n, const int widths[]);
b31eaa5c
FM
113
114 int GetStatusWidth(int n) const
115 { return m_panes[n].GetWidth(); }
71e03035 116
c2919ab3
VZ
117 // field styles
118 // ------------
119
d775fa82
WS
120 // Set the field style. Use either wxSB_NORMAL (default) for a standard 3D
121 // border around a field, wxSB_FLAT for no border around a field, so that it
c2919ab3
VZ
122 // appears flat or wxSB_POPOUT to make the field appear raised.
123 // Setting field styles only works on wxMSW
124 virtual void SetStatusStyles(int n, const int styles[]);
b31eaa5c
FM
125
126 int GetStatusStyle(int n) const
127 { return m_panes[n].GetStyle(); }
c2919ab3 128
71e03035
VZ
129 // geometry
130 // --------
ed791986
VZ
131
132 // Get the position and size of the field's internal bounding rectangle
133 virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
134
135 // sets the minimal vertical size of the status bar
136 virtual void SetMinHeight(int height) = 0;
137
138 // get the dimensions of the horizontal and vertical borders
139 virtual int GetBorderX() const = 0;
140 virtual int GetBorderY() const = 0;
141
b31eaa5c
FM
142 // miscellaneous
143 // -------------
144
145 const wxStatusBarPane& GetField(int n) const
146 { return m_panes[n]; }
147
148 // wxWindow overrides:
149
1e6feb95 150 // don't want status bars to accept the focus at all
d775fa82 151 virtual bool AcceptsFocus() const { return false; }
1e6feb95 152
b31eaa5c 153 // the client size of a toplevel window doesn't include the status bar
c04c7a3d
VS
154 virtual bool CanBeOutsideClientArea() const { return true; }
155
ed791986 156protected:
3c75d8ba
PC
157 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
158
71e03035
VZ
159 // calculate the real field widths for the given total available size
160 wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
161
7b6fefbe
FM
162 // the array with the pane infos:
163 wxStatusBarPaneArray m_panes;
1f361cdd 164
7b6fefbe
FM
165 // if true overrides the width info of the wxStatusBarPanes
166 bool m_bSameWidthForAllPanes;
22f3361e 167
c0c133e1 168 wxDECLARE_NO_COPY_CLASS(wxStatusBarBase);
ed791986
VZ
169};
170
71e03035
VZ
171// ----------------------------------------------------------------------------
172// include the actual wxStatusBar class declaration
173// ----------------------------------------------------------------------------
174
175#if defined(__WXUNIVERSAL__)
176 #define wxStatusBarUniv wxStatusBar
71e03035 177 #include "wx/univ/statusbr.h"
4055ed82 178#elif defined(__WXPALMOS__)
ffecfa5a 179 #define wxStatusBarPalm wxStatusBar
771be77f 180 #include "wx/palmos/statusbr.h"
71e03035 181#elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
936f6353 182 #include "wx/msw/statusbar.h"
656fc51c 183#elif defined(__WXMAC__)
71e03035 184 #define wxStatusBarMac wxStatusBar
5fde6fcc 185 #include "wx/generic/statusbr.h"
ef0e9220 186 #include "wx/osx/statusbr.h"
ed791986 187#else
71e03035 188 #define wxStatusBarGeneric wxStatusBar
71e03035 189 #include "wx/generic/statusbr.h"
ed791986
VZ
190#endif
191
71e03035 192#endif // wxUSE_STATUSBAR
1e6feb95 193
c801d85f 194#endif
34138703 195 // _WX_STATUSBR_H_BASE_