wxMessageBox off the main thread lost result code.
[wxWidgets.git] / include / wx / generic / statusbr.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/statusbr.h
3 // Purpose: wxStatusBarGeneric class
4 // Author: Julian Smart
5 // Modified by: VZ at 05.02.00 to derive from wxStatusBarBase
6 // Created: 01/02/97
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_GENERIC_STATUSBR_H_
12 #define _WX_GENERIC_STATUSBR_H_
13
14 #include "wx/defs.h"
15
16 #if wxUSE_STATUSBAR
17
18 #include "wx/pen.h"
19 #include "wx/arrstr.h"
20
21
22 // ----------------------------------------------------------------------------
23 // wxStatusBarGeneric
24 // ----------------------------------------------------------------------------
25
26 class WXDLLIMPEXP_CORE wxStatusBarGeneric : public wxStatusBarBase
27 {
28 public:
29 wxStatusBarGeneric() { Init(); }
30 wxStatusBarGeneric(wxWindow *parent,
31 wxWindowID winid = wxID_ANY,
32 long style = wxSTB_DEFAULT_STYLE,
33 const wxString& name = wxStatusBarNameStr)
34 {
35 Init();
36
37 Create(parent, winid, style, name);
38 }
39
40 virtual ~wxStatusBarGeneric();
41
42 bool Create(wxWindow *parent, wxWindowID winid = wxID_ANY,
43 long style = wxSTB_DEFAULT_STYLE,
44 const wxString& name = wxStatusBarNameStr);
45
46 // implement base class methods
47 virtual void SetStatusWidths(int n, const int widths_field[]);
48 virtual bool GetFieldRect(int i, wxRect& rect) const;
49 virtual void SetMinHeight(int height);
50
51 virtual int GetBorderX() const { return m_borderX; }
52 virtual int GetBorderY() const { return m_borderY; }
53
54
55 // implementation only (not part of wxStatusBar public API):
56
57 int GetFieldFromPoint(const wxPoint& point) const;
58
59 protected:
60 virtual void DoUpdateStatusText(int number);
61
62 // event handlers
63 void OnPaint(wxPaintEvent& event);
64 void OnSize(wxSizeEvent& event);
65
66 void OnLeftDown(wxMouseEvent& event);
67 void OnRightDown(wxMouseEvent& event);
68
69 // Responds to colour changes
70 void OnSysColourChanged(wxSysColourChangedEvent& event);
71
72 protected:
73
74 virtual void DrawFieldText(wxDC& dc, const wxRect& rc, int i, int textHeight);
75 virtual void DrawField(wxDC& dc, int i, int textHeight);
76
77 void SetBorderX(int x);
78 void SetBorderY(int y);
79
80 virtual void InitColours();
81
82 // true if the status bar shows the size grip: for this it must have
83 // wxSTB_SIZEGRIP style and the window it is attached to must be resizable
84 // and not maximized
85 bool ShowsSizeGrip() const;
86
87 // returns the position and the size of the size grip
88 wxRect GetSizeGripRect() const;
89
90 // common part of all ctors
91 void Init();
92
93 // the last known size, fields widths must be updated whenever it's out of
94 // date
95 wxSize m_lastClientSize;
96
97 // the absolute widths of the status bar panes in pixels
98 wxArrayInt m_widthsAbs;
99
100 int m_borderX;
101 int m_borderY;
102
103 wxPen m_mediumShadowPen;
104 wxPen m_hilightPen;
105
106 virtual wxSize DoGetBestSize() const;
107
108 private:
109 // Update m_lastClientSize and m_widthsAbs from the current size.
110 void DoUpdateFieldWidths();
111
112 DECLARE_EVENT_TABLE()
113 DECLARE_DYNAMIC_CLASS_NO_COPY(wxStatusBarGeneric)
114 };
115
116 #endif // wxUSE_STATUSBAR
117
118 #endif
119 // _WX_GENERIC_STATUSBR_H_