static void AttachToFrame( wxMenu *menu, wxWindow *win ) { wxWindow *top_frame = win; while (top_frame->GetParent() && !(top_frame->IsTopLevel())) top_frame = top_frame->GetParent(); // support for native hot keys ACCEL_OBJECT *obj = ACCEL_OBJ_CAST(top_frame->m_widget); if ( !g_slist_find( ACCEL_OBJECTS(menu->m_accel), obj ) ) gtk_accel_group_attach( menu->m_accel, obj ); wxMenuItemList::compatibility_iterator node = menu->GetMenuItems().GetFirst(); while (node) { wxMenuItem *menuitem = node->GetData(); if (menuitem->IsSubMenu()) AttachToFrame( menuitem->GetSubMenu(), win ); node = node->GetNext(); } }
void wxMenuBar::SetInvokingWindow( wxWindow *win ) { m_invokingWindow = win; wxWindow *top_frame = win; while (top_frame->GetParent() && !(top_frame->IsTopLevel())) top_frame = top_frame->GetParent(); // support for native key accelerators indicated by underscroes ACCEL_OBJECT *obj = ACCEL_OBJ_CAST(top_frame->m_widget); if ( !g_slist_find( ACCEL_OBJECTS(m_accel), obj ) ) gtk_accel_group_attach( m_accel, obj ); wxMenuList::compatibility_iterator node = m_menus.GetFirst(); while (node) { wxMenu *menu = node->GetData(); wxMenubarSetInvokingWindow( menu, win ); node = node->GetNext(); } }