Changed wxGetSingleChoiceData() to take void* client data pointers instead
of char* git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4167 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -111,15 +111,14 @@ WXDLLEXPORT int wxGetSingleChoiceIndex(const wxString& message, const wxString&
|
|||||||
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
||||||
|
|
||||||
// Return client data instead
|
// Return client data instead
|
||||||
// FIXME: this is horrible, using "char *" instead of "void *" belongs to the 70s!
|
WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, const wxString& caption,
|
||||||
WXDLLEXPORT wxChar* wxGetSingleChoiceData(const wxString& message, const wxString& caption,
|
int n, const wxString *choices, void **client_data,
|
||||||
int n, const wxString *choices, char **client_data,
|
|
||||||
wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1,
|
wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1,
|
||||||
bool centre = TRUE,
|
bool centre = TRUE,
|
||||||
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
||||||
|
|
||||||
WXDLLEXPORT wxChar* wxGetSingleChoiceData(const wxString& message, const wxString& caption,
|
WXDLLEXPORT void* wxGetSingleChoiceData(const wxString& message, const wxString& caption,
|
||||||
int n, wxChar *choices[], char **client_data,
|
int n, wxChar *choices[], void **client_data,
|
||||||
wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1,
|
wxWindow *parent = (wxWindow *) NULL, int x = -1, int y = -1,
|
||||||
bool centre = TRUE,
|
bool centre = TRUE,
|
||||||
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
int width = wxCHOICE_WIDTH, int height = wxCHOICE_HEIGHT);
|
||||||
|
@@ -103,7 +103,7 @@ static inline wxString FindExtension(const wxChar *path);
|
|||||||
// local constants
|
// local constants
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
static const char *s_MRUEntryFormat = wxT("&%d %s");
|
static const wxChar *s_MRUEntryFormat = wxT("&%d %s");
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// implementation
|
// implementation
|
||||||
@@ -1309,7 +1309,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates,
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document template"), _("Templates"), n,
|
wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document template"), _("Templates"), n,
|
||||||
strings, (char **)data);
|
strings, (void **)data);
|
||||||
delete[] strings;
|
delete[] strings;
|
||||||
delete[] data;
|
delete[] data;
|
||||||
return theTemplate;
|
return theTemplate;
|
||||||
@@ -1332,7 +1332,7 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document view"), _("Views"), n,
|
wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document view"), _("Views"), n,
|
||||||
strings, (char **)data);
|
strings, (void **)data);
|
||||||
delete[] strings;
|
delete[] strings;
|
||||||
delete[] data;
|
delete[] data;
|
||||||
return theTemplate;
|
return theTemplate;
|
||||||
|
@@ -96,21 +96,21 @@ int wxGetSingleChoiceIndex( const wxString& message, const wxString& caption, in
|
|||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
|
void *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
|
||||||
const wxString *choices, wxChar **client_data, wxWindow *parent,
|
const wxString *choices, void **client_data, wxWindow *parent,
|
||||||
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
|
int WXUNUSED(x), int WXUNUSED(y), bool WXUNUSED(centre),
|
||||||
int WXUNUSED(width), int WXUNUSED(height) )
|
int WXUNUSED(width), int WXUNUSED(height) )
|
||||||
{
|
{
|
||||||
wxSingleChoiceDialog dialog(parent, message, caption, n, choices, (char **)client_data);
|
wxSingleChoiceDialog dialog(parent, message, caption, n, choices, (char **)client_data);
|
||||||
if ( dialog.ShowModal() == wxID_OK )
|
if ( dialog.ShowModal() == wxID_OK )
|
||||||
return (wxChar *)dialog.GetSelectionClientData();
|
return dialog.GetSelectionClientData();
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Overloaded for backward compatibility
|
// Overloaded for backward compatibility
|
||||||
wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
|
void *wxGetSingleChoiceData( const wxString& message, const wxString& caption, int n,
|
||||||
wxChar *choices[], wxChar **client_data, wxWindow *parent,
|
wxChar *choices[], void **client_data, wxWindow *parent,
|
||||||
int x, int y, bool centre,
|
int x, int y, bool centre,
|
||||||
int width, int height )
|
int width, int height )
|
||||||
{
|
{
|
||||||
@@ -120,7 +120,7 @@ wxChar *wxGetSingleChoiceData( const wxString& message, const wxString& caption,
|
|||||||
{
|
{
|
||||||
strings[i] = choices[i];
|
strings[i] = choices[i];
|
||||||
}
|
}
|
||||||
wxChar *data = wxGetSingleChoiceData(message, caption, n, (const wxString *)strings, client_data, parent,
|
void *data = wxGetSingleChoiceData(message, caption, n, (const wxString *)strings, client_data, parent,
|
||||||
x, y, centre, width, height);
|
x, y, centre, width, height);
|
||||||
delete[] strings;
|
delete[] strings;
|
||||||
return data;
|
return data;
|
||||||
|
Reference in New Issue
Block a user