Ignore:
Timestamp:
Apr 25, 2022, 6:22:53 PM (3 years ago)
Author:
chronos
Message:
  • Modified: Update Common package to version 0.10.
  • Modified: fgl unit replaced by Generics.Collections.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/UTheme.pas

    r420 r424  
    55uses
    66  Classes, SysUtils, Graphics, ComCtrls, Controls, ExtCtrls, Menus, StdCtrls,
    7   Spin, Forms, fgl, Grids;
     7  Spin, Forms, Generics.Collections, Grids;
    88
    99type
     
    1919  { TThemes }
    2020
    21   TThemes = class(TFPGObjectList<TTheme>)
     21  TThemes = class(TObjectList<TTheme>)
    2222    function AddNew(Name: string): TTheme;
    2323    function FindByName(Name: string): TTheme;
     
    4242  end;
    4343
     44const
     45  ThemeNameSystem = 'System';
     46  ThemeNameLight = 'Light';
     47  ThemeNameDark = 'Dark';
     48
    4449procedure Register;
     50
    4551
    4652implementation
     
    105111  inherited;
    106112  Themes := TThemes.Create;
    107   with Themes.AddNew('System') do begin
     113  with Themes.AddNew(ThemeNameSystem) do begin
    108114    ColorWindow := clWindow;
    109115    ColorWindowText := clWindowText;
     
    113119  end;
    114120  Theme := TTheme(Themes.First);
    115   with Themes.AddNew('Dark') do begin
     121  with Themes.AddNew(ThemeNameDark) do begin
    116122    ColorWindow := RGBToColor($20, $20, $20);
    117123    ColorWindowText := clWhite;
     
    120126    ColorControlSelected := RGBToColor(96, 125, 155);
    121127  end;
    122   with Themes.AddNew('Light') do begin
     128  with Themes.AddNew(ThemeNameLight) do begin
    123129    ColorWindow := clWhite;
    124130    ColorWindowText := clBlack;
     
    175181procedure TThemeManager.UseTheme(Form: TForm);
    176182begin
    177   if not Used and (FTheme.Name = 'System') then Exit;
     183  if not Used and (FTheme.Name = ThemeNameSystem) then Exit;
    178184  ApplyTheme(Form);
    179185  Used := True;
Note: See TracChangeset for help on using the changeset viewer.