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