Changeset 315 for trunk/Packages/Common/Theme.pas
- Timestamp:
- Jun 19, 2024, 11:15:44 PM (5 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Theme.pas
r314 r315 1 unit UTheme;1 unit Theme; 2 2 3 3 interface … … 5 5 uses 6 6 Classes, SysUtils, Graphics, ComCtrls, Controls, ExtCtrls, Menus, StdCtrls, 7 Spin, Forms, fgl, Grids;7 Spin, Forms, Generics.Collections, Grids; 8 8 9 9 type … … 19 19 { TThemes } 20 20 21 TThemes = class(T FPGObjectList<TTheme>)21 TThemes = class(TObjectList<TTheme>) 22 22 function AddNew(Name: string): TTheme; 23 23 function FindByName(Name: string): TTheme; … … 42 42 end; 43 43 44 const 45 ThemeNameSystem = 'System'; 46 ThemeNameLight = 'Light'; 47 ThemeNameDark = 'Dark'; 48 44 49 procedure Register; 50 45 51 46 52 implementation … … 105 111 inherited; 106 112 Themes := TThemes.Create; 107 with Themes.AddNew( 'System') do begin113 with Themes.AddNew(ThemeNameSystem) do begin 108 114 ColorWindow := clWindow; 109 115 ColorWindowText := clWindowText; … … 113 119 end; 114 120 Theme := TTheme(Themes.First); 115 with Themes.AddNew( 'Dark') do begin121 with Themes.AddNew(ThemeNameDark) do begin 116 122 ColorWindow := RGBToColor($20, $20, $20); 117 123 ColorWindowText := clWhite; … … 120 126 ColorControlSelected := RGBToColor(96, 125, 155); 121 127 end; 122 with Themes.AddNew( 'Light') do begin128 with Themes.AddNew(ThemeNameLight) do begin 123 129 ColorWindow := clWhite; 124 130 ColorWindowText := clBlack; … … 175 181 procedure TThemeManager.UseTheme(Form: TForm); 176 182 begin 177 if not Used and (FTheme.Name = 'System') then Exit;183 if not Used and (FTheme.Name = ThemeNameSystem) then Exit; 178 184 ApplyTheme(Form); 179 185 Used := True; 180 186 end; 181 187 182 183 188 end.
Note:
See TracChangeset
for help on using the changeset viewer.