Changeset 76 for trunk/UMenu.pas


Ignore:
Timestamp:
May 18, 2021, 10:25:20 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Colors inversion of used images if dark mode active.
  • Fixed: Back button arrow drawn as image instead of font. Left arrow was not supported under Ubuntu.
  • Modified: Allow to start new track from already connected station.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UMenu.pas

    r68 r76  
    2525    procedure Paint(Canvas: TCanvas; P: TPoint); virtual;
    2626    function GetOutputText: string; virtual;
    27     constructor Create;
     27    constructor Create; virtual;
    2828  end;
    2929
     
    4747    Index: Integer;
    4848    States: TStringList;
    49     constructor Create;
     49    constructor Create; override;
    5050    destructor Destroy; override;
    5151    procedure Paint(Canvas: TCanvas; P: TPoint); override;
     
    6262    procedure Paint(Canvas: TCanvas; P: TPoint); override;
    6363    property OnClick: TNotifyEvent read FOnClick write FOnClick;
     64  end;
     65
     66  { TMenuItemImage }
     67
     68  TMenuItemImage = class(TMenuItem)
     69  private
     70    FOnClick: TNotifyEvent;
     71  public
     72    Bitmap: TBitmap;
     73    procedure Paint(Canvas: TCanvas; P: TPoint); override;
     74    property OnClick: TNotifyEvent read FOnClick write FOnClick;
     75    constructor Create; override;
     76    destructor Destroy; override;
    6477  end;
    6578
     
    105118implementation
    106119
     120{ TMenuItemImage }
     121
     122procedure TMenuItemImage.Paint(Canvas: TCanvas; P: TPoint);
     123begin
     124  if Selected then Canvas.Brush.Color := BackgroundSelectedColor
     125    else Canvas.Brush.Color := BackgroundColor;
     126  if Canvas.Brush.Color = clNone then Canvas.Brush.Style := bsClear
     127    else Canvas.Brush.Style := bsSolid;
     128  Canvas.StretchDraw(Bounds, Bitmap);
     129end;
     130
     131constructor TMenuItemImage.Create;
     132begin
     133  inherited;
     134  Bitmap := TBitmap.Create;
     135end;
     136
     137destructor TMenuItemImage.Destroy;
     138begin
     139  FreeAndNil(Bitmap);
     140  inherited;
     141end;
     142
    107143{ TMenuItemButton }
    108144
     
    155191constructor TMenuItemComboBox.Create;
    156192begin
     193  inherited;
    157194  States := TStringList.Create;
    158195end;
     
    160197destructor TMenuItemComboBox.Destroy;
    161198begin
    162   States.Free;
     199  FreeAndNil(States);
    163200  inherited;
    164201end;
Note: See TracChangeset for help on using the changeset viewer.