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 implementation
uses uses
JvXPBar, JvXPContainer, JvXPButtons, JvXPCheckCtrls; JvXPCore, JvXPBar, JvXPContainer, JvXPButtons, JvXPCheckCtrls;
procedure Register; procedure Register;
begin begin
@ -21,7 +21,8 @@ begin
TJvXPContainer, TJvXPContainer,
TJvXPButton, TJvXPButton,
TJvXPToolButton, TJvXPToolButton,
TJvXPCheckbox TJvXPCheckbox,
TJvXPStyleManager
]); ]);
end; 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' +#138#248#9'x;'#255'j'#213#189#166#127#166'I'#183#254#181'|i5'#0#0#0#0'IEND'
+#174'B`'#130 +#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 PopupMenu;
property ShowHint; property ShowHint;
property Style; property Style;
// property StyleManager; property StyleManager;
property Visible; property Visible;
//property OnDockDrop; //property OnDockDrop;
//property OnDockOver; //property OnDockOver;
@ -255,7 +255,7 @@ type
property PopupMenu; property PopupMenu;
property ShowHint; property ShowHint;
property Style; property Style;
// property StyleManager; property StyleManager;
property Visible; property Visible;
//property OnDockDrop; //property OnDockDrop;
//property OnDockOver; //property OnDockOver;

View File

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

View File

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