]> git.sesse.net Git - vlc/blob - modules/gui/wxwindows/wxwindows.h
Add directory in wxWidgets
[vlc] / modules / gui / wxwindows / wxwindows.h
1 /*****************************************************************************
2  * wxwindows.h: private wxWindows interface description
3  *****************************************************************************
4  * Copyright (C) 1999-2004 VideoLAN
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
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 <wx/checkbox.h>
44 #include <wx/wizard.h>
45 #include "vlc_keys.h"
46
47
48 /* Hmmm, work-around for newest wxWin */
49 #ifdef wxStaticCastEvent
50 #   undef wxStaticCastEvent
51 #   define wxStaticCastEvent(type, val) ((type)(val))
52 #endif
53
54 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
55 DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
56
57 #define SLIDER_MAX_POS 10000
58
59 /* wxU is used to convert ansi/utf8 strings to unicode strings (wchar_t) */
60 #if defined( ENABLE_NLS ) && defined( ENABLE_UTF8 )
61 #if wxUSE_UNICODE
62 #   define wxU(utf8) wxString(utf8, wxConvUTF8)
63 #else
64 #   define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
65 #endif
66 #define ISUTF8 1
67
68 #else // ENABLE_NLS && ENABLE_UTF8
69 #if wxUSE_UNICODE
70 #   define wxU(ansi) wxString(ansi, *wxConvCurrent)
71 #else
72 #   define wxU(ansi) ansi
73 #endif
74 #define ISUTF8 0
75
76 #endif
77
78 /* wxL2U (locale to unicode) is used to convert ansi strings to unicode
79  * strings (wchar_t) */
80 #if wxUSE_UNICODE
81 #   define wxL2U(ansi) wxString(ansi, *wxConvCurrent)
82 #else
83 #   define wxL2U(ansi) ansi
84 #endif
85
86 #define WRAPCOUNT 80
87
88 #define OPEN_NORMAL 0
89 #define OPEN_STREAM 1
90
91 #define MODE_NONE 0
92 #define MODE_GROUP 1
93 #define MODE_AUTHOR 2
94 #define MODE_TITLE 3
95
96 class DialogsProvider;
97 class PrefsTreeCtrl;
98 class AutoBuiltPanel;
99 class VideoWindow;
100
101 /*****************************************************************************
102  * intf_sys_t: description and status of wxwindows interface
103  *****************************************************************************/
104 struct intf_sys_t
105 {
106     /* the wx parent window */
107     wxWindow            *p_wxwindow;
108     wxIcon              *p_icon;
109
110     /* special actions */
111     vlc_bool_t          b_playing;
112     vlc_bool_t          b_intf_show;                /* interface to be shown */
113
114     /* The input thread */
115     input_thread_t *    p_input;
116
117     /* The slider */
118     int                 i_slider_pos;                     /* slider position */
119     int                 i_slider_oldpos;                /* previous position */
120     vlc_bool_t          b_slider_free;                      /* slider status */
121
122     /* The messages window */
123     msg_subscription_t* p_sub;                  /* message bank subscription */
124
125     /* Playlist management */
126     int                 i_playing;                 /* playlist selected item */
127
128     /* Send an event to show a dialog */
129     void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
130                              intf_dialog_args_t *p_arg );
131
132     /* Popup menu */
133     wxMenu              *p_popup_menu;
134
135     /* Hotkeys */
136     int                 i_first_hotkey_event;
137     int                 i_hotkeys;
138
139     /* Embedded vout */
140     VideoWindow         *p_video_window;
141     wxBoxSizer          *p_video_sizer;
142
143     /* Aout */
144     aout_instance_t     *p_aout;
145 };
146
147 /*****************************************************************************
148  * Prototypes
149  *****************************************************************************/
150 wxArrayString SeparateEntries( wxString );
151 wxWindow *VideoWindow( intf_thread_t *p_intf, wxWindow *p_parent );
152 wxWindow *BookmarksDialog( intf_thread_t *p_intf, wxWindow *p_parent );
153 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
154
155 namespace wxvlc
156 {
157 class Interface;
158 class OpenDialog;
159 class SoutDialog;
160 class SubsFileDialog;
161 class Playlist;
162 class Messages;
163 class FileInfo;
164 class StreamDialog;
165 class WizardDialog;
166 class ItemInfoDialog;
167 class NewGroup;
168 class ExportPlaylist;
169
170 /*****************************************************************************
171  * Classes declarations.
172  *****************************************************************************/
173 /* Timer */
174 class Timer: public wxTimer
175 {
176 public:
177     /* Constructor */
178     Timer( intf_thread_t *p_intf, Interface *p_main_interface );
179     virtual ~Timer();
180
181     virtual void Notify();
182
183 private:
184     intf_thread_t *p_intf;
185     Interface *p_main_interface;
186     vlc_bool_t b_init;
187     int i_old_playing_status;
188     int i_old_rate;
189     vlc_bool_t b_old_seekable;
190 };
191
192
193 /* Extended panel */
194 class ExtraPanel: public wxPanel
195 {
196 public:
197     /* Constructor */
198     ExtraPanel( intf_thread_t *p_intf, wxWindow *p_parent );
199     virtual ~ExtraPanel();
200
201     wxStaticBox *adjust_box;
202     wxButton *restoredefaults_button;
203     wxSlider *brightness_slider;
204     wxSlider *contrast_slider;
205     wxSlider *saturation_slider;
206     wxSlider *hue_slider;
207     wxSlider *gamma_slider;
208
209     wxStaticBox *other_box;
210     wxComboBox *ratio_combo;
211
212     char *psz_bands;
213     float f_preamp;
214     vlc_bool_t b_update;
215
216 private:
217
218     wxPanel *VideoPanel( wxWindow * );
219     wxPanel *EqzPanel( wxWindow * );
220     wxPanel *AudioPanel( wxWindow * );
221
222     wxNotebook *notebook;
223
224     wxCheckBox *eq_chkbox;
225
226     wxCheckBox *eq_2p_chkbox;
227
228     wxSlider *smooth_slider;
229
230     wxSlider *preamp_slider;
231     wxStaticText * preamp_text;
232
233     int i_smooth;
234     wxWindow *p_parent;
235
236     wxSlider *band_sliders[10];
237     wxStaticText *band_texts[10];
238
239     int i_values[10];
240
241     void CheckAout();
242
243     /* Event handlers (these functions should _not_ be virtual) */
244
245     void OnEnableAdjust( wxCommandEvent& );
246     void OnEnableEqualizer( wxCommandEvent& );
247     void OnRestoreDefaults( wxCommandEvent& );
248     void OnChangeEqualizer( wxScrollEvent& );
249     void OnAdjustUpdate( wxScrollEvent& );
250     void OnRatio( wxCommandEvent& );
251     void OnFiltersInfo( wxCommandEvent& );
252     void OnSelectFilter( wxCommandEvent& );
253
254     void OnEqSmooth( wxScrollEvent& );
255     void OnPreamp( wxScrollEvent& );
256     void OnEq2Pass( wxCommandEvent& );
257     void OnEqRestore( wxCommandEvent& );
258
259     void OnHeadphone( wxCommandEvent& );
260     void OnNormvol( wxCommandEvent& );
261     void OnNormvolSlider( wxScrollEvent& );
262
263     void OnIdle( wxIdleEvent& );
264
265     DECLARE_EVENT_TABLE();
266
267     intf_thread_t *p_intf;
268     vlc_bool_t b_my_update;
269 };
270
271 #if 0
272 /* Extended Window  */
273 class ExtraWindow: public wxFrame
274 {
275 public:
276     /* Constructor */
277     ExtraWindow( intf_thread_t *p_intf, wxWindow *p_parent, wxPanel *panel );
278     virtual ~ExtraWindow();
279
280 private:
281
282     wxPanel *panel;
283
284     DECLARE_EVENT_TABLE();
285
286     intf_thread_t *p_intf;
287 };
288 #endif
289
290 /* Main Interface */
291 class Interface: public wxFrame
292 {
293 public:
294     /* Constructor */
295     Interface( intf_thread_t *p_intf );
296     virtual ~Interface();
297     void Init();
298     void TogglePlayButton( int i_playing_status );
299     void Update();
300
301     wxBoxSizer  *frame_sizer;
302     wxStatusBar *statusbar;
303
304     wxSlider    *slider;
305     wxWindow    *slider_frame;
306     wxPanel     *extra_frame;
307
308     wxFrame    *extra_window;
309
310     vlc_bool_t b_extra;
311     vlc_bool_t b_undock;
312
313
314     wxGauge     *volctrl;
315
316 private:
317     void SetupHotkeys();
318     void CreateOurMenuBar();
319     void CreateOurToolBar();
320     void CreateOurExtendedPanel();
321     void CreateOurSlider();
322     void Open( int i_access_method );
323
324     /* Event handlers (these functions should _not_ be virtual) */
325     void OnExit( wxCommandEvent& event );
326     void OnAbout( wxCommandEvent& event );
327
328     void OnOpenFileSimple( wxCommandEvent& event );
329     void OnOpenDir( wxCommandEvent& event );
330     void OnOpenFile( wxCommandEvent& event );
331     void OnOpenDisc( wxCommandEvent& event );
332     void OnOpenNet( wxCommandEvent& event );
333     void OnOpenSat( wxCommandEvent& event );
334
335     void OnExtended( wxCommandEvent& event );
336     //void OnUndock( wxCommandEvent& event );
337
338     void OnBookmarks( wxCommandEvent& event );
339     void OnShowDialog( wxCommandEvent& event );
340     void OnPlayStream( wxCommandEvent& event );
341     void OnStopStream( wxCommandEvent& event );
342     void OnSliderUpdate( wxScrollEvent& event );
343     void OnPrevStream( wxCommandEvent& event );
344     void OnNextStream( wxCommandEvent& event );
345     void OnSlowStream( wxCommandEvent& event );
346     void OnFastStream( wxCommandEvent& event );
347
348     void OnMenuOpen( wxMenuEvent& event );
349
350 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
351     void OnContextMenu2(wxContextMenuEvent& event);
352 #endif
353     void OnContextMenu(wxMouseEvent& event);
354
355     void OnControlEvent( wxCommandEvent& event );
356
357     DECLARE_EVENT_TABLE();
358
359     Timer *timer;
360     intf_thread_t *p_intf;
361
362 private:
363     int i_old_playing_status;
364
365     /* For auto-generated menus */
366     wxMenu *p_settings_menu;
367     wxMenu *p_audio_menu;
368     wxMenu *p_video_menu;
369     wxMenu *p_navig_menu;
370 };
371
372 /* Open Dialog */
373 WX_DEFINE_ARRAY(AutoBuiltPanel *, ArrayOfAutoBuiltPanel);
374 class OpenDialog: public wxDialog
375 {
376 public:
377     /* Constructor */
378     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
379                 int i_access_method, int i_arg = 0  );
380
381     /* Extended Contructor */
382     OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
383                 int i_access_method, int i_arg = 0 , int _i_method = 0 );
384     virtual ~OpenDialog();
385
386     int Show();
387     int Show( int i_access_method, int i_arg = 0 );
388
389     void UpdateMRL();
390     void UpdateMRL( int i_access_method );
391
392     wxArrayString mrl;
393
394 private:
395     wxPanel *FilePanel( wxWindow* parent );
396     wxPanel *DiscPanel( wxWindow* parent );
397     wxPanel *NetPanel( wxWindow* parent );
398
399     ArrayOfAutoBuiltPanel input_tab_array;
400
401     /* Event handlers (these functions should _not_ be virtual) */
402     void OnOk( wxCommandEvent& event );
403     void OnCancel( wxCommandEvent& event );
404
405     void OnPageChange( wxNotebookEvent& event );
406     void OnMRLChange( wxCommandEvent& event );
407
408     /* Event handlers for the file page */
409     void OnFilePanelChange( wxCommandEvent& event );
410     void OnFileBrowse( wxCommandEvent& event );
411
412     /* Event handlers for the disc page */
413     void OnDiscPanelChange( wxCommandEvent& event );
414     void OnDiscTypeChange( wxCommandEvent& event );
415     void OnDiscDeviceChange( wxCommandEvent& event );
416
417     /* Event handlers for the net page */
418     void OnNetPanelChange( wxCommandEvent& event );
419     void OnNetTypeChange( wxCommandEvent& event );
420
421     /* Event handlers for the stream output */
422     void OnSubsFileEnable( wxCommandEvent& event );
423     void OnSubsFileSettings( wxCommandEvent& WXUNUSED(event) );
424
425     /* Event handlers for the stream output */
426     void OnSoutEnable( wxCommandEvent& event );
427     void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
428
429     /* Event handlers for the caching option */
430     void OnCachingEnable( wxCommandEvent& event );
431     void OnCachingChange( wxCommandEvent& event );
432
433     DECLARE_EVENT_TABLE();
434
435     intf_thread_t *p_intf;
436     wxWindow *p_parent;
437     int i_current_access_method;
438     int i_disc_type_selection;
439
440     int i_method; /* Normal or for the stream dialog ? */
441     int i_open_arg;
442
443     wxComboBox *mrl_combo;
444     wxNotebook *notebook;
445
446     /* Controls for the file panel */
447     wxComboBox *file_combo;
448     wxFileDialog *file_dialog;
449
450     /* Controls for the disc panel */
451     wxRadioBox *disc_type;
452     wxTextCtrl *disc_device;
453     wxSpinCtrl *disc_title; int i_disc_title;
454     wxSpinCtrl *disc_chapter; int i_disc_chapter;
455     wxSpinCtrl *disc_sub; int i_disc_sub;
456
457     /* The media equivalent name for a DVD names. For example,
458      * "Title", is "Track" for a CD-DA */
459     wxStaticText *disc_title_label;
460     wxStaticText *disc_chapter_label;
461     wxStaticText *disc_sub_label;
462     
463     /* Indicates if the disc device control was modified */
464     bool b_disc_device_changed;
465     
466     /* Controls for the net panel */
467     wxRadioBox *net_type;
468     int i_net_type;
469     wxPanel *net_subpanels[4];
470     wxRadioButton *net_radios[4];
471     wxSpinCtrl *net_ports[4];
472     int        i_net_ports[4];
473     wxTextCtrl *net_addrs[4];
474     wxCheckBox *net_ipv6;
475
476     /* Controls for the subtitles file */
477     wxButton *subsfile_button;
478     wxCheckBox *subsfile_checkbox;
479     SubsFileDialog *subsfile_dialog;
480     wxArrayString subsfile_mrl;
481
482     /* Controls for the stream output */
483     wxButton *sout_button;
484     wxCheckBox *sout_checkbox;
485     SoutDialog *sout_dialog;
486     wxArrayString sout_mrl;
487
488     /* Controls for the caching options */
489     wxCheckBox *caching_checkbox;
490     wxSpinCtrl *caching_value;
491     int i_caching;
492 };
493
494 enum
495 {
496     FILE_ACCESS = 0,
497     DISC_ACCESS,
498     NET_ACCESS,
499
500     /* Auto-built panels */
501     CAPTURE_ACCESS
502 };
503 #define MAX_ACCESS CAPTURE_ACCESS
504
505 /* Stream output Dialog */
506 enum
507 {
508     PLAY_ACCESS_OUT = 0,
509     FILE_ACCESS_OUT,
510     HTTP_ACCESS_OUT,
511     MMSH_ACCESS_OUT,
512     UDP_ACCESS_OUT,
513     RTP_ACCESS_OUT,
514     ACCESS_OUT_NUM
515 };
516
517 enum
518 {
519     TS_ENCAPSULATION = 0,
520     PS_ENCAPSULATION,
521     MPEG1_ENCAPSULATION,
522     OGG_ENCAPSULATION,
523     ASF_ENCAPSULATION,
524     MP4_ENCAPSULATION,
525     MOV_ENCAPSULATION,
526     WAV_ENCAPSULATION,
527     RAW_ENCAPSULATION,
528     AVI_ENCAPSULATION,
529     ENCAPS_NUM
530 };
531
532 enum
533 {
534     ANN_MISC_SOUT = 0,
535     MISC_SOUT_NUM
536 };
537
538 class SoutDialog: public wxDialog
539 {
540 public:
541     /* Constructor */
542     SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
543     virtual ~SoutDialog();
544
545     wxArrayString GetOptions();
546
547 private:
548     void UpdateMRL();
549     wxPanel *AccessPanel( wxWindow* parent );
550     wxPanel *MiscPanel( wxWindow* parent );
551     wxPanel *EncapsulationPanel( wxWindow* parent );
552     wxPanel *TranscodingPanel( wxWindow* parent );
553     void    ParseMRL();
554
555     /* Event handlers (these functions should _not_ be virtual) */
556     void OnOk( wxCommandEvent& event );
557     void OnCancel( wxCommandEvent& event );
558     void OnMRLChange( wxCommandEvent& event );
559     void OnAccessTypeChange( wxCommandEvent& event );
560
561     /* Event handlers for the file access output */
562     void OnFileChange( wxCommandEvent& event );
563     void OnFileBrowse( wxCommandEvent& event );
564     void OnFileDump( wxCommandEvent& event );
565
566     /* Event handlers for the net access output */
567     void OnNetChange( wxCommandEvent& event );
568
569     /* Event specific to the announce address */
570     void OnAnnounceGroupChange( wxCommandEvent& event );
571     void OnAnnounceAddrChange( wxCommandEvent& event );
572     
573     /* Event handlers for the encapsulation panel */
574     void OnEncapsulationChange( wxCommandEvent& event );
575
576     /* Event handlers for the transcoding panel */
577     void OnTranscodingEnable( wxCommandEvent& event );
578     void OnTranscodingChange( wxCommandEvent& event );
579
580     /* Event handlers for the misc panel */
581     void OnSAPMiscChange( wxCommandEvent& event );
582     void OnSLPMiscChange( wxCommandEvent& event );
583
584     DECLARE_EVENT_TABLE();
585
586     intf_thread_t *p_intf;
587     wxWindow *p_parent;
588
589     wxComboBox *mrl_combo;
590
591     /* Controls for the access outputs */
592     wxPanel *access_panel;
593     wxPanel *access_subpanels[ACCESS_OUT_NUM];
594     wxCheckBox *access_checkboxes[ACCESS_OUT_NUM];
595
596     int i_access_type;
597
598     wxComboBox *file_combo;
599     wxCheckBox *dump_checkbox;
600     wxSpinCtrl *net_ports[ACCESS_OUT_NUM];
601     wxTextCtrl *net_addrs[ACCESS_OUT_NUM];
602
603     /* Controls for the SAP announces */
604     wxPanel *misc_panel;
605     wxPanel *misc_subpanels[MISC_SOUT_NUM];
606     wxCheckBox *sap_checkbox;
607     wxCheckBox *slp_checkbox;
608     wxTextCtrl *announce_group;
609     wxTextCtrl *announce_addr;
610
611     /* Controls for the encapsulation */
612     wxPanel *encapsulation_panel;
613     wxRadioButton *encapsulation_radios[ENCAPS_NUM];
614     int i_encapsulation_type;
615
616     /* Controls for transcoding */
617     wxPanel *transcoding_panel;
618     wxCheckBox *video_transc_checkbox;
619     wxComboBox *video_codec_combo;
620     wxComboBox *audio_codec_combo;
621     wxCheckBox *audio_transc_checkbox;
622     wxComboBox *video_bitrate_combo;
623     wxComboBox *audio_bitrate_combo;
624     wxComboBox *audio_channels_combo;
625     wxComboBox *video_scale_combo;
626 };
627
628 /* Subtitles File Dialog */
629 class SubsFileDialog: public wxDialog
630 {
631 public:
632     /* Constructor */
633     SubsFileDialog( intf_thread_t *p_intf, wxWindow *p_parent );
634     virtual ~SubsFileDialog();
635
636     wxComboBox *file_combo;
637     wxComboBox *encoding_combo;
638     wxComboBox *size_combo;
639     wxComboBox *align_combo;
640     wxSpinCtrl *fps_spinctrl;
641     wxSpinCtrl *delay_spinctrl;
642
643 private:
644     /* Event handlers (these functions should _not_ be virtual) */
645     void OnOk( wxCommandEvent& event );
646     void OnCancel( wxCommandEvent& event );
647     void OnFileBrowse( wxCommandEvent& event );
648
649     DECLARE_EVENT_TABLE();
650
651     intf_thread_t *p_intf;
652     wxWindow *p_parent;
653 };
654
655 /* Stream */
656 class StreamDialog: public wxFrame
657 {
658 public:
659     /* Constructor */
660     StreamDialog( intf_thread_t *p_intf, wxWindow *p_parent );
661     virtual ~StreamDialog();
662
663 private:
664     void OnClose( wxCommandEvent& event );
665     void OnOpen( wxCommandEvent& event );
666     void OnSout( wxCommandEvent& event );
667     void OnStart( wxCommandEvent& event );
668
669     DECLARE_EVENT_TABLE();
670
671     intf_thread_t *p_intf;
672
673     wxStaticText *step2_label;
674     wxStaticText *step3_label;
675     wxButton *sout_button;
676     wxButton *start_button;
677     wxArrayString mrl;
678     wxArrayString sout_mrl;
679     OpenDialog *p_open_dialog;
680     SoutDialog *p_sout_dialog;
681 };
682
683 /* Wizard */
684 class WizardDialog : public wxWizard
685 {
686 public:
687     /* Constructor */
688     WizardDialog( intf_thread_t *p_intf, wxWindow *p_parent,char *, int, int );
689     virtual ~WizardDialog();
690     void SetTranscode( char *vcodec, int vb, char *acodec,int ab);
691     void SetMrl( const char *mrl );
692     void SetTTL( int i_ttl );
693     void SetPartial( int, int );
694     void SetStream( char *method, char *address );
695     void SetTranscodeOut( char *address );
696     void SetAction( int i_action );
697     int  GetAction();
698     void SetSAP( bool b_enabled, const char *psz_name );
699     void SetMux( char *mux );
700     void Run();
701     int i_action;
702     char *method;
703
704 protected:
705     int vb,ab;
706     int i_from, i_to, i_ttl;
707     char *vcodec , *acodec , *address , *mrl , *mux ;
708     char *psz_sap_name;
709     bool b_sap;
710     DECLARE_EVENT_TABLE();
711
712     intf_thread_t *p_intf;
713 };
714
715
716 /* Preferences Dialog */
717 class PrefsDialog: public wxFrame
718 {
719 public:
720     /* Constructor */
721     PrefsDialog( intf_thread_t *p_intf, wxWindow *p_parent );
722     virtual ~PrefsDialog();
723
724 private:
725     wxPanel *PrefsPanel( wxWindow* parent );
726
727     /* Event handlers (these functions should _not_ be virtual) */
728     void OnOk( wxCommandEvent& event );
729     void OnCancel( wxCommandEvent& event );
730     void OnSave( wxCommandEvent& event );
731     void OnResetAll( wxCommandEvent& event );
732     void OnAdvanced( wxCommandEvent& event );
733
734     DECLARE_EVENT_TABLE();
735
736     intf_thread_t *p_intf;
737
738     PrefsTreeCtrl *prefs_tree;
739 };
740
741 /* Messages */
742 class Messages: public wxFrame
743 {
744 public:
745     /* Constructor */
746     Messages( intf_thread_t *p_intf, wxWindow *p_parent );
747     virtual ~Messages();
748     bool Show( bool show = TRUE );
749     void UpdateLog();
750
751 private:
752     /* Event handlers (these functions should _not_ be virtual) */
753     void OnClose( wxCommandEvent& event );
754     void OnClear( wxCommandEvent& event );
755     void OnSaveLog( wxCommandEvent& event );
756
757     DECLARE_EVENT_TABLE();
758
759     intf_thread_t *p_intf;
760     wxTextCtrl *textctrl;
761     wxTextAttr *info_attr;
762     wxTextAttr *err_attr;
763     wxTextAttr *warn_attr;
764     wxTextAttr *dbg_attr;
765
766     wxFileDialog *save_log_dialog;
767
768     vlc_bool_t b_verbose;
769 };
770
771 /* Playlist */
772 class Playlist: public wxFrame
773 {
774 public:
775     /* Constructor */
776     Playlist( intf_thread_t *p_intf, wxWindow *p_parent );
777     virtual ~Playlist();
778
779     void UpdatePlaylist();
780     void ShowPlaylist( bool show );
781     void UpdateItem( int );
782
783     bool b_need_update;
784
785 private:
786     void DeleteItem( int item );
787     void ShowInfos( int item );
788
789     /* Event handlers (these functions should _not_ be virtual) */
790
791     void OnSize( wxSizeEvent &event );
792
793     /* Menu Handlers */
794     void OnAddFile( wxCommandEvent& event );
795     void OnAddDir( wxCommandEvent& event );
796     void OnAddMRL( wxCommandEvent& event );
797     void OnClose( wxCommandEvent& event );
798     void OnSearch( wxCommandEvent& event );
799     void OnEnDis( wxCommandEvent& event );
800     void OnInfos( wxCommandEvent& event );
801     void OnSearchTextChange( wxCommandEvent& event );
802     void OnOpen( wxCommandEvent& event );
803     void OnSave( wxCommandEvent& event );
804
805     void OnSort( wxCommandEvent& event );
806
807     void OnMenuEvent( wxCommandEvent& event );
808     void OnMenuOpen( wxMenuEvent& event );
809
810     wxMenu *ViewMenu();
811     wxMenu *SDMenu();
812
813     void OnUp( wxCommandEvent& event);
814     void OnDown( wxCommandEvent& event);
815
816     void OnEnableSelection( wxCommandEvent& event );
817     void OnDisableSelection( wxCommandEvent& event );
818     void OnInvertSelection( wxCommandEvent& event );
819     void OnDeleteSelection( wxCommandEvent& event );
820     void OnSelectAll( wxCommandEvent& event );
821     void OnRandom( wxCommandEvent& event );
822     void OnRepeat( wxCommandEvent& event );
823     void OnLoop ( wxCommandEvent& event );
824
825     void OnActivateItem( wxTreeEvent& event );
826     void OnKeyDown( wxTreeEvent& event );
827     void OnNewGroup( wxCommandEvent& event );
828
829     /* Popup functions */
830     void OnPopup( wxContextMenuEvent& event );
831     void OnPopupPlay( wxMenuEvent& event );
832     void OnPopupDel( wxMenuEvent& event );
833     void OnPopupEna( wxMenuEvent& event );
834     void OnPopupInfo( wxMenuEvent& event );
835     void Rebuild();
836
837     /* Update */
838     void UpdateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
839     void CreateNode( playlist_t *, playlist_item_t*, wxTreeItemId );
840
841     wxTreeItemId FindItem( wxTreeItemId, playlist_item_t * );
842     void SetCurrentItem( wxTreeItemId );
843     void UpdateTreeItem( playlist_t *, wxTreeItemId );
844
845     /* Custom events */
846     void OnPlaylistEvent( wxCommandEvent& event );
847
848     wxTextCtrl *search_text;
849     wxButton *search_button;
850     DECLARE_EVENT_TABLE();
851
852     wxMenu *popup_menu;
853
854     wxMenu *p_view_menu;
855     wxMenu *p_sd_menu;
856
857     char **pp_sds;
858
859     ItemInfoDialog *iteminfo_dialog;
860
861     intf_thread_t *p_intf;
862     wxTreeCtrl *treectrl;
863     int i_update_counter;
864     int i_sort_mode;
865
866     int i_current_view;
867
868     wxTreeItemId i_popup_item;
869     playlist_item_t *p_popup_item;
870     playlist_item_t *p_popup_parent;
871
872     int i_title_sorted;
873     int i_author_sorted;
874     int i_group_sorted;
875     int i_duration_sorted;
876 };
877
878 /* ItemInfo Dialog */
879 class ItemInfoDialog: public wxDialog
880 {
881 public:
882     /* Constructor */
883     ItemInfoDialog( intf_thread_t *p_intf, playlist_item_t *_p_item,
884                     wxWindow *p_parent );
885     virtual ~ItemInfoDialog();
886
887     wxArrayString GetOptions();
888
889 private:
890     wxPanel *InfoPanel( wxWindow* parent );
891     wxPanel *GroupPanel( wxWindow* parent );
892
893     /* Event handlers (these functions should _not_ be virtual) */
894     void OnOk( wxCommandEvent& event );
895     void OnCancel( wxCommandEvent& event );
896
897     void UpdateInfo();
898
899     DECLARE_EVENT_TABLE();
900
901     intf_thread_t *p_intf;
902     playlist_item_t *p_item;
903     wxWindow *p_parent;
904
905     /* Controls for the iteminfo dialog box */
906     wxPanel *info_subpanel;
907     wxPanel *info_panel;
908
909     wxPanel *group_subpanel;
910     wxPanel *group_panel;
911
912     wxTextCtrl *uri_text;
913     wxTextCtrl *name_text;
914     wxTextCtrl *author_text;
915
916     wxTreeCtrl *info_tree;
917     wxTreeItemId info_root;
918
919     wxCheckBox *enabled_checkbox;
920 };
921
922
923 /* File Info */
924 class FileInfo: public wxFrame
925 {
926 public:
927     /* Constructor */
928     FileInfo( intf_thread_t *p_intf, wxWindow *p_parent );
929     virtual ~FileInfo();
930     void UpdateFileInfo();
931
932     vlc_bool_t b_need_update;
933
934 private:
935     void OnClose( wxCommandEvent& event );
936
937     DECLARE_EVENT_TABLE();
938
939     intf_thread_t *p_intf;
940     wxTreeCtrl *fileinfo_tree;
941     wxTreeItemId fileinfo_root;
942     wxString fileinfo_root_label;
943
944
945 };
946
947 #if wxUSE_DRAG_AND_DROP
948 /* Drag and Drop class */
949 class DragAndDrop: public wxFileDropTarget
950 {
951 public:
952     DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
953
954     virtual bool OnDropFiles( wxCoord x, wxCoord y,
955                               const wxArrayString& filenames );
956
957 private:
958     intf_thread_t *p_intf;
959     vlc_bool_t b_enqueue;
960 };
961 #endif
962 } // end of wxvlc namespace
963
964 /* Menus */
965 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
966 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
967 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
968 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
969 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
970
971 namespace wxvlc
972 {
973 class MenuEvtHandler : public wxEvtHandler
974 {
975 public:
976     MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
977     virtual ~MenuEvtHandler();
978
979     void OnMenuEvent( wxCommandEvent& event );
980     void OnShowDialog( wxCommandEvent& event );
981
982 private:
983
984     DECLARE_EVENT_TABLE()
985
986     intf_thread_t *p_intf;
987     Interface *p_main_interface;
988 };
989
990 } // end of wxvlc namespace
991 using namespace wxvlc;