|
@@ -14,6 +14,7 @@ type
|
|
|
|
|
|
|
|
TColorState = class(TPersistent)
|
|
TColorState = class(TPersistent)
|
|
|
private
|
|
private
|
|
|
|
|
+ FOwner: TControl;
|
|
|
FBorderColor: TColor;
|
|
FBorderColor: TColor;
|
|
|
FBorderWidth: integer;
|
|
FBorderWidth: integer;
|
|
|
FColor: TColor;
|
|
FColor: TColor;
|
|
@@ -21,7 +22,7 @@ type
|
|
|
procedure SetFBorderWidth(AValue: integer);
|
|
procedure SetFBorderWidth(AValue: integer);
|
|
|
procedure SetFColor(AValue: TColor);
|
|
procedure SetFColor(AValue: TColor);
|
|
|
public
|
|
public
|
|
|
- constructor Create;
|
|
|
|
|
|
|
+ constructor Create(AOwner: TControl);
|
|
|
published
|
|
published
|
|
|
property Color: TColor read FColor write SetFColor;
|
|
property Color: TColor read FColor write SetFColor;
|
|
|
property BorderColor: TColor read FBorderColor write SetFBorderColor;
|
|
property BorderColor: TColor read FBorderColor write SetFBorderColor;
|
|
@@ -142,10 +143,10 @@ end;
|
|
|
constructor TColorSpeedButton.Create(TheOwner: TComponent);
|
|
constructor TColorSpeedButton.Create(TheOwner: TComponent);
|
|
|
begin
|
|
begin
|
|
|
inherited Create(TheOwner);
|
|
inherited Create(TheOwner);
|
|
|
- FStateNormal := TColorState.Create;
|
|
|
|
|
- FStateHover := TColorState.Create;
|
|
|
|
|
- FStateActive := TColorState.Create;
|
|
|
|
|
- FStateDisabled := TColorState.Create;
|
|
|
|
|
|
|
+ FStateNormal := TColorState.Create(Self);
|
|
|
|
|
+ FStateHover := TColorState.Create(Self);
|
|
|
|
|
+ FStateActive := TColorState.Create(Self);
|
|
|
|
|
+ FStateDisabled := TColorState.Create(Self);
|
|
|
{ Windows Style }
|
|
{ Windows Style }
|
|
|
FStateNormal.Color := RGBToColor(225, 225, 225);
|
|
FStateNormal.Color := RGBToColor(225, 225, 225);
|
|
|
FStateNormal.BorderColor := RGBToColor(173, 173, 173);
|
|
FStateNormal.BorderColor := RGBToColor(173, 173, 173);
|
|
@@ -185,6 +186,9 @@ begin
|
|
|
if FBorderColor = AValue then
|
|
if FBorderColor = AValue then
|
|
|
Exit;
|
|
Exit;
|
|
|
FBorderColor := AValue;
|
|
FBorderColor := AValue;
|
|
|
|
|
+
|
|
|
|
|
+ FOwner.Perform(CM_CHANGED, 0, 0);
|
|
|
|
|
+ FOwner.Invalidate;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
procedure TColorState.SetFBorderWidth(AValue: integer);
|
|
procedure TColorState.SetFBorderWidth(AValue: integer);
|
|
@@ -192,6 +196,9 @@ begin
|
|
|
if FBorderWidth = AValue then
|
|
if FBorderWidth = AValue then
|
|
|
Exit;
|
|
Exit;
|
|
|
FBorderWidth := AValue;
|
|
FBorderWidth := AValue;
|
|
|
|
|
+
|
|
|
|
|
+ FOwner.Perform(CM_CHANGED, 0, 0);
|
|
|
|
|
+ FOwner.Invalidate;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
procedure TColorState.SetFColor(AValue: TColor);
|
|
procedure TColorState.SetFColor(AValue: TColor);
|
|
@@ -199,11 +206,15 @@ begin
|
|
|
if FColor = AValue then
|
|
if FColor = AValue then
|
|
|
Exit;
|
|
Exit;
|
|
|
FColor := AValue;
|
|
FColor := AValue;
|
|
|
|
|
+
|
|
|
|
|
+ FOwner.Perform(CM_CHANGED, 0, 0);
|
|
|
|
|
+ FOwner.Invalidate;
|
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
-constructor TColorState.Create;
|
|
|
|
|
|
|
+constructor TColorState.Create(AOwner: TControl);
|
|
|
begin
|
|
begin
|
|
|
inherited Create;
|
|
inherited Create;
|
|
|
|
|
+ FOwner := AOwner;
|
|
|
BorderWidth := 1;
|
|
BorderWidth := 1;
|
|
|
BorderColor := clBlack;
|
|
BorderColor := clBlack;
|
|
|
Color := clWhite;
|
|
Color := clWhite;
|