1 /*****************************************************************************
2 * wince.h: private WinCE interface descriptor
3 *****************************************************************************
4 * Copyright (C) 1999-2004 the VideoLAN team
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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, 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 */
43 #include <vlc_messages.h>
54 /*****************************************************************************
55 * intf_sys_t: description and status of wxwindows interface
56 *****************************************************************************/
59 /* the parent window */
60 CBaseWindow *p_window;
65 /* The input thread */
66 input_thread_t * p_input;
69 int i_slider_pos; /* slider position */
70 int i_slider_oldpos; /* previous position */
71 bool b_slider_free; /* slider status */
75 /* Playlist management */
76 int i_playing; /* playlist selected item */
78 /* Send an event to show a dialog */
79 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
80 intf_dialog_args_t *p_arg );
82 /* Dynamic Menu management */
83 vector<MenuItemExt*> *p_audio_menu;
84 vector<MenuItemExt*> *p_video_menu;
85 vector<MenuItemExt*> *p_navig_menu;
86 vector<MenuItemExt*> *p_settings_menu;
88 VideoWindow *p_video_window;
93 /*****************************************************************************
95 *****************************************************************************/
100 CBaseWindow( intf_thread_t *_p_intf = 0, CBaseWindow *_p_parent = 0,
101 HINSTANCE _hInst = 0 )
102 : hWnd(0), hInst(_hInst), p_parent(_p_parent), p_intf(_p_intf) {};
103 virtual ~CBaseWindow() {};
105 HWND hWnd; // The main window handle
107 static LRESULT CALLBACK BaseWndProc( HWND, UINT, WPARAM, LPARAM );
108 static int CreateDialogBox( HWND, CBaseWindow * );
110 HWND GetHandle() { return hWnd; }
111 BOOL Show( BOOL b_show ) { return (hWnd && ShowWindow(hWnd, b_show)); }
112 BOOL IsShown( void ) { return (hWnd && IsWindowVisible(hWnd)); }
116 HINSTANCE hInst; // The current instance
117 HWND hwndCB; // The command bar handle
119 HINSTANCE GetInstance () const { return hInst; }
120 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ) { return 0; };
122 CBaseWindow *p_parent;
123 intf_thread_t *p_intf;
133 CBaseWindow *CreateDialogsProvider( intf_thread_t *, CBaseWindow *, HINSTANCE);
134 CBaseWindow *CreateVideoWindow( intf_thread_t *, HWND );
135 void PopupMenu( intf_thread_t *, HWND, POINT );
138 class Interface : public CBaseWindow
142 Interface( intf_thread_t *, CBaseWindow *, HINSTANCE );
147 HWND CreateMenuBar( HWND, HINSTANCE );
148 void TogglePlayButton( int i_playing_status );
151 HWND hwndMain; // Handle to the main window.
153 HWND hwndCB; // Handle to the command bar (contains menu)
154 HWND hwndTB; // Handle to the toolbar.
155 HWND hwndSlider; // Handle to the Sliderbar.
157 HWND hwndVol; // Handle to the volume trackbar.
158 HWND hwndSB; // Handle to the status bar.
167 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
169 void OnShowDialog( int );
171 void OnPlayStream( void );
172 void OnStopStream( void );
173 void OnPrevStream( void );
174 void OnNextStream( void );
175 void OnSlowStream( void );
176 void OnFastStream( void );
178 void OnVideoOnTop( void );
179 void OnSliderUpdate( int wp );
180 void OnChange( int wp );
181 void VolumeChange( int i_volume );
182 void VolumeUpdate( void );
184 int i_old_playing_status;
190 HMENU menu_navigation;
196 class FileInfo : public CBaseWindow
200 FileInfo( intf_thread_t *, CBaseWindow *, HINSTANCE );
201 virtual ~FileInfo(){};
203 void UpdateFileInfo(void);
207 HWND hwnd_fileinfo; // handle to fileinfo window
208 HWND hwndTV; // handle to tree-view control
210 TCHAR szFileInfoClassName[100]; // Main window class name
211 TCHAR szFileInfoTitle[100]; // Main window name
213 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
214 BOOL CreateTreeView( HWND );
223 class Messages : public CBaseWindow
227 Messages( intf_thread_t *, CBaseWindow *, HINSTANCE );
230 static void sinkMessage (msg_cb_data_t *, msg_item_t *, unsigned);
231 void sinkMessage (msg_item_t *item, unsigned);
235 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
237 /* The messages window */
238 msg_subscription_t* sub; /* message bank subscription */
239 msg_cb_data_t *cb_data;
244 /* ItemInfo Dialog */
245 class ItemInfoDialog : public CBaseWindow
249 ItemInfoDialog( intf_thread_t *, CBaseWindow *,
250 HINSTANCE, playlist_item_t * );
251 virtual ~ItemInfoDialog(){};
255 intf_thread_t *p_intf;
256 HWND hwndCB; // Handle to the command bar (but no menu)
258 playlist_item_t *p_item;
260 /* Event handlers (these functions should _not_ be virtual) */
264 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
266 /* Controls for the iteminfo dialog box */
274 HWND enabled_checkbox;
280 class SubsFileDialog;
281 class OpenDialog : public CBaseWindow
285 OpenDialog( intf_thread_t *, CBaseWindow *, HINSTANCE, int, int );
286 virtual ~OpenDialog(){};
289 void UpdateMRL( int i_access_method );
295 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
305 HWND subsfile_checkbox;
307 HWND subsfile_button;
308 SubsFileDialog *subsfile_dialog;
313 HWND net_port_label[4];
318 HWND net_addrs_label[4];
325 void FilePanel( HWND hwnd );
326 void NetPanel( HWND hwnd );
328 void OnSubsFileEnable();
329 void OnSubsFileSettings( HWND hwnd );
333 void OnFilePanelChange();
335 void OnNetPanelChange( int event );
336 void OnNetTypeChange( int event );
337 void DisableNETCtrl();
342 vector<string> subsfile_mrl;
345 /* Subtitles File Dialog */
346 class SubsFileDialog: public CBaseWindow
350 SubsFileDialog( intf_thread_t *, CBaseWindow *, HINSTANCE );
351 virtual ~SubsFileDialog(){};
353 vector<string> subsfile_mrl;
357 friend class OpenDialog;
374 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
376 /* Event handlers (these functions should _not_ be virtual) */
381 class Playlist : public CBaseWindow
385 Playlist( intf_thread_t *, CBaseWindow *, HINSTANCE );
386 virtual ~Playlist(){};
388 void UpdatePlaylist();
389 void ShowPlaylist( bool );
399 HWND hwndCB; // Handle to the command bar (contains menu)
400 HWND hwndTB; // Handle to the toolbar.
404 void UpdateItem( int );
405 LRESULT ProcessCustomDraw( LPARAM lParam );
406 void HandlePopupMenu( HWND hwnd, POINT point);
408 void DeleteItem( input_item_t * item );
413 void OnDeleteSelection();
414 void OnInvertSelection();
415 void OnEnableSelection();
416 void OnDisableSelection();
418 void OnActivateItem( int i_item );
419 void ShowInfos( HWND hwnd, int i_item );
428 void OnSort( UINT event );
429 void OnColSelect( int iSubItem );
434 void OnPopupInfo( HWND hwnd );
436 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
444 Timer( intf_thread_t *p_intf, HWND hwnd, Interface *_p_main_interface );
449 intf_thread_t *p_intf;
450 Interface *p_main_interface;
451 //Interface *p_main_interface;
452 int i_old_playing_status;
457 void RefreshSettingsMenu( intf_thread_t *_p_intf, HMENU hMenu );
458 void RefreshAudioMenu( intf_thread_t *_p_intf, HMENU hMenu );
459 void RefreshVideoMenu( intf_thread_t *_p_intf, HMENU hMenu );
460 void RefreshNavigMenu( intf_thread_t *_p_intf, HMENU hMenu );
461 void RefreshMenu( intf_thread_t *, vector<MenuItemExt*> *, HMENU, int,
462 char **, vlc_object_t **, int );
463 int wce_GetMenuItemCount( HMENU );
464 void CreateMenuItem( intf_thread_t *, vector<MenuItemExt*> *, HMENU, char *,
465 vlc_object_t *, int * );
466 HMENU CreateChoicesMenu( intf_thread_t *, vector<MenuItemExt*> *, char *,
467 vlc_object_t *, int * );
468 void OnMenuEvent( intf_thread_t *, int );
470 /*****************************************************************************
471 * A small helper class which encapsulate wxMenuitem with some other useful
473 *****************************************************************************/
478 MenuItemExt( intf_thread_t *_p_intf, int _id, char *_psz_var,
479 vlc_object_t * p_object, vlc_value_t _val, int _i_val_type );
481 virtual ~MenuItemExt();
483 static void ClearList( vector<MenuItemExt*> * );
486 intf_thread_t *p_intf;
489 vlc_object_t * p_object;
497 /* Preferences Dialog */
498 /* Preferences Dialog */
500 class PrefsDialog: public CBaseWindow
504 PrefsDialog( intf_thread_t *, CBaseWindow *, HINSTANCE );
505 virtual ~PrefsDialog(){};
509 /* Event handlers (these functions should _not_ be virtual) */
511 /*void OnCancel( UINT event );
512 void OnSave( UINT event );
513 void OnResetAll( UINT event );
514 void OnAdvanced( UINT event );*/
518 HWND advanced_checkbox;
521 PrefsTreeCtrl *prefs_tree;
523 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
526 /*****************************************************************************
527 * A small helper function for utf8 <-> unicode conversions
528 *****************************************************************************/
530 extern wchar_t pwsz_mbtow_wince[2048];
531 extern char psz_wtomb_wince[2048];
532 static inline wchar_t *_FROMMB( const char *psz_in )
534 mbstowcs( pwsz_mbtow_wince, psz_in, 2048 );
535 pwsz_mbtow_wince[2048-1] = 0;
536 return pwsz_mbtow_wince;
538 static inline char *_TOMB( const wchar_t *pwsz_in )
540 wcstombs( psz_wtomb_wince, pwsz_in, 2048 );
541 psz_wtomb_wince[2048-1] = 0;
542 return psz_wtomb_wince;
545 # define _FROMMB(a) a
549 /*****************************************************************************
550 * Misc definitions (mainly from aygshell.h)
551 *****************************************************************************/
552 #define _WIN32_IE 0x0500
554 #define SHFS_SHOWSIPBUTTON 0x0004
555 #define SHFS_HIDESIPBUTTON 0x0008
556 #define SHIDIM_FLAGS 0x0001
557 #define SHIDIF_DONEBUTTON 0x0001
558 #define SHIDIF_SIPDOWN 0x0008
559 #define SHIDIF_FULLSCREENNOMENUBAR 0x0010
560 #define SHCMBF_HMENU 0x0010
561 #define SHCMBF_EMPTYBAR 0x0001
562 #define GN_CONTEXTMENU 1000
563 #define SHRG_RETURNCMD 0x0001
564 #define SHRG_NOTIFYPARENT 0x0002
565 #define SHCMBM_GETSUBMENU (WM_USER + 401)
566 #define SHCMBM_GETMENU (WM_USER + 402)
567 #ifndef TBSTYLE_NO_DROPDOWN_ARROW
568 #define TBSTYLE_NO_DROPDOWN_ARROW 0x0080
570 #define lstrlenW wcslen
571 #define SHGetMenu(hwnd) \
572 (HMENU)SendMessage((hwnd), SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0)
573 #define TrackPopupMenu(hm,u,x,y,r,hw,p) \
574 TrackPopupMenuEx((hm),(u),(x),(y),(hw),0)
577 typedef struct tagSHMENUBARINFO
588 } SHMENUBARINFO, *PSHMENUBARINFO;
590 BOOL SHCreateMenuBar( SHMENUBARINFO *pmbi );
591 BOOL SHFullScreen(HWND hwndRequester, DWORD dwState);
593 typedef struct tagSHINITDLGINFO
598 } SHINITDLGINFO, *PSHINITDLGINFO;
600 BOOL SHInitDialog(PSHINITDLGINFO pshidi);
602 typedef struct tagNMRGINFO
607 } NMRGINFO, *PNMRGINFO;
609 BOOL WINAPI CommandBar_InsertMenubarEx(HWND, HINSTANCE, LPTSTR, WORD);
611 typedef struct tagSHRGI
617 } SHRGINFO, *PSHRGINFO;
619 DWORD SHRecognizeGesture(SHRGINFO *shrg);
621 typedef enum tagSIPSTATE
630 BOOL SHSipPreference(HWND, SIPSTATE);
632 BOOL SHSipInfo(UINT, UINT, PVOID, UINT);
638 RECT rcVisibleDesktop;
645 #if defined( WIN32 ) && !defined( UNDER_CE )
646 # define SHFullScreen(a,b)
647 # define SHInitDialog(a)
648 # define SHCreateMenuBar(a) 1
649 # define SHRecognizeGesture(a) 0
650 # define SHSipPreference(a,b)
652 # define SHSipInfo(a,b,c,d) 0
655 #endif //WINCE_RESOURCE
657 #define IDD_ABOUT 101
658 #define IDI_ICON1 102
659 #define IDB_BITMAP1 103
660 #define IDB_BITMAP2 111
661 #define IDR_MENUBAR1 113
662 #define IDD_FILEINFO 118
663 #define IDD_DUMMY 118
664 #define IDD_MESSAGES 119
665 #define IDR_MENUBAR 120
666 #define IDR_MENUBAR2 121
667 #define IDD_PLAYLIST 122
668 #define IDB_BITMAP3 123
669 #define IDD_ITEMINFO 124
671 #define IDSAVEAS 1002
672 #define ID_FILE 40028
673 #define ID_VIEW 40030
674 #define ID_SETTINGS 40032
675 #define ID_AUDIO 40034
676 #define ID_EMPTY 40034
677 #define ID_VIDEO 40036
678 #define ID_NAVIGATION 40038
679 #define IDM_FILE 40042
680 #define IDM_VIEW 40044
681 #define IDM_SETTINGS 40046
682 #define IDM_AUDIO 40048
683 #define IDM_VIDEO 40050
684 #define IDM_NAVIGATION 40053
685 #define ID_FILE_QUICKOPEN 40057
686 #define ID_FILE_OPENFILE 40058
687 #define ID_FILE_OPENDIR 40059
688 #define ID_FILE_OPENNET 40060
689 #define ID_FILE_EXIT 40061
690 #define ID_VIEW_PLAYLIST 40063
691 #define ID_VIEW_MESSAGES 40064
692 #define ID_VIEW_MEDIAINFO 40065
693 #define ID_VIEW_STREAMINFO 40066
694 #define ID_PREFERENCES 40071
695 #define ID_FILE_ABOUT 40069
696 #define IDM_MANAGE 40087
697 #define IDM_SORT 40088
698 #define IDM_SEL 40089
699 #define ID_SORT_AUTHOR 40091
700 #define ID_SORT_RAUTHOR 40092
701 #define ID_SORT_SHUFFLE 40095
702 #define ID_SEL_INVERT 40096
703 #define ID_SEL_DELETE 40097
704 #define ID_SEL_SELECTALL 40098
705 #define ID_SEL_ENABLE 40100
706 #define ID_SEL_DISABLE 40101
707 #define ID_SORT_TITLE 40102
708 #define ID_SORT_RTITLE 40103
709 #define ID_MANAGE_ADDFILE 40104
710 #define ID_MANAGE_ADDDIRECTORY 40105
711 #define ID_MANAGE_ADDMRL 40106
712 #define ID_MANAGE_OPENPL 40107
713 #define ID_MANAGE_SAVEPL 40108
714 #define StopStream_Event 57601
715 #define PlayStream_Event 57602
716 #define PrevStream_Event 57603
717 #define NextStream_Event 57604
718 #define SlowStream_Event 57605
719 #define FastStream_Event 57606