1 /*****************************************************************************
2 * interface.hpp: Main interface headers
3 *****************************************************************************
4 * Copyright (C) 1999-2005 the VideoLAN team
7 * Authors: Gildas Bazin <gbazin@videolan.org>
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
24 #ifndef _WXVLC_INTERFACE_H_
25 #define _WXVLC_INTERFACE_H_
27 #include "wxwidgets.hpp"
28 #include "input_manager.hpp"
32 #include <wx/taskbar.h>
41 #if wxUSE_DRAG_AND_DROP
42 /* Drag and Drop class */
43 class DragAndDrop: public wxFileDropTarget
46 DragAndDrop( intf_thread_t *_p_intf, bool b_enqueue = false );
47 virtual bool OnDropFiles( wxCoord x, wxCoord y,
48 const wxArrayString& filenames );
51 intf_thread_t *p_intf;
56 /* Systray integration */
57 /* wxCocoa pretends to support this, but at least 2.6.x doesn't */
59 #ifdef wxHAS_TASK_BAR_ICON
60 class Systray: public wxTaskBarIcon
63 Systray( Interface* p_main_interface, intf_thread_t *p_intf );
64 virtual ~Systray() {};
65 wxMenu* CreatePopupMenu();
66 void UpdateTooltip( const wxChar* tooltip );
69 void OnMenuIconize( wxCommandEvent& event );
70 void OnLeftClick( wxTaskBarIconEvent& event );
71 void OnPlayStream ( wxCommandEvent& event );
72 void OnStopStream ( wxCommandEvent& event );
73 void OnPrevStream ( wxCommandEvent& event );
74 void OnNextStream ( wxCommandEvent& event );
75 void OnExit( wxCommandEvent& event );
76 Interface* p_main_interface;
77 intf_thread_t *p_intf;
84 class Interface: public wxFrame
88 Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE );
91 void TogglePlayButton( int i_playing_status );
98 wxBoxSizer *main_sizer;
102 wxBoxSizer *panel_sizer;
104 wxStatusBar *statusbar;
106 InputManager *input_manager;
110 /* wxCocoa pretends to support this, but at least 2.6.x doesn't */
112 #ifdef wxHAS_TASK_BAR_ICON
117 wxWindow *video_window;
121 void CreateOurMenuBar();
122 void CreateOurToolBar();
123 void CreateOurExtendedPanel();
124 void Open( int i_access_method );
126 void SetIntfMinSize();
128 /* Event handlers (these functions should _not_ be virtual) */
129 void OnExit( wxCommandEvent& event );
130 void OnAbout( wxCommandEvent& event );
131 void OnWebLink( wxCommandEvent& event );
132 void OnWebHelp( wxCommandEvent& event );
134 void OnOpenFileSimple( wxCommandEvent& event );
135 void OnOpenDir( wxCommandEvent& event );
136 void OnOpenFile( wxCommandEvent& event );
137 void OnOpenDisc( wxCommandEvent& event );
138 void OnOpenNet( wxCommandEvent& event );
139 void OnOpenSat( wxCommandEvent& event );
141 void OnExtended( wxCommandEvent& event );
142 void OnSmallPlaylist( wxCommandEvent& event );
144 void OnBookmarks( wxCommandEvent& event );
145 void OnShowDialog( wxCommandEvent& event );
146 void OnPlayStream( wxCommandEvent& event );
147 void OnStopStream( wxCommandEvent& event );
148 void OnPrevStream( wxCommandEvent& event );
149 void OnNextStream( wxCommandEvent& event );
150 void OnSlowStream( wxCommandEvent& event );
151 void OnFastStream( wxCommandEvent& event );
152 void OnToggleMute( wxCommandEvent& event );
153 void OnSlideVolume( wxScrollEvent& event );
156 void OnInteraction( wxCommandEvent& event );
158 void OnMenuOpen( wxMenuEvent& event );
160 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
161 void OnContextMenu2(wxContextMenuEvent& event);
163 void OnContextMenu(wxMouseEvent& event);
165 void OnControlEvent( wxCommandEvent& event );
167 DECLARE_EVENT_TABLE();
170 intf_thread_t *p_intf;
172 unsigned int i_update_counter;
173 int i_old_playing_status;
175 /* For auto-generated menus */
176 wxMenu *p_settings_menu;
177 wxMenu *p_audio_menu;
178 wxMenu *p_video_menu;
179 wxMenu *p_navig_menu;
183 wxPanel *extra_frame;
186 wxPanel *playlist_manager;
188 /* Utility dimensions */
189 wxSize main_min_size;
197 WindowSettings( intf_thread_t *_p_intf );
198 virtual ~WindowSettings();
212 void SetSettings( int id, bool _b_shown,
213 wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize );
214 bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s );
216 void SetScreen( int i_screen_w, int i_screen_h );
219 intf_thread_t *p_intf;
223 bool b_valid[ID_MAX];
224 bool b_shown[ID_MAX];
225 wxPoint position[ID_MAX];
230 class MenuEvtHandler : public wxEvtHandler
233 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
234 virtual ~MenuEvtHandler();
236 void OnMenuEvent( wxCommandEvent& event );
237 void OnShowDialog( wxCommandEvent& event );
240 DECLARE_EVENT_TABLE()
242 intf_thread_t *p_intf;
243 Interface *p_main_interface;
247 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
248 void AudioPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
249 void VideoPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
250 void MiscPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
251 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
252 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
253 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
254 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );