Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions Source/SpTBXSkins.pas
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ interface

TSpTBXSkinPartsType = (sknpBody, sknpBorders, sknpText);

TSpTBXSkinPartsSet = set of TSpTBXSkinPartsType;

TSpTBXSkinComponentsIdentEntry = record
Name: string;
States: TSpTBXSkinStatesSet;
Expand Down Expand Up @@ -406,9 +408,10 @@ TSpTBXSkinManager = class
constructor Create; virtual;
destructor Destroy; override;

function GetSkinType(AControl: TControl): TSpTBXSkinType;
function GetSkinType(AControl: TControl = nil): TSpTBXSkinType;
procedure GetSkinsAndDelphiStyles(SkinsAndStyles: TStrings);
function IsDefaultSkin: Boolean;
function GetSkinPartsSet(AControl: TControl = nil): TSpTBXSkinPartsSet;

procedure AddSkinNotification(AObject: TObject);
procedure RemoveSkinNotification(AObject: TObject);
Expand Down Expand Up @@ -2505,11 +2508,11 @@ procedure SpDrawXPListItemBackground(AControl: TControl;ACanvas: TCanvas; ARect:
end;
end
else begin
if SkinManager.GetSkinType(AControl) = sknDelphiStyle then begin
if Selected then
ACanvas.Brush.Color := SpTBXStyleServices(AControl).GetSystemColor(clHighlight)
else
ACanvas.Brush.Color := SpTBXStyleServices(AControl).GetStyleColor(scListBox);
if (SkinManager.GetSkinType(AControl) = sknDelphiStyle) and (sknpBody in SkinManager.GetSkinPartsSet(AControl)) then begin
if Selected then
ACanvas.Brush.Color := SpTBXStyleServices(AControl).GetSystemColor(clHighlight)
else
ACanvas.Brush.Color := SpTBXStyleServices(AControl).GetStyleColor(scListBox);
end
else
if Selected then
Expand Down Expand Up @@ -3906,6 +3909,23 @@ function TSpTBXSkinManager.IsDefaultSkin: Boolean;
Result := CurrentSkinName = 'Default';
end;


function TSpTBXSkinManager.GetSkinPartsSet(AControl: TControl): TSpTBXSkinPartsSet;
begin
Result := [];
if Assigned(AControl) then
begin
{$IF CompilerVersion >= 34} // for 10.4 Sydney and up
if seFont in AControl.StyleElements then
Result := Result + [sknpText];
if seClient in AControl.StyleElements then
Result := Result + [sknpBody];
if seBorder in AControl.StyleElements then
Result := Result + [sknpBorders];
{$IFEND}
end;
end;

procedure TSpTBXSkinManager.SetSkin(SkinName: string);
var
K: TSpTBXSkinsListEntry;
Expand Down