1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.18 2003/04/21 16:55:53 anil 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>
29 #include <wx/treectrl.h>
35 #define SLIDER_MAX_POS 10000
37 /*****************************************************************************
38 * intf_sys_t: description and status of wxwindows interface
39 *****************************************************************************/
42 /* the wx parent window */
46 /* secondary windows */
47 Playlist *p_playlist_window;
48 Messages *p_messages_window;
49 FileInfo *p_fileinfo_window;
53 vlc_bool_t b_popup_changed; /* display menu ? */
54 vlc_bool_t b_window_changed; /* window display toggled ? */
55 vlc_bool_t b_playlist_changed; /* playlist display toggled ? */
56 vlc_bool_t b_slider_free; /* slider status */
59 vlc_bool_t b_program_update; /* do we need to update programs
61 vlc_bool_t b_title_update; /* do we need to update title menus */
62 vlc_bool_t b_chapter_update; /* do we need to update
64 vlc_bool_t b_audio_update; /* do we need to update audio menus */
65 vlc_bool_t b_spu_update; /* do we need to update spu menus */
67 /* windows and widgets */
69 /* The input thread */
70 input_thread_t * p_input;
73 int i_slider_pos; /* slider position */
74 int i_slider_oldpos; /* previous position */
76 /* The messages window */
77 msg_subscription_t* p_sub; /* message bank subscription */
79 /* Playlist management */
80 int i_playing; /* playlist selected item */
82 /* The window labels for DVD mode */
83 unsigned int i_part; /* current chapter */
86 /*****************************************************************************
88 *****************************************************************************/
90 /*****************************************************************************
91 * Classes declarations.
92 *****************************************************************************/
96 class Timer: public wxTimer
100 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
103 virtual void Notify();
106 intf_thread_t *p_intf;
107 Interface *p_main_interface;
108 int i_old_playing_status;
112 class Interface: public wxFrame
116 Interface( intf_thread_t *p_intf );
117 virtual ~Interface();
118 void TogglePlayButton( int i_playing_status );
120 wxBoxSizer *frame_sizer;
121 wxStatusBar *statusbar;
124 wxWindow *slider_frame;
125 wxStaticBox *slider_box;
127 wxMenu *p_popup_menu;
129 wxArrayString mrl_history;
132 void CreateOurMenuBar();
133 void CreateOurToolBar();
134 void CreateOurSlider();
135 void Open( int i_access_method );
137 /* Event handlers (these functions should _not_ be virtual) */
138 void OnExit( wxCommandEvent& event );
139 void OnAbout( wxCommandEvent& event );
140 void OnMessages( wxCommandEvent& event );
141 void OnPlaylist( wxCommandEvent& event );
142 void OnLogs( wxCommandEvent& event );
143 void OnFileInfo( wxCommandEvent& event );
144 void OnPreferences( wxCommandEvent& event );
146 void OnOpenFile( wxCommandEvent& event );
147 void OnOpenDisc( wxCommandEvent& event );
148 void OnOpenNet( wxCommandEvent& event );
149 void OnOpenSat( wxCommandEvent& event );
151 void OnPlayStream( wxCommandEvent& event );
152 void OnStopStream( wxCommandEvent& event );
153 void OnSliderUpdate( wxScrollEvent& event );
154 void OnPrevStream( wxCommandEvent& event );
155 void OnNextStream( wxCommandEvent& event );
157 DECLARE_EVENT_TABLE();
160 intf_thread_t *p_intf;
162 wxFrame *p_prefs_dialog;
164 int i_old_playing_status;
168 class OpenDialog: public wxDialog
172 OpenDialog( intf_thread_t *p_intf, Interface *p_main_interface,
173 int i_access_method );
174 virtual ~OpenDialog();
181 wxPanel *FilePanel( wxWindow* parent );
182 wxPanel *DiscPanel( wxWindow* parent );
183 wxPanel *NetPanel( wxWindow* parent );
184 wxPanel *SatPanel( wxWindow* parent );
186 void UpdateMRL( int i_access_method );
188 /* Event handlers (these functions should _not_ be virtual) */
189 void OnOk( wxCommandEvent& event );
190 void OnCancel( wxCommandEvent& event );
192 void OnPageChange( wxNotebookEvent& event );
193 void OnMRLChange( wxCommandEvent& event );
195 /* Event handlers for the file page */
196 void OnFilePanelChange( wxCommandEvent& event );
197 void OnFileBrowse( wxCommandEvent& event );
199 /* Event handlers for the disc page */
200 void OnDiscPanelChange( wxCommandEvent& event );
201 void OnDiscTypeChange( wxCommandEvent& event );
203 /* Event handlers for the net page */
204 void OnNetPanelChange( wxCommandEvent& event );
205 void OnNetTypeChange( wxCommandEvent& event );
207 /* Event handlers for the stream output */
208 void OnSoutEnable( wxCommandEvent& event );
209 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
211 /* Event handlers for the demux dump */
212 void OnDemuxDumpEnable( wxCommandEvent& event );
213 void OnDemuxDumpBrowse( wxCommandEvent& event );
214 void OnDemuxDumpChange( wxCommandEvent& event );
216 DECLARE_EVENT_TABLE();
218 intf_thread_t *p_intf;
219 Interface *p_main_interface;
220 int i_current_access_method;
222 wxComboBox *mrl_combo;
224 /* Controls for the file panel */
225 wxComboBox *file_combo;
227 /* Controls for the disc panel */
228 wxRadioBox *disc_type;
229 wxTextCtrl *disc_device;
230 wxSpinCtrl *disc_title;
231 wxSpinCtrl *disc_chapter;
233 /* Controls for the net panel */
234 wxRadioBox *net_type;
236 wxPanel *net_subpanels[4];
237 wxRadioButton *net_radios[4];
238 wxSpinCtrl *net_ports[4];
239 wxTextCtrl *net_addrs[4];
241 /* Controls for the stream output */
242 wxButton *sout_button;
243 wxCheckBox *sout_checkbox;
245 /* Controls for the demux dump */
246 wxTextCtrl *demuxdump_textctrl;
247 wxButton *demuxdump_button;
248 wxCheckBox *demuxdump_checkbox;
259 /* Stream output Dialog */
260 class SoutDialog: public wxDialog
264 SoutDialog( intf_thread_t *p_intf, Interface *p_main_interface );
265 virtual ~SoutDialog();
271 wxPanel *AccessPanel( wxWindow* parent );
272 wxPanel *EncapsulationPanel( wxWindow* parent );
275 /* Event handlers (these functions should _not_ be virtual) */
276 void OnOk( wxCommandEvent& event );
277 void OnCancel( wxCommandEvent& event );
278 void OnMRLChange( wxCommandEvent& event );
279 void OnAccessTypeChange( wxCommandEvent& event );
281 /* Event handlers for the file access output */
282 void OnFileChange( wxCommandEvent& event );
283 void OnFileBrowse( wxCommandEvent& event );
285 /* Event handlers for the net access output */
286 void OnNetChange( wxCommandEvent& event );
288 /* Event handlers for the encapsulation panel */
289 void OnEncapsulationChange( wxCommandEvent& event );
291 DECLARE_EVENT_TABLE();
293 intf_thread_t *p_intf;
294 Interface *p_main_interface;
296 wxComboBox *mrl_combo;
297 wxPanel *access_panel;
298 wxPanel *encapsulation_panel;
300 /* Controls for the access outputs */
301 wxPanel *access_subpanels[4];
302 wxRadioButton *access_radios[4];
306 wxComboBox *file_combo;
307 wxSpinCtrl *net_port;
308 wxTextCtrl *net_addr;
310 /* Controls for the encapsulation */
311 wxRadioButton *encapsulation_radios[4];
312 int i_encapsulation_type;
316 /* Preferences Dialog */
318 class PrefsDialog: public wxFrame
322 PrefsDialog( intf_thread_t *p_intf, Interface *p_main_interface );
323 virtual ~PrefsDialog();
326 wxPanel *PrefsPanel( wxWindow* parent );
328 /* Event handlers (these functions should _not_ be virtual) */
329 void OnOk( wxCommandEvent& event );
330 void OnCancel( wxCommandEvent& event );
331 void OnSave( wxCommandEvent& event );
333 DECLARE_EVENT_TABLE();
335 intf_thread_t *p_intf;
336 Interface *p_main_interface;
338 PrefsTreeCtrl *prefs_tree;
342 class Messages: public wxFrame
346 Messages( intf_thread_t *p_intf, Interface *_p_main_interface );
351 /* Event handlers (these functions should _not_ be virtual) */
352 void OnClose( wxCommandEvent& event );
353 void OnVerbose( wxCommandEvent& event );
355 DECLARE_EVENT_TABLE();
357 intf_thread_t *p_intf;
358 Interface *p_main_interface;
359 wxTextCtrl *textctrl;
360 wxTextAttr *info_attr;
361 wxTextAttr *err_attr;
362 wxTextAttr *warn_attr;
363 wxTextAttr *dbg_attr;
365 vlc_bool_t b_verbose;
369 class Playlist: public wxFrame
373 Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
379 void DeleteItem( int item );
381 /* Event handlers (these functions should _not_ be virtual) */
382 void OnAddUrl( wxCommandEvent& event );
383 void OnAddDirectory( wxCommandEvent& event );
384 void OnClose( wxCommandEvent& event );
385 void OnInvertSelection( wxCommandEvent& event );
386 void OnDeleteSelection( wxCommandEvent& event );
387 void OnSelectAll( wxCommandEvent& event );
388 void OnActivateItem( wxListEvent& event );
389 void OnKeyDown( wxListEvent& event );
391 DECLARE_EVENT_TABLE();
393 intf_thread_t *p_intf;
394 Interface *p_main_interface;
395 wxListView *listview;
400 class FileInfo: public wxFrame
404 FileInfo( intf_thread_t *p_intf, Interface *p_main_interface );
406 void UpdateFileInfo();
409 void OnClose( wxCommandEvent& event );
411 DECLARE_EVENT_TABLE();
413 intf_thread_t *p_intf;
414 wxTreeCtrl *fileinfo_tree;
415 wxTreeItemId fileinfo_root;
416 wxString fileinfo_root_label;
420 #if !defined(__WXX11__)
421 /* Drag and Drop class */
422 class DragAndDrop: public wxFileDropTarget
425 DragAndDrop( intf_thread_t *_p_intf );
427 virtual bool OnDropFiles( wxCoord x, wxCoord y,
428 const wxArrayString& filenames );
431 intf_thread_t *p_intf;
435 /* Popup contextual menu */
436 class PopupMenu: public wxMenu
440 PopupMenu( intf_thread_t *p_intf, Interface *p_main_interface );
441 virtual ~PopupMenu();
444 /* Event handlers (these functions should _not_ be virtual) */
445 void OnClose( wxCommandEvent& event );
446 void OnEntrySelected( wxCommandEvent& event );
448 wxMenu *PopupMenu::CreateDummyMenu();
449 void PopupMenu::CreateMenuEntry( char *, vlc_object_t * );
450 wxMenu *PopupMenu::CreateSubMenu( char *, vlc_object_t * );
452 DECLARE_EVENT_TABLE();
454 intf_thread_t *p_intf;
455 Interface *p_main_interface;
460 class PopupEvtHandler : public wxEvtHandler
463 PopupEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
464 virtual ~PopupEvtHandler();
466 void PopupEvtHandler::OnMenuEvent( wxCommandEvent& event );
470 DECLARE_EVENT_TABLE()
472 intf_thread_t *p_intf;
473 Interface *p_main_interface;
476 class wxMenuItemExt: public wxMenuItem
480 wxMenuItemExt( wxMenu* parentMenu, int id,
481 const wxString& text,
482 const wxString& helpString,
484 char *_psz_var, int _i_object_id, vlc_value_t _val ):
485 wxMenuItem( parentMenu, id, text, helpString, kind )
487 /* Initializations */
489 i_object_id = _i_object_id;
493 virtual ~wxMenuItemExt() { if( psz_var ) free( psz_var ); };