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