jvcllaz: Add TXPStyleManager

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5411 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-12-04 20:09:30 +00:00
parent 2e4d2bcbf6
commit 82fa654c7a
5 changed files with 58 additions and 34 deletions

View File

@ -12,7 +12,7 @@ procedure Register;
implementation
uses
JvXPBar, JvXPContainer, JvXPButtons, JvXPCheckCtrls;
JvXPCore, JvXPBar, JvXPContainer, JvXPButtons, JvXPCheckCtrls;
procedure Register;
begin
@ -21,7 +21,8 @@ begin
TJvXPContainer,
TJvXPButton,
TJvXPToolButton,
TJvXPCheckbox
TJvXPCheckbox,
TJvXPStyleManager
]);
end;

View File

@ -84,3 +84,23 @@ LazarusResources.Add('TJvXpCheckbox','PNG',[
+#138#248#9'x;'#255'j'#213#189#166#127#166'I'#183#254#181'|i5'#0#0#0#0'IEND'
+#174'B`'#130
]);
LazarusResources.Add('TJvXPStyleManager','PNG',[
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
+#0#0#9'pHYs'#0#0#11#19#0#0#11#19#1#0#154#156#24#0#0#1'nIDATH'#137#173'U;v'
+#195' '#16#156#205#211#21#146#214#212#206'!'#196'%'#236#218'7'#17#186#142'}'
+#9't'#9#213'['#199'}'#218'Ma'#144#0#1'"'#182#231'='#158#216#5'vv'#150#143#136
+'-'#4#30#10'o'#1#7#253#14#0#148'~!'#24'''v2'#222#249#142#136#224#191' '#162
+'jp'#0#248#136#202'r'#159'''"Bk'#3#0#165#214#150'C'#151's'#190'C'#205#170#160
+#132''''#212'h'#181#182#170#130#16#175#170#217'%'#0#0#220#231#169'9'#250'|'
+#179#0#6'o'#150'K'#148'_'#152#253#210#215'w'#191#216#9#218#9#142''''#157#251
+#146'6C'#228#127#154#160#148'y:'#158#160'm'#15#0#224'x'#210'.`/?'#167'i'#201
+#28#128'X3'#182')(d'#145#142#133#153'/'#193'3k'#25#129#2'w'#180#134'tR'#168
+'@,'#198'b'#230#137#2#14#21'0'#175#173#168'f'#190#217#7#137#25#179#153#23#212
+#19'3'#162#155#148#190')"'#178#189#7#142#12#0#232#243#216#163#130#205'&3'#175
+#242#150'+'#159#203#206#251#250#161#7#141#231'v'#130#196#222#221#27#217#14
+#137#152'+'#145'9o'#8#210#224'6ud'#160'w'#198#31#127'4U'#159'd9~!='#177'V'#0
+'v'#222#194#14'p'''#162#130#9#143#163#25#6#182#236#136#221#156#176','#17#1#3
+'8'#20'n'#225#130'_'#147'usu'#145'#'#0#226#155#153'CT'#18'g3'#128#139#194'R"'
+'"s'#22'1W'#223#247'k'#137'a'#133'Y7'#228#178#130#131#254#229' '#168#29#211
+'?='#214#180'M'#214'b'#159#182#0#0#0#0'IEND'#174'B`'#130
]);

View File

@ -159,7 +159,7 @@ type
property PopupMenu;
property ShowHint;
property Style;
// property StyleManager;
property StyleManager;
property Visible;
//property OnDockDrop;
//property OnDockOver;
@ -255,7 +255,7 @@ type
property PopupMenu;
property ShowHint;
property Style;
// property StyleManager;
property StyleManager;
property Visible;
//property OnDockDrop;
//property OnDockOver;

View File

@ -113,8 +113,8 @@ type
property ParentShowHint;
property PopupMenu;
property ShowHint;
// property Style;
// property StyleManager;
property Style;
property StyleManager;
property Visible;
//property OnDockDrop;
//property OnDockOver;

View File

@ -133,8 +133,8 @@ type
{ baseclass for focusable control descendants. }
// TJvXPCustomControl = class(TCustomControl) //(TJvCustomControl)
TJvXPCustomControl = class(TJvCustomControl)
TJvXPCustomControl = class(TCustomControl) //(TJvCustomControl)
// TJvXPCustomControl = class(TJvCustomControl)
private
FClicking: Boolean;
FDrawState: TJvXPDrawState;
@ -253,20 +253,19 @@ type
TJvXPStyle = class(TPersistent)
private
FTheme: TJvXPTheme;
//FUseStyleManager: Boolean;
FUseStyleManager: Boolean;
protected
Parent: TJvXPCustomStyleControl;
procedure SetTheme(Value: TJvXPTheme); virtual;
//procedure SetUseStyleManager(Value: Boolean); virtual;
procedure SetUseStyleManager(Value: Boolean); virtual;
public
constructor Create(AOwner: TComponent);
function GetTheme: TJvXPTheme;
published
property Theme: TJvXPTheme read FTheme write SetTheme default WindowsXP;
//property UseStyleManager: Boolean read FUseStyleManager write SetUseStyleManager default True;
property UseStyleManager: Boolean read FUseStyleManager write SetUseStyleManager default True;
end;
(******************** NOT CONVERTED
TJvXPStyleManager = class(TJvXPCustomComponent)
private
FControls: TList;
@ -274,6 +273,7 @@ type
FOnThemeChanged: TNotifyEvent;
procedure InvalidateControls;
protected
procedure FreeNotifyControls;
procedure SetTheme(Value: TJvXPTheme); virtual;
public
constructor Create(AOwner: TComponent); override;
@ -284,17 +284,16 @@ type
property Theme: TJvXPTheme read FTheme write SetTheme default WindowsXP;
property OnThemeChanged: TNotifyEvent read FOnThemeChanged write FOnThemeChanged;
end;
******************** NOT CONVERTED *)
TJvXPCustomStyleControl = class(TJvXPCustomControl)
private
FStyle: TJvXPStyle;
//FStyleManager: TJvXPStyleManager;
FStyleManager: TJvXPStyleManager;
protected
//procedure SetStyleManager(Value: TJvXPStyleManager); virtual;
//procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetStyleManager(Value: TJvXPStyleManager); virtual;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
property Style: TJvXPStyle read FStyle write FStyle;
//property StyleManager: TJvXPStyleManager read FStyleManager write SetStyleManager;
property StyleManager: TJvXPStyleManager read FStyleManager write SetStyleManager;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
@ -675,7 +674,7 @@ begin
inherited Create;
Parent := TJvXPCustomStyleControl(AOwner);
FTheme := WindowsXP;
//FUseStyleManager := True;
FUseStyleManager := True;
end;
procedure TJvXPStyle.SetTheme(Value: TJvXPTheme);
@ -690,13 +689,10 @@ end;
function TJvXPStyle.GetTheme: TJvXPTheme;
begin
Result := FTheme;
{
if FUseStyleManager and Assigned(Parent.StyleManager) then
Result := Parent.StyleManager.Theme;
}
end;
{
procedure TJvXPStyle.SetUseStyleManager(Value: Boolean);
begin
if Value <> FUseStyleManager then
@ -705,9 +701,7 @@ begin
Parent.InternalRedraw;
end;
end;
}
(******************** NOT CONVERTED
//=== { TJvXPStyleManager } ==================================================
@ -721,17 +715,26 @@ end;
destructor TJvXPStyleManager.Destroy;
begin
InvalidateControls;
FreeNotifyControls;
FControls.Free;
inherited Destroy;
end;
procedure TJvXPStyleManager.FreeNotifyControls;
var
J: Integer;
begin
for J := 0 to FControls.Count - 1 do
TJvXPCustomControl(FControls[J]).Notification(self, opRemove);
end;
procedure TJvXPStyleManager.InvalidateControls;
var
I: Integer;
begin
for I := 0 to FControls.Count - 1 do
with TJvXPCustomControl(FControls[I]) do
InternalRedraw;
with TJvXPCustomControl(FControls[I]) do
InternalRedraw;
end;
procedure TJvXPStyleManager.SetTheme(Value: TJvXPTheme);
@ -756,13 +759,15 @@ end;
procedure TJvXPStyleManager.UnregisterControls(const AControls: array of TJvXPCustomControl);
var
I: Integer;
I, J: Integer;
begin
for I := Low(AControls) to High(AControls) do
if FControls.IndexOf(AControls[I]) <> -1 then
FControls.Delete(FControls.IndexOf(AControls[I]));
begin
J := FControls.IndexOf(AControls[I]);
if J <> -1 then
FControls.Delete(J);
end;
end;
******************** NOT CONVERTED *)
//=== { TJvXPCustomStyleControl } ============================================
@ -771,19 +776,17 @@ constructor TJvXPCustomStyleControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FStyle := TJvXPStyle.Create(Self);
//FStyleManager := nil;
FStyleManager := nil;
end;
destructor TJvXPCustomStyleControl.Destroy;
begin
{
if FStyleManager <> nil then
FStyleManager.UnregisterControls([Self]);
}
FStyle.Free;
inherited Destroy;
end;
{
procedure TJvXPCustomStyleControl.Notification(AComponent: TComponent;
Operation: TOperation);
begin
@ -803,7 +806,7 @@ begin
FStyleManager := Value;
InternalRedraw;
end;
end; }
end;
(******************** NOT CONVERTED