Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Alextp committed Sep 20, 2020
1 parent 5e4b48d commit 9dbcefa
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions win32menustyler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ procedure TWin32MenuStyler.HandleMenuDrawItem(Sender: TObject; ACanvas: TCanvas;
var
mi: TMenuItem;
Images: TCustomImageList;
IconW, IconH: integer;
IconW: integer;
dx, dxCell, dxMin, dxBig, Y: integer;
ExtCell, ExtTall, Ext2: Types.TSize;
NDrawFlags: UINT;
Expand All @@ -153,6 +153,7 @@ procedure TWin32MenuStyler.HandleMenuDrawItem(Sender: TObject; ACanvas: TCanvas;
bDisabled:= odDisabled in AState;
bInBar:= mi.IsInMenuBar;
bHasSubmenu:= (not bInBar) and (mi.Count>0);
IconW:= 0;

if odSelected in AState then
ACanvas.Brush.Color:= MenuStylerTheme.ColorBkSelected
Expand All @@ -165,21 +166,12 @@ procedure TWin32MenuStyler.HandleMenuDrawItem(Sender: TObject; ACanvas: TCanvas;
dxMin:= dxCell * MenuStylerTheme.IndentMinPercents div 100;
dxBig:= dxCell * MenuStylerTheme.IndentBigPercents div 100;

IconW:= 0;
IconH:= 0;

if Assigned(mi.Bitmap) then
begin
IconW:= mi.Bitmap.Width;
IconH:= mi.Bitmap.Height;
end;

Images:= mi.GetParentMenu.Images;
if Assigned(Images) then
begin
IconW:= Max(IconW, Images.Width);
IconH:= Max(IconH, Images.Height);
end;

if IconW>0 then
dxBig:= Max(dxBig, IconW + dxCell * MenuStylerTheme.IndentIconPercents * 2 div 100);
Expand Down

0 comments on commit 9dbcefa

Please sign in to comment.