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