1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-12 13:44:56 +02:00

* modules/gui/wxwindows/*: enable popup menu support in the "dialogs provider".

This commit is contained in:
Gildas Bazin 2003-07-17 18:58:23 +00:00
parent 035792d566
commit 5a90c35825
6 changed files with 52 additions and 9 deletions

View File

@ -4,7 +4,7 @@
* interface, such as message output. * interface, such as message output.
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: vlc_interface.h,v 1.2 2003/07/17 17:30:40 gbazin Exp $ * $Id: vlc_interface.h,v 1.3 2003/07/17 18:58:23 gbazin Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* *
@ -91,3 +91,5 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
#define INTF_DIALOG_MESSAGES 11 #define INTF_DIALOG_MESSAGES 11
#define INTF_DIALOG_FILEINFO 12 #define INTF_DIALOG_FILEINFO 12
#define INTF_DIALOG_PREFS 13 #define INTF_DIALOG_PREFS 13
#define INTF_DIALOG_POPUPMENU 20

View File

@ -2,7 +2,7 @@
* dialogs.cpp: Handles all the different dialog boxes we provide. * dialogs.cpp: Handles all the different dialog boxes we provide.
***************************************************************************** *****************************************************************************
* Copyright (C) 2003 VideoLAN * Copyright (C) 2003 VideoLAN
* $Id: dialogs.cpp,v 1.10 2003/07/17 17:30:40 gbazin Exp $ * $Id: dialogs.cpp,v 1.11 2003/07/17 18:58:23 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
@ -74,6 +74,17 @@ Dialogs::Dialogs( intf_thread_t *_p_intf )
/* Initialize dialogs provider /* Initialize dialogs provider
* (returns as soon as initialization is done) */ * (returns as soon as initialization is done) */
if( p_provider->pf_run ) p_provider->pf_run( p_provider ); if( p_provider->pf_run ) p_provider->pf_run( p_provider );
/* Register callback for the intf-popupmenu variable */
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if( p_playlist != NULL )
{
var_AddCallback( p_playlist, "intf-popupmenu", PopupMenuCB,
p_intf->p_sys->p_dialogs );
vlc_object_release( p_playlist );
}
} }
Dialogs::~Dialogs() Dialogs::~Dialogs()
@ -122,6 +133,8 @@ void Dialogs::ShowFileInfo()
void Dialogs::ShowPopup() void Dialogs::ShowPopup()
{ {
if( p_provider && p_provider->pf_show_dialog )
p_provider->pf_show_dialog( p_provider, INTF_DIALOG_POPUPMENU, 0 );
} }
/***************************************************************************** /*****************************************************************************

View File

@ -2,7 +2,7 @@
* dialogs.cpp : wxWindows plugin for vlc * dialogs.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: dialogs.cpp,v 1.1 2003/07/17 17:30:40 gbazin Exp $ * $Id: dialogs.cpp,v 1.2 2003/07/17 18:58:23 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
@ -72,7 +72,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
DialogsProvider::OnPreferences) DialogsProvider::OnPreferences)
EVT_COMMAND(INTF_DIALOG_FILEINFO, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_FILEINFO, wxEVT_DIALOG,
DialogsProvider::OnFileInfo) DialogsProvider::OnFileInfo)
//EVT_COMMAND(ShowPopup_Event, wxEVT_DIALOG, DialogsProvider::OnShowPopup) EVT_COMMAND(INTF_DIALOG_POPUPMENU, wxEVT_DIALOG,
DialogsProvider::OnPopupMenu)
END_EVENT_TABLE() END_EVENT_TABLE()
/***************************************************************************** /*****************************************************************************
@ -95,6 +96,9 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
/* Create the messages dialog so it can begin storing logs */ /* Create the messages dialog so it can begin storing logs */
p_messages_dialog = new Messages( p_intf, p_parent ? p_parent : this ); p_messages_dialog = new Messages( p_intf, p_parent ? p_parent : this );
/* Intercept all menu events in our custom event handler */
PushEventHandler( new MenuEvtHandler( p_intf, NULL ) );
} }
DialogsProvider::~DialogsProvider() DialogsProvider::~DialogsProvider()
@ -237,3 +241,17 @@ void DialogsProvider::Open( int i_access_method, int i_arg )
p_open_dialog->Show( i_access_method, i_arg ); p_open_dialog->Show( i_access_method, i_arg );
} }
} }
void DialogsProvider::OnPopupMenu( wxCommandEvent& event )
{
wxPoint mousepos = wxGetMousePosition();
#if 0
wxMouseEvent event = wxMouseEvent( wxEVT_RIGHT_UP );
event.m_x = p_main_interface->ScreenToClient(mousepos).x;
event.m_y = p_main_interface->ScreenToClient(mousepos).y;
#endif
::PopupMenu( p_intf, this, mousepos );
}

View File

@ -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.46 2003/07/17 17:30:40 gbazin Exp $ * $Id: interface.cpp,v 1.47 2003/07/17 18:58:23 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
@ -539,12 +539,16 @@ void Interface::OnMenuOpen(wxMenuEvent& event)
#if defined( __WXMSW__ ) || defined( __WXMAC__ ) #if defined( __WXMSW__ ) || defined( __WXMAC__ )
void Interface::OnContextMenu2(wxContextMenuEvent& event) void Interface::OnContextMenu2(wxContextMenuEvent& event)
{ {
::PopupMenu( p_intf, this, ScreenToClient(event.GetPosition()) ); if( p_intf->p_sys->pf_show_dialog )
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0 );
//::PopupMenu( p_intf, this, ScreenToClient(event.GetPosition()) );
} }
#endif #endif
void Interface::OnContextMenu(wxMouseEvent& event) void Interface::OnContextMenu(wxMouseEvent& event)
{ {
::PopupMenu( p_intf, this, event.GetPosition() ); if( p_intf->p_sys->pf_show_dialog )
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0 );
//::PopupMenu( p_intf, this, event.GetPosition() );
} }
void Interface::OnExit( wxCommandEvent& WXUNUSED(event) ) void Interface::OnExit( wxCommandEvent& WXUNUSED(event) )

View File

@ -2,7 +2,7 @@
* timer.cpp : wxWindows plugin for vlc * timer.cpp : wxWindows plugin for vlc
***************************************************************************** *****************************************************************************
* Copyright (C) 2000-2001 VideoLAN * Copyright (C) 2000-2001 VideoLAN
* $Id: timer.cpp,v 1.26 2003/07/17 17:30:40 gbazin Exp $ * $Id: timer.cpp,v 1.27 2003/07/17 18:58:23 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
@ -100,6 +100,7 @@ void Timer::Notify()
/* If the "display popup" flag has changed */ /* If the "display popup" flag has changed */
if( p_intf->p_sys->b_popup_change ) if( p_intf->p_sys->b_popup_change )
{ {
#if 0
wxPoint mousepos = wxGetMousePosition(); wxPoint mousepos = wxGetMousePosition();
wxMouseEvent event = wxMouseEvent( wxEVT_RIGHT_UP ); wxMouseEvent event = wxMouseEvent( wxEVT_RIGHT_UP );
@ -107,6 +108,9 @@ void Timer::Notify()
event.m_y = p_main_interface->ScreenToClient(mousepos).y; event.m_y = p_main_interface->ScreenToClient(mousepos).y;
p_main_interface->AddPendingEvent(event); p_main_interface->AddPendingEvent(event);
#endif
if( p_intf->p_sys->pf_show_dialog )
p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU, 0 );
p_intf->p_sys->b_popup_change = VLC_FALSE; p_intf->p_sys->b_popup_change = VLC_FALSE;
} }

View File

@ -2,7 +2,7 @@
* wxwindows.h: private wxWindows interface description * wxwindows.h: private wxWindows interface description
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: wxwindows.h,v 1.43 2003/07/17 17:30:40 gbazin Exp $ * $Id: wxwindows.h,v 1.44 2003/07/17 18:58:23 gbazin Exp $
* *
* Authors: Gildas Bazin <gbazin@netcourrier.com> * Authors: Gildas Bazin <gbazin@netcourrier.com>
* *
@ -203,6 +203,8 @@ private:
void OnOpenNet( wxCommandEvent& event ); void OnOpenNet( wxCommandEvent& event );
void OnOpenSat( wxCommandEvent& event ); void OnOpenSat( wxCommandEvent& event );
void OnPopupMenu( wxCommandEvent& event );
void OnIdle( wxIdleEvent& event ); void OnIdle( wxIdleEvent& event );
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();