]>
git.saurik.com Git - wxWidgets.git/blob - src/generic/panelg.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation "panelg.h"
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
24 #include "wx/settings.h"
27 #include "wx/generic/panelg.h"
29 #if !USE_SHARED_LIBRARY
30 IMPLEMENT_DYNAMIC_CLASS(wxPanel
, wxWindow
)
32 BEGIN_EVENT_TABLE(wxPanel
, wxWindow
)
33 EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged
)
34 EVT_NAVIGATION_KEY(wxPanel::OnNavigationKey
)
43 bool wxPanel::Create(wxWindow
*parent
, wxWindowID id
,
49 bool ret
= wxWindow::Create(parent
, id
, pos
, size
, style
, name
);
54 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
));
55 SetFont(wxSystemSettings::GetSystemFont(wxSYS_DEFAULT_GUI_FONT
));
62 void wxPanel::InitDialog(void)
64 wxInitDialogEvent
event(GetId());
65 event
.SetEventObject(this);
66 GetEventHandler()->ProcessEvent(event
);
69 // Responds to colour changes, and passes event on to children.
70 void wxPanel::OnSysColourChanged(wxSysColourChangedEvent
& event
)
72 SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE
));
75 // Propagate the event to the non-top-level children
76 wxWindow::OnSysColourChanged(event
);
79 void wxPanel::OnNavigationKey( wxNavigationKeyEvent
& event
)
81 if (GetChildren().GetCount() < 2)
87 // don't process these ones here
88 if (event
.IsWindowChange())
94 wxWindow
*winFocus
= event
.GetCurrentFocus();
95 if (!winFocus
) winFocus
= wxWindow::FindFocus();
103 wxNode
*start_node
= GetChildren().Find( winFocus
);
104 if (!start_node
) start_node
= GetChildren().First();
106 wxNode
*node
= event
.GetDirection() ? start_node
->Next() : start_node
->Previous();
108 while (node
!= start_node
)
113 if (GetParent() != NULL)
115 wxNavigationKeyEvent new_event;
116 new_event.SetDirection( event.GetDirection() );
117 new_event.SetWindowChange(FALSE);
118 new_event.SetCurrentFocus( this );
120 if (GetParent()->GetEventHandler()->ProcessEvent(new_event))
127 node
= event
.GetDirection() ? GetChildren().First() : GetChildren().Last();
130 wxWindow
*child
= (wxWindow
*) node
->Data();
132 if (child
->AcceptsFocus())