From 60104cbafa4502c7592801ccb8507f779c5601cf Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Tue, 1 Nov 2005 22:35:50 +0000 Subject: [PATCH] wxMultiChoiceDialog uses now wxCheckListBox if possible, wxListBox if not git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36055 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/generic/choicdgg.h | 12 +++++++++++- src/generic/choicdgg.cpp | 26 ++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index d356938603..19d04d4309 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -24,6 +24,7 @@ All (GUI): wxLB_TOP, wxNB_TOP, wxCHB_TOP, wxTBK_TOP. - Added parent window parameter to wxHelpController constructor and added SetParentWindow/GetParentWindow. +- wxMultiChoiceDialog uses now wxCheckListBox if possible, wxListBox if not. wxMSW: diff --git a/include/wx/generic/choicdgg.h b/include/wx/generic/choicdgg.h index 6678bc16b4..3699e126ca 100644 --- a/include/wx/generic/choicdgg.h +++ b/include/wx/generic/choicdgg.h @@ -80,7 +80,11 @@ public: long styleLbox = wxLB_ALWAYS_SB); protected: - wxListBox *m_listbox; + wxListBoxBase *m_listbox; + + virtual wxListBoxBase *CreateList(int n, + const wxString *choices, + long styleLbox); DECLARE_NO_COPY_CLASS(wxAnyChoiceDialog) }; @@ -206,6 +210,12 @@ public: virtual bool TransferDataFromWindow(); protected: +#if wxUSE_CHECKLISTBOX + virtual wxListBoxBase *CreateList(int n, + const wxString *choices, + long styleLbox); +#endif // wxUSE_CHECKLISTBOX + wxArrayInt m_selections; private: diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index cd5743cbae..62beddd961 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -272,10 +272,8 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, topsizer->Add( CreateTextSizer( message ), 0, wxALL, wxLARGESMALL(10,0) ); // 2) list box - m_listbox = new wxListBox( this, wxID_LISTBOX, - wxDefaultPosition, wxDefaultSize, - n, choices, - styleLbox ); + m_listbox = CreateList(n,choices,styleLbox); + if ( n > 0 ) m_listbox->SetSelection(0); @@ -326,6 +324,14 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, styleDlg, pos, styleLbox); } +wxListBoxBase *wxAnyChoiceDialog::CreateList(int n, const wxString *choices, long styleLbox) +{ + return new wxListBox( this, wxID_LISTBOX, + wxDefaultPosition, wxDefaultSize, + n, choices, + styleLbox ); +} + // ---------------------------------------------------------------------------- // wxSingleChoiceDialog // ---------------------------------------------------------------------------- @@ -506,4 +512,16 @@ bool wxMultiChoiceDialog::TransferDataFromWindow() return true; } +#if wxUSE_CHECKLISTBOX + +wxListBoxBase *wxMultiChoiceDialog::CreateList(int n, const wxString *choices, long styleLbox) +{ + return new wxCheckListBox( this, wxID_LISTBOX, + wxDefaultPosition, wxDefaultSize, + n, choices, + styleLbox ); +} + +#endif // wxUSE_CHECKLISTBOX + #endif // wxUSE_CHOICEDLG -- 2.45.2