Skip to content

Commit 33818f5

Browse files
committed
Updated Vcl Styles Utils files.
1 parent 394183b commit 33818f5

18 files changed

+6576
-2049
lines changed
119 KB
Binary file not shown.
Binary file not shown.

delphi-ide-theme-editor/Common/Vcl Styles Utils/Vcl.Styles.Ext.pas

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// Unit Vcl.Styles.Ext
44
// unit for the VCL Styles Utils
5-
// http://code.google.com/p/vcl-styles-utils/
5+
// https://github.com/RRUZ/vcl-styles-utils/
66
//
77
// The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
88
// you may not use this file except in compliance with the License. You may obtain a copy of the
@@ -15,7 +15,7 @@
1515
// The Original Code is Vcl.Styles.Ext.pas.
1616
//
1717
// The Initial Developer of the Original Code is Rodrigo Ruz V.
18-
// Portions created by Rodrigo Ruz V. are Copyright (C) 2012-2014 Rodrigo Ruz V.
18+
// Portions created by Rodrigo Ruz V. are Copyright (C) 2012-2015 Rodrigo Ruz V.
1919
// All Rights Reserved.
2020
//
2121
//**************************************************************************************************
@@ -123,12 +123,13 @@ TSourceInfo = record
123123
/// <summary>Force to reload a modified vcl style
124124
/// </summary>
125125
{$ENDREGION}
126-
class procedure ReloadStyle(const Name: string);
126+
class procedure ReloadStyle(const StyleName : string);
127127
{$REGION 'Documentation'}
128128
/// <summary>remove a vcl style
129129
/// </summary>
130130
{$ENDREGION}
131-
class procedure RemoveStyle(const Name: string);
131+
class procedure RemoveStyle(const StyleName : string);
132+
class function StyleLoaded(const StyleName : string) : Boolean;
132133
end;
133134

134135
const
@@ -382,54 +383,60 @@ class procedure TStyleManagerHelper.RefreshCurrentTheme;
382383
end;
383384

384385

385-
class procedure TStyleManagerHelper.ReloadStyle(const Name: string);
386+
class procedure TStyleManagerHelper.ReloadStyle(const StyleName : string);
386387
var
387388
LStyle: TCustomStyleServices;
388389
t : TPair<string, TStyleManager.TSourceInfo>;
389390
begin
390391

391-
if SameText(Name, ActiveStyle.Name, loUserLocale) then
392+
if SameText(StyleName, ActiveStyle.Name, loUserLocale) then
392393
SetStyle(SystemStyle);
393394

394395
for LStyle in Styles do
395-
if SameText(Name, LStyle.Name, loUserLocale) then
396+
if SameText(StyleName, LStyle.Name, loUserLocale) then
396397
begin
397398
LStyle.Free;
398399
Styles.Remove(LStyle);
399400
end;
400401

401402
for t in Self.FRegisteredStyles do
402-
if SameText(Name, t.Key, loUserLocale) then
403+
if SameText(StyleName, t.Key, loUserLocale) then
403404
if (t.Value.Data<>nil) then
404405
begin
405406
TStream(t.Value.Data).Position:=0;
406407
break;
407408
end;
408409

409-
SetStyle(Name);
410+
SetStyle(StyleName);
410411
end;
411412

412-
class procedure TStyleManagerHelper.RemoveStyle(const Name: string);
413+
class procedure TStyleManagerHelper.RemoveStyle(const StyleName: string);
413414
var
414415
LStyle: TCustomStyleServices;
415416
t : TPair<string, TStyleManager.TSourceInfo>;
416417
begin
417-
if SameText(Name, ActiveStyle.Name, loUserLocale) then
418+
if SameText(StyleName, ActiveStyle.Name, loUserLocale) then
418419
SetStyle(SystemStyle);
419420

420421
for LStyle in Styles do
421-
if SameText(Name, LStyle.Name, loUserLocale) then
422+
if SameText(StyleName, LStyle.Name, loUserLocale) then
422423
begin
423424
LStyle.Free;
424425
Styles.Remove(LStyle);
425426
end;
426427

427428
for t in Self.FRegisteredStyles do
428-
if SameText(Name, t.Key, loUserLocale) then
429+
if SameText(StyleName, t.Key, loUserLocale) then
429430
Self.FRegisteredStyles.Remove(t.Key);
430431

431432
end;
432433

434+
class function TStyleManagerHelper.StyleLoaded(
435+
const StyleName: string): Boolean;
436+
begin
437+
Result := TStyleManager.Style[StyleName] <> nil;
438+
end;
439+
433440
class function TStyleManagerHelper._GetStyles: TList<TCustomStyleServices>;
434441
begin
435442
Result:=TStyleManager.GetStyles;

delphi-ide-theme-editor/Common/Vcl Styles Utils/Vcl.Styles.Fixes.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// Unit Vcl.Styles.Fixes
44
// unit for the VCL Styles Utils
5-
// http://code.google.com/p/vcl-styles-utils/
5+
// https://github.com/RRUZ/vcl-styles-utils/
66
//
77
// The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
88
// you may not use this file except in compliance with the License. You may obtain a copy of the

delphi-ide-theme-editor/Common/Vcl Styles Utils/Vcl.Styles.FormStyleHooks.pas

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// Unit Vcl.Styles.FormStyleHooks
44
// unit for the VCL Styles Utils
5-
// http://code.google.com/p/vcl-styles-utils/
5+
// https://github.com/RRUZ/vcl-styles-utils/
66
//
77
// The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License");
88
// you may not use this file except in compliance with the License. You may obtain a copy of the
@@ -15,7 +15,7 @@
1515
// The Original Code is Vcl.Styles.FormStyleHooks.pas.
1616
//
1717
// The Initial Developer of the Original Code is Rodrigo Ruz V.
18-
// Portions created by Rodrigo Ruz V. are Copyright (C) 2012-2014 Rodrigo Ruz V.
18+
// Portions created by Rodrigo Ruz V. are Copyright (C) 2012-2015 Rodrigo Ruz V.
1919
// All Rights Reserved.
2020
//
2121
//**************************************************************************************************
@@ -134,6 +134,7 @@ TFormStyleHookHelper = class helper for TFormStyleHook
134134
procedure SetFChangeSizeCalled(const Value: Boolean);
135135
function GetFRegion: HRGN;
136136
procedure SetFRegion(const Value: HRGN);
137+
function GetForm: TCustomForm;
137138
public
138139
property _FCloseButtonRect : TRect read GetFCloseButtonRect Write SetFCloseButtonRect;
139140
property _FMaxButtonRect : TRect read GetFMaxButtonRect Write SetFMaxButtonRect;
@@ -151,11 +152,15 @@ TFormStyleHookHelper = class helper for TFormStyleHook
151152
property _FPressedButton: Integer read GetFPressedButton;
152153
property _FHotButton: Integer read GetFHotButton;
153154
property _FRegion: HRGN read GetFRegion write SetFRegion;
155+
property _Form : TCustomForm read GetForm;
154156
procedure MainMenuBarHookPaint(Canvas: TCanvas);
155157
function _GetIconFast: TIcon;
156158
procedure _ChangeSize;
157159
function _NormalizePoint(P: TPoint): TPoint;
158160
function _GetHitTest(P: TPoint): Integer;
161+
function _GetBorderSizeAddr : Pointer;
162+
function _GetRegionAddr : Pointer;
163+
159164
end;
160165

161166
function RectVCenter(var R: TRect; Bounds: TRect): TRect;
@@ -1291,6 +1296,11 @@ function TFormStyleHookHelper.GetFMinButtonRect: TRect;
12911296
result:=Self.FMinButtonRect;
12921297
end;
12931298

1299+
function TFormStyleHookHelper.GetForm: TCustomForm;
1300+
begin
1301+
Result:=Self.Form;
1302+
end;
1303+
12941304
function TFormStyleHookHelper.GetFPressedButton: Integer;
12951305
begin
12961306
Result:=Self.FPressedButton;
@@ -1392,6 +1402,15 @@ function TFormStyleHookHelper._GetBorderSize: TRect;
13921402
Result:=Self.GetBorderSize;
13931403
end;
13941404

1405+
function TFormStyleHookHelper._GetBorderSizeAddr: Pointer;
1406+
var
1407+
MethodAddr: function : TRect of object;
1408+
begin
1409+
MethodAddr := Self.GetBorderSize;
1410+
Result := TMethod(MethodAddr).Code;
1411+
end;
1412+
1413+
13951414
function TFormStyleHookHelper._GetHitTest(P: TPoint): Integer;
13961415
begin
13971416
result:= Self.GetHitTest(P);
@@ -1402,6 +1421,15 @@ function TFormStyleHookHelper._GetIconFast: TIcon;
14021421
Result:=Self.GetIconFast;
14031422
end;
14041423

1424+
function TFormStyleHookHelper._GetRegionAddr: Pointer;
1425+
var
1426+
MethodAddr: function : HRgn of object;
1427+
begin
1428+
MethodAddr := Self.GetRegion;
1429+
Result := TMethod(MethodAddr).Code;
1430+
end;
1431+
1432+
14051433
function TFormStyleHookHelper._NormalizePoint(P: TPoint): TPoint;
14061434
begin
14071435
Result:=Self.NormalizePoint(P);

0 commit comments

Comments
 (0)