1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.13 2003/03/30 02:58:36 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 #include <wx/listctrl.h>
25 #include <wx/textctrl.h>
26 #include <wx/notebook.h>
27 #include <wx/spinctrl.h>
33 #define SLIDER_MAX_POS 10000
35 /*****************************************************************************
36 * intf_sys_t: description and status of Gtk+ interface
37 *****************************************************************************/
40 /* the wx parent window */
43 /* secondary windows */
44 Playlist *p_playlist_window;
45 Messages *p_messages_window;
49 vlc_bool_t b_popup_changed; /* display menu ? */
50 vlc_bool_t b_window_changed; /* window display toggled ? */
51 vlc_bool_t b_playlist_changed; /* playlist display toggled ? */
52 vlc_bool_t b_slider_free; /* slider status */
55 vlc_bool_t b_program_update; /* do we need to update programs
57 vlc_bool_t b_title_update; /* do we need to update title menus */
58 vlc_bool_t b_chapter_update; /* do we need to update
60 vlc_bool_t b_audio_update; /* do we need to update audio menus */
61 vlc_bool_t b_spu_update; /* do we need to update spu menus */
63 /* windows and widgets */
65 /* The input thread */
66 input_thread_t * p_input;
69 int i_slider_pos; /* slider position */
70 int i_slider_oldpos; /* previous position */
72 /* The messages window */
73 msg_subscription_t* p_sub; /* message bank subscription */
75 /* Playlist management */
76 int i_playing; /* playlist selected item */
78 /* The window labels for DVD mode */
79 unsigned int i_part; /* current chapter */
82 /*****************************************************************************
84 *****************************************************************************/
86 /*****************************************************************************
87 * Classes declarations.
88 *****************************************************************************/
92 class Timer: public wxTimer
96 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
99 virtual void Notify();
102 intf_thread_t *p_intf;
103 Interface *p_main_interface;
104 int i_old_playing_status;
108 class Interface: public wxFrame
112 Interface( intf_thread_t *p_intf );
113 virtual ~Interface();
114 void TogglePlayButton( int i_playing_status );
116 wxBoxSizer *frame_sizer;
117 wxStatusBar *statusbar;
120 wxWindow *slider_frame;
121 wxStaticBox *slider_box;
123 wxMenu *p_popup_menu;
125 wxArrayString mrl_history;
128 void CreateOurMenuBar();
129 void CreateOurToolBar();
130 void CreateOurSlider();
131 void Open( int i_access_method );
133 /* Event handlers (these functions should _not_ be virtual) */
134 void OnExit( wxCommandEvent& event );
135 void OnAbout( wxCommandEvent& event );
136 void OnMessages( wxCommandEvent& event );
137 void OnPlaylist( wxCommandEvent& event );
138 void OnLogs( wxCommandEvent& event );
139 void OnFileInfo( wxCommandEvent& event );
140 void OnPreferences( wxCommandEvent& event );
142 void OnOpenFile( wxCommandEvent& event );
143 void OnOpenDisc( wxCommandEvent& event );
144 void OnOpenNet( wxCommandEvent& event );
145 void OnOpenSat( wxCommandEvent& event );
147 void OnPlayStream( wxCommandEvent& event );
148 void OnStopStream( wxCommandEvent& event );
149 void OnSliderUpdate( wxScrollEvent& event );
150 void OnPrevStream( wxCommandEvent& event );
151 void OnNextStream( wxCommandEvent& event );
153 DECLARE_EVENT_TABLE();
156 intf_thread_t *p_intf;
158 wxDialog *p_prefs_dialog;
159 wxFrame *p_fileinfo_window;
161 int i_old_playing_status;
165 class OpenDialog: public wxDialog
169 OpenDialog( intf_thread_t *p_intf, Interface *p_main_interface,
170 int i_access_method );
171 virtual ~OpenDialog();
178 wxPanel *FilePanel( wxWindow* parent );
179 wxPanel *DiscPanel( wxWindow* parent );
180 wxPanel *NetPanel( wxWindow* parent );
181 wxPanel *SatPanel( wxWindow* parent );
183 void UpdateMRL( int i_access_method );
185 /* Event handlers (these functions should _not_ be virtual) */
186 void OnOk( wxCommandEvent& event );
187 void OnCancel( wxCommandEvent& event );
189 void OnPageChange( wxNotebookEvent& event );
190 void OnMRLChange( wxCommandEvent& event );
192 /* Event handlers for the file page */
193 void OnFilePanelChange( wxCommandEvent& event );
194 void OnFileBrowse( wxCommandEvent& event );
196 /* Event handlers for the disc page */
197 void OnDiscPanelChange( wxCommandEvent& event );
198 void OnDiscTypeChange( wxCommandEvent& event );
200 /* Event handlers for the net page */
201 void OnNetPanelChange( wxCommandEvent& event );
202 void OnNetTypeChange( wxCommandEvent& event );
204 /* Event handlers for the stream output */
205 void OnSoutEnable( wxCommandEvent& event );
206 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
208 /* Event handlers for the demux dump */
209 void OnDemuxDumpEnable( wxCommandEvent& event );
210 void OnDemuxDumpBrowse( wxCommandEvent& event );
211 void OnDemuxDumpChange( wxCommandEvent& event );
213 DECLARE_EVENT_TABLE();
215 intf_thread_t *p_intf;
216 Interface *p_main_interface;
217 int i_current_access_method;
219 wxComboBox *mrl_combo;
221 /* Controls for the file panel */
222 wxComboBox *file_combo;
224 /* Controls for the disc panel */
225 wxRadioBox *disc_type;
226 wxTextCtrl *disc_device;
227 wxSpinCtrl *disc_title;
228 wxSpinCtrl *disc_chapter;
230 /* Controls for the net panel */
231 wxRadioBox *net_type;
233 wxPanel *net_subpanels[4];
234 wxRadioButton *net_radios[4];
235 wxSpinCtrl *net_ports[4];
236 wxTextCtrl *net_addrs[4];
238 /* Controls for the stream output */
239 wxButton *sout_button;
240 wxCheckBox *sout_checkbox;
242 /* Controls for the demux dump */
243 wxTextCtrl *demuxdump_textctrl;
244 wxButton *demuxdump_button;
245 wxCheckBox *demuxdump_checkbox;
256 /* Stream output Dialog */
257 class SoutDialog: public wxDialog
261 SoutDialog( intf_thread_t *p_intf, Interface *p_main_interface );
262 virtual ~SoutDialog();
268 wxPanel *AccessPanel( wxWindow* parent );
269 wxPanel *EncapsulationPanel( wxWindow* parent );
272 /* Event handlers (these functions should _not_ be virtual) */
273 void OnOk( wxCommandEvent& event );
274 void OnCancel( wxCommandEvent& event );
275 void OnMRLChange( wxCommandEvent& event );
276 void OnAccessTypeChange( wxCommandEvent& event );
278 /* Event handlers for the file access output */
279 void OnFileChange( wxCommandEvent& event );
280 void OnFileBrowse( wxCommandEvent& event );
282 /* Event handlers for the net access output */
283 void OnNetChange( wxCommandEvent& event );
285 /* Event handlers for the encapsulation panel */
286 void OnEncapsulationChange( wxCommandEvent& event );
288 DECLARE_EVENT_TABLE();
290 intf_thread_t *p_intf;
291 Interface *p_main_interface;
293 wxComboBox *mrl_combo;
294 wxPanel *access_panel;
295 wxPanel *encapsulation_panel;
297 /* Controls for the access outputs */
298 wxPanel *access_subpanels[4];
299 wxRadioButton *access_radios[4];
303 wxComboBox *file_combo;
304 wxSpinCtrl *net_port;
305 wxTextCtrl *net_addr;
307 /* Controls for the encapsulation */
308 wxRadioButton *encapsulation_radios[4];
309 int i_encapsulation_type;
313 /* Preferences Dialog */
315 class PrefsDialog: public wxDialog
319 PrefsDialog( intf_thread_t *p_intf, Interface *p_main_interface );
320 virtual ~PrefsDialog();
323 wxPanel *PrefsPanel( wxWindow* parent );
325 /* Event handlers (these functions should _not_ be virtual) */
326 void OnOk( wxCommandEvent& event );
327 void OnCancel( wxCommandEvent& event );
328 void OnSave( wxCommandEvent& event );
330 DECLARE_EVENT_TABLE();
332 intf_thread_t *p_intf;
333 Interface *p_main_interface;
335 PrefsTreeCtrl *prefs_tree;
339 class Messages: public wxFrame
343 Messages( intf_thread_t *p_intf, Interface *_p_main_interface );
348 /* Event handlers (these functions should _not_ be virtual) */
349 void OnClose( wxCommandEvent& event );
351 DECLARE_EVENT_TABLE();
353 intf_thread_t *p_intf;
354 Interface *p_main_interface;
356 wxTextCtrl *textctrl;
357 wxTextAttr *info_attr;
358 wxTextAttr *err_attr;
359 wxTextAttr *warn_attr;
360 wxTextAttr *dbg_attr;
364 class Playlist: public wxFrame
368 Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
374 void DeleteItem( int item );
376 /* Event handlers (these functions should _not_ be virtual) */
377 void OnAddUrl( wxCommandEvent& event );
378 void OnAddDirectory( wxCommandEvent& event );
379 void OnClose( wxCommandEvent& event );
380 void OnInvertSelection( wxCommandEvent& event );
381 void OnDeleteSelection( wxCommandEvent& event );
382 void OnSelectAll( wxCommandEvent& event );
383 void OnActivateItem( wxListEvent& event );
384 void OnKeyDown( wxListEvent& event );
386 DECLARE_EVENT_TABLE();
388 intf_thread_t *p_intf;
389 Interface *p_main_interface;
390 wxListView *listview;
395 class FileInfo: public wxFrame
399 FileInfo( intf_thread_t *p_intf, Interface *p_main_interface );
403 void OnClose( wxCommandEvent& event );
404 DECLARE_EVENT_TABLE();
408 #if !defined(__WXX11__)
409 /* Drag and Drop class */
410 class DragAndDrop: public wxFileDropTarget
413 DragAndDrop( intf_thread_t *_p_intf );
415 virtual bool OnDropFiles( wxCoord x, wxCoord y,
416 const wxArrayString& filenames );
419 intf_thread_t *p_intf;
423 /* Popup contextual menu */
424 class PopupMenu: public wxMenu
428 PopupMenu( intf_thread_t *p_intf, Interface *p_main_interface );
429 virtual ~PopupMenu();
432 /* Event handlers (these functions should _not_ be virtual) */
433 void OnClose( wxCommandEvent& event );
434 void OnEntrySelected( wxCommandEvent& event );
436 wxMenu *PopupMenu::CreateDummyMenu();
437 void PopupMenu::CreateMenuEntry( char *, vlc_object_t * );
438 wxMenu *PopupMenu::CreateSubMenu( char *, vlc_object_t * );
440 DECLARE_EVENT_TABLE();
442 intf_thread_t *p_intf;
443 Interface *p_main_interface;
448 class PopupEvtHandler : public wxEvtHandler
451 PopupEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
452 virtual ~PopupEvtHandler();
454 void PopupEvtHandler::OnMenuEvent( wxCommandEvent& event );
458 DECLARE_EVENT_TABLE()
460 intf_thread_t *p_intf;
461 Interface *p_main_interface;
464 class wxMenuItemExt: public wxMenuItem
468 wxMenuItemExt( wxMenu* parentMenu, int id,
469 const wxString& text,
470 const wxString& helpString,
472 char *_psz_var, int _i_object_id, vlc_value_t _val ):
473 wxMenuItem( parentMenu, id, text, helpString, kind )
475 /* Initializations */
477 i_object_id = _i_object_id;
481 virtual ~wxMenuItemExt() { if( psz_var ) free( psz_var ); };