Cocoa: TSpeedButton: set the highlighted background color when pressed, consistent with win32

before, TSpeedButton had a white highlighted background color when it was normal, and a gray background when it was pressed, causing confusion to users.
This commit is contained in:
rich2014 2023-07-02 21:26:51 +08:00
parent eb65e0684e
commit feae93368d

View File

@ -898,6 +898,8 @@ begin
BtnType := NSPushOnPushOffButton;
BezelStyle := BezelButton;
useBezel := true;
if IsPushed(Details) then
btn.setBackgroundColor(NSColor.selectedTextBackgroundColor);
end;
else
Result := false;
@ -922,6 +924,7 @@ begin
btn.setHighlighted( IsPushed(Details));
if ((Details.Element = teToolBar) and (not IsPushed(Details)) and (not IsChecked(Details)))
or ((Details.Element = teButton) and (Details.Part = BP_PUSHBUTTON) and IsPushed(Details))
or ((Details.Element = teButton) and (Details.Part = BP_CHECKBOX))
then
// this is "flat" mode. So unpushed state should draw no borders