Minor and silly fix.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3081 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
1fad4c3eb2
commit
5d55595cb6
@ -44,6 +44,7 @@ IMPLEMENT_APP(MyApp)
|
|||||||
|
|
||||||
MyMainFrame *main_frame = (MyMainFrame*) NULL;
|
MyMainFrame *main_frame = (MyMainFrame*) NULL;
|
||||||
MyMiniFrame *mini_frame = (MyMiniFrame*) NULL;
|
MyMiniFrame *mini_frame = (MyMiniFrame*) NULL;
|
||||||
|
bool mini_frame_exists = FALSE;
|
||||||
wxButton *button = (wxButton*) NULL;
|
wxButton *button = (wxButton*) NULL;
|
||||||
|
|
||||||
// The `main program' equivalent, creating the windows and returning the
|
// The `main program' equivalent, creating the windows and returning the
|
||||||
@ -53,6 +54,7 @@ bool MyApp::OnInit(void)
|
|||||||
// Create the mini frame window
|
// Create the mini frame window
|
||||||
mini_frame = new MyMiniFrame((wxFrame *) NULL, -1, "wxMiniFrame sample",
|
mini_frame = new MyMiniFrame((wxFrame *) NULL, -1, "wxMiniFrame sample",
|
||||||
wxPoint(100, 100), wxSize(205, 100));
|
wxPoint(100, 100), wxSize(205, 100));
|
||||||
|
mini_frame_exists = TRUE;
|
||||||
|
|
||||||
mini_frame->CreateToolBar(wxNO_BORDER|wxHORIZONTAL|wxTB_FLAT, ID_TOOLBAR);
|
mini_frame->CreateToolBar(wxNO_BORDER|wxHORIZONTAL|wxTB_FLAT, ID_TOOLBAR);
|
||||||
InitToolbar(mini_frame->GetToolBar());
|
InitToolbar(mini_frame->GetToolBar());
|
||||||
@ -163,6 +165,8 @@ MyMiniFrame::MyMiniFrame(wxFrame* parent, wxWindowID id, const wxString& title,
|
|||||||
|
|
||||||
void MyMiniFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
|
void MyMiniFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
// make it known that the miniframe is no more
|
||||||
|
mini_frame_exists = FALSE;
|
||||||
Destroy();
|
Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,6 +195,13 @@ void MyMainFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyMainFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
|
void MyMainFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
|
// practical jokers might find satisfaction in reparenting the button
|
||||||
|
// after closing the mini_frame. We'll have the last laugh.
|
||||||
|
if (! mini_frame_exists)
|
||||||
|
wxMessageBox("The miniframe no longer exists.\n"
|
||||||
|
"You don't want to make this button an orphan, do you?",
|
||||||
|
"You got to be kidding");
|
||||||
|
else
|
||||||
button->Reparent( mini_frame );
|
button->Reparent( mini_frame );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user