Ignore:
Timestamp:
May 13, 2024, 6:00:06 PM (2 years ago)
Author:
chronos
Message:
  • Fixed: Custom draw ListBox items to keep consistent style on Linux.
  • Fixed: Last game name index error if no saved games.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/DpiControls/Dpi.Graphics.pas

    r560 r568  
    88const
    99  clBlack = TColor($000000);
     10  clWhite = TColor($ffffff);
    1011
    1112type
     
    9293
    9394  TBrushStyle = Graphics.TBrushStyle;
     95  TPenStyle = Graphics.TPenStyle;
    9496
    9597  { TBrush }
     
    131133    function GetHandle: HDC;
    132134    function GetPixel(X, Y: Integer): TColor;
     135    function GetTextStyle: TTextStyle;
    133136    procedure SetBrush(AValue: TBrush);
    134137    procedure SetFont(AValue: TFont);
     
    137140    procedure SetPixel(X, Y: Integer; AValue: TColor);
    138141    procedure SetNativeCanvas(AValue: Graphics.TCanvas);
     142    procedure SetTextStyle(AValue: TTextStyle);
    139143  protected
    140144    procedure DoLine(X1, Y1, X2, Y2: Integer); virtual;
     
    182186    function TextExtent(const Text: string): TSize; virtual;
    183187    procedure TextOut(X, Y: Integer; const Text: string); virtual;
    184     procedure TextRect(ARect: TRect; X, Y: Integer; Text: string);
     188    procedure TextRect(ARect: TRect; X, Y: Integer; Text: string); overload;
     189    procedure TextRect(ARect: TRect; X, Y: integer; const Text: string;
     190      const Style: TTextStyle); overload;
    185191    procedure MoveTo(X, Y: Integer);
    186192    procedure LineTo(X, Y: Integer);
     
    196202    property Width: Integer read GetWidth;
    197203    property Height: Integer read GetHeight;
     204    property TextStyle: TTextStyle read GetTextStyle write SetTextStyle;
    198205  published
    199206    property Brush: TBrush read FBrush write SetBrush;
     
    966973end;
    967974
     975function TCanvas.GetTextStyle: TTextStyle;
     976begin
     977  Result := GetNativeCanvas.TextStyle;
     978end;
     979
    968980function TCanvas.GetWidth: Integer;
    969981begin
     
    10391051end;
    10401052
     1053procedure TCanvas.SetTextStyle(AValue: TTextStyle);
     1054begin
     1055  GetNativeCanvas.TextStyle := AValue;
     1056end;
     1057
    10411058procedure TCanvas.DoLine(X1, Y1, X2, Y2: Integer);
    10421059begin
     
    12131230procedure TCanvas.TextRect(ARect: TRect; X, Y: Integer; Text: string);
    12141231begin
    1215   GetNativeCanvas.TextRect(ScaleRectToNative(ARect), ScaleToNative(X), ScaleToNative(Y), Text);
     1232  GetNativeCanvas.TextRect(ScaleRectToNative(ARect), ScaleToNative(X),
     1233    ScaleToNative(Y), Text);
     1234end;
     1235
     1236procedure TCanvas.TextRect(ARect: TRect; X, Y: integer; const Text: string;
     1237  const Style: TTextStyle);
     1238begin
     1239  GetNativeCanvas.TextRect(ScaleRectToNative(ARect), ScaleToNative(X),
     1240    ScaleToNative(Y), Text, TextStyle);
    12161241end;
    12171242
Note: See TracChangeset for help on using the changeset viewer.