]> git.saurik.com Git - wxWidgets.git/blob - src/common/panelcmn.cpp
Trigger wxLog auto-creation when getting old logger in wxLogChain ctor.
[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 // implementation
90 // ============================================================================
91
92 // ----------------------------------------------------------------------------
93 // wxPanelBase creation
94 // ----------------------------------------------------------------------------
95
96 bool wxPanelBase::Create(wxWindow *parent, wxWindowID id,
97 const wxPoint& pos,
98 const wxSize& size,
99 long style,
100 const wxString& name)
101 {
102 if ( !wxWindow::Create(parent, id, pos, size, style, name) )
103 return false;
104
105 // so that non-solid background renders correctly under GTK+:
106 SetThemeEnabled(true);
107
108 #if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__))
109 // Required to get solid control backgrounds under WinCE
110 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
111 #endif
112
113 return true;
114 }
115
116 void wxPanelBase::InitDialog()
117 {
118 wxInitDialogEvent event(GetId());
119 event.SetEventObject(this);
120 GetEventHandler()->ProcessEvent(event);
121 }