More simplistic test for setting size and max size
after creation. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -48,6 +48,11 @@ MyMiniFrame *mini_frame = (MyMiniFrame*) NULL;
|
|||||||
bool mini_frame_exists = false;
|
bool mini_frame_exists = false;
|
||||||
wxButton *button = (wxButton*) NULL;
|
wxButton *button = (wxButton*) NULL;
|
||||||
|
|
||||||
|
#define ID_SET_SIZE_TO_150_150 100
|
||||||
|
#define ID_SET_SIZE_TO_200_200 101
|
||||||
|
#define ID_SET_MAX_SIZE_TO_150_150 102
|
||||||
|
#define ID_SET_MAX_SIZE_TO_300_300 103
|
||||||
|
|
||||||
// The `main program' equivalent, creating the windows and returning the
|
// The `main program' equivalent, creating the windows and returning the
|
||||||
// main frame
|
// main frame
|
||||||
bool MyApp::OnInit()
|
bool MyApp::OnInit()
|
||||||
@@ -61,6 +66,26 @@ bool MyApp::OnInit()
|
|||||||
// same as
|
// same as
|
||||||
main_frame->SetSizeHints( 100,100, 400,400 );
|
main_frame->SetSizeHints( 100,100, 400,400 );
|
||||||
|
|
||||||
|
wxMenu *file_menu = new wxMenu;
|
||||||
|
file_menu->Append(wxID_EXIT, _T("E&xit\tAlt-Q"));
|
||||||
|
file_menu->Append(ID_SET_SIZE_TO_150_150, _T("Set frame size to 150,150\tF2"));
|
||||||
|
file_menu->Append(ID_SET_SIZE_TO_200_200, _T("Set frame size to 200,200\tF3"));
|
||||||
|
file_menu->Append(ID_SET_MAX_SIZE_TO_150_150, _T("Set frame max size to 150,150\tF4"));
|
||||||
|
file_menu->Append(ID_SET_MAX_SIZE_TO_300_300, _T("Set frame max size to 300,300\tF5"));
|
||||||
|
|
||||||
|
wxMenuBar *menu_bar = new wxMenuBar;
|
||||||
|
menu_bar->Append(file_menu, _T("&File"));
|
||||||
|
main_frame->SetMenuBar(menu_bar);
|
||||||
|
|
||||||
|
main_frame->Connect( ID_SET_SIZE_TO_150_150, wxID_ANY,
|
||||||
|
wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyMainFrame::OnSetSize_150_150) );
|
||||||
|
main_frame->Connect( ID_SET_SIZE_TO_200_200, wxID_ANY,
|
||||||
|
wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyMainFrame::OnSetSize_200_200) );
|
||||||
|
main_frame->Connect( ID_SET_MAX_SIZE_TO_150_150, wxID_ANY,
|
||||||
|
wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyMainFrame::OnSetMaxSize_150_150) );
|
||||||
|
main_frame->Connect( ID_SET_MAX_SIZE_TO_300_300, wxID_ANY,
|
||||||
|
wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(MyMainFrame::OnSetMaxSize_300_300) );
|
||||||
|
|
||||||
main_frame->CreateToolBar(wxNO_BORDER|wxTB_VERTICAL, ID_TOOLBAR);
|
main_frame->CreateToolBar(wxNO_BORDER|wxTB_VERTICAL, ID_TOOLBAR);
|
||||||
InitToolbar(main_frame->GetToolBar());
|
InitToolbar(main_frame->GetToolBar());
|
||||||
|
|
||||||
@@ -200,3 +225,23 @@ void MyMainFrame::OnReparent(wxCommandEvent& WXUNUSED(event))
|
|||||||
mini_frame->SendSizeEvent();
|
mini_frame->SendSizeEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MyMainFrame::OnSetSize_150_150(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
SetSize( 150, 150 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyMainFrame::OnSetSize_200_200(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
SetSize( 200, 200 );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyMainFrame::OnSetMaxSize_150_150(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
SetMaxSize( wxSize(150,150) );
|
||||||
|
}
|
||||||
|
|
||||||
|
void MyMainFrame::OnSetMaxSize_300_300(wxCommandEvent& WXUNUSED(event))
|
||||||
|
{
|
||||||
|
SetMaxSize( wxSize(300,300) );
|
||||||
|
}
|
||||||
|
@@ -41,6 +41,10 @@ public:
|
|||||||
|
|
||||||
void OnCloseWindow(wxCloseEvent& event);
|
void OnCloseWindow(wxCloseEvent& event);
|
||||||
void OnReparent(wxCommandEvent& event);
|
void OnReparent(wxCommandEvent& event);
|
||||||
|
void OnSetSize_150_150(wxCommandEvent &event);
|
||||||
|
void OnSetSize_200_200(wxCommandEvent &event);
|
||||||
|
void OnSetMaxSize_150_150(wxCommandEvent &event);
|
||||||
|
void OnSetMaxSize_300_300(wxCommandEvent &event);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user