interface.hpp

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * interface.hpp: Main interface headers
00003  *****************************************************************************
00004  * Copyright (C) 1999-2005 the VideoLAN team
00005  * $Id$
00006  *
00007  * Authors: Gildas Bazin <gbazin@videolan.org>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
00022  *****************************************************************************/
00023 
00024 #ifndef _WXVLC_INTERFACE_H_
00025 #define _WXVLC_INTERFACE_H_
00026 
00027 #include "wxwidgets.hpp"
00028 #include "input_manager.hpp"
00029 
00030 #include <wx/dnd.h>
00031 #include <wx/accel.h>
00032 #include <wx/taskbar.h>
00033 
00034 class Splitter;
00035 
00036 namespace wxvlc
00037 {
00038     class Timer;
00039     class Interface;
00040 
00041 #if wxUSE_DRAG_AND_DROP
00042     /* Drag and Drop class */
00043     class DragAndDrop: public wxFileDropTarget
00044     {
00045     public:
00046         DragAndDrop( intf_thread_t *_p_intf, bool b_enqueue = false );
00047         virtual bool OnDropFiles( wxCoord x, wxCoord y,
00048                                   const wxArrayString& filenames );
00049 
00050     private:
00051         intf_thread_t *p_intf;
00052         bool b_enqueue;
00053     };
00054 #endif
00055 
00056     /* Systray integration */
00057 /* wxCocoa pretends to support this, but at least 2.6.x doesn't */
00058 #ifndef __APPLE__
00059 #ifdef wxHAS_TASK_BAR_ICON
00060    class Systray: public wxTaskBarIcon
00061    {
00062    public:
00063         Systray( Interface* p_main_interface, intf_thread_t *p_intf );
00064         virtual ~Systray() {};
00065         wxMenu* CreatePopupMenu();
00066         void UpdateTooltip( const wxChar* tooltip );
00067 
00068     private:
00069         void OnMenuIconize( wxCommandEvent& event );
00070         void OnLeftClick( wxTaskBarIconEvent& event );
00071         void OnPlayStream ( wxCommandEvent& event );
00072         void OnStopStream ( wxCommandEvent& event );
00073         void OnPrevStream ( wxCommandEvent& event );
00074         void OnNextStream ( wxCommandEvent& event );
00075         void OnExit(  wxCommandEvent& event );
00076         Interface* p_main_interface;
00077         intf_thread_t *p_intf;
00078         DECLARE_EVENT_TABLE()
00079     };
00080 #endif
00081 #endif
00082 
00083     /* Main Interface */
00084     class Interface: public wxFrame
00085     {
00086     public:
00087         /* Constructor */
00088         Interface( intf_thread_t *p_intf, long style = wxDEFAULT_FRAME_STYLE );
00089         virtual ~Interface();
00090         void Init();
00091         void TogglePlayButton( int i_playing_status );
00092         void Update();
00093         void PlayStream();
00094         void StopStream();
00095         void PrevStream();
00096         void NextStream();
00097 
00098         wxBoxSizer  *main_sizer;
00099         Splitter    *splitter;
00100 
00101         wxPanel     *main_panel;
00102         wxBoxSizer  *panel_sizer;
00103 
00104         wxStatusBar *statusbar;
00105 
00106         InputManager *input_manager;
00107 
00108         wxControl  *volctrl;
00109 
00110     /* wxCocoa pretends to support this, but at least 2.6.x doesn't */
00111     #ifndef __APPLE__
00112     #ifdef wxHAS_TASK_BAR_ICON
00113         Systray     *p_systray;
00114     #endif
00115     #endif
00116 
00117         wxWindow *video_window;
00118 
00119     private:
00120         void SetupHotkeys();
00121         void CreateOurMenuBar();
00122         void CreateOurToolBar();
00123         void CreateOurExtendedPanel();
00124         void Open( int i_access_method );
00125 
00126         void SetIntfMinSize();
00127 
00128         /* Event handlers (these functions should _not_ be virtual) */
00129         void OnExit( wxCommandEvent& event );
00130         void OnAbout( wxCommandEvent& event );
00131         void OnWebLink( wxCommandEvent& event );
00132         void OnWebHelp( wxCommandEvent& event );
00133 
00134         void OnOpenFileSimple( wxCommandEvent& event );
00135         void OnOpenDir( wxCommandEvent& event );
00136         void OnOpenFile( wxCommandEvent& event );
00137         void OnOpenDisc( wxCommandEvent& event );
00138         void OnOpenNet( wxCommandEvent& event );
00139         void OnOpenSat( wxCommandEvent& event );
00140 
00141         void OnExtended( wxCommandEvent& event );
00142         void OnSmallPlaylist( wxCommandEvent& event );
00143 
00144         void OnBookmarks( wxCommandEvent& event );
00145         void OnShowDialog( wxCommandEvent& event );
00146         void OnPlayStream( wxCommandEvent& event );
00147         void OnStopStream( wxCommandEvent& event );
00148         void OnPrevStream( wxCommandEvent& event );
00149         void OnNextStream( wxCommandEvent& event );
00150         void OnSlowStream( wxCommandEvent& event );
00151         void OnFastStream( wxCommandEvent& event );
00152     void OnToggleMute( wxCommandEvent& event );
00153     void OnSlideVolume( wxScrollEvent& event );
00154         void SyncVolume( );
00155 
00156         void OnInteraction( wxCommandEvent& event );
00157 
00158         void OnMenuOpen( wxMenuEvent& event );
00159 
00160     #if defined( __WXMSW__ ) || defined( __WXMAC__ )
00161         void OnContextMenu2(wxContextMenuEvent& event);
00162     #endif
00163         void OnContextMenu(wxMouseEvent& event);
00164 
00165         void OnControlEvent( wxCommandEvent& event );
00166 
00167         DECLARE_EVENT_TABLE();
00168 
00169         Timer *timer;
00170         intf_thread_t *p_intf;
00171 
00172         unsigned int i_update_counter;
00173         int i_old_playing_status;
00174 
00175         /* For auto-generated menus */
00176         wxMenu *p_settings_menu;
00177         wxMenu *p_audio_menu;
00178         wxMenu *p_video_menu;
00179         wxMenu *p_navig_menu;
00180 
00181         /* Extended panel */
00182         bool  b_extra;
00183         wxPanel     *extra_frame;
00184 
00185         /* Playlist panel */
00186         wxPanel     *playlist_manager;
00187 
00188         /* Utility dimensions */
00189         wxSize main_min_size;
00190         wxSize ext_min_size;
00191     };
00192 
00193 
00194     class WindowSettings
00195     {
00196     public:
00197         WindowSettings( intf_thread_t *_p_intf );
00198         virtual ~WindowSettings();
00199         enum
00200         {
00201             ID_SCREEN = -1,
00202             ID_MAIN,
00203             ID_PLAYLIST,
00204             ID_MESSAGES,
00205             ID_FILE_INFO,
00206             ID_BOOKMARKS,
00207             ID_VIDEO,
00208             ID_SMALL_PLAYLIST,
00209             ID_MAX,
00210         };
00211 
00212         void SetSettings( int id, bool _b_shown,
00213                     wxPoint p = wxDefaultPosition, wxSize s = wxDefaultSize );
00214         bool GetSettings( int id, bool& _b_shown, wxPoint& p, wxSize& s );
00215 
00216         void SetScreen( int i_screen_w, int i_screen_h );
00217 
00218     private:
00219         intf_thread_t *p_intf;
00220 
00221         int     i_screen_w;
00222         int     i_screen_h;
00223         bool    b_valid[ID_MAX];
00224         bool    b_shown[ID_MAX];
00225         wxPoint position[ID_MAX];
00226         wxSize  size[ID_MAX];
00227     };
00228 
00229 
00230     class MenuEvtHandler : public wxEvtHandler
00231     {
00232     public:
00233         MenuEvtHandler( intf_thread_t *p_intf, Interface *p_main_interface );
00234         virtual ~MenuEvtHandler();
00235 
00236         void OnMenuEvent( wxCommandEvent& event );
00237         void OnShowDialog( wxCommandEvent& event );
00238 
00239     private:
00240         DECLARE_EVENT_TABLE()
00241 
00242         intf_thread_t *p_intf;
00243         Interface *p_main_interface;
00244     };
00245 };
00246 
00247 void PopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
00248 void AudioPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
00249 void VideoPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
00250 void MiscPopupMenu( intf_thread_t *, wxWindow *, const wxPoint& );
00251 wxMenu *SettingsMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
00252 wxMenu *AudioMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
00253 wxMenu *VideoMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
00254 wxMenu *NavigMenu( intf_thread_t *, wxWindow *, wxMenu * = NULL );
00255 
00256 #endif

Generated on Wed Aug 13 08:02:38 2008 for VLC by  doxygen 1.5.1