1 /*****************************************************************************
2 * menus.cpp : wxWindows plugin for vlc
3 *****************************************************************************
4 * Copyright (C) 2000-2004 VideoLAN
7 * Authors: Gildas Bazin <gbazin@netcourrier.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
22 *****************************************************************************/
24 /*****************************************************************************
26 *****************************************************************************/
27 #include <stdlib.h> /* malloc(), free() */
28 #include <errno.h> /* ENOMEM */
29 #include <string.h> /* strerror() */
35 #include "wxwindows.h"
37 class wxMenuItemExt: public wxMenuItem
41 wxMenuItemExt( wxMenu* parentMenu, int id, const wxString& text,
42 const wxString& helpString, wxItemKind kind,
43 char *_psz_var, int _i_object_id, vlc_value_t _val,
46 virtual ~wxMenuItemExt();
57 /*****************************************************************************
59 *****************************************************************************/
61 /* IDs for the controls and the menu commands */
65 MenuDummy_Event = wxID_HIGHEST + 1000,
66 OpenFileSimple_Event = wxID_HIGHEST + 1100,
70 FirstAutoGenerated_Event = wxID_HIGHEST + 1999,
71 SettingsMenu_Events = wxID_HIGHEST + 5000,
72 AudioMenu_Events = wxID_HIGHEST + 2000,
73 VideoMenu_Events = wxID_HIGHEST + 3000,
74 NavigMenu_Events = wxID_HIGHEST + 4000,
75 PopupMenu_Events = wxID_HIGHEST + 6000
78 BEGIN_EVENT_TABLE(Menu, wxMenu)
81 BEGIN_EVENT_TABLE(MenuEvtHandler, wxEvtHandler)
82 EVT_MENU(OpenFileSimple_Event, MenuEvtHandler::OnShowDialog)
83 EVT_MENU(OpenFile_Event, MenuEvtHandler::OnShowDialog)
84 EVT_MENU(OpenDisc_Event, MenuEvtHandler::OnShowDialog)
85 EVT_MENU(OpenNet_Event, MenuEvtHandler::OnShowDialog)
86 EVT_MENU(-1, MenuEvtHandler::OnMenuEvent)
89 wxMenu *OpenStreamMenu( intf_thread_t *p_intf )
91 wxMenu *menu = new wxMenu;
92 menu->Append( OpenFileSimple_Event, wxU(_("Quick &Open File...")) );
93 menu->Append( OpenFile_Event, wxU(_("Open &File...")) );
94 menu->Append( OpenDisc_Event, wxU(_("Open &Disc...")) );
95 menu->Append( OpenNet_Event, wxU(_("Open &Network Stream...")) );
99 void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
102 #define MAX_POPUP_ITEMS 35
104 vlc_object_t *p_object;
105 char *ppsz_varnames[MAX_POPUP_ITEMS];
106 int pi_objects[MAX_POPUP_ITEMS];
109 /* Initializations */
110 memset( pi_objects, 0, MAX_POPUP_ITEMS * sizeof(int) );
113 ppsz_varnames[i++] = _("Audio menu");
114 ppsz_varnames[i++] = NULL; /* Separator */
116 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
118 if( p_object != NULL )
120 ppsz_varnames[i] = "audio-device";
121 pi_objects[i++] = p_object->i_object_id;
122 ppsz_varnames[i] = "audio-channels";
123 pi_objects[i++] = p_object->i_object_id;
124 ppsz_varnames[i] = "visual";
125 pi_objects[i++] = p_object->i_object_id;
126 vlc_object_release( p_object );
130 ppsz_varnames[i++] = NULL; /* Separator */
131 ppsz_varnames[i++] = _("Video menu");
132 ppsz_varnames[i++] = NULL; /* Separator */
134 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
136 if( p_object != NULL )
138 vlc_object_t *p_dec_obj;
140 ppsz_varnames[i] = "fullscreen";
141 pi_objects[i++] = p_object->i_object_id;
142 ppsz_varnames[i] = "zoom";
143 pi_objects[i++] = p_object->i_object_id;
144 ppsz_varnames[i] = "deinterlace";
145 pi_objects[i++] = p_object->i_object_id;
146 ppsz_varnames[i] = "aspect-ratio";
147 pi_objects[i++] = p_object->i_object_id;
148 ppsz_varnames[i] = "crop";
149 pi_objects[i++] = p_object->i_object_id;
150 ppsz_varnames[i] = "video-on-top";
151 pi_objects[i++] = p_object->i_object_id;
153 p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
156 if( p_dec_obj != NULL )
158 ppsz_varnames[i] = "ffmpeg-pp-q";
159 pi_objects[i++] = p_dec_obj->i_object_id;
160 vlc_object_release( p_dec_obj );
163 vlc_object_release( p_object );
167 ppsz_varnames[i++] = NULL; /* Separator */
168 ppsz_varnames[i++] = _("Input menu");
169 ppsz_varnames[i++] = NULL; /* Separator */
171 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
173 if( p_object != NULL )
175 ppsz_varnames[i] = "bookmark";
176 pi_objects[i++] = p_object->i_object_id;
177 ppsz_varnames[i] = "title";
178 pi_objects[i++] = p_object->i_object_id;
179 ppsz_varnames[i] = "chapter";
180 pi_objects[i++] = p_object->i_object_id;
181 ppsz_varnames[i] = "program";
182 pi_objects[i++] = p_object->i_object_id;
183 ppsz_varnames[i] = "navigation";
184 pi_objects[i++] = p_object->i_object_id;
185 ppsz_varnames[i] = "dvd_menus";
186 pi_objects[i++] = p_object->i_object_id;
188 ppsz_varnames[i] = "video-es";
189 pi_objects[i++] = p_object->i_object_id;
190 ppsz_varnames[i] = "audio-es";
191 pi_objects[i++] = p_object->i_object_id;
192 ppsz_varnames[i] = "spu-es";
193 pi_objects[i++] = p_object->i_object_id;
195 vlc_object_release( p_object );
199 ppsz_varnames[i++] = NULL; /* Separator */
200 ppsz_varnames[i++] = _("Interface menu");
201 ppsz_varnames[i++] = NULL; /* Separator */
203 /* vlc_object_find is needed because of the dialogs provider case */
204 p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INTF,
206 if( p_object != NULL )
208 ppsz_varnames[i] = "intf-switch";
209 pi_objects[i++] = p_object->i_object_id;
210 ppsz_varnames[i] = "intf-add";
211 pi_objects[i++] = p_object->i_object_id;
213 vlc_object_release( p_object );
217 Menu popupmenu( p_intf, p_parent, i,
218 ppsz_varnames, pi_objects, PopupMenu_Events );
221 /* Add static entries */
222 popupmenu.AppendSeparator();
223 popupmenu.Append( MenuDummy_Event, wxU("Open..."),
224 OpenStreamMenu( p_intf ), wxT("") );
227 p_intf->p_sys->p_popup_menu = &popupmenu;
228 p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
229 p_intf->p_sys->p_popup_menu = NULL;
232 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
234 #define MAX_AUDIO_ITEMS 10
236 vlc_object_t *p_object;
237 char *ppsz_varnames[MAX_AUDIO_ITEMS];
238 int pi_objects[MAX_AUDIO_ITEMS];
241 /* Initializations */
242 memset( pi_objects, 0, MAX_AUDIO_ITEMS * sizeof(int) );
244 p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
246 if( p_object != NULL )
248 ppsz_varnames[i] = "audio-es";
249 pi_objects[i++] = p_object->i_object_id;
250 vlc_object_release( p_object );
253 p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_AOUT,
255 if( p_object != NULL )
257 ppsz_varnames[i] = "audio-device";
258 pi_objects[i++] = p_object->i_object_id;
259 ppsz_varnames[i] = "audio-channels";
260 pi_objects[i++] = p_object->i_object_id;
261 ppsz_varnames[i] = "visual";
262 pi_objects[i++] = p_object->i_object_id;
263 vlc_object_release( p_object );
267 return new Menu( _p_intf, p_parent, i,
268 ppsz_varnames, pi_objects, AudioMenu_Events );
271 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
273 #define MAX_VIDEO_ITEMS 15
275 vlc_object_t *p_object;
276 char *ppsz_varnames[MAX_VIDEO_ITEMS];
277 int pi_objects[MAX_VIDEO_ITEMS];
280 /* Initializations */
281 memset( pi_objects, 0, MAX_VIDEO_ITEMS * sizeof(int) );
283 p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
285 if( p_object != NULL )
287 ppsz_varnames[i] = "video-es";
288 pi_objects[i++] = p_object->i_object_id;
289 ppsz_varnames[i] = "spu-es";
290 pi_objects[i++] = p_object->i_object_id;
291 vlc_object_release( p_object );
294 p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_VOUT,
296 if( p_object != NULL )
298 vlc_object_t *p_dec_obj;
300 ppsz_varnames[i] = "fullscreen";
301 pi_objects[i++] = p_object->i_object_id;
302 ppsz_varnames[i] = "zoom";
303 pi_objects[i++] = p_object->i_object_id;
304 ppsz_varnames[i] = "deinterlace";
305 pi_objects[i++] = p_object->i_object_id;
306 ppsz_varnames[i] = "aspect-ratio";
307 pi_objects[i++] = p_object->i_object_id;
308 ppsz_varnames[i] = "crop";
309 pi_objects[i++] = p_object->i_object_id;
310 ppsz_varnames[i] = "directx-on-top";
311 pi_objects[i++] = p_object->i_object_id;
312 ppsz_varnames[i] = "xvideo-on-top";
313 pi_objects[i++] = p_object->i_object_id;
314 ppsz_varnames[i] = "x11-on-top";
315 pi_objects[i++] = p_object->i_object_id;
317 p_dec_obj = (vlc_object_t *)vlc_object_find( p_object,
320 if( p_dec_obj != NULL )
322 ppsz_varnames[i] = "ffmpeg-pp-q";
323 pi_objects[i++] = p_dec_obj->i_object_id;
324 vlc_object_release( p_dec_obj );
327 vlc_object_release( p_object );
331 return new Menu( _p_intf, p_parent, i,
332 ppsz_varnames, pi_objects, VideoMenu_Events );
335 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
337 #define MAX_NAVIG_ITEMS 10
339 vlc_object_t *p_object;
340 char *ppsz_varnames[MAX_NAVIG_ITEMS];
341 int pi_objects[MAX_NAVIG_ITEMS];
344 /* Initializations */
345 memset( pi_objects, 0, MAX_NAVIG_ITEMS * sizeof(int) );
347 p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
349 if( p_object != NULL )
351 ppsz_varnames[i] = "bookmark";
352 pi_objects[i++] = p_object->i_object_id;
353 ppsz_varnames[i] = "title";
354 pi_objects[i++] = p_object->i_object_id;
355 ppsz_varnames[i] = "chapter";
356 pi_objects[i++] = p_object->i_object_id;
357 ppsz_varnames[i] = "program";
358 pi_objects[i++] = p_object->i_object_id;
359 ppsz_varnames[i] = "navigation";
360 pi_objects[i++] = p_object->i_object_id;
361 ppsz_varnames[i] = "dvd_menus";
362 pi_objects[i++] = p_object->i_object_id;
364 ppsz_varnames[i] = "prev-title";
365 pi_objects[i++] = p_object->i_object_id;
366 ppsz_varnames[i] = "next-title";
367 pi_objects[i++] = p_object->i_object_id;
368 ppsz_varnames[i] = "prev-chapter";
369 pi_objects[i++] = p_object->i_object_id;
370 ppsz_varnames[i] = "next-chapter";
371 pi_objects[i++] = p_object->i_object_id;
373 vlc_object_release( p_object );
377 return new Menu( _p_intf, p_parent, i,
378 ppsz_varnames, pi_objects, NavigMenu_Events );
381 wxMenu *SettingsMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
383 #define MAX_SETTINGS_ITEMS 10
385 vlc_object_t *p_object;
386 char *ppsz_varnames[MAX_SETTINGS_ITEMS];
387 int pi_objects[MAX_SETTINGS_ITEMS];
390 /* Initializations */
391 memset( pi_objects, 0, MAX_SETTINGS_ITEMS * sizeof(int) );
393 p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INTF,
395 if( p_object != NULL )
397 ppsz_varnames[i] = "intf-switch";
398 pi_objects[i++] = p_object->i_object_id;
399 ppsz_varnames[i] = "intf-add";
400 pi_objects[i++] = p_object->i_object_id;
401 vlc_object_release( p_object );
405 return new Menu( _p_intf, p_parent, i,
406 ppsz_varnames, pi_objects, SettingsMenu_Events );
409 /*****************************************************************************
411 *****************************************************************************/
412 Menu::Menu( intf_thread_t *_p_intf, wxWindow *p_parent,
413 int i_count, char **ppsz_varnames, int *pi_objects,
414 int i_start_id ): wxMenu( )
416 vlc_object_t *p_object;
417 vlc_bool_t b_section_empty = VLC_FALSE;
420 /* Initializations */
423 i_item_id = i_start_id;
425 for( i = 0; i < i_count; i++ )
427 if( !ppsz_varnames[i] )
429 if( b_section_empty )
431 Append( MenuDummy_Event + i, wxU(_("Empty")) );
432 Enable( MenuDummy_Event + i, FALSE );
436 b_section_empty = VLC_TRUE;
442 Append( MenuDummy_Event, wxU(ppsz_varnames[i]) );
443 b_section_empty = VLC_FALSE;
447 p_object = (vlc_object_t *)vlc_object_get( p_intf, pi_objects[i] );
448 if( p_object == NULL ) continue;
450 b_section_empty = VLC_FALSE;
451 CreateMenuItem( this, ppsz_varnames[i], p_object );
452 vlc_object_release( p_object );
455 /* Special case for empty menus */
456 if( GetMenuItemCount() == 0 || b_section_empty )
458 Append( MenuDummy_Event + i, wxU(_("Empty")) );
459 Enable( MenuDummy_Event + i, FALSE );
467 /*****************************************************************************
469 *****************************************************************************/
470 static bool IsMenuEmpty( char *psz_var, vlc_object_t *p_object,
473 vlc_value_t val, val_list;
474 int i_type, i_result, i;
476 /* Check the type of the object variable */
477 i_type = var_Type( p_object, psz_var );
479 /* Check if we want to display the variable */
480 if( !(i_type & VLC_VAR_HASCHOICE) ) return FALSE;
482 var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
483 if( val.i_int == 0 ) return TRUE;
485 if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE )
487 if( val.i_int == 1 && b_root ) return TRUE;
491 /* Check children variables in case of VLC_VAR_VARIABLE */
492 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST, &val_list, NULL ) < 0 )
497 for( i = 0, i_result = TRUE; i < val_list.p_list->i_count; i++ )
499 if( !IsMenuEmpty( val_list.p_list->p_values[i].psz_string,
507 /* clean up everything */
508 var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, NULL );
513 void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
514 vlc_object_t *p_object )
516 wxMenuItemExt *menuitem;
517 vlc_value_t val, text;
520 /* Check the type of the object variable */
521 i_type = var_Type( p_object, psz_var );
523 switch( i_type & VLC_VAR_TYPE )
527 case VLC_VAR_VARIABLE:
529 case VLC_VAR_INTEGER:
533 /* Variable doesn't exist or isn't handled */
537 /* Make sure we want to display the variable */
538 if( IsMenuEmpty( psz_var, p_object ) ) return;
540 /* Get the descriptive name of the variable */
541 var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
543 if( i_type & VLC_VAR_HASCHOICE )
545 menu->Append( MenuDummy_Event,
546 wxU(text.psz_string ? text.psz_string : psz_var),
547 CreateChoicesMenu( psz_var, p_object, TRUE ),
548 wxT("")/* Nothing for now (maybe use a GETLONGTEXT) */ );
550 if( text.psz_string ) free( text.psz_string );
555 switch( i_type & VLC_VAR_TYPE )
558 var_Get( p_object, psz_var, &val );
559 menuitem = new wxMenuItemExt( menu, ++i_item_id,
560 wxU(text.psz_string ?
561 text.psz_string : psz_var),
562 wxT(""), wxITEM_NORMAL, strdup(psz_var),
563 p_object->i_object_id, val, i_type );
564 menu->Append( menuitem );
568 var_Get( p_object, psz_var, &val );
569 val.b_bool = !val.b_bool;
570 menuitem = new wxMenuItemExt( menu, ++i_item_id,
571 wxU(text.psz_string ?
572 text.psz_string : psz_var),
573 wxT(""), wxITEM_CHECK, strdup(psz_var),
574 p_object->i_object_id, val, i_type );
575 menu->Append( menuitem );
576 Check( i_item_id, val.b_bool ? FALSE : TRUE );
580 if( text.psz_string ) free( text.psz_string );
583 wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object,
586 vlc_value_t val, val_list, text_list;
589 /* Check the type of the object variable */
590 i_type = var_Type( p_object, psz_var );
592 /* Make sure we want to display the variable */
593 if( IsMenuEmpty( psz_var, p_object, b_root ) ) return NULL;
595 switch( i_type & VLC_VAR_TYPE )
599 case VLC_VAR_VARIABLE:
601 case VLC_VAR_INTEGER:
605 /* Variable doesn't exist or isn't handled */
609 if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
610 &val_list, &text_list ) < 0 )
615 wxMenu *menu = new wxMenu;
616 for( i = 0; i < val_list.p_list->i_count; i++ )
618 vlc_value_t another_val;
619 wxMenuItemExt *menuitem;
621 switch( i_type & VLC_VAR_TYPE )
623 case VLC_VAR_VARIABLE:
624 menu->Append( MenuDummy_Event,
625 wxU(text_list.p_list->p_values[i].psz_string ?
626 text_list.p_list->p_values[i].psz_string :
627 val_list.p_list->p_values[i].psz_string),
629 val_list.p_list->p_values[i].psz_string,
630 p_object, FALSE ), wxT("") );
634 var_Get( p_object, psz_var, &val );
636 another_val.psz_string =
637 strdup(val_list.p_list->p_values[i].psz_string);
639 new wxMenuItemExt( menu, ++i_item_id,
640 wxU(text_list.p_list->p_values[i].psz_string ?
641 text_list.p_list->p_values[i].psz_string :
642 another_val.psz_string), wxT(""),
643 i_type & VLC_VAR_ISCOMMAND ?
644 wxITEM_NORMAL : wxITEM_RADIO,
646 p_object->i_object_id, another_val, i_type );
648 menu->Append( menuitem );
650 if( !(i_type & VLC_VAR_ISCOMMAND) && val.psz_string &&
651 !strcmp( val.psz_string,
652 val_list.p_list->p_values[i].psz_string ) )
653 menu->Check( i_item_id, TRUE );
655 if( val.psz_string ) free( val.psz_string );
658 case VLC_VAR_INTEGER:
659 var_Get( p_object, psz_var, &val );
662 new wxMenuItemExt( menu, ++i_item_id,
663 text_list.p_list->p_values[i].psz_string ?
665 text_list.p_list->p_values[i].psz_string) :
666 wxString::Format(wxT("%d"),
667 val_list.p_list->p_values[i].i_int), wxT(""),
668 i_type & VLC_VAR_ISCOMMAND ?
669 wxITEM_NORMAL : wxITEM_RADIO,
671 p_object->i_object_id,
672 val_list.p_list->p_values[i], i_type );
674 menu->Append( menuitem );
676 if( !(i_type & VLC_VAR_ISCOMMAND) &&
677 val_list.p_list->p_values[i].i_int == val.i_int )
678 menu->Check( i_item_id, TRUE );
682 var_Get( p_object, psz_var, &val );
685 new wxMenuItemExt( menu, ++i_item_id,
686 text_list.p_list->p_values[i].psz_string ?
688 text_list.p_list->p_values[i].psz_string) :
689 wxString::Format(wxT("%.2f"),
690 val_list.p_list->p_values[i].f_float),wxT(""),
691 i_type & VLC_VAR_ISCOMMAND ?
692 wxITEM_NORMAL : wxITEM_RADIO,
694 p_object->i_object_id,
695 val_list.p_list->p_values[i], i_type );
697 menu->Append( menuitem );
699 if( !(i_type & VLC_VAR_ISCOMMAND) &&
700 val_list.p_list->p_values[i].f_float == val.f_float )
701 menu->Check( i_item_id, TRUE );
709 /* clean up everything */
710 var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list );
715 void Menu::OnShowDialog( wxCommandEvent& event )
717 if( p_intf->p_sys->pf_show_dialog )
721 switch( event.GetId() )
723 case OpenFileSimple_Event:
724 i_id = INTF_DIALOG_FILE_SIMPLE;
727 i_id = INTF_DIALOG_FILE;
730 i_id = INTF_DIALOG_DISC;
733 i_id = INTF_DIALOG_NET;
736 i_id = INTF_DIALOG_FILE;
741 p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
745 /*****************************************************************************
746 * A small helper class which intercepts all popup menu events
747 *****************************************************************************/
748 MenuEvtHandler::MenuEvtHandler( intf_thread_t *_p_intf,
749 Interface *_p_main_interface )
751 /* Initializations */
753 p_main_interface = _p_main_interface;
756 MenuEvtHandler::~MenuEvtHandler()
760 void MenuEvtHandler::OnShowDialog( wxCommandEvent& event )
762 if( p_intf->p_sys->pf_show_dialog )
766 switch( event.GetId() )
768 case OpenFileSimple_Event:
769 i_id = INTF_DIALOG_FILE_SIMPLE;
772 i_id = INTF_DIALOG_FILE;
775 i_id = INTF_DIALOG_DISC;
778 i_id = INTF_DIALOG_NET;
781 i_id = INTF_DIALOG_FILE;
786 p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
790 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
792 wxMenuItem *p_menuitem = NULL;
794 /* Check if this is an auto generated menu item */
795 if( event.GetId() < FirstAutoGenerated_Event )
801 if( !p_main_interface ||
802 (p_menuitem = p_main_interface->GetMenuBar()->FindItem(event.GetId()))
805 if( p_intf->p_sys->p_popup_menu )
808 p_intf->p_sys->p_popup_menu->FindItem( event.GetId() );
814 wxMenuItemExt *p_menuitemext = (wxMenuItemExt *)p_menuitem;
815 vlc_object_t *p_object;
817 p_object = (vlc_object_t *)vlc_object_get( p_intf,
818 p_menuitemext->i_object_id );
819 if( p_object == NULL ) return;
821 var_Set( p_object, p_menuitemext->psz_var, p_menuitemext->val );
823 vlc_object_release( p_object );
829 /*****************************************************************************
830 * A small helper class which encapsulate wxMenuitem with some other useful
832 *****************************************************************************/
833 wxMenuItemExt::wxMenuItemExt( wxMenu* parentMenu, int id, const wxString& text,
834 const wxString& helpString, wxItemKind kind,
835 char *_psz_var, int _i_object_id, vlc_value_t _val, int _i_val_type ):
836 wxMenuItem( parentMenu, id, text, helpString, kind )
838 /* Initializations */
840 i_val_type = _i_val_type;
841 i_object_id = _i_object_id;
845 wxMenuItemExt::~wxMenuItemExt()
847 if( psz_var ) free( psz_var );
848 if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING)
849 && val.psz_string ) free( val.psz_string );