From 584ad2a32fec156c6049145d7ece9a33213aea28 Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Sat, 31 Jan 2004 18:21:45 +0000 Subject: [PATCH] Added some missing STL-like wxArray/wxArrayString constructors. Added helper class wxCArrayString, better replacement for wxArrayString::GetStringArray. Added overloaded constructors and Create() methods taking a wxArrayString for wxCheckListBox, wxChoice, wxComboBox, wxListBox, wxRadioBox, wxSingleChoiceDialog, wxMultipleChoiceDialog. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 6 +++- include/wx/arrstr.h | 54 ++++++++++++++++++++++++++--------- include/wx/cocoa/checklst.h | 17 +++++++++++ include/wx/cocoa/choice.h | 20 +++++++++++++ include/wx/cocoa/combobox.h | 20 +++++++++++++ include/wx/cocoa/listbox.h | 17 +++++++++++ include/wx/cocoa/radiobox.h | 20 +++++++++++++ include/wx/dynarray.h | 3 ++ include/wx/generic/choicdgg.h | 47 ++++++++++++++++++++++++++++++ include/wx/gtk/checklst.h | 7 +++++ include/wx/gtk/choice.h | 20 +++++++++++++ include/wx/gtk/combobox.h | 19 ++++++++++++ include/wx/gtk/listbox.h | 20 +++++++++++++ include/wx/gtk/radiobox.h | 25 ++++++++++++++++ include/wx/gtk1/checklst.h | 7 +++++ include/wx/gtk1/choice.h | 20 +++++++++++++ include/wx/gtk1/combobox.h | 19 ++++++++++++ include/wx/gtk1/listbox.h | 20 +++++++++++++ include/wx/gtk1/radiobox.h | 25 ++++++++++++++++ include/wx/mac/checklst.h | 21 ++++++++++++++ include/wx/mac/choice.h | 20 ++++++++++++- include/wx/mac/combobox.h | 19 ++++++++++++ include/wx/mac/listbox.h | 19 +++++++++++- include/wx/mac/menu.h | 2 ++ include/wx/mac/radiobox.h | 16 +++++++++++ include/wx/motif/checklst.h | 16 +++++++++++ include/wx/motif/choice.h | 20 +++++++++++++ include/wx/motif/combobox.h | 23 +++++++++++++++ include/wx/motif/listbox.h | 19 ++++++++++++ include/wx/motif/menu.h | 1 + include/wx/motif/radiobox.h | 22 ++++++++++++++ include/wx/msw/checklst.h | 14 +++++++++ include/wx/msw/choice.h | 19 ++++++++++++ include/wx/msw/combobox.h | 20 +++++++++++++ include/wx/msw/listbox.h | 17 +++++++++++ include/wx/msw/radiobox.h | 24 ++++++++++++++++ include/wx/os2/checklst.h | 9 ++++++ include/wx/os2/choice.h | 31 ++++++++++++++++++++ include/wx/os2/combobox.h | 34 ++++++++++++++++++++++ include/wx/os2/listbox.h | 28 ++++++++++++++++++ include/wx/os2/radiobox.h | 37 ++++++++++++++++++++++++ include/wx/univ/checklst.h | 16 +++++++++++ include/wx/univ/choice.h | 14 +++++++++ include/wx/univ/combobox.h | 19 +++++++++++- include/wx/univ/listbox.h | 16 +++++++++++ include/wx/univ/radiobox.h | 20 +++++++++++++ src/cocoa/checklst.mm | 14 +++++++++ src/cocoa/choice.mm | 15 ++++++++++ src/cocoa/combobox.mm | 15 ++++++++++ src/cocoa/listbox.mm | 14 +++++++++ src/cocoa/radiobox.mm | 16 +++++++++++ src/generic/choicdgg.cpp | 49 +++++++++++++++++++++++++++++++ src/generic/grid.cpp | 11 +------ src/gtk/checklst.cpp | 13 +++++++++ src/gtk/choice.cpp | 12 ++++++++ src/gtk/combobox.cpp | 14 +++++++++ src/gtk/listbox.cpp | 12 ++++++++ src/gtk/radiobox.cpp | 13 +++++++++ src/gtk1/checklst.cpp | 13 +++++++++ src/gtk1/choice.cpp | 12 ++++++++ src/gtk1/combobox.cpp | 14 +++++++++ src/gtk1/listbox.cpp | 12 ++++++++ src/gtk1/radiobox.cpp | 13 +++++++++ src/mac/carbon/checklst.cpp | 16 +++++++++++ src/mac/carbon/choice.cpp | 14 +++++++++ src/mac/carbon/combobox.cpp | 16 +++++++++++ src/mac/carbon/listbox.cpp | 14 +++++++++ src/mac/carbon/radiobox.cpp | 13 +++++++++ src/mac/checklst.cpp | 16 +++++++++++ src/mac/choice.cpp | 14 +++++++++ src/mac/combobox.cpp | 16 +++++++++++ src/mac/listbox.cpp | 14 +++++++++ src/mac/radiobox.cpp | 13 +++++++++ src/motif/checklst.cpp | 25 ++++++++++++++++ src/motif/choice.cpp | 14 +++++++++ src/motif/combobox.cpp | 15 ++++++++++ src/motif/combobox_native.cpp | 15 ++++++++++ src/motif/listbox.cpp | 14 +++++++++ src/motif/menu.cpp | 11 +++++++ src/motif/radiobox.cpp | 11 +++++++ src/msw/checklst.cpp | 19 ++++++++++++ src/msw/choice.cpp | 14 +++++++++ src/msw/combobox.cpp | 14 +++++++++ src/msw/listbox.cpp | 14 +++++++++ src/msw/radiobox.cpp | 16 +++++++++++ src/os2/checklst.cpp | 25 ++++++++++++++++ src/os2/choice.cpp | 17 +++++++++++ src/os2/combobox.cpp | 18 ++++++++++++ src/os2/listbox.cpp | 17 +++++++++++ src/os2/radiobox.cpp | 19 ++++++++++++ src/univ/checklst.cpp | 29 +++++++++++++++++++ src/univ/choice.cpp | 26 +++++++++++++++++ src/univ/combobox.cpp | 31 ++++++++++++++++++++ src/univ/listbox.cpp | 29 +++++++++++++++++++ src/univ/radiobox.cpp | 32 +++++++++++++++++++++ 95 files changed, 1707 insertions(+), 28 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 99e306db43..9b111d4578 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -51,7 +51,8 @@ versions, please update your code to not use them. - wxTheFontMapper: use wxFontMapper::Get() instead - wxStringHashTable: use wxHashMap instead - wxHashTableLong: use wxHashMap instead -- wxArrayString::GetStringArray: no replacement +- wxArrayString::GetStringArray: use wxCArrayString or alternative wxWindows + methods taking wxArrayString - wxArrayString::Remove(index, count): use RemoveAt instead - wxTreeItemId conversion to long is deprecated and shouldn't be used - [MSW only] wxWindow::GetUseCtl3D(), GetTransparentBackground() and @@ -91,6 +92,9 @@ All: wxSize (Wlodzimierz Skiba) - intermediate wxIPaddress class added to prepare for wxIPV6address (Ray Gilbert) +- added overloaded constructors and Create() methods taking wxArrayString + for wxChoice, wxComboBox, wxListBox, wxRadioBox, wxCheckListBox, + wxSingleChoiceDialog, wxMultipleChoiceDialog All (GUI): diff --git a/include/wx/arrstr.h b/include/wx/arrstr.h index 5eed53d2cc..9643b64e76 100644 --- a/include/wx/arrstr.h +++ b/include/wx/arrstr.h @@ -92,10 +92,8 @@ public: // constructors and destructor // default ctor - wxArrayString() - : m_nSize(0), m_nCount(0), m_pItems(NULL), m_autoSort(FALSE) - { Init(FALSE); } - // if autoSort is TRUE, the array is always sorted (in alphabetical order) + wxArrayString() { Init(false); } + // if autoSort is true, the array is always sorted (in alphabetical order) // // NB: the reason for using int and not bool is that like this we can avoid // using this ctor for implicit conversions from "const char *" (which @@ -103,9 +101,7 @@ public: // // of course, using explicit would be even better - if all compilers // supported it... - wxArrayString(int autoSort) - : m_nSize(0), m_nCount(0), m_pItems(NULL), m_autoSort(FALSE) - { Init(autoSort != 0); } + wxArrayString(int autoSort) { Init(autoSort != 0); } // copy ctor wxArrayString(const wxArrayString& array); // assignment operator @@ -155,14 +151,16 @@ public: // take one in their ctor. You must delete[] it yourself // once you are done with it. Will return NULL if the // ArrayString was empty. +#if WXWIN_COMPATIBILITY_2_4 wxString* GetStringArray() const; +#endif // item management // Search the element in the array, starting from the beginning if - // bFromEnd is FALSE or from end otherwise. If bCase, comparison is case + // bFromEnd is false or from end otherwise. If bCase, comparison is case // sensitive (default). Returns index of the first item matched or // wxNOT_FOUND - int Index (const wxChar *sz, bool bCase = TRUE, bool bFromEnd = FALSE) const; + int Index (const wxChar *sz, bool bCase = true, bool bFromEnd = false) const; // add new element at the end (if the array is not sorted), return its // index size_t Add(const wxString& str, size_t nInsert = 1); @@ -180,8 +178,8 @@ public: // sorting // sort array elements in alphabetical order (or reversed alphabetical - // order if reverseOrder parameter is TRUE) - void Sort(bool reverseOrder = FALSE); + // order if reverseOrder parameter is true) + void Sort(bool reverseOrder = false); // sort array elements using specified comparaison function void Sort(CompareFunction compareFunction); void Sort(CompareFunction2 compareFunction); @@ -257,6 +255,9 @@ public: bool operator !=(const itor& it) { return m_ptr != it.m_ptr; } }; + wxArrayString(const_iterator first, const_iterator last) + { Init(false); assign(first, last); } + wxArrayString(size_type n, const_reference v) { Init(false); assign(n, v); } void assign(const_iterator first, const_iterator last); void assign(size_type n, const_reference v) { clear(); Add(v, n); } @@ -309,18 +310,43 @@ private: wxChar **m_pItems; // pointer to data - bool m_autoSort; // if TRUE, keep the array always sorted + bool m_autoSort; // if true, keep the array always sorted }; class WXDLLIMPEXP_BASE wxSortedArrayString : public wxArrayString { public: - wxSortedArrayString() : wxArrayString(TRUE) + wxSortedArrayString() : wxArrayString(true) { } - wxSortedArrayString(const wxArrayString& array) : wxArrayString(TRUE) + wxSortedArrayString(const wxArrayString& array) : wxArrayString(true) { Copy(array); } }; #endif // !wxUSE_STL +// this class provides a temporary wxString* from a +// wxArrayString +class WXDLLIMPEXP_BASE wxCArrayString +{ +public: + wxCArrayString( const wxArrayString& array ) + : m_array( array ), m_strings( NULL ) + { } + ~wxCArrayString() { delete[] m_strings; } + + size_t GetCount() const { return m_array.GetCount(); } + wxString* GetStrings() + { + if( m_strings ) return m_strings; + size_t count = m_array.GetCount(); + m_strings = new wxString[count]; + for( size_t i = 0; i < count; ++i ) + m_strings[i] = m_array[i]; + return m_strings; + } +private: + const wxArrayString& m_array; + wxString* m_strings; +}; + #endif diff --git a/include/wx/cocoa/checklst.h b/include/wx/cocoa/checklst.h index 4286b1a3d6..7b4c59315d 100644 --- a/include/wx/cocoa/checklst.h +++ b/include/wx/cocoa/checklst.h @@ -37,6 +37,16 @@ public: { Create(parent, winid, pos, size, n, choices, style, validator, name); } + wxCheckListBox(wxWindow *parent, wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, winid, pos, size, choices, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID winid, const wxPoint& pos = wxDefaultPosition, @@ -45,6 +55,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); virtual ~wxCheckListBox(); // ------------------------------------------------------------------------ diff --git a/include/wx/cocoa/choice.h b/include/wx/cocoa/choice.h index 3f6370a673..7db48f39f0 100644 --- a/include/wx/cocoa/choice.h +++ b/include/wx/cocoa/choice.h @@ -15,6 +15,8 @@ //#include "wx/cocoa/NSPopUpButton.h" #include "wx/cocoa/NSMenu.h" +class WXDLLIMPEXP_BASE wxSortedArrayString; + // ======================================================================== // wxChoice // ======================================================================== @@ -39,6 +41,17 @@ public: Init(); Create(parent, winid, pos, size, n, choices, style, validator, name); } + wxChoice(wxWindow *parent, wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Init(); + Create(parent, winid, pos, size, choices, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID winid, const wxPoint& pos = wxDefaultPosition, @@ -47,6 +60,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr); + bool Create(wxWindow *parent, wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); virtual ~wxChoice(); protected: void Init(); diff --git a/include/wx/cocoa/combobox.h b/include/wx/cocoa/combobox.h index 2b665585d3..b1abb3950c 100644 --- a/include/wx/cocoa/combobox.h +++ b/include/wx/cocoa/combobox.h @@ -40,6 +40,18 @@ public: { Create(parent, winid, value, pos, size, n, choices, style, validator, name); } + wxComboBox(wxWindow *parent, wxWindowID winid, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, winid, value, pos, size, choices, style, + validator, name); + } bool Create(wxWindow *parent, wxWindowID winid, const wxString& value = wxEmptyString, @@ -49,6 +61,14 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, wxWindowID winid, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); virtual ~wxComboBox(); // ------------------------------------------------------------------------ diff --git a/include/wx/cocoa/listbox.h b/include/wx/cocoa/listbox.h index 5d2dec15ba..94f6ea0897 100644 --- a/include/wx/cocoa/listbox.h +++ b/include/wx/cocoa/listbox.h @@ -39,6 +39,16 @@ public: { Create(parent, winid, pos, size, n, choices, style, validator, name); } + wxListBox(wxWindow *parent, wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, winid, pos, size, choices, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID winid, const wxPoint& pos = wxDefaultPosition, @@ -47,6 +57,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); virtual ~wxListBox(); // ------------------------------------------------------------------------ diff --git a/include/wx/cocoa/radiobox.h b/include/wx/cocoa/radiobox.h index 7db85c0655..363ffd3a35 100644 --- a/include/wx/cocoa/radiobox.h +++ b/include/wx/cocoa/radiobox.h @@ -38,6 +38,17 @@ public: { Create(parent, winid, title, pos, size, n, choices, majorDim, style, validator, name); } + wxRadioBox(wxWindow *parent, wxWindowID winid, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = 0, const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) + { + Create(parent, winid, title, pos, size, choices, majorDim, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID winid, const wxString& title, @@ -48,6 +59,15 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, wxWindowID winid, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); virtual ~wxRadioBox(); // ------------------------------------------------------------------------ diff --git a/include/wx/dynarray.h b/include/wx/dynarray.h index d784dff844..4c0346dbc9 100644 --- a/include/wx/dynarray.h +++ b/include/wx/dynarray.h @@ -442,6 +442,9 @@ public: \ bool operator !=(const itor& it) { return m_ptr != it.m_ptr; } \ }; \ \ + name(size_type n, const_reference v) { assign(n, v); } \ + name(const_iterator first, const_iterator last) \ + { assign(first, last); } \ void assign(const_iterator first, const_iterator last) \ { base::assign((bconst_iterator)first, (bconst_iterator)last); } \ void assign(size_type n, const_reference v) \ diff --git a/include/wx/generic/choicdgg.h b/include/wx/generic/choicdgg.h index 2ccd871e43..3038a2dff5 100644 --- a/include/wx/generic/choicdgg.h +++ b/include/wx/generic/choicdgg.h @@ -51,6 +51,17 @@ public: (void)Create(parent, message, caption, n, choices, styleDlg, pos, styleLbox); } + wxAnyChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long styleDlg = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition, + long styleLbox = wxLB_ALWAYS_SB) + { + (void)Create(parent, message, caption, choices, + styleDlg, pos, styleLbox); + } bool Create(wxWindow *parent, const wxString& message, @@ -59,6 +70,13 @@ public: long styleDlg = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition, long styleLbox = wxLB_ALWAYS_SB); + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long styleDlg = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition, + long styleLbox = wxLB_ALWAYS_SB); protected: wxListBox *m_listbox; @@ -86,6 +104,13 @@ public: char **clientData = (char **)NULL, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); + wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData = (char **)NULL, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); bool Create(wxWindow *parent, const wxString& message, @@ -95,6 +120,13 @@ public: char **clientData = (char **)NULL, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData = (char **)NULL, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); void SetSelection(int sel); int GetSelection() const { return m_selection; } @@ -135,6 +167,15 @@ public: { (void)Create(parent, message, caption, n, choices, style, pos); } + wxMultiChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition) + { + (void)Create(parent, message, caption, choices, style, pos); + } bool Create(wxWindow *parent, const wxString& message, @@ -143,6 +184,12 @@ public: const wxString *choices, long style = wxCHOICEDLG_STYLE, const wxPoint& pos = wxDefaultPosition); + bool Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long style = wxCHOICEDLG_STYLE, + const wxPoint& pos = wxDefaultPosition); void SetSelections(const wxArrayInt& selections); wxArrayInt GetSelections() const { return m_selections; } diff --git a/include/wx/gtk/checklst.h b/include/wx/gtk/checklst.h index aa26886c0f..b2afb54cf3 100644 --- a/include/wx/gtk/checklst.h +++ b/include/wx/gtk/checklst.h @@ -44,6 +44,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); bool IsChecked( int index ) const; void Check( int index, bool check = TRUE ); diff --git a/include/wx/gtk/choice.h b/include/wx/gtk/choice.h index a6e0ecd1be..d738e3e253 100644 --- a/include/wx/gtk/choice.h +++ b/include/wx/gtk/choice.h @@ -15,6 +15,7 @@ #endif class WXDLLIMPEXP_BASE wxSortedArrayString; +class WXDLLIMPEXP_BASE wxArrayString; //----------------------------------------------------------------------------- // wxChoice @@ -36,6 +37,18 @@ public: Create(parent, id, pos, size, n, choices, style, validator, name); } + wxChoice( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr ) + { + m_strings = (wxSortedArrayString *)NULL; + + Create(parent, id, pos, size, choices, style, validator, name); + } ~wxChoice(); bool Create( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -44,6 +57,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr ); + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr ); // implement base class pure virtuals void Delete(int n); diff --git a/include/wx/gtk/combobox.h b/include/wx/gtk/combobox.h index 54f5d30cf7..6cd8dafe5b 100644 --- a/include/wx/gtk/combobox.h +++ b/include/wx/gtk/combobox.h @@ -54,6 +54,17 @@ public: { Create(parent, id, value, pos, size, n, choices, style, validator, name); } + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, choices, style, validator, name); + } ~wxComboBox(); @@ -65,6 +76,14 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); void Clear(); void Delete( int n ); diff --git a/include/wx/gtk/listbox.h b/include/wx/gtk/listbox.h index 3a91c721c7..7974011566 100644 --- a/include/wx/gtk/listbox.h +++ b/include/wx/gtk/listbox.h @@ -41,6 +41,19 @@ public: #endif // wxUSE_CHECKLISTBOX Create(parent, id, pos, size, n, choices, style, validator, name); } + wxListBox( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr ) + { +#if wxUSE_CHECKLISTBOX + m_hasCheckBoxes = FALSE; +#endif // wxUSE_CHECKLISTBOX + Create(parent, id, pos, size, choices, style, validator, name); + } virtual ~wxListBox(); bool Create(wxWindow *parent, wxWindowID id, @@ -50,6 +63,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); // implement base class pure virtuals virtual void Clear(); diff --git a/include/wx/gtk/radiobox.h b/include/wx/gtk/radiobox.h index e0e45b054e..bba9a528e2 100644 --- a/include/wx/gtk/radiobox.h +++ b/include/wx/gtk/radiobox.h @@ -41,6 +41,21 @@ public: Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); } + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 1, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) + { + Init(); + + Create( parent, id, title, pos, size, choices, majorDim, style, val, name ); + } virtual ~wxRadioBox(); bool Create(wxWindow *parent, @@ -54,6 +69,16 @@ public: long style = wxRA_HORIZONTAL, const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); int FindString( const wxString& s) const; void SetSelection( int n ); diff --git a/include/wx/gtk1/checklst.h b/include/wx/gtk1/checklst.h index aa26886c0f..b2afb54cf3 100644 --- a/include/wx/gtk1/checklst.h +++ b/include/wx/gtk1/checklst.h @@ -44,6 +44,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); bool IsChecked( int index ) const; void Check( int index, bool check = TRUE ); diff --git a/include/wx/gtk1/choice.h b/include/wx/gtk1/choice.h index a6e0ecd1be..d738e3e253 100644 --- a/include/wx/gtk1/choice.h +++ b/include/wx/gtk1/choice.h @@ -15,6 +15,7 @@ #endif class WXDLLIMPEXP_BASE wxSortedArrayString; +class WXDLLIMPEXP_BASE wxArrayString; //----------------------------------------------------------------------------- // wxChoice @@ -36,6 +37,18 @@ public: Create(parent, id, pos, size, n, choices, style, validator, name); } + wxChoice( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr ) + { + m_strings = (wxSortedArrayString *)NULL; + + Create(parent, id, pos, size, choices, style, validator, name); + } ~wxChoice(); bool Create( wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -44,6 +57,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr ); + bool Create( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr ); // implement base class pure virtuals void Delete(int n); diff --git a/include/wx/gtk1/combobox.h b/include/wx/gtk1/combobox.h index 54f5d30cf7..6cd8dafe5b 100644 --- a/include/wx/gtk1/combobox.h +++ b/include/wx/gtk1/combobox.h @@ -54,6 +54,17 @@ public: { Create(parent, id, value, pos, size, n, choices, style, validator, name); } + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, choices, style, validator, name); + } ~wxComboBox(); @@ -65,6 +76,14 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); void Clear(); void Delete( int n ); diff --git a/include/wx/gtk1/listbox.h b/include/wx/gtk1/listbox.h index 3a91c721c7..7974011566 100644 --- a/include/wx/gtk1/listbox.h +++ b/include/wx/gtk1/listbox.h @@ -41,6 +41,19 @@ public: #endif // wxUSE_CHECKLISTBOX Create(parent, id, pos, size, n, choices, style, validator, name); } + wxListBox( wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr ) + { +#if wxUSE_CHECKLISTBOX + m_hasCheckBoxes = FALSE; +#endif // wxUSE_CHECKLISTBOX + Create(parent, id, pos, size, choices, style, validator, name); + } virtual ~wxListBox(); bool Create(wxWindow *parent, wxWindowID id, @@ -50,6 +63,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); // implement base class pure virtuals virtual void Clear(); diff --git a/include/wx/gtk1/radiobox.h b/include/wx/gtk1/radiobox.h index e0e45b054e..bba9a528e2 100644 --- a/include/wx/gtk1/radiobox.h +++ b/include/wx/gtk1/radiobox.h @@ -41,6 +41,21 @@ public: Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name ); } + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 1, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) + { + Init(); + + Create( parent, id, title, pos, size, choices, majorDim, style, val, name ); + } virtual ~wxRadioBox(); bool Create(wxWindow *parent, @@ -54,6 +69,16 @@ public: long style = wxRA_HORIZONTAL, const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); int FindString( const wxString& s) const; void SetSelection( int n ); diff --git a/include/wx/mac/checklst.h b/include/wx/mac/checklst.h index 3bf972d7a2..35f3bd885d 100644 --- a/include/wx/mac/checklst.h +++ b/include/wx/mac/checklst.h @@ -41,6 +41,19 @@ public: Create(parent, id, pos, size, nStrings, choices, style, validator, name); } + wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Init(); + + Create(parent, id, pos, size, choices, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID id, @@ -51,6 +64,14 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); // items may be checked bool IsChecked(size_t uiIndex) const; diff --git a/include/wx/mac/choice.h b/include/wx/mac/choice.h index 26ac3359c0..4c10bab315 100644 --- a/include/wx/mac/choice.h +++ b/include/wx/mac/choice.h @@ -18,7 +18,8 @@ #include "wx/control.h" - #include "wx/dynarray.h" +#include "wx/dynarray.h" +#include "wx/arrstr.h" WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr; @@ -46,6 +47,16 @@ public: { Create(parent, id, pos, size, n, choices, style, validator, name); } + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -54,6 +65,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); // implement base class pure virtuals virtual int DoAppend(const wxString& item); diff --git a/include/wx/mac/combobox.h b/include/wx/mac/combobox.h index d2528db237..68b3b02820 100644 --- a/include/wx/mac/combobox.h +++ b/include/wx/mac/combobox.h @@ -53,6 +53,17 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase { Create(parent, id, value, pos, size, n, choices, style, validator, name); } + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, choices, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID id, const wxString& value = wxEmptyString, @@ -62,6 +73,14 @@ class WXDLLEXPORT wxComboBox : public wxControl, public wxComboBoxBase long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); // List functions virtual void Delete(int n); diff --git a/include/wx/mac/listbox.h b/include/wx/mac/listbox.h index d1ca11ca7a..0df5bd0366 100644 --- a/include/wx/mac/listbox.h +++ b/include/wx/mac/listbox.h @@ -21,7 +21,7 @@ // simple types // ---------------------------------------------------------------------------- #include "wx/dynarray.h" - +#include "wx/arrstr.h" #if wxUSE_OWNER_DRAWN class WXDLLEXPORT wxOwnerDrawn; @@ -58,6 +58,16 @@ public: { Create(parent, id, pos, size, n, choices, style, validator, name); } + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -66,6 +76,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); virtual ~wxListBox(); virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL); diff --git a/include/wx/mac/menu.h b/include/wx/mac/menu.h index 5f2cd2344c..854a70d107 100644 --- a/include/wx/mac/menu.h +++ b/include/wx/mac/menu.h @@ -18,6 +18,8 @@ class WXDLLEXPORT wxFrame; +#include "wx/arrstr.h" + // ---------------------------------------------------------------------------- // Menu // ---------------------------------------------------------------------------- diff --git a/include/wx/mac/radiobox.h b/include/wx/mac/radiobox.h index 79bd01c0ac..c9642e2deb 100644 --- a/include/wx/mac/radiobox.h +++ b/include/wx/mac/radiobox.h @@ -35,12 +35,28 @@ public: { Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); } + inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) + { + Create(parent, id, title, pos, size, choices, + majorDim, style, val, name); + } ~wxRadioBox(); bool Create(wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL, int majorDim = 0, long style = wxRA_HORIZONTAL, const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); // Specific functions (in wxWindows2 reference) virtual void SetSelection(int item); diff --git a/include/wx/motif/checklst.h b/include/wx/motif/checklst.h index 32370ab30c..f097bd739f 100644 --- a/include/wx/motif/checklst.h +++ b/include/wx/motif/checklst.h @@ -35,6 +35,14 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -43,6 +51,14 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + // items may be checked bool IsChecked(size_t uiIndex) const; void Check(size_t uiIndex, bool bCheck = TRUE); diff --git a/include/wx/motif/choice.h b/include/wx/motif/choice.h index 1636502e63..8a01c3cb23 100644 --- a/include/wx/motif/choice.h +++ b/include/wx/motif/choice.h @@ -46,6 +46,18 @@ public: Create(parent, id, pos, size, n, choices, style, validator, name); } + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Init(); + Create(parent, id, pos, size, choices, style, validator, name); + } + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -54,6 +66,14 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); + // implementation of wxControlWithItems virtual int GetCount() const; virtual int DoAppend(const wxString& item); diff --git a/include/wx/motif/combobox.h b/include/wx/motif/combobox.h index c3f748e0fe..d0b5b2532c 100644 --- a/include/wx/motif/combobox.h +++ b/include/wx/motif/combobox.h @@ -41,6 +41,20 @@ public: style, validator, name); } + inline wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + m_inSetSelection = false; + Create(parent, id, value, pos, size, choices, + style, validator, name); + } + bool Create(wxWindow *parent, wxWindowID id, const wxString& value = wxEmptyString, const wxPoint& pos = wxDefaultPosition, @@ -50,6 +64,15 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); + // implementation of wxControlWithItems virtual int DoAppend(const wxString& item); virtual int DoInsert(const wxString& item, int pos); diff --git a/include/wx/motif/listbox.h b/include/wx/motif/listbox.h index 93a3fac24c..07c77df706 100644 --- a/include/wx/motif/listbox.h +++ b/include/wx/motif/listbox.h @@ -40,6 +40,17 @@ public: Create(parent, id, pos, size, n, choices, style, validator, name); } + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } + bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, @@ -48,6 +59,14 @@ public: const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); + ~wxListBox(); // implementation of wxControlWithItems diff --git a/include/wx/motif/menu.h b/include/wx/motif/menu.h index 64ad89e2d0..eb26667a36 100644 --- a/include/wx/motif/menu.h +++ b/include/wx/motif/menu.h @@ -118,6 +118,7 @@ public: wxMenuBar() { Init(); } wxMenuBar(long WXUNUSED(style)) { Init(); } wxMenuBar(int n, wxMenu *menus[], const wxString titles[]); + wxMenuBar(int n, wxMenu *menus[], const wxArrayString& titles); virtual ~wxMenuBar(); // implement base class (pure) virtuals diff --git a/include/wx/motif/radiobox.h b/include/wx/motif/radiobox.h index 81f1900b3d..d1e91a0bfc 100644 --- a/include/wx/motif/radiobox.h +++ b/include/wx/motif/radiobox.h @@ -46,6 +46,20 @@ public: majorDim, style, val, name); } + wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) + { + Init(); + + Create(parent, id, title, pos, size, choices, + majorDim, style, val, name); + } + ~wxRadioBox(); bool Create(wxWindow *parent, wxWindowID id, const wxString& title, @@ -56,6 +70,14 @@ public: const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); + int FindString(const wxString& s) const; void SetSelection(int N); int GetSelection() const; diff --git a/include/wx/msw/checklst.h b/include/wx/msw/checklst.h index 96df78ad12..73385b20da 100644 --- a/include/wx/msw/checklst.h +++ b/include/wx/msw/checklst.h @@ -36,6 +36,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -44,6 +51,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); // override base class virtuals virtual void Delete(int n); diff --git a/include/wx/msw/choice.h b/include/wx/msw/choice.h index c2b47f69c5..ab7016061f 100644 --- a/include/wx/msw/choice.h +++ b/include/wx/msw/choice.h @@ -38,6 +38,17 @@ public: { Create(parent, id, pos, size, n, choices, style, validator, name); } + wxChoice(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID id, @@ -47,6 +58,14 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); // implement base class pure virtuals virtual int DoAppend(const wxString& item); diff --git a/include/wx/msw/combobox.h b/include/wx/msw/combobox.h index a369165d75..f47d004cb6 100644 --- a/include/wx/msw/combobox.h +++ b/include/wx/msw/combobox.h @@ -40,6 +40,17 @@ public: { Create(parent, id, value, pos, size, n, choices, style, validator, name); } + wxComboBox(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr) + { + Create(parent, id, value, pos, size, choices, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID id, @@ -51,6 +62,15 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); // List functions: see wxChoice diff --git a/include/wx/msw/listbox.h b/include/wx/msw/listbox.h index 9574e73e9f..5ab31ebbed 100644 --- a/include/wx/msw/listbox.h +++ b/include/wx/msw/listbox.h @@ -53,6 +53,16 @@ public: { Create(parent, id, pos, size, n, choices, style, validator, name); } + wxListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr) + { + Create(parent, id, pos, size, choices, style, validator, name); + } bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -61,6 +71,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); virtual ~wxListBox(); diff --git a/include/wx/msw/radiobox.h b/include/wx/msw/radiobox.h index 0cab158a27..9b3a90c121 100644 --- a/include/wx/msw/radiobox.h +++ b/include/wx/msw/radiobox.h @@ -41,6 +41,20 @@ public: (void)Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); } + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr) + { + (void)Create(parent, id, title, pos, size, choices, majorDim, + style, val, name); + } ~wxRadioBox(); @@ -54,6 +68,16 @@ public: long style = wxRA_HORIZONTAL, const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_HORIZONTAL, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); // implement the radiobox interface virtual void SetSelection(int n); diff --git a/include/wx/os2/checklst.h b/include/wx/os2/checklst.h index 6a73d7052b..d2d75ec498 100644 --- a/include/wx/os2/checklst.h +++ b/include/wx/os2/checklst.h @@ -38,6 +38,15 @@ public: ,const wxValidator& rValidator = wxDefaultValidator ,const wxString& rsName = wxListBoxNameStr ); + wxCheckListBox( wxWindow* pParent + ,wxWindowID vId + ,const wxPoint& rPos + ,const wxSize& vSize + ,const wxArrayString& asChoices + ,long lStyle = 0 + ,const wxValidator& rValidator = wxDefaultValidator + ,const wxString& rsName = wxListBoxNameStr + ); // // Override base class virtuals diff --git a/include/wx/os2/choice.h b/include/wx/os2/choice.h index 9c4e0f47a5..9293bdab9f 100644 --- a/include/wx/os2/choice.h +++ b/include/wx/os2/choice.h @@ -44,6 +44,27 @@ public: ); } + inline wxChoice( wxWindow* pParent + ,wxWindowID vId + ,const wxPoint& rPos + ,const wxSize& rSize + ,const wxArrayString& asChoices + ,long lStyle = 0 + ,const wxValidator& rValidator = wxDefaultValidator + ,const wxString& rsName = wxChoiceNameStr + ) + { + Create( pParent + ,vId + ,rPos + ,rSize + ,asChoices + ,lStyle + ,rValidator + ,rsName + ); + } + bool Create( wxWindow* pParent ,wxWindowID vId ,const wxPoint& rPos = wxDefaultPosition @@ -55,6 +76,16 @@ public: ,const wxString& rsName = wxChoiceNameStr ); + bool Create( wxWindow* pParent + ,wxWindowID vId + ,const wxPoint& rPos + ,const wxSize& rSize + ,const wxArrayString& asChoices + ,long lStyle = 0 + ,const wxValidator& rValidator = wxDefaultValidator + ,const wxString& rsName = wxChoiceNameStr + ); + // // Implement base class virtuals // diff --git a/include/wx/os2/combobox.h b/include/wx/os2/combobox.h index 4e39936991..e1373b9bdc 100644 --- a/include/wx/os2/combobox.h +++ b/include/wx/os2/combobox.h @@ -48,6 +48,29 @@ class WXDLLEXPORT wxComboBox : public wxChoice ); } + inline wxComboBox( wxWindow* pParent + ,wxWindowID vId + ,const wxString& rsValue + ,const wxPoint& rPos + ,const wxSize& rSize + ,const wxArrayString& asChoices + ,long lStyle = 0 + ,const wxValidator& rValidator = wxDefaultValidator + ,const wxString& rsName = wxComboBoxNameStr + ) + { + Create( pParent + ,vId + ,rsValue + ,rPos + ,rSize + ,asChoices + ,lStyle + ,rValidator + ,rsName + ); + } + bool Create( wxWindow* pParent ,wxWindowID vId ,const wxString& rsValue = wxEmptyString @@ -60,6 +83,17 @@ class WXDLLEXPORT wxComboBox : public wxChoice ,const wxString& rsName = wxComboBoxNameStr ); + bool Create( wxWindow* pParent + ,wxWindowID vId + ,const wxString& rsValue + ,const wxPoint& rPos + ,const wxSize& rSize + ,const wxArrayString& asChoices + ,long lStyle = 0 + ,const wxValidator& rValidator = wxDefaultValidator + ,const wxString& rsName = wxComboBoxNameStr + ); + // // List functions: see wxChoice // diff --git a/include/wx/os2/listbox.h b/include/wx/os2/listbox.h index 813885934a..a1bba2d821 100644 --- a/include/wx/os2/listbox.h +++ b/include/wx/os2/listbox.h @@ -58,6 +58,25 @@ public: ,rsName ); } + wxListBox( wxWindow* pParent + ,wxWindowID vId + ,const wxPoint& rPos + ,const wxSize& rSize + ,const wxArrayString& asChoices + ,long lStyle = 0 + ,const wxValidator& rValidator = wxDefaultValidator + ,const wxString& rsName = wxListBoxNameStr) + { + Create( pParent + ,vId + ,rPos + ,rSize + ,asChoices + ,lStyle + ,rValidator + ,rsName + ); + } bool Create( wxWindow* pParent ,wxWindowID vId @@ -69,6 +88,15 @@ public: ,const wxValidator& rValidator = wxDefaultValidator ,const wxString& rsName = wxListBoxNameStr ); + bool Create( wxWindow* pParent + ,wxWindowID vId + ,const wxPoint& rPos + ,const wxSize& rSize + ,const wxArrayString& asChoices + ,long lStyle = 0 + ,const wxValidator& rValidator = wxDefaultValidator + ,const wxString& rsName = wxListBoxNameStr + ); virtual ~wxListBox(); diff --git a/include/wx/os2/radiobox.h b/include/wx/os2/radiobox.h index d6eb7cc229..9534ba0ba0 100644 --- a/include/wx/os2/radiobox.h +++ b/include/wx/os2/radiobox.h @@ -47,6 +47,31 @@ public: ); } + inline wxRadioBox( wxWindow* pParent + ,wxWindowID vId + ,const wxString& rsTitle + ,const wxPoint& rPos + ,const wxSize& rSize + ,const wxArrayString& asChoices + ,int nMajorDim = 0 + ,long lStyle = wxRA_HORIZONTAL + ,const wxValidator& rVal = wxDefaultValidator + ,const wxString& rsName = wxRadioBoxNameStr + ) + { + Create( pParent + ,vId + ,rsTitle + ,rPos + ,rSize + ,asChoices + ,nMajorDim + ,lStyle + ,rVal + ,rsName + ); + } + ~wxRadioBox(); bool Create( wxWindow* pParent @@ -62,6 +87,18 @@ public: ,const wxString& rsName = wxRadioBoxNameStr ); + bool Create( wxWindow* pParent + ,wxWindowID vId + ,const wxString& rsTitle + ,const wxPoint& rPos + ,const wxSize& rSize + ,const wxArrayString& asChoices + ,int nMajorDim = 0 + ,long lStyle = wxRA_HORIZONTAL + ,const wxValidator& rVal = wxDefaultValidator + ,const wxString& rsName = wxRadioBoxNameStr + ); + void Command(wxCommandEvent& rEvent); bool ContainsHWND(WXHWND hWnd) const; virtual bool Enable(bool bEnable = TRUE); diff --git a/include/wx/univ/checklst.h b/include/wx/univ/checklst.h index ee62327925..af878cad02 100644 --- a/include/wx/univ/checklst.h +++ b/include/wx/univ/checklst.h @@ -46,6 +46,14 @@ public: Create(parent, id, pos, size, nStrings, choices, style, validator, name); } + wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); bool Create(wxWindow *parent, wxWindowID id, @@ -56,6 +64,14 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); // implement check list box methods virtual bool IsChecked(size_t item) const; diff --git a/include/wx/univ/choice.h b/include/wx/univ/choice.h index a96d443d02..7e7d852239 100644 --- a/include/wx/univ/choice.h +++ b/include/wx/univ/choice.h @@ -34,6 +34,13 @@ public: { Create(parent, id, pos, size, n, choices, style, validator, name); } + wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, @@ -42,6 +49,13 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxChoiceNameStr); + bool Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxChoiceNameStr); private: void OnComboBox(wxCommandEvent &event); diff --git a/include/wx/univ/combobox.h b/include/wx/univ/combobox.h index 28be5a0a2e..bfc643c696 100644 --- a/include/wx/univ/combobox.h +++ b/include/wx/univ/combobox.h @@ -231,6 +231,15 @@ public: (void)Create(parent, id, value, pos, size, n, choices, style, validator, name); } + wxComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); bool Create(wxWindow *parent, wxWindowID id, @@ -242,7 +251,15 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxComboBoxNameStr); - + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxComboBoxNameStr); virtual ~wxComboBox(); diff --git a/include/wx/univ/listbox.h b/include/wx/univ/listbox.h index b5c6cc2c21..acc660541a 100644 --- a/include/wx/univ/listbox.h +++ b/include/wx/univ/listbox.h @@ -70,6 +70,14 @@ public: Create(parent, id, pos, size, n, choices, style, validator, name); } + wxListBox(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr ); virtual ~wxListBox(); @@ -81,6 +89,14 @@ public: long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style = 0, + const wxValidator& validator = wxDefaultValidator, + const wxString& name = wxListBoxNameStr); // implement the listbox interface defined by wxListBoxBase virtual void Clear(); diff --git a/include/wx/univ/radiobox.h b/include/wx/univ/radiobox.h index 409d647d15..6072641499 100644 --- a/include/wx/univ/radiobox.h +++ b/include/wx/univ/radiobox.h @@ -50,6 +50,16 @@ public: (void)Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name); } + wxRadioBox(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); bool Create(wxWindow *parent, wxWindowID id, @@ -61,6 +71,16 @@ public: long style = wxRA_SPECIFY_COLS, const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr); + bool Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim = 0, + long style = wxRA_SPECIFY_COLS, + const wxValidator& val = wxDefaultValidator, + const wxString& name = wxRadioBoxNameStr); virtual ~wxRadioBox(); diff --git a/src/cocoa/checklst.mm b/src/cocoa/checklst.mm index abda41c2a4..5fa53cf917 100644 --- a/src/cocoa/checklst.mm +++ b/src/cocoa/checklst.mm @@ -21,6 +21,20 @@ BEGIN_EVENT_TABLE(wxCheckListBox, wxCheckListBoxBase) END_EVENT_TABLE() // WX_IMPLEMENT_COCOA_OWNER(wxCheckListBox,NSButton,NSControl,NSView) +bool wxCheckListBox::Create(wxWindow *parent, wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, winid, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxCheckListBox::Create(wxWindow *parent, wxWindowID winid, const wxPoint& pos, const wxSize& size, diff --git a/src/cocoa/choice.mm b/src/cocoa/choice.mm index 3840e0994b..91ca7a94b9 100644 --- a/src/cocoa/choice.mm +++ b/src/cocoa/choice.mm @@ -14,6 +14,7 @@ #include "wx/log.h" #include "wx/app.h" #include "wx/choice.h" + #include "wx/arrstr.h" #endif //WX_PRECOMP #include "wx/cocoa/string.h" @@ -33,6 +34,20 @@ void wxChoice::Init() m_sortedStrings = NULL; } +bool wxChoice::Create(wxWindow *parent, wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, winid, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxChoice::Create(wxWindow *parent, wxWindowID winid, const wxPoint& pos, const wxSize& size, diff --git a/src/cocoa/combobox.mm b/src/cocoa/combobox.mm index ae2b9015fd..8500a22382 100644 --- a/src/cocoa/combobox.mm +++ b/src/cocoa/combobox.mm @@ -27,6 +27,21 @@ BEGIN_EVENT_TABLE(wxComboBox, wxTextCtrl) END_EVENT_TABLE() // WX_IMPLEMENT_COCOA_OWNER(wxComboBox,NSComboBox,NSTextField,NSView) +bool wxComboBox::Create(wxWindow *parent, wxWindowID winid, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, winid, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name); +} + bool wxComboBox::Create(wxWindow *parent, wxWindowID winid, const wxString& value, const wxPoint& pos, diff --git a/src/cocoa/listbox.mm b/src/cocoa/listbox.mm index 2f35c368cd..a379cdd02e 100644 --- a/src/cocoa/listbox.mm +++ b/src/cocoa/listbox.mm @@ -30,6 +30,20 @@ BEGIN_EVENT_TABLE(wxListBox, wxListBoxBase) END_EVENT_TABLE() WX_IMPLEMENT_COCOA_OWNER(wxListBox,NSTableView,NSControl,NSView) +bool wxListBox::Create(wxWindow *parent, wxWindowID winid, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, winid, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxListBox::Create(wxWindow *parent, wxWindowID winid, const wxPoint& pos, const wxSize& size, diff --git a/src/cocoa/radiobox.mm b/src/cocoa/radiobox.mm index ff0626e5c5..216038e63d 100644 --- a/src/cocoa/radiobox.mm +++ b/src/cocoa/radiobox.mm @@ -13,6 +13,7 @@ #ifndef WX_PRECOMP #include "wx/app.h" #include "wx/radiobox.h" + #include "wx/arrstr.h" #endif //WX_PRECOMP #import @@ -22,6 +23,21 @@ BEGIN_EVENT_TABLE(wxRadioBox, wxControl) END_EVENT_TABLE() // WX_IMPLEMENT_COCOA_OWNER(wxRadioBox,NSTextField,NSControl,NSView) +bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim, + long style, const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, winid, title, pos, size, chs.GetCount(), + chs.GetStrings(), majorDim, style, validator, name); +} + bool wxRadioBox::Create(wxWindow *parent, wxWindowID winid, const wxString& title, const wxPoint& pos, diff --git a/src/generic/choicdgg.cpp b/src/generic/choicdgg.cpp index 629284a4ba..1abec6f0cb 100644 --- a/src/generic/choicdgg.cpp +++ b/src/generic/choicdgg.cpp @@ -285,6 +285,19 @@ bool wxAnyChoiceDialog::Create(wxWindow *parent, return TRUE; } +bool wxAnyChoiceDialog::Create(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long styleDlg, + const wxPoint& pos, + long styleLbox) +{ + wxCArrayString chs(choices); + return Create(parent, message, caption, chs.GetCount(), chs.GetStrings(), + styleDlg, pos, styleLbox); +} + // ---------------------------------------------------------------------------- // wxSingleChoiceDialog // ---------------------------------------------------------------------------- @@ -308,6 +321,17 @@ wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, Create(parent, message, caption, n, choices, clientData, style); } +wxSingleChoiceDialog::wxSingleChoiceDialog(wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData, + long style, + const wxPoint& WXUNUSED(pos)) +{ + Create(parent, message, caption, choices, clientData, style); +} + bool wxSingleChoiceDialog::Create( wxWindow *parent, const wxString& message, const wxString& caption, @@ -333,6 +357,19 @@ bool wxSingleChoiceDialog::Create( wxWindow *parent, return TRUE; } +bool wxSingleChoiceDialog::Create( wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + char **clientData, + long style, + const wxPoint& pos ) +{ + wxCArrayString chs(choices); + return Create( parent, message, caption, chs.GetCount(), chs.GetStrings(), + clientData, style, pos ); +} + // Set the selection void wxSingleChoiceDialog::SetSelection(int sel) { @@ -383,6 +420,18 @@ bool wxMultiChoiceDialog::Create( wxWindow *parent, return TRUE; } +bool wxMultiChoiceDialog::Create( wxWindow *parent, + const wxString& message, + const wxString& caption, + const wxArrayString& choices, + long style, + const wxPoint& pos ) +{ + wxCArrayString chs(choices); + return Create( parent, message, caption, chs.GetCount(), + chs.GetStrings(), style, pos ); +} + void wxMultiChoiceDialog::SetSelections(const wxArrayInt& selections) { size_t count = selections.GetCount(); diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 753fcf01b7..9ad4536bc8 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -1398,20 +1398,11 @@ void wxGridCellChoiceEditor::Create(wxWindow* parent, wxWindowID id, wxEvtHandler* evtHandler) { - size_t count = m_choices.GetCount(); - wxString *choices = new wxString[count]; - for ( size_t n = 0; n < count; n++ ) - { - choices[n] = m_choices[n]; - } - m_control = new wxComboBox(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, - count, choices, + m_choices, m_allowOthers ? 0 : wxCB_READONLY); - delete [] choices; - wxGridCellEditor::Create(parent, id, evtHandler); } diff --git a/src/gtk/checklst.cpp b/src/gtk/checklst.cpp index fc1aa4602a..45bc4adc20 100644 --- a/src/gtk/checklst.cpp +++ b/src/gtk/checklst.cpp @@ -48,6 +48,19 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name ); } +wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name ) +{ + m_hasCheckBoxes = TRUE; + wxListBox::Create( parent, id, pos, size, choices, + style, validator, name ); +} + bool wxCheckListBox::IsChecked( int index ) const { wxCHECK_MSG( m_list != NULL, FALSE, wxT("invalid checklistbox") ); diff --git a/src/gtk/choice.cpp b/src/gtk/choice.cpp index f437527d6c..6eef00f624 100644 --- a/src/gtk/choice.cpp +++ b/src/gtk/choice.cpp @@ -73,6 +73,18 @@ wxChoice::wxChoice() m_strings = (wxSortedArrayString *)NULL; } +bool wxChoice::Create( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + const wxArrayString& choices, + long style, const wxValidator& validator, + const wxString &name ) +{ + wxCArrayString chs(choices); + + return Create( parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name ); +} + bool wxChoice::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 6e268ed40d..e619060405 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -19,6 +19,7 @@ #if wxUSE_COMBOBOX #include "wx/settings.h" +#include "wx/arrstr.h" #include "wx/intl.h" #include "wx/textctrl.h" // for wxEVT_COMMAND_TEXT_UPDATED @@ -102,6 +103,19 @@ BEGIN_EVENT_TABLE(wxComboBox, wxControl) EVT_CHAR(wxComboBox::OnChar) END_EVENT_TABLE() +bool wxComboBox::Create( wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + long style, const wxValidator& validator, + const wxString& name ) +{ + wxCArrayString chs(choices); + + return Create( parent, id, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name ); +} + bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index a8a680a940..a4304cfe01 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -316,6 +316,18 @@ wxListBox::wxListBox() #endif // wxUSE_CHECKLISTBOX } +bool wxListBox::Create( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + const wxArrayString& choices, + long style, const wxValidator& validator, + const wxString &name ) +{ + wxCArrayString chs(choices); + + return Create( parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name ); +} + bool wxListBox::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], diff --git a/src/gtk/radiobox.cpp b/src/gtk/radiobox.cpp index 1fd590f205..7463243d03 100644 --- a/src/gtk/radiobox.cpp +++ b/src/gtk/radiobox.cpp @@ -168,6 +168,19 @@ void wxRadioBox::Init() m_lostFocus = FALSE; } +bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint &pos, const wxSize &size, + const wxArrayString& choices, int majorDim, + long style, const wxValidator& validator, + const wxString &name ) +{ + wxCArrayString chs(choices); + + return Create( parent, id, title, pos, size, chs.GetCount(), + chs.GetStrings(), majorDim, style, validator, name ); +} + bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], int majorDim, diff --git a/src/gtk1/checklst.cpp b/src/gtk1/checklst.cpp index fc1aa4602a..45bc4adc20 100644 --- a/src/gtk1/checklst.cpp +++ b/src/gtk1/checklst.cpp @@ -48,6 +48,19 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, wxListBox::Create( parent, id, pos, size, nStrings, choices, style, validator, name ); } +wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name ) +{ + m_hasCheckBoxes = TRUE; + wxListBox::Create( parent, id, pos, size, choices, + style, validator, name ); +} + bool wxCheckListBox::IsChecked( int index ) const { wxCHECK_MSG( m_list != NULL, FALSE, wxT("invalid checklistbox") ); diff --git a/src/gtk1/choice.cpp b/src/gtk1/choice.cpp index f437527d6c..6eef00f624 100644 --- a/src/gtk1/choice.cpp +++ b/src/gtk1/choice.cpp @@ -73,6 +73,18 @@ wxChoice::wxChoice() m_strings = (wxSortedArrayString *)NULL; } +bool wxChoice::Create( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + const wxArrayString& choices, + long style, const wxValidator& validator, + const wxString &name ) +{ + wxCArrayString chs(choices); + + return Create( parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name ); +} + bool wxChoice::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 6e268ed40d..e619060405 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -19,6 +19,7 @@ #if wxUSE_COMBOBOX #include "wx/settings.h" +#include "wx/arrstr.h" #include "wx/intl.h" #include "wx/textctrl.h" // for wxEVT_COMMAND_TEXT_UPDATED @@ -102,6 +103,19 @@ BEGIN_EVENT_TABLE(wxComboBox, wxControl) EVT_CHAR(wxComboBox::OnChar) END_EVENT_TABLE() +bool wxComboBox::Create( wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + long style, const wxValidator& validator, + const wxString& name ) +{ + wxCArrayString chs(choices); + + return Create( parent, id, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name ); +} + bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index a8a680a940..a4304cfe01 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -316,6 +316,18 @@ wxListBox::wxListBox() #endif // wxUSE_CHECKLISTBOX } +bool wxListBox::Create( wxWindow *parent, wxWindowID id, + const wxPoint &pos, const wxSize &size, + const wxArrayString& choices, + long style, const wxValidator& validator, + const wxString &name ) +{ + wxCArrayString chs(choices); + + return Create( parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name ); +} + bool wxListBox::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], diff --git a/src/gtk1/radiobox.cpp b/src/gtk1/radiobox.cpp index 1fd590f205..7463243d03 100644 --- a/src/gtk1/radiobox.cpp +++ b/src/gtk1/radiobox.cpp @@ -168,6 +168,19 @@ void wxRadioBox::Init() m_lostFocus = FALSE; } +bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, + const wxString& title, + const wxPoint &pos, const wxSize &size, + const wxArrayString& choices, int majorDim, + long style, const wxValidator& validator, + const wxString &name ) +{ + wxCArrayString chs(choices); + + return Create( parent, id, title, pos, size, chs.GetCount(), + chs.GetStrings(), majorDim, style, validator, name ); +} + bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, const wxPoint &pos, const wxSize &size, int n, const wxString choices[], int majorDim, diff --git a/src/mac/carbon/checklst.cpp b/src/mac/carbon/checklst.cpp index 1e88ce34f6..cb7c4a818f 100644 --- a/src/mac/carbon/checklst.cpp +++ b/src/mac/carbon/checklst.cpp @@ -22,6 +22,7 @@ #if wxUSE_CHECKLISTBOX #include "wx/checklst.h" +#include "wx/arrstr.h" #include "wx/mac/uma.h" #include "Appearance.h" @@ -172,6 +173,21 @@ void wxCheckListBox::Init() { } +bool wxCheckListBox::Create(wxWindow *parent, + wxWindowID id, + const wxPoint &pos, + const wxSize &size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString &name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, diff --git a/src/mac/carbon/choice.cpp b/src/mac/carbon/choice.cpp index 55a9268e10..a18113dbf3 100644 --- a/src/mac/carbon/choice.cpp +++ b/src/mac/carbon/choice.cpp @@ -38,6 +38,20 @@ wxChoice::~wxChoice() // DisposeMenu( m_macPopUpMenuHandle ) ; } +bool wxChoice::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxChoice::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, diff --git a/src/mac/carbon/combobox.cpp b/src/mac/carbon/combobox.cpp index 5a911361cf..27aa1a58de 100644 --- a/src/mac/carbon/combobox.cpp +++ b/src/mac/carbon/combobox.cpp @@ -256,6 +256,22 @@ void wxComboBox::DelegateChoice( const wxString& value ) } +bool wxComboBox::Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs( choices ); + + return Create( parent, id, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name ); +} + + bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, diff --git a/src/mac/carbon/listbox.cpp b/src/mac/carbon/listbox.cpp index fe39a0a19f..ea675aaf1c 100644 --- a/src/mac/carbon/listbox.cpp +++ b/src/mac/carbon/listbox.cpp @@ -193,6 +193,20 @@ wxListBox::wxListBox() static ListDefUPP macListDefUPP = NULL ; +bool wxListBox::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, diff --git a/src/mac/carbon/radiobox.cpp b/src/mac/carbon/radiobox.cpp index 9ef60f5594..103d68ca44 100644 --- a/src/mac/carbon/radiobox.cpp +++ b/src/mac/carbon/radiobox.cpp @@ -19,6 +19,7 @@ //------------------------------------------------------------------------------------- #include "wx/defs.h" +#include "wx/arrstr.h" #include "wx/radiobox.h" #include "wx/radiobut.h" @@ -93,6 +94,18 @@ wxRadioBox::~wxRadioBox() //------------------------------------------------------------------------------------- // Create the radiobox for two-step construction +bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + int majorDim, long style, + const wxValidator& val, const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, label, pos, size, chs.GetCount(), + chs.GetStrings(), majorDim, style, val, name); +} + bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], diff --git a/src/mac/checklst.cpp b/src/mac/checklst.cpp index 1e88ce34f6..cb7c4a818f 100644 --- a/src/mac/checklst.cpp +++ b/src/mac/checklst.cpp @@ -22,6 +22,7 @@ #if wxUSE_CHECKLISTBOX #include "wx/checklst.h" +#include "wx/arrstr.h" #include "wx/mac/uma.h" #include "Appearance.h" @@ -172,6 +173,21 @@ void wxCheckListBox::Init() { } +bool wxCheckListBox::Create(wxWindow *parent, + wxWindowID id, + const wxPoint &pos, + const wxSize &size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString &name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, diff --git a/src/mac/choice.cpp b/src/mac/choice.cpp index 55a9268e10..a18113dbf3 100644 --- a/src/mac/choice.cpp +++ b/src/mac/choice.cpp @@ -38,6 +38,20 @@ wxChoice::~wxChoice() // DisposeMenu( m_macPopUpMenuHandle ) ; } +bool wxChoice::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxChoice::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, diff --git a/src/mac/combobox.cpp b/src/mac/combobox.cpp index 5a911361cf..27aa1a58de 100644 --- a/src/mac/combobox.cpp +++ b/src/mac/combobox.cpp @@ -256,6 +256,22 @@ void wxComboBox::DelegateChoice( const wxString& value ) } +bool wxComboBox::Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs( choices ); + + return Create( parent, id, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name ); +} + + bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, const wxPoint& pos, diff --git a/src/mac/listbox.cpp b/src/mac/listbox.cpp index fe39a0a19f..ea675aaf1c 100644 --- a/src/mac/listbox.cpp +++ b/src/mac/listbox.cpp @@ -193,6 +193,20 @@ wxListBox::wxListBox() static ListDefUPP macListDefUPP = NULL ; +bool wxListBox::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, diff --git a/src/mac/radiobox.cpp b/src/mac/radiobox.cpp index 9ef60f5594..103d68ca44 100644 --- a/src/mac/radiobox.cpp +++ b/src/mac/radiobox.cpp @@ -19,6 +19,7 @@ //------------------------------------------------------------------------------------- #include "wx/defs.h" +#include "wx/arrstr.h" #include "wx/radiobox.h" #include "wx/radiobut.h" @@ -93,6 +94,18 @@ wxRadioBox::~wxRadioBox() //------------------------------------------------------------------------------------- // Create the radiobox for two-step construction +bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + int majorDim, long style, + const wxValidator& val, const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, label, pos, size, chs.GetCount(), + chs.GetStrings(), majorDim, style, val, name); +} + bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], diff --git a/src/motif/checklst.cpp b/src/motif/checklst.cpp index ef51031515..be02853203 100644 --- a/src/motif/checklst.cpp +++ b/src/motif/checklst.cpp @@ -75,6 +75,17 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, style, val, name); } +wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + long style, const wxValidator& val, + const wxString& name) + : wxCheckListBoxBase() +{ + Create(parent, id, pos, size, choices, + style, val, name); +} + bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, @@ -89,6 +100,20 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, return retVal; } +bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + // wxListBox::Create calls set, which adds the prefixes + bool retVal = wxListBox::Create(parent, id, pos, size, choices, + style, validator, name); + return retVal; +} + // check items // ----------- diff --git a/src/motif/choice.cpp b/src/motif/choice.cpp index 27673013fa..fbc5fdc03e 100644 --- a/src/motif/choice.cpp +++ b/src/motif/choice.cpp @@ -22,6 +22,7 @@ #include "wx/choice.h" #include "wx/utils.h" +#include "wx/arrstr.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -143,6 +144,19 @@ bool wxChoice::Create(wxWindow *parent, wxWindowID id, return TRUE; } +bool wxChoice::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + wxChoice::~wxChoice() { // For some reason destroying the menuWidget diff --git a/src/motif/combobox.cpp b/src/motif/combobox.cpp index e4ec22c7da..4389cc1f00 100644 --- a/src/motif/combobox.cpp +++ b/src/motif/combobox.cpp @@ -18,6 +18,7 @@ #if wxUSE_COMBOBOX #include "wx/combobox.h" +#include "wx/arrstr.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -93,6 +94,20 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, return TRUE; } +bool wxComboBox::Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name); +} + wxComboBox::~wxComboBox() { DetachWidget((Widget) m_mainWidget); // Removes event handlers diff --git a/src/motif/combobox_native.cpp b/src/motif/combobox_native.cpp index 9e1eec75f9..0d588f0911 100644 --- a/src/motif/combobox_native.cpp +++ b/src/motif/combobox_native.cpp @@ -14,6 +14,7 @@ #if wxUSE_COMBOBOX #include "wx/combobox.h" +#include "wx/arrstr.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -122,6 +123,20 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, return true; } +bool wxComboBox::Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name); +} + void wxComboBox::AdjustDropDownListSize() { int newListCount = -1, itemCount = GetCount(); diff --git a/src/motif/listbox.cpp b/src/motif/listbox.cpp index 9908f10c23..1ad6566347 100644 --- a/src/motif/listbox.cpp +++ b/src/motif/listbox.cpp @@ -23,6 +23,7 @@ #include "wx/dynarray.h" #include "wx/log.h" #include "wx/utils.h" +#include "wx/arrstr.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -157,6 +158,19 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id, return TRUE; } +bool wxListBox::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + wxListBox::~wxListBox() { if( HasClientObjectData() ) diff --git a/src/motif/menu.cpp b/src/motif/menu.cpp index c85dea8e74..82193e0cce 100644 --- a/src/motif/menu.cpp +++ b/src/motif/menu.cpp @@ -206,6 +206,17 @@ void wxMenuBar::Init() m_font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); } +wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxArrayString& titles) +{ + wxASSERT( size_t(n) == titles.GetCount() ); + + Init(); + + m_titles = titles; + for ( int i = 0; i < n; i++ ) + m_menus.Append(menus[i]); +} + wxMenuBar::wxMenuBar(int n, wxMenu *menus[], const wxString titles[]) { Init(); diff --git a/src/motif/radiobox.cpp b/src/motif/radiobox.cpp index 62fb7e2b3d..774c4df47c 100644 --- a/src/motif/radiobox.cpp +++ b/src/motif/radiobox.cpp @@ -21,6 +21,7 @@ #include "wx/radiobox.h" #include "wx/utils.h" +#include "wx/arrstr.h" #ifdef __VMS__ #pragma message disable nosimpint @@ -157,6 +158,16 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, return TRUE; } +bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + int majorDim, long style, + const wxValidator& val, const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, title, pos, size, chs.GetCount(), + chs.GetStrings(), majorDim, style, val, name); +} wxRadioBox::~wxRadioBox() { diff --git a/src/msw/checklst.cpp b/src/msw/checklst.cpp index 7f4c77711a..47867f2de0 100644 --- a/src/msw/checklst.cpp +++ b/src/msw/checklst.cpp @@ -345,6 +345,15 @@ wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, Create(parent, id, pos, size, nStrings, choices, style, val, name); } +wxCheckListBox::wxCheckListBox(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + long style, const wxValidator& val, + const wxString& name) +{ + Create(parent, id, pos, size, choices, style, val, name); +} + bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[], @@ -355,6 +364,16 @@ bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, style | wxLB_OWNERDRAW, validator, name); } +bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, const wxString& name) +{ + return wxListBox::Create(parent, id, pos, size, choices, + style | wxLB_OWNERDRAW, validator, name); +} + // misc overloaded methods // ----------------------- diff --git a/src/msw/choice.cpp b/src/msw/choice.cpp index 3a5919592b..220f7c8cfd 100644 --- a/src/msw/choice.cpp +++ b/src/msw/choice.cpp @@ -151,6 +151,20 @@ bool wxChoice::Create(wxWindow *parent, return TRUE; } +bool wxChoice::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + wxChoice::~wxChoice() { Free(); diff --git a/src/msw/combobox.cpp b/src/msw/combobox.cpp index f71cb41a3f..e23e1fa66e 100644 --- a/src/msw/combobox.cpp +++ b/src/msw/combobox.cpp @@ -433,6 +433,20 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, return TRUE; } +bool wxComboBox::Create(wxWindow *parent, wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name); +} + void wxComboBox::SetValue(const wxString& value) { if ( HasFlag(wxCB_READONLY) ) diff --git a/src/msw/listbox.cpp b/src/msw/listbox.cpp index 90cfac1779..1102d6f012 100644 --- a/src/msw/listbox.cpp +++ b/src/msw/listbox.cpp @@ -251,6 +251,20 @@ bool wxListBox::Create(wxWindow *parent, return TRUE; } +bool wxListBox::Create(wxWindow *parent, + wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& wxVALIDATOR_PARAM(validator), + const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + wxListBox::~wxListBox() { Free(); diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 58d056fa61..bb1b247614 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -352,6 +352,22 @@ bool wxRadioBox::Create(wxWindow *parent, return TRUE; } +bool wxRadioBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim, + long style, + const wxValidator& val, + const wxString& name) +{ + wxCArrayString chs(choices); + return Create(parent, id, title, pos, size, chs.GetCount(), + chs.GetStrings(), majorDim, style, val, name); +} + wxRadioBox::~wxRadioBox() { m_isBeingDeleted = TRUE; diff --git a/src/os2/checklst.cpp b/src/os2/checklst.cpp index ec5776444d..6c06fa391b 100644 --- a/src/os2/checklst.cpp +++ b/src/os2/checklst.cpp @@ -291,6 +291,31 @@ wxCheckListBox::wxCheckListBox ( ); } // end of wxCheckListBox::wxCheckListBox +wxCheckListBox::wxCheckListBox ( + wxWindow* pParent +, wxWindowID vId +, const wxPoint& rPos +, const wxSize& rSize +, const wxArrayString& asChoices +, long lStyle +, const wxValidator& rVal +, const wxString& rsName +) + : wxListBox() +{ + wxCArrayString chs(asChoices); + Create( pParent + ,vId + ,rPos + ,rSize + ,chs.GetCount() + ,chs.GetStrings() + ,lStyle | wxLB_OWNERDRAW + ,rVal + ,rsName + ); +} // end of wxCheckListBox::wxCheckListBox + void wxCheckListBox::Delete( int N ) diff --git a/src/os2/choice.cpp b/src/os2/choice.cpp index 6098b3afa4..b980792934 100644 --- a/src/os2/choice.cpp +++ b/src/os2/choice.cpp @@ -23,6 +23,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) +bool wxChoice::Create( + wxWindow* pParent +, wxWindowID vId +, const wxPoint& rPos +, const wxSize& rSize +, const wxArrayString& asChoices +, long lStyle +, const wxValidator& rValidator +, const wxString& rsName +) +{ + wxCArrayString chs(asChoices); + + return Create(pParent, vId, rPos, rSize, chs.GetCount(), chs.GetStrings(), + lStyle, rValidator, rsName); +} + bool wxChoice::Create( wxWindow* pParent , wxWindowID vId diff --git a/src/os2/combobox.cpp b/src/os2/combobox.cpp index 90a8241fae..a3123e6347 100644 --- a/src/os2/combobox.cpp +++ b/src/os2/combobox.cpp @@ -86,6 +86,24 @@ bool wxComboBox::OS2Command( return FALSE; } // end of wxComboBox::OS2Command +bool wxComboBox::Create( + wxWindow* pParent +, wxWindowID vId +, const wxString& rsValue +, const wxPoint& rPos +, const wxSize& rSize +, const wxArrayString& asChoices +, long lStyle +, const wxValidator& rValidator +, const wxString& rsName +) +{ + wxCArrayString chs(asChoices); + + return Create(pParent, vId, rsValue, rPos, rSize, chs.GetCount(), + chs.GetStrings(), lStyle, rValidator, rsName); +} + bool wxComboBox::Create( wxWindow* pParent , wxWindowID vId diff --git a/src/os2/listbox.cpp b/src/os2/listbox.cpp index 69ba786869..6d56ce1890 100644 --- a/src/os2/listbox.cpp +++ b/src/os2/listbox.cpp @@ -85,6 +85,23 @@ wxListBox::wxListBox() m_nSelected = 0; } // end of wxListBox::wxListBox +bool wxListBox::Create( + wxWindow* pParent +, wxWindowID vId +, const wxPoint& rPos +, const wxSize& rSize +, const wxArrayString& asChoices +, long lStyle +, const wxValidator& rValidator +, const wxString& rsName +) +{ + wxCArrayString chs(asChoices); + + return Create(pParent, vId, rPos, rSize, chs.GetCount(), chs.GetStrings(), + lStyle, rValidator, rsName); +} + bool wxListBox::Create( wxWindow* pParent , wxWindowID vId diff --git a/src/os2/radiobox.cpp b/src/os2/radiobox.cpp index b0d640ae17..94792b5217 100644 --- a/src/os2/radiobox.cpp +++ b/src/os2/radiobox.cpp @@ -253,6 +253,25 @@ bool wxRadioBox::ContainsHWND( return FALSE; } // end of wxRadioBox::ContainsHWND +bool wxRadioBox::Create( + wxWindow* pParent +, wxWindowID vId +, const wxString& rsTitle +, const wxPoint& rPos +, const wxSize& rSize +, const wxArrayString& asChoices +, int nMajorDim +, long lStyle +, const wxValidator& rVal +, const wxString& rsName +) +{ + wxCArrayString(asChoices); + + return Create(pParent, vId, rsTitle, rPos, rSize, chs.GetCount(), + chs.GetStrings(), nMajorDim, lStyle, rVal, rsName); +} + bool wxRadioBox::Create( wxWindow* pParent , wxWindowID vId diff --git a/src/univ/checklst.cpp b/src/univ/checklst.cpp index 8f3981f8c4..f527683e61 100644 --- a/src/univ/checklst.cpp +++ b/src/univ/checklst.cpp @@ -55,6 +55,35 @@ void wxCheckListBox::Init() { } +wxCheckListBox::wxCheckListBox(wxWindow *parent, + wxWindowID id, + const wxPoint &pos, + const wxSize &size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString &name) +{ + Init(); + + Create(parent, id, pos, size, choices, style, validator, name); +} + +bool wxCheckListBox::Create(wxWindow *parent, + wxWindowID id, + const wxPoint &pos, + const wxSize &size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString &name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, diff --git a/src/univ/choice.cpp b/src/univ/choice.cpp index 81925542a1..426b2b4180 100644 --- a/src/univ/choice.cpp +++ b/src/univ/choice.cpp @@ -31,6 +31,7 @@ #ifndef WX_PRECOMP #include "wx/choice.h" + #include "wx/arrstr.h" #endif IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl) @@ -39,6 +40,31 @@ BEGIN_EVENT_TABLE(wxChoice, wxComboBox) EVT_COMBOBOX(-1, wxChoice::OnComboBox) END_EVENT_TABLE() +wxChoice::wxChoice(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + Create(parent, id, pos, size, choices, style, validator, name); +} + +bool wxChoice::Create(wxWindow *parent, wxWindowID id, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxChoice::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, diff --git a/src/univ/combobox.cpp b/src/univ/combobox.cpp index a61d580100..6c3be430e5 100644 --- a/src/univ/combobox.cpp +++ b/src/univ/combobox.cpp @@ -657,6 +657,37 @@ void wxComboBox::Init() m_lbox = (wxListBox *)NULL; } +wxComboBox::wxComboBox(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + Init(); + + Create(parent, id, value, pos, size, choices, style, validator, name); +} + +bool wxComboBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& value, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, value, pos, size, chs.GetCount(), + chs.GetStrings(), style, validator, name); +} + bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, diff --git a/src/univ/listbox.cpp b/src/univ/listbox.cpp index 099d70f8e3..d05da69d53 100644 --- a/src/univ/listbox.cpp +++ b/src/univ/listbox.cpp @@ -80,6 +80,35 @@ void wxListBox::Init() m_showScrollbarY = FALSE; } +wxListBox::wxListBox(wxWindow *parent, + wxWindowID id, + const wxPoint &pos, + const wxSize &size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString &name) +{ + Init(); + + Create(parent, id, pos, size, choices, style, validator, name); +} + +bool wxListBox::Create(wxWindow *parent, + wxWindowID id, + const wxPoint &pos, + const wxSize &size, + const wxArrayString& choices, + long style, + const wxValidator& validator, + const wxString &name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, pos, size, chs.GetCount(), chs.GetStrings(), + style, validator, name); +} + bool wxListBox::Create(wxWindow *parent, wxWindowID id, const wxPoint &pos, diff --git a/src/univ/radiobox.cpp b/src/univ/radiobox.cpp index c758abf74b..621fde6d6f 100644 --- a/src/univ/radiobox.cpp +++ b/src/univ/radiobox.cpp @@ -34,6 +34,7 @@ #include "wx/radiobox.h" #include "wx/radiobut.h" #include "wx/validate.h" + #include "wx/arrstr.h" #endif #include "wx/tooltip.h" @@ -101,6 +102,37 @@ void wxRadioBox::Init() m_majorDim = 0; } +wxRadioBox::wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, + const wxArrayString& choices, + int majorDim, long style, + const wxValidator& val, const wxString& name) +{ + wxCArrayString chs(choices); + + Init(); + + (void)Create(parent, id, title, pos, size, chs.GetCount(), + chs.GetStrings(), majorDim, style, val, name); +} + +bool wxRadioBox::Create(wxWindow *parent, + wxWindowID id, + const wxString& title, + const wxPoint& pos, + const wxSize& size, + const wxArrayString& choices, + int majorDim, + long style, + const wxValidator& val, + const wxString& name) +{ + wxCArrayString chs(choices); + + return Create(parent, id, title, pos, size, chs.GetCount(), + chs.GetStrings(), majorDim, style, val, name); +} + bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, -- 2.47.2