Commit ef46a3ff authored by Gildas Bazin's avatar Gildas Bazin

* modules/gui/wxwindows/interface.cpp: work-around a bug in wxWindows for menus auto-generation.
parent 3a521261
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* interface.cpp : wxWindows plugin for vlc * interface.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: interface.cpp,v 1.25 2003/05/11 13:45:21 gbazin Exp $ * $Id: interface.cpp,v 1.26 2003/05/11 15:55:51 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
...@@ -414,6 +414,25 @@ void Interface::Open( int i_access_method ) ...@@ -414,6 +414,25 @@ void Interface::Open( int i_access_method )
/***************************************************************************** /*****************************************************************************
* Event Handlers. * Event Handlers.
*****************************************************************************/ *****************************************************************************/
/* Work-around helper for buggy wxGTK */
void RecursiveDestroy( wxMenu *menu )
{
wxMenuItemList::Node *node = menu->GetMenuItems().GetFirst();
for( ; node; )
{
wxMenuItem *item = node->GetData();
node = node->GetNext();
/* Delete the submenus */
wxMenu *submenu = item->GetSubMenu();
if( submenu )
{
RecursiveDestroy( submenu );
}
menu->Delete( item );
}
}
void Interface::OnMenuOpen(wxMenuEvent& event) void Interface::OnMenuOpen(wxMenuEvent& event)
{ {
#if !defined( __WXMSW__ ) #if !defined( __WXMSW__ )
...@@ -422,7 +441,13 @@ void Interface::OnMenuOpen(wxMenuEvent& event) ...@@ -422,7 +441,13 @@ void Interface::OnMenuOpen(wxMenuEvent& event)
if( b_audio_menu ) if( b_audio_menu )
{ {
p_audio_menu = AudioMenu( p_intf, this ); p_audio_menu = AudioMenu( p_intf, this );
wxMenu *menu =
/* Work-around for buggy wxGTK */
wxMenu *menu = GetMenuBar()->GetMenu( 3 );
RecursiveDestroy( menu );
/* End work-around */
menu =
GetMenuBar()->Replace( 3, p_audio_menu, wxU(_("&Audio")) ); GetMenuBar()->Replace( 3, p_audio_menu, wxU(_("&Audio")) );
if( menu ) delete menu; if( menu ) delete menu;
...@@ -435,7 +460,13 @@ void Interface::OnMenuOpen(wxMenuEvent& event) ...@@ -435,7 +460,13 @@ void Interface::OnMenuOpen(wxMenuEvent& event)
if( b_video_menu ) if( b_video_menu )
{ {
p_video_menu = VideoMenu( p_intf, this ); p_video_menu = VideoMenu( p_intf, this );
wxMenu *menu =
/* Work-around for buggy wxGTK */
wxMenu *menu = GetMenuBar()->GetMenu( 4 );
RecursiveDestroy( menu );
/* End work-around */
menu =
GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) ); GetMenuBar()->Replace( 4, p_video_menu, wxU(_("&Video")) );
if( menu ) delete menu; if( menu ) delete menu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment