some work on menus

svn path=/trunk/; revision=5443
This commit is contained in:
Thomas Bluemel 2003-08-06 18:43:58 +00:00
parent bd3582207d
commit 2f728ecc17
6 changed files with 20 additions and 61 deletions

View file

@ -439,7 +439,7 @@ NtUserDrawMenuBarTemp(
HDC hDC, HDC hDC,
PRECT hRect, PRECT hRect,
HMENU hMenu, HMENU hMenu,
DWORD Unknown4); HFONT hFont);
DWORD DWORD
STDCALL STDCALL

View file

@ -1,4 +1,4 @@
/* $Id: defwnd.c,v 1.61 2003/08/06 13:17:43 weiden Exp $ /* $Id: defwnd.c,v 1.62 2003/08/06 18:43:57 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
@ -449,6 +449,7 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
RECT rect; RECT rect;
ULONG Style; ULONG Style;
ULONG ExStyle; ULONG ExStyle;
int wFrame = 0;
Active = GetWindowLongW(hWnd, GWL_STYLE) & WIN_NCACTIVATED; Active = GetWindowLongW(hWnd, GWL_STYLE) & WIN_NCACTIVATED;
Style = GetWindowLong(hWnd, GWL_STYLE); Style = GetWindowLong(hWnd, GWL_STYLE);
@ -471,10 +472,12 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
if (UserHasThickFrameStyle(Style, ExStyle)) if (UserHasThickFrameStyle(Style, ExStyle))
{ {
UserDrawFrameNC(hWnd, &rect, FALSE, Active); UserDrawFrameNC(hWnd, &rect, FALSE, Active);
wFrame = GetSystemMetrics(SM_CXSIZEFRAME);
} }
else if (UserHasDlgFrameStyle(Style, ExStyle)) else if (UserHasDlgFrameStyle(Style, ExStyle))
{ {
UserDrawFrameNC(hWnd, &rect, TRUE, Active); UserDrawFrameNC(hWnd, &rect, TRUE, Active);
wFrame = GetSystemMetrics(SM_CXDLGFRAME);
} }
if (Style & WS_CAPTION) if (Style & WS_CAPTION)
{ {
@ -490,6 +493,8 @@ DefWndDoPaintNC(HWND hWnd, HRGN clip)
{ {
RECT r = rect; RECT r = rect;
r.bottom = rect.top + GetSystemMetrics(SM_CYMENU); r.bottom = rect.top + GetSystemMetrics(SM_CYMENU);
r.left += wFrame;
r.right -= wFrame;
rect.top += MenuDrawMenuBar(hDC, &r, hWnd, FALSE); rect.top += MenuDrawMenuBar(hDC, &r, hWnd, FALSE);
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: menu.c,v 1.19 2003/08/06 13:17:43 weiden Exp $ /* $Id: menu.c,v 1.20 2003/08/06 18:43:57 weiden Exp $
* *
* PROJECT: ReactOS user32.dll * PROJECT: ReactOS user32.dll
* FILE: lib/user32/windows/menu.c * FILE: lib/user32/windows/menu.c
@ -302,59 +302,13 @@ MenuGetMenuBarHeight(HWND hWnd, ULONG MenuBarWidth, LONG OrgX, LONG OrgY)
UINT UINT
MenuDrawMenuBar(HDC hDC, LPRECT Rect, HWND hWnd, BOOL Draw) MenuDrawMenuBar(HDC hDC, LPRECT Rect, HWND hWnd, BOOL Draw)
{ {
HFONT hFontOld = SelectObject(hDC, hMenuFont); /* FIXME cache menu bar items using NtUserDrawMenuBarTemp() */
//DrawTextA(hDC, "This is the menu bar", 19, Rect, DT_SINGLELINE);
SelectObject(hDC, hFontOld);
return(GetSystemMetrics(SM_CYMENU));
/*
ULONG MenuID;
PPOPUP_MENU Menu;
HFONT hFontOld;
ULONG i;
MenuID = GetWindowLong(hWnd, GWL_ID); /* FIXME select menu font first */
Menu = MenuGetMenu((HMENU)MenuID);
if (Menu == NULL || Rect == NULL) DrawTextW(hDC, L"FIXME: Draw Menubar", -1, Rect, DT_SINGLELINE | DT_VCENTER);
{
return(GetSystemMetrics(SM_CYMENU));
}
hFontOld = SelectObject(hDC, hMenuFont); return(Rect->bottom - Rect->top);
if (Menu->Height == 0)
{
MenuMenuBarCalcSize(hDC, Rect, Menu, hWnd);
}
Rect->bottom = Rect->top + Menu->Height;
if (!Draw)
{
SelectObject(hDC, hFontOld);
return(Menu->Height);
}
FillRect(hDC, Rect, GetSysColorBrush(COLOR_MENU));
SelectObject(hDC, GetSysColorPen(COLOR_WINDOWFRAME));
MoveToEx(hDC, Rect->left, Rect->bottom, NULL);
LineTo(hDC, Rect->right, Rect->bottom);
if (Menu->NrItems == 0)
{
SelectObject(hDC, hFontOld);
return(GetSystemMetrics(SM_CYMENU));
}
for (i = 0; i < Menu->NrItems; i++)
{
MenuDrawMenuItem(hWnd, (HMENU)MenuID, hWnd, hDC,
Menu->Items + i, Menu->Height, TRUE, ODA_DRAWENTIRE);
}
SelectObject(hDC, hFontOld);
return(Menu->Height);*/
} }

View file

@ -130,7 +130,7 @@ NtUserDrawMenuBarTemp(
HDC hDC, HDC hDC,
PRECT hRect, PRECT hRect,
HMENU hMenu, HMENU hMenu,
DWORD Unknown4); HFONT hFont);
UINT UINT
STDCALL STDCALL

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: menu.c,v 1.11 2003/08/06 13:17:44 weiden Exp $ /* $Id: menu.c,v 1.12 2003/08/06 18:43:58 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -101,7 +101,7 @@ CleanupMenuImpl(VOID)
return(STATUS_SUCCESS); return(STATUS_SUCCESS);
} }
#if 1 #if 0
void FASTCALL void FASTCALL
DumpMenuItemList(PMENU_ITEM MenuItem) DumpMenuItemList(PMENU_ITEM MenuItem)
{ {
@ -532,7 +532,7 @@ W32kInsertMenuItem(PMENU_OBJECT MenuObject, UINT uItem, WINBOOL fByPosition,
} }
pos = W32kInsertMenuItemToList(MenuObject, MenuItem, pos); pos = W32kInsertMenuItemToList(MenuObject, MenuItem, pos);
DumpMenuItemList(MenuObject->MenuItemList);
return pos >= 0; return pos >= 0;
} }

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* $Id: window.c,v 1.79 2003/08/06 16:47:35 weiden Exp $ /* $Id: window.c,v 1.80 2003/08/06 18:43:58 weiden Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -2199,10 +2199,10 @@ NtUserDrawMenuBarTemp(
HDC hDC, HDC hDC,
PRECT hRect, PRECT hRect,
HMENU hMenu, HMENU hMenu,
DWORD Unknown4) HFONT hFont)
{ {
/* we'll use this function just for caching the menu bar */
UNIMPLEMENTED UNIMPLEMENTED
return 0; return 0;
} }