]> git.saurik.com Git - wxWidgets.git/blob - src/common/panelcmn.cpp
add src/gtk/anybutton.cpp to OpenVMS makefile
[wxWidgets.git] / src / common / panelcmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/panelcmn.cpp
3 // Purpose: wxPanel common code
4 // Author: Julian Smart, Robert Roebling, Vadim Zeitlin
5 // Modified by:
6 // Created: 04/01/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #ifndef WX_PRECOMP
28 #include "wx/object.h"
29 #include "wx/font.h"
30 #include "wx/colour.h"
31 #include "wx/settings.h"
32 #include "wx/log.h"
33 #include "wx/panel.h"
34 #include "wx/containr.h"
35 #endif
36
37 // ----------------------------------------------------------------------------
38 // XTI
39 // ----------------------------------------------------------------------------
40
41 wxDEFINE_FLAGS( wxPanelStyle )
42 wxBEGIN_FLAGS( wxPanelStyle )
43 // new style border flags, we put them first to
44 // use them for streaming out
45 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
46 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
47 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
48 wxFLAGS_MEMBER(wxBORDER_RAISED)
49 wxFLAGS_MEMBER(wxBORDER_STATIC)
50 wxFLAGS_MEMBER(wxBORDER_NONE)
51
52 // old style border flags
53 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
54 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
55 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
56 wxFLAGS_MEMBER(wxRAISED_BORDER)
57 wxFLAGS_MEMBER(wxSTATIC_BORDER)
58 wxFLAGS_MEMBER(wxBORDER)
59
60 // standard window styles
61 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
62 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
63 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
64 wxFLAGS_MEMBER(wxWANTS_CHARS)
65 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
66 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB)
67 wxFLAGS_MEMBER(wxVSCROLL)
68 wxFLAGS_MEMBER(wxHSCROLL)
69 wxEND_FLAGS( wxPanelStyle )
70
71 wxIMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel, wxWindow, "wx/panel.h")
72
73 wxBEGIN_PROPERTIES_TABLE(wxPanel)
74 wxPROPERTY_FLAGS( WindowStyle, wxPanelStyle, long, \
75 SetWindowStyleFlag, GetWindowStyleFlag, \
76 wxEMPTY_PARAMETER_VALUE, 0 /*flags*/, \
77 wxT("Helpstring"), wxT("group")) // style
78 // style wxTAB_TRAVERSAL
79 wxEND_PROPERTIES_TABLE()
80
81 wxEMPTY_HANDLERS_TABLE(wxPanel)
82
83 wxCONSTRUCTOR_6( wxPanel, wxWindow*, Parent, wxWindowID, Id, \
84 wxPoint, Position, wxSize, Size, long, WindowStyle, \
85 wxString, Name)
86
87
88 // ----------------------------------------------------------------------------
89 // wxWin macros
90 // ----------------------------------------------------------------------------
91
92 BEGIN_EVENT_TABLE(wxPanelBase, wxWindow)
93 WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanelBase)
94 END_EVENT_TABLE()
95
96 // ============================================================================
97 // implementation
98 // ============================================================================
99
100 WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanelBase, wxWindow)
101
102 // ----------------------------------------------------------------------------
103 // wxPanelBase creation
104 // ----------------------------------------------------------------------------
105
106 wxPanelBase::wxPanelBase()
107 {
108 WX_INIT_CONTROL_CONTAINER();
109 }
110
111 bool wxPanelBase::Create(wxWindow *parent, wxWindowID id,
112 const wxPoint& pos,
113 const wxSize& size,
114 long style,
115 const wxString& name)
116 {
117 if ( !wxWindow::Create(parent, id, pos, size, style, name) )
118 return false;
119
120 // so that non-solid background renders correctly under GTK+:
121 SetThemeEnabled(true);
122
123 #if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__))
124 // Required to get solid control backgrounds under WinCE
125 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
126 #endif
127
128 return true;
129 }
130
131 void wxPanelBase::InitDialog()
132 {
133 wxInitDialogEvent event(GetId());
134 event.SetEventObject(this);
135 GetEventHandler()->ProcessEvent(event);
136 }