Size text sample to it's contents, rather than using fixed arbitrary size
This commit is contained in:
parent
5fb89cb86e
commit
d3497d32ec
@ -165,7 +165,7 @@ private:
|
|||||||
class MyFrame: public wxFrame
|
class MyFrame: public wxFrame
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h);
|
MyFrame(const wxString& title, int x, int y);
|
||||||
|
|
||||||
void OnQuit(wxCommandEvent& event);
|
void OnQuit(wxCommandEvent& event);
|
||||||
void OnAbout(wxCommandEvent& event);
|
void OnAbout(wxCommandEvent& event);
|
||||||
@ -455,9 +455,7 @@ bool MyApp::OnInit()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Create the main frame window
|
// Create the main frame window
|
||||||
MyFrame *frame = new MyFrame((wxFrame *) NULL,
|
MyFrame *frame = new MyFrame(wxS("Text wxWidgets sample"), 50, 50);
|
||||||
wxT("Text wxWidgets sample"), 50, 50, 700, 550);
|
|
||||||
frame->SetSizeHints( 500, 400 );
|
|
||||||
|
|
||||||
wxMenu *file_menu = new wxMenu;
|
wxMenu *file_menu = new wxMenu;
|
||||||
file_menu->Append(TEXT_SAVE, wxT("&Save file\tCtrl-S"),
|
file_menu->Append(TEXT_SAVE, wxT("&Save file\tCtrl-S"),
|
||||||
@ -1462,8 +1460,8 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
|
|||||||
EVT_IDLE(MyFrame::OnIdle)
|
EVT_IDLE(MyFrame::OnIdle)
|
||||||
wxEND_EVENT_TABLE()
|
wxEND_EVENT_TABLE()
|
||||||
|
|
||||||
MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h)
|
MyFrame::MyFrame(const wxString& title, int x, int y)
|
||||||
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h) )
|
: wxFrame(NULL, wxID_ANY, title, wxPoint(x, y))
|
||||||
{
|
{
|
||||||
SetIcon(wxICON(sample));
|
SetIcon(wxICON(sample));
|
||||||
|
|
||||||
@ -1472,6 +1470,7 @@ MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h
|
|||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
m_panel = new MyPanel( this, 10, 10, 300, 100 );
|
m_panel = new MyPanel( this, 10, 10, 300, 100 );
|
||||||
|
m_panel->GetSizer()->Fit(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnQuit (wxCommandEvent& WXUNUSED(event) )
|
void MyFrame::OnQuit (wxCommandEvent& WXUNUSED(event) )
|
||||||
|
Loading…
Reference in New Issue
Block a user