You've already forked lazarus-ccr
spktoolbar: Fix action behavior in TSpkCheckbox and TSpkRadioButtons. Remove redundant code. Remove unneeded property Groupbehavior from these controls - THIS MAY BREAK EXISTING FORMS!
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6170 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -20,8 +20,11 @@ type
|
|||||||
TBackgroundKind = (bkSolid, bkVerticalGradient, bkHorizontalGradient,
|
TBackgroundKind = (bkSolid, bkVerticalGradient, bkHorizontalGradient,
|
||||||
bkConcave);
|
bkConcave);
|
||||||
|
|
||||||
|
TSpkButtonState = (bsIdle,
|
||||||
|
bsBtnHottrack, bsBtnPressed, bsDropdownHottrack, bsDropdownPressed);
|
||||||
|
|
||||||
TSpkCheckboxStyle = (cbsCheckbox, cbsRadioButton);
|
TSpkCheckboxStyle = (cbsCheckbox, cbsRadioButton);
|
||||||
TSpkCheckboxState = (cbsIdle, cbsHotTrack, cbsPressed, cbsDisabled);
|
// TSpkCheckboxState = (cbsIdle, cbsHotTrack, cbsPressed, cbsDisabled);
|
||||||
|
|
||||||
TGUITools = class(TObject)
|
TGUITools = class(TObject)
|
||||||
protected
|
protected
|
||||||
@@ -294,12 +297,12 @@ type
|
|||||||
class procedure DrawCheckbox(ACanvas: TCanvas;
|
class procedure DrawCheckbox(ACanvas: TCanvas;
|
||||||
x,y: Integer;
|
x,y: Integer;
|
||||||
AState: TCheckboxState;
|
AState: TCheckboxState;
|
||||||
ACheckboxState: TSpkCheckboxState;
|
AButtonState: TSpkButtonState;
|
||||||
AStyle: TSpkCheckboxStyle); overload;
|
AStyle: TSpkCheckboxStyle); overload;
|
||||||
class procedure DrawCheckbox(ACanvas: TCanvas;
|
class procedure DrawCheckbox(ACanvas: TCanvas;
|
||||||
x,y: Integer;
|
x,y: Integer;
|
||||||
AState: TCheckboxState;
|
AState: TCheckboxState;
|
||||||
ACheckboxState: TSpkCheckboxState;
|
AButtonState: TSpkButtonState;
|
||||||
AStyle: TSpkCheckboxStyle;
|
AStyle: TSpkCheckboxStyle;
|
||||||
ClipRect: T2DIntRect); overload;
|
ClipRect: T2DIntRect); overload;
|
||||||
|
|
||||||
@@ -2833,7 +2836,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGUITools.DrawCheckbox(ACanvas:TCanvas; x,y: Integer;
|
class procedure TGUITools.DrawCheckbox(ACanvas:TCanvas; x,y: Integer;
|
||||||
AState: TCheckboxState; ACheckboxState:TSpkCheckboxState;
|
AState: TCheckboxState; AButtonState:TSpkButtonState;
|
||||||
AStyle: TSpkCheckboxStyle; ClipRect:T2DIntRect);
|
AStyle: TSpkCheckboxStyle; ClipRect:T2DIntRect);
|
||||||
var
|
var
|
||||||
UseOrgClipRgn: Boolean;
|
UseOrgClipRgn: Boolean;
|
||||||
@@ -2847,27 +2850,29 @@ begin
|
|||||||
if UseOrgClipRgn then
|
if UseOrgClipRgn then
|
||||||
CombineRgn(ClipRgn, ClipRgn, OrgRgn, RGN_AND);
|
CombineRgn(ClipRgn, ClipRgn, OrgRgn, RGN_AND);
|
||||||
SelectClipRgn(ACanvas.Handle, ClipRgn);
|
SelectClipRgn(ACanvas.Handle, ClipRgn);
|
||||||
DrawCheckbox(ACanvas, x,y, AState, ACheckboxState, AStyle);
|
DrawCheckbox(ACanvas, x,y, AState, AButtonState, AStyle);
|
||||||
RestoreClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
|
RestoreClipRgn(ACanvas.Handle, UseOrgClipRgn, OrgRgn);
|
||||||
DeleteObject(ClipRgn);
|
DeleteObject(ClipRgn);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class procedure TGUITools.DrawCheckbox(ACanvas: TCanvas; x,y: Integer;
|
class procedure TGUITools.DrawCheckbox(ACanvas: TCanvas; x,y: Integer;
|
||||||
AState: TCheckboxState; ACheckboxState: TSpkCheckboxState;
|
AState: TCheckboxState; AButtonState: TSpkButtonState;
|
||||||
AStyle:TSpkCheckboxStyle);
|
AStyle: TSpkCheckboxStyle);
|
||||||
|
const
|
||||||
|
NOT_USED = tbCheckboxCheckedNormal;
|
||||||
const
|
const
|
||||||
UNTHEMED_FLAGS: array [TSpkCheckboxStyle, TCheckboxState] of Integer = (
|
UNTHEMED_FLAGS: array [TSpkCheckboxStyle, TCheckboxState] of Integer = (
|
||||||
(DFCS_BUTTONCHECK, DFCS_BUTTONCHECK or DFCS_CHECKED, DFCS_BUTTONCHECK or DFCS_BUTTON3STATE),
|
(DFCS_BUTTONCHECK, DFCS_BUTTONCHECK or DFCS_CHECKED, DFCS_BUTTONCHECK or DFCS_BUTTON3STATE),
|
||||||
(DFCS_BUTTONRADIO, DFCS_BUTTONRADIO or DFCS_CHECKED, DFCS_BUTTONRADIO or DFCS_BUTTON3STATE)
|
(DFCS_BUTTONRADIO, DFCS_BUTTONRADIO or DFCS_CHECKED, DFCS_BUTTONRADIO or DFCS_BUTTON3STATE)
|
||||||
);
|
);
|
||||||
THEMED_FLAGS: array [TSpkCheckboxStyle, TCheckboxState, TSpkCheckboxState] of TThemedButton = (
|
THEMED_FLAGS: array [TSpkCheckboxStyle, TCheckboxState, TSpkButtonState] of TThemedButton = (
|
||||||
( (tbCheckboxUncheckedNormal, tbCheckboxUncheckedHot, tbCheckboxUncheckedPressed, tbCheckboxUncheckedDisabled),
|
( (tbCheckboxUncheckedNormal, tbCheckboxUncheckedHot, tbCheckboxUncheckedPressed, tbCheckboxUncheckedDisabled, NOT_USED),
|
||||||
(tbCheckboxCheckedNormal, tbCheckboxCheckedHot, tbCheckboxCheckedPressed, tbCheckboxCheckedDisabled),
|
(tbCheckboxCheckedNormal, tbCheckboxCheckedHot, tbCheckboxCheckedPressed, tbCheckboxCheckedDisabled, NOT_USED),
|
||||||
(tbCheckboxMixedNormal, tbCheckboxMixedHot, tbCheckboxMixedPressed, tbCheckboxMixedDisabled)
|
(tbCheckboxMixedNormal, tbCheckboxMixedHot, tbCheckboxMixedPressed, tbCheckboxMixedDisabled, NOT_USED)
|
||||||
),
|
),
|
||||||
( (tbRadioButtonUncheckedNormal, tbRadioButtonUncheckedHot, tbRadioButtonUncheckedPressed, tbRadioButtonUncheckedDisabled),
|
( (tbRadioButtonUncheckedNormal, tbRadioButtonUncheckedHot, tbRadioButtonUncheckedPressed, tbRadioButtonUncheckedDisabled, NOT_USED),
|
||||||
(tbRadioButtonCheckedNormal, tbRadioButtonCheckedHot, tbRadioButtonCheckedPressed, tbRadioButtonCheckedDisabled),
|
(tbRadioButtonCheckedNormal, tbRadioButtonCheckedHot, tbRadioButtonCheckedPressed, tbRadioButtonCheckedDisabled, NOT_USED),
|
||||||
(tbRadioButtonCheckedNormal, tbRadioButtonCheckedHot, tbRadioButtonCheckedPressed, tbRadioButtonCheckedDisabled)
|
(tbRadioButtonCheckedNormal, tbRadioButtonCheckedHot, tbRadioButtonCheckedPressed, tbRadioButtonCheckedDisabled, NOT_USED)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
var
|
var
|
||||||
@@ -2877,7 +2882,7 @@ var
|
|||||||
te: TThemedElementDetails;
|
te: TThemedElementDetails;
|
||||||
begin
|
begin
|
||||||
if ThemeServices.ThemesEnabled then begin
|
if ThemeServices.ThemesEnabled then begin
|
||||||
te := ThemeServices.GetElementDetails(THEMED_FLAGS[AStyle, AState, ACheckboxState]);
|
te := ThemeServices.GetElementDetails(THEMED_FLAGS[AStyle, AState, AButtonState]);
|
||||||
sz := ThemeServices.GetDetailSize(te);
|
sz := ThemeServices.GetDetailSize(te);
|
||||||
R := Bounds(x, y, sz.cx, sz.cy);
|
R := Bounds(x, y, sz.cx, sz.cy);
|
||||||
InflateRect(R, 1, 1);
|
InflateRect(R, 1, 1);
|
||||||
|
@@ -22,12 +22,6 @@ uses
|
|||||||
spkt_Const, spkt_BaseItem, spkt_Exceptions, spkt_Tools;
|
spkt_Const, spkt_BaseItem, spkt_Exceptions, spkt_Tools;
|
||||||
|
|
||||||
type
|
type
|
||||||
TSpkButtonState = (
|
|
||||||
bsIdle,
|
|
||||||
bsBtnHottrack, bsBtnPressed,
|
|
||||||
bsDropdownHottrack, bsDropdownPressed
|
|
||||||
);
|
|
||||||
|
|
||||||
TSpkMouseButtonElement = (beNone, beButton, beDropdown);
|
TSpkMouseButtonElement = (beNone, beButton, beDropdown);
|
||||||
|
|
||||||
TSpkButtonKind = (bkButton, bkButtonDropdown, bkDropdown, bkToggle);
|
TSpkButtonKind = (bkButton, bkButtonDropdown, bkDropdown, bkToggle);
|
||||||
|
@@ -9,36 +9,20 @@ uses
|
|||||||
SpkMath, SpkGUITools, spkt_BaseItem, spkt_Buttons;
|
SpkMath, SpkGUITools, spkt_BaseItem, spkt_Buttons;
|
||||||
|
|
||||||
type
|
type
|
||||||
TSpkCustomCheckbox = class;
|
|
||||||
|
|
||||||
TSpkCheckboxActionLink = class(TSpkButtonActionLink)
|
|
||||||
protected
|
|
||||||
procedure SetChecked(Value: Boolean); override;
|
|
||||||
public
|
|
||||||
function IsCheckedLinked: Boolean; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
TSpkCustomCheckBox = class(TSPkBaseButton)
|
TSpkCustomCheckBox = class(TSPkBaseButton)
|
||||||
private
|
private
|
||||||
FState: TCheckboxState; // unchecked, checked, grayed
|
FState: TCheckboxState; // unchecked, checked, grayed
|
||||||
FCheckboxState: TSpkCheckboxState; // incl Hot, Pressed, Disabled
|
|
||||||
FHideFrameWhenIdle : boolean;
|
FHideFrameWhenIdle : boolean;
|
||||||
FTableBehaviour : TSpkItemTableBehaviour;
|
FTableBehaviour : TSpkItemTableBehaviour;
|
||||||
FGroupBehaviour : TSPkItemGroupBehaviour;
|
FGroupBehaviour : TSPkItemGroupBehaviour;
|
||||||
FCheckboxStyle: TSpkCheckboxStyle;
|
FCheckboxStyle: TSpkCheckboxStyle;
|
||||||
procedure SetGroupBehaviour(const Value: TSpkItemGroupBehaviour);
|
|
||||||
procedure SetTableBehaviour(const Value: TSpkItemTableBehaviour);
|
procedure SetTableBehaviour(const Value: TSpkItemTableBehaviour);
|
||||||
protected
|
protected
|
||||||
procedure ActionChange(Sender : TObject);
|
|
||||||
procedure BtnStateToCheckboxState;
|
|
||||||
procedure CalcRects; override;
|
procedure CalcRects; override;
|
||||||
procedure Click; override;
|
|
||||||
procedure ConstructRect(var BtnRect: T2DIntRect);
|
procedure ConstructRect(var BtnRect: T2DIntRect);
|
||||||
function GetChecked: Boolean; override;
|
function GetChecked: Boolean; override;
|
||||||
function GetDefaultCaption: String; override;
|
function GetDefaultCaption: String; override;
|
||||||
procedure SetAction(const AValue: TBasicAction); override;
|
|
||||||
procedure SetChecked(const AValue: Boolean); override;
|
procedure SetChecked(const AValue: Boolean); override;
|
||||||
procedure SetEnabled(const AValue: Boolean); override;
|
|
||||||
procedure SetState(AValue: TCheckboxState); virtual;
|
procedure SetState(AValue: TCheckboxState); virtual;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
@@ -46,18 +30,11 @@ type
|
|||||||
function GetGroupBehaviour : TSpkItemGroupBehaviour; override;
|
function GetGroupBehaviour : TSpkItemGroupBehaviour; override;
|
||||||
function GetSize: TSpkItemSize; override;
|
function GetSize: TSpkItemSize; override;
|
||||||
function GetTableBehaviour : TSpkItemTableBehaviour; override;
|
function GetTableBehaviour : TSpkItemTableBehaviour; override;
|
||||||
function GetWidth : integer; override;
|
function GetWidth: integer; override;
|
||||||
procedure MouseLeave; override;
|
|
||||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
|
||||||
X, Y: Integer); override;
|
|
||||||
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
|
|
||||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
|
||||||
X, Y: Integer); override;
|
|
||||||
published
|
published
|
||||||
property Checked;
|
property Checked;
|
||||||
property State: TCheckboxState read FState write SetState;
|
property State: TCheckboxState read FState write SetState;
|
||||||
property TableBehaviour : TSpkItemTableBehaviour read FTableBehaviour write SetTableBehaviour;
|
property TableBehaviour: TSpkItemTableBehaviour read FTableBehaviour write SetTableBehaviour;
|
||||||
property GroupBehaviour : TSpkItemGroupBehaviour read FGroupBehaviour write SetGroupBehaviour;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TSpkCheckbox = class(TSpkCustomCheckbox)
|
TSpkCheckbox = class(TSpkCustomCheckbox)
|
||||||
@@ -72,6 +49,9 @@ type
|
|||||||
procedure UncheckSiblings; override;
|
procedure UncheckSiblings; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
published
|
||||||
|
property AllowAllUp;
|
||||||
|
property GroupIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@@ -82,34 +62,12 @@ uses
|
|||||||
SpkGraphTools, spkt_Const, spkt_Tools, spkt_Pane, spkt_Appearance;
|
SpkGraphTools, spkt_Const, spkt_Tools, spkt_Pane, spkt_Appearance;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkCheckboxActionLink }
|
|
||||||
|
|
||||||
function TSpkCheckboxActionLink.IsCheckedLinked: Boolean;
|
|
||||||
var
|
|
||||||
cb: TSpkCustomCheckbox;
|
|
||||||
begin
|
|
||||||
cb := FClient as TSpkCustomCheckbox;
|
|
||||||
result := (inherited IsCheckedLinked) and
|
|
||||||
Assigned(cb) and (cb.Checked = (Action as TCustomAction).Checked);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCheckboxActionLink.SetChecked(Value: Boolean);
|
|
||||||
var
|
|
||||||
cb: TSpkCustomCheckbox;
|
|
||||||
begin
|
|
||||||
if IsCheckedLinked then
|
|
||||||
begin
|
|
||||||
cb := TSpkCustomCheckbox(FClient);
|
|
||||||
cb.Checked := Value;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{ TSpkCustomCheckbox }
|
{ TSpkCustomCheckbox }
|
||||||
|
|
||||||
constructor TSpkCustomCheckbox.Create(AOwner: TComponent);
|
constructor TSpkCustomCheckbox.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
|
ButtonKind := bkToggle;
|
||||||
FHideFrameWhenIdle := true;
|
FHideFrameWhenIdle := true;
|
||||||
FTableBehaviour := tbContinuesRow;
|
FTableBehaviour := tbContinuesRow;
|
||||||
FGroupBehaviour := gbSingleItem;
|
FGroupBehaviour := gbSingleItem;
|
||||||
@@ -117,36 +75,6 @@ begin
|
|||||||
FState := cbUnchecked;
|
FState := cbUnchecked;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.ActionChange(Sender: TObject);
|
|
||||||
begin
|
|
||||||
if Sender is TCustomAction then
|
|
||||||
with TCustomAction(Sender) do
|
|
||||||
begin
|
|
||||||
if (Self.Caption = '') or (Self.Caption = GetDefaultCaption) then
|
|
||||||
Self.Caption := Caption;
|
|
||||||
if (Self.Enabled = True) then
|
|
||||||
Self.Enabled := Enabled;
|
|
||||||
if (Self.Visible = True) then
|
|
||||||
Self.Visible := Visible;
|
|
||||||
if not Assigned(Self.OnClick) then
|
|
||||||
Self.OnClick := OnExecute;
|
|
||||||
if (Self.Checked = false) then
|
|
||||||
Self.Checked := Checked;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.BtnStateToCheckboxState;
|
|
||||||
begin
|
|
||||||
if FEnabled then
|
|
||||||
case FButtonState of
|
|
||||||
bsIdle : FCheckboxState := cbsIdle;
|
|
||||||
bsBtnHotTrack : FCheckboxState := cbsHotTrack;
|
|
||||||
bsBtnPressed : FCheckboxState := cbsPressed;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
FCheckboxState := cbsDisabled;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.CalcRects;
|
procedure TSpkCustomCheckbox.CalcRects;
|
||||||
var
|
var
|
||||||
RectVector: T2DIntVector;
|
RectVector: T2DIntVector;
|
||||||
@@ -162,22 +90,6 @@ begin
|
|||||||
FButtonRect := FButtonRect + RectVector;
|
FButtonRect := FButtonRect + RectVector;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.Click;
|
|
||||||
begin
|
|
||||||
if Enabled then begin
|
|
||||||
case FState of
|
|
||||||
cbGrayed : Checked := true;
|
|
||||||
cbChecked : Checked := false;
|
|
||||||
cbUnchecked : Checked := true;
|
|
||||||
end;
|
|
||||||
if not (csDesigning in ComponentState) and (FActionLink <> nil) then
|
|
||||||
FActionLink.Execute(Self)
|
|
||||||
else
|
|
||||||
if Assigned(FOnClick) and ((Action = nil) or (FOnClick <> Action.OnExecute)) then
|
|
||||||
FOnClick(Self);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.ConstructRect(var BtnRect: T2DIntRect);
|
procedure TSpkCustomCheckbox.ConstructRect(var BtnRect: T2DIntRect);
|
||||||
var
|
var
|
||||||
BtnWidth: integer;
|
BtnWidth: integer;
|
||||||
@@ -326,7 +238,7 @@ begin
|
|||||||
ABuffer.Canvas,
|
ABuffer.Canvas,
|
||||||
x,y,
|
x,y,
|
||||||
FState,
|
FState,
|
||||||
FCheckboxState,
|
FButtonState,
|
||||||
FCheckboxStyle,
|
FCheckboxStyle,
|
||||||
ClipRect
|
ClipRect
|
||||||
);
|
);
|
||||||
@@ -366,7 +278,7 @@ end;
|
|||||||
|
|
||||||
function TSpkCustomCheckbox.GetGroupBehaviour: TSpkItemGroupBehaviour;
|
function TSpkCustomCheckbox.GetGroupBehaviour: TSpkItemGroupBehaviour;
|
||||||
begin
|
begin
|
||||||
Result := FGroupBehaviour;
|
Result := gbSingleitem; //FGroupBehaviour;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TSpkCustomCheckbox.GetSize: TSpkItemSize;
|
function TSpkCustomCheckbox.GetSize: TSpkItemSize;
|
||||||
@@ -392,79 +304,20 @@ begin
|
|||||||
Result := BtnRect.Right + 1;
|
Result := BtnRect.Right + 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
|
||||||
X, Y: Integer);
|
|
||||||
begin
|
|
||||||
inherited;
|
|
||||||
BtnStateToCheckboxState;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.MouseLeave;
|
|
||||||
begin
|
|
||||||
inherited MouseLeave;
|
|
||||||
if FEnabled then
|
|
||||||
FCheckboxState := cbsIdle
|
|
||||||
else
|
|
||||||
FCheckboxState := cbsDisabled;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.MouseMove(Shift: TShiftState; X, Y: Integer);
|
|
||||||
begin
|
|
||||||
inherited MouseMove(Shift, X, Y);
|
|
||||||
BtnStateToCheckboxState;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.MouseUp(Button: TMouseButton; Shift: TShiftState;
|
|
||||||
X, Y: Integer);
|
|
||||||
begin
|
|
||||||
inherited MouseUp(Button, Shift, X, Y);
|
|
||||||
BtnStateToCheckboxState;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.SetAction(const AValue: TBasicAction);
|
|
||||||
begin
|
|
||||||
if AValue = nil then begin
|
|
||||||
FActionLink.Free;
|
|
||||||
FActionLink := nil;
|
|
||||||
end else begin
|
|
||||||
if FActionLink = nil then
|
|
||||||
FActionLink := TSpkCheckboxActionLink.Create(self);
|
|
||||||
FActionLink.Action := AValue;
|
|
||||||
FActionLink.OnChange := @ActionChange;
|
|
||||||
ActionChange(AValue);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.SetChecked(const AValue: Boolean);
|
procedure TSpkCustomCheckbox.SetChecked(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if AValue then
|
inherited SetChecked(AValue);
|
||||||
|
if FChecked then
|
||||||
SetState(cbChecked)
|
SetState(cbChecked)
|
||||||
else
|
else
|
||||||
SetState(cbUnchecked);
|
SetState(cbUnchecked);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.SetEnabled(const AValue: Boolean);
|
|
||||||
begin
|
|
||||||
inherited SetEnabled(AValue);
|
|
||||||
BtnStateToCheckboxState;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.SetGroupBehaviour(const Value: TSpkItemGroupBehaviour);
|
|
||||||
begin
|
|
||||||
FGroupBehaviour := Value;
|
|
||||||
if Assigned(FToolbarDispatch) then
|
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.SetState(AValue:TCheckboxState);
|
procedure TSpkCustomCheckbox.SetState(AValue:TCheckboxState);
|
||||||
begin
|
begin
|
||||||
if AValue <> FState then
|
if AValue <> FState then
|
||||||
begin
|
begin
|
||||||
FState := AValue;
|
FState := AValue;
|
||||||
{
|
|
||||||
if Assigned(FToolbarDispatch) then
|
|
||||||
FToolbarDispatch.NotifyVisualsChanged;
|
|
||||||
}
|
|
||||||
inherited SetChecked(Checked);
|
inherited SetChecked(Checked);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@@ -518,8 +371,10 @@ begin
|
|||||||
if (pane.Items[i] is TSpkRadioButton) then
|
if (pane.Items[i] is TSpkRadioButton) then
|
||||||
begin
|
begin
|
||||||
rb := TSpkRadioButton(pane.Items[i]);
|
rb := TSpkRadioButton(pane.Items[i]);
|
||||||
if (rb <> self) and (rb.GroupIndex = GroupIndex) then
|
if (rb <> self) and (rb.GroupIndex = GroupIndex) then begin
|
||||||
rb.State := cbUnchecked;
|
rb.FChecked := false;
|
||||||
|
rb.FState := cbUnchecked;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Reference in New Issue
Block a user