// ----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxListbook, wxBookCtrlBase)
-IMPLEMENT_DYNAMIC_CLASS(wxListbookEvent, wxNotifyEvent)
const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType();
const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED = wxNewEventType();
// under MSW, we'd finish with an ugly looking list control with both
// vertical and horizontal scrollbar (with one of them being added because
// the other one is not accounted for in client size computations)
- wxListView *list = GetListView();
- if (list) list->Arrange();
- wxBookCtrlBase::OnSize(event);
+ wxListView * const list = GetListView();
+ if ( list )
+ list->Arrange();
+
+ event.Skip();
}
int wxListbook::HitTest(const wxPoint& pt, long *flags) const
return size;
}
+void wxListbook::UpdateSize()
+{
+ // we should find a more elegant way to force a layout than generating this
+ // dummy event
+ wxSizeEvent sz(GetSize(), GetId());
+ GetEventHandler()->ProcessEvent(sz);
+}
// ----------------------------------------------------------------------------
// accessing the pages
return m_selection;
}
-wxBookCtrlBaseEvent* wxListbook::CreatePageChangingEvent() const
+wxBookCtrlEvent* wxListbook::CreatePageChangingEvent() const
{
- return new wxListbookEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId);
+ return new wxBookCtrlEvent(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING, m_windowId);
}
-void wxListbook::MakeChangedEvent(wxBookCtrlBaseEvent &event)
+void wxListbook::MakeChangedEvent(wxBookCtrlEvent &event)
{
event.SetEventType(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED);
}
if ( selNew != -1 )
SetSelection(selNew);
- wxSizeEvent sz(GetSize(), GetId());
- GetEventHandler()->ProcessEvent(sz);
-
+ UpdateSize();
+
return true;
}
}
GetListView()->Arrange();
- if (GetPageCount() == 0)
- {
- wxSizeEvent sz(GetSize(), GetId());
- GetEventHandler()->ProcessEvent(sz);
- }
+ UpdateSize();
}
return win;
m_selection = -1;
- wxSizeEvent sz(GetSize(), GetId());
- GetEventHandler()->ProcessEvent(sz);
+ UpdateSize();
return true;
}