From 27e1973d8055f37ee7813fddf6c370c0ffa1a448 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 9 Nov 2003 10:35:19 +0000 Subject: [PATCH] started Menu icons for win32 intf from Martin Smat git-svn-id: trunk@4789 - --- lcl/interfaces/win32/win32object.inc | 16 ++++++++++------ lcl/interfaces/win32/win32winapi.inc | 8 +++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lcl/interfaces/win32/win32object.inc b/lcl/interfaces/win32/win32object.inc index 62467798bd..a01840c750 100644 --- a/lcl/interfaces/win32/win32object.inc +++ b/lcl/interfaces/win32/win32object.inc @@ -853,7 +853,7 @@ activate_time : the time at which the activation event occurred. End; LM_SETFORMICON: Begin - SetClassLong(Handle, GCL_HIcon, (Sender As TCustomForm).GetIconHandle); + SetClassLong(Handle, GCL_HIcon, integer(Data)); End; LM_GETITEMS : Begin @@ -1312,6 +1312,7 @@ Begin Pixmap := CreatePixmapIndirect(PixmapData, 0); DrawIcon(DC, TWinControl(Surface).Left, TWinControl(Surface).Top, Pixmap); ReleaseDC(TWinControl(Surface).Handle, DC); + DeleteObject(Pixmap); End; {------------------------------------------------------------------------------ @@ -2765,14 +2766,14 @@ Begin cbsize:=sizeof(MENUITEMINFO); fMask:=Mask; fType:=Style; - {fState:=MFS_ENABLED;} {not needed} wID:=TMenuItem(Sender).Command; {value may only be 16 bit wide!} hSubmenu:=MenuHandle; - {hbmpChecked:=0; - hbmpUnchecked:=0;} {not needed} dwItemData:=integer(Sender); - {dwTypeData:=LPSTR(TMenuItem(Sender).Caption);} - {cch:=length(TMenuItem(Sender).Caption);} {not needed} + if assigned(TmenuItem(Sender).Graphic) then {adds the menuitem icon} + begin + fMask:=fMask or MIIM_CHECKMARKS; + hbmpUnchecked:=(TMenuItem(Sender).Graphic as TBitmap).Handle; + end; end; InsertMenuItem(ParentMenuHandle, High(UINT), true, @MenuInfo); if TMenuItem(Sender).ShortCut <> 0 then @@ -2806,6 +2807,9 @@ End; { $Log$ + Revision 1.127 2003/11/09 10:35:19 mattias + started Menu icons for win32 intf from Martin Smat + Revision 1.126 2003/11/08 17:41:03 micha compiler warning cleanups diff --git a/lcl/interfaces/win32/win32winapi.inc b/lcl/interfaces/win32/win32winapi.inc index 0caeec9fbc..ab96677c18 100644 --- a/lcl/interfaces/win32/win32winapi.inc +++ b/lcl/interfaces/win32/win32winapi.inc @@ -223,13 +223,11 @@ End; ------------------------------------------------------------------------------} Function TWin32Object.CheckMenuItem(HndMenu: HMENU; uIDEnableItem: Integer; BChecked: Boolean): Boolean; var CheckFlag: integer; - PrevState: integer; Begin if BChecked then CheckFlag := MF_CHECKED else CheckFlag := MF_UNCHECKED; CheckFlag := CheckFlag or MF_BYCOMMAND; - PrevState := Windows.CheckMenuItem(FMenu, UIDEnableItem, CheckFlag); - Result := PrevState = MF_ENABLED; + Result := Windows.CheckMenuItem(FMenu, UIDEnableItem, CheckFlag)=MF_ENABLED; End; {------------------------------------------------------------------------------ @@ -718,6 +716,7 @@ Begin CreateColorMap; DoDrawBitmap; DestroyColorMap; + SelectObject(hdcBitmap, OldObject); ReleaseDC(GetDesktopWindow, hdcScreen); SelectObject(hdcBitmap, OldObject); DeleteDC(hdcBitmap); @@ -2534,6 +2533,9 @@ end; { ============================================================================= $Log$ + Revision 1.70 2003/11/09 10:35:19 mattias + started Menu icons for win32 intf from Martin Smat + Revision 1.69 2003/11/08 17:41:03 micha compiler warning cleanups