1 /*****************************************************************************
2 * wince.h: private WinCE interface descriptor
3 *****************************************************************************
4 * Copyright (C) 1999-2004 VideoLAN
7 * Authors: Gildas Bazin <gbazin@videolan.org>
8 * Marodon Cedric <cedric_marodon@yahoo.fr>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
23 *****************************************************************************/
25 #ifndef WINCE_RESOURCE
27 #define SLIDER_HEIGHT 50
28 #define SLIDER_MAX_POS 10000
29 #define MENU_HEIGHT 26
37 #if defined( UNDER_CE ) && defined(__MINGW32__)
38 /* This is a gross hack for the wince gcc cross-compiler */
53 /*****************************************************************************
54 * intf_sys_t: description and status of wxwindows interface
55 *****************************************************************************/
61 /* The input thread */
62 input_thread_t * p_input;
65 int i_slider_pos; /* slider position */
66 int i_slider_oldpos; /* previous position */
67 vlc_bool_t b_slider_free; /* slider status */
69 /* The messages window */
70 msg_subscription_t* p_sub; /* message bank subscription */
72 /* Playlist management */
73 int i_playing; /* playlist selected item */
75 /* Send an event to show a dialog */
76 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
77 intf_dialog_args_t *p_arg );
79 CBaseWindow *p_main_window;
81 /* Dynamic Menu management */
82 vector<MenuItemExt*> *p_audio_menu;
83 vector<MenuItemExt*> *p_video_menu;
84 vector<MenuItemExt*> *p_navig_menu;
85 vector<MenuItemExt*> *p_settings_menu;
87 VideoWindow *p_video_window;
89 /* GetOpenFileName replacement */
90 BOOL (WINAPI *GetOpenFile)(void *);
91 HMODULE h_gsgetfile_dll;
94 #define GetOpenFile(a) p_intf->p_sys->GetOpenFile(a)
96 /*****************************************************************************
98 *****************************************************************************/
103 CBaseWindow() : hWnd(0), hInst(0) {};
104 virtual ~CBaseWindow() {};
106 HWND hWnd; // The main window handle
108 static LRESULT CALLBACK BaseWndProc( HWND, UINT, WPARAM, LPARAM );
109 static int CreateDialogBox( HWND, CBaseWindow * );
113 HINSTANCE hInst; // The current instance
114 HWND hwndCB; // The command bar handle
116 HINSTANCE GetInstance () const { return hInst; }
117 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ) { return 0; };
119 intf_thread_t *p_intf;
129 CBaseWindow *CreateVideoWindow( intf_thread_t *, HWND );
130 void PopupMenu( intf_thread_t *, HWND, POINT );
133 class Interface : public CBaseWindow
140 BOOL InitInstance( HINSTANCE, intf_thread_t * );
142 HWND CreateMenuBar( HWND, HINSTANCE );
143 void TogglePlayButton( int i_playing_status );
146 HWND hwndMain; // Handle to the main window.
148 HWND hwndCB; // Handle to the command bar (contains menu)
149 HWND hwndTB; // Handle to the toolbar.
150 HWND hwndSlider; // Handle to the Sliderbar.
152 HWND hwndVol; // Handle to the volume trackbar.
153 HWND hwndSB; // Handle to the status bar.
159 PrefsDialog *preferences;
167 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
169 void OnOpenFileSimple( void );
170 void OnPlayStream( void );
171 void OnVideoOnTop( void );
173 void OnSliderUpdate( int wp );
174 void OnChange( int wp );
175 void VolumeChange( int i_volume );
176 void VolumeUpdate( void );
177 void OnStopStream( void );
178 void OnPrevStream( void );
179 void OnNextStream( void );
180 void OnSlowStream( void );
181 void OnFastStream( void );
183 int i_old_playing_status;
189 HMENU menu_navigation;
191 vlc_bool_t b_volume_hold;
195 class FileInfo : public CBaseWindow
199 FileInfo( intf_thread_t *_p_intf, HINSTANCE _hInst );
200 virtual ~FileInfo(){};
204 HWND hwnd_fileinfo; // handle to fileinfo window
205 HWND hwndTV; // handle to tree-view control
207 TCHAR szFileInfoClassName[100]; // Main window class name
208 TCHAR szFileInfoTitle[100]; // Main window name
210 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
211 void UpdateFileInfo( HWND );
212 BOOL CreateTreeView( HWND );
216 class Messages : public CBaseWindow
220 Messages( intf_thread_t *_p_intf, HINSTANCE _hInst );
221 virtual ~Messages(){};
225 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
228 void UpdateLog(void);
230 vlc_bool_t b_verbose;
233 /* ItemInfo Dialog */
234 class ItemInfoDialog : public CBaseWindow
238 ItemInfoDialog( intf_thread_t *, HINSTANCE, playlist_item_t * );
239 virtual ~ItemInfoDialog(){};
243 intf_thread_t *p_intf;
244 HWND hwndCB; // Handle to the command bar (but no menu)
246 playlist_item_t *p_item;
248 /* Event handlers (these functions should _not_ be virtual) */
252 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
254 /* Controls for the iteminfo dialog box */
262 HWND enabled_checkbox;
268 class SubsFileDialog;
269 class OpenDialog : public CBaseWindow
273 OpenDialog( intf_thread_t *_p_intf, HINSTANCE _hInst,
274 int _i_access_method, int _i_arg, int _i_method );
275 virtual ~OpenDialog(){};
278 void UpdateMRL( int i_access_method );
282 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
293 HWND subsfile_checkbox;
295 HWND subsfile_button;
296 SubsFileDialog *subsfile_dialog;
301 HWND net_port_label[4];
306 HWND net_addrs_label[4];
309 int i_current_access_method;
310 int i_method; /* Normal or for the stream dialog ? */
314 void FilePanel( HWND hwnd );
315 void NetPanel( HWND hwnd );
317 void OnSubsFileEnable();
318 void OnSubsFileSettings( HWND hwnd );
322 void OnFilePanelChange();
324 void OnNetPanelChange( int event );
325 void OnNetTypeChange( int event );
326 void DisableNETCtrl();
331 vector<string> subsfile_mrl;
334 /* Subtitles File Dialog */
335 class SubsFileDialog: public CBaseWindow
339 SubsFileDialog( intf_thread_t *_p_intf, HINSTANCE _hInst );
340 virtual ~SubsFileDialog(){};
342 vector<string> subsfile_mrl;
345 friend class OpenDialog;
363 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
365 /* Event handlers (these functions should _not_ be virtual) */
370 class Playlist : public CBaseWindow
374 Playlist( intf_thread_t *_p_intf, HINSTANCE _hInst );
375 virtual ~Playlist(){};
385 HWND hwndCB; // Handle to the command bar (contains menu)
386 HWND hwndTB; // Handle to the toolbar.
389 void UpdatePlaylist();
391 void UpdateItem( int );
392 LRESULT ProcessCustomDraw( LPARAM lParam );
393 void HandlePopupMenu( HWND hwnd, POINT point);
395 void DeleteItem( int item );
402 void OnDeleteSelection();
403 void OnInvertSelection();
404 void OnEnableSelection();
405 void OnDisableSelection();
407 void OnActivateItem( int i_item );
408 void ShowInfos( HWND hwnd, int i_item );
417 void OnSort( UINT event );
418 void OnColSelect( int iSubItem );
423 void OnPopupInfo( HWND hwnd );
425 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
433 Timer( intf_thread_t *p_intf, HWND hwnd, Interface *_p_main_interface);
438 intf_thread_t *p_intf;
439 Interface *p_main_interface;
440 //Interface *p_main_interface;
441 int i_old_playing_status;
446 void RefreshSettingsMenu( intf_thread_t *_p_intf, HMENU hMenu );
447 void RefreshAudioMenu( intf_thread_t *_p_intf, HMENU hMenu );
448 void RefreshVideoMenu( intf_thread_t *_p_intf, HMENU hMenu );
449 void RefreshNavigMenu( intf_thread_t *_p_intf, HMENU hMenu );
450 void RefreshMenu( intf_thread_t *, vector<MenuItemExt*> *, HMENU, int,
451 char **, int *, int );
452 int wce_GetMenuItemCount( HMENU );
453 void CreateMenuItem( intf_thread_t *, vector<MenuItemExt*> *, HMENU, char *,
454 vlc_object_t *, int * );
455 HMENU CreateChoicesMenu( intf_thread_t *, vector<MenuItemExt*> *, char *,
456 vlc_object_t *, int * );
457 void OnMenuEvent( intf_thread_t *, int );
459 /*****************************************************************************
460 * A small helper class which encapsulate wxMenuitem with some other useful
462 *****************************************************************************/
467 MenuItemExt( intf_thread_t *_p_intf, int _id, char *_psz_var,
468 int _i_object_id, vlc_value_t _val, int _i_val_type );
470 virtual ~MenuItemExt();
472 static void ClearList( vector<MenuItemExt*> * );
475 intf_thread_t *p_intf;
486 /* Preferences Dialog */
487 /* Preferences Dialog */
489 class PrefsDialog: public CBaseWindow
493 PrefsDialog( intf_thread_t *_p_intf, HINSTANCE _hInst );
494 virtual ~PrefsDialog(){};
498 /* Event handlers (these functions should _not_ be virtual) */
500 /*void OnCancel( UINT event );
501 void OnSave( UINT event );
502 void OnResetAll( UINT event );
503 void OnAdvanced( UINT event );*/
507 HWND advanced_checkbox;
510 PrefsTreeCtrl *prefs_tree;
512 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
515 /*****************************************************************************
516 * A small helper function for utf8 <-> unicode conversions
517 *****************************************************************************/
519 extern wchar_t pwsz_mbtow_wince[2048];
520 extern char psz_wtomb_wince[2048];
521 static inline wchar_t *_FROMMB( const char *psz_in )
523 mbstowcs( pwsz_mbtow_wince, psz_in, 2048 );
524 pwsz_mbtow_wince[2048-1] = 0;
525 return pwsz_mbtow_wince;
527 static inline char *_TOMB( const wchar_t *pwsz_in )
529 wcstombs( psz_wtomb_wince, pwsz_in, 2048 );
530 psz_wtomb_wince[2048-1] = 0;
531 return psz_wtomb_wince;
534 # define _FROMMB(a) a
538 #if defined( ENABLE_NLS ) && defined( ENABLE_UTF8 )
540 #else // ENABLE_NLS && ENABLE_UTF8
544 /*****************************************************************************
545 * Misc definitions (mainly from aygshell.h)
546 *****************************************************************************/
547 #define _WIN32_IE 0x0500
549 #define SHFS_HIDESIPBUTTON 0x0008
550 #define SHIDIM_FLAGS 0x0001
551 #define SHIDIF_DONEBUTTON 0x0001
552 #define SHIDIF_SIPDOWN 0x0008
553 #define SHIDIF_FULLSCREENNOMENUBAR 0x0010
554 #define SHCMBF_HMENU 0x0010
555 #define SHCMBF_EMPTYBAR 0x0001
556 #define SHFS_SHOWSIPBUTTON 0x0004
557 #define GN_CONTEXTMENU 1000
558 #define SHRG_RETURNCMD 0x0001
559 #define SHRG_NOTIFYPARENT 0x0002
560 #define SHCMBM_GETSUBMENU (WM_USER + 401)
561 #define SHCMBM_GETMENU (WM_USER + 402)
562 #ifndef TBSTYLE_NO_DROPDOWN_ARROW
563 #define TBSTYLE_NO_DROPDOWN_ARROW 0x0080
565 #define lstrlenW wcslen
566 #define SHGetMenu(hwnd) \
567 (HMENU)SendMessage((hwnd), SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0)
568 #define TrackPopupMenu(hm,u,x,y,r,hw,p) \
569 TrackPopupMenuEx((hm),(u),(x),(y),(hw),0)
572 typedef struct tagSHMENUBARINFO
583 } SHMENUBARINFO, *PSHMENUBARINFO;
585 BOOL SHCreateMenuBar( SHMENUBARINFO *pmbi );
586 BOOL SHFullScreen(HWND hwndRequester, DWORD dwState);
588 typedef struct tagSHINITDLGINFO
593 } SHINITDLGINFO, *PSHINITDLGINFO;
595 BOOL SHInitDialog(PSHINITDLGINFO pshidi);
597 typedef struct tagNMRGINFO
602 } NMRGINFO, *PNMRGINFO;
604 BOOL WINAPI CommandBar_InsertMenubarEx(HWND, HINSTANCE, LPTSTR, WORD);
606 typedef struct tagSHRGI
612 } SHRGINFO, *PSHRGINFO;
614 DWORD SHRecognizeGesture(SHRGINFO *shrg);
617 #if defined( WIN32 ) && !defined( UNDER_CE )
618 # define SHFullScreen(a,b)
619 # define SHInitDialog(a)
620 # define SHCreateMenuBar(a) 1
621 # define SHRecognizeGesture(a) 0
624 #endif //WINCE_RESOURCE
626 #define IDD_ABOUT 101
627 #define IDI_ICON1 102
628 #define IDB_BITMAP1 103
629 #define IDB_BITMAP2 111
630 #define IDR_MENUBAR1 113
631 #define IDD_FILEINFO 118
632 #define IDD_DUMMY 118
633 #define IDD_MESSAGES 119
634 #define IDR_MENUBAR 120
635 #define IDR_MENUBAR2 121
636 #define IDD_PLAYLIST 122
637 #define IDB_BITMAP3 123
638 #define IDD_ITEMINFO 124
640 #define IDSAVEAS 1002
641 #define ID_FILE 40028
642 #define ID_VIEW 40030
643 #define ID_SETTINGS 40032
644 #define ID_AUDIO 40034
645 #define ID_EMPTY 40034
646 #define ID_VIDEO 40036
647 #define ID_NAVIGATION 40038
648 #define IDM_FILE 40042
649 #define IDM_VIEW 40044
650 #define IDM_SETTINGS 40046
651 #define IDM_AUDIO 40048
652 #define IDM_VIDEO 40050
653 #define IDM_NAVIGATION 40053
654 #define ID_FILE_QUICKOPEN 40057
655 #define ID_FILE_OPENFILE 40058
656 #define ID_FILE_OPENNET 40059
657 #define ID_FILE_EXIT 40061
658 #define ID_VIEW_PLAYLIST 40063
659 #define ID_VIEW_MESSAGES 40064
660 #define ID_VIEW_MEDIAINFO 40065
661 #define ID_VIEW_STREAMINFO 40066
662 #define ID_PREFERENCES 40071
663 #define ID_FILE_ABOUT 40069
664 #define IDM_MANAGE 40087
665 #define IDM_SORT 40088
666 #define IDM_SEL 40089
667 #define ID_SORT_AUTHOR 40091
668 #define ID_SORT_RAUTHOR 40092
669 #define ID_SORT_SHUFFLE 40095
670 #define ID_SEL_INVERT 40096
671 #define ID_SEL_DELETE 40097
672 #define ID_SEL_SELECTALL 40098
673 #define ID_SEL_ENABLE 40100
674 #define ID_SEL_DISABLE 40101
675 #define ID_SORT_TITLE 40102
676 #define ID_SORT_RTITLE 40103
677 #define ID_MANAGE_ADDFILE 40104
678 #define ID_MANAGE_ADDDIRECTORY 40105
679 #define ID_MANAGE_ADDMRL 40106
680 #define ID_MANAGE_OPENPL 40107
681 #define ID_MANAGE_SAVEPL 40108
682 #define StopStream_Event 57601
683 #define PlayStream_Event 57602
684 #define PrevStream_Event 57603
685 #define NextStream_Event 57604
686 #define SlowStream_Event 57605
687 #define FastStream_Event 57606