]> git.sesse.net Git - vlc/blob - modules/gui/wxwidgets/interface.hpp
update module LIST file.
[vlc] / modules / gui / wxwidgets / interface.hpp
1 /*****************************************************************************
2  * interface.hpp: Main interface headers
3  *****************************************************************************
4  * Copyright (C) 1999-2005 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *
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.
13  *
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.
18  *
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  *****************************************************************************/
23
24 #ifndef _WXVLC_INTERFACE_H_
25 #define _WXVLC_INTERFACE_H_
26
27 #include "wxwidgets.hpp"
28 #include "input_manager.hpp"
29
30 #include <wx/dnd.h>
31 #include <wx/accel.h>
32 #include <wx/taskbar.h>
33
34 class Splitter;
35
36 namespace wxvlc
37 {
38     class Timer;
39     class Interface;
40
41 #if wxUSE_DRAG_AND_DROP
42     /* Drag and Drop class */
43     class DragAndDrop: public wxFileDropTarget
44     {
45     public:
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 );
49
50     private:
51         intf_thread_t *p_intf;
52         vlc_bool_t b_enqueue;
53     };
54 #endif
55
56     /* Systray integration */
57 /* wxCocoa pretends to support this, but at least 2.6.x doesn't */
58 #ifndef __APPLE__
59 #ifdef wxHAS_TASK_BAR_ICON
60    class Systray: public wxTaskBarIcon
61    {
62    public:
63         Systray( Interface* p_main_interface, intf_thread_t *p_intf );
64         virtual ~Systray() {};
65         wxMenu* CreatePopupMenu();
66         void UpdateTooltip( const wxChar* tooltip );
67
68     private:
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;
78         DECLARE_EVENT_TABLE()
79     };
80 #endif
81 #endif
82
83     /* Main Interface */
84     class Interface: public wxFrame
85     {
86     public:
87         /* Constructor */
88         Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE );
89         virtual ~Interface();
90         void Init();
91         void TogglePlayButton( int i_playing_status );
92         void Update();
93         void PlayStream();
94         void StopStream();
95         void PrevStream();
96         void NextStream();
97
98         wxBoxSizer  *main_sizer;
99         Splitter    *splitter;
100
101         wxPanel     *main_panel;
102         wxBoxSizer  *panel_sizer;
103
104         wxStatusBar *statusbar;
105
106         InputManager *input_manager;
107
108         wxControl  *volctrl;
109
110     /* wxCocoa pretends to support this, but at least 2.6.x doesn't */
111     #ifndef __APPLE__
112     #ifdef wxHAS_TASK_BAR_ICON
113         Systray     *p_systray;
114     #endif
115     #endif
116
117         wxWindow *video_window;
118
119     private:
120         void SetupHotkeys();
121         void CreateOurMenuBar();
122         void CreateOurToolBar();
123         void CreateOurExtendedPanel();
124         void Open( int i_access_method );
125
126         void SetIntfMinSize();
127
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 );
133
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 );
140
141         void OnExtended( wxCommandEvent& event );
142         void OnSmallPlaylist( wxCommandEvent& event );
143
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
153         void OnInteraction( wxCommandEvent& event );
154
155         void OnMenuOpen( wxMenuEvent& event );
156
157     #if defined( __WXMSW__ ) || defined( __WXMAC__ )
158         void OnContextMenu2(wxContextMenuEvent& event);
159     #endif
160         void OnContextMenu(wxMouseEvent& event);
161
162         void OnControlEvent( wxCommandEvent& event );
163
164         DECLARE_EVENT_TABLE();
165
166         Timer *timer;
167         intf_thread_t *p_intf;
168
169         unsigned int i_update_counter;
170         int i_old_playing_status;
171
172         /* For auto-generated menus */
173         wxMenu *p_settings_menu;
174         wxMenu *p_audio_menu;
175         wxMenu *p_video_menu;
176         wxMenu *p_navig_menu;
177
178         /* Extended panel */
179         vlc_bool_t  b_extra;
180         wxPanel     *extra_frame;
181
182         /* Playlist panel */
183         wxPanel     *playlist_manager;
184
185         /* Utility dimensions */
186         wxSize main_min_size;
187         wxSize ext_min_size;
188     };
189
190
191     class WindowSettings
192     {
193     public:
194         WindowSettings( intf_thread_t *_p_intf );
195         virtual ~WindowSettings();
196         enum
197         {
198             ID_SCREEN = -1,
199             ID_MAIN,
200             ID_PLAYLIST,
201             ID_MESSAGES,
202             ID_FILE_INFO,
203             ID_BOOKMARKS,
204             ID_VIDEO,
205             ID_SMALL_PLAYLIST,
206             ID_MAX,
207         };
208
209         void SetSettings( int id, bool _b_shown,
210                     wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize );
211         bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s );
212
213         void SetScreen( int i_screen_w, int i_screen_h );
214
215     private:
216         intf_thread_t *p_intf;
217
218         int     i_screen_w;
219         int     i_screen_h;
220         bool    b_valid[ID_MAX];
221         bool    b_shown[ID_MAX];
222         wxPoint position[ID_MAX];
223         wxSize  size[ID_MAX];
224     };
225
226
227     class MenuEvtHandler : public wxEvtHandler
228     {
229     public:
230         MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
231         virtual ~MenuEvtHandler();
232
233         void OnMenuEvent( wxCommandEvent& event );
234         void OnShowDialog( wxCommandEvent& event );
235
236     private:
237         DECLARE_EVENT_TABLE()
238
239         intf_thread_t *p_intf;
240         Interface *p_main_interface;
241     };
242 };
243
244 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
245 void AudioPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
246 void VideoPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
247 void MiscPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
248 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
249 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
250 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
251 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
252
253 #endif