mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-16 22:20:47 +01:00
win32: menu item: fix wrong painting of icons bigger than text. Issue #31149
git-svn-id: trunk@54212 -
This commit is contained in:
parent
592b495a47
commit
48a215ee7e
@ -461,6 +461,7 @@ end;
|
|||||||
function VistaPopupMenuItemSize(AMenuItem: TMenuItem; ADC: HDC): TSize;
|
function VistaPopupMenuItemSize(AMenuItem: TMenuItem; ADC: HDC): TSize;
|
||||||
var
|
var
|
||||||
Metrics: TVistaPopupMenuMetrics;
|
Metrics: TVistaPopupMenuMetrics;
|
||||||
|
IconSize: TPoint;
|
||||||
begin
|
begin
|
||||||
Metrics := GetVistaPopupMenuMetrics(AMenuItem, ADC);
|
Metrics := GetVistaPopupMenuMetrics(AMenuItem, ADC);
|
||||||
// count check
|
// count check
|
||||||
@ -475,8 +476,9 @@ begin
|
|||||||
Result.cy := Metrics.CheckSize.cy + ScaleY(Metrics.CheckMargins.cyTopHeight + Metrics.CheckMargins.cyBottomHeight, 96);
|
Result.cy := Metrics.CheckSize.cy + ScaleY(Metrics.CheckMargins.cyTopHeight + Metrics.CheckMargins.cyBottomHeight, 96);
|
||||||
if AMenuItem.HasIcon then
|
if AMenuItem.HasIcon then
|
||||||
begin
|
begin
|
||||||
Result.cy := Max(Result.cy, AMenuItem.GetIconSize.y);
|
IconSize := AMenuItem.GetIconSize;
|
||||||
Result.cx := Max(Result.cx, AMenuItem.GetIconSize.x);
|
Result.cy := Max(Result.cy, IconSize.y);
|
||||||
|
Result.cx := Max(Result.cx, IconSize.x);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
// count gutter
|
// count gutter
|
||||||
@ -715,6 +717,12 @@ begin
|
|||||||
CheckRect := ARect;
|
CheckRect := ARect;
|
||||||
CheckRect.Right := CheckRect.Left + Metrics.CheckSize.cx + Metrics.CheckMargins.cxRightWidth + Metrics.CheckMargins.cxLeftWidth;
|
CheckRect.Right := CheckRect.Left + Metrics.CheckSize.cx + Metrics.CheckMargins.cxRightWidth + Metrics.CheckMargins.cxLeftWidth;
|
||||||
CheckRect.Bottom := CheckRect.Top + Metrics.CheckSize.cy + ScaleY(Metrics.CheckMargins.cyTopHeight + Metrics.CheckMargins.cyBottomHeight, 96);
|
CheckRect.Bottom := CheckRect.Top + Metrics.CheckSize.cy + ScaleY(Metrics.CheckMargins.cyTopHeight + Metrics.CheckMargins.cyBottomHeight, 96);
|
||||||
|
if AMenuItem.HasIcon then
|
||||||
|
begin
|
||||||
|
IconSize := AMenuItem.GetIconSize;
|
||||||
|
CheckRect.Right := Max(CheckRect.Right, CheckRect.Left+MenuIconWidth(AMenuItem));
|
||||||
|
CheckRect.Bottom := Max(CheckRect.Bottom, CheckRect.Top+IconSize.y);
|
||||||
|
end;
|
||||||
// draw gutter
|
// draw gutter
|
||||||
GutterRect := CheckRect;
|
GutterRect := CheckRect;
|
||||||
GutterRect.Left := GutterRect.Right + Metrics.CheckBgMargins.cxRightWidth - Metrics.CheckMargins.cxRightWidth;
|
GutterRect.Left := GutterRect.Right + Metrics.CheckBgMargins.cxRightWidth - Metrics.CheckMargins.cxRightWidth;
|
||||||
@ -752,7 +760,6 @@ begin
|
|||||||
if AMenuItem.HasIcon then
|
if AMenuItem.HasIcon then
|
||||||
begin
|
begin
|
||||||
ImageRect := CheckRect;
|
ImageRect := CheckRect;
|
||||||
IconSize := AMenuItem.GetIconSize;
|
|
||||||
if AMenuItem.Checked then // draw checked rectangle around
|
if AMenuItem.Checked then // draw checked rectangle around
|
||||||
begin
|
begin
|
||||||
Tmp := ThemeServices.GetElementDetails(PopupCheckBgStates[AMenuItem.Enabled]);
|
Tmp := ThemeServices.GetElementDetails(PopupCheckBgStates[AMenuItem.Enabled]);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user