1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.68 2003/11/09 20:13:46 gbazin Exp $
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 #ifdef WIN32 /* mingw32 hack */
29 /* Let vlc take care of the i18n stuff */
30 #define WXINTL_NO_GETTEXT_MACRO
32 #include <wx/wxprec.h>
35 #include <wx/listctrl.h>
36 #include <wx/textctrl.h>
37 #include <wx/notebook.h>
38 #include <wx/spinctrl.h>
40 #include <wx/treectrl.h>
45 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
52 #define SLIDER_MAX_POS 10000
54 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
55 #if defined( ENABLE_NLS ) && defined( HAVE_GETTEXT ) && \
56 defined( WIN32 ) && !defined( HAVE_INCLUDED_GETTEXT )
58 # define wxU(utf8) wxString(utf8, wxConvUTF8)
60 # define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
64 #else // ENABLE_NLS && HAVE_GETTEXT && WIN32 && !HAVE_INCLUDED_GETTEXT
66 # define wxU(ansi) wxString(ansi, *wxConvCurrent)
68 # define wxU(ansi) ansi
84 wxArrayString SeparateEntries( wxString );
86 /*****************************************************************************
87 * intf_sys_t: description and status of wxwindows interface
88 *****************************************************************************/
91 /* the wx parent window */
98 /* The input thread */
99 input_thread_t * p_input;
102 int i_slider_pos; /* slider position */
103 int i_slider_oldpos; /* previous position */
104 vlc_bool_t b_slider_free; /* slider status */
106 /* The messages window */
107 msg_subscription_t* p_sub; /* message bank subscription */
109 /* Playlist management */
110 int i_playing; /* playlist selected item */
112 /* Send an event to show a dialog */
113 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
114 intf_dialog_args_t *p_arg );
117 wxMenu *p_popup_menu;
121 /*****************************************************************************
123 *****************************************************************************/
125 /*****************************************************************************
126 * Classes declarations.
127 *****************************************************************************/
131 class Timer: public wxTimer
135 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
138 virtual void Notify();
141 intf_thread_t *p_intf;
142 Interface *p_main_interface;
143 int i_old_playing_status;
148 class Interface: public wxFrame
152 Interface( intf_thread_t *p_intf );
153 virtual ~Interface();
154 void TogglePlayButton( int i_playing_status );
156 // wxFlexGridSizer *frame_sizer;
157 wxBoxSizer *frame_sizer;
158 wxStatusBar *statusbar;
161 wxWindow *slider_frame;
162 wxWindow *extra_frame;
163 wxStaticBox *slider_box;
167 wxStaticBox *adjust_box;
168 wxSlider *brightness_slider;
169 wxSlider *contrast_slider;
170 wxSlider *saturation_slider;
171 wxSlider *hue_slider;
173 wxStaticBox *other_box;
174 wxComboBox *ratio_combo;
179 void UpdateAcceleratorTable();
180 void CreateOurMenuBar();
181 void CreateOurToolBar();
182 void CreateOurExtraPanel();
183 void CreateOurSlider();
184 void Open( int i_access_method );
186 /* Event handlers (these functions should _not_ be virtual) */
187 void OnExit( wxCommandEvent& event );
188 void OnAbout( wxCommandEvent& event );
190 void OnOpenFileSimple( wxCommandEvent& event );
191 void OnOpenFile( wxCommandEvent& event );
192 void OnOpenDisc( wxCommandEvent& event );
193 void OnOpenNet( wxCommandEvent& event );
194 void OnOpenSat( wxCommandEvent& event );
195 void OnOpenV4L( wxCommandEvent& event );
196 void OnStream( wxCommandEvent& event );
197 void OnExtra( wxCommandEvent& event );
198 void OnShowDialog( wxCommandEvent& event );
199 void OnPlayStream( wxCommandEvent& event );
200 void OnStopStream( wxCommandEvent& event );
201 void OnSliderUpdate( wxScrollEvent& event );
202 void OnPrevStream( wxCommandEvent& event );
203 void OnNextStream( wxCommandEvent& event );
204 void OnSlowStream( wxCommandEvent& event );
205 void OnFastStream( wxCommandEvent& event );
207 void OnEnableAdjust( wxCommandEvent& event );
208 void OnHueUpdate( wxScrollEvent& event );
209 void OnContrastUpdate( wxScrollEvent& event );
210 void OnBrightnessUpdate( wxScrollEvent& event );
211 void OnSaturationUpdate( wxScrollEvent& event );
213 void OnRatio( wxCommandEvent& event );
214 void OnEnableVisual( wxCommandEvent& event );
216 void OnMenuOpen( wxMenuEvent& event );
218 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
219 void OnContextMenu2(wxContextMenuEvent& event);
221 void OnContextMenu(wxMouseEvent& event);
223 DECLARE_EVENT_TABLE();
226 intf_thread_t *p_intf;
229 int i_old_playing_status;
231 /* For auto-generated menus */
232 wxMenu *p_audio_menu;
233 vlc_bool_t b_audio_menu;
234 wxMenu *p_video_menu;
235 vlc_bool_t b_video_menu;
236 wxMenu *p_navig_menu;
237 vlc_bool_t b_navig_menu;
239 vlc_bool_t b_misc_menu;
244 /* Dialogs Provider */
245 class DialogsProvider: public wxFrame
249 DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
250 virtual ~DialogsProvider();
253 void Open( int i_access_method, int i_arg );
255 /* Event handlers (these functions should _not_ be virtual) */
256 void OnExit( wxCommandEvent& event );
257 void OnPlaylist( wxCommandEvent& event );
258 void OnMessages( wxCommandEvent& event );
259 void OnFileInfo( wxCommandEvent& event );
260 void OnPreferences( wxCommandEvent& event );
261 void OnStreamDialog( wxCommandEvent& event );
263 void OnOpenFileGeneric( wxCommandEvent& event );
264 void OnOpenFileSimple( wxCommandEvent& event );
265 void OnOpenFile( wxCommandEvent& event );
266 void OnOpenDisc( wxCommandEvent& event );
267 void OnOpenNet( wxCommandEvent& event );
268 void OnOpenSat( wxCommandEvent& event );
270 void OnPopupMenu( wxCommandEvent& event );
272 void OnIdle( wxIdleEvent& event );
274 void OnExitThread( wxCommandEvent& event );
276 DECLARE_EVENT_TABLE();
278 intf_thread_t *p_intf;
281 /* Secondary windows */
282 OpenDialog *p_open_dialog;
283 wxFileDialog *p_file_dialog;
284 Playlist *p_playlist_dialog;
285 Messages *p_messages_dialog;
286 FileInfo *p_fileinfo_dialog;
287 StreamDialog *p_stream_dialog;
288 wxFrame *p_prefs_dialog;
289 wxFileDialog *p_file_generic_dialog;
295 class SubsFileDialog;
296 class OpenDialog: public wxFrame
300 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
301 int i_access_method, int i_arg = 0 );
303 /* Extended Contructor */
304 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
305 int i_access_method, int i_arg = 0 , int _i_method = 0 );
306 virtual ~OpenDialog();
309 int Show( int i_access_method, int i_arg = 0 );
314 wxPanel *FilePanel( wxWindow* parent );
315 wxPanel *DiscPanel( wxWindow* parent );
316 wxPanel *NetPanel( wxWindow* parent );
317 wxPanel *V4LPanel( wxWindow* parent );
318 wxPanel *AutoBuildPanel( wxWindow* parent, const module_t * );
320 void UpdateMRL( int i_access_method );
322 /* Event handlers (these functions should _not_ be virtual) */
323 void OnOk( wxCommandEvent& event );
324 void OnCancel( wxCommandEvent& event );
326 void OnPageChange( wxNotebookEvent& event );
327 void OnMRLChange( wxCommandEvent& event );
329 /* Event handlers for the file page */
330 void OnFilePanelChange( wxCommandEvent& event );
331 void OnFileBrowse( wxCommandEvent& event );
333 /* Event handlers for the disc page */
334 void OnDiscPanelChange( wxCommandEvent& event );
335 void OnDiscTypeChange( wxCommandEvent& event );
337 /* Event handlers for the net page */
338 void OnNetPanelChange( wxCommandEvent& event );
339 void OnNetTypeChange( wxCommandEvent& event );
341 /* Event handlers for the v4l page */
342 void OnV4LPanelChange( wxCommandEvent& event );
343 void OnV4LTypeChange( wxCommandEvent& event );
344 void OnV4LSettingsChange( wxCommandEvent& event );
346 /* Event handlers for the stream output */
347 void OnSubsFileEnable( wxCommandEvent& event );
348 void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
350 /* Event handlers for the stream output */
351 void OnSoutEnable( wxCommandEvent& event );
352 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
354 DECLARE_EVENT_TABLE();
356 intf_thread_t *p_intf;
358 int i_current_access_method;
360 int i_method; /* Normal or for the stream dialog ? */
361 wxComboBox *mrl_combo;
362 wxNotebook *notebook;
364 /* Controls for the file panel */
365 wxComboBox *file_combo;
366 wxFileDialog *file_dialog;
368 /* Controls for the disc panel */
369 wxRadioBox *disc_type;
370 wxTextCtrl *disc_device;
371 wxSpinCtrl *disc_title;
373 wxSpinCtrl *disc_chapter;
376 /* Controls for the net panel */
377 wxRadioBox *net_type;
379 wxPanel *net_subpanels[4];
380 wxRadioButton *net_radios[4];
381 wxSpinCtrl *net_ports[4];
383 wxTextCtrl *net_addrs[4];
385 /* Controls for the v4l panel */
386 wxRadioBox *video_type;
387 wxTextCtrl *video_device;
388 wxSpinCtrl *video_channel;
389 wxButton *v4l_button;
390 V4LDialog *v4l_dialog;
391 wxArrayString v4l_mrl;
393 /* Controls for the subtitles file */
394 wxButton *subsfile_button;
395 wxCheckBox *subsfile_checkbox;
396 SubsFileDialog *subsfile_dialog;
397 wxArrayString subsfile_mrl;
399 /* Controls for the stream output */
400 wxButton *sout_button;
401 wxCheckBox *sout_checkbox;
402 SoutDialog *sout_dialog;
403 wxArrayString sout_mrl;
417 class V4LDialog: public wxDialog
421 V4LDialog( intf_thread_t *p_intf, wxWindow *p_parent );
422 virtual ~V4LDialog();
424 wxArrayString GetOptions();
428 wxPanel *AudioPanel( wxWindow* parent );
429 wxPanel *CommonPanel( wxWindow* parent );
430 wxPanel *BitratePanel( wxWindow* parent );
433 /* Event handlers (these functions should _not_ be virtual) */
434 void OnOk( wxCommandEvent& event );
435 void OnCancel( wxCommandEvent& event );
436 void OnMRLChange( wxCommandEvent& event );
437 void OnAudioEnable( wxCommandEvent& event );
438 void OnAudioChannel( wxCommandEvent& event );
439 void OnSizeEnable( wxCommandEvent& event );
440 void OnSize( wxCommandEvent& event );
441 void OnNormEnable( wxCommandEvent& event );
442 void OnNorm( wxCommandEvent& event );
443 void OnFrequencyEnable( wxCommandEvent& event );
444 void OnFrequency( wxCommandEvent& event );
445 void OnBitrateEnable( wxCommandEvent& event );
446 void OnBitrate( wxCommandEvent& event );
447 void OnMaxBitrateEnable( wxCommandEvent& event );
448 void OnMaxBitrate( wxCommandEvent& event );
450 DECLARE_EVENT_TABLE();
452 intf_thread_t *p_intf;
455 wxComboBox *mrl_combo;
459 /* Controls for the v4l advanced options */
460 wxPanel *common_subpanel;
461 wxPanel *common_panel;
462 wxCheckBox *size_checkbox;
463 wxComboBox *size_combo;
464 wxCheckBox *norm_checkbox;
465 wxComboBox *norm_combo;
466 wxCheckBox *frequency_checkbox;
467 wxSpinCtrl *frequency;
469 wxPanel *audio_subpanel;
470 wxPanel *audio_panel;
471 wxCheckBox *audio_checkbox;
472 wxTextCtrl *audio_device;
473 wxSpinCtrl *audio_channel;
475 wxPanel *bitrate_subpanel;
476 wxPanel *bitrate_panel;
477 wxCheckBox *bitrate_checkbox;
479 wxCheckBox *maxbitrate_checkbox;
480 wxSpinCtrl *maxbitrate;
484 /* Stream output Dialog */
498 TS_ENCAPSULATION = 0,
515 class SoutDialog: public wxDialog
519 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
520 virtual ~SoutDialog();
522 wxArrayString GetOptions();
526 wxPanel *AccessPanel( wxWindow* parent );
527 wxPanel *MiscPanel( wxWindow* parent );
528 wxPanel *EncapsulationPanel( wxWindow* parent );
529 wxPanel *TranscodingPanel( wxWindow* parent );
532 /* Event handlers (these functions should _not_ be virtual) */
533 void OnOk( wxCommandEvent& event );
534 void OnCancel( wxCommandEvent& event );
535 void OnMRLChange( wxCommandEvent& event );
536 void OnAccessTypeChange( wxCommandEvent& event );
538 /* Event handlers for the file access output */
539 void OnFileChange( wxCommandEvent& event );
540 void OnFileBrowse( wxCommandEvent& event );
541 void OnFileDump( wxCommandEvent& event );
543 /* Event handlers for the net access output */
544 void OnNetChange( wxCommandEvent& event );
546 /* Event specific to the announce address */
547 void OnAnnounceAddrChange( wxCommandEvent& event );
549 /* Event handlers for the encapsulation panel */
550 void OnEncapsulationChange( wxCommandEvent& event );
552 /* Event handlers for the transcoding panel */
553 void OnTranscodingEnable( wxCommandEvent& event );
554 void OnTranscodingChange( wxCommandEvent& event );
556 /* Event handlers for the misc panel */
557 void OnSAPMiscChange( wxCommandEvent& event );
558 void OnSLPMiscChange( wxCommandEvent& event );
560 DECLARE_EVENT_TABLE();
562 intf_thread_t *p_intf;
565 wxComboBox *mrl_combo;
567 /* Controls for the access outputs */
568 wxPanel *access_panel;
569 wxPanel *access_subpanels[ACCESS_OUT_NUM];
570 wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
574 wxComboBox *file_combo;
575 wxCheckBox *dump_checkbox;
576 wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
577 wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
579 /* Controls for the SAP announces */
581 wxPanel *misc_subpanels[MISC_SOUT_NUM];
582 wxCheckBox *sap_checkbox;
583 wxCheckBox *slp_checkbox;
584 wxTextCtrl *announce_addr;
586 /* Controls for the encapsulation */
587 wxPanel *encapsulation_panel;
588 wxRadioButton *encapsulation_radios[ENCAPS_NUM];
589 int i_encapsulation_type;
591 /* Controls for transcoding */
592 wxPanel *transcoding_panel;
593 wxCheckBox *video_transc_checkbox;
594 wxComboBox *video_codec_combo;
595 wxComboBox *audio_codec_combo;
596 wxCheckBox *audio_transc_checkbox;
597 wxComboBox *video_bitrate_combo;
598 wxComboBox *audio_bitrate_combo;
599 wxComboBox *audio_channels_combo;
602 /* Subtitles File Dialog */
603 class SubsFileDialog: public wxDialog
607 SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
608 virtual ~SubsFileDialog();
610 wxComboBox *file_combo;
611 wxComboBox *encoding_combo;
612 wxSpinCtrl *delay_spinctrl;
613 wxSpinCtrl *fps_spinctrl;
616 /* Event handlers (these functions should _not_ be virtual) */
617 void OnOk( wxCommandEvent& event );
618 void OnCancel( wxCommandEvent& event );
619 void OnFileBrowse( wxCommandEvent& event );
621 DECLARE_EVENT_TABLE();
623 intf_thread_t *p_intf;
628 class StreamDialog: public wxFrame
632 StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
633 virtual ~StreamDialog();
636 void OnClose( wxCommandEvent& event );
637 void OnOpen( wxCommandEvent& event );
638 void OnSout( wxCommandEvent& event );
639 void OnStart( wxCommandEvent& event );
641 DECLARE_EVENT_TABLE();
643 intf_thread_t *p_intf;
645 wxStaticText *step2_label;
646 wxStaticText *step3_label;
647 wxButton *sout_button;
648 wxButton *start_button;
650 wxArrayString sout_mrl;
651 OpenDialog *p_open_dialog;
652 SoutDialog *p_sout_dialog;
657 /* Preferences Dialog */
659 class PrefsDialog: public wxFrame
663 PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
664 virtual ~PrefsDialog();
667 wxPanel *PrefsPanel( wxWindow* parent );
669 /* Event handlers (these functions should _not_ be virtual) */
670 void OnOk( wxCommandEvent& event );
671 void OnCancel( wxCommandEvent& event );
672 void OnSave( wxCommandEvent& event );
673 void OnResetAll( wxCommandEvent& event );
674 void OnAdvanced( wxCommandEvent& event );
676 DECLARE_EVENT_TABLE();
678 intf_thread_t *p_intf;
680 PrefsTreeCtrl *prefs_tree;
684 class Messages: public wxFrame
688 Messages( intf_thread_t *p_intf, wxWindow *p_parent );
690 bool Show( bool show = TRUE );
694 /* Event handlers (these functions should _not_ be virtual) */
695 void OnClose( wxCommandEvent& event );
696 void OnClear( wxCommandEvent& event );
697 void OnSaveLog( wxCommandEvent& event );
699 DECLARE_EVENT_TABLE();
701 intf_thread_t *p_intf;
702 wxTextCtrl *textctrl;
703 wxTextAttr *info_attr;
704 wxTextAttr *err_attr;
705 wxTextAttr *warn_attr;
706 wxTextAttr *dbg_attr;
708 wxFileDialog *save_log_dialog;
710 vlc_bool_t b_verbose;
714 class ItemInfoDialog;
716 class Playlist: public wxFrame
720 Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
723 void UpdatePlaylist();
724 void ShowPlaylist( bool show );
730 void DeleteItem( int item );
732 /* Event handlers (these functions should _not_ be virtual) */
733 void OnAddFile( wxCommandEvent& event );
734 void OnAddMRL( wxCommandEvent& event );
735 void OnClose( wxCommandEvent& event );
736 void OnSearch( wxCommandEvent& event );
737 void OnEnDis( wxCommandEvent& event );
738 void OnInfos( wxCommandEvent& event );
739 void OnSearchTextChange( wxCommandEvent& event );
740 void OnOpen( wxCommandEvent& event );
741 void OnSave( wxCommandEvent& event );
743 void OnSort( wxCommandEvent& event );
745 void OnUp( wxCommandEvent& event);
746 void OnDown( wxCommandEvent& event);
748 void OnEnableSelection( wxCommandEvent& event );
749 void OnDisableSelection( wxCommandEvent& event );
750 void OnInvertSelection( wxCommandEvent& event );
751 void OnDeleteSelection( wxCommandEvent& event );
752 void OnSelectAll( wxCommandEvent& event );
753 void OnRandom( wxCommandEvent& event );
754 void OnRepeat( wxCommandEvent& event );
755 void OnLoop ( wxCommandEvent& event );
756 void OnActivateItem( wxListEvent& event );
757 void OnKeyDown( wxListEvent& event );
758 void OnNewGroup( wxCommandEvent& event );
762 wxTextCtrl *search_text;
763 wxButton *search_button;
764 DECLARE_EVENT_TABLE();
767 ItemInfoDialog *iteminfo_dialog;
769 intf_thread_t *p_intf;
770 wxListView *listview;
771 wxTreeCtrl *treeview;
772 int i_update_counter;
777 class NewGroup: public wxDialog
781 NewGroup( intf_thread_t *p_intf, wxWindow *p_parent );
786 /* Event handlers (these functions should _not_ be virtual) */
787 void OnOk( wxCommandEvent& event );
788 void OnCancel( wxCommandEvent& event );
790 DECLARE_EVENT_TABLE();
792 intf_thread_t *p_intf;
793 wxTextCtrl *groupname;
796 friend class Playlist;
797 friend class ItemInfoDialog;
802 /* ItemInfo Dialog */
803 class ItemInfoDialog: public wxDialog
807 ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
808 wxWindow *p_parent );
809 virtual ~ItemInfoDialog();
811 wxArrayString GetOptions();
814 wxPanel *InfoPanel( wxWindow* parent );
815 wxPanel *GroupPanel( wxWindow* parent );
817 /* Event handlers (these functions should _not_ be virtual) */
818 void OnOk( wxCommandEvent& event );
819 void OnCancel( wxCommandEvent& event );
820 void OnNewGroup( wxCommandEvent& event );
822 DECLARE_EVENT_TABLE();
824 intf_thread_t *p_intf;
825 playlist_item_t *p_item;
828 /* Controls for the iteminfo dialog box */
829 wxPanel *info_subpanel;
832 wxPanel *group_subpanel;
833 wxPanel *group_panel;
835 wxTextCtrl *uri_text;
836 wxTextCtrl *name_text;
837 wxTextCtrl *author_text;
839 wxCheckBox *enabled_checkbox;
840 wxComboBox *group_combo;
846 class FileInfo: public wxFrame
850 FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
852 void UpdateFileInfo();
855 void OnClose( wxCommandEvent& event );
857 DECLARE_EVENT_TABLE();
859 intf_thread_t *p_intf;
860 wxTreeCtrl *fileinfo_tree;
861 wxTreeItemId fileinfo_root;
862 wxString fileinfo_root_label;
867 #if !defined(__WXX11__)
868 /* Drag and Drop class */
869 class DragAndDrop: public wxFileDropTarget
872 DragAndDrop( intf_thread_t *_p_intf );
874 virtual bool OnDropFiles( wxCoord x, wxCoord y,
875 const wxArrayString& filenames );
878 intf_thread_t *p_intf;
883 void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
884 const wxPoint& pos );
885 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
886 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
887 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
888 wxMenu *MiscMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
890 class MenuEvtHandler : public wxEvtHandler
893 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
894 virtual ~MenuEvtHandler();
896 void OnMenuEvent( wxCommandEvent& event );
897 void OnShowDialog( wxCommandEvent& event );
901 DECLARE_EVENT_TABLE()
903 intf_thread_t *p_intf;
904 Interface *p_main_interface;
907 class Menu: public wxMenu
911 Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
912 char **ppsz_names, int *pi_objects, int i_start_id );
916 /* Event handlers (these functions should _not_ be virtual) */
917 void OnClose( wxCommandEvent& event );
918 void OnShowDialog( wxCommandEvent& event );
919 void OnEntrySelected( wxCommandEvent& event );
921 wxMenu *Menu::CreateDummyMenu();
922 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
923 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
925 DECLARE_EVENT_TABLE();
927 intf_thread_t *p_intf;
932 static inline int ConvertHotkeyModifiers( int i_hotkey )
934 int i_accel_flags = 0;
935 if( i_hotkey & KEY_MODIFIER_ALT ) i_accel_flags |= wxACCEL_ALT;
936 if( i_hotkey & KEY_MODIFIER_CTRL ) i_accel_flags |= wxACCEL_CTRL;
937 if( i_hotkey & KEY_MODIFIER_SHIFT ) i_accel_flags |= wxACCEL_SHIFT;
938 return i_accel_flags;
941 static inline int ConvertHotkey( int i_hotkey )
943 int i_key = i_hotkey & ~KEY_MODIFIER;
944 if( i_key & KEY_ASCII ) return i_key & KEY_ASCII;
945 else if( i_key & KEY_SPECIAL )
949 case KEY_LEFT: return WXK_LEFT;
950 case KEY_RIGHT: return WXK_RIGHT;
951 case KEY_UP: return WXK_UP;
952 case KEY_DOWN: return WXK_DOWN;
953 case KEY_SPACE: return WXK_SPACE;
954 case KEY_ENTER: return WXK_RETURN;
955 case KEY_F1: return WXK_F1;
956 case KEY_F2: return WXK_F2;
957 case KEY_F3: return WXK_F3;
958 case KEY_F4: return WXK_F4;
959 case KEY_F5: return WXK_F5;
960 case KEY_F6: return WXK_F6;
961 case KEY_F7: return WXK_F7;
962 case KEY_F8: return WXK_F8;
963 case KEY_F9: return WXK_F9;
964 case KEY_F10: return WXK_F10;
965 case KEY_F11: return WXK_F11;
966 case KEY_F12: return WXK_F12;
967 case KEY_HOME: return WXK_HOME;
968 case KEY_END: return WXK_HOME;
969 case KEY_MENU: return WXK_MENU;
970 case KEY_ESC: return WXK_ESCAPE;
971 case KEY_PAGEUP: return WXK_PRIOR;
972 case KEY_PAGEDOWN: return WXK_NEXT;
973 case KEY_TAB: return WXK_TAB;
974 case KEY_BACKSPACE: return WXK_BACK;