]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/panelg.h
Replaced typedef with #define for VC++ 1.5, to prevent 'no constructor' error
[wxWidgets.git] / include / wx / generic / panelg.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/panelg.h
3 // Purpose: wxPanel: a container for child controls
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c)
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_GENERIC_PANEL_H_
13 #define _WX_GENERIC_PANEL_H_
14
15 #ifdef __GNUG__
16 #pragma interface "panelg.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // headers and forward declarations
21 // ----------------------------------------------------------------------------
22
23 #include "wx/window.h"
24
25 class WXDLLEXPORT wxButton;
26
27 WXDLLEXPORT_DATA(extern const wxChar*) wxPanelNameStr;
28
29 // ----------------------------------------------------------------------------
30 // wxPanel contains other controls and implements TAB traversal between them
31 // ----------------------------------------------------------------------------
32
33 class WXDLLEXPORT wxPanel : public wxWindow
34 {
35 public:
36 wxPanel() { Init(); }
37
38 // Old-style constructor (no default values for coordinates to avoid
39 // ambiguity with the new one)
40 wxPanel(wxWindow *parent,
41 int x, int y, int width, int height,
42 long style = wxTAB_TRAVERSAL | wxNO_BORDER,
43 const wxString& name = wxPanelNameStr)
44 {
45 Init();
46
47 Create(parent, -1, wxPoint(x, y), wxSize(width, height), style, name);
48 }
49
50 // Constructor
51 wxPanel(wxWindow *parent,
52 wxWindowID id = -1,
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = wxTAB_TRAVERSAL | wxNO_BORDER,
56 const wxString& name = wxPanelNameStr)
57 {
58 Init();
59
60 Create(parent, id, pos, size, style, name);
61 }
62
63 // Pseudo ctor
64 bool Create(wxWindow *parent, wxWindowID id,
65 const wxPoint& pos = wxDefaultPosition,
66 const wxSize& size = wxDefaultSize,
67 long style = wxTAB_TRAVERSAL | wxNO_BORDER,
68 const wxString& name = wxPanelNameStr);
69
70 // Sends an OnInitDialog event, which in turns transfers data to
71 // to the dialog via validators.
72 virtual void InitDialog();
73
74 // a default button is activated when Enter is pressed
75 wxButton *GetDefaultItem() const { return m_btnDefault; }
76 void SetDefaultItem(wxButton *btn) { m_btnDefault = btn; }
77
78 // implementation from now on
79 // --------------------------
80
81 // responds to colour changes
82 void OnSysColourChanged(wxSysColourChangedEvent& event);
83
84 // process a keyboard navigation message (Tab traversal)
85 void OnNavigationKey(wxNavigationKeyEvent& event);
86
87 // set the focus to the first child if we get it
88 void OnFocus(wxFocusEvent& event);
89
90 // calls layout for layout constraints and sizers
91 void OnSize(wxSizeEvent& event);
92
93 // overridden to tab move focus into first focusable child
94 virtual void SetFocus();
95
96 // called by wxWindow whenever it gets focus
97 void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
98 wxWindow *GetLastFocus() const { return m_winLastFocused; }
99
100 protected:
101 // common part of all ctors
102 void Init();
103
104 // set the focus to the child which had it the last time
105 bool SetFocusToChild();
106
107 // the child which had the focus last time this panel was activated
108 wxWindow *m_winLastFocused;
109
110 // a default button or NULL
111 wxButton *m_btnDefault;
112
113 private:
114 DECLARE_DYNAMIC_CLASS(wxPanel)
115 DECLARE_EVENT_TABLE()
116 };
117
118 // this function is for wxWindows use only
119 extern bool wxSetFocusToChild(wxWindow *win, wxWindow **child);
120
121 #endif
122 // _WX_GENERIC_PANEL_H_