1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.23 2003/05/12 17:33:19 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>
29 #include <wx/treectrl.h>
35 #define SLIDER_MAX_POS 10000
37 /* wxU is used to convert ansi strings to unicode strings (wchar_t) */
39 # define wxU(ansi) wxString(ansi, *wxConvCurrent)
41 # define wxU(ansi) ansi
44 #if !defined(MODULE_NAME_IS_skins)
45 /*****************************************************************************
46 * intf_sys_t: description and status of wxwindows interface
47 *****************************************************************************/
50 /* the wx parent window */
54 /* secondary windows */
55 Playlist *p_playlist_window;
56 Messages *p_messages_window;
57 FileInfo *p_fileinfo_window;
61 vlc_bool_t b_popup_changed; /* display menu ? */
62 vlc_bool_t b_window_changed; /* window display toggled ? */
63 vlc_bool_t b_playlist_changed; /* playlist display toggled ? */
64 vlc_bool_t b_slider_free; /* slider status */
67 vlc_bool_t b_program_update; /* do we need to update programs
69 vlc_bool_t b_title_update; /* do we need to update title menus */
70 vlc_bool_t b_chapter_update; /* do we need to update
72 vlc_bool_t b_audio_update; /* do we need to update audio menus */
73 vlc_bool_t b_spu_update; /* do we need to update spu menus */
75 /* windows and widgets */
77 /* The input thread */
78 input_thread_t * p_input;
81 int i_slider_pos; /* slider position */
82 int i_slider_oldpos; /* previous position */
84 /* The messages window */
85 msg_subscription_t* p_sub; /* message bank subscription */
87 /* Playlist management */
88 int i_playing; /* playlist selected item */
90 /* The window labels for DVD mode */
91 unsigned int i_part; /* current chapter */
93 #endif /* !defined(MODULE_NAME_IS_skins) */
95 /*****************************************************************************
97 *****************************************************************************/
99 /*****************************************************************************
100 * Classes declarations.
101 *****************************************************************************/
105 class Timer: public wxTimer
109 Timer( intf_thread_t *p_intf, Interface *p_main_interface );
112 virtual void Notify();
115 intf_thread_t *p_intf;
116 Interface *p_main_interface;
117 int i_old_playing_status;
121 class Interface: public wxFrame
125 Interface( intf_thread_t *p_intf );
126 virtual ~Interface();
127 void TogglePlayButton( int i_playing_status );
129 wxBoxSizer *frame_sizer;
130 wxStatusBar *statusbar;
133 wxWindow *slider_frame;
134 wxStaticBox *slider_box;
136 wxMenu *p_popup_menu;
138 wxArrayString mrl_history;
141 void CreateOurMenuBar();
142 void CreateOurToolBar();
143 void CreateOurSlider();
144 void Open( int i_access_method );
146 /* Event handlers (these functions should _not_ be virtual) */
147 void OnExit( wxCommandEvent& event );
148 void OnAbout( wxCommandEvent& event );
149 void OnMessages( wxCommandEvent& event );
150 void OnPlaylist( wxCommandEvent& event );
151 void OnLogs( wxCommandEvent& event );
152 void OnFileInfo( wxCommandEvent& event );
153 void OnPreferences( wxCommandEvent& event );
155 void OnOpenFile( wxCommandEvent& event );
156 void OnOpenDisc( wxCommandEvent& event );
157 void OnOpenNet( wxCommandEvent& event );
158 void OnOpenSat( wxCommandEvent& event );
160 void OnPlayStream( wxCommandEvent& event );
161 void OnStopStream( wxCommandEvent& event );
162 void OnSliderUpdate( wxScrollEvent& event );
163 void OnPrevStream( wxCommandEvent& event );
164 void OnNextStream( wxCommandEvent& event );
166 void OnMenuOpen( wxMenuEvent& event );
168 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
169 void OnContextMenu(wxContextMenuEvent& event);
171 void OnContextMenu(wxMouseEvent& event);
174 DECLARE_EVENT_TABLE();
177 intf_thread_t *p_intf;
179 wxFrame *p_prefs_dialog;
181 int i_old_playing_status;
183 /* For auto-generated menus */
184 wxMenu *p_audio_menu;
185 vlc_bool_t b_audio_menu;
186 wxMenu *p_video_menu;
187 vlc_bool_t b_video_menu;
191 class OpenDialog: public wxDialog
195 OpenDialog( intf_thread_t *p_intf, wxWindow *p_parent,
196 int i_access_method );
197 virtual ~OpenDialog();
202 wxPanel *FilePanel( wxWindow* parent );
203 wxPanel *DiscPanel( wxWindow* parent );
204 wxPanel *NetPanel( wxWindow* parent );
205 wxPanel *SatPanel( wxWindow* parent );
207 void UpdateMRL( int i_access_method );
209 /* Event handlers (these functions should _not_ be virtual) */
210 void OnOk( wxCommandEvent& event );
211 void OnCancel( wxCommandEvent& event );
213 void OnPageChange( wxNotebookEvent& event );
214 void OnMRLChange( wxCommandEvent& event );
216 /* Event handlers for the file page */
217 void OnFilePanelChange( wxCommandEvent& event );
218 void OnFileBrowse( wxCommandEvent& event );
220 /* Event handlers for the disc page */
221 void OnDiscPanelChange( wxCommandEvent& event );
222 void OnDiscTypeChange( wxCommandEvent& event );
224 /* Event handlers for the net page */
225 void OnNetPanelChange( wxCommandEvent& event );
226 void OnNetTypeChange( wxCommandEvent& event );
228 /* Event handlers for the stream output */
229 void OnSoutEnable( wxCommandEvent& event );
230 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
232 /* Event handlers for the demux dump */
233 void OnDemuxDumpEnable( wxCommandEvent& event );
234 void OnDemuxDumpBrowse( wxCommandEvent& event );
235 void OnDemuxDumpChange( wxCommandEvent& event );
237 DECLARE_EVENT_TABLE();
239 intf_thread_t *p_intf;
241 int i_current_access_method;
243 wxComboBox *mrl_combo;
245 /* Controls for the file panel */
246 wxComboBox *file_combo;
248 /* Controls for the disc panel */
249 wxRadioBox *disc_type;
250 wxTextCtrl *disc_device;
251 wxSpinCtrl *disc_title;
252 wxSpinCtrl *disc_chapter;
254 /* Controls for the net panel */
255 wxRadioBox *net_type;
257 wxPanel *net_subpanels[4];
258 wxRadioButton *net_radios[4];
259 wxSpinCtrl *net_ports[4];
260 wxTextCtrl *net_addrs[4];
262 /* Controls for the stream output */
263 wxButton *sout_button;
264 wxCheckBox *sout_checkbox;
266 /* Controls for the demux dump */
267 wxTextCtrl *demuxdump_textctrl;
268 wxButton *demuxdump_button;
269 wxCheckBox *demuxdump_checkbox;
280 /* Stream output Dialog */
281 class SoutDialog: public wxDialog
285 SoutDialog( intf_thread_t *p_intf, wxWindow *p_parent );
286 virtual ~SoutDialog();
292 wxPanel *AccessPanel( wxWindow* parent );
293 wxPanel *EncapsulationPanel( wxWindow* parent );
296 /* Event handlers (these functions should _not_ be virtual) */
297 void OnOk( wxCommandEvent& event );
298 void OnCancel( wxCommandEvent& event );
299 void OnMRLChange( wxCommandEvent& event );
300 void OnAccessTypeChange( wxCommandEvent& event );
302 /* Event handlers for the file access output */
303 void OnFileChange( wxCommandEvent& event );
304 void OnFileBrowse( wxCommandEvent& event );
306 /* Event handlers for the net access output */
307 void OnNetChange( wxCommandEvent& event );
309 /* Event handlers for the encapsulation panel */
310 void OnEncapsulationChange( wxCommandEvent& event );
312 DECLARE_EVENT_TABLE();
314 intf_thread_t *p_intf;
317 wxComboBox *mrl_combo;
318 wxPanel *access_panel;
319 wxPanel *encapsulation_panel;
321 /* Controls for the access outputs */
322 wxPanel *access_subpanels[4];
323 wxRadioButton *access_radios[4];
327 wxComboBox *file_combo;
328 wxSpinCtrl *net_port;
329 wxTextCtrl *net_addr;
331 /* Controls for the encapsulation */
332 wxRadioButton *encapsulation_radios[4];
333 int i_encapsulation_type;
337 /* Preferences Dialog */
339 class PrefsDialog: public wxFrame
343 PrefsDialog( intf_thread_t *p_intf, Interface *p_main_interface );
344 virtual ~PrefsDialog();
347 wxPanel *PrefsPanel( wxWindow* parent );
349 /* Event handlers (these functions should _not_ be virtual) */
350 void OnOk( wxCommandEvent& event );
351 void OnCancel( wxCommandEvent& event );
352 void OnSave( wxCommandEvent& event );
353 void OnResetAll( wxCommandEvent& event );
355 DECLARE_EVENT_TABLE();
357 intf_thread_t *p_intf;
358 Interface *p_main_interface;
360 PrefsTreeCtrl *prefs_tree;
364 class Messages: public wxFrame
368 Messages( intf_thread_t *p_intf, Interface *_p_main_interface );
373 /* Event handlers (these functions should _not_ be virtual) */
374 void OnClose( wxCommandEvent& event );
375 void OnVerbose( wxCommandEvent& event );
377 DECLARE_EVENT_TABLE();
379 intf_thread_t *p_intf;
380 Interface *p_main_interface;
381 wxTextCtrl *textctrl;
382 wxTextAttr *info_attr;
383 wxTextAttr *err_attr;
384 wxTextAttr *warn_attr;
385 wxTextAttr *dbg_attr;
387 vlc_bool_t b_verbose;
391 class Playlist: public wxFrame
395 Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
398 void UpdatePlaylist();
399 void ShowPlaylist( bool show );
405 void DeleteItem( int item );
407 /* Event handlers (these functions should _not_ be virtual) */
408 void OnAddMRL( wxCommandEvent& event );
409 void OnClose( wxCommandEvent& event );
410 void OnOpen( wxCommandEvent& event );
411 void OnSave( wxCommandEvent& event );
412 void OnInvertSelection( wxCommandEvent& event );
413 void OnDeleteSelection( wxCommandEvent& event );
414 void OnSelectAll( wxCommandEvent& event );
415 void OnActivateItem( wxListEvent& event );
416 void OnKeyDown( wxListEvent& event );
419 DECLARE_EVENT_TABLE();
421 intf_thread_t *p_intf;
422 Interface *p_main_interface;
423 wxListView *listview;
424 int i_update_counter;
428 class FileInfo: public wxFrame
432 FileInfo( intf_thread_t *p_intf, Interface *p_main_interface );
434 void UpdateFileInfo();
437 void OnClose( wxCommandEvent& event );
439 DECLARE_EVENT_TABLE();
441 intf_thread_t *p_intf;
442 wxTreeCtrl *fileinfo_tree;
443 wxTreeItemId fileinfo_root;
444 wxString fileinfo_root_label;
448 #if !defined(__WXX11__)
449 /* Drag and Drop class */
450 class DragAndDrop: public wxFileDropTarget
453 DragAndDrop( intf_thread_t *_p_intf );
455 virtual bool OnDropFiles( wxCoord x, wxCoord y,
456 const wxArrayString& filenames );
459 intf_thread_t *p_intf;
464 void PopupMenu( intf_thread_t *_p_intf, Interface *_p_main_interface,
465 const wxPoint& pos );
466 wxMenu *AudioMenu( intf_thread_t *_p_intf, Interface *_p_main_interface );
467 wxMenu *VideoMenu( intf_thread_t *_p_intf, Interface *_p_main_interface );
469 class MenuEvtHandler : public wxEvtHandler
472 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
473 virtual ~MenuEvtHandler();
475 void MenuEvtHandler::OnMenuEvent( wxCommandEvent& event );
479 DECLARE_EVENT_TABLE()
481 intf_thread_t *p_intf;
482 Interface *p_main_interface;
485 class Menu: public wxMenu
489 Menu( intf_thread_t *p_intf, Interface *p_main_interface, int i_count,
490 char **ppsz_names, int *pi_objects, int i_start_id );
494 /* Event handlers (these functions should _not_ be virtual) */
495 void OnClose( wxCommandEvent& event );
496 void OnEntrySelected( wxCommandEvent& event );
498 wxMenu *Menu::CreateDummyMenu();
499 void Menu::CreateMenuItem( wxMenu *, char *, vlc_object_t * );
500 wxMenu *Menu::CreateChoicesMenu( char *, vlc_object_t * );
502 DECLARE_EVENT_TABLE();
504 intf_thread_t *p_intf;
505 Interface *p_main_interface;