Merge branch 'im/menu' of https://github.com/imciner2/wxWidgets
Make wxEVT_MENU_HIGHLIGHT generation when there is no highlighted item consistent across all the major ports: use wxID_NONE instead of wxID_ANY in wxGTK and send these events, which were previously not sent at all in this case, in wxOSX. See https://github.com/wxWidgets/wxWidgets/pull/1637
This commit is contained in:
@@ -83,6 +83,10 @@ Changes in behaviour not resulting in compilation errors
|
|||||||
coordinates, e.g. returned by wxWindow::GetSize() by GetContentScaleFactor()
|
coordinates, e.g. returned by wxWindow::GetSize() by GetContentScaleFactor()
|
||||||
before using them with OpenGL functions.
|
before using them with OpenGL functions.
|
||||||
|
|
||||||
|
- wxGTK now uses wxID_NONE item ID for wxEVT_MENU_HIGHLIGHT events sent when
|
||||||
|
there is no highlighted menu item, instead of wxID_ANY used before, for
|
||||||
|
consistency with wxMSW.
|
||||||
|
|
||||||
|
|
||||||
Changes in behaviour which may result in build errors
|
Changes in behaviour which may result in build errors
|
||||||
-----------------------------------------------------
|
-----------------------------------------------------
|
||||||
|
@@ -31,8 +31,10 @@
|
|||||||
A menu has been just closed.
|
A menu has been just closed.
|
||||||
This type of event is sent as wxMenuEvent.
|
This type of event is sent as wxMenuEvent.
|
||||||
@event{EVT_MENU_HIGHLIGHT(id, func)}
|
@event{EVT_MENU_HIGHLIGHT(id, func)}
|
||||||
The menu item with the specified id has been highlighted: used to show
|
The menu item with the specified id has been highlighted. If the id is
|
||||||
help prompts in the status bar by wxFrame
|
::wxID_NONE, highlighting has been removed from the previously
|
||||||
|
highlighted menu item and there is no highlighted item any more.
|
||||||
|
This is used by wxFrame to show help prompts in the status bar.
|
||||||
This type of event is sent as wxMenuEvent.
|
This type of event is sent as wxMenuEvent.
|
||||||
@event{EVT_MENU_HIGHLIGHT_ALL(func)}
|
@event{EVT_MENU_HIGHLIGHT_ALL(func)}
|
||||||
A menu item has been highlighted, i.e. the currently selected menu item has changed.
|
A menu item has been highlighted, i.e. the currently selected menu item has changed.
|
||||||
|
@@ -575,7 +575,7 @@ static void menuitem_deselect(GtkWidget*, wxMenuItem* item)
|
|||||||
if (!item->IsEnabled())
|
if (!item->IsEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, -1, item->GetMenu());
|
wxMenuEvent event(wxEVT_MENU_HIGHLIGHT, wxID_NONE, item->GetMenu());
|
||||||
DoCommonMenuCallbackCode(item->GetMenu(), event);
|
DoCommonMenuCallbackCode(item->GetMenu(), event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -673,7 +673,7 @@ static void gtk_menu_nolight_callback( GtkWidget *widget, wxMenu *menu )
|
|||||||
if (!menu->IsEnabled(id))
|
if (!menu->IsEnabled(id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxMenuEvent event( wxEVT_MENU_HIGHLIGHT, -1, menu );
|
wxMenuEvent event( wxEVT_MENU_HIGHLIGHT, wxID_NONE, menu );
|
||||||
event.SetEventObject( menu );
|
event.SetEventObject( menu );
|
||||||
|
|
||||||
wxEvtHandler* handler = menu->GetEventHandler();
|
wxEvtHandler* handler = menu->GetEventHandler();
|
||||||
|
@@ -127,15 +127,22 @@
|
|||||||
wxMenuImpl* menuimpl = [menu implementation];
|
wxMenuImpl* menuimpl = [menu implementation];
|
||||||
if ( menuimpl )
|
if ( menuimpl )
|
||||||
{
|
{
|
||||||
|
wxMenuItem* menuitem = nullptr;
|
||||||
wxMenu* wxpeer = (wxMenu*) menuimpl->GetWXPeer();
|
wxMenu* wxpeer = (wxMenu*) menuimpl->GetWXPeer();
|
||||||
|
|
||||||
if ( [ item isKindOfClass:[wxNSMenuItem class] ] )
|
if ( [ item isKindOfClass:[wxNSMenuItem class] ] )
|
||||||
{
|
{
|
||||||
wxMenuItemImpl* menuitemimpl = (wxMenuItemImpl*) [ (wxNSMenuItem*) item implementation ];
|
wxMenuItemImpl* menuitemimpl = (wxMenuItemImpl*) [ (wxNSMenuItem*) item implementation ];
|
||||||
if ( wxpeer && menuitemimpl )
|
if ( menuitemimpl )
|
||||||
{
|
{
|
||||||
wxpeer->HandleMenuItemHighlighted( menuitemimpl->GetWXPeer() );
|
menuitem = menuitemimpl->GetWXPeer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( wxpeer )
|
||||||
|
{
|
||||||
|
wxpeer->HandleMenuItemHighlighted( menuitem );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -379,7 +379,7 @@ bool wxMenu::HandleCommandProcess( wxMenuItem* item, wxWindow* senderWindow )
|
|||||||
|
|
||||||
void wxMenu::HandleMenuItemHighlighted( wxMenuItem* item )
|
void wxMenu::HandleMenuItemHighlighted( wxMenuItem* item )
|
||||||
{
|
{
|
||||||
int menuid = item ? item->GetId() : 0;
|
int menuid = item ? item->GetId() : wxID_NONE;
|
||||||
wxMenuEvent wxevent(wxEVT_MENU_HIGHLIGHT, menuid, this);
|
wxMenuEvent wxevent(wxEVT_MENU_HIGHLIGHT, menuid, this);
|
||||||
ProcessMenuEvent(this, wxevent, GetWindow());
|
ProcessMenuEvent(this, wxevent, GetWindow());
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user