Ignore:
Timestamp:
Jun 19, 2024, 11:15:44 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Updated Common package.
File:
1 moved

Legend:

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

    r314 r315  
    1 unit UTheme;
     1unit Theme;
    22
    33interface
     
    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;
    180186end;
    181187
    182 
    183188end.
Note: See TracChangeset for help on using the changeset viewer.