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