]> git.sesse.net Git - vlc/blob - modules/gui/wxwidgets/interface.hpp
* modules/gui/wxwidgets: start of a playlist_manager widget.
[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., 59 Temple Place - Suite 330, Boston, MA  02111, 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
35 namespace wxvlc
36 {
37     class Timer;
38     class Interface;
39
40 #if wxUSE_DRAG_AND_DROP
41     /* Drag and Drop class */
42     class DragAndDrop: public wxFileDropTarget
43     {
44     public:
45         DragAndDrop( intf_thread_t *_p_intf, vlc_bool_t b_enqueue = VLC_FALSE );
46         virtual bool OnDropFiles( wxCoord x, wxCoord y,
47                                   const wxArrayString& filenames );
48
49     private:
50         intf_thread_t *p_intf;
51         vlc_bool_t b_enqueue;
52     };
53 #endif
54
55     /* Systray integration */
56 #ifdef wxHAS_TASK_BAR_ICON
57    class Systray: public wxTaskBarIcon
58    {
59    public:
60         Systray( Interface* p_main_interface, intf_thread_t *p_intf );
61         virtual ~Systray() {};
62         wxMenu* CreatePopupMenu();
63         void UpdateTooltip( const wxChar* tooltip );
64
65     private:
66         void OnMenuIconize( wxCommandEvent& event );
67         void OnLeftClick( wxTaskBarIconEvent& event );
68         void OnPlayStream ( wxCommandEvent& event );
69         void OnStopStream ( wxCommandEvent& event );
70         void OnPrevStream ( wxCommandEvent& event );
71         void OnNextStream ( wxCommandEvent& event );
72         void OnExit(  wxCommandEvent& event );
73         Interface* p_main_interface;
74         intf_thread_t *p_intf;
75         DECLARE_EVENT_TABLE()
76     };
77 #endif
78
79     /* Main Interface */
80     class Interface: public wxFrame
81     {
82     public:
83         /* Constructor */
84         Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE );
85         virtual ~Interface();
86         void Init();
87         void TogglePlayButton( int i_playing_status );
88         void Update();
89         void PlayStream();
90         void StopStream();
91         void PrevStream();
92         void NextStream();
93
94         wxBoxSizer  *main_sizer;
95
96         wxPanel     *main_panel;
97         wxBoxSizer  *panel_sizer;
98
99         wxStatusBar *statusbar;
100
101         InputManager *input_manager;
102
103         wxControl  *volctrl;
104
105     #ifdef wxHAS_TASK_BAR_ICON
106         Systray     *p_systray;
107     #endif
108
109         wxWindow *video_window;
110
111     private:
112         void SetupHotkeys();
113         void CreateOurMenuBar();
114         void CreateOurToolBar();
115         void CreateOurExtendedPanel();
116         void Open( int i_access_method );
117
118         void SetIntfMinSize();
119
120         /* Event handlers (these functions should _not_ be virtual) */
121         void OnExit( wxCommandEvent& event );
122         void OnAbout( wxCommandEvent& event );
123
124         void OnOpenFileSimple( wxCommandEvent& event );
125         void OnOpenDir( wxCommandEvent& event );
126         void OnOpenFile( wxCommandEvent& event );
127         void OnOpenDisc( wxCommandEvent& event );
128         void OnOpenNet( wxCommandEvent& event );
129         void OnOpenSat( wxCommandEvent& event );
130
131         void OnExtended( wxCommandEvent& event );
132         void OnSmallPlaylist( wxCommandEvent& event );
133
134         void OnBookmarks( wxCommandEvent& event );
135         void OnShowDialog( wxCommandEvent& event );
136         void OnPlayStream( wxCommandEvent& event );
137         void OnStopStream( wxCommandEvent& event );
138         void OnPrevStream( wxCommandEvent& event );
139         void OnNextStream( wxCommandEvent& event );
140         void OnSlowStream( wxCommandEvent& event );
141         void OnFastStream( wxCommandEvent& event );
142
143         void OnMenuOpen( wxMenuEvent& event );
144
145     #if defined( __WXMSW__ ) || defined( __WXMAC__ )
146         void OnContextMenu2(wxContextMenuEvent& event);
147     #endif
148         void OnContextMenu(wxMouseEvent& event);
149
150         void OnControlEvent( wxCommandEvent& event );
151
152         DECLARE_EVENT_TABLE();
153
154         Timer *timer;
155         intf_thread_t *p_intf;
156
157         int i_old_playing_status;
158
159         /* For auto-generated menus */
160         wxMenu *p_settings_menu;
161         wxMenu *p_audio_menu;
162         wxMenu *p_video_menu;
163         wxMenu *p_navig_menu;
164
165         /* Extended panel */
166         vlc_bool_t  b_extra;
167         wxPanel     *extra_frame;
168
169         /* Playlist panel */
170         vlc_bool_t  b_playlist_manager;
171         wxPanel     *playlist_manager;
172
173         /* Utility dimensions */
174         wxSize main_min_size;
175         wxSize playlist_min_size;
176         wxSize ext_min_size;
177     };
178
179
180     class WindowSettings
181     {
182     public:
183         WindowSettings( intf_thread_t *_p_intf );
184         virtual ~WindowSettings();
185         enum
186         {
187             ID_SCREEN = -1,
188             ID_MAIN,
189             ID_PLAYLIST,
190             ID_MESSAGES,
191             ID_FILE_INFO,
192             ID_BOOKMARKS,
193             ID_VIDEO,
194             ID_MAX,
195         };
196
197         void SetSettings( int id, bool _b_shown,
198                     wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize );
199         bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s );
200
201         void SetScreen( int i_screen_w, int i_screen_h );
202
203     private:
204         intf_thread_t *p_intf;
205
206         int     i_screen_w;
207         int     i_screen_h;
208         bool    b_valid[ID_MAX];
209         bool    b_shown[ID_MAX];
210         wxPoint position[ID_MAX];
211         wxSize  size[ID_MAX];
212     };
213
214
215     class MenuEvtHandler : public wxEvtHandler
216     {
217     public:
218         MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
219         virtual ~MenuEvtHandler();
220
221         void OnMenuEvent( wxCommandEvent& event );
222         void OnShowDialog( wxCommandEvent& event );
223
224     private:
225         DECLARE_EVENT_TABLE()
226
227         intf_thread_t *p_intf;
228         Interface *p_main_interface;
229     };
230 };
231
232 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
233 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
234 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
235 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
236 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
237
238 #endif