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