mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 13:50:06 +02:00
LCL-Win32: Fix MenuBar RTL and Check Rectangle. Issue #28294, patch from Zaher Dirkey.
git-svn-id: trunk@49333 -
This commit is contained in:
parent
702d8751b0
commit
a5dc98b647
@ -725,6 +725,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
ImageRect := CheckRect;
|
ImageRect := CheckRect;
|
||||||
IconSize := AMenuItem.GetIconSize;
|
IconSize := AMenuItem.GetIconSize;
|
||||||
|
if AMenuItem.Checked then // draw checked rectangle around
|
||||||
|
begin
|
||||||
|
Tmp := ThemeServices.GetElementDetails(PopupCheckBgStates[AMenuItem.Enabled]);
|
||||||
|
ThemeDrawElement(AHDC, Tmp, CheckRect, nil);
|
||||||
|
end;
|
||||||
ImageRect.Left := (ImageRect.Left + ImageRect.Right - IconSize.x) div 2;
|
ImageRect.Left := (ImageRect.Left + ImageRect.Right - IconSize.x) div 2;
|
||||||
ImageRect.Top := (ImageRect.Top + ImageRect.Bottom - IconSize.y) div 2;
|
ImageRect.Top := (ImageRect.Top + ImageRect.Bottom - IconSize.y) div 2;
|
||||||
if IsRightToLeft then
|
if IsRightToLeft then
|
||||||
@ -736,11 +741,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
ImageRect.Right := IconSize.x;
|
ImageRect.Right := IconSize.x;
|
||||||
ImageRect.Bottom := IconSize.y;
|
ImageRect.Bottom := IconSize.y;
|
||||||
if AMenuItem.Checked then // draw checked rectangle around
|
|
||||||
begin
|
|
||||||
Tmp := ThemeServices.GetElementDetails(PopupCheckBgStates[AMenuItem.Enabled]);
|
|
||||||
ThemeDrawElement(AHDC, Tmp, CheckRect, nil);
|
|
||||||
end;
|
|
||||||
DrawMenuItemIcon(AMenuItem, AHDC, ImageRect, ASelected);
|
DrawMenuItemIcon(AMenuItem, AHDC, ImageRect, ASelected);
|
||||||
if IsRightToLeft then
|
if IsRightToLeft then
|
||||||
SetLayout(AHDC, LAYOUT_RTL);
|
SetLayout(AHDC, LAYOUT_RTL);
|
||||||
@ -1296,15 +1296,10 @@ var
|
|||||||
begin
|
begin
|
||||||
FillChar(MenuInfo, SizeOf(MenuInfo), 0);
|
FillChar(MenuInfo, SizeOf(MenuInfo), 0);
|
||||||
if OldMenuWin95 then
|
if OldMenuWin95 then
|
||||||
begin
|
MenuInfo.cbSize := W95_MENUITEMINFO_SIZE
|
||||||
MenuInfo.cbSize := W95_MENUITEMINFO_SIZE;
|
|
||||||
MenuInfo.fMask := MIIM_TYPE; // caption not retrieved (dwTypeData = nil)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
begin
|
|
||||||
MenuInfo.cbSize := sizeof(TMenuItemInfo);
|
MenuInfo.cbSize := sizeof(TMenuItemInfo);
|
||||||
MenuInfo.fMask := MIIM_FTYPE; // don't retrieve caption (MIIM_STRING not included)
|
MenuInfo.fMask := MIIM_TYPE; //MIIM_FTYPE not work here please use only MIIM_TYPE, caption not retrieved (dwTypeData = nil)
|
||||||
end;
|
|
||||||
{$ifdef WindowsUnicodeSupport}
|
{$ifdef WindowsUnicodeSupport}
|
||||||
if UnicodeEnabledOS then
|
if UnicodeEnabledOS then
|
||||||
GetMenuItemInfoW(Menu, 0, True, @MenuInfo)
|
GetMenuItemInfoW(Menu, 0, True, @MenuInfo)
|
||||||
@ -1567,8 +1562,8 @@ begin
|
|||||||
fType := fType or MFT_RIGHTJUSTIFY;
|
fType := fType or MFT_RIGHTJUSTIFY;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if AMenuItem.RightJustify then
|
if AMenuItem.RightJustify then
|
||||||
fType := fType or MFT_RIGHTJUSTIFY;
|
fType := fType or MFT_RIGHTJUSTIFY;
|
||||||
end;
|
end;
|
||||||
{$ifdef WindowsUnicodeSupport}
|
{$ifdef WindowsUnicodeSupport}
|
||||||
if UnicodeEnabledOS then
|
if UnicodeEnabledOS then
|
||||||
@ -1704,7 +1699,7 @@ begin
|
|||||||
if not TCustomForm(AMenu.Parent).HandleAllocated then Exit;
|
if not TCustomForm(AMenu.Parent).HandleAllocated then Exit;
|
||||||
if csDestroying in AMenu.Parent.ComponentState then Exit;
|
if csDestroying in AMenu.Parent.ComponentState then Exit;
|
||||||
|
|
||||||
AddToChangedMenus(TCustomForm(AMenu.Parent).Handle);
|
AddToChangedMenus((AMenu.Parent as TCustomForm).Handle);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user