mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
init new-style menus
This commit is contained in:
parent
23139bccce
commit
4e4123c0d3
1 changed files with 47 additions and 5 deletions
|
@ -25,6 +25,7 @@
|
||||||
#include <commdlg.h>
|
#include <commdlg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <winuser.h>
|
#include <winuser.h>
|
||||||
|
#include <aygshell.h>
|
||||||
#include "strutils.h"
|
#include "strutils.h"
|
||||||
|
|
||||||
#include "memstream.h"
|
#include "memstream.h"
|
||||||
|
@ -730,6 +731,17 @@ InitInstance(HINSTANCE hInstance, int nCmdShow)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( globals->hwndCB ) {
|
||||||
|
RECT rc, rcmb;
|
||||||
|
|
||||||
|
GetWindowRect( hWnd, &rc );
|
||||||
|
GetWindowRect( globals->hwndCB, &rcmb );
|
||||||
|
rc.bottom -= (rcmb.bottom - rcmb.top);
|
||||||
|
|
||||||
|
MoveWindow(hWnd, rc.left, rc.top, rc.right-rc.left,
|
||||||
|
rc.bottom-rc.top, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
ceInitUtilFuncs( globals );
|
ceInitUtilFuncs( globals );
|
||||||
|
|
||||||
/* choose one. If none found it's an error. */
|
/* choose one. If none found it's an error. */
|
||||||
|
@ -1209,6 +1221,28 @@ ceConfirmAndSave( CEAppGlobals* globals )
|
||||||
return confirmed;
|
return confirmed;
|
||||||
} /* ceConfirmAndSave */
|
} /* ceConfirmAndSave */
|
||||||
|
|
||||||
|
static HWND
|
||||||
|
makeCommandBar( HWND hwnd, HINSTANCE hInst )
|
||||||
|
{
|
||||||
|
SHMENUBARINFO mbi;
|
||||||
|
|
||||||
|
XP_MEMSET( &mbi, 0, sizeof(SHMENUBARINFO) );
|
||||||
|
mbi.cbSize = sizeof(SHMENUBARINFO);
|
||||||
|
mbi.hwndParent = hwnd;
|
||||||
|
mbi.nToolBarId = IDM_MENU;
|
||||||
|
mbi.hInstRes = hInst;
|
||||||
|
mbi.nBmpId = 0;
|
||||||
|
mbi.cBmpImages = 0;
|
||||||
|
mbi.dwFlags = SHCMBF_HIDESIPBUTTON; /* eeh added */
|
||||||
|
|
||||||
|
if (!SHCreateMenuBar(&mbi)) {
|
||||||
|
XP_LOGF( "SHCreateMenuBar failed" );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mbi.hwndMB;
|
||||||
|
} /* makeCommandBar */
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
|
@ -1220,19 +1254,27 @@ WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
XP_Bool handled;
|
XP_Bool handled;
|
||||||
|
|
||||||
if ( message == WM_CREATE ) {
|
if ( message == WM_CREATE ) {
|
||||||
|
INITCOMMONCONTROLSEX initCtrls;
|
||||||
|
BOOL installed;
|
||||||
globals = ((CREATESTRUCT*)lParam)->lpCreateParams;
|
globals = ((CREATESTRUCT*)lParam)->lpCreateParams;
|
||||||
SetWindowLong( hWnd, GWL_USERDATA, (long)globals );
|
SetWindowLong( hWnd, GWL_USERDATA, (long)globals );
|
||||||
|
|
||||||
globals->hwndCB = CommandBar_Create(globals->hInst, hWnd, 1);
|
globals->hwndCB = makeCommandBar( hWnd, globals->hInst );
|
||||||
CommandBar_InsertMenubar(globals->hwndCB, globals->hInst, IDM_MENU, 0);
|
|
||||||
addButtonsToCmdBar( globals );
|
addButtonsToCmdBar( globals );
|
||||||
/* CommandBar_AddAdornments must get called last */
|
|
||||||
/* CommandBar_AddAdornments(globals->hwndCB, 0, 0); */
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
globals = (CEAppGlobals*)GetWindowLong( hWnd, GWL_USERDATA );
|
globals = (CEAppGlobals*)GetWindowLong( hWnd, GWL_USERDATA );
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
|
|
||||||
|
case WM_ACTIVATE:
|
||||||
|
// Notify shell of our activate message
|
||||||
|
SHHandleWMActivate( hWnd, wParam, lParam, &globals->sai, FALSE );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WM_SETTINGCHANGE:
|
||||||
|
SHHandleWMSettingChange( hWnd, wParam, lParam, &globals->sai );
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
wmId = LOWORD(wParam);
|
wmId = LOWORD(wParam);
|
||||||
wmEvent = HIWORD(wParam);
|
wmEvent = HIWORD(wParam);
|
||||||
|
|
Loading…
Reference in a new issue