Disable wxSIZE_FORCE_EVENT and demonstrate its bug in the wxCollapsiblePane sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58560 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -56,7 +56,10 @@ enum
|
|||||||
PANE_SETLABEL,
|
PANE_SETLABEL,
|
||||||
PANE_SHOWDLG,
|
PANE_SHOWDLG,
|
||||||
PANE_ABOUT = wxID_ABOUT,
|
PANE_ABOUT = wxID_ABOUT,
|
||||||
PANE_QUIT = wxID_EXIT
|
PANE_QUIT = wxID_EXIT,
|
||||||
|
|
||||||
|
PANE_BUTTON,
|
||||||
|
PANE_TEXTCTRL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -94,6 +97,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
wxCollapsiblePane *m_collPane;
|
wxCollapsiblePane *m_collPane;
|
||||||
|
wxBoxSizer *m_paneSizer;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
DECLARE_NO_COPY_CLASS(MyFrame)
|
DECLARE_NO_COPY_CLASS(MyFrame)
|
||||||
@@ -104,10 +108,12 @@ class MyDialog : public wxDialog
|
|||||||
public:
|
public:
|
||||||
MyDialog(wxFrame *parent);
|
MyDialog(wxFrame *parent);
|
||||||
void OnToggleStatus(wxCommandEvent& WXUNUSED(ev));
|
void OnToggleStatus(wxCommandEvent& WXUNUSED(ev));
|
||||||
|
void OnAlignButton(wxCommandEvent& WXUNUSED(ev));
|
||||||
void OnPaneChanged(wxCollapsiblePaneEvent& event);
|
void OnPaneChanged(wxCollapsiblePaneEvent& event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxCollapsiblePane *m_collPane;
|
wxCollapsiblePane *m_collPane;
|
||||||
|
wxGridSizer *m_paneSizer;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
DECLARE_NO_COPY_CLASS(MyDialog)
|
DECLARE_NO_COPY_CLASS(MyDialog)
|
||||||
@@ -185,11 +191,13 @@ MyFrame::MyFrame()
|
|||||||
|
|
||||||
m_collPane = new wxCollapsiblePane(this, -1, wxT("test!"));
|
m_collPane = new wxCollapsiblePane(this, -1, wxT("test!"));
|
||||||
wxWindow *win = m_collPane->GetPane();
|
wxWindow *win = m_collPane->GetPane();
|
||||||
|
|
||||||
new wxStaticText(win, -1, wxT("Static control with absolute coords"), wxPoint(10,2));
|
m_paneSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
new wxStaticText(win, -1, wxT("Yet another one!"), wxPoint(30, 30));
|
m_paneSizer->Add( new wxStaticText(win, -1, wxT("Static text") ), 0, wxALIGN_LEFT );
|
||||||
new wxTextCtrl(win, -1, wxT("You can place anything you like inside a wxCollapsiblePane"),
|
m_paneSizer->Add( new wxStaticText(win, -1, wxT("Yet another one!") ), 0, wxALIGN_LEFT );
|
||||||
wxPoint(5, 60), wxSize(300, -1));
|
m_paneSizer->Add( new wxTextCtrl(win, PANE_TEXTCTRL, wxT("Text control"), wxDefaultPosition, wxSize(80,-1) ), 0, wxALIGN_LEFT );
|
||||||
|
m_paneSizer->Add( new wxButton(win, PANE_BUTTON, wxT("Press to align right") ), 0, wxALIGN_LEFT );
|
||||||
|
win->SetSizer( m_paneSizer );
|
||||||
}
|
}
|
||||||
|
|
||||||
MyFrame::~MyFrame()
|
MyFrame::~MyFrame()
|
||||||
@@ -263,6 +271,7 @@ enum
|
|||||||
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
BEGIN_EVENT_TABLE(MyDialog, wxDialog)
|
||||||
EVT_BUTTON(PANEDLG_TOGGLESTATUS_BTN, MyDialog::OnToggleStatus)
|
EVT_BUTTON(PANEDLG_TOGGLESTATUS_BTN, MyDialog::OnToggleStatus)
|
||||||
EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY, MyDialog::OnPaneChanged)
|
EVT_COLLAPSIBLEPANE_CHANGED(wxID_ANY, MyDialog::OnPaneChanged)
|
||||||
|
EVT_BUTTON(PANE_BUTTON, MyDialog::OnAlignButton)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
MyDialog::MyDialog(wxFrame *parent)
|
MyDialog::MyDialog(wxFrame *parent)
|
||||||
@@ -285,13 +294,16 @@ MyDialog::MyDialog(wxFrame *parent)
|
|||||||
|
|
||||||
// now add test controls in the collapsible pane
|
// now add test controls in the collapsible pane
|
||||||
wxWindow *win = m_collPane->GetPane();
|
wxWindow *win = m_collPane->GetPane();
|
||||||
wxSizer *paneSz = new wxGridSizer(4, 1, 5, 5);
|
m_paneSizer = new wxGridSizer(4, 1, 5, 5);
|
||||||
paneSz->Add(new wxColourPickerCtrl(win, -1), 1, wxALL|wxALIGN_LEFT, 2);
|
|
||||||
paneSz->Add(new wxFontPickerCtrl(win, -1), 1, wxALL|wxALIGN_LEFT, 2);
|
m_paneSizer->Add( new wxStaticText(win, -1, wxT("Static text") ), 0, wxALIGN_LEFT );
|
||||||
paneSz->Add(new wxFilePickerCtrl(win, -1), 1, wxALL|wxALIGN_LEFT, 2);
|
m_paneSizer->Add( new wxStaticText(win, -1, wxT("Yet another one!") ), 0, wxALIGN_LEFT );
|
||||||
paneSz->Add(new wxDirPickerCtrl(win, -1), 1, wxALL|wxALIGN_LEFT, 2);
|
m_paneSizer->Add( new wxTextCtrl(win, PANE_TEXTCTRL, wxT("Text control"), wxDefaultPosition, wxSize(80,-1) ), 0, wxALIGN_LEFT );
|
||||||
win->SetSizer(paneSz);
|
m_paneSizer->Add( new wxButton(win, PANE_BUTTON, wxT("Press to align right") ), 0, wxALIGN_LEFT );
|
||||||
paneSz->SetSizeHints(win);
|
win->SetSizer( m_paneSizer );
|
||||||
|
|
||||||
|
win->SetSizer( m_paneSizer );
|
||||||
|
m_paneSizer->SetSizeHints(win);
|
||||||
|
|
||||||
SetSizer(sz);
|
SetSizer(sz);
|
||||||
sz->SetSizeHints(this);
|
sz->SetSizeHints(this);
|
||||||
@@ -302,6 +314,14 @@ void MyDialog::OnToggleStatus(wxCommandEvent& WXUNUSED(ev))
|
|||||||
m_collPane->Collapse(!m_collPane->IsCollapsed());
|
m_collPane->Collapse(!m_collPane->IsCollapsed());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyDialog::OnAlignButton(wxCommandEvent& WXUNUSED(ev))
|
||||||
|
{
|
||||||
|
wxSizerItem *item = m_paneSizer->GetItem( FindWindow(PANE_TEXTCTRL), true );
|
||||||
|
item->SetFlag( wxALIGN_RIGHT );
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
|
||||||
void MyDialog::OnPaneChanged(wxCollapsiblePaneEvent &event)
|
void MyDialog::OnPaneChanged(wxCollapsiblePaneEvent &event)
|
||||||
{
|
{
|
||||||
wxLogDebug(wxT("The pane has just been %s by the user"),
|
wxLogDebug(wxT("The pane has just been %s by the user"),
|
||||||
|
@@ -486,8 +486,13 @@ void wxSizerItem::SetDimension( const wxPoint& pos_, const wxSize& size_ )
|
|||||||
// not change the size of the window. In such a case, no
|
// not change the size of the window. In such a case, no
|
||||||
// wxSizeEvent would normally be generated and thus the
|
// wxSizeEvent would normally be generated and thus the
|
||||||
// control wouldn't get layed out correctly here.
|
// control wouldn't get layed out correctly here.
|
||||||
|
#if 0
|
||||||
m_window->SetSize(pos.x, pos.y, size.x, size.y,
|
m_window->SetSize(pos.x, pos.y, size.x, size.y,
|
||||||
wxSIZE_ALLOW_MINUS_ONE|wxSIZE_FORCE_EVENT );
|
wxSIZE_ALLOW_MINUS_ONE|wxSIZE_FORCE_EVENT );
|
||||||
|
#else
|
||||||
|
m_window->SetSize(pos.x, pos.y, size.x, size.y,
|
||||||
|
wxSIZE_ALLOW_MINUS_ONE );
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Item_Sizer:
|
case Item_Sizer:
|
||||||
|
Reference in New Issue
Block a user