wxGTK wxMenuBar used its own SetInvokingWindow/UnsetInvokingWindow() and
related functions instead of reusing the base class Attach/Detach() which
exist for exactly the same purpose. This resulted in unnecessary code
duplication and confusion and, since the changes of r64104, resulted in
asserts due to use of SetInvokingWindow() for non-popup menus.
Fix this by removing the wxGTK-specific functions and doing the work they used
to do in (now overridden) Attach() and Detach(). Also call Attach/Detach()
instead of these functions from wxGTK wxFrame and wxMDIParentFrame code.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64127 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This simplifies the code as we don't need to walk the menu hierarchy upwards
any more (GetInvokingWindow() does it now) and also makes it work for all
menus, not just the popup ones.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64126 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Reuse the existing DoCommonMenuCallbackCode() function instead of duplicating
its code in menuitem_select() and menuitem_deselect() GTK callbacks.
No changes in behaviour.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64125 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
GetInvokingWindow() can only be used for the popup menus which have the
invoking window, so add a new function which can be used to get the window
associated with any kind of menu in all ports -- it already existed in wxMSW
but is needed elsewhere too.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64123 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
To make the code more manageable, intl.h now contains wxLocale and
translation.h all translations-related stuff (wxTranslations, _() etc.).
Code generated by genlang.py was moved into its own files (language.h,
languageinfo.cpp).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64118 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxTranslations is for handling gettext translations. wxLocale manages
locale and provides compatiblity API for translations. Separating these
two loosely related tasks makes it possible to use translations into
languages not known by Windows or using localized GUI without all the
locales compilations.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64117 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The client size of maximized windows which hadn't been shown yet isn't
computed correctly by wxMSW because WM_NCCALCSIZE returns too small values for
some reason. Attempts to fix this were unsuccessful so just ensure that the
window is re-laid out using the right size from WM_SIZE it receives when it is
shown instead of using the wrong pending size.
Closes#11762.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64115 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
gcc complained about possibly uninitialized variable in QueueTestCase in
optimized build, just initialize it to suppress this warning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64112 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The variable "mode" is not filled by TranslateRasterOp() function if the input
function is not supported, so don't compare it with wxCOMPOSITION_XOR later.
Just compare "function" itself with wxXOR as this works in any case.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64111 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
We incremented the index once more even after finding the line we were looking
for in the array which meant that we accessed a wrong array element in any
case and could even attempt to access an out of bound one if the file was
found in the last line.
Closes#11964.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
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
No real changes, just use wxID_NONE instead of hardcoded -1 (in one place) and
-3 (in another one). Hardcoding them not only made the code less readable but
also resulted in two numbers actually becoming different when they almost
certainly were meant to be the same.
This shouldn't result in any changes in the user-visible behaviour but we now
avoid searching the menu bar for menu items with id of -1 needlessly.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64103 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxMSW code implicitly cast ids carried by wxEVT_MENU_HIGHLIGHT events to
unsigned short so that they didn't compare equal to the (signed, negative) ids
of the real menu items. Because of this menu help strings were not shown for
any items with negative ids, i.e. those created using wxID_ANY.
Closes#11977.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64102 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
In Unicode build, there's no need to create wxCSConv object for every
loaded catalog when it won't be used for anything.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
The extra +4 in IsLessThanStdSize() functions resulted in assert failures
under Windows XP after the ownerdraw drawing changes so remove it as nobody
knew why was it there anyhow.
Also replace IsLessThanStdSize() with IsGreaterThanStdSize() to allow using it
directly instead of always testing for !IsLessThanStdSize().
See #11657.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64088 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
It doesn't make sense to add a menu with empty title to the menu bar so assert
that the title is not empty and fail to add the menu if it is.
See r64033 in wxQT branch.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775