]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/menus.cpp
0a41867dd114c63e1392ed462a8ef3d61ae4e867
[vlc] / modules / gui / wxwindows / menus.cpp
1 /*****************************************************************************
2  * menus.cpp : wxWindows plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000-2001 VideoLAN
5  * $Id: menus.cpp,v 1.20 2003/08/28 15:59:04 gbazin Exp $
6  *
7  * Authors: Gildas Bazin <gbazin@netcourrier.com>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <stdlib.h>                                      /* malloc(), free() */
28 #include <errno.h>                                                 /* ENOMEM */
29 #include <string.h>                                            /* strerror() */
30 #include <stdio.h>
31
32 #include <vlc/vlc.h>
33 #include <vlc/intf.h>
34
35 #include "wxwindows.h"
36 #include <wx/listctrl.h>
37
38 class wxMenuItemExt: public wxMenuItem
39 {
40 public:
41     /* Constructor */
42     wxMenuItemExt( wxMenu* parentMenu, int id, const wxString& text,
43                    const wxString& helpString, wxItemKind kind,
44                    char *_psz_var, int _i_object_id, vlc_value_t _val,
45                    int _i_val_type );
46
47     virtual ~wxMenuItemExt();
48
49     char *psz_var;
50     int  i_val_type;
51     int  i_object_id;
52     vlc_value_t val;
53
54 private:
55
56 };
57
58 /*****************************************************************************
59  * Event Table.
60  *****************************************************************************/
61
62 /* IDs for the controls and the menu commands */
63 enum
64 {
65     /* menu items */
66     MenuDummy_Event = wxID_HIGHEST + 1000,
67     OpenFileSimple_Event,
68     OpenFile_Event,
69     OpenDisc_Event,
70     OpenNet_Event,
71     FirstAutoGenerated_Event = wxID_HIGHEST + 1999,
72     AudioMenu_Events = wxID_HIGHEST + 2000,
73     VideoMenu_Events = wxID_HIGHEST + 3000,
74     NavigMenu_Events = wxID_HIGHEST + 4000,
75     PopupMenu_Events = wxID_HIGHEST + 5000
76 };
77
78 BEGIN_EVENT_TABLE(Menu, wxMenu)
79 END_EVENT_TABLE()
80
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)
87 END_EVENT_TABLE()
88
89 wxMenu *OpenStreamMenu( intf_thread_t *p_intf )
90 {
91     wxMenu *menu = new wxMenu;
92     menu->Append( OpenFileSimple_Event, wxU(_("Simple &Open ...")) );
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...")) );
96     return menu;
97 }
98
99 void PopupMenu( intf_thread_t *p_intf, wxWindow *p_parent,
100                 const wxPoint& pos )
101 {
102     vlc_object_t *p_object;
103     char *ppsz_varnames[29];
104     int pi_objects[29];
105     int i = 0;
106
107     /* Initializations */
108     memset( pi_objects, 0, 29 * sizeof(int) );
109
110     /* Audio menu */
111     ppsz_varnames[i++] = _("Audio menu");
112     ppsz_varnames[i++] = NULL; /* Separator */
113
114     p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_AOUT,
115                                                 FIND_ANYWHERE );
116     if( p_object != NULL )
117     {
118         ppsz_varnames[i] = "audio-device";
119         pi_objects[i++] = p_object->i_object_id;
120         ppsz_varnames[i] = "audio-channels";
121         pi_objects[i++] = p_object->i_object_id;
122         vlc_object_release( p_object );
123     }
124
125     /* Video menu */
126     ppsz_varnames[i++] = NULL; /* Separator */
127     ppsz_varnames[i++] = _("Video menu");
128     ppsz_varnames[i++] = NULL; /* Separator */
129
130     p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_VOUT,
131                                                 FIND_ANYWHERE );
132     if( p_object != NULL )
133     {
134         ppsz_varnames[i] = "fullscreen";
135         pi_objects[i++] = p_object->i_object_id;
136         ppsz_varnames[i] = "deinterlace";
137         pi_objects[i++] = p_object->i_object_id;
138         ppsz_varnames[i] = "directx-on-top";
139         pi_objects[i++] = p_object->i_object_id;
140         vlc_object_release( p_object );
141     }
142
143     /* Input menu */
144     ppsz_varnames[i++] = NULL; /* Separator */
145     ppsz_varnames[i++] = _("Input menu");
146     ppsz_varnames[i++] = NULL; /* Separator */
147
148     p_object = (vlc_object_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
149                                                 FIND_ANYWHERE );
150     if( p_object != NULL )
151     {
152         ppsz_varnames[i] = "title";
153         pi_objects[i++] = p_object->i_object_id;
154         ppsz_varnames[i] = "chapter";
155         pi_objects[i++] = p_object->i_object_id;
156         ppsz_varnames[i] = "program";
157         pi_objects[i++] = p_object->i_object_id;
158         ppsz_varnames[i] = "navigation";
159         pi_objects[i++] = p_object->i_object_id;
160         ppsz_varnames[i] = "dvd_menus";
161         pi_objects[i++] = p_object->i_object_id;
162
163         ppsz_varnames[i] = "video-es";
164         pi_objects[i++] = p_object->i_object_id;
165         ppsz_varnames[i] = "audio-es";
166         pi_objects[i++] = p_object->i_object_id;
167         ppsz_varnames[i] = "spu-es";
168         pi_objects[i++] = p_object->i_object_id;
169
170         vlc_object_release( p_object );
171     }
172
173     /* Build menu */
174     Menu popupmenu( p_intf, p_parent, i,
175                      ppsz_varnames, pi_objects, PopupMenu_Events );
176
177 #if 1
178     /* Add static entries */
179     popupmenu.AppendSeparator();
180     popupmenu.Append( MenuDummy_Event, wxU("Open"),
181                       OpenStreamMenu( p_intf ), wxT("") );
182 #endif
183
184     p_intf->p_sys->p_popup_menu = &popupmenu;
185     p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
186     p_intf->p_sys->p_popup_menu = NULL;
187 }
188
189 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
190 {
191     vlc_object_t *p_object;
192     char *ppsz_varnames[5];
193     int pi_objects[5];
194     int i = 0;
195
196     /* Initializations */
197     memset( pi_objects, 0, 5 * sizeof(int) );
198
199     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_AOUT,
200                                                 FIND_ANYWHERE );
201     if( p_object != NULL )
202     {
203         ppsz_varnames[i] = "audio-device";
204         pi_objects[i++] = p_object->i_object_id;
205         ppsz_varnames[i] = "audio-channels";
206         pi_objects[i++] = p_object->i_object_id;
207         vlc_object_release( p_object );
208     }
209
210     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
211                                                 FIND_ANYWHERE );
212     if( p_object != NULL )
213     {
214         ppsz_varnames[i] = "audio-es";
215         pi_objects[i++] = p_object->i_object_id;
216         vlc_object_release( p_object );
217     }
218
219     /* Build menu */
220     return new Menu( _p_intf, p_parent, i,
221                      ppsz_varnames, pi_objects, AudioMenu_Events );
222 }
223
224 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
225 {
226     vlc_object_t *p_object;
227     char *ppsz_varnames[6];
228     int pi_objects[6];
229     int i = 0;
230
231     /* Initializations */
232     memset( pi_objects, 0, 6 * sizeof(int) );
233
234     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_VOUT,
235                                                 FIND_ANYWHERE );
236     if( p_object != NULL )
237     {
238         ppsz_varnames[i] = "fullscreen";
239         pi_objects[i++] = p_object->i_object_id;
240         ppsz_varnames[i] = "deinterlace";
241         pi_objects[i++] = p_object->i_object_id;
242         ppsz_varnames[i] = "directx-on-top";
243         pi_objects[i++] = p_object->i_object_id;
244         vlc_object_release( p_object );
245     }
246
247     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
248                                                 FIND_ANYWHERE );
249     if( p_object != NULL )
250     {
251         ppsz_varnames[i] = "video-es";
252         pi_objects[i++] = p_object->i_object_id;
253         ppsz_varnames[i] = "spu-es";
254         pi_objects[i++] = p_object->i_object_id;
255         vlc_object_release( p_object );
256     }
257
258     /* Build menu */
259     return new Menu( _p_intf, p_parent, i,
260                      ppsz_varnames, pi_objects, VideoMenu_Events );
261 }
262
263 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
264 {
265     vlc_object_t *p_object;
266     char *ppsz_varnames[10];
267     int pi_objects[10];
268     int i = 0;
269
270     /* Initializations */
271     memset( pi_objects, 0, 4 * sizeof(int) );
272
273     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
274                                                 FIND_ANYWHERE );
275     if( p_object != NULL )
276     {
277         ppsz_varnames[i] = "title";
278         pi_objects[i++] = p_object->i_object_id;
279         ppsz_varnames[i] = "chapter";
280         pi_objects[i++] = p_object->i_object_id;
281         ppsz_varnames[i] = "program";
282         pi_objects[i++] = p_object->i_object_id;
283         ppsz_varnames[i] = "navigation";
284         pi_objects[i++] = p_object->i_object_id;
285         ppsz_varnames[i] = "dvd_menus";
286         pi_objects[i++] = p_object->i_object_id;
287
288         ppsz_varnames[i] = "prev-title";
289         pi_objects[i++] = p_object->i_object_id;
290         ppsz_varnames[i] = "next-title";
291         pi_objects[i++] = p_object->i_object_id;
292         ppsz_varnames[i] = "prev-chapter";
293         pi_objects[i++] = p_object->i_object_id;
294         ppsz_varnames[i] = "next-chapter";
295         pi_objects[i++] = p_object->i_object_id;
296
297         vlc_object_release( p_object );
298     }
299
300     /* Build menu */
301     return new Menu( _p_intf, p_parent, i,
302                      ppsz_varnames, pi_objects, NavigMenu_Events );
303 }
304
305 /*****************************************************************************
306  * Constructor.
307  *****************************************************************************/
308 Menu::Menu( intf_thread_t *_p_intf, wxWindow *p_parent,
309             int i_count, char **ppsz_varnames, int *pi_objects,
310             int i_start_id ): wxMenu( )
311 {
312     vlc_object_t *p_object;
313     int i;
314
315     /* Initializations */
316     p_intf = _p_intf;
317
318     i_item_id = i_start_id;
319
320     for( i = 0; i < i_count; i++ )
321     {
322         if( !ppsz_varnames[i] )
323         {
324             AppendSeparator();
325             continue;
326         }
327
328         if( !pi_objects[i] )
329         {
330             Append( MenuDummy_Event, wxU(ppsz_varnames[i]) );
331             continue;
332         }
333
334         p_object = (vlc_object_t *)vlc_object_get( p_intf, pi_objects[i] );
335         if( p_object == NULL ) continue;
336
337         CreateMenuItem( this, ppsz_varnames[i], p_object );
338         vlc_object_release( p_object );
339     }
340
341     /* Special case for empty menus */
342     if( GetMenuItemCount() == 0 )
343     {
344         Append( MenuDummy_Event, wxU(_("Empty")) );
345         Enable( MenuDummy_Event, FALSE );
346     }
347 }
348
349 Menu::~Menu()
350 {
351 }
352
353 /*****************************************************************************
354  * Private methods.
355  *****************************************************************************/
356 void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
357                            vlc_object_t *p_object )
358 {
359     wxMenuItemExt *menuitem;
360     vlc_value_t val, text;
361     int i_type;
362
363     /* Check the type of the object variable */
364     i_type = var_Type( p_object, psz_var );
365
366     switch( i_type & VLC_VAR_TYPE )
367     {
368     case VLC_VAR_VOID:
369     case VLC_VAR_BOOL:
370     case VLC_VAR_VARIABLE:
371     case VLC_VAR_STRING:
372     case VLC_VAR_INTEGER:
373         break;
374     default:
375         /* Variable doesn't exist or isn't handled */
376         return;
377     }
378
379     /* Make sure we want to display the variable */
380     if( i_type & VLC_VAR_HASCHOICE )
381     {
382         var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
383         if( val.i_int == 0 ) return;
384         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
385             return;
386     }
387
388     /* Get the descriptive name of the variable */
389     var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
390
391     var_Get( p_object, psz_var, &val );
392
393     if( i_type & VLC_VAR_HASCHOICE )
394     {
395         menu->Append( MenuDummy_Event,
396                       wxU(text.psz_string ? text.psz_string : psz_var),
397                       CreateChoicesMenu( psz_var, p_object ),
398                       wxT("")/* Nothing for now (maybe use a GETLONGTEXT) */ );
399
400         if( text.psz_string ) free( text.psz_string );
401         return;
402     }
403
404
405     switch( i_type & VLC_VAR_TYPE )
406     {
407     case VLC_VAR_VOID:
408         menuitem = new wxMenuItemExt( menu, ++i_item_id,
409                                       wxU(text.psz_string ?
410                                         text.psz_string : psz_var),
411                                       wxT(""), wxITEM_NORMAL, strdup(psz_var),
412                                       p_object->i_object_id, val, i_type );
413         menu->Append( menuitem );
414         break;
415
416     case VLC_VAR_BOOL:
417         val.b_bool = !val.b_bool;
418         menuitem = new wxMenuItemExt( menu, ++i_item_id,
419                                       wxU(text.psz_string ?
420                                         text.psz_string : psz_var),
421                                       wxT(""), wxITEM_CHECK, strdup(psz_var),
422                                       p_object->i_object_id, val, i_type );
423         menu->Append( menuitem );
424         Check( i_item_id, val.b_bool ? FALSE : TRUE );
425         break;
426
427     default:
428         if( text.psz_string ) free( text.psz_string );
429         return;
430     }
431
432     if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
433     if( text.psz_string ) free( text.psz_string );
434 }
435
436 wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object )
437 {
438     vlc_value_t val, val_list, text_list;
439     int i_type, i;
440
441     /* Check the type of the object variable */
442     i_type = var_Type( p_object, psz_var );
443
444     /* Make sure we want to display the variable */
445     if( i_type & VLC_VAR_HASCHOICE )
446     {
447         var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
448         if( val.i_int == 0 ) return NULL;
449         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
450             return NULL;
451     }
452     else
453     {
454         return NULL;
455     }
456
457     switch( i_type & VLC_VAR_TYPE )
458     {
459     case VLC_VAR_VOID:
460     case VLC_VAR_BOOL:
461     case VLC_VAR_VARIABLE:
462     case VLC_VAR_STRING:
463     case VLC_VAR_INTEGER:
464         break;
465     default:
466         /* Variable doesn't exist or isn't handled */
467         return NULL;
468     }
469
470     if( var_Get( p_object, psz_var, &val ) < 0 )
471     {
472         return NULL;
473     }
474
475     if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
476                     &val_list, &text_list ) < 0 )
477     {
478         if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
479         return NULL;
480     }
481
482     wxMenu *menu = new wxMenu;
483     for( i = 0; i < val_list.p_list->i_count; i++ )
484     {
485         vlc_value_t another_val;
486         wxMenuItemExt *menuitem;
487
488         switch( i_type & VLC_VAR_TYPE )
489         {
490         case VLC_VAR_VARIABLE:
491           menu->Append( MenuDummy_Event,
492                         wxU(text_list.p_list->p_values[i].psz_string ?
493                         text_list.p_list->p_values[i].psz_string :
494                         val_list.p_list->p_values[i].psz_string),
495                         CreateChoicesMenu(
496                             val_list.p_list->p_values[i].psz_string,
497                             p_object ), wxT("") );
498           break;
499
500         case VLC_VAR_STRING:
501           another_val.psz_string =
502               strdup(val_list.p_list->p_values[i].psz_string);
503           menuitem =
504               new wxMenuItemExt( menu, ++i_item_id,
505                                  wxU(text_list.p_list->p_values[i].psz_string ?
506                                  text_list.p_list->p_values[i].psz_string :
507                                  another_val.psz_string), wxT(""),
508                                  i_type & VLC_VAR_ISCOMMAND ?
509                                    wxITEM_NORMAL : wxITEM_RADIO,
510                                  strdup(psz_var),
511                                  p_object->i_object_id, another_val, i_type );
512
513           menu->Append( menuitem );
514
515           if( !strcmp( val.psz_string,
516                        val_list.p_list->p_values[i].psz_string ) )
517               menu->Check( i_item_id, TRUE );
518           break;
519
520         case VLC_VAR_INTEGER:
521           menuitem =
522               new wxMenuItemExt( menu, ++i_item_id,
523                                  text_list.p_list->p_values[i].psz_string ?
524                                  (wxString)wxU(
525                                    text_list.p_list->p_values[i].psz_string) :
526                                  wxString::Format(wxT("%d"),
527                                  val_list.p_list->p_values[i].i_int), wxT(""),
528                                  i_type & VLC_VAR_ISCOMMAND ?
529                                    wxITEM_NORMAL : wxITEM_RADIO,
530                                  strdup(psz_var),
531                                  p_object->i_object_id,
532                                  val_list.p_list->p_values[i], i_type );
533
534           menu->Append( menuitem );
535
536           if( val_list.p_list->p_values[i].i_int == val.i_int )
537               menu->Check( i_item_id, TRUE );
538           break;
539
540         default:
541           break;
542         }
543     }
544
545     /* clean up everything */
546     if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
547     var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list );
548
549     return menu;
550 }
551
552 void Menu::OnShowDialog( wxCommandEvent& event )
553 {
554     if( p_intf->p_sys->pf_show_dialog )
555     {
556         int i_id;
557
558         switch( event.GetId() )
559         {
560         case OpenFileSimple_Event:
561             i_id = INTF_DIALOG_FILE_SIMPLE;
562             break;
563         case OpenFile_Event:
564             i_id = INTF_DIALOG_FILE;
565             break;
566         case OpenDisc_Event:
567             i_id = INTF_DIALOG_DISC;
568             break;
569         case OpenNet_Event:
570             i_id = INTF_DIALOG_NET;
571             break;
572         default:
573             i_id = INTF_DIALOG_FILE;
574             break;
575
576         }
577
578         p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
579     }
580 }
581
582 /*****************************************************************************
583  * A small helper class which intercepts all popup menu events
584  *****************************************************************************/
585 MenuEvtHandler::MenuEvtHandler( intf_thread_t *_p_intf,
586                                 Interface *_p_main_interface )
587 {
588     /* Initializations */
589     p_intf = _p_intf;
590     p_main_interface = _p_main_interface;
591 }
592
593 MenuEvtHandler::~MenuEvtHandler()
594 {
595 }
596
597 void MenuEvtHandler::OnShowDialog( wxCommandEvent& event )
598 {
599     if( p_intf->p_sys->pf_show_dialog )
600     {
601         int i_id;
602
603         switch( event.GetId() )
604         {
605         case OpenFileSimple_Event:
606             i_id = INTF_DIALOG_FILE_SIMPLE;
607             break;
608         case OpenFile_Event:
609             i_id = INTF_DIALOG_FILE;
610             break;
611         case OpenDisc_Event:
612             i_id = INTF_DIALOG_DISC;
613             break;
614         case OpenNet_Event:
615             i_id = INTF_DIALOG_NET;
616             break;
617         default:
618             i_id = INTF_DIALOG_FILE;
619             break;
620
621         }
622
623         p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
624     }
625 }
626
627 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
628 {
629     wxMenuItem *p_menuitem = NULL;
630
631     /* Check if this is an auto generated menu item */
632     if( event.GetId() < FirstAutoGenerated_Event )
633     {
634         event.Skip();
635         return;
636     }
637
638     if( !p_main_interface ||
639         (p_menuitem = p_main_interface->GetMenuBar()->FindItem(event.GetId()))
640         == NULL )
641     {
642         if( p_intf->p_sys->p_popup_menu )
643         {
644             p_menuitem = 
645                 p_intf->p_sys->p_popup_menu->FindItem( event.GetId() );
646         }
647     }
648
649     if( p_menuitem )
650     {
651         wxMenuItemExt *p_menuitemext = (wxMenuItemExt *)p_menuitem;
652         vlc_object_t *p_object;
653
654         p_object = (vlc_object_t *)vlc_object_get( p_intf,
655                                        p_menuitemext->i_object_id );
656         if( p_object == NULL ) return;
657
658         var_Set( p_object, p_menuitemext->psz_var, p_menuitemext->val );
659
660         vlc_object_release( p_object );
661     }
662     else
663         event.Skip();
664 }
665
666 /*****************************************************************************
667  * A small helper class which encapsulate wxMenuitem with some other useful
668  * things.
669  *****************************************************************************/
670 wxMenuItemExt::wxMenuItemExt( wxMenu* parentMenu, int id, const wxString& text,
671     const wxString& helpString, wxItemKind kind,
672     char *_psz_var, int _i_object_id, vlc_value_t _val, int _i_val_type ):
673     wxMenuItem( parentMenu, id, text, helpString, kind )
674 {
675     /* Initializations */
676     psz_var = _psz_var;
677     i_val_type = _i_val_type;
678     i_object_id = _i_object_id;
679     val = _val;
680 };
681
682 wxMenuItemExt::~wxMenuItemExt()
683 {
684     if( psz_var ) free( psz_var );
685     if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING)
686         && val.psz_string ) free( val.psz_string );
687 };