SetInvokingWindow() is only called for the top menu being popped up itself but
the invoking window should also be associated with its submenus.
Modify GetInvokingWindow() to return the parents invoking window for submenus.
This fixes a crash due to returning NULL from wxMenu::GetWindow() in wxMSW
owner-drawn code.
And it also makes redundant some code in wxUniversal wxMenu implementation
which can now simply use GetInvokingWindow() in all cases.
Closes#11957.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64104 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The old code was messy because it handled both top level and child windows at
wxWindow level when they need quite different treatment. This resulted in
several errors: first, wxWindow versions of WidthDefault and HeightDefault
were used to determine the initial size even of top level windows which was
clearly wrong as it created tiny windows (20*20). Second, CW_USEDEFAULT could
be used for child window for which this shouldn't be done.
Fix this by making MSWGetCreateWindowCoords() virtual and overriding it in
wxTopLevelWindow. This makes the code much simpler and more obviously correct.
Also make MSWGetCreateWindowCoords() void, as nobody was using its return
value anyhow (and the old version also had a bug in it and wrongly returned
true when default size was passed to it).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Although the information about "Cancel" and "Skip" buttons presses is returned
from Update(), sometimes it may be more convenient to ask the dialog about
whether it was cancelled or skipped instead of storing it in the program
itself.
Add the methods which allow to check for this.
Closes#10903.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64057 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
GetParentForModalDialog() was called from the ctor initialized list before
m_windowStyle could be initialized by the base class ctor in several different
places, meaning that the check for wxDIALOG_NO_PARENT in this function was
using uninitialized variable.
Fix this by passing the style parameter explicitly to this function to allow
using it from derived class ctors. Still keep an overload which uses the
actual window parent and flags which is simpler to use for later calls to this
function.
Thanks valgrind for finding this one.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64019 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Defining wxADJUST_MINSIZE as 0 may be a simple way to make the old code to
compile and while it works without WXWIN_COMPATIBILITY_2_8 it paradoxically
doesn't work with it because this results in errors when wxADJUST_MINSIZE is
defined as 0 by wx itself.
Avoid this problem by only defining wxADJUST_MINSIZE ourselves if it hadn't
been defined yet.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64005 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This is a trivial accessor which somehow was never added before even though we
had GetToolsCount() and even DeleteToolByPos().
Closes#11120.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64004 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
__GXX_RTTI is only defined since g++ 4.3.2 and so we can't rely on its absence
as indicating the use of -fno-rtti switch with the older versions of the
compiler, only do this for g++ 4.3+.
Also define wxNO_RTTI from configure if --enable-no_rtti was used as we can't
always detect it automatically.
Closes#11955.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63995 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This doesn't affect Unicode builds, only the legacy ANSI one.
PO files are now always converted to the appropriate charset according
to current locale. This was the default behavior for long time; not
doing the conversion was always a fragile hack that didn't work well.
Removing this flag simplifies wxLocale code.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63993 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxWidgets requires wchar_t for some time now; wx/chartype.h has a check
to fail complation without it. Simplify code by removing now-dead code
for the !wxUSE_WCHAR_T case.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63991 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxWeakRef can work with forward-declared classes provided dynamic_cast<> is
available but this wasn't detected as being the case due to the use of the
obsolete HAVE_DYNAMIC_CAST in its code.
Replace HAVE_DYNAMIC_CAST with !wxNO_RTTI to fix this.
Also add a unit test checking that this does work.
Closes#11916.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63986 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
For some mysterious reason, adding non-template wxWeakRef ctor breaks VC6
build with the apparently completely unrelated errors:
include\wx/toplevel.h(223) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class wxWindow *' (or there is no acceptable conversion)
include\wx/toplevel.h(231) : error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class wxWindow *' (or there is no acceptable conversion)
src\common\dummy.cpp(27) : error C2856: #pragma hdrstop cannot be inside an #if block
Simply don't define it for VC6 to at least allow the code not using wxWeakRef
to compile.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63955 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The generic wxListCtrl didn't properly support switching between report and
non-report modes without invalidating the control contents, the required in
non report view geometry info pointers were not allocated when the control was
switched to a, say, list mode and not created in it.
Fix this by updating all list control lines when the report mode changes.
Closes#11698.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63946 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The returned value was the same as the iterator that was passed in which could
even be invalid when appending.
Fix the wrong use of postfix decrement instead of prefix one and handle the
case of appending correctly.
Closes#11808.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63943 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This allows the code to compile with VC6 which has trouble with explicit
specification of the template functions instantiation.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63940 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
These trivial helper functions are available in all builds (provided that
wxUSE_STD_STRING is not explicitly set to non-default 0 value) unlike implicit
conversions to std::[w]string which are only available when wxUSE_STL==1.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63938 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Define element_type for consistency with other classes (wxSharedPtr, weak_ptr)
and to allow accessing the type from the template code.
Also remove the apparently unnecessary template assignment operator:
assignment from an expression convertible to type T* works even without it and
while assigning something implicitly convertible to T* wouldn't work now, it's
for the best as we don't want to rely on such implicit conversions.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63933 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This makes it possible to use static build of wx from VC++ by just
including its headers. Even though it's common to have these libs in
your settings, it's not always the case.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63920 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775