From: Václav Slavík Date: Thu, 11 Jul 2013 06:58:35 +0000 (+0000) Subject: Use wxWindowID in wxNewId() and related functions. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1c6a98048b47cf1dd1926e97f94abe81a3fded1e?ds=sidebyside;hp=7e05f038b9fe89edac2ffec5d1170faa1f1aed7f Use wxWindowID in wxNewId() and related functions. wxNewId(), wxRegisterId() and wxGetCurrentId() functions all work with window IDs, so they should use the dedicated type. Previously, they worked with long, which is not even the same type (wxWindowID is int), causing implicit type conversion warnings. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74485 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/utils.h b/include/wx/utils.h index 3df820da57..edbd7de380 100644 --- a/include/wx/utils.h +++ b/include/wx/utils.h @@ -273,13 +273,13 @@ inline bool wxPlatformIs(int platform) { return wxPlatform::Is(platform); } // ---------------------------------------------------------------------------- // Ensure subsequent IDs don't clash with this one -WXDLLIMPEXP_BASE void wxRegisterId(long id); +WXDLLIMPEXP_BASE void wxRegisterId(wxWindowID id); // Return the current ID -WXDLLIMPEXP_BASE long wxGetCurrentId(); +WXDLLIMPEXP_BASE wxWindowID wxGetCurrentId(); // Generate a unique ID -WXDLLIMPEXP_BASE long wxNewId(); +WXDLLIMPEXP_BASE wxWindowID wxNewId(); // ---------------------------------------------------------------------------- // Various conversions diff --git a/interface/wx/utils.h b/interface/wx/utils.h index 34a9e15347..ad37f8030c 100644 --- a/interface/wx/utils.h +++ b/interface/wx/utils.h @@ -459,7 +459,7 @@ int wxFindMenuItemId(wxFrame* frame, const wxString& menuString, @header{wx/utils.h} */ -long wxNewId(); +wxWindowID wxNewId(); /** Ensures that Ids subsequently generated by wxNewId() do not clash with the @@ -467,7 +467,7 @@ long wxNewId(); @header{wx/utils.h} */ -void wxRegisterId(long id); +void wxRegisterId(wxWindowID id); /** Opens the @a document in the application associated with the files of this diff --git a/src/common/utilscmn.cpp b/src/common/utilscmn.cpp index f5ba00045b..5cd3d8e3c7 100644 --- a/src/common/utilscmn.cpp +++ b/src/common/utilscmn.cpp @@ -714,9 +714,9 @@ long wxExecute(const wxString& command, // ---------------------------------------------------------------------------- // Id generation -static long wxCurrentId = 100; +static wxWindowID wxCurrentId = 100; -long wxNewId() +wxWindowID wxNewId() { // skip the part of IDs space that contains hard-coded values: if (wxCurrentId == wxID_LOWEST) @@ -725,11 +725,11 @@ long wxNewId() return wxCurrentId++; } -long +wxWindowID wxGetCurrentId(void) { return wxCurrentId; } void -wxRegisterId (long id) +wxRegisterId (wxWindowID id) { if (id >= wxCurrentId) wxCurrentId = id + 1;