1. added wxStatusBarUniv
[wxWidgets.git] / include / wx / univ / statusbr.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/statusbr.h
3 // Purpose: wxStatusBarUniv: wxStatusBar for wxUniversal declaration
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 14.10.01
7 // RCS-ID: $Id$
8 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_UNIV_STATUSBR_H_
13 #define _WX_UNIV_STATUSBR_H_
14
15 #ifdef __GNUG__
16 #pragma interface "univstatusbr.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // wxStatusBar: a window near the bottom of the frame used for status info
21 // ----------------------------------------------------------------------------
22
23 class WXDLLEXPORT wxStatusBarUniv : public wxStatusBarBase,
24 public wxInputConsumer
25 {
26 public:
27 wxStatusBarUniv() { Init(); }
28
29 wxStatusBarUniv(wxWindow *parent,
30 wxWindowID id = -1,
31 long style = 0,
32 const wxString& name = wxPanelNameStr)
33 {
34 Init();
35
36 (void)Create(parent, id, style, name);
37 }
38
39 bool Create(wxWindow *parent,
40 wxWindowID id = -1,
41 long style = 0,
42 const wxString& name = wxPanelNameStr);
43
44 // set field count/widths
45 virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
46 virtual void SetStatusWidths(int n, const int widths[]);
47
48 // get/set the text of the given field
49 virtual void SetStatusText(const wxString& text, int number = 0);
50 virtual wxString GetStatusText(int number = 0) const;
51
52 // Get the position and size of the field's internal bounding rectangle
53 virtual bool GetFieldRect(int i, wxRect& rect) const;
54
55 // sets the minimal vertical size of the status bar
56 virtual void SetMinHeight(int height);
57
58 // get the dimensions of the horizontal and vertical borders
59 virtual int GetBorderX() const;
60 virtual int GetBorderY() const;
61
62 protected:
63 // recalculate the field widths
64 void OnSize(wxSizeEvent& event);
65
66 // draw the statusbar
67 virtual void DoDraw(wxControlRenderer *renderer);
68
69 // wxInputConsumer pure virtual
70 virtual wxWindow *GetInputWindow() const
71 { return wxConstCast(this, wxStatusBar); }
72
73 // tell them about our preferred height
74 virtual wxSize DoGetBestSize() const;
75
76 // override DoSetSize() to prevent the status bar height from changing
77 virtual void DoSetSize(int x, int y,
78 int width, int height,
79 int sizeFlags = wxSIZE_AUTO);
80
81 // get the (fixed) status bar height
82 wxCoord GetHeight() const;
83
84 // get the rectangle containing all the fields and the border between them
85 //
86 // also updates m_widthsAbs if necessary
87 wxRect GetTotalFieldRect(wxCoord *borderBetweenFields);
88
89 // refresh the given field
90 void RefreshField(int i);
91
92 // common part of all ctors
93 void Init();
94
95 private:
96 // the status fields strings
97 wxArrayString m_statusText;
98
99 // the absolute status fields widths
100 wxArrayInt m_widthsAbs;
101
102 DECLARE_DYNAMIC_CLASS(wxStatusBarUniv)
103 DECLARE_EVENT_TABLE()
104 WX_DECLARE_INPUT_CONSUMER()
105 };
106
107 #endif // _WX_UNIV_STATUSBR_H_
108