Commit fa81e26c authored by Gildas Bazin's avatar Gildas Bazin

* ../modules/gui/wince: new CreateMenuBar() which handles win32 as well.

parent 4edf30a1
...@@ -144,15 +144,105 @@ BOOL Interface::InitInstance( HINSTANCE hInstance, intf_thread_t *_p_intf ) ...@@ -144,15 +144,105 @@ BOOL Interface::InitInstance( HINSTANCE hInstance, intf_thread_t *_p_intf )
} }
/*********************************************************************** /***********************************************************************
FUNCTION:
CreateMenuBar
PURPOSE:
Creates a menu bar.
***********************************************************************/
HWND CreateMenuBar( HWND hwnd, HINSTANCE hInst )
{
#ifdef UNDER_CE
SHMENUBARINFO mbi;
memset( &mbi, 0, sizeof(SHMENUBARINFO) );
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent = hwnd;
mbi.hInstRes = hInst;
mbi.nToolBarId = IDR_MENUBAR;
if( !SHCreateMenuBar( &mbi ) )
{
MessageBox(hwnd, _T("SHCreateMenuBar Failed"), _T("Error"), MB_OK);
return 0;
}
TBBUTTONINFO tbbi;
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_LPARAM;
SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_FILE, (LPARAM)&tbbi );
HMENU hmenu_file = (HMENU)tbbi.lParam;
RemoveMenu( hmenu_file, 0, MF_BYPOSITION );
SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_VIEW, (LPARAM)&tbbi );
HMENU hmenu_view = (HMENU)tbbi.lParam;
RemoveMenu( hmenu_view, 0, MF_BYPOSITION );
SendMessage( mbi.hwndMB, TB_GETBUTTONINFO, IDM_SETTINGS, (LPARAM)&tbbi );
HMENU hmenu_settings = (HMENU)tbbi.lParam;
#else
HMENU hmenu_file = CreatePopupMenu();
HMENU hmenu_view = CreatePopupMenu();
HMENU hmenu_settings = CreatePopupMenu();
HMENU hmenu_audio = CreatePopupMenu();
HMENU hmenu_video = CreatePopupMenu();
HMENU hmenu_navigation = CreatePopupMenu();
#endif
AppendMenu( hmenu_file, MF_STRING, ID_FILE_QUICKOPEN,
_T("Quick &Open File") );
AppendMenu( hmenu_file, MF_SEPARATOR, 0, 0 );
AppendMenu( hmenu_file, MF_STRING, ID_FILE_OPENFILE,
_T("Open &File") );
AppendMenu( hmenu_file, MF_STRING, ID_FILE_OPENNET,
_T("Open Network Stream") );
AppendMenu( hmenu_file, MF_SEPARATOR, 0, 0 );
AppendMenu( hmenu_file, MF_STRING, ID_FILE_ABOUT,
_T("About VLC") );
AppendMenu( hmenu_file, MF_STRING, ID_FILE_EXIT,
_T("E&xit") );
AppendMenu( hmenu_view, MF_STRING, ID_VIEW_PLAYLIST,
_T("&Playlist") );
AppendMenu( hmenu_view, MF_STRING, ID_VIEW_MESSAGES,
_T("&Messages") );
AppendMenu( hmenu_view, MF_STRING, ID_VIEW_STREAMINFO,
_T("&Stream and Media info") );
AppendMenu( hmenu_settings, MF_STRING, ID_SETTINGS_EXTEND,
_T("&Extended GUI") );
AppendMenu( hmenu_settings, MF_STRING, ID_SETTINGS_PREF,
_T("&Preferences...") );
#ifdef UNDER_CE
return mbi.hwndMB;
#else
HMENU hmenu = CreateMenu();
AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_file, _T("File") );
AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_view, _T("View") );
AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_settings,
_T("Settings") );
AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_audio, _T("Audio") );
AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_video, _T("Video") );
AppendMenu( hmenu, MF_POPUP|MF_STRING, (UINT)hmenu_navigation,
_T("Nav.") );
SetMenu( hwnd, hmenu );
return hwnd;
#endif
}
/***********************************************************************
FUNCTION: FUNCTION:
CreateToolbar CreateToolBar
PURPOSE: PURPOSE:
Registers the TOOLBAR control class and creates a toolbar. Registers the TOOLBAR control class and creates a toolbar.
***********************************************************************/ ***********************************************************************/
HWND WINAPI Interface::CreateToolbar( HWND hwnd ) HWND CreateToolBar( HWND hwnd, HINSTANCE hInst )
{ {
DWORD dwStyle; DWORD dwStyle;
HWND hwndTB; HWND hwndTB;
...@@ -191,13 +281,13 @@ HWND WINAPI Interface::CreateToolbar( HWND hwnd ) ...@@ -191,13 +281,13 @@ HWND WINAPI Interface::CreateToolbar( HWND hwnd )
/*********************************************************************** /***********************************************************************
FUNCTION: FUNCTION:
CreateSliderbar CreateSliderBar
PURPOSE: PURPOSE:
Registers the TRACKBAR_CLASS control class and creates a trackbar. Registers the TRACKBAR_CLASS control class and creates a trackbar.
***********************************************************************/ ***********************************************************************/
HWND WINAPI Interface::CreateSliderbar( HWND hwnd ) HWND CreateSliderBar( HWND hwnd, HINSTANCE hInst )
{ {
HWND hwndSlider; HWND hwndSlider;
RECT rect; RECT rect;
...@@ -231,7 +321,7 @@ HWND WINAPI Interface::CreateSliderbar( HWND hwnd ) ...@@ -231,7 +321,7 @@ HWND WINAPI Interface::CreateSliderbar( HWND hwnd )
return hwndSlider; return hwndSlider;
} }
HWND WINAPI Interface::CreateStaticText( HWND hwnd ) HWND CreateStaticText( HWND hwnd, HINSTANCE hInst )
{ {
HWND hwndLabel; HWND hwndLabel;
RECT rect; RECT rect;
...@@ -256,13 +346,13 @@ HWND WINAPI Interface::CreateStaticText( HWND hwnd ) ...@@ -256,13 +346,13 @@ HWND WINAPI Interface::CreateStaticText( HWND hwnd )
/*********************************************************************** /***********************************************************************
FUNCTION: FUNCTION:
CreateVolTrackbar CreateVolTrackBar
PURPOSE: PURPOSE:
Registers the TRACKBAR_CLASS control class and creates a trackbar. Registers the TRACKBAR_CLASS control class and creates a trackbar.
***********************************************************************/ ***********************************************************************/
HWND WINAPI Interface::CreateVolTrackbar( HWND hwnd ) HWND CreateVolTrackBar( HWND hwnd, HINSTANCE hInst )
{ {
HWND hwndVol; HWND hwndVol;
RECT rect; RECT rect;
...@@ -300,13 +390,13 @@ HWND WINAPI Interface::CreateVolTrackbar( HWND hwnd ) ...@@ -300,13 +390,13 @@ HWND WINAPI Interface::CreateVolTrackbar( HWND hwnd )
/*********************************************************************** /***********************************************************************
FUNCTION: FUNCTION:
CreateStatusbar CreateStatusBar
PURPOSE: PURPOSE:
Registers the StatusBar control class and creates a Statusbar. Registers the StatusBar control class and creates a Statusbar.
***********************************************************************/ ***********************************************************************/
HWND WINAPI Interface::CreateStatusbar( HWND hwnd ) HWND CreateStatusBar( HWND hwnd, HINSTANCE hInst )
{ {
DWORD dwStyle; DWORD dwStyle;
HWND hwndSB; HWND hwndSB;
...@@ -385,11 +475,11 @@ LRESULT CALLBACK CBaseWindow::BaseWndProc( HWND hwnd, UINT msg, WPARAM wParam, ...@@ -385,11 +475,11 @@ LRESULT CALLBACK CBaseWindow::BaseWndProc( HWND hwnd, UINT msg, WPARAM wParam,
CBaseWindow *pObj = CBaseWindow *pObj =
reinterpret_cast<CBaseWindow *>(::GetWindowLong( hwnd, GWL_USERDATA )); reinterpret_cast<CBaseWindow *>(::GetWindowLong( hwnd, GWL_USERDATA ));
if( !pObj ) return DefWindowProc( hwnd, msg, wParam, lParam );
// Filter message through child classes // Filter message through child classes
if( pObj ) if( pObj )
lResult = pObj->WndProc( hwnd, msg, wParam, lParam, &bProcessed ); lResult = pObj->WndProc( hwnd, msg, wParam, lParam, &bProcessed );
else
return ( pObj->DlgFlag ? FALSE : TRUE ); // message not processed
if( pObj->DlgFlag ) if( pObj->DlgFlag )
return bProcessed; // processing a dialog message return TRUE if processed return bProcessed; // processing a dialog message return TRUE if processed
...@@ -412,8 +502,6 @@ PURPOSE: ...@@ -412,8 +502,6 @@ PURPOSE:
LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
LPARAM lp, PBOOL pbProcessed ) LPARAM lp, PBOOL pbProcessed )
{ {
SHMENUBARINFO mbi;
// call the base class first // call the base class first
LRESULT lResult = CBaseWindow::WndProc( hwnd, msg, wp, lp, pbProcessed ); LRESULT lResult = CBaseWindow::WndProc( hwnd, msg, wp, lp, pbProcessed );
*pbProcessed = TRUE; *pbProcessed = TRUE;
...@@ -421,37 +509,15 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, ...@@ -421,37 +509,15 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
switch( msg ) switch( msg )
{ {
case WM_CREATE: case WM_CREATE:
//Create the menubar
memset( &mbi, 0, sizeof(SHMENUBARINFO) );
mbi.cbSize = sizeof(SHMENUBARINFO);
mbi.hwndParent = hwnd;
mbi.nToolBarId = IDR_MENUBAR;
mbi.hInstRes = hInst;
mbi.nBmpId = 0;
mbi.cBmpImages = 0;
if( !SHCreateMenuBar(&mbi) )
{ {
MessageBox(hwnd, _T("SHCreateMenuBar Failed"), _T("Error"), MB_OK); hwndCB = CreateMenuBar( hwnd, hInst );
//return -1; hwndTB = CreateToolBar( hwnd, hInst );
} hwndSlider = CreateSliderBar( hwnd, hInst );
hwndLabel = CreateStaticText( hwnd, hInst );
hwndCB = mbi.hwndMB; hwndVol = CreateVolTrackBar( hwnd, hInst );
#ifdef UNDER_CE
// Creates the toolbar hwndSB = CreateStatusBar( hwnd, hInst );
hwndTB = CreateToolbar( hwnd ); #endif
// Creates the sliderbar
hwndSlider = CreateSliderbar( hwnd );
// Creates the time label
hwndLabel = CreateStaticText( hwnd );
// Creates the volume trackbar
hwndVol = CreateVolTrackbar( hwnd );
// Creates the statusbar
hwndSB = CreateStatusbar( hwnd );
/* Video window */ /* Video window */
if( config_GetInt( pIntf, "wince-embed" ) ) if( config_GetInt( pIntf, "wince-embed" ) )
...@@ -462,7 +528,7 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp, ...@@ -462,7 +528,7 @@ LRESULT CALLBACK Interface::WndProc( HWND hwnd, UINT msg, WPARAM wp,
// Hide the SIP button (WINCE only) // Hide the SIP button (WINCE only)
SetForegroundWindow( hwnd ); SetForegroundWindow( hwnd );
SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON ); SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
}
return lResult; return lResult;
case WM_COMMAND: case WM_COMMAND:
......
...@@ -158,12 +158,6 @@ protected: ...@@ -158,12 +158,6 @@ protected:
virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp, virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
PBOOL pbProcessed ); PBOOL pbProcessed );
HWND WINAPI CreateToolbar( HWND );
HWND WINAPI CreateSliderbar( HWND );
HWND WINAPI CreateStaticText( HWND );
HWND WINAPI CreateVolTrackbar( HWND );
HWND WINAPI CreateStatusbar( HWND );
void OnOpenFileSimple( void ); void OnOpenFileSimple( void );
void OnPlayStream( void ); void OnPlayStream( void );
void OnVideoOnTop( void ); void OnVideoOnTop( void );
...@@ -564,12 +558,19 @@ protected: ...@@ -564,12 +558,19 @@ protected:
#define SHIDIF_SIPDOWN 0x0008 #define SHIDIF_SIPDOWN 0x0008
#define SHIDIF_FULLSCREENNOMENUBAR 0x0010 #define SHIDIF_FULLSCREENNOMENUBAR 0x0010
#define SHCMBF_HMENU 0x0010 #define SHCMBF_HMENU 0x0010
#define SHCMBF_EMPTYBAR 0x0001
#define SHFS_SHOWSIPBUTTON 0x0004 #define SHFS_SHOWSIPBUTTON 0x0004
#define GN_CONTEXTMENU 1000 #define GN_CONTEXTMENU 1000
#define SHCMBM_GETSUBMENU (WM_USER + 401) #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 lstrlenW wcslen
#define SHGetMenu(hwnd) \
(HMENU)SendMessage((hwnd), SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0)
#define TrackPopupMenu(hm,u,x,y,r,hw,p) \ #define TrackPopupMenu(hm,u,x,y,r,hw,p) \
TrackPopupMenuEx((hm),(u),(x),(y),(hw),0) TrackPopupMenuEx((hm),(u),(x),(y),(hw),0)
extern "C" { extern "C" {
typedef struct tagSHMENUBARINFO typedef struct tagSHMENUBARINFO
...@@ -603,6 +604,8 @@ extern "C" { ...@@ -603,6 +604,8 @@ extern "C" {
POINT ptAction; POINT ptAction;
DWORD dwItemSpec; DWORD dwItemSpec;
} NMRGINFO, *PNMRGINFO; } NMRGINFO, *PNMRGINFO;
BOOL WINAPI CommandBar_InsertMenubarEx(HWND, HINSTANCE, LPTSTR, WORD);
} }
#if defined( WIN32 ) && !defined( UNDER_CE ) #if defined( WIN32 ) && !defined( UNDER_CE )
......
...@@ -41,24 +41,15 @@ IDR_MENUBAR MENU DISCARDABLE ...@@ -41,24 +41,15 @@ IDR_MENUBAR MENU DISCARDABLE
BEGIN BEGIN
POPUP "File" POPUP "File"
BEGIN BEGIN
MENUITEM "Quick &Open File", ID_FILE_QUICKOPEN MENUITEM "Empty", ID_EMPTY, GRAYED
MENUITEM SEPARATOR
MENUITEM "Open &File", ID_FILE_OPENFILE
MENUITEM "Open &Network Stream", ID_FILE_OPENNET
MENUITEM SEPARATOR
MENUITEM "About VLC", ID_FILE_ABOUT
MENUITEM "E&xit", ID_FILE_EXIT
END END
POPUP "View" POPUP "View"
BEGIN BEGIN
MENUITEM "&Playlist", ID_VIEW_PLAYLIST MENUITEM "Empty", ID_EMPTY, GRAYED
MENUITEM "&Messages", ID_VIEW_MESSAGES
MENUITEM "&Stream and Media info", ID_VIEW_STREAMINFO
END END
POPUP "Settings" POPUP "Settings"
BEGIN BEGIN
MENUITEM "&Extended GUI", ID_SETTINGS_EXTEND MENUITEM "Empty", ID_EMPTY, GRAYED
MENUITEM "&Preferences...", ID_SETTINGS_PREF
END END
POPUP "Audio" POPUP "Audio"
BEGIN BEGIN
...@@ -68,7 +59,7 @@ BEGIN ...@@ -68,7 +59,7 @@ BEGIN
BEGIN BEGIN
MENUITEM "Empty", ID_EMPTY, GRAYED MENUITEM "Empty", ID_EMPTY, GRAYED
END END
POPUP "Navigation" POPUP "Nav"
BEGIN BEGIN
MENUITEM "Empty", ID_EMPTY, GRAYED MENUITEM "Empty", ID_EMPTY, GRAYED
END END
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment