]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/wxwindows.h
45e38ad27d9510c05f2dc048525621536c6e62c7
[vlc] / modules / gui / wxwindows / wxwindows.h
1 /*****************************************************************************
2  * wxwindows.h: private wxWindows interface description
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  * $Id: wxwindows.h,v 1.64 2003/10/08 19:40:42 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 #ifdef WIN32                                                 /* mingw32 hack */
25 #undef Yield
26 #undef CreateDialog
27 #endif
28
29 /* Let vlc take care of the i18n stuff */
30 #define WXINTL_NO_GETTEXT_MACRO
31
32 #include <wx/wxprec.h>
33 #include <wx/wx.h>
34
35 #include <wx/listctrl.h>
36 #include <wx/textctrl.h>
37 #include <wx/notebook.h>
38 #include <wx/spinctrl.h>
39 #include <wx/dnd.h>
40 #include <wx/treectrl.h>
41 #include <wx/gauge.h>
42 #include <wx/accel.h>
43 #include "vlc_keys.h"
44
45 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
46
47 class OpenDialog;
48 class Playlist;
49 class Messages;
50 class FileInfo;
51
52 #define SLIDER_MAX_POS 10000
53
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 )
57 #if wxUSE_UNICODE
58 #   define wxU(utf8) wxString(utf8, wxConvUTF8)
59 #else
60 #   define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
61 #endif
62 #define ISUTF8 1
63
64 #else // ENABLE_NLS && HAVE_GETTEXT && WIN32 && !HAVE_INCLUDED_GETTEXT
65 #if wxUSE_UNICODE
66 #   define wxU(ansi) wxString(ansi, *wxConvCurrent)
67 #else
68 #   define wxU(ansi) ansi
69 #endif
70 #define ISUTF8 0
71
72 #endif
73
74 #define WRAPCOUNT 80
75
76 wxArrayString SeparateEntries( wxString );
77
78 /*****************************************************************************
79  * intf_sys_t: description and status of wxwindows interface
80  *****************************************************************************/
81 struct intf_sys_t
82 {
83     /* the wx parent window */
84     wxWindow            *p_wxwindow;
85     wxIcon              *p_icon;
86
87     /* special actions */
88     vlc_bool_t          b_playing;
89
90     /* The input thread */
91     input_thread_t *    p_input;
92
93     /* The slider */
94     int                 i_slider_pos;                     /* slider position */
95     int                 i_slider_oldpos;                /* previous position */
96     vlc_bool_t          b_slider_free;                      /* slider status */
97
98     /* The messages window */
99     msg_subscription_t* p_sub;                  /* message bank subscription */
100
101     /* Playlist management */
102     int                 i_playing;                 /* playlist selected item */
103
104     /* Send an event to show a dialog */
105     void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
106                              intf_dialog_args_t *p_arg );
107
108     /* Popup menu */
109     wxMenu              *p_popup_menu;
110
111 };
112
113 /*****************************************************************************
114  * Prototypes
115  *****************************************************************************/
116
117 /*****************************************************************************
118  * Classes declarations.
119  *****************************************************************************/
120 class Interface;
121
122 /* Timer */
123 class Timer: public wxTimer
124 {
125 public:
126     /* Constructor */
127     Timer( intf_thread_t *p_intf, Interface *p_main_interface );
128     virtual ~Timer();
129
130     virtual void Notify();
131
132 private:
133     intf_thread_t *p_intf;
134     Interface *p_main_interface;
135     int i_old_playing_status;
136     int i_old_rate;
137 };
138
139 /* Main Interface */
140 class Interface: public wxFrame
141 {
142 public:
143     /* Constructor */
144     Interface( intf_thread_t *p_intf );
145     virtual ~Interface();
146     void TogglePlayButton( int i_playing_status );
147
148 //    wxFlexGridSizer *frame_sizer;
149     wxBoxSizer  *frame_sizer;
150     wxStatusBar *statusbar;
151
152     wxSlider    *slider;
153     wxWindow    *slider_frame;
154     wxWindow    *extra_frame;
155     wxStaticBox *slider_box;
156
157     vlc_bool_t b_extra;
158
159     wxStaticBox *adjust_box;
160     wxSlider *brightness_slider;
161     wxSlider *contrast_slider;
162     wxSlider *saturation_slider;
163     wxSlider *hue_slider;
164
165     wxStaticBox *other_box;
166     wxComboBox *ratio_combo;
167
168     wxGauge     *volctrl;
169
170 private:
171     void UpdateAcceleratorTable();
172     void CreateOurMenuBar();
173     void CreateOurToolBar();
174     void CreateOurExtraPanel();
175     void CreateOurSlider();
176     void Open( int i_access_method );
177
178     /* Event handlers (these functions should _not_ be virtual) */
179     void OnExit( wxCommandEvent& event );
180     void OnAbout( wxCommandEvent& event );
181
182     void OnOpenFileSimple( wxCommandEvent& event );
183     void OnOpenFile( wxCommandEvent& event );
184     void OnOpenDisc( wxCommandEvent& event );
185     void OnOpenNet( wxCommandEvent& event );
186     void OnOpenSat( wxCommandEvent& event );
187     void OnOpenV4L( wxCommandEvent& event );
188     void OnExtra( wxCommandEvent& event );
189     void OnShowDialog( wxCommandEvent& event );
190     void OnPlayStream( wxCommandEvent& event );
191     void OnStopStream( wxCommandEvent& event );
192     void OnSliderUpdate( wxScrollEvent& event );
193     void OnPrevStream( wxCommandEvent& event );
194     void OnNextStream( wxCommandEvent& event );
195     void OnSlowStream( wxCommandEvent& event );
196     void OnFastStream( wxCommandEvent& event );
197
198     void OnEnableAdjust( wxCommandEvent& event );
199     void OnHueUpdate( wxScrollEvent& event );
200     void OnContrastUpdate( wxScrollEvent& event );
201     void OnBrightnessUpdate( wxScrollEvent& event );
202     void OnSaturationUpdate( wxScrollEvent& event );
203
204     void OnRatio( wxCommandEvent& event );
205
206     void OnMenuOpen( wxMenuEvent& event );
207
208 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
209     void OnContextMenu2(wxContextMenuEvent& event);
210 #endif
211     void OnContextMenu(wxMouseEvent& event);
212
213     DECLARE_EVENT_TABLE();
214
215     Timer *timer;
216     intf_thread_t *p_intf;
217
218 private:
219     int i_old_playing_status;
220
221     /* For auto-generated menus */
222     wxMenu *p_audio_menu;
223     vlc_bool_t b_audio_menu;
224     wxMenu *p_video_menu;
225     vlc_bool_t b_video_menu;
226     wxMenu *p_navig_menu;
227     vlc_bool_t b_navig_menu;
228 };
229
230 /* Dialogs Provider */
231 class DialogsProvider: public wxFrame
232 {
233 public:
234     /* Constructor */
235     DialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
236     virtual ~DialogsProvider();
237
238 private:
239     void Open( int i_access_method, int i_arg );
240
241     /* Event handlers (these functions should _not_ be virtual) */
242     void OnExit( wxCommandEvent& event );
243     void OnPlaylist( wxCommandEvent& event );
244     void OnMessages( wxCommandEvent& event );
245     void OnFileInfo( wxCommandEvent& event );
246     void OnPreferences( wxCommandEvent& event );
247
248     void OnOpenFileGeneric( wxCommandEvent& event );
249     void OnOpenFileSimple( wxCommandEvent& event );
250     void OnOpenFile( wxCommandEvent& event );
251     void OnOpenDisc( wxCommandEvent& event );
252     void OnOpenNet( wxCommandEvent& event );
253     void OnOpenSat( wxCommandEvent& event );
254
255     void OnPopupMenu( wxCommandEvent& event );
256
257     void OnIdle( wxIdleEvent& event );
258
259     void OnExitThread( wxCommandEvent& event );
260
261     DECLARE_EVENT_TABLE();
262
263     intf_thread_t *p_intf;
264
265 public:
266     /* Secondary windows */
267     OpenDialog          *p_open_dialog;
268     wxFileDialog        *p_file_dialog;
269     Playlist            *p_playlist_dialog;
270     Messages            *p_messages_dialog;
271     FileInfo            *p_fileinfo_dialog;
272     wxFrame             *p_prefs_dialog;
273     wxFileDialog        *p_file_generic_dialog;
274 };
275
276 /* Open Dialog */
277 class V4LDialog;
278 class SoutDialog;
279 class SubsFileDialog;
280 class OpenDialog: public wxFrame
281 {
282 public:
283     /* Constructor */
284     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
285                 int i_access_method, int i_arg = 0 );
286     virtual ~OpenDialog();
287
288     int Show();
289     int Show( int i_access_method, int i_arg = 0 );
290
291     wxArrayString mrl;
292
293 private:
294     wxPanel *FilePanel( wxWindow* parent );
295     wxPanel *DiscPanel( wxWindow* parent );
296     wxPanel *NetPanel( wxWindow* parent );
297     wxPanel *SatPanel( wxWindow* parent );
298     wxPanel *V4LPanel( wxWindow* parent );
299
300     void UpdateMRL( int i_access_method );
301
302     /* Event handlers (these functions should _not_ be virtual) */
303     void OnOk( wxCommandEvent& event );
304     void OnCancel( wxCommandEvent& event );
305
306     void OnPageChange( wxNotebookEvent& event );
307     void OnMRLChange( wxCommandEvent& event );
308
309     /* Event handlers for the file page */
310     void OnFilePanelChange( wxCommandEvent& event );
311     void OnFileBrowse( wxCommandEvent& event );
312
313     /* Event handlers for the disc page */
314     void OnDiscPanelChange( wxCommandEvent& event );
315     void OnDiscTypeChange( wxCommandEvent& event );
316
317     /* Event handlers for the net page */
318     void OnNetPanelChange( wxCommandEvent& event );
319     void OnNetTypeChange( wxCommandEvent& event );
320
321     /* Event handlers for the v4l page */
322     void OnV4LPanelChange( wxCommandEvent& event );
323     void OnV4LTypeChange( wxCommandEvent& event );
324     void OnV4LSettingsChange( wxCommandEvent& event );
325
326     /* Event handlers for the stream output */
327     void OnSubsFileEnable( wxCommandEvent& event );
328     void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
329
330     /* Event handlers for the stream output */
331     void OnSoutEnable( wxCommandEvent& event );
332     void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
333
334     /* Event handlers for the demux dump */
335     void OnDemuxDumpEnable( wxCommandEvent& event );
336     void OnDemuxDumpBrowse( wxCommandEvent& event );
337     void OnDemuxDumpChange( wxCommandEvent& event );
338
339     DECLARE_EVENT_TABLE();
340
341     intf_thread_t *p_intf;
342     wxWindow *p_parent;
343     int i_current_access_method;
344
345     wxComboBox *mrl_combo;
346     wxNotebook *notebook;
347
348     /* Controls for the file panel */
349     wxComboBox *file_combo;
350     wxFileDialog *file_dialog;
351
352     /* Controls for the disc panel */
353     wxRadioBox *disc_type;
354     wxTextCtrl *disc_device;
355     wxSpinCtrl *disc_title;
356     int        i_disc_title;
357     wxSpinCtrl *disc_chapter;
358     int        i_disc_chapter;
359
360     /* Controls for the net panel */
361     wxRadioBox *net_type;
362     int i_net_type;
363     wxPanel *net_subpanels[4];
364     wxRadioButton *net_radios[4];
365     wxSpinCtrl *net_ports[4];
366     int        i_net_ports[4];
367     wxTextCtrl *net_addrs[4];
368
369     /* Controls for the v4l panel */
370     wxRadioBox *video_type;
371     wxTextCtrl *video_device;
372     wxSpinCtrl *video_channel;
373     wxButton *v4l_button;
374     V4LDialog *v4l_dialog;
375     wxArrayString v4l_mrl;
376
377     /* Controls for the subtitles file */
378     wxButton *subsfile_button;
379     wxCheckBox *subsfile_checkbox;
380     SubsFileDialog *subsfile_dialog;
381     wxArrayString subsfile_mrl;
382
383     /* Controls for the stream output */
384     wxButton *sout_button;
385     wxCheckBox *sout_checkbox;
386     SoutDialog *sout_dialog;
387     wxArrayString sout_mrl;
388
389     /* Controls for the demux dump */
390     wxTextCtrl *demuxdump_textctrl;
391     wxButton *demuxdump_button;
392     wxCheckBox *demuxdump_checkbox;
393     wxFileDialog *demuxdump_dialog;
394 };
395
396 enum
397 {
398     FILE_ACCESS = 0,
399     DISC_ACCESS,
400     NET_ACCESS,
401     SAT_ACCESS,
402     V4L_ACCESS,
403     FILE_SIMPLE_ACCESS
404 };
405
406 /* V4L Dialog */
407 class V4LDialog: public wxDialog
408 {
409 public:
410     /* Constructor */
411     V4LDialog( intf_thread_t *p_intf, wxWindow *p_parent );
412     virtual ~V4LDialog();
413
414     wxArrayString GetOptions();
415
416 private:
417     void UpdateMRL();
418     wxPanel *AudioPanel( wxWindow* parent );
419     wxPanel *CommonPanel( wxWindow* parent );
420     wxPanel *BitratePanel( wxWindow* parent );
421     void    ParseMRL();
422
423     /* Event handlers (these functions should _not_ be virtual) */
424     void OnOk( wxCommandEvent& event );
425     void OnCancel( wxCommandEvent& event );
426     void OnMRLChange( wxCommandEvent& event );
427     void OnAudioEnable( wxCommandEvent& event );
428     void OnAudioChannel( wxCommandEvent& event );
429     void OnSizeEnable( wxCommandEvent& event );
430     void OnSize( wxCommandEvent& event );
431     void OnNormEnable( wxCommandEvent& event );
432     void OnNorm( wxCommandEvent& event );
433     void OnFrequencyEnable( wxCommandEvent& event );
434     void OnFrequency( wxCommandEvent& event );
435     void OnBitrateEnable( wxCommandEvent& event );
436     void OnBitrate( wxCommandEvent& event );
437     void OnMaxBitrateEnable( wxCommandEvent& event );
438     void OnMaxBitrate( wxCommandEvent& event );
439
440     DECLARE_EVENT_TABLE();
441
442     intf_thread_t *p_intf;
443     wxWindow *p_parent;
444
445     wxComboBox *mrl_combo;
446
447     int i_access_type;
448
449     /* Controls for the v4l advanced options */
450     wxPanel *common_subpanel;
451     wxPanel *common_panel;
452     wxCheckBox *size_checkbox;
453     wxComboBox *size_combo;
454     wxCheckBox *norm_checkbox;
455     wxComboBox *norm_combo;
456     wxCheckBox *frequency_checkbox;
457     wxSpinCtrl *frequency;
458
459     wxPanel *audio_subpanel;
460     wxPanel *audio_panel;
461     wxCheckBox *audio_checkbox;
462     wxTextCtrl *audio_device;
463     wxSpinCtrl *audio_channel;
464
465     wxPanel *bitrate_subpanel;
466     wxPanel *bitrate_panel;
467     wxCheckBox *bitrate_checkbox;
468     wxSpinCtrl *bitrate;
469     wxCheckBox *maxbitrate_checkbox;
470     wxSpinCtrl *maxbitrate;
471
472 };
473
474 /* Stream output Dialog */
475 enum
476 {
477     PLAY_ACCESS_OUT = 0,
478     FILE_ACCESS_OUT,
479     HTTP_ACCESS_OUT,
480     MMSH_ACCESS_OUT,
481     UDP_ACCESS_OUT,
482     RTP_ACCESS_OUT,
483     ACCESS_OUT_NUM
484 };
485
486 enum
487 {
488     TS_ENCAPSULATION = 0,
489     PS_ENCAPSULATION,
490     MPEG1_ENCAPSULATION,
491     OGG_ENCAPSULATION,
492     ASF_ENCAPSULATION,
493     AVI_ENCAPSULATION,
494     MP4_ENCAPSULATION,
495     MOV_ENCAPSULATION,
496     ENCAPS_NUM
497 };
498
499 enum
500 {
501     ANN_MISC_SOUT = 0,
502     MISC_SOUT_NUM
503 };
504
505 class SoutDialog: public wxDialog
506 {
507 public:
508     /* Constructor */
509     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
510     virtual ~SoutDialog();
511
512     wxArrayString GetOptions();
513
514 private:
515     void UpdateMRL();
516     wxPanel *AccessPanel( wxWindow* parent );
517     wxPanel *MiscPanel( wxWindow* parent );
518     wxPanel *EncapsulationPanel( wxWindow* parent );
519     wxPanel *TranscodingPanel( wxWindow* parent );
520     void    ParseMRL();
521
522     /* Event handlers (these functions should _not_ be virtual) */
523     void OnOk( wxCommandEvent& event );
524     void OnCancel( wxCommandEvent& event );
525     void OnMRLChange( wxCommandEvent& event );
526     void OnAccessTypeChange( wxCommandEvent& event );
527
528     /* Event handlers for the file access output */
529     void OnFileChange( wxCommandEvent& event );
530     void OnFileBrowse( wxCommandEvent& event );
531
532     /* Event handlers for the net access output */
533     void OnNetChange( wxCommandEvent& event );
534
535     /* Event specific to the announce address */
536     void OnAnnounceAddrChange( wxCommandEvent& event );
537
538     /* Event handlers for the encapsulation panel */
539     void OnEncapsulationChange( wxCommandEvent& event );
540
541     /* Event handlers for the transcoding panel */
542     void OnTranscodingEnable( wxCommandEvent& event );
543     void OnTranscodingChange( wxCommandEvent& event );
544
545     /* Event handlers for the misc panel */
546     void OnSAPMiscChange( wxCommandEvent& event );
547     void OnSLPMiscChange( wxCommandEvent& event );
548
549     DECLARE_EVENT_TABLE();
550
551     intf_thread_t *p_intf;
552     wxWindow *p_parent;
553
554     wxComboBox *mrl_combo;
555
556     /* Controls for the access outputs */
557     wxPanel *access_subpanels[ACCESS_OUT_NUM];
558     wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
559
560     int i_access_type;
561
562     wxComboBox *file_combo;
563     wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
564     wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
565
566     /* Controls for the SAP announces */
567     wxPanel *misc_subpanels[MISC_SOUT_NUM];
568     wxCheckBox *sap_checkbox;
569     wxCheckBox *slp_checkbox;
570     wxTextCtrl *announce_addr;
571
572     /* Controls for the encapsulation */
573     wxRadioButton *encapsulation_radios[ENCAPS_NUM];
574     int i_encapsulation_type;
575
576     /* Controls for transcoding */
577     wxCheckBox *video_transc_checkbox;
578     wxComboBox *video_codec_combo;
579     wxComboBox *audio_codec_combo;
580     wxCheckBox *audio_transc_checkbox;
581     wxComboBox *video_bitrate_combo;
582     wxComboBox *audio_bitrate_combo;
583     wxComboBox *audio_channels_combo;
584 };
585
586 /* Subtitles File Dialog */
587 class SubsFileDialog: public wxDialog
588 {
589 public:
590     /* Constructor */
591     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
592     virtual ~SubsFileDialog();
593
594     wxComboBox *file_combo;
595     wxComboBox *encoding_combo;
596     wxSpinCtrl *delay_spinctrl;
597     wxSpinCtrl *fps_spinctrl;
598
599 private:
600     /* Event handlers (these functions should _not_ be virtual) */
601     void OnOk( wxCommandEvent& event );
602     void OnCancel( wxCommandEvent& event );
603     void OnFileBrowse( wxCommandEvent& event );
604
605     DECLARE_EVENT_TABLE();
606
607     intf_thread_t *p_intf;
608     wxWindow *p_parent;
609 };
610
611 /* Preferences Dialog */
612 class PrefsTreeCtrl;
613 class PrefsDialog: public wxFrame
614 {
615 public:
616     /* Constructor */
617     PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
618     virtual ~PrefsDialog();
619
620 private:
621     wxPanel *PrefsPanel( wxWindow* parent );
622
623     /* Event handlers (these functions should _not_ be virtual) */
624     void OnOk( wxCommandEvent& event );
625     void OnCancel( wxCommandEvent& event );
626     void OnSave( wxCommandEvent& event );
627     void OnResetAll( wxCommandEvent& event );
628     void OnAdvanced( wxCommandEvent& event );
629
630     DECLARE_EVENT_TABLE();
631
632     intf_thread_t *p_intf;
633
634     PrefsTreeCtrl *prefs_tree;
635 };
636
637 /* Messages */
638 class Messages: public wxFrame
639 {
640 public:
641     /* Constructor */
642     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
643     virtual ~Messages();
644     bool Show( bool show = TRUE );
645     void UpdateLog();
646
647 private:
648     /* Event handlers (these functions should _not_ be virtual) */
649     void OnClose( wxCommandEvent& event );
650     void OnClear( wxCommandEvent& event );
651     void OnSaveLog( wxCommandEvent& event );
652
653     DECLARE_EVENT_TABLE();
654
655     intf_thread_t *p_intf;
656     wxTextCtrl *textctrl;
657     wxTextAttr *info_attr;
658     wxTextAttr *err_attr;
659     wxTextAttr *warn_attr;
660     wxTextAttr *dbg_attr;
661
662     wxFileDialog *save_log_dialog;
663
664     vlc_bool_t b_verbose;
665 };
666
667 /* Playlist */
668 class ItemInfoDialog;
669 class Playlist: public wxFrame
670 {
671 public:
672     /* Constructor */
673     Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
674     virtual ~Playlist();
675
676     void UpdatePlaylist();
677     void ShowPlaylist( bool show );
678
679     bool b_need_update;
680     vlc_mutex_t lock;
681
682 private:
683     void DeleteItem( int item );
684
685     /* Event handlers (these functions should _not_ be virtual) */
686     void OnAddFile( wxCommandEvent& event );
687     void OnAddMRL( wxCommandEvent& event );
688     void OnSort( wxCommandEvent& event );
689     void OnRSort( wxCommandEvent& event );
690     void OnClose( wxCommandEvent& event );
691     void OnSearch( wxCommandEvent& event );
692     void OnEnDis( wxCommandEvent& event );
693     void OnInfos( wxCommandEvent& event );
694     void OnSearchTextChange( wxCommandEvent& event );
695     void OnOpen( wxCommandEvent& event );
696     void OnSave( wxCommandEvent& event );
697     void OnEnableSelection( wxCommandEvent& event );
698     void OnDisableSelection( wxCommandEvent& event );
699     void OnInvertSelection( wxCommandEvent& event );
700     void OnDeleteSelection( wxCommandEvent& event );
701     void OnSelectAll( wxCommandEvent& event );
702     void OnRandom( wxCommandEvent& event );
703     void OnRepeat( wxCommandEvent& event );
704     void OnLoop ( wxCommandEvent& event );
705     void OnActivateItem( wxListEvent& event );
706     void OnKeyDown( wxListEvent& event );
707     void Rebuild();
708
709     wxTextCtrl *search_text;
710     wxButton *search_button;
711     DECLARE_EVENT_TABLE();
712
713
714     ItemInfoDialog *iteminfo_dialog;
715
716     intf_thread_t *p_intf;
717     wxListView *listview;
718     int i_update_counter;
719 };
720
721
722 /* ItemInfo Dialog */
723 class ItemInfoDialog: public wxDialog
724 {
725 public:
726     /* Constructor */
727     ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
728                     wxWindow *p_parent );
729     virtual ~ItemInfoDialog();
730
731     wxArrayString GetOptions();
732
733 private:
734     wxPanel *InfoPanel( wxWindow* parent );
735     wxPanel *GroupPanel( wxWindow* parent );
736
737     /* Event handlers (these functions should _not_ be virtual) */
738     void OnOk( wxCommandEvent& event );
739     void OnCancel( wxCommandEvent& event );
740
741     DECLARE_EVENT_TABLE();
742
743     intf_thread_t *p_intf;
744     playlist_item_t *p_item;
745     wxWindow *p_parent;
746
747     /* Controls for the iteminfo dialog box */
748     wxPanel *info_subpanel;
749     wxPanel *info_panel;
750
751     wxPanel *group_subpanel;
752     wxPanel *group_panel;
753
754     wxTextCtrl *uri_text;
755     wxTextCtrl *name_text;
756     wxTextCtrl *author_text;
757
758     wxCheckBox *enabled_checkbox;
759     wxSpinCtrl *group_spin;
760 };
761
762
763 /* File Info */
764 class FileInfo: public wxFrame
765 {
766 public:
767     /* Constructor */
768     FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
769     virtual ~FileInfo();
770     void UpdateFileInfo();
771
772 private:
773     void OnClose( wxCommandEvent& event );
774
775     DECLARE_EVENT_TABLE();
776
777     intf_thread_t *p_intf;
778     wxTreeCtrl *fileinfo_tree;
779     wxTreeItemId fileinfo_root;
780     wxString fileinfo_root_label;
781
782 };
783
784 #if !defined(__WXX11__)
785 /* Drag and Drop class */
786 class DragAndDrop: public wxFileDropTarget
787 {
788 public:
789     DragAndDrop( intf_thread_t *_p_intf );
790
791     virtual bool OnDropFiles( wxCoord x, wxCoord y,
792                               const wxArrayString& filenames );
793
794 private:
795     intf_thread_t *p_intf;
796 };
797 #endif
798
799 /* Menus */
800 void PopupMenu( intf_thread_t *_p_intf, wxWindow *p_parent,
801                 const wxPoint& pos );
802 wxMenu *AudioMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
803 wxMenu *VideoMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
804 wxMenu *NavigMenu( intf_thread_t *_p_intf, wxWindow *p_parent );
805
806 class MenuEvtHandler : public wxEvtHandler
807 {
808 public:
809     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
810     virtual ~MenuEvtHandler();
811
812     void OnMenuEvent( wxCommandEvent& event );
813     void OnShowDialog( wxCommandEvent& event );
814
815 private:
816
817     DECLARE_EVENT_TABLE()
818
819     intf_thread_t *p_intf;
820     Interface *p_main_interface;
821 };
822
823 class Menu: public wxMenu
824 {
825 public:
826     /* Constructor */
827     Menu( intf_thread_t *p_intf, wxWindow *p_parent, int i_count,
828           char **ppsz_names, int *pi_objects, int i_start_id );
829     virtual ~Menu();
830
831 private:
832     /* Event handlers (these functions should _not_ be virtual) */
833     void OnClose( wxCommandEvent& event );
834     void OnShowDialog( wxCommandEvent& event );
835     void OnEntrySelected( wxCommandEvent& event );
836
837     wxMenu *Menu::CreateDummyMenu();
838     void   Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
839     wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
840
841     DECLARE_EVENT_TABLE();
842
843     intf_thread_t *p_intf;
844
845     int  i_item_id;
846 };
847
848 static inline int ConvertHotkeyModifiers( int i_hotkey )
849 {
850     int i_accel_flags = 0;
851     if( i_hotkey & KEY_MODIFIER_ALT ) i_accel_flags |= wxACCEL_ALT;
852     if( i_hotkey & KEY_MODIFIER_CTRL ) i_accel_flags |= wxACCEL_CTRL;
853     if( i_hotkey & KEY_MODIFIER_SHIFT ) i_accel_flags |= wxACCEL_SHIFT;
854     return i_accel_flags;
855 }
856
857 static inline int ConvertHotkey( int i_hotkey )
858 {
859     int i_key = i_hotkey & ~KEY_MODIFIER;
860     if( i_key & KEY_ASCII ) return i_key & KEY_ASCII;
861     else if( i_key & KEY_SPECIAL )
862     {
863         switch ( i_key )
864         {
865         case KEY_LEFT: return WXK_LEFT;
866         case KEY_RIGHT: return WXK_RIGHT;
867         case KEY_UP: return WXK_UP;
868         case KEY_DOWN: return WXK_DOWN;
869         case KEY_SPACE: return WXK_SPACE;
870         case KEY_ENTER: return WXK_RETURN;
871         case KEY_F1: return WXK_F1;
872         case KEY_F2: return WXK_F2;
873         case KEY_F3: return WXK_F3;
874         case KEY_F4: return WXK_F4;
875         case KEY_F5: return WXK_F5;
876         case KEY_F6: return WXK_F6;
877         case KEY_F7: return WXK_F7;
878         case KEY_F8: return WXK_F8;
879         case KEY_F9: return WXK_F9;
880         case KEY_F10: return WXK_F10;
881         case KEY_F11: return WXK_F11;
882         case KEY_F12: return WXK_F12;
883         case KEY_HOME: return WXK_HOME;
884         case KEY_END: return WXK_HOME;
885         case KEY_MENU: return WXK_MENU;
886         case KEY_ESC: return WXK_ESCAPE;
887         case KEY_PAGEUP: return WXK_PRIOR;
888         case KEY_PAGEDOWN: return WXK_NEXT;
889         case KEY_TAB: return WXK_TAB;
890         case KEY_BACKSPACE: return WXK_BACK;
891         }
892     }
893     return 0;
894 }