Check for the length of the buffer to determine whether the conversion failed
instead of checking whether it's NULL because this is currently never the case
because of the code in wxString::AsCharBuf() which returns "" and not NULL in
case of conversion failure.
This at least eliminates silent data loss when saving data that can't be
converted to the current locale encoding.
Closes#16348.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76798 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
We already have the length of the string, either in the buffer if we actually
converted the string from Unicode to multi-byte, or in the string itself in
non-Unicode build.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76797 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This doesn't work if the global C++ locale had been changed and we can't call
imbue(locale::classic()) to ensure that the stream we use here uses the C
locale because imbue() is hopelessly broken in some implementations.
So just get rid of this code and keep only the hack replacing the decimal
separator with the dot explicitly. This is ugly but should always work in
practice and is also consistent with ToCDouble().
Closes#16343.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76796 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Ensure that the owner-drawn toggle buttons are drawn in the pressed state when
they are pressed, even if they are also selected or under mouse.
Closes#11665.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76794 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Don't use "size" variable unnecessarily under non-Mac platforms, this also
fixes a warning about reassigning it immediately after assigning a previous
values to it under Mac.
Closes#16353.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76789 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Fix warnings appearing when building with --disable-debug under Unix by
either referencing the parameters or variables which become unused then,
because wxLogTrace() calls are compiled out, or by not compiling the code
whose only purpose is to call wxLogTrace() at all.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76786 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Back in #8101 I made fixes for wxStaticBox and right-to-left handling under Windows.
While this worked fine in wx2.8, the old patch has some unfortunate consequences on wx3:
* Since the box is always set to LTR, its children also inherit LTR
* Text was always right-aligned
This follow-up patch removes the RTL-specific code from wxStaticBox. Instead, the wxMemoryDC in wxStaticBox::OnPaint is made to inherit attributes from the wxPaintDC.
Tested on XP (both XP and classic theme), Windows 7 and 8.1
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76783 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Don't call SetBitmap from GetHBitmapForMenu but instead handle possibly
needed bitmap modifications earlier on during SetBitmap. Allows for
GetHBitmapForMenu to be const and gets rid of the clumsy re-entry check
introduced in r76754.
Also check the bitmap for alpha presence instead of needlessly converting
the bitmap to an image and checking the latter for alpha.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76781 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Add argument to a call to GetHBitmapForMenu, which doesn't have a default
parameter any more. Fixes (this part of) WinCE compilation. Broken since
r76760.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76780 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
WM_COMMAND is delivered after WM_UNINITMENUPOPUP and clearing
wxCurrentPopupMenu in the latter's handler broke delivery of the command
event to the wxTextCtrl control.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76773 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
MinGW headers declare the IRichEditOleCallback interface and the
corresponding IID, but the libraries don't contain the latter symbol.
Work around it by defining it ourselves.
Fixes#16340.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76771 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Update bakefile configuration to include x64 configurations into MSVS 2005 and
2008 projects (2003 doesn't support building in 64 bits, 2010 and later are
manually maintained and already have them) and rebake the projects.
Closes#13675.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76768 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Merge wxMenuItem::GetHBitmapForMenuCheckable and ::DoGetHBitmapForMenu
into wxMenuItem::GetHBitmapForMenu. Change its boolean parameter to an
enum specifying the kind of bitmap that is wanted (normal, checked, or
unchecked).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76760 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Replace a few __WXMSW__ tests with __WINDOWS__ as the former is not
defined any longer (since r73290) when compiling with wxUSE_GUI set to 0.
Tested changes with both wxGTK and wxMSW builds under Cygwin.
Closes#14382.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76759 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Since r76202 InsertMenuItem is used when adding checkable menu items even
without a bitmap. The call fails because hbmpChecked and hbmpUnchecked are
set to HBMMENU_CALLBACK on pre-Vista, making the menu owner drawn
unnecessarily.
Fix by adding GetHBitmapForMenuCheckable which is used when assigning
values to hbmpChecked and hbmpUnchecked. GetHBitmapForMenu remains
unchanged (for possible porting reasons) and is used for hBmpItem only.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Since r44192 a checkable menu item with bitmap on pre-Vista assigns
HBMMENU_CALLBACK to hbmpChecked and hbmpUnchecked members of MENUITEMINFO.
However this value is only valid for hbmpItem and for other bitmaps
InsertMenuItem will fail (with "the parameter is incorrect") resulting in
making the menu owner drawn later.
Instead check earlier on in MSWMustUseOwnerDrawn if we're dealing with a
checkable menu item with a bitmap and if so make it owner drawn
explicitly.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
After removing an item from a menu that item's parent menu is set to NULL
and can't be used any longer to insert the item again. Fix by remembering
the parent menu before removing the item from it.
Regression since r76251 (this commit is a partial revert of that commit).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Calling a menu item's SetBitmap can result in a stack overflow. This
occurs when setting a bitmap after the menu item has already been added to
the menu and while running under Vista (and later). Under those
circumstances [Do]SetBitmap will call GetHBitmapForMenu which itself calls
SetBitmap again.
Fix by adding a simple check for re-entry.
Regression since r76202.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76754 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Add "dictionary sort" callbacks and document them and the already existing
wxStringSortAscending() and wxStringSortDescending().
See #16330.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76753 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Even if this code is not used, it was still wrong as it didn't initialize the
(shadowed) member variables, so fix it to actually do it.
Closes#16342.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76747 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Rely on the already properly defined wx types instead of using INTNN which
could clash with the system headers (e.g. INT32 is already defined in some
Motif headers) and are not guaranteed to be always defined correctly (while
int is always 32 bit on all currently supported platforms, this is not
guaranteed to always remain the case).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76745 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
FindChildItem gets passed the id of a menu item as returned by GetMSWId, however GetMSWId should be used in combination with Win32 API functions. Instead use GetId: this fixes finding menu items that have a negative id (as a result of using wxID_ANY as id) or have a sub menu.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This file was last (really) updated in 2003 and, unsurprisingly, information
in it is not relevant 10+ years later and most of URLs in it simply don't
exist any more (or exist but are no longer used, such as freshmeat.net, since
yesterday).
Any additional places to announce wxWidgets releases should be added to the
"Announcement" section of docs/contributing/how-to-release.md now.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
In wxMSW, use IRichEditOleCallback::GetContextMenu() to provide our
default context menu for rich text controls, instead of using
EVT_CONTEXT_MENU.
The latter completely overrides native control's handling and in
particular breaks Windows 8's builtin spellchecking support.
Fall back to the previous non-OLE code for older richtext versions.
Also make the new MSWCreateContextMenu() method virtual so that the
context menu can be customized.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76723 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775