]> git.sesse.net Git - vlc/blob - modules/gui/wince/menus.cpp
* modules/gui/wince: WinCE build fixes.
[vlc] / modules / gui / wince / menus.cpp
1 /*****************************************************************************
2  * menus.cpp : WinCE gui plugin for VLC
3  *****************************************************************************
4  * Copyright (C) 2000-2004 VideoLAN
5  * $Id$
6  *
7  * Authors: Marodon Cedric <cedric_marodon@yahoo.fr>
8  *          Gildas Bazin <gbazin@videolan.org>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 /*****************************************************************************
26  * Preamble
27  *****************************************************************************/
28 #include <stdlib.h>                                      /* malloc(), free() */
29 #include <string.h>                                            /* strerror() */
30 #include <stdio.h>
31 #include <vlc/vlc.h>
32 #include <vlc/intf.h>
33
34 #include "wince.h"
35
36 /*****************************************************************************
37  * Event Table.
38  *****************************************************************************/
39
40 /* IDs for the controls and the menu commands */
41 enum
42 {
43     /* menu items */
44     MenuDummy_Event = 1000,
45     OpenFileSimple_Event = 1100,
46     OpenFile_Event,
47     OpenDisc_Event,
48     OpenNet_Event,
49     FirstAutoGenerated_Event = 1999,
50     SettingsMenu_Events = 2000,
51     AudioMenu_Events = 3000,
52     VideoMenu_Events = 4000,
53     NavigMenu_Events = 5000,
54     PopupMenu_Events = 6000
55 };
56
57 void RefreshAudioMenu( intf_thread_t *p_intf, HMENU hMenu )
58 {
59 #define MAX_AUDIO_ITEMS 10
60
61     vlc_object_t *p_object;
62     char *ppsz_varnames[MAX_AUDIO_ITEMS];
63     int pi_objects[MAX_AUDIO_ITEMS];
64     vector<MenuItemExt*>::iterator iter;
65     int i;
66
67     /* Delete old menu */
68     int count = wce_GetMenuItemCount( hMenu );
69     for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
70         
71     if( p_intf->p_sys->p_audio_menu )
72     {
73         for( iter = p_intf->p_sys->p_audio_menu->begin();
74              iter != p_intf->p_sys->p_audio_menu->end(); iter++ )
75             delete *iter;
76         p_intf->p_sys->p_audio_menu->clear();
77     }
78     else p_intf->p_sys->p_audio_menu = new vector<MenuItemExt*>;
79
80     /* Initializations */
81     memset( pi_objects, 0, MAX_AUDIO_ITEMS * sizeof(int) );
82     i = 0;
83
84     p_object = (vlc_object_t *)
85         vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
86     if( p_object != NULL )
87     {
88         ppsz_varnames[i] = "audio-es";
89         pi_objects[i++] = p_object->i_object_id;
90         vlc_object_release( p_object );
91     }
92
93     p_object = (vlc_object_t *)
94         vlc_object_find( p_intf, VLC_OBJECT_AOUT, FIND_ANYWHERE );
95     if( p_object != NULL )
96     {
97         ppsz_varnames[i] = "audio-device";
98         pi_objects[i++] = p_object->i_object_id;
99         ppsz_varnames[i] = "audio-channels";
100         pi_objects[i++] = p_object->i_object_id;
101         ppsz_varnames[i] = "visual";
102         pi_objects[i++] = p_object->i_object_id;
103         vlc_object_release( p_object );
104     }
105
106     /* Build menu */
107     RefreshMenu( p_intf, p_intf->p_sys->p_audio_menu,
108                  hMenu, i, ppsz_varnames, pi_objects, AudioMenu_Events );
109 }
110
111 void RefreshVideoMenu( intf_thread_t *p_intf, HMENU hMenu )
112 {
113 #define MAX_VIDEO_ITEMS 15
114
115     vlc_object_t *p_object;
116     char *ppsz_varnames[MAX_VIDEO_ITEMS];
117     int pi_objects[MAX_VIDEO_ITEMS];
118     vector<MenuItemExt*>::iterator iter;
119     int i;
120
121     /* Delete old menu */
122     int count = wce_GetMenuItemCount( hMenu );
123     for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
124         
125     if( p_intf->p_sys->p_video_menu )
126     {
127         for( iter = p_intf->p_sys->p_video_menu->begin();
128              iter != p_intf->p_sys->p_video_menu->end(); iter++ )
129             delete *iter;
130         p_intf->p_sys->p_video_menu->clear();
131     }
132     else p_intf->p_sys->p_video_menu = new vector<MenuItemExt*>;
133         
134     /* Initializations */
135     memset( pi_objects, 0, MAX_VIDEO_ITEMS * sizeof(int) );
136     i = 0;
137
138     p_object = (vlc_object_t *)
139         vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
140     if( p_object != NULL )
141     {
142         ppsz_varnames[i] = "video-es";
143         pi_objects[i++] = p_object->i_object_id;
144         ppsz_varnames[i] = "spu-es";
145         pi_objects[i++] = p_object->i_object_id;
146         vlc_object_release( p_object );
147     }
148
149     p_object = (vlc_object_t *)
150         vlc_object_find( p_intf, VLC_OBJECT_VOUT, FIND_ANYWHERE );
151     if( p_object != NULL )
152     {
153         vlc_object_t *p_dec_obj;
154
155         ppsz_varnames[i] = "fullscreen";
156         pi_objects[i++] = p_object->i_object_id;
157 #ifdef WINCE
158         ppsz_varnames[i] = "transform";
159         pi_objects[i++] = p_object->i_object_id;
160 #endif
161         ppsz_varnames[i] = "zoom";
162         pi_objects[i++] = p_object->i_object_id;
163         ppsz_varnames[i] = "deinterlace";
164         pi_objects[i++] = p_object->i_object_id;
165         ppsz_varnames[i] = "aspect-ratio";
166         pi_objects[i++] = p_object->i_object_id;
167         ppsz_varnames[i] = "crop";
168         pi_objects[i++] = p_object->i_object_id;
169         ppsz_varnames[i] = "directx-on-top";
170         pi_objects[i++] = p_object->i_object_id;
171
172         p_dec_obj = (vlc_object_t *)
173             vlc_object_find( p_object, VLC_OBJECT_DECODER, FIND_PARENT );
174         if( p_dec_obj != NULL )
175         {
176             ppsz_varnames[i] = "ffmpeg-pp-q";
177             pi_objects[i++] = p_dec_obj->i_object_id;
178             vlc_object_release( p_dec_obj );
179         }
180
181         vlc_object_release( p_object );
182     }
183
184     /* Build menu */
185     RefreshMenu( p_intf, p_intf->p_sys->p_video_menu, hMenu, i,
186                  ppsz_varnames, pi_objects, VideoMenu_Events );
187 }
188
189 void RefreshNavigMenu( intf_thread_t *p_intf, HMENU hMenu )
190 {
191 #define MAX_NAVIG_ITEMS 10
192
193     vlc_object_t *p_object;
194     char *ppsz_varnames[MAX_NAVIG_ITEMS];
195     int pi_objects[MAX_NAVIG_ITEMS];
196     vector<MenuItemExt*>::iterator iter;
197     int i;
198
199     /* Delete old menu */
200     int count = wce_GetMenuItemCount( hMenu );
201     for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
202         
203     if( p_intf->p_sys->p_navig_menu )
204     {
205         for( iter = p_intf->p_sys->p_navig_menu->begin();
206              iter != p_intf->p_sys->p_navig_menu->end(); iter++ )
207             delete *iter;
208         p_intf->p_sys->p_navig_menu->clear();
209     }
210     else p_intf->p_sys->p_navig_menu = new vector<MenuItemExt*>;
211
212     /* Initializations */
213     memset( pi_objects, 0, MAX_NAVIG_ITEMS * sizeof(int) );
214     i = 0;
215
216     p_object = (vlc_object_t *)
217         vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
218     if( p_object != NULL )
219     {
220         ppsz_varnames[i] = "title";
221         pi_objects[i++] = p_object->i_object_id;
222         ppsz_varnames[i] = "chapter";
223         pi_objects[i++] = p_object->i_object_id;
224         ppsz_varnames[i] = "program";
225         pi_objects[i++] = p_object->i_object_id;
226         ppsz_varnames[i] = "navigation";
227         pi_objects[i++] = p_object->i_object_id;
228         ppsz_varnames[i] = "dvd_menus";
229         pi_objects[i++] = p_object->i_object_id;
230
231         ppsz_varnames[i] = "prev-title";
232         pi_objects[i++] = p_object->i_object_id;
233         ppsz_varnames[i] = "next-title";
234         pi_objects[i++] = p_object->i_object_id;
235         ppsz_varnames[i] = "prev-chapter";
236         pi_objects[i++] = p_object->i_object_id;
237         ppsz_varnames[i] = "next-chapter";
238         pi_objects[i++] = p_object->i_object_id;
239
240         vlc_object_release( p_object );
241     }
242
243     /* Build menu */
244     RefreshMenu( p_intf, p_intf->p_sys->p_navig_menu, hMenu, i,
245                  ppsz_varnames, pi_objects, NavigMenu_Events );
246 }
247
248 void RefreshSettingsMenu( intf_thread_t *p_intf, HMENU hMenu )
249 {
250 #define MAX_SETTINGS_ITEMS 10
251
252     vlc_object_t *p_object;
253     char *ppsz_varnames[MAX_SETTINGS_ITEMS];
254     int pi_objects[MAX_SETTINGS_ITEMS];
255     vector<MenuItemExt*>::iterator iter;
256     int i;
257
258     /* Delete old menu */
259     int count = wce_GetMenuItemCount( hMenu );
260     for( i = 0; i <= count; i++ ) RemoveMenu( hMenu, 0, MF_BYPOSITION );
261
262     if( p_intf->p_sys->p_settings_menu )
263     {
264         for( iter = p_intf->p_sys->p_settings_menu->begin();
265              iter != p_intf->p_sys->p_settings_menu->end(); iter++ )
266             delete(*iter);
267         p_intf->p_sys->p_settings_menu->clear();
268     }
269     else p_intf->p_sys->p_settings_menu = new vector<MenuItemExt*>;
270
271     /* Initializations */
272     memset( pi_objects, 0, MAX_SETTINGS_ITEMS * sizeof(int) );
273     i = 0;
274
275     AppendMenu( hMenu, MF_STRING, ID_SETTINGS_EXTEND, _T("&Extended GUI") );
276     AppendMenu( hMenu, MF_STRING, ID_SETTINGS_PREF, _T("&Preferences...") );
277
278     p_object = (vlc_object_t *)
279         vlc_object_find( p_intf, VLC_OBJECT_INTF, FIND_PARENT );
280     if( p_object != NULL )
281     {
282         ppsz_varnames[i] = "intf-switch";
283         pi_objects[i++] = p_object->i_object_id;
284         ppsz_varnames[i] = "intf-add";
285         pi_objects[i++] = p_object->i_object_id;
286         vlc_object_release( p_object );
287     }
288
289     /* Build menu */
290     RefreshMenu( p_intf, p_intf->p_sys->p_settings_menu, hMenu, i,
291                  ppsz_varnames, pi_objects, SettingsMenu_Events );
292 }
293
294 /*****************************************************************************
295  * Refresh the menu.
296  *****************************************************************************/
297 void RefreshMenu( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList,
298                   HMENU hMenu , int i_count, char **ppsz_varnames, 
299                   int *pi_objects, int i_start_id )
300 {
301     vlc_object_t *p_object;
302     vlc_bool_t b_section_empty = VLC_FALSE;
303     int i;
304
305     /* Initializations */
306     int i_item_id = i_start_id;
307
308     for( i = 0; i < i_count; i++ )
309     {
310         if( !ppsz_varnames[i] )
311         {
312             if( b_section_empty )
313             {
314                 AppendMenu( hMenu, MF_GRAYED | MF_STRING,
315                             MenuDummy_Event + i, _T("Empty") );
316             }
317
318             AppendMenu( hMenu, MF_SEPARATOR, 0, _T("") );
319             b_section_empty = VLC_TRUE;
320             continue;
321         }
322
323         if( !pi_objects[i] )
324         {
325             AppendMenu( hMenu, MF_GRAYED | MF_STRING,
326                         MenuDummy_Event, _FROMMB(ppsz_varnames[i]) );
327
328             b_section_empty = VLC_FALSE;
329             continue;
330         }
331
332         p_object = (vlc_object_t *)vlc_object_get( p_intf, pi_objects[i] );
333         if( p_object == NULL ) continue;
334
335         b_section_empty = VLC_FALSE;
336         CreateMenuItem( p_intf, _p_menuList, hMenu, ppsz_varnames[i],
337                         p_object, &i_item_id );
338         vlc_object_release( p_object );
339     }
340
341     /* Special case for empty menus */
342     if( wce_GetMenuItemCount(hMenu) == 0 || b_section_empty )
343     {
344         AppendMenu( hMenu, MF_GRAYED | MF_STRING,
345                     MenuDummy_Event + i, _T("Empty") );
346     }
347 }
348
349 /*****************************************************************************
350  * Private methods.
351  *****************************************************************************/
352 void CreateMenuItem( intf_thread_t *p_intf, vector<MenuItemExt*> *_p_menuList,
353                      HMENU hMenu, char *psz_var, vlc_object_t *p_object,
354                      int *pi_item_id )
355 {
356     MenuItemExt *pMenuItemExt;
357     HMENU hMenuItem;
358     vlc_value_t val, text;
359     int i_type;
360
361     /* Check the type of the object variable */
362     i_type = var_Type( p_object, psz_var );
363
364     switch( i_type & VLC_VAR_TYPE )
365     {
366     case VLC_VAR_VOID:
367     case VLC_VAR_BOOL:
368     case VLC_VAR_VARIABLE:
369     case VLC_VAR_STRING:
370     case VLC_VAR_INTEGER:
371     case VLC_VAR_FLOAT:
372         break;
373     default:
374         /* Variable doesn't exist or isn't handled */
375         return;
376     }
377
378     /* Make sure we want to display the variable */
379     if( i_type & VLC_VAR_HASCHOICE )
380     {
381         var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
382         if( val.i_int == 0 ) return;
383         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
384             return;
385     }
386
387     /* Get the descriptive name of the variable */
388     var_Change( p_object, psz_var, VLC_VAR_GETTEXT, &text, NULL );
389
390     var_Get( p_object, psz_var, &val );
391
392     if( i_type & VLC_VAR_HASCHOICE )
393     {
394         hMenuItem = CreateChoicesMenu( p_intf, _p_menuList, psz_var,
395                                        p_object, pi_item_id );
396         AppendMenu( hMenu, MF_STRING | MF_POPUP, (UINT)hMenuItem,
397                     _FROMMB(text.psz_string ? text.psz_string : psz_var) );
398         if( text.psz_string ) free( text.psz_string );
399         return;
400     }
401
402     switch( i_type & VLC_VAR_TYPE )
403     {
404     case VLC_VAR_VOID:
405         AppendMenu( hMenu, MF_STRING , ++(*pi_item_id),
406                     _FROMMB(text.psz_string ? text.psz_string : psz_var) );
407         pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
408                                         p_object->i_object_id, val, i_type );
409         _p_menuList->push_back( pMenuItemExt );
410         break;
411
412     case VLC_VAR_BOOL:
413         val.b_bool = !val.b_bool;
414         AppendMenu( hMenu, MF_STRING | MF_CHECKED, ++(*pi_item_id),
415                     _FROMMB(text.psz_string ? text.psz_string : psz_var) );
416         pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
417                                         p_object->i_object_id, val, i_type );
418         _p_menuList->push_back( pMenuItemExt );
419         CheckMenuItem( hMenu, *pi_item_id ,
420                        ( val.b_bool ? MF_UNCHECKED : MF_CHECKED ) |
421                        MF_BYCOMMAND ); 
422         break;
423
424     default:
425         if( text.psz_string ) free( text.psz_string );
426         return;
427     }
428
429     if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
430     if( text.psz_string ) free( text.psz_string );
431 }
432
433 HMENU CreateChoicesMenu( intf_thread_t *p_intf,
434                          vector<MenuItemExt*> *_p_menuList, char *psz_var, 
435                          vlc_object_t *p_object, int *pi_item_id )
436 {
437     MenuItemExt *pMenuItemExt;
438     vlc_value_t val, val_list, text_list;
439     int i_type, i;
440     HMENU hSubMenu = CreatePopupMenu();
441
442     /* Check the type of the object variable */
443     i_type = var_Type( p_object, psz_var );
444
445     /* Make sure we want to display the variable */
446     if( i_type & VLC_VAR_HASCHOICE )
447     {
448         var_Change( p_object, psz_var, VLC_VAR_CHOICESCOUNT, &val, NULL );
449         if( val.i_int == 0 ) return NULL;
450         if( (i_type & VLC_VAR_TYPE) != VLC_VAR_VARIABLE && val.i_int == 1 )
451             return NULL;
452     }
453     else
454     {
455         return NULL;
456     }
457
458     switch( i_type & VLC_VAR_TYPE )
459     {
460     case VLC_VAR_VOID:
461     case VLC_VAR_BOOL:
462     case VLC_VAR_VARIABLE:
463     case VLC_VAR_STRING:
464     case VLC_VAR_INTEGER:
465         break;
466     default:
467         /* Variable doesn't exist or isn't handled */
468         return NULL;
469     }
470
471     if( var_Get( p_object, psz_var, &val ) < 0 ) return NULL;
472
473     if( var_Change( p_object, psz_var, VLC_VAR_GETLIST,
474                     &val_list, &text_list ) < 0 )
475     {
476         if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
477         return NULL;
478     }
479
480     for( i = 0; i < val_list.p_list->i_count; i++ )
481     {
482         vlc_value_t another_val;
483         HMENU hMenuItem;
484         char *psz_tmp;
485
486         switch( i_type & VLC_VAR_TYPE )
487         {
488         case VLC_VAR_VARIABLE:
489             hMenuItem = CreateChoicesMenu( p_intf, _p_menuList,
490               val_list.p_list->p_values[i].psz_string, p_object, pi_item_id );
491             AppendMenu( hSubMenu, MF_STRING | MF_POPUP, (UINT)hMenuItem,
492                         _FROMMB(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             break;
496
497         case VLC_VAR_STRING:
498             another_val.psz_string =
499                 strdup(val_list.p_list->p_values[i].psz_string);
500             AppendMenu( hSubMenu, MF_STRING, ++(*pi_item_id),
501                         _FROMMB(text_list.p_list->p_values[i].psz_string ?
502                           text_list.p_list->p_values[i].psz_string :
503                           val_list.p_list->p_values[i].psz_string) );
504             pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
505                           p_object->i_object_id, another_val, i_type );
506             _p_menuList->push_back( pMenuItemExt );
507
508             if( !(i_type & VLC_VAR_ISCOMMAND) && val.psz_string &&
509                 !strcmp( val.psz_string,
510                          val_list.p_list->p_values[i].psz_string ) )
511               CheckMenuItem( hSubMenu, *pi_item_id, MF_CHECKED | MF_BYCOMMAND);
512             break;
513
514         case VLC_VAR_INTEGER:
515             asprintf( &psz_tmp, "%d", val_list.p_list->p_values[i].i_int );
516             AppendMenu( hSubMenu, MF_STRING, ++(*pi_item_id),
517                         _FROMMB(text_list.p_list->p_values[i].psz_string ?
518                           text_list.p_list->p_values[i].psz_string : psz_tmp));
519             pMenuItemExt = new MenuItemExt( p_intf, *pi_item_id, psz_var,
520                 p_object->i_object_id, val_list.p_list->p_values[i], i_type );
521             _p_menuList->push_back( pMenuItemExt );
522
523             if( val_list.p_list->p_values[i].i_int == val.i_int )
524               CheckMenuItem( hSubMenu, *pi_item_id, MF_CHECKED | MF_BYCOMMAND);
525             break;
526
527         default:
528             break;
529         }
530     }
531
532     /* Clean up everything */
533     if( (i_type & VLC_VAR_TYPE) == VLC_VAR_STRING ) free( val.psz_string );
534     var_Change( p_object, psz_var, VLC_VAR_FREELIST, &val_list, &text_list );
535
536     return hSubMenu;
537 }
538
539 int wce_GetMenuItemCount(HMENU hMenu)
540 {
541     const int MAX_NUM_ITEMS = 256;
542     int iPos, iCount;
543
544     MENUITEMINFO mii;
545     memset( (char *)&mii, 0, sizeof(MENUITEMINFO) );
546     mii.cbSize = sizeof(MENUITEMINFO);
547
548     iCount = 0;
549     for( iPos = 0; iPos < MAX_NUM_ITEMS; iPos++ )
550     {
551         if( !GetMenuItemInfo(hMenu, (UINT)iPos, TRUE, &mii) ) break;
552         iCount++;
553     }
554
555     return iCount;
556 }
557
558 void OnMenuEvent( intf_thread_t *p_intf, int id )
559 {
560     MenuItemExt *p_menuitemext = NULL;
561     vector<MenuItemExt*>::iterator iter;
562
563     for( iter = p_intf->p_sys->p_settings_menu->begin();
564          iter != p_intf->p_sys->p_settings_menu->end(); iter++ )
565         if( (*iter)->id == id )
566         {
567             p_menuitemext = *iter;
568             break;
569         }
570     for( iter = p_intf->p_sys->p_audio_menu->begin();
571          iter != p_intf->p_sys->p_audio_menu->end(); iter++ ) 
572         if( (*iter)->id == id )
573         {
574             p_menuitemext = *iter;
575             break;
576         }
577     for( iter = p_intf->p_sys->p_video_menu->begin();
578          iter != p_intf->p_sys->p_video_menu->end(); iter++ )
579         if( (*iter)->id == id )
580         {
581             p_menuitemext = *iter;
582             break;
583         }
584     for( iter = p_intf->p_sys->p_navig_menu->begin();
585          iter != p_intf->p_sys->p_navig_menu->end(); iter++ )
586         if( (*iter)->id == id )
587         {
588             p_menuitemext = *iter;
589             break;
590         }
591
592     if( p_menuitemext )
593     {
594         vlc_object_t *p_object = (vlc_object_t *)
595             vlc_object_get( p_intf, p_menuitemext->i_object_id );
596         if( p_object == NULL ) return;
597
598         var_Set( p_object, p_menuitemext->psz_var, p_menuitemext->val );
599         int i_type = var_Type( p_object, p_menuitemext->psz_var );
600         switch( i_type & VLC_VAR_TYPE )
601         {
602         case VLC_VAR_VOID:
603         case VLC_VAR_BOOL:
604         case VLC_VAR_VARIABLE:
605         case VLC_VAR_STRING:
606         case VLC_VAR_INTEGER:
607             break;
608         default:
609             /* Variable doesn't exist or isn't handled */
610             return;
611         }
612
613         vlc_object_release( p_object );
614     }
615 }
616
617 /*****************************************************************************
618  * A small helper class which encapsulate wxMenuitem with some other useful
619  * things.
620  *****************************************************************************/
621 MenuItemExt::MenuItemExt( intf_thread_t *p_intf, int _id, char *_psz_var,
622                           int _i_object_id, vlc_value_t _val, int _i_val_type )
623 {
624     /* Initializations */
625     id = _id;
626     p_intf = p_intf;
627     psz_var = strdup( _psz_var );
628     i_val_type = _i_val_type;
629     i_object_id = _i_object_id;
630     val = _val;
631 };
632
633 MenuItemExt::~MenuItemExt()
634 {
635     if( psz_var ) free( psz_var );
636     if( ((i_val_type & VLC_VAR_TYPE) == VLC_VAR_STRING)
637         && val.psz_string ) free( val.psz_string );
638 };