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, vlc_bool_t b_enqueue = VLC_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 );
132 void OnOpenFileSimple( wxCommandEvent& event );
133 void OnOpenDir( wxCommandEvent& event );
134 void OnOpenFile( wxCommandEvent& event );
135 void OnOpenDisc( wxCommandEvent& event );
136 void OnOpenNet( wxCommandEvent& event );
137 void OnOpenSat( wxCommandEvent& event );
139 void OnExtended( wxCommandEvent& event );
140 void OnSmallPlaylist( wxCommandEvent& event );
142 void OnBookmarks( wxCommandEvent& event );
143 void OnShowDialog( wxCommandEvent& event );
144 void OnPlayStream( wxCommandEvent& event );
145 void OnStopStream( wxCommandEvent& event );
146 void OnPrevStream( wxCommandEvent& event );
147 void OnNextStream( wxCommandEvent& event );
148 void OnSlowStream( wxCommandEvent& event );
149 void OnFastStream( wxCommandEvent& event );
151 void OnInteraction( wxCommandEvent& event );
153 void OnMenuOpen( wxMenuEvent& event );
155 #if defined( __WXMSW__ ) || defined( __WXMAC__ )
156 void OnContextMenu2(wxContextMenuEvent& event);
158 void OnContextMenu(wxMouseEvent& event);
160 void OnControlEvent( wxCommandEvent& event );
162 DECLARE_EVENT_TABLE();
165 intf_thread_t *p_intf;
167 int i_old_playing_status;
169 /* For auto-generated menus */
170 wxMenu *p_settings_menu;
171 wxMenu *p_audio_menu;
172 wxMenu *p_video_menu;
173 wxMenu *p_navig_menu;
177 wxPanel *extra_frame;
180 wxPanel *playlist_manager;
182 /* Utility dimensions */
183 wxSize main_min_size;
191 WindowSettings( intf_thread_t *_p_intf );
192 virtual ~WindowSettings();
206 void SetSettings( int id, bool _b_shown,
207 wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize );
208 bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s );
210 void SetScreen( int i_screen_w, int i_screen_h );
213 intf_thread_t *p_intf;
217 bool b_valid[ID_MAX];
218 bool b_shown[ID_MAX];
219 wxPoint position[ID_MAX];
224 class MenuEvtHandler : public wxEvtHandler
227 MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
228 virtual ~MenuEvtHandler();
230 void OnMenuEvent( wxCommandEvent& event );
231 void OnShowDialog( wxCommandEvent& event );
234 DECLARE_EVENT_TABLE()
236 intf_thread_t *p_intf;
237 Interface *p_main_interface;
241 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
242 void AudioPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
243 void VideoPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
244 void MiscPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
245 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
246 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
247 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
248 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );