X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fwince%2Fwince.h;h=df8af25c5035ebafec257758539bfd8cecca4f0d;hb=6ee1e193fd896ab9a4729fde14f009d9ce629815;hp=67e29b77d3655e04a9880fa570e82221d1137717;hpb=6c0ceeb39cf4038daffa2e078e49e39949342bc3;p=vlc diff --git a/modules/gui/wince/wince.h b/modules/gui/wince/wince.h index 67e29b77d3..df8af25c50 100644 --- a/modules/gui/wince/wince.h +++ b/modules/gui/wince/wince.h @@ -1,7 +1,7 @@ /***************************************************************************** * wince.h: private WinCE interface descriptor ***************************************************************************** - * Copyright (C) 1999-2004 VideoLAN + * Copyright (C) 1999-2004 the VideoLAN team * $Id$ * * Authors: Gildas Bazin @@ -19,15 +19,14 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #ifndef WINCE_RESOURCE -#define MENU_HEIGHT 26 #define SLIDER_HEIGHT 50 - #define SLIDER_MAX_POS 10000 +#define MENU_HEIGHT 26 #define FILE_ACCESS 1 #define NET_ACCESS 2 @@ -35,15 +34,19 @@ #define OPEN_NORMAL 0 #define OPEN_STREAM 1 +#if defined( UNDER_CE ) && defined(__MINGW32__) + /* This is a gross hack for the wince gcc cross-compiler */ +# define _off_t long +#endif + #include "vlc_keys.h" #include #include #include -using namespace std; - -vector SeparateEntries( LPWSTR entries ); +using namespace std; +class CBaseWindow; class MenuItemExt; class VideoWindow; @@ -52,6 +55,9 @@ class VideoWindow; *****************************************************************************/ struct intf_sys_t { + /* the parent window */ + CBaseWindow *p_window; + /* special actions */ vlc_bool_t b_playing; @@ -89,24 +95,30 @@ struct intf_sys_t class CBaseWindow { public: - CBaseWindow(){ hInst = 0; } - virtual ~CBaseWindow() {}; + CBaseWindow( intf_thread_t *_p_intf = 0, CBaseWindow *_p_parent = 0, + HINSTANCE _hInst = 0 ) + : hWnd(0), hInst(_hInst), p_parent(_p_parent), p_intf(_p_intf) {}; + virtual ~CBaseWindow() {}; - HWND hWnd; // The main window handle - BOOL DlgFlag; // True if object is a dialog window + HWND hWnd; // The main window handle - static LRESULT CALLBACK BaseWndProc( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam ); + static LRESULT CALLBACK BaseWndProc( HWND, UINT, WPARAM, LPARAM ); + static int CreateDialogBox( HWND, CBaseWindow * ); + + HWND GetHandle() { return hWnd; } + BOOL Show( BOOL b_show ) { return (hWnd && ShowWindow(hWnd, b_show)); } + BOOL IsShown( void ) { return (hWnd && IsWindowVisible(hWnd)); } protected: - HINSTANCE hInst; // The current instance - HWND hwndCB; // The command bar handle + HINSTANCE hInst; // The current instance + HWND hwndCB; // The command bar handle + + HINSTANCE GetInstance () const { return hInst; } + virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ) { return 0; }; - HINSTANCE GetInstance () const { return hInst; } - virtual LRESULT WndProc( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam, - PBOOL pbProcessed ){*pbProcessed = FALSE; return 0;} + CBaseWindow *p_parent; + intf_thread_t *p_intf; }; class FileInfo; @@ -116,19 +128,23 @@ class Timer; class OpenDialog; class PrefsDialog; -CBaseWindow *CreateVideoWindow( intf_thread_t *, HINSTANCE, HWND ); +CBaseWindow *CreateDialogsProvider( intf_thread_t *, CBaseWindow *, HINSTANCE); +CBaseWindow *CreateVideoWindow( intf_thread_t *, HWND ); +void PopupMenu( intf_thread_t *, HWND, POINT ); /* Main Interface */ class Interface : public CBaseWindow { public: /* Constructor */ - Interface(){} - ~Interface(){} + Interface( intf_thread_t *, CBaseWindow *, HINSTANCE ); + ~Interface(); - BOOL InitInstance( HINSTANCE hInstance, intf_thread_t *_pIntf ); + BOOL InitInstance(); + HWND CreateMenuBar( HWND, HINSTANCE ); void TogglePlayButton( int i_playing_status ); + void Update(); HWND hwndMain; // Handle to the main window. @@ -140,42 +156,38 @@ public: HWND hwndSB; // Handle to the status bar. HMENU hPopUpMenu; HMENU hMenu; - FileInfo *fi; // pas besoin de la plupart de ses attributs - Messages *hmsg; - PrefsDialog *pref; - Playlist *pl; - Timer *ti; - OpenDialog *open; + + Timer *timer; CBaseWindow *video; - HWND hwndVideo; protected: - virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, - PBOOL pbProcessed ); + virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ); - HWND WINAPI CreateToolbar( HWND ); - HWND WINAPI CreateSliderbar( HWND ); - HWND WINAPI CreateStaticText( HWND ); - HWND WINAPI CreateVolTrackbar( HWND ); - HWND WINAPI CreateStatusbar( HWND ); + void OnShowDialog( int ); - void OnOpenFileSimple( void ); void OnPlayStream( void ); - void OnVideoOnTop( void ); - - void OnSliderUpdate( int wp ); - void OnChange( int wp ); - void Change( int i_volume ); void OnStopStream( void ); void OnPrevStream( void ); void OnNextStream( void ); void OnSlowStream( void ); void OnFastStream( void ); - intf_thread_t *pIntf; + void OnVideoOnTop( void ); + void OnSliderUpdate( int wp ); + void OnChange( int wp ); + void VolumeChange( int i_volume ); + void VolumeUpdate( void ); int i_old_playing_status; + +private: + HMENU menu_settings; + HMENU menu_video; + HMENU menu_audio; + HMENU menu_navigation; + + vlc_bool_t b_volume_hold; }; /* File Info */ @@ -183,21 +195,20 @@ class FileInfo : public CBaseWindow { public: /* Constructor */ - FileInfo( intf_thread_t *_p_intf, HINSTANCE _hInst ); + FileInfo( intf_thread_t *, CBaseWindow *, HINSTANCE ); virtual ~FileInfo(){}; + void UpdateFileInfo(void); + protected: HWND hwnd_fileinfo; // handle to fileinfo window - HWND hwndTV; // handle to tree-view control - intf_thread_t *p_intf; + HWND hwndTV; // handle to tree-view control TCHAR szFileInfoClassName[100]; // Main window class name TCHAR szFileInfoTitle[100]; // Main window name - virtual LRESULT WndProc( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam, PBOOL pbProcessed ); - void UpdateFileInfo( HWND ); + virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ); BOOL CreateTreeView( HWND ); }; @@ -206,20 +217,16 @@ class Messages : public CBaseWindow { public: /* Constructor */ - Messages( intf_thread_t *_p_intf, HINSTANCE _hInst ); + Messages( intf_thread_t *, CBaseWindow *, HINSTANCE ); virtual ~Messages(){}; -protected: + void UpdateLog(void); - intf_thread_t *p_intf; +protected: - virtual LRESULT WndProc( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam, - PBOOL pbProcessed ); + virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ); HWND hListView; - void UpdateLog(void); - vlc_bool_t b_verbose; }; @@ -228,7 +235,8 @@ class ItemInfoDialog : public CBaseWindow { public: /* Constructor */ - ItemInfoDialog( intf_thread_t *, HINSTANCE, playlist_item_t * ); + ItemInfoDialog( intf_thread_t *, CBaseWindow *, + HINSTANCE, playlist_item_t * ); virtual ~ItemInfoDialog(){}; protected: @@ -242,9 +250,7 @@ protected: void OnOk(); void UpdateInfo(); - virtual LRESULT WndProc( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam, - PBOOL pbProcessed ); + virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ); /* Controls for the iteminfo dialog box */ HWND uri_label; @@ -265,20 +271,17 @@ class OpenDialog : public CBaseWindow { public: /* Constructor */ - OpenDialog( intf_thread_t *_p_intf, HINSTANCE _hInst, - int _i_access_method, int _i_arg, int _i_method ); + OpenDialog( intf_thread_t *, CBaseWindow *, HINSTANCE, int, int ); virtual ~OpenDialog(){}; void UpdateMRL(); void UpdateMRL( int i_access_method ); -protected: + HWND file_combo; - intf_thread_t *p_intf; +protected: - virtual LRESULT WndProc( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam, - PBOOL pbProcessed ); + virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ); HWND mrl_box; HWND mrl_label; @@ -287,7 +290,6 @@ protected: HWND notebook; - HWND file_combo; HWND browse_button; HWND subsfile_checkbox; HWND subsfile_label; @@ -304,12 +306,11 @@ protected: HWND net_addrs_label[4]; HWND net_addrs[4]; - - int i_current_access_method; - int i_method; /* Normal or for the stream dialog ? */ + int i_open_arg; + int i_access; int i_net_type; - + void FilePanel( HWND hwnd ); void NetPanel( HWND hwnd ); @@ -335,18 +336,16 @@ class SubsFileDialog: public CBaseWindow { public: /* Constructor */ - SubsFileDialog( intf_thread_t *_p_intf, HINSTANCE _hInst ); + SubsFileDialog( intf_thread_t *, CBaseWindow *, HINSTANCE ); virtual ~SubsFileDialog(){}; vector subsfile_mrl; + HWND file_combo; protected: friend class OpenDialog; - intf_thread_t *p_intf; - HWND file_box; - HWND file_combo; HWND browse_button; HWND enc_box; @@ -361,9 +360,7 @@ protected: HWND fps_edit; HWND fps_spinctrl; - virtual LRESULT WndProc( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam, - PBOOL pbProcessed ); + virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ); /* Event handlers (these functions should _not_ be virtual) */ void OnFileBrowse(); @@ -374,9 +371,12 @@ class Playlist : public CBaseWindow { public: /* Constructor */ - Playlist( intf_thread_t *_p_intf, HINSTANCE _hInst ); + Playlist( intf_thread_t *, CBaseWindow *, HINSTANCE ); virtual ~Playlist(){}; + void UpdatePlaylist(); + void ShowPlaylist( bool ); + protected: bool b_need_update; @@ -385,12 +385,10 @@ protected: int i_title_sorted; int i_author_sorted; - intf_thread_t *p_intf; HWND hwndCB; // Handle to the command bar (contains menu) HWND hwndTB; // Handle to the toolbar. HWND hListView; - void UpdatePlaylist(); void Rebuild(); void UpdateItem( int ); LRESULT ProcessCustomDraw( LPARAM lParam ); @@ -400,8 +398,6 @@ protected: void OnOpen(); void OnSave(); - void OnAddFile(); - void OnAddMRL(); void OnDeleteSelection(); void OnInvertSelection(); @@ -426,9 +422,7 @@ protected: void OnPopupEna(); void OnPopupInfo( HWND hwnd ); - virtual LRESULT WndProc( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam, - PBOOL pbProcessed ); + virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ); }; /* Timer */ @@ -436,9 +430,9 @@ class Timer { public: /* Constructor */ - Timer( intf_thread_t *p_intf, HWND hwnd, Interface *_p_main_interface); + Timer( intf_thread_t *p_intf, HWND hwnd, Interface *_p_main_interface ); virtual ~Timer(); - void Notify( void ); + void Notify( void ); private: intf_thread_t *p_intf; @@ -458,7 +452,7 @@ void RefreshMenu( intf_thread_t *, vector *, HMENU, int, int wce_GetMenuItemCount( HMENU ); void CreateMenuItem( intf_thread_t *, vector *, HMENU, char *, vlc_object_t *, int * ); -HMENU CreateChoicesMenu( intf_thread_t *, vector *, char *, +HMENU CreateChoicesMenu( intf_thread_t *, vector *, char *, vlc_object_t *, int * ); void OnMenuEvent( intf_thread_t *, int ); @@ -475,6 +469,8 @@ public: virtual ~MenuItemExt(); + static void ClearList( vector * ); + int id; intf_thread_t *p_intf; char *psz_var; @@ -494,13 +490,11 @@ class PrefsDialog: public CBaseWindow { public: /* Constructor */ - PrefsDialog( intf_thread_t *_p_intf, HINSTANCE _hInst ); + PrefsDialog( intf_thread_t *, CBaseWindow *, HINSTANCE ); virtual ~PrefsDialog(){}; protected: - intf_thread_t *p_intf; - /* Event handlers (these functions should _not_ be virtual) */ void OnOk( void ); /*void OnCancel( UINT event ); @@ -515,38 +509,136 @@ protected: PrefsTreeCtrl *prefs_tree; - virtual LRESULT WndProc( HWND hwnd, UINT msg, - WPARAM wParam, LPARAM lParam, - PBOOL pbProcessed ); + virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ); }; /***************************************************************************** * A small helper function for utf8 <-> unicode conversions *****************************************************************************/ #ifdef UNICODE - static wchar_t pwsz_mbtow[2048]; - static char psz_wtomb[2048]; + extern wchar_t pwsz_mbtow_wince[2048]; + extern char psz_wtomb_wince[2048]; static inline wchar_t *_FROMMB( const char *psz_in ) { - mbstowcs( pwsz_mbtow, psz_in, 2048 ); - pwsz_mbtow[2048] = 0; - return pwsz_mbtow; + mbstowcs( pwsz_mbtow_wince, psz_in, 2048 ); + pwsz_mbtow_wince[2048-1] = 0; + return pwsz_mbtow_wince; } static inline char *_TOMB( const wchar_t *pwsz_in ) { - wcstombs( psz_wtomb, pwsz_in, 2048 ); - psz_wtomb[2048] = 0; - return psz_wtomb; + wcstombs( psz_wtomb_wince, pwsz_in, 2048 ); + psz_wtomb_wince[2048-1] = 0; + return psz_wtomb_wince; } #else -# define _FROMMB(a) -# define _TOMB(a) +# define _FROMMB(a) a +# define _TOMB(a) a #endif -#if defined( ENABLE_NLS ) && defined( ENABLE_UTF8 ) -# define ISUTF8 1 -#else // ENABLE_NLS && ENABLE_UTF8 -# define ISUTF8 0 +/***************************************************************************** + * Misc definitions (mainly from aygshell.h) + *****************************************************************************/ +#define _WIN32_IE 0x0500 + +#define SHFS_SHOWSIPBUTTON 0x0004 +#define SHFS_HIDESIPBUTTON 0x0008 +#define SHIDIM_FLAGS 0x0001 +#define SHIDIF_DONEBUTTON 0x0001 +#define SHIDIF_SIPDOWN 0x0008 +#define SHIDIF_FULLSCREENNOMENUBAR 0x0010 +#define SHCMBF_HMENU 0x0010 +#define SHCMBF_EMPTYBAR 0x0001 +#define GN_CONTEXTMENU 1000 +#define SHRG_RETURNCMD 0x0001 +#define SHRG_NOTIFYPARENT 0x0002 +#define SHCMBM_GETSUBMENU (WM_USER + 401) +#define SHCMBM_GETMENU (WM_USER + 402) +#ifndef TBSTYLE_NO_DROPDOWN_ARROW +#define TBSTYLE_NO_DROPDOWN_ARROW 0x0080 +#endif +#define lstrlenW wcslen +#define SHGetMenu(hwnd) \ + (HMENU)SendMessage((hwnd), SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0) +#define TrackPopupMenu(hm,u,x,y,r,hw,p) \ + TrackPopupMenuEx((hm),(u),(x),(y),(hw),0) + +extern "C" { + typedef struct tagSHMENUBARINFO + { + DWORD cbSize; + HWND hwndParent; + DWORD dwFlags; + UINT nToolBarId; + HINSTANCE hInstRes; + int nBmpId; + int cBmpImages; + HWND hwndMB; + COLORREF clrBk; + } SHMENUBARINFO, *PSHMENUBARINFO; + + BOOL SHCreateMenuBar( SHMENUBARINFO *pmbi ); + BOOL SHFullScreen(HWND hwndRequester, DWORD dwState); + + typedef struct tagSHINITDLGINFO + { + DWORD dwMask; + HWND hDlg; + DWORD dwFlags; + } SHINITDLGINFO, *PSHINITDLGINFO; + + BOOL SHInitDialog(PSHINITDLGINFO pshidi); + + typedef struct tagNMRGINFO + { + NMHDR hdr; + POINT ptAction; + DWORD dwItemSpec; + } NMRGINFO, *PNMRGINFO; + + BOOL WINAPI CommandBar_InsertMenubarEx(HWND, HINSTANCE, LPTSTR, WORD); + + typedef struct tagSHRGI + { + DWORD cbSize; + HWND hwndClient; + POINT ptDown; + DWORD dwFlags; + } SHRGINFO, *PSHRGINFO; + + DWORD SHRecognizeGesture(SHRGINFO *shrg); + + typedef enum tagSIPSTATE + { + SIP_UP = 0, + SIP_DOWN, + SIP_FORCEDOWN, + SIP_UNCHANGED, + SIP_INPUTDIALOG, + } SIPSTATE; + + BOOL SHSipPreference(HWND, SIPSTATE); + + BOOL SHSipInfo(UINT, UINT, PVOID, UINT); + + typedef struct + { + DWORD cbSize; + DWORD fdwFlags; + RECT rcVisibleDesktop; + RECT rcSipRect; + DWORD dwImDataSize; + VOID *pvImData; + } SIPINFO; +} + +#if defined( WIN32 ) && !defined( UNDER_CE ) +# define SHFullScreen(a,b) +# define SHInitDialog(a) +# define SHCreateMenuBar(a) 1 +# define SHRecognizeGesture(a) 0 +# define SHSipPreference(a,b) + +# define SHSipInfo(a,b,c,d) 0 #endif #endif //WINCE_RESOURCE @@ -556,7 +648,6 @@ protected: #define IDB_BITMAP1 103 #define IDB_BITMAP2 111 #define IDR_MENUBAR1 113 -#define IDR_ACCELERATOR1 116 #define IDD_FILEINFO 118 #define IDD_DUMMY 118 #define IDD_MESSAGES 119 @@ -565,30 +656,10 @@ protected: #define IDD_PLAYLIST 122 #define IDB_BITMAP3 123 #define IDD_ITEMINFO 124 -#define IDR_DUMMYMENU 126 #define IDCLEAR 1001 #define IDSAVEAS 1002 -#define IDC_TEXTCTRL 1004 -#define IDC_CUSTOM1 1012 -#define IDS_MAIN_MENUITEM1 40001 -#define IDS_TITLE 40002 -#define IDS_CLASSNAME 40003 -#define IDS_CAP_QUICKFILEOPEN 40006 -#define IDS_CAP_VIEW 40009 -#define IDS_CAP_SETTINGS 40012 -#define IDS_CAP_AUDIO 40015 -#define IDS_CAP_VIDEO 40018 -#define IDS_CAP_HELP 40021 -#define IDS_CAP_Navigation 40024 -#define IDS_CAP_FILE 40025 -#define ID_COLOR_OPTIONS 40026 -#define IDS_DYNAMENU 40027 #define ID_FILE 40028 -#define IDS_BLACK 40028 -#define IDS_LTGRAY 40029 #define ID_VIEW 40030 -#define IDS_DKGRAY 40030 -#define IDS_WHITE 40031 #define ID_SETTINGS 40032 #define ID_AUDIO 40034 #define ID_EMPTY 40034 @@ -600,21 +671,17 @@ protected: #define IDM_AUDIO 40048 #define IDM_VIDEO 40050 #define IDM_NAVIGATION 40053 -#define ID_FILE_QUICK_OPEN 40056 -#define ID_FILE_OPENFILE 40057 -#define ID_FILE_QUICKOPEN 40058 -#define ID_FILE_OPENNETWORKSTREAM 40059 +#define ID_FILE_QUICKOPEN 40057 +#define ID_FILE_OPENFILE 40058 +#define ID_FILE_OPENDIR 40059 #define ID_FILE_OPENNET 40060 #define ID_FILE_EXIT 40061 #define ID_VIEW_PLAYLIST 40063 #define ID_VIEW_MESSAGES 40064 #define ID_VIEW_MEDIAINFO 40065 #define ID_VIEW_STREAMINFO 40066 -#define IDS_CAP_NAV 40067 +#define ID_PREFERENCES 40071 #define ID_FILE_ABOUT 40069 -#define ID_SETTINGS_PREF 40071 -#define ID_SETTINGS_EXTEND 40072 -#define IDS_CAP_XXX 40084 #define IDM_MANAGE 40087 #define IDM_SORT 40088 #define IDM_SEL 40089 @@ -628,28 +695,14 @@ protected: #define ID_SEL_DISABLE 40101 #define ID_SORT_TITLE 40102 #define ID_SORT_RTITLE 40103 -#define ID_MANAGE_SIMPLEADD 40104 -#define ID_MANAGE_OPENPL 40105 +#define ID_MANAGE_ADDFILE 40104 +#define ID_MANAGE_ADDDIRECTORY 40105 #define ID_MANAGE_ADDMRL 40106 -#define ID_MANAGE_SAVEPL 40107 -#define ID_MENUITEM40108 40108 -#define IDS_CAP_MENUITEM40109 40110 -#define IDS_STOP 57601 +#define ID_MANAGE_OPENPL 40107 +#define ID_MANAGE_SAVEPL 40108 #define StopStream_Event 57601 -#define IDS_PLAY 57602 #define PlayStream_Event 57602 #define PrevStream_Event 57603 #define NextStream_Event 57604 #define SlowStream_Event 57605 #define FastStream_Event 57606 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 128 -#define _APS_NEXT_COMMAND_VALUE 40111 -#define _APS_NEXT_CONTROL_VALUE 1013 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif