spktoolbar: Support accelerator in TSpkPopupMenu items

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8729 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-02-22 14:19:19 +00:00
parent 4e512b8b93
commit e599ba0a1d
2 changed files with 9 additions and 4 deletions

View File

@ -356,7 +356,8 @@ type
x, y : integer;
const AText : string;
TextColor : TColor;
ClipRect : T2DIntRect); overload;
ClipRect : T2DIntRect;
Accel: Boolean = false); overload;
class procedure DrawFitWText(ABitmap : TBitmap;
x1, x2 : integer;
y : integer;
@ -2276,16 +2277,20 @@ begin
end;
class procedure TGUITools.DrawText(ACanvas: TCanvas; x, y: integer;
const AText: string; TextColor: TColor; ClipRect: T2DIntRect);
const AText: string; TextColor: TColor; ClipRect: T2DIntRect;
Accel: Boolean = false);
var
WinAPIClipRect: TRect;
ts: TTextStyle;
begin
WinAPIClipRect := ClipRect.ForWinAPI;
with ACanvas do
begin
Brush.Style := bsClear;
Font.Color := TextColor;
TextRect(WinAPIClipRect, x, y, AText);
ts := TextStyle;
ts.ShowPrefix := Accel;
TextRect(WinAPIClipRect, x, y, AText, ts);
end;
end;

View File

@ -226,7 +226,7 @@ begin
wText := 0;
R.Right := ARect.Right - wText; // ClipRect
TGUITools.DrawText(ACanvas, x, y, menuItem.Caption, TextColor, R);
TGUITools.DrawText(ACanvas, x, y, menuItem.Caption, TextColor, R, true);
end;
end;
end;