Replace wxEVT_SIZE handler with sizers in the listctrl sample
Just simplify the code, no real changes.
This commit is contained in:
parent
1a55f4cfa2
commit
0873abb836
@ -41,6 +41,7 @@
|
||||
#include "wx/timer.h" // for wxStopWatch
|
||||
#include "wx/colordlg.h" // for wxGetColourFromUser
|
||||
#include "wx/settings.h"
|
||||
#include "wx/sizer.h"
|
||||
#include "wx/sysopt.h"
|
||||
#include "wx/numdlg.h"
|
||||
|
||||
@ -305,6 +306,13 @@ MyFrame::MyFrame(const wxChar *title)
|
||||
#if wxUSE_STATUSBAR
|
||||
CreateStatusBar();
|
||||
#endif // wxUSE_STATUSBAR
|
||||
|
||||
wxBoxSizer* const sizer = new wxBoxSizer(wxVERTICAL);
|
||||
sizer->Add(m_listCtrl, wxSizerFlags(2).Expand().Border());
|
||||
sizer->Add(m_logWindow, wxSizerFlags(1).Expand().Border());
|
||||
m_panel->SetSizer(sizer);
|
||||
|
||||
SetClientSize(m_panel->GetBestSize());
|
||||
}
|
||||
|
||||
MyFrame::~MyFrame()
|
||||
@ -315,24 +323,6 @@ MyFrame::~MyFrame()
|
||||
delete m_imageListSmall;
|
||||
}
|
||||
|
||||
void MyFrame::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
DoSize();
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void MyFrame::DoSize()
|
||||
{
|
||||
if ( !m_logWindow )
|
||||
return;
|
||||
|
||||
wxSize size = GetClientSize();
|
||||
wxCoord y = (2*size.y)/3;
|
||||
m_listCtrl->SetSize(0, 0, size.x, y);
|
||||
m_logWindow->SetSize(0, y + 1, size.x, size.y - y -1);
|
||||
}
|
||||
|
||||
bool MyFrame::CheckNonVirtual() const
|
||||
{
|
||||
if ( !m_listCtrl->HasFlag(wxLC_VIRTUAL) )
|
||||
@ -496,8 +486,6 @@ void MyFrame::RecreateList(long flags, bool withText)
|
||||
m_listCtrl->EnableBellOnNoMatch(mb->IsChecked(LIST_TOGGLE_BELL));
|
||||
}
|
||||
|
||||
DoSize();
|
||||
|
||||
GetMenuBar()->Check(LIST_ROW_LINES, false);
|
||||
|
||||
m_logWindow->Clear();
|
||||
|
@ -100,11 +100,7 @@ public:
|
||||
MyFrame(const wxChar *title);
|
||||
virtual ~MyFrame();
|
||||
|
||||
void DoSize();
|
||||
|
||||
protected:
|
||||
void OnSize(wxSizeEvent& event);
|
||||
|
||||
void OnQuit(wxCommandEvent& event);
|
||||
void OnAbout(wxCommandEvent& event);
|
||||
void OnListView(wxCommandEvent& event);
|
||||
|
Loading…
Reference in New Issue
Block a user