]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/menus.cpp
* modules/gui/wxwindows/*: small clean-up in included headers.
[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.19 2003/08/27 11:53:26 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     popupmenu.AppendSeparator();
183     popupmenu.Append( MenuDummy_Event, wxU(_("Close Menu")) );
184 #endif
185
186     p_intf->p_sys->p_popup_menu = &popupmenu;
187     p_parent->PopupMenu( &popupmenu, pos.x, pos.y );
188     p_intf->p_sys->p_popup_menu = NULL;
189 }
190
191 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
192 {
193     vlc_object_t *p_object;
194     char *ppsz_varnames[5];
195     int pi_objects[5];
196     int i = 0;
197
198     /* Initializations */
199     memset( pi_objects, 0, 5 * sizeof(int) );
200
201     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_AOUT,
202                                                 FIND_ANYWHERE );
203     if( p_object != NULL )
204     {
205         ppsz_varnames[i] = "audio-device";
206         pi_objects[i++] = p_object->i_object_id;
207         ppsz_varnames[i] = "audio-channels";
208         pi_objects[i++] = p_object->i_object_id;
209         vlc_object_release( p_object );
210     }
211
212     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
213                                                 FIND_ANYWHERE );
214     if( p_object != NULL )
215     {
216         ppsz_varnames[i] = "audio-es";
217         pi_objects[i++] = p_object->i_object_id;
218         vlc_object_release( p_object );
219     }
220
221     /* Build menu */
222     return new Menu( _p_intf, p_parent, i,
223                      ppsz_varnames, pi_objects, AudioMenu_Events );
224 }
225
226 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
227 {
228     vlc_object_t *p_object;
229     char *ppsz_varnames[6];
230     int pi_objects[6];
231     int i = 0;
232
233     /* Initializations */
234     memset( pi_objects, 0, 6 * sizeof(int) );
235
236     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_VOUT,
237                                                 FIND_ANYWHERE );
238     if( p_object != NULL )
239     {
240         ppsz_varnames[i] = "fullscreen";
241         pi_objects[i++] = p_object->i_object_id;
242         ppsz_varnames[i] = "deinterlace";
243         pi_objects[i++] = p_object->i_object_id;
244         ppsz_varnames[i] = "directx-on-top";
245         pi_objects[i++] = p_object->i_object_id;
246         vlc_object_release( p_object );
247     }
248
249     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
250                                                 FIND_ANYWHERE );
251     if( p_object != NULL )
252     {
253         ppsz_varnames[i] = "video-es";
254         pi_objects[i++] = p_object->i_object_id;
255         ppsz_varnames[i] = "spu-es";
256         pi_objects[i++] = p_object->i_object_id;
257         vlc_object_release( p_object );
258     }
259
260     /* Build menu */
261     return new Menu( _p_intf, p_parent, i,
262                      ppsz_varnames, pi_objects, VideoMenu_Events );
263 }
264
265 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent )
266 {
267     vlc_object_t *p_object;
268     char *ppsz_varnames[10];
269     int pi_objects[10];
270     int i = 0;
271
272     /* Initializations */
273     memset( pi_objects, 0, 4 * sizeof(int) );
274
275     p_object = (vlc_object_t *)vlc_object_find( _p_intf, VLC_OBJECT_INPUT,
276                                                 FIND_ANYWHERE );
277     if( p_object != NULL )
278     {
279         ppsz_varnames[i] = "title";
280         pi_objects[i++] = p_object->i_object_id;
281         ppsz_varnames[i] = "chapter";
282         pi_objects[i++] = p_object->i_object_id;
283         ppsz_varnames[i] = "program";
284         pi_objects[i++] = p_object->i_object_id;
285         ppsz_varnames[i] = "navigation";
286         pi_objects[i++] = p_object->i_object_id;
287         ppsz_varnames[i] = "dvd_menus";
288         pi_objects[i++] = p_object->i_object_id;
289
290         ppsz_varnames[i] = "prev-title";
291         pi_objects[i++] = p_object->i_object_id;
292         ppsz_varnames[i] = "next-title";
293         pi_objects[i++] = p_object->i_object_id;
294         ppsz_varnames[i] = "prev-chapter";
295         pi_objects[i++] = p_object->i_object_id;
296         ppsz_varnames[i] = "next-chapter";
297         pi_objects[i++] = p_object->i_object_id;
298
299         vlc_object_release( p_object );
300     }
301
302     /* Build menu */
303     return new Menu( _p_intf, p_parent, i,
304                      ppsz_varnames, pi_objects, NavigMenu_Events );
305 }
306
307 /*****************************************************************************
308  * Constructor.
309  *****************************************************************************/
310 Menu::Menu( intf_thread_t *_p_intf, wxWindow *p_parent,
311             int i_count, char **ppsz_varnames, int *pi_objects,
312             int i_start_id ): wxMenu( )
313 {
314     vlc_object_t *p_object;
315     int i;
316
317     /* Initializations */
318     p_intf = _p_intf;
319
320     i_item_id = i_start_id;
321
322     for( i = 0; i < i_count; i++ )
323     {
324         if( !ppsz_varnames[i] )
325         {
326             AppendSeparator();
327             continue;
328         }
329
330         if( !pi_objects[i] )
331         {
332             Append( MenuDummy_Event, wxU(ppsz_varnames[i]) );
333             continue;
334         }
335
336         p_object = (vlc_object_t *)vlc_object_get( p_intf, pi_objects[i] );
337         if( p_object == NULL ) continue;
338
339         CreateMenuItem( this, ppsz_varnames[i], p_object );
340         vlc_object_release( p_object );
341     }
342
343     /* Special case for empty menus */
344     if( GetMenuItemCount() == 0 )
345     {
346         Append( MenuDummy_Event, wxU(_("Empty")) );
347         Enable( MenuDummy_Event, FALSE );
348     }
349 }
350
351 Menu::~Menu()
352 {
353 }
354
355 /*****************************************************************************
356  * Private methods.
357  *****************************************************************************/
358 void Menu::CreateMenuItem( wxMenu *menu, char *psz_var,
359                            vlc_object_t *p_object )
360 {
361     wxMenuItemExt *menuitem;
362     vlc_value_t val, text;
363     int i_type;
364
365     /* Check the type of the object variable */
366     i_type = var_Type( p_object, psz_var );
367
368     switch( i_type & VLC_VAR_TYPE )
369     {
370     case VLC_VAR_VOID:
371     case VLC_VAR_BOOL:
372     case VLC_VAR_VARIABLE:
373     case VLC_VAR_STRING:
374     case VLC_VAR_INTEGER:
375         break;
376     default:
377         /* Variable doesn't exist or isn't handled */
378         return;
379     }
380
381     /* Make sure we want to display the variable */
382     if( i_type & VLC_VAR_HASCHOICE )
383     {
384         var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
385         if( val.i_int == 0 ) return;
386         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
387             return;
388     }
389
390     /* Get the descriptive name of the variable */
391     var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
392
393     var_Get( p_object, psz_var, &val );
394
395     if( i_type & VLC_VAR_HASCHOICE )
396     {
397         menu->Append( MenuDummy_Event,
398                       wxU(text.psz_string ? text.psz_string : psz_var),
399                       CreateChoicesMenu( psz_var, p_object ),
400                       wxT("")/* Nothing for now (maybe use a GETLONGTEXT) */ );
401
402         if( text.psz_string ) free( text.psz_string );
403         return;
404     }
405
406
407     switch( i_type & VLC_VAR_TYPE )
408     {
409     case VLC_VAR_VOID:
410         menuitem = new wxMenuItemExt( menu, ++i_item_id,
411                                       wxU(text.psz_string ?
412                                         text.psz_string : psz_var),
413                                       wxT(""), wxITEM_NORMAL, strdup(psz_var),
414                                       p_object->i_object_id, val, i_type );
415         menu->Append( menuitem );
416         break;
417
418     case VLC_VAR_BOOL:
419         val.b_bool = !val.b_bool;
420         menuitem = new wxMenuItemExt( menu, ++i_item_id,
421                                       wxU(text.psz_string ?
422                                         text.psz_string : psz_var),
423                                       wxT(""), wxITEM_CHECK, strdup(psz_var),
424                                       p_object->i_object_id, val, i_type );
425         menu->Append( menuitem );
426         Check( i_item_id, val.b_bool ? FALSE : TRUE );
427         break;
428
429     default:
430         if( text.psz_string ) free( text.psz_string );
431         return;
432     }
433
434     if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
435     if( text.psz_string ) free( text.psz_string );
436 }
437
438 wxMenu *Menu::CreateChoicesMenu( char *psz_var, vlc_object_t *p_object )
439 {
440     vlc_value_t val, val_list, text_list;
441     int i_type, i;
442
443     /* Check the type of the object variable */
444     i_type = var_Type( p_object, psz_var );
445
446     /* Make sure we want to display the variable */
447     if( i_type & VLC_VAR_HASCHOICE )
448     {
449         var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
450         if( val.i_int == 0 ) return NULL;
451         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
452             return NULL;
453     }
454     else
455     {
456         return NULL;
457     }
458
459     switch( i_type & VLC_VAR_TYPE )
460     {
461     case VLC_VAR_VOID:
462     case VLC_VAR_BOOL:
463     case VLC_VAR_VARIABLE:
464     case VLC_VAR_STRING:
465     case VLC_VAR_INTEGER:
466         break;
467     default:
468         /* Variable doesn't exist or isn't handled */
469         return NULL;
470     }
471
472     if( var_Get( p_object, psz_var, &val ) < 0 )
473     {
474         return NULL;
475     }
476
477     if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
478                     &val_list, &text_list ) < 0 )
479     {
480         if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
481         return NULL;
482     }
483
484     wxMenu *menu = new wxMenu;
485     for( i = 0; i < val_list.p_list->i_count; i++ )
486     {
487         vlc_value_t another_val;
488         wxMenuItemExt *menuitem;
489
490         switch( i_type & VLC_VAR_TYPE )
491         {
492         case VLC_VAR_VARIABLE:
493           menu->Append( MenuDummy_Event,
494                         wxU(text_list.p_list->p_values[i].psz_string ?
495                         text_list.p_list->p_values[i].psz_string :
496                         val_list.p_list->p_values[i].psz_string),
497                         CreateChoicesMenu(
498                             val_list.p_list->p_values[i].psz_string,
499                             p_object ), wxT("") );
500           break;
501
502         case VLC_VAR_STRING:
503           another_val.psz_string =
504               strdup(val_list.p_list->p_values[i].psz_string);
505           menuitem =
506               new wxMenuItemExt( menu, ++i_item_id,
507                                  wxU(text_list.p_list->p_values[i].psz_string ?
508                                  text_list.p_list->p_values[i].psz_string :
509                                  another_val.psz_string), wxT(""),
510                                  i_type & VLC_VAR_ISCOMMAND ?
511                                    wxITEM_NORMAL : wxITEM_RADIO,
512                                  strdup(psz_var),
513                                  p_object->i_object_id, another_val, i_type );
514
515           menu->Append( menuitem );
516
517           if( !strcmp( val.psz_string,
518                        val_list.p_list->p_values[i].psz_string ) )
519               menu->Check( i_item_id, TRUE );
520           break;
521
522         case VLC_VAR_INTEGER:
523           menuitem =
524               new wxMenuItemExt( menu, ++i_item_id,
525                                  text_list.p_list->p_values[i].psz_string ?
526                                  (wxString)wxU(
527                                    text_list.p_list->p_values[i].psz_string) :
528                                  wxString::Format(wxT("%d"),
529                                  val_list.p_list->p_values[i].i_int), wxT(""),
530                                  i_type & VLC_VAR_ISCOMMAND ?
531                                    wxITEM_NORMAL : wxITEM_RADIO,
532                                  strdup(psz_var),
533                                  p_object->i_object_id,
534                                  val_list.p_list->p_values[i], i_type );
535
536           menu->Append( menuitem );
537
538           if( val_list.p_list->p_values[i].i_int == val.i_int )
539               menu->Check( i_item_id, TRUE );
540           break;
541
542         default:
543           break;
544         }
545     }
546
547     /* clean up everything */
548     if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
549     var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list );
550
551     return menu;
552 }
553
554 void Menu::OnShowDialog( wxCommandEvent& event )
555 {
556     if( p_intf->p_sys->pf_show_dialog )
557     {
558         int i_id;
559
560         switch( event.GetId() )
561         {
562         case OpenFileSimple_Event:
563             i_id = INTF_DIALOG_FILE_SIMPLE;
564             break;
565         case OpenFile_Event:
566             i_id = INTF_DIALOG_FILE;
567             break;
568         case OpenDisc_Event:
569             i_id = INTF_DIALOG_DISC;
570             break;
571         case OpenNet_Event:
572             i_id = INTF_DIALOG_NET;
573             break;
574         default:
575             i_id = INTF_DIALOG_FILE;
576             break;
577
578         }
579
580         p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
581     }
582 }
583
584 /*****************************************************************************
585  * A small helper class which intercepts all popup menu events
586  *****************************************************************************/
587 MenuEvtHandler::MenuEvtHandler( intf_thread_t *_p_intf,
588                                 Interface *_p_main_interface )
589 {
590     /* Initializations */
591     p_intf = _p_intf;
592     p_main_interface = _p_main_interface;
593 }
594
595 MenuEvtHandler::~MenuEvtHandler()
596 {
597 }
598
599 void MenuEvtHandler::OnShowDialog( wxCommandEvent& event )
600 {
601     if( p_intf->p_sys->pf_show_dialog )
602     {
603         int i_id;
604
605         switch( event.GetId() )
606         {
607         case OpenFileSimple_Event:
608             i_id = INTF_DIALOG_FILE_SIMPLE;
609             break;
610         case OpenFile_Event:
611             i_id = INTF_DIALOG_FILE;
612             break;
613         case OpenDisc_Event:
614             i_id = INTF_DIALOG_DISC;
615             break;
616         case OpenNet_Event:
617             i_id = INTF_DIALOG_NET;
618             break;
619         default:
620             i_id = INTF_DIALOG_FILE;
621             break;
622
623         }
624
625         p_intf->p_sys->pf_show_dialog( p_intf, i_id, 1, 0 );
626     }
627 }
628
629 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event )
630 {
631     wxMenuItem *p_menuitem = NULL;
632
633     /* Check if this is an auto generated menu item */
634     if( event.GetId() < FirstAutoGenerated_Event )
635     {
636         event.Skip();
637         return;
638     }
639
640     if( !p_main_interface ||
641         (p_menuitem = p_main_interface->GetMenuBar()->FindItem(event.GetId()))
642         == NULL )
643     {
644         if( p_intf->p_sys->p_popup_menu )
645         {
646             p_menuitem = 
647                 p_intf->p_sys->p_popup_menu->FindItem( event.GetId() );
648         }
649     }
650
651     if( p_menuitem )
652     {
653         wxMenuItemExt *p_menuitemext = (wxMenuItemExt *)p_menuitem;
654         vlc_object_t *p_object;
655
656         p_object = (vlc_object_t *)vlc_object_get( p_intf,
657                                        p_menuitemext->i_object_id );
658         if( p_object == NULL ) return;
659
660         var_Set( p_object, p_menuitemext->psz_var, p_menuitemext->val );
661
662         vlc_object_release( p_object );
663     }
664     else
665         event.Skip();
666 }
667
668 /*****************************************************************************
669  * A small helper class which encapsulate wxMenuitem with some other useful
670  * things.
671  *****************************************************************************/
672 wxMenuItemExt::wxMenuItemExt( wxMenu* parentMenu, int id, const wxString& text,
673     const wxString& helpString, wxItemKind kind,
674     char *_psz_var, int _i_object_id, vlc_value_t _val, int _i_val_type ):
675     wxMenuItem( parentMenu, id, text, helpString, kind )
676 {
677     /* Initializations */
678     psz_var = _psz_var;
679     i_val_type = _i_val_type;
680     i_object_id = _i_object_id;
681     val = _val;
682 };
683
684 wxMenuItemExt::~wxMenuItemExt()
685 {
686     if( psz_var ) free( psz_var );
687     if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING)
688         && val.psz_string ) free( val.psz_string );
689 };