1 /*****************************************************************************
2 * wxwindows.h: private wxWindows interface description
3 *****************************************************************************
4 * Copyright (C) 1999, 2000 VideoLAN
5 * $Id: wxwindows.h,v 1.9 2003/03/22 03:14:34 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;
107 class Interface: public wxFrame
111 Interface( intf_thread_t *p_intf );
112 virtual ~Interface();
114 wxBoxSizer *frame_sizer;
115 wxStatusBar *statusbar;
118 wxWindow *slider_frame;
119 wxStaticBox *slider_box;
121 wxMenu *p_popup_menu;
123 wxArrayString mrl_history;
126 void CreateOurMenuBar();
127 void CreateOurToolBar();
128 void CreateOurSlider();
129 void Open( int i_access_method );
131 /* Event handlers (these functions should _not_ be virtual) */
132 void OnExit( wxCommandEvent& event );
133 void OnAbout( wxCommandEvent& event );
134 void OnMessages( wxCommandEvent& event );
135 void OnPlaylist( wxCommandEvent& event );
136 void OnLogs( wxCommandEvent& event );
137 void OnFileInfo( wxCommandEvent& event );
139 void OnOpenFile( wxCommandEvent& event );
140 void OnOpenDisc( wxCommandEvent& event );
141 void OnOpenNet( wxCommandEvent& event );
142 void OnOpenSat( wxCommandEvent& event );
144 void OnPlayStream( wxCommandEvent& event );
145 void OnStopStream( wxCommandEvent& event );
146 void OnSliderUpdate( wxScrollEvent& event );
147 void OnPrevStream( wxCommandEvent& event );
148 void OnNextStream( wxCommandEvent& event );
150 void TogglePlayButton();
152 DECLARE_EVENT_TABLE();
155 intf_thread_t *p_intf;
156 int i_playing_status;
160 class OpenDialog: public wxDialog
164 OpenDialog( intf_thread_t *p_intf, Interface *p_main_interface,
165 int i_access_method );
166 virtual ~OpenDialog();
173 wxPanel *FilePanel( wxWindow* parent );
174 wxPanel *DiscPanel( wxWindow* parent );
175 wxPanel *NetPanel( wxWindow* parent );
176 wxPanel *SatPanel( wxWindow* parent );
178 void UpdateMRL( int i_access_method );
180 /* Event handlers (these functions should _not_ be virtual) */
181 void OnOk( wxCommandEvent& event );
182 void OnCancel( wxCommandEvent& event );
184 void OnPageChange( wxNotebookEvent& event );
185 void OnMRLChange( wxCommandEvent& event );
187 /* Event handlers for the file page */
188 void OnFilePanelChange( wxCommandEvent& event );
189 void OnFileBrowse( wxCommandEvent& event );
191 /* Event handlers for the disc page */
192 void OnDiscPanelChange( wxCommandEvent& event );
193 void OnDiscTypeChange( wxCommandEvent& event );
195 /* Event handlers for the net page */
196 void OnNetPanelChange( wxCommandEvent& event );
197 void OnNetTypeChange( wxCommandEvent& event );
199 /* Event handlers for the stream output */
200 void OnSoutEnable( wxCommandEvent& event );
201 void OnSoutSettings( wxCommandEvent& WXUNUSED(event) );
203 DECLARE_EVENT_TABLE();
205 intf_thread_t *p_intf;
206 Interface *p_main_interface;
208 wxComboBox *mrl_combo;
210 /* Controls for the file panel */
211 wxComboBox *file_combo;
213 /* Controls for the disc panel */
214 wxRadioBox *disc_type;
215 wxTextCtrl *disc_device;
216 wxSpinCtrl *disc_title;
217 wxSpinCtrl *disc_chapter;
219 /* Controls for the net panel */
220 wxRadioBox *net_type;
222 wxPanel *net_subpanels[4];
223 wxRadioButton *net_radios[4];
224 wxSpinCtrl *net_ports[4];
225 wxTextCtrl *net_addrs[4];
227 /* Controls for the stream output */
228 wxButton *sout_button;
239 /* Stream output Dialog */
240 class SoutDialog: public wxDialog
244 SoutDialog( intf_thread_t *p_intf, Interface *p_main_interface );
245 virtual ~SoutDialog();
251 wxPanel *AccessPanel( wxWindow* parent );
252 wxPanel *EncapsulationPanel( wxWindow* parent );
254 /* Event handlers (these functions should _not_ be virtual) */
255 void OnOk( wxCommandEvent& event );
256 void OnCancel( wxCommandEvent& event );
257 void OnMRLChange( wxCommandEvent& event );
258 void OnAccessTypeChange( wxCommandEvent& event );
260 /* Event handlers for the file access output */
261 void OnFileChange( wxCommandEvent& event );
262 void OnFileBrowse( wxCommandEvent& event );
264 /* Event handlers for the net access output */
265 void OnNetChange( wxCommandEvent& event );
266 void OnMulticastChange( wxCommandEvent& event );
268 /* Event handlers for the encapsulation panel */
269 void OnEncapsulationChange( wxCommandEvent& event );
271 DECLARE_EVENT_TABLE();
273 intf_thread_t *p_intf;
274 Interface *p_main_interface;
276 wxComboBox *mrl_combo;
277 wxPanel *access_panel;
278 wxPanel *encapsulation_panel;
280 /* Controls for the access outputs */
281 wxPanel *access_subpanels[4];
282 wxRadioButton *access_radios[4];
283 wxCheckBox *multicast_checkbox;
286 vlc_bool_t b_multicast;
288 wxComboBox *file_combo;
289 wxSpinCtrl *net_port;
290 wxTextCtrl *net_addr;
292 /* Controls for the encapsulation */
293 wxRadioButton *encapsulation_radios[4];
294 int i_encapsulation_type;
299 class Messages: public wxFrame
303 Messages( intf_thread_t *p_intf, Interface *_p_main_interface );
308 /* Event handlers (these functions should _not_ be virtual) */
309 void OnClose( wxCommandEvent& event );
311 DECLARE_EVENT_TABLE();
313 intf_thread_t *p_intf;
314 Interface *p_main_interface;
316 wxTextCtrl *textctrl;
317 wxTextAttr *info_attr;
318 wxTextAttr *err_attr;
319 wxTextAttr *warn_attr;
320 wxTextAttr *dbg_attr;
324 class Playlist: public wxFrame
328 Playlist( intf_thread_t *p_intf, Interface *p_main_interface );
334 void DeleteItem( int item );
336 /* Event handlers (these functions should _not_ be virtual) */
337 void OnAddUrl( wxCommandEvent& event );
338 void OnAddDirectory( wxCommandEvent& event );
339 void OnClose( wxCommandEvent& event );
340 void OnInvertSelection( wxCommandEvent& event );
341 void OnDeleteSelection( wxCommandEvent& event );
342 void OnSelectAll( wxCommandEvent& event );
343 void OnActivateItem( wxListEvent& event );
344 void OnKeyDown( wxListEvent& event );
346 DECLARE_EVENT_TABLE();
348 intf_thread_t *p_intf;
349 Interface *p_main_interface;
350 wxListView *listview;
355 class FileInfo: public wxFrame
359 FileInfo( intf_thread_t *p_intf, Interface *p_main_interface );
363 void OnClose( wxCommandEvent& event );
364 DECLARE_EVENT_TABLE();
368 #if !defined(__WXX11__)
369 /* Drag and Drop class */
370 class DragAndDrop: public wxFileDropTarget
373 DragAndDrop( intf_thread_t *_p_intf );
375 virtual bool OnDropFiles( wxCoord x, wxCoord y,
376 const wxArrayString& filenames );
379 intf_thread_t *p_intf;
383 /* Popup contextual menu */
384 class PopupMenu: public wxMenu
388 PopupMenu( intf_thread_t *p_intf, Interface *p_main_interface );
389 virtual ~PopupMenu();
392 /* Event handlers (these functions should _not_ be virtual) */
393 void OnClose( wxCommandEvent& event );
394 void OnEntrySelected( wxCommandEvent& event );
396 wxMenu *PopupMenu::CreateDummyMenu();
397 void PopupMenu::CreateMenuEntry( char *, vlc_object_t * );
398 wxMenu *PopupMenu::CreateSubMenu( char *, vlc_object_t * );
400 DECLARE_EVENT_TABLE();
402 intf_thread_t *p_intf;
403 Interface *p_main_interface;
408 class PopupEvtHandler : public wxEvtHandler
411 PopupEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
412 virtual ~PopupEvtHandler();
414 void PopupEvtHandler::OnMenuEvent( wxCommandEvent& event );
418 DECLARE_EVENT_TABLE()
420 intf_thread_t *p_intf;
421 Interface *p_main_interface;
424 class wxMenuItemExt: public wxMenuItem
428 wxMenuItemExt( wxMenu* parentMenu, int id,
429 const wxString& text,
430 const wxString& helpString,
432 char *_psz_var, int _i_object_id, vlc_value_t _val ):
433 wxMenuItem( parentMenu, id, text, helpString, kind )
435 /* Initializations */
437 i_object_id = _i_object_id;
441 virtual ~wxMenuItemExt() { if( psz_var ) free( psz_var ); };