]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/panelg.cpp
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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
21 #pragma implementation "panelg.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
32 #include "wx/object.h"
34 #include "wx/colour.h"
35 #include "wx/settings.h"
39 #include "wx/containr.h"
42 // ----------------------------------------------------------------------------
44 // ----------------------------------------------------------------------------
46 #if wxUSE_EXTENDED_RTTI
47 WX_DEFINE_FLAGS( wxPanelStyle
)
49 wxBEGIN_FLAGS( wxPanelStyle
)
50 // new style border flags, we put them first to
51 // use them for streaming out
52 wxFLAGS_MEMBER(wxBORDER_SIMPLE
)
53 wxFLAGS_MEMBER(wxBORDER_SUNKEN
)
54 wxFLAGS_MEMBER(wxBORDER_DOUBLE
)
55 wxFLAGS_MEMBER(wxBORDER_RAISED
)
56 wxFLAGS_MEMBER(wxBORDER_STATIC
)
57 wxFLAGS_MEMBER(wxBORDER_NONE
)
59 // old style border flags
60 wxFLAGS_MEMBER(wxSIMPLE_BORDER
)
61 wxFLAGS_MEMBER(wxSUNKEN_BORDER
)
62 wxFLAGS_MEMBER(wxDOUBLE_BORDER
)
63 wxFLAGS_MEMBER(wxRAISED_BORDER
)
64 wxFLAGS_MEMBER(wxSTATIC_BORDER
)
65 wxFLAGS_MEMBER(wxBORDER
)
67 // standard window styles
68 wxFLAGS_MEMBER(wxTAB_TRAVERSAL
)
69 wxFLAGS_MEMBER(wxCLIP_CHILDREN
)
70 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
)
71 wxFLAGS_MEMBER(wxWANTS_CHARS
)
72 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
)
73 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB
)
74 wxFLAGS_MEMBER(wxVSCROLL
)
75 wxFLAGS_MEMBER(wxHSCROLL
)
77 wxEND_FLAGS( wxPanelStyle
)
79 IMPLEMENT_DYNAMIC_CLASS_XTI(wxPanel
, wxWindow
,"wx/panel.h")
81 wxBEGIN_PROPERTIES_TABLE(wxPanel
)
82 wxPROPERTY_FLAGS( WindowStyle
, wxPanelStyle
, long , SetWindowStyleFlag
, GetWindowStyleFlag
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
83 // style wxTAB_TRAVERSAL
84 wxEND_PROPERTIES_TABLE()
86 wxBEGIN_HANDLERS_TABLE(wxPanel
)
87 wxEND_HANDLERS_TABLE()
89 wxCONSTRUCTOR_5( wxPanel
, wxWindow
* , Parent
, wxWindowID
, Id
, wxPoint
, Position
, wxSize
, Size
, long , WindowStyle
)
92 IMPLEMENT_DYNAMIC_CLASS(wxPanel
, wxWindow
)
95 BEGIN_EVENT_TABLE(wxPanel
, wxWindow
)
96 EVT_SIZE(wxPanel::OnSize
)
98 WX_EVENT_TABLE_CONTROL_CONTAINER(wxPanel
)
101 // ============================================================================
103 // ============================================================================
105 WX_DELEGATE_TO_CONTROL_CONTAINER(wxPanel
)
107 // ----------------------------------------------------------------------------
109 // ----------------------------------------------------------------------------
113 m_container
.SetContainerWindow(this);
116 bool wxPanel::Create(wxWindow
*parent
, wxWindowID id
,
120 const wxString
& name
)
122 if ( !wxWindow::Create(parent
, id
, pos
, size
, style
, name
) )
125 // so that non-solid background renders correctly under GTK+:
126 SetThemeEnabled(true);
129 // Required to get solid control backgrounds under WinCE
130 SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW
));
140 void wxPanel::InitDialog()
142 wxInitDialogEvent
event(GetId());
143 event
.SetEventObject(this);
144 GetEventHandler()->ProcessEvent(event
);
147 // ----------------------------------------------------------------------------
149 // ----------------------------------------------------------------------------
151 void wxPanel::OnSize(wxSizeEvent
& event
)
155 #if wxUSE_CONSTRAINTS
156 #if defined(__WXPM__)
159 // Need to properly move child windows under OS/2
161 PSWP pWinSwp
= GetSwp();
163 if (pWinSwp
->cx
== 0 && pWinSwp
->cy
== 0 && pWinSwp
->fl
== 0)
167 ::WinQueryWindowPos(GetHWND(), pWinSwp
);
174 ::WinQueryWindowPos(GetHWND(), &vSwp
);
175 nYDiff
= pWinSwp
->cy
- vSwp
.cy
;
176 MoveChildren(nYDiff
);
177 pWinSwp
->cx
= vSwp
.cx
;
178 pWinSwp
->cy
= vSwp
.cy
;
182 #endif // wxUSE_CONSTRAINTS