]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/panelg.cpp
454f5dc1d86537e33914c0f7276ba0cbcf9097f5
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/panelg.cpp
3 // Purpose: wxPanel and the keyboard handling code
4 // Author: Julian Smart, Robert Roebling, Vadim Zeitlin
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
28 #include "wx/object.h"
30 #include "wx/colour.h"
31 #include "wx/settings.h"
36 #include "wx/containr.h"
38 // ----------------------------------------------------------------------------
40 // ----------------------------------------------------------------------------
42 #if wxUSE_EXTENDED_RTTI
43 WX_DEFINE_FLAGS( wxPanelStyle
)
45 wxBEGIN_FLAGS( wxPanelStyle
)
46 // new style border flags, we put them first to
47 // use them for streaming out
48 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
49 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
50 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
51 wxFLAGS_MEMBER(wxBORDER_RAISED
)
52 wxFLAGS_MEMBER(wxBORDER_STATIC
)
53 wxFLAGS_MEMBER(wxBORDER_NONE
)
55 // old style border flags
56 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
57 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
58 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
59 wxFLAGS_MEMBER(wxRAISED_BORDER
)
60 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
61 wxFLAGS_MEMBER(wxBORDER
)
63 // standard window styles
64 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
65 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
66 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
67 wxFLAGS_MEMBER(wxWANTS_CHARS
)
68 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
69 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
70 wxFLAGS_MEMBER(wxVSCROLL
)
71 wxFLAGS_MEMBER(wxHSCROLL
)
73 wxEND_FLAGS( wxPanelStyle
)
75 IMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel
, wxWindow
,"wx/panel.h")
77 wxBEGIN_PROPERTIES_TABLE(wxPanel
)
78 wxPROPERTY_FLAGS( WindowStyle
, wxPanelStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
79 // style wxTAB_TRAVERSAL
80 wxEND_PROPERTIES_TABLE()
82 wxBEGIN_HANDLERS_TABLE(wxPanel
)
83 wxEND_HANDLERS_TABLE()
85 wxCONSTRUCTOR_5( wxPanel
, wxWindow
* , Parent
, wxWindowID
, Id
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
88 IMPLEMENT_DYNAMIC_CLASS(wxPanel
, wxWindow
)
91 BEGIN_EVENT_TABLE(wxPanel
, wxWindow
)
92 EVT_SIZE(wxPanel::OnSize
)
94 WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel
)
97 // ============================================================================
99 // ============================================================================
101 WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel
)
103 // ----------------------------------------------------------------------------
105 // ----------------------------------------------------------------------------
109 m_container
.SetContainerWindow(this);
112 bool wxPanel::Create(wxWindow
*parent
, wxWindowID id
,
116 const wxString
& name
)
118 if ( !wxWindow::Create(parent
, id
, pos
, size
, style
, name
) )
121 // so that non-solid background renders correctly under GTK+:
122 SetThemeEnabled(true);
124 #if defined(__WXWINCE__) && (defined(__POCKETPC__) || defined(__SMARTPHONE__))
125 // Required to get solid control backgrounds under WinCE
126 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW
));
136 void wxPanel::InitDialog()
138 wxInitDialogEvent
event(GetId());
139 event
.SetEventObject(this);
140 GetEventHandler()->ProcessEvent(event
);
143 // ----------------------------------------------------------------------------
145 // ----------------------------------------------------------------------------
147 void wxPanel::OnSize(wxSizeEvent
& event
)
151 #if wxUSE_CONSTRAINTS
152 #if defined(__WXPM__) && 0
155 // Need to properly move child windows under OS/2
157 PSWP pWinSwp
= GetSwp();
159 if (pWinSwp
->cx
== 0 && pWinSwp
->cy
== 0 && pWinSwp
->fl
== 0)
163 ::WinQueryWindowPos(GetHWND(), pWinSwp
);
170 ::WinQueryWindowPos(GetHWND(), &vSwp
);
171 nYDiff
= pWinSwp
->cy
- vSwp
.cy
;
172 MoveChildren(nYDiff
);
173 pWinSwp
->cx
= vSwp
.cx
;
174 pWinSwp
->cy
= vSwp
.cy
;
178 #endif // wxUSE_CONSTRAINTS