made wxPanel be auto layout aware
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4075 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -25,7 +25,7 @@ class WXDLLEXPORT wxPanel : public wxWindow
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxPanel() { Init(); }
|
wxPanel() { Init(); }
|
||||||
|
|
||||||
// Old-style constructor (no default values for coordinates to avoid
|
// Old-style constructor (no default values for coordinates to avoid
|
||||||
// ambiguity with the new one)
|
// ambiguity with the new one)
|
||||||
wxPanel(wxWindow *parent,
|
wxPanel(wxWindow *parent,
|
||||||
@@ -37,7 +37,7 @@ public:
|
|||||||
|
|
||||||
Create(parent, -1, wxPoint(x, y), wxSize(width, height), style, name);
|
Create(parent, -1, wxPoint(x, y), wxSize(width, height), style, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
wxPanel(wxWindow *parent,
|
wxPanel(wxWindow *parent,
|
||||||
wxWindowID id = -1,
|
wxWindowID id = -1,
|
||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
const wxSize& size = wxDefaultSize,
|
const wxSize& size = wxDefaultSize,
|
||||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||||
const wxString& name = wxPanelNameStr);
|
const wxString& name = wxPanelNameStr);
|
||||||
|
|
||||||
// Sends an OnInitDialog event, which in turns transfers data to
|
// Sends an OnInitDialog event, which in turns transfers data to
|
||||||
// to the dialog via validators.
|
// to the dialog via validators.
|
||||||
virtual void InitDialog();
|
virtual void InitDialog();
|
||||||
@@ -71,13 +71,15 @@ public:
|
|||||||
|
|
||||||
// responds to colour changes
|
// responds to colour changes
|
||||||
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
||||||
|
|
||||||
// process a keyboard navigation message (Tab traversal)
|
// process a keyboard navigation message (Tab traversal)
|
||||||
void OnNavigationKey(wxNavigationKeyEvent& event);
|
void OnNavigationKey(wxNavigationKeyEvent& event);
|
||||||
|
|
||||||
// set the focus to the first child if we get it
|
// set the focus to the first child if we get it
|
||||||
void OnFocus(wxFocusEvent& event);
|
void OnFocus(wxFocusEvent& event);
|
||||||
|
|
||||||
|
void OnSize(wxSizeEvent& event);
|
||||||
|
|
||||||
// called by wxWindow whenever it gets focus
|
// called by wxWindow whenever it gets focus
|
||||||
void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
|
void SetLastFocus(wxWindow *win) { m_winLastFocused = win; }
|
||||||
wxWindow *GetLastFocus() const { return m_winLastFocused; }
|
wxWindow *GetLastFocus() const { return m_winLastFocused; }
|
||||||
|
@@ -36,6 +36,7 @@ BEGIN_EVENT_TABLE(wxPanel, wxWindow)
|
|||||||
EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged)
|
EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged)
|
||||||
EVT_SET_FOCUS(wxPanel::OnFocus)
|
EVT_SET_FOCUS(wxPanel::OnFocus)
|
||||||
EVT_NAVIGATION_KEY(wxPanel::OnNavigationKey)
|
EVT_NAVIGATION_KEY(wxPanel::OnNavigationKey)
|
||||||
|
EVT_SIZE(wxPanel::OnSize)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -101,7 +102,7 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
|
|||||||
wxWindow *winFocus = event.GetCurrentFocus();
|
wxWindow *winFocus = event.GetCurrentFocus();
|
||||||
if (!winFocus)
|
if (!winFocus)
|
||||||
winFocus = wxWindow::FindFocus();
|
winFocus = wxWindow::FindFocus();
|
||||||
|
|
||||||
if (!winFocus)
|
if (!winFocus)
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
@@ -132,7 +133,7 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
|
|||||||
// we don't want to tab into a different dialog or frame
|
// we don't want to tab into a different dialog or frame
|
||||||
if ( focussed_child_of_p->IsTopLevel() )
|
if ( focussed_child_of_p->IsTopLevel() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( wxDynamicCast(p, wxPanel) )
|
if ( wxDynamicCast(p, wxPanel) )
|
||||||
{
|
{
|
||||||
event.SetCurrentFocus( focussed_child_of_p );
|
event.SetCurrentFocus( focussed_child_of_p );
|
||||||
@@ -166,6 +167,14 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void wxPanel::OnSize(wxSizeEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
#if wxUSE_CONSTRAINTS
|
||||||
|
if (GetAutoLayout()) Layout();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void wxPanel::OnFocus(wxFocusEvent& event)
|
void wxPanel::OnFocus(wxFocusEvent& event)
|
||||||
{
|
{
|
||||||
if ( m_winLastFocused )
|
if ( m_winLastFocused )
|
||||||
|
Reference in New Issue
Block a user