X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/206d3a16caa7a4e626395ae52cc8f7e0225e202d..1d529ef7eed851db9d007821decb9639e4e7fc16:/samples/widgets/widgets.cpp diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index 40d24365aa..6f51626845 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -282,10 +282,13 @@ WidgetsFrame::WidgetsFrame(const wxString& title) sizerTop->Fit(this); sizerTop->SetSizeHints(this); + // wxCocoa's listbox is too flakey to use for logging right now + #if !defined(__WXCOCOA__) // now that everything is created we can redirect the log messages to the // listbox m_logTarget = new LboxLogger(m_lboxLog, wxLog::GetActiveTarget()); wxLog::SetActiveTarget(m_logTarget); + #endif } void WidgetsFrame::InitNotebook() @@ -354,8 +357,54 @@ WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxChar *label) { m_ctor = ctor; - m_next = WidgetsPage::ms_widgetPages; - WidgetsPage::ms_widgetPages = this; + m_next = NULL; + + // dummy sorting: add and immediately sort on list according to label + + if(WidgetsPage::ms_widgetPages) + { + WidgetsPageInfo *node_prev = WidgetsPage::ms_widgetPages; + if(wxStrcmp(label,node_prev->GetLabel().c_str())<0) + { + // add as first + m_next = node_prev; + WidgetsPage::ms_widgetPages = this; + } + else + { + WidgetsPageInfo *node_next; + do + { + node_next = node_prev->GetNext(); + if(node_next) + { + // add if between two + if(wxStrcmp(label,node_next->GetLabel().c_str())<0) + { + node_prev->SetNext(this); + m_next = node_next; + // force to break loop + node_next = NULL; + } + } + else + { + // add as last + node_prev->SetNext(this); + m_next = node_next; + } + node_prev = node_next; + }while(node_next); + } + } + else + { + // add when first + + WidgetsPage::ms_widgetPages = this; + + } + } // ----------------------------------------------------------------------------