mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 17:50:19 +02:00
LCL, Win32: Refactor DoMsgMeasureItem out of TWindowProcHelper.DoWindowProc.
git-svn-id: trunk@47461 -
This commit is contained in:
parent
5acbc303cb
commit
e63274a519
@ -409,6 +409,7 @@ type
|
|||||||
procedure DoMsgLButtonCommon;
|
procedure DoMsgLButtonCommon;
|
||||||
procedure DoMsgLButtonDoubleClick;
|
procedure DoMsgLButtonDoubleClick;
|
||||||
procedure DoMsgLButtonDown;
|
procedure DoMsgLButtonDown;
|
||||||
|
procedure DoMsgMeasureItem;
|
||||||
procedure DoMsgMouseMove;
|
procedure DoMsgMouseMove;
|
||||||
procedure DoMsgMouseUpDownClick(aMsg: Cardinal);
|
procedure DoMsgMouseUpDownClick(aMsg: Cardinal);
|
||||||
procedure DoMsgContextMenu;
|
procedure DoMsgContextMenu;
|
||||||
@ -1797,6 +1798,41 @@ begin
|
|||||||
WinProcess := false;
|
WinProcess := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TWindowProcHelper.DoMsgMeasureItem;
|
||||||
|
begin
|
||||||
|
case PMeasureItemStruct(LParam)^.CtlType of
|
||||||
|
ODT_MENU:
|
||||||
|
begin
|
||||||
|
menuItem := TObject(PMeasureItemStruct(LParam)^.itemData);
|
||||||
|
if menuItem is TMenuItem then
|
||||||
|
begin
|
||||||
|
menuHDC := GetDC(Window);
|
||||||
|
TmpSize := MenuItemSize(TMenuItem(menuItem), menuHDC);
|
||||||
|
PMeasureItemStruct(LParam)^.itemWidth := TmpSize.cx;
|
||||||
|
PMeasureItemStruct(LParam)^.itemHeight := TmpSize.cy;
|
||||||
|
ReleaseDC(Window, menuHDC);
|
||||||
|
Winprocess := False;
|
||||||
|
end
|
||||||
|
{$ifdef MSG_DEBUG}
|
||||||
|
else
|
||||||
|
DebugLn('WM_MEASUREITEM for a menuitem catched but menuitem is not TmenuItem');
|
||||||
|
{$endif}
|
||||||
|
end;
|
||||||
|
else
|
||||||
|
if WParam <> 0 then
|
||||||
|
begin
|
||||||
|
lWinControl := TWinControl(WParam);
|
||||||
|
if Assigned(lWinControl) then
|
||||||
|
begin
|
||||||
|
LMessage.Msg := LM_MEASUREITEM;
|
||||||
|
LMessage.LParam := LParam;
|
||||||
|
LMessage.WParam := WParam;
|
||||||
|
Winprocess := False;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
// This is called from the actual WindowProc.
|
// This is called from the actual WindowProc.
|
||||||
|
|
||||||
function TWindowProcHelper.DoWindowProc: LResult;
|
function TWindowProcHelper.DoWindowProc: LResult;
|
||||||
@ -2214,44 +2250,9 @@ begin
|
|||||||
if (PWindowPos(LParam)^.flags and SWP_NOSIZE) = 0 then
|
if (PWindowPos(LParam)^.flags and SWP_NOSIZE) = 0 then
|
||||||
Windows.InvalidateRect(Window, nil, True);
|
Windows.InvalidateRect(Window, nil, True);
|
||||||
end;
|
end;
|
||||||
WM_MEASUREITEM:
|
WM_MEASUREITEM: DoMsgMeasureItem;
|
||||||
begin
|
WM_SETTINGCHANGE: Application.IntfSettingsChange;
|
||||||
case PMeasureItemStruct(LParam)^.CtlType of
|
|
||||||
ODT_MENU:
|
|
||||||
begin
|
|
||||||
menuItem := TObject(PMeasureItemStruct(LParam)^.itemData);
|
|
||||||
if menuItem is TMenuItem then
|
|
||||||
begin
|
|
||||||
menuHDC := GetDC(Window);
|
|
||||||
TmpSize := MenuItemSize(TMenuItem(menuItem), menuHDC);
|
|
||||||
PMeasureItemStruct(LParam)^.itemWidth := TmpSize.cx;
|
|
||||||
PMeasureItemStruct(LParam)^.itemHeight := TmpSize.cy;
|
|
||||||
ReleaseDC(Window, menuHDC);
|
|
||||||
Winprocess := False;
|
|
||||||
end
|
|
||||||
{$ifdef MSG_DEBUG}
|
|
||||||
else
|
|
||||||
DebugLn('WM_MEASUREITEM for a menuitem catched but menuitem is not TmenuItem');
|
|
||||||
{$endif}
|
|
||||||
end;
|
|
||||||
else
|
|
||||||
if WParam <> 0 then
|
|
||||||
begin
|
|
||||||
lWinControl := TWinControl(WParam);
|
|
||||||
if Assigned(lWinControl) then
|
|
||||||
begin
|
|
||||||
LMessage.Msg := LM_MEASUREITEM;
|
|
||||||
LMessage.LParam := LParam;
|
|
||||||
LMessage.WParam := WParam;
|
|
||||||
Winprocess := False;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
WM_SETTINGCHANGE:
|
|
||||||
Application.IntfSettingsChange;
|
|
||||||
WM_THEMECHANGED:
|
WM_THEMECHANGED:
|
||||||
begin
|
|
||||||
// winxp theme changed, recheck whether themes are enabled
|
// winxp theme changed, recheck whether themes are enabled
|
||||||
if Window = Win32WidgetSet.AppHandle then
|
if Window = Win32WidgetSet.AppHandle then
|
||||||
begin
|
begin
|
||||||
@ -2259,12 +2260,9 @@ begin
|
|||||||
Graphics.UpdateHandleObjects;
|
Graphics.UpdateHandleObjects;
|
||||||
ThemeServices.IntfDoOnThemeChange;
|
ThemeServices.IntfDoOnThemeChange;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
WM_UPDATEUISTATE:
|
WM_UPDATEUISTATE:
|
||||||
begin
|
|
||||||
if ThemeServices.ThemesEnabled then
|
if ThemeServices.ThemesEnabled then
|
||||||
InvalidateRect(Window, nil, True);
|
InvalidateRect(Window, nil, True);
|
||||||
end;
|
|
||||||
|
|
||||||
{ >= WM_USER }
|
{ >= WM_USER }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user