211 lines
8.2 KiB
Plaintext
211 lines
8.2 KiB
Plaintext
(* ImageEn Build 7.0.0.06.2637 @ 7-4-17 14:58:42.679 *)
|
|
(*
|
|
Copyright (c) 1998-2017 by Carlotta Calandra. All rights reserved.
|
|
Copyright (c) 2011-2017 by Xequte Software.
|
|
|
|
This software comes without express or implied warranty.
|
|
In no case shall the author be liable for any damage or unwanted behavior of any
|
|
computer hardware and/or software.
|
|
|
|
Author grants you the right to include the component
|
|
in your application, whether COMMERCIAL, SHAREWARE, or FREEWARE.
|
|
|
|
ImageEn, IEvolution and ImageEn ActiveX may not be included in any
|
|
commercial, shareware or freeware libraries or components.
|
|
|
|
www.ImageEn.com
|
|
*)
|
|
|
|
(*
|
|
File version 1002
|
|
*)
|
|
|
|
unit iexThemes;
|
|
|
|
{$R-}
|
|
{$Q-}
|
|
|
|
{$I ie.inc}
|
|
|
|
{$IFDEF Delphi6orNewer} {$WARN SYMBOL_DEPRECATED OFF} {$ENDIF}
|
|
|
|
interface
|
|
|
|
uses
|
|
{$IFDEF IEHASSTYLESERVICES}
|
|
Vcl.Forms, Winapi.Messages, Vcl.Controls, Winapi.Windows,
|
|
{$ENDIF}
|
|
{$IFDEF IEHASTHEMING}
|
|
Themes,
|
|
{$ENDIF}
|
|
Graphics;
|
|
|
|
type
|
|
|
|
{$IFDEF IEHASSTYLESERVICES}
|
|
TImageEnStyleHook = class(TScrollingStyleHook)
|
|
strict private
|
|
procedure UpdateColors;
|
|
strict protected
|
|
procedure WndProc(var Message: TMessage); override;
|
|
public
|
|
constructor Create(AControl: TWinControl); override;
|
|
end;
|
|
{$ENDIF}
|
|
|
|
TIEThemePart = ( ietpControlBackground, // Background of TIEView
|
|
ietpControlBackgroundDisabled, // Background of TIEView when Enabled = False
|
|
ietpControlBackgroundGradientEnd, // Ending gradient of TIEView background
|
|
ietpControlBorder, // Border of TIEView
|
|
ietpThumbCellBackground, // Background of cells in TIEImageEnMView
|
|
ietpThumbCellBackgroundSelected, // Background of selected cells in TIEImageEnMView
|
|
ietpThumbCellBackgroundDisabledSelected, // Background of selected cells in TIEImageEnMView when Enabled = False
|
|
ietpThumbCellBorder, // Border of cells in TIEImageEnMView
|
|
ietpThumbCellBorderSelected, // Border of selected cells in TIEImageEnMView
|
|
ietpThumbCellBorderDisabled, // Border of cells in TIEImageEnMView when Enabled = False
|
|
ietpThumbCellFont, // Font of cells in TIEImageEnMView
|
|
ietpThumbCellFontSelected, // Font of selected cells in TIEImageEnMView
|
|
ietpThumbCellFontDisabled, // Font of cells in TIEImageEnMView when Enabled = False
|
|
ietpRuler, // Background "measure area" of rulers of TImageEnView
|
|
ietpRulerBackground, // Background "non-measure area" of rulers of TImageEnView
|
|
ietpRulerText, // Font of ruler of TImageEnView
|
|
ietpRulerBorder, // Border of ruler of TImageEnView
|
|
ietpRulerGripFill, // Fill color of grips of TImageEnView rulers
|
|
ietpRulerGripBorder, // Border of grips of TImageEnView rulers
|
|
ietpPanel ); // Themed panel color
|
|
|
|
|
|
function GetThemeColor(Part: TIEThemePart; DefaultColor: TColor; ForceThemed: Boolean = False): TColor;
|
|
|
|
{$IFDEF IEHASTHEMING}
|
|
function IEStyleServices: {$IFDEF IEHASSTYLESERVICES} TCustomStyleServices; {$ELSE} TThemeServices; {$ENDIF}
|
|
function IEStyleServices_Enabled: Boolean;
|
|
{$ENDIF}
|
|
const
|
|
clExplorer_Selection_Background_Color = $00FCEADA;
|
|
clExplorer_Selection_Border_Color = $00CEA27D;
|
|
|
|
implementation
|
|
|
|
uses
|
|
ieview, iemview, iesettings, hyiedefs;
|
|
|
|
|
|
// Returns a themed color if IEGlobalSettings().EnableTheming is enabled, else DefaultColor
|
|
// But only if Default color is a system color: clBtnFace, clWindow, clWindowText, clGrayText, clHighlight, cl3DLight, clBtnShadow, clWindowFrame, etc.
|
|
// ForceThemed: Themed color is returned even if EnableTheming is disabled
|
|
function GetThemeColor(Part: TIEThemePart; DefaultColor: TColor; ForceThemed: Boolean = False): TColor;
|
|
{}
|
|
{$IFDEF IEHASSTYLESERVICES}
|
|
function _GetGridColor(Grid: TThemedGrid; Element: TElementColor): TColor;
|
|
var
|
|
Details : TThemedElementDetails;
|
|
begin
|
|
Details := IEStyleServices.GetElementDetails( Grid );
|
|
IEStyleServices.GetElementColor( Details, Element, Result );
|
|
end;
|
|
{$ENDIF}
|
|
{}
|
|
{$IFDEF IEHASSTYLESERVICES}
|
|
var
|
|
useThemeColor: Boolean;
|
|
{$ENDIF}
|
|
begin
|
|
result := DefaultColor;
|
|
{$IFDEF IEHASSTYLESERVICES}
|
|
useThemeColor := False;
|
|
if IEStyleServices_Enabled and ( ForceThemed or IEGlobalSettings().EnableTheming ) then
|
|
useThemeColor := ( DefaultColor = clWindow ) or
|
|
( DefaultColor = clWindowText ) or
|
|
( DefaultColor = clNone_ ) or
|
|
( DefaultColor = clBtnFace ) or
|
|
( DefaultColor = clHighlight ) or
|
|
( DefaultColor = clHighlightText ) or
|
|
( DefaultColor = cl3DLight ) or
|
|
( DefaultColor = clGrayText ) or
|
|
( DefaultColor = clBtnShadow ) or
|
|
( DefaultColor = clWindowFrame ) or
|
|
( DefaultColor = clExplorer_Selection_Background_Color ) or
|
|
( DefaultColor = clExplorer_Selection_Border_Color );
|
|
|
|
if useThemeColor then
|
|
case Part of
|
|
ietpControlBackground : Result := IEStyleServices.GetStyleColor( scEdit );
|
|
ietpControlBackgroundDisabled : Result := IEStyleServices.GetStyleColor( scEditDisabled );
|
|
ietpControlBackgroundGradientEnd : Result := IEStyleServices.GetStyleColor( scGenericGradientBase );
|
|
ietpRulerBorder,
|
|
ietpControlBorder : Result := IEStyleServices.GetStyleColor( scBorder );
|
|
ietpThumbCellBackground : Result := _GetGridColor( tgClassicCellNormal, ecFillColor );
|
|
ietpThumbCellBackgroundSelected : Result := _GetGridColor( tgClassicCellSelected, ecFillColor );
|
|
ietpThumbCellBorderDisabled,
|
|
ietpThumbCellBackgroundDisabledSelected : Result := IEStyleServices.GetStyleColor( scPanelDisabled );
|
|
ietpThumbCellBorder,
|
|
ietpThumbCellBorderSelected : Result := _GetGridColor( tgClassicCellNormal, ecBorderColor );
|
|
ietpThumbCellFont : Result := _GetGridColor( tgClassicCellNormal, ecTextColor );
|
|
ietpThumbCellFontSelected : Result := _GetGridColor( tgClassicCellSelected, ecTextColor );
|
|
ietpThumbCellFontDisabled : Result := IEStyleServices.GetSystemColor( clGrayText );
|
|
ietpRuler : Result := IEStyleServices.GetStyleColor( scToolBarGradientEnd );
|
|
ietpRulerBackground : Result := IEStyleServices.GetStyleColor( scToolBarGradientBase );
|
|
ietpRulerGripBorder,
|
|
ietpRulerText : Result := IEStyleServices.GetSystemColor( clWindowText );
|
|
ietpRulerGripFill : Result := IEStyleServices.GetStyleColor( scButtonNormal );
|
|
ietpPanel : Result := IEStyleServices.GetStyleColor( scPanel );
|
|
end;
|
|
|
|
if result = clNone_ then
|
|
result := DefaultColor;
|
|
{$ENDIF}
|
|
end;
|
|
|
|
|
|
|
|
{$IFDEF IEHASTHEMING}
|
|
function IEStyleServices: {$IFDEF DelphiXE2orNewer} TCustomStyleServices; {$ELSE} TThemeServices; {$ENDIF}
|
|
begin
|
|
{$IFDEF IEHASSTYLESERVICES}
|
|
Result := StyleServices;
|
|
{$ELSE}
|
|
Result := ThemeServices;
|
|
{$ENDIF}
|
|
end;
|
|
{$ENDIF}
|
|
|
|
{$IFDEF IEHASTHEMING}
|
|
function IEStyleServices_Enabled: Boolean;
|
|
begin
|
|
{$IFDEF IEHASSTYLESERVICES}
|
|
Result := StyleServices.Enabled;
|
|
{$ELSE}
|
|
Result := ThemeServices.ThemesEnabled;
|
|
{$ENDIF}
|
|
end;
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
{$IFDEF IEHASSTYLESERVICES}
|
|
{ TImageEnStyleHook }
|
|
|
|
constructor TImageEnStyleHook.Create(AControl: TWinControl);
|
|
begin
|
|
inherited;
|
|
OverridePaintNC := True;
|
|
OverrideEraseBkgnd := True;
|
|
UpdateColors;
|
|
end;
|
|
|
|
procedure TImageEnStyleHook.UpdateColors;
|
|
begin
|
|
{ // }
|
|
end;
|
|
|
|
procedure TImageEnStyleHook.WndProc(var Message: TMessage);
|
|
begin
|
|
// Reserved for potential updates
|
|
inherited;
|
|
end;
|
|
{$ENDIF}
|
|
|
|
end.
|
|
|