]>
Commit | Line | Data |
---|---|---|
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 | #include "wx/univ/inpcons.h" | |
16 | #include "wx/arrstr.h" | |
17 | ||
18 | // ---------------------------------------------------------------------------- | |
19 | // wxStatusBarUniv: a window near the bottom of the frame used for status info | |
20 | // ---------------------------------------------------------------------------- | |
21 | ||
22 | class WXDLLIMPEXP_CORE wxStatusBarUniv : public wxStatusBarBase, | |
23 | public wxInputConsumer | |
24 | { | |
25 | public: | |
26 | wxStatusBarUniv() { Init(); } | |
27 | ||
28 | wxStatusBarUniv(wxWindow *parent, | |
29 | wxWindowID id = wxID_ANY, | |
30 | long style = 0, | |
31 | const wxString& name = wxPanelNameStr) | |
32 | { | |
33 | Init(); | |
34 | ||
35 | (void)Create(parent, id, style, name); | |
36 | } | |
37 | ||
38 | bool Create(wxWindow *parent, | |
39 | wxWindowID id = wxID_ANY, | |
40 | long style = 0, | |
41 | const wxString& name = wxPanelNameStr); | |
42 | ||
43 | // set field count/widths | |
44 | virtual void SetFieldsCount(int number = 1, const int *widths = NULL); | |
45 | virtual void SetStatusWidths(int n, const int widths[]); | |
46 | ||
47 | // get/set the text of the given field | |
48 | virtual void SetStatusText(const wxString& text, int number = 0); | |
49 | virtual wxString GetStatusText(int number = 0) const; | |
50 | ||
51 | // Get the position and size of the field's internal bounding rectangle | |
52 | virtual bool GetFieldRect(int i, wxRect& rect) const; | |
53 | ||
54 | // sets the minimal vertical size of the status bar | |
55 | virtual void SetMinHeight(int height); | |
56 | ||
57 | // get the dimensions of the horizontal and vertical borders | |
58 | virtual int GetBorderX() const; | |
59 | virtual int GetBorderY() const; | |
60 | ||
61 | // wxInputConsumer pure virtual | |
62 | virtual wxWindow *GetInputWindow() const | |
63 | { return const_cast<wxStatusBar*>(this); } | |
64 | ||
65 | protected: | |
66 | // recalculate the field widths | |
67 | void OnSize(wxSizeEvent& event); | |
68 | ||
69 | // draw the statusbar | |
70 | virtual void DoDraw(wxControlRenderer *renderer); | |
71 | ||
72 | // tell them about our preferred height | |
73 | virtual wxSize DoGetBestSize() const; | |
74 | ||
75 | // override DoSetSize() to prevent the status bar height from changing | |
76 | virtual void DoSetSize(int x, int y, | |
77 | int width, int height, | |
78 | int sizeFlags = wxSIZE_AUTO); | |
79 | ||
80 | // get the (fixed) status bar height | |
81 | wxCoord GetHeight() const; | |
82 | ||
83 | // get the rectangle containing all the fields and the border between them | |
84 | // | |
85 | // also updates m_widthsAbs if necessary | |
86 | wxRect GetTotalFieldRect(wxCoord *borderBetweenFields); | |
87 | ||
88 | // get the rect for this field without ani side effects (see code) | |
89 | wxRect DoGetFieldRect(int n) const; | |
90 | ||
91 | // refresh the given field | |
92 | void RefreshField(int i); | |
93 | ||
94 | // common part of all ctors | |
95 | void Init(); | |
96 | ||
97 | private: | |
98 | // the current status fields strings | |
99 | wxArrayString m_statusText; | |
100 | ||
101 | // the absolute status fields widths | |
102 | wxArrayInt m_widthsAbs; | |
103 | ||
104 | DECLARE_DYNAMIC_CLASS(wxStatusBarUniv) | |
105 | DECLARE_EVENT_TABLE() | |
106 | WX_DECLARE_INPUT_CONSUMER() | |
107 | }; | |
108 | ||
109 | #endif // _WX_UNIV_STATUSBR_H_ | |
110 |