Take void** client data in wxSingleChoiceDialog ctor and not char**.
The client data is supposed to be untyped, there is really no reason (other than compatibility with C conventions of 40 years ago) to use char** here. So don't do it and provide the versions taking "void**" keeping "char**" ones for backwards compatibility only. Also deprecate GetSelectionClientData() that returned char* and add a new GetSelectionData() returning void* instead. Closes #13876. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -106,39 +106,112 @@ public:
|
||||
const wxString& caption,
|
||||
int n,
|
||||
const wxString *choices,
|
||||
char **clientData = (char **)NULL,
|
||||
void **clientData = NULL,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
const wxPoint& pos = wxDefaultPosition)
|
||||
{
|
||||
Create(parent, message, caption, n, choices, clientData, style, pos);
|
||||
}
|
||||
|
||||
wxSingleChoiceDialog(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
const wxArrayString& choices,
|
||||
char **clientData = (char **)NULL,
|
||||
void **clientData = NULL,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
const wxPoint& pos = wxDefaultPosition)
|
||||
{
|
||||
Create(parent, message, caption, choices, clientData, style, pos);
|
||||
}
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
int n,
|
||||
const wxString *choices,
|
||||
char **clientData = (char **)NULL,
|
||||
void **clientData = 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,
|
||||
void **clientData = NULL,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition);
|
||||
|
||||
void SetSelection(int sel);
|
||||
int GetSelection() const { return m_selection; }
|
||||
wxString GetStringSelection() const { return m_stringSelection; }
|
||||
void* GetSelectionData() { return m_clientData; }
|
||||
|
||||
// obsolete function (NB: no need to make it return wxChar, it's untyped)
|
||||
char *GetSelectionClientData() const { return (char *)m_clientData; }
|
||||
#if WXWIN_COMPATIBILITY_2_8
|
||||
// Deprecated overloads taking "char**" client data.
|
||||
wxDEPRECATED_CONSTRUCTOR
|
||||
(
|
||||
wxSingleChoiceDialog(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
int n,
|
||||
const wxString *choices,
|
||||
char **clientData,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition)
|
||||
)
|
||||
{
|
||||
Create(parent, message, caption, n, choices,
|
||||
(void**)clientData, style, pos);
|
||||
}
|
||||
|
||||
wxDEPRECATED_CONSTRUCTOR
|
||||
(
|
||||
wxSingleChoiceDialog(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
const wxArrayString& choices,
|
||||
char **clientData,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition)
|
||||
)
|
||||
{
|
||||
Create(parent, message, caption, choices,
|
||||
(void**)clientData, style, pos);
|
||||
}
|
||||
|
||||
wxDEPRECATED_INLINE
|
||||
(
|
||||
bool Create(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
int n,
|
||||
const wxString *choices,
|
||||
char **clientData,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition),
|
||||
return Create(parent, message, caption, n, choices,
|
||||
(void**)clientData, style, pos);
|
||||
)
|
||||
|
||||
wxDEPRECATED_INLINE
|
||||
(
|
||||
bool Create(wxWindow *parent,
|
||||
const wxString& message,
|
||||
const wxString& caption,
|
||||
const wxArrayString& choices,
|
||||
char **clientData,
|
||||
long style = wxCHOICEDLG_STYLE,
|
||||
const wxPoint& pos = wxDefaultPosition),
|
||||
return Create(parent, message, caption, choices,
|
||||
(void**)clientData, style, pos);
|
||||
)
|
||||
|
||||
// NB: no need to make it return wxChar, it's untyped
|
||||
wxDEPRECATED_ACCESSOR
|
||||
(
|
||||
char* GetSelectionClientData(),
|
||||
(char*)GetClientData()
|
||||
)
|
||||
#endif // WXWIN_COMPATIBILITY_2_8
|
||||
|
||||
// implementation from now on
|
||||
void OnOK(wxCommandEvent& event);
|
||||
|
Reference in New Issue
Block a user