You've already forked lazarus-ccr
SpkToolbar: Add toggle behavior to toolbar buttons (ButtonKind = bkButton). Together with new properties Checked and GroupIndex this can be used for checkbox and radiobutton effects of toggle buttons.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5386 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -186,6 +186,19 @@ type
|
|||||||
procedure SaveToXML(Node: TSpkXMLNode);
|
procedure SaveToXML(Node: TSpkXMLNode);
|
||||||
procedure Reset(AStyle: TSpkStyle = spkOffice2007Blue);
|
procedure Reset(AStyle: TSpkStyle = spkOffice2007Blue);
|
||||||
|
|
||||||
|
procedure GetActiveColors(IsChecked: Boolean; out AFrameColor,
|
||||||
|
AInnerLightColor, AInnerDarkColor, AGradientFromColor,
|
||||||
|
AGradientToColor: TColor; out AGradientKind: TBackgroundKind;
|
||||||
|
ABrightenBy: Integer = 0);
|
||||||
|
procedure GetHotTrackColors(IsChecked: Boolean; out AFrameColor,
|
||||||
|
AInnerLightColor, AInnerDarkColor, AGradientFromColor,
|
||||||
|
AGradientToColor: TColor; out AGradientKind: TBackgroundKind;
|
||||||
|
ABrightenBy: Integer = 0);
|
||||||
|
procedure GetIdleColors(IsChecked: Boolean; out AFrameColor,
|
||||||
|
AInnerLightColor, AInnerDarkColor, AGradientFromColor,
|
||||||
|
AGradientToColor: TColor; out AGradientKind: TBackgroundKind;
|
||||||
|
ABrightenBy: Integer = 0);
|
||||||
|
|
||||||
published
|
published
|
||||||
property CaptionFont: TFont read FCaptionFont write SetCaptionFont;
|
property CaptionFont: TFont read FCaptionFont write SetCaptionFont;
|
||||||
property IdleFrameColor: TColor read FIdleFrameColor write SetIdleFrameColor;
|
property IdleFrameColor: TColor read FIdleFrameColor write SetIdleFrameColor;
|
||||||
@ -257,7 +270,7 @@ procedure SetDefaultFont(AFont: TFont);
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
LCLIntf, LCLType, typinfo;
|
LCLIntf, LCLType, typinfo, spkGraphTools;
|
||||||
|
|
||||||
procedure SaveFontToPascal(AList: TStrings; AFont: TFont; AName: String);
|
procedure SaveFontToPascal(AList: TStrings; AFont: TFont; AName: String);
|
||||||
var
|
var
|
||||||
@ -801,6 +814,101 @@ begin
|
|||||||
raise AssignException.create('TSpkElementAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkElementAppearance!');
|
raise AssignException.create('TSpkElementAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkElementAppearance!');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpkElementAppearance.GetActiveColors(IsChecked: Boolean;
|
||||||
|
out AFrameColor, AInnerLightColor, AInnerDarkColor, AGradientFromColor,
|
||||||
|
AGradientToColor: TColor; out AGradientKind: TBackgroundKind;
|
||||||
|
ABrightenBy: Integer = 0);
|
||||||
|
const
|
||||||
|
DELTA = -20;
|
||||||
|
begin
|
||||||
|
AFrameColor := FActiveFrameColor;
|
||||||
|
AInnerLightColor := FActiveInnerLightColor;
|
||||||
|
AInnerDarkColor := FActiveInnerDarkColor;
|
||||||
|
AGradientFromColor := FActiveGradientFromColor;
|
||||||
|
AGradientToColor := FActiveGradientToColor;
|
||||||
|
AGradientKind := FActiveGradientType;
|
||||||
|
|
||||||
|
if IsChecked then
|
||||||
|
ABrightenBy := DELTA + ABrightenBy;
|
||||||
|
|
||||||
|
if ABrightenBy <> 0 then
|
||||||
|
begin
|
||||||
|
AFrameColor := TColorTools.Brighten(AFrameColor, ABrightenBy);
|
||||||
|
AInnerLightColor := TColorTools.Brighten(AInnerLightColor, ABrightenBy);
|
||||||
|
AInnerDarkColor := TColortools.Brighten(AInnerDarkColor, ABrightenBy);
|
||||||
|
AGradientFromColor := TColorTools.Brighten(AGradientFromColor, ABrightenBy);
|
||||||
|
AGradientToColor := TColorTools.Brighten(AGradientToColor, ABrightenBy);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSpkElementAppearance.GetIdleColors(IsChecked: Boolean;
|
||||||
|
out AFrameColor, AInnerLightColor, AInnerDarkColor, AGradientFromColor,
|
||||||
|
AGradientToColor: TColor; out AGradientKind: TBackgroundKind;
|
||||||
|
ABrightenBy: Integer = 0);
|
||||||
|
const
|
||||||
|
DELTA = 10;
|
||||||
|
begin
|
||||||
|
if IsChecked then
|
||||||
|
begin
|
||||||
|
ABrightenBy := DELTA + ABrightenBy;
|
||||||
|
AFrameColor := FActiveFrameColor;
|
||||||
|
AInnerLightColor := FActiveInnerLightColor;
|
||||||
|
AInnerDarkColor := FActiveInnerDarkColor;
|
||||||
|
AGradientFromColor := FActiveGradientFromColor;
|
||||||
|
AGradientToColor := FActiveGradientToColor;
|
||||||
|
AGradientKind := FActiveGradientType;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
AFrameColor := FIdleFrameColor;
|
||||||
|
AInnerLightColor := FIdleInnerLightColor;
|
||||||
|
AInnerDarkColor := FIdleInnerDarkColor;
|
||||||
|
AGradientFromColor := FIdleGradientFromColor;
|
||||||
|
AGradientToColor := FIdleGradientToColor;
|
||||||
|
AGradientKind := FIdleGradientType;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if ABrightenBy <> 0 then
|
||||||
|
begin
|
||||||
|
AFrameColor := TColorTools.Brighten(AFrameColor, ABrightenBy);
|
||||||
|
AInnerLightColor := TColorTools.Brighten(AInnerLightColor, ABrightenBy);
|
||||||
|
AInnerDarkColor := TColorTools.Brighten(AInnerLightColor, ABrightenBy);
|
||||||
|
AGradientFromColor := TColorTools.Brighten(AGradientFromColor, ABrightenBy);
|
||||||
|
AGradientToColor := TColorTools.Brighten(AGradientToColor, ABrightenBy);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSpkElementAppearance.GetHotTrackColors(IsChecked: Boolean;
|
||||||
|
out AFrameColor, AInnerLightColor, AInnerDarkColor, AGradientFromColor,
|
||||||
|
AGradientToColor: TColor; out AGradientKind: TBackgroundKind;
|
||||||
|
ABrightenBy: Integer = 0);
|
||||||
|
const
|
||||||
|
DELTA = 20;
|
||||||
|
begin
|
||||||
|
if IsChecked then begin
|
||||||
|
ABrightenBy := ABrightenBy + DELTA;
|
||||||
|
AFrameColor := FActiveFrameColor;
|
||||||
|
AInnerLightColor := FActiveInnerLightColor;
|
||||||
|
AInnerDarkColor := FActiveInnerDarkColor;
|
||||||
|
AGradientFromColor := FActiveGradientFromColor;
|
||||||
|
AGradientToColor := FActiveGradientToColor;
|
||||||
|
AGradientKind := FActiveGradientType;
|
||||||
|
end else begin
|
||||||
|
AFrameColor := FHotTrackFrameColor;
|
||||||
|
AInnerLightColor := FHotTrackInnerLightColor;
|
||||||
|
AInnerDarkColor := FHotTrackInnerDarkColor;
|
||||||
|
AGradientFromColor := FHotTrackGradientFromColor;
|
||||||
|
AGradientToColor := FHotTrackGradientToColor;
|
||||||
|
AGradientKind := FHotTrackGradientType;
|
||||||
|
end;
|
||||||
|
if ABrightenBy <> 0 then begin
|
||||||
|
AFrameColor := TColorTools.Brighten(AFrameColor, ABrightenBy);
|
||||||
|
AInnerLightColor := TColorTools.Brighten(AInnerLightColor, ABrightenBy);
|
||||||
|
AInnerDarkColor := TColortools.Brighten(AInnerDarkColor, ABrightenBy);
|
||||||
|
AGradientFromColor := TColorTools.Brighten(AGradientFromColor, ABrightenBy);
|
||||||
|
AGradientToColor := TColorTools.Brighten(AGradientToColor, ABrightenBy);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkElementAppearance.LoadFromXML(Node: TSpkXMLNode);
|
procedure TSpkElementAppearance.LoadFromXML(Node: TSpkXMLNode);
|
||||||
var
|
var
|
||||||
Subnode: TSpkXMLNode;
|
Subnode: TSpkXMLNode;
|
||||||
|
@ -30,7 +30,7 @@ type
|
|||||||
|
|
||||||
TSpkMouseButtonElement = (beNone, beButton, beDropdown);
|
TSpkMouseButtonElement = (beNone, beButton, beDropdown);
|
||||||
|
|
||||||
TSpkButtonKind = (bkButton, bkButtonDropdown, bkDropdown);
|
TSpkButtonKind = (bkButton, bkButtonDropdown, bkDropdown, bkToggle);
|
||||||
|
|
||||||
TSpkBaseButton = class;
|
TSpkBaseButton = class;
|
||||||
|
|
||||||
@ -40,13 +40,17 @@ type
|
|||||||
procedure AssignClient(AClient: TObject); override;
|
procedure AssignClient(AClient: TObject); override;
|
||||||
function IsOnExecuteLinked: Boolean; override;
|
function IsOnExecuteLinked: Boolean; override;
|
||||||
procedure SetCaption(const Value: string); override;
|
procedure SetCaption(const Value: string); override;
|
||||||
|
procedure SetChecked(Value: Boolean); override;
|
||||||
procedure SetEnabled(Value: Boolean); override;
|
procedure SetEnabled(Value: Boolean); override;
|
||||||
|
procedure SetGroupIndex(Value: Integer); override;
|
||||||
procedure SetImageIndex(Value: integer); override;
|
procedure SetImageIndex(Value: integer); override;
|
||||||
procedure SetVisible(Value: Boolean); override;
|
procedure SetVisible(Value: Boolean); override;
|
||||||
procedure SetOnExecute(Value: TNotifyEvent); override;
|
procedure SetOnExecute(Value: TNotifyEvent); override;
|
||||||
public
|
public
|
||||||
function IsCaptionLinked: Boolean; override;
|
function IsCaptionLinked: Boolean; override;
|
||||||
|
function IsCheckedLinked: Boolean; override;
|
||||||
function IsEnabledLinked: Boolean; override;
|
function IsEnabledLinked: Boolean; override;
|
||||||
|
function IsGroupIndexLinked: Boolean; override;
|
||||||
function IsImageIndexLinked: Boolean; override;
|
function IsImageIndexLinked: Boolean; override;
|
||||||
function IsVisibleLinked: Boolean; override;
|
function IsVisibleLinked: Boolean; override;
|
||||||
end;
|
end;
|
||||||
@ -61,9 +65,11 @@ type
|
|||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
function GetAction: TBasicAction;
|
function GetAction: TBasicAction;
|
||||||
procedure SetCaption(const Value: string);
|
procedure SetAllowAllUp(const Value: Boolean);
|
||||||
procedure SetButtonKind(const Value: TSpkButtonKind);
|
procedure SetButtonKind(const Value: TSpkButtonKind);
|
||||||
|
procedure SetCaption(const Value: string);
|
||||||
procedure SetDropdownMenu(const Value: TPopupMenu);
|
procedure SetDropdownMenu(const Value: TPopupMenu);
|
||||||
|
procedure SetGroupIndex(const Value: Integer);
|
||||||
|
|
||||||
protected
|
protected
|
||||||
FCaption: string;
|
FCaption: string;
|
||||||
@ -73,6 +79,9 @@ type
|
|||||||
FButtonRect: T2DIntRect;
|
FButtonRect: T2DIntRect;
|
||||||
FDropdownRect: T2DIntRect;
|
FDropdownRect: T2DIntRect;
|
||||||
FButtonKind: TSpkButtonKind;
|
FButtonKind: TSpkButtonKind;
|
||||||
|
FChecked: Boolean;
|
||||||
|
FGroupIndex: Integer;
|
||||||
|
FAllowAllUp: Boolean;
|
||||||
FDropdownMenu: TPopupMenu;
|
FDropdownMenu: TPopupMenu;
|
||||||
|
|
||||||
// *** Obs³uga rysowania ***
|
// *** Obs³uga rysowania ***
|
||||||
@ -87,13 +96,21 @@ type
|
|||||||
procedure DoActionChange(Sender: TObject);
|
procedure DoActionChange(Sender: TObject);
|
||||||
function GetDefaultCaption: String; virtual;
|
function GetDefaultCaption: String; virtual;
|
||||||
|
|
||||||
|
function SiblingsChecked: Boolean; virtual;
|
||||||
|
procedure UncheckSiblings; virtual;
|
||||||
|
|
||||||
// Getters and Setters
|
// Getters and Setters
|
||||||
|
function GetChecked: Boolean; virtual;
|
||||||
|
procedure SetAction(const Value: TBasicAction); virtual;
|
||||||
|
procedure SetChecked(const Value: Boolean); virtual;
|
||||||
procedure SetEnabled(const Value: boolean); override;
|
procedure SetEnabled(const Value: boolean); override;
|
||||||
procedure SetRect(const Value: T2DIntRect); override;
|
procedure SetRect(const Value: T2DIntRect); override;
|
||||||
procedure SetAction(const Value: TBasicAction); virtual;
|
|
||||||
|
|
||||||
|
property AllowAllUp: Boolean read FAllowAllUp write SetAllowAllUp default false;
|
||||||
property ButtonKind: TSpkButtonKind read FButtonKind write SetButtonKind;
|
property ButtonKind: TSpkButtonKind read FButtonKind write SetButtonKind;
|
||||||
|
property Checked: Boolean read GetChecked write SetChecked default false;
|
||||||
property DropdownMenu: TPopupMenu read FDropdownMenu write SetDropdownMenu;
|
property DropdownMenu: TPopupMenu read FDropdownMenu write SetDropdownMenu;
|
||||||
|
property GroupIndex: Integer read FGroupIndex write SetGroupIndex default 0;
|
||||||
|
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
@ -134,8 +151,11 @@ type
|
|||||||
function GetWidth: integer; override;
|
function GetWidth: integer; override;
|
||||||
published
|
published
|
||||||
property LargeImageIndex: TImageIndex read FLargeImageIndex write SetLargeImageIndex default -1;
|
property LargeImageIndex: TImageIndex read FLargeImageIndex write SetLargeImageIndex default -1;
|
||||||
|
property AllowAllUp;
|
||||||
property ButtonKind;
|
property ButtonKind;
|
||||||
|
property Checked;
|
||||||
property DropdownMenu;
|
property DropdownMenu;
|
||||||
|
property GroupIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -170,8 +190,11 @@ type
|
|||||||
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
|
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
|
||||||
property ShowCaption: boolean read FShowCaption write SetShowCaption;
|
property ShowCaption: boolean read FShowCaption write SetShowCaption;
|
||||||
property TableBehaviour: TSpkItemTableBehaviour read FTableBehaviour write SetTableBehaviour;
|
property TableBehaviour: TSpkItemTableBehaviour read FTableBehaviour write SetTableBehaviour;
|
||||||
|
property AllowAllUp;
|
||||||
property ButtonKind;
|
property ButtonKind;
|
||||||
|
property Checked;
|
||||||
property DropdownMenu;
|
property DropdownMenu;
|
||||||
|
property GroupIndex;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -194,12 +217,24 @@ begin
|
|||||||
(FClient.Caption = (Action as TCustomAction).Caption);
|
(FClient.Caption = (Action as TCustomAction).Caption);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSpkButtonActionLink.IsCheckedLinked: Boolean;
|
||||||
|
begin
|
||||||
|
Result := inherited IsCheckedLinked and Assigned(FClient) and
|
||||||
|
(FClient.Checked = (Action as TCustomAction).Checked);
|
||||||
|
end;
|
||||||
|
|
||||||
function TSpkButtonActionLink.IsEnabledLinked: Boolean;
|
function TSpkButtonActionLink.IsEnabledLinked: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := inherited IsEnabledLinked and Assigned(FClient) and
|
Result := inherited IsEnabledLinked and Assigned(FClient) and
|
||||||
(FClient.Enabled = (Action as TCustomAction).Enabled);
|
(FClient.Enabled = (Action as TCustomAction).Enabled);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSpkButtonActionLink.IsGroupIndexLinked: Boolean;
|
||||||
|
begin
|
||||||
|
Result := inherited IsGroupIndexLinked and Assigned(FClient) and
|
||||||
|
(FClient.GroupIndex = (Action as TCustomAction).GroupIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
function TSpkButtonActionLink.IsOnExecuteLinked: Boolean;
|
function TSpkButtonActionLink.IsOnExecuteLinked: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := inherited IsOnExecuteLinked and
|
Result := inherited IsOnExecuteLinked and
|
||||||
@ -230,12 +265,24 @@ begin
|
|||||||
FClient.Caption := Value;
|
FClient.Caption := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpkButtonActionLink.SetChecked(Value: Boolean);
|
||||||
|
begin
|
||||||
|
if IsCheckedLinked then
|
||||||
|
FClient.Checked := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkButtonActionLink.SetEnabled(Value: Boolean);
|
procedure TSpkButtonActionLink.SetEnabled(Value: Boolean);
|
||||||
begin
|
begin
|
||||||
if IsEnabledLinked then
|
if IsEnabledLinked then
|
||||||
FClient.Enabled := Value;
|
FClient.Enabled := Value;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpkButtonActionLink.SetGroupIndex(Value: Integer);
|
||||||
|
begin
|
||||||
|
if IsGroupIndexLinked then
|
||||||
|
FClient.GroupIndex := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkButtonActionLink.SetImageIndex(Value: integer);
|
procedure TSpkButtonActionLink.SetImageIndex(Value: integer);
|
||||||
begin
|
begin
|
||||||
if IsImageIndexLinked then begin
|
if IsImageIndexLinked then begin
|
||||||
@ -296,6 +343,12 @@ begin
|
|||||||
Self.Enabled := Enabled;
|
Self.Enabled := Enabled;
|
||||||
if not CheckDefaults or (Self.Visible = True) then
|
if not CheckDefaults or (Self.Visible = True) then
|
||||||
Self.Visible := Visible;
|
Self.Visible := Visible;
|
||||||
|
if not CheckDefaults or Self.Checked then
|
||||||
|
Self.Checked := Checked;
|
||||||
|
if not CheckDefaults or (Self.GroupIndex > 0) then
|
||||||
|
Self.GroupIndex := GroupIndex;
|
||||||
|
if not CheckDefaults or not Self.AllowAllUp then
|
||||||
|
Self.AllowAllUp := AllowAllUp;
|
||||||
if not CheckDefaults or not Assigned(Self.OnClick) then
|
if not CheckDefaults or not Assigned(Self.OnClick) then
|
||||||
Self.OnClick := OnExecute;
|
Self.OnClick := OnExecute;
|
||||||
if self is TSpkSmallButton then begin
|
if self is TSpkSmallButton then begin
|
||||||
@ -329,6 +382,11 @@ begin
|
|||||||
Result := nil;
|
Result := nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSpkBaseButton.GetChecked: Boolean;
|
||||||
|
begin
|
||||||
|
Result := FChecked;
|
||||||
|
end;
|
||||||
|
|
||||||
function TSpkBaseButton.GetDefaultCaption: String;
|
function TSpkBaseButton.GetDefaultCaption: String;
|
||||||
begin
|
begin
|
||||||
Result := 'Button';
|
Result := 'Button';
|
||||||
@ -361,6 +419,9 @@ begin
|
|||||||
if Button <> mbLeft then
|
if Button <> mbLeft then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
if FButtonKind = bkToggle then
|
||||||
|
Checked := not Checked;
|
||||||
|
|
||||||
if FMouseActiveElement = beButton then
|
if FMouseActiveElement = beButton then
|
||||||
begin
|
begin
|
||||||
if FButtonState <> bsBtnPressed then
|
if FButtonState <> bsBtnPressed then
|
||||||
@ -565,7 +626,7 @@ begin
|
|||||||
// przyciskiem
|
// przyciskiem
|
||||||
if FMouseHoverElement = beButton then
|
if FMouseHoverElement = beButton then
|
||||||
begin
|
begin
|
||||||
if FButtonKind in [bkButton, bkButtonDropdown] then
|
if FButtonKind in [bkButton, bkButtonDropdown, bkToggle] then
|
||||||
begin
|
begin
|
||||||
Click;
|
Click;
|
||||||
FButtonState := bsBtnHottrack;
|
FButtonState := bsBtnHottrack;
|
||||||
@ -637,7 +698,7 @@ begin
|
|||||||
|
|
||||||
if ClearActive then
|
if ClearActive then
|
||||||
begin
|
begin
|
||||||
FMouseActiveElement:=beNone;
|
FMouseActiveElement := beNone;
|
||||||
end;
|
end;
|
||||||
end // if FEnabled
|
end // if FEnabled
|
||||||
else
|
else
|
||||||
@ -659,8 +720,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
FActionLink.Free;
|
FActionLink.Free;
|
||||||
FActionLink := nil;
|
FActionLink := nil;
|
||||||
end
|
end else
|
||||||
else
|
|
||||||
begin
|
begin
|
||||||
if FActionLink = nil then
|
if FActionLink = nil then
|
||||||
FActionLink := TSpkButtonActionLink.Create(self);
|
FActionLink := TSpkButtonActionLink.Create(self);
|
||||||
@ -670,18 +730,41 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpkBaseButton.SetAllowAllUp(const Value: Boolean);
|
||||||
|
begin
|
||||||
|
FAllowAllUp := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseButton.SetButtonKind(const Value: TSpkButtonKind);
|
procedure TSpkBaseButton.SetButtonKind(const Value: TSpkButtonKind);
|
||||||
begin
|
begin
|
||||||
FButtonKind := Value;
|
FButtonKind := Value;
|
||||||
if Assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
FToolbarDispatch.NotifyMetricsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseButton.SetCaption(const Value: string);
|
procedure TSpkBaseButton.SetCaption(const Value: string);
|
||||||
begin
|
begin
|
||||||
FCaption := Value;
|
FCaption := Value;
|
||||||
if Assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
FToolbarDispatch.NotifyMetricsChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSpkBaseButton.SetChecked(const Value: Boolean);
|
||||||
|
begin
|
||||||
|
if FChecked = Value then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
if FGroupIndex > 0 then
|
||||||
|
begin
|
||||||
|
if FAllowAllUp or ((not FAllowAllUp) and Value) then
|
||||||
|
UncheckSiblings;
|
||||||
|
if not FAllowAllUp and (not Value) and not SiblingsChecked then
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
FChecked := Value;
|
||||||
|
if Assigned(FToolbarDispatch) then
|
||||||
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseButton.SetDropdownMenu(const Value: TPopupMenu);
|
procedure TSpkBaseButton.SetDropdownMenu(const Value: TPopupMenu);
|
||||||
@ -712,12 +795,64 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSpkBaseButton.SetGroupIndex(const Value: Integer);
|
||||||
|
begin
|
||||||
|
if FGroupIndex = Value then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
FGroupIndex := Value;
|
||||||
|
if Assigned(FToolbarDispatch) then
|
||||||
|
FToolbarDispatch.NotifyVisualsChanged;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSpkBaseButton.SetRect(const Value: T2DIntRect);
|
procedure TSpkBaseButton.SetRect(const Value: T2DIntRect);
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
CalcRects;
|
CalcRects;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TSpkBaseButton.SiblingsChecked: Boolean;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
pane: TSpkPane;
|
||||||
|
btn: TSpkBaseButton;
|
||||||
|
begin
|
||||||
|
if (Parent is TSpkPane) then
|
||||||
|
begin
|
||||||
|
pane := TSpkPane(Parent);
|
||||||
|
for i:=0 to pane.Items.Count-1 do
|
||||||
|
if pane.Items[i] is TSpkBaseButton then
|
||||||
|
begin
|
||||||
|
btn := TSpkBaseButton(pane.Items[i]);
|
||||||
|
if (btn <> self) and (btn.ButtonKind = bkToggle) and
|
||||||
|
(btn.GroupIndex = FGroupIndex) and btn.Checked then
|
||||||
|
begin
|
||||||
|
Result := true;
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Result := false;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TSpkBaseButton.UncheckSiblings;
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
pane: TSpkPane;
|
||||||
|
btn: TSpkBaseButton;
|
||||||
|
begin
|
||||||
|
if (Parent is TSpkPane) then begin
|
||||||
|
pane := TSpkPane(Parent);
|
||||||
|
for i:=0 to pane.Items.Count-1 do
|
||||||
|
if pane.Items[i] is TSpkBasebutton then
|
||||||
|
begin
|
||||||
|
btn := TSpkBaseButton(pane.Items[i]);
|
||||||
|
if (btn <> self) and (btn.ButtonKind = bkToggle) and (btn.GroupIndex = FGroupIndex) then
|
||||||
|
btn.FChecked := false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ TSpkLargeButton }
|
{ TSpkLargeButton }
|
||||||
|
|
||||||
@ -807,32 +942,24 @@ begin
|
|||||||
if FButtonKind = bkButtonDropdown then
|
if FButtonKind = bkButtonDropdown then
|
||||||
begin
|
begin
|
||||||
drawBtn := true;
|
drawBtn := true;
|
||||||
if (FButtonState in [bsBtnHottrack, bsBtnPressed]) then
|
if (FButtonState in [bsBtnHotTrack, bsBtnPressed]) then
|
||||||
begin
|
begin
|
||||||
frameColor := TColorTools.Brighten(FAppearance.Element.HotTrackFrameColor, delta);
|
FAppearance.Element.GetHotTrackColors(Checked,
|
||||||
innerLightColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerLightColor, delta);
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerDarkColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerDarkColor, delta);
|
gradientFromColor, gradientToColor, gradientKind,
|
||||||
gradientFromColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientFromColor, delta);
|
delta);
|
||||||
gradientToColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientToColor, delta);
|
|
||||||
gradientKind := FAppearance.Element.HotTrackGradientType;
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState = bsDropdownHottrack) then
|
if (FButtonState = bsDropdownHottrack) then
|
||||||
begin
|
begin
|
||||||
frameColor := FAppearance.Element.HotTrackFrameColor;
|
FAppearance.Element.GetHotTrackColors(Checked,
|
||||||
innerLightColor := FAppearance.Element.HotTrackInnerLightColor;
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerDarkColor := FAppearance.Element.HotTrackInnerDarkColor;
|
gradientFromColor, gradientToColor, gradientKind);
|
||||||
gradientFromColor := FAppearance.Element.HotTrackGradientFromColor;
|
|
||||||
gradientToColor := FAppearance.Element.HotTrackGradientToColor;
|
|
||||||
gradientKind := FAppearance.Element.HotTrackGradientType;
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState = bsDropdownPressed) then
|
if (FButtonState = bsDropdownPressed) then
|
||||||
begin
|
begin
|
||||||
frameColor := FAppearance.Element.ActiveFrameColor;
|
FAppearance.Element.GetActiveColors(Checked,
|
||||||
innerlightColor := FAppearance.Element.ActiveInnerLightColor;
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerDarkColor := FAppearance.Element.ActiveInnerDarkColor;
|
gradientFromColor, gradientToColor, gradientKind);
|
||||||
gradientFromColor := FAppearance.Element.ActiveGradientFromColor;
|
|
||||||
gradientToColor := FAppearance.Element.ActiveGradientToColor;
|
|
||||||
gradientKind := FAppearance.Element.ActiveGradientType;
|
|
||||||
end else
|
end else
|
||||||
drawBtn := false;
|
drawBtn := false;
|
||||||
|
|
||||||
@ -860,30 +987,29 @@ begin
|
|||||||
drawBtn := true;
|
drawBtn := true;
|
||||||
if FButtonState = bsBtnHottrack then
|
if FButtonState = bsBtnHottrack then
|
||||||
begin
|
begin
|
||||||
frameColor := FAppearance.Element.HotTrackFrameColor;
|
FAppearance.Element.GetHotTrackColors(Checked,
|
||||||
innerLightColor := FAppearance.Element.HotTrackInnerLightColor;
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerDarkColor := FAppearance.Element.HotTrackInnerDarkColor;
|
gradientFromColor, gradientToColor, gradientKind);
|
||||||
gradientFromColor := FAppearance.Element.HotTrackGradientFromColor;
|
|
||||||
gradientToColor := FAppearance.Element.HotTrackGradientToColor;
|
|
||||||
gradientKind := FAppearance.Element.HotTrackGradientType;
|
|
||||||
end else
|
end else
|
||||||
if FButtonState = bsBtnPressed then
|
if FButtonState = bsBtnPressed then
|
||||||
begin
|
begin
|
||||||
frameColor := FAppearance.Element.ActiveFrameColor;
|
FAppearance.Element.GetActiveColors(Checked,
|
||||||
innerDarkColor := FAppearance.Element.ActiveInnerDarkColor;
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerLightColor := FAppearance.Element.ActiveInnerLightColor;
|
gradientFromColor, gradientToColor, gradientkind);
|
||||||
gradientFromColor := FAppearance.Element.ActiveGradientFromColor;
|
|
||||||
gradientToColor := FAppearance.Element.ActiveGradientToColor;
|
|
||||||
gradientKind := FAppearance.Element.ActiveGradientType;
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState in [bsDropdownHotTrack, bsDropdownPressed]) then
|
if (FButtonState in [bsDropdownHotTrack, bsDropdownPressed]) then
|
||||||
begin
|
begin
|
||||||
frameColor := TColorTools.Brighten(FAppearance.Element.HotTrackFrameColor, delta);
|
FAppearance.Element.GetHotTrackColors(Checked,
|
||||||
innerDarkColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerDarkColor, delta);
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerLightColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerLightColor, delta);
|
gradientFromColor, gradientToColor, gradientKind,
|
||||||
gradientFromColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientFromColor, delta);
|
delta);
|
||||||
gradientToColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientToColor, delta);
|
end else
|
||||||
gradientKind := FAppearance.Element.HotTrackGradientType;
|
if (FButtonState = bsIdle) and Checked then
|
||||||
|
begin
|
||||||
|
FAppearance.Element.GetActiveColors(Checked,
|
||||||
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
|
gradientFromColor, gradientToColor, gradientKind
|
||||||
|
);
|
||||||
end else
|
end else
|
||||||
drawBtn := false;
|
drawBtn := false;
|
||||||
|
|
||||||
@ -954,7 +1080,7 @@ begin
|
|||||||
ABuffer.Canvas.Font.Assign(FAppearance.Element.CaptionFont);
|
ABuffer.Canvas.Font.Assign(FAppearance.Element.CaptionFont);
|
||||||
ABuffer.Canvas.Font.Color := fontColor;
|
ABuffer.Canvas.Font.Color := fontColor;
|
||||||
|
|
||||||
if FButtonKind = bkButton then
|
if FButtonKind in [bkButton, bkToggle] then
|
||||||
FindBreakPlace(FCaption, breakPos, breakWidth)
|
FindBreakPlace(FCaption, breakPos, breakWidth)
|
||||||
else
|
else
|
||||||
breakPos := 0;
|
breakPos := 0;
|
||||||
@ -1101,7 +1227,7 @@ begin
|
|||||||
GlyphWidth := 0;
|
GlyphWidth := 0;
|
||||||
|
|
||||||
// Text
|
// Text
|
||||||
if FButtonKind = bkButton then
|
if FButtonKind in [bkButton, bkToggle] then
|
||||||
begin
|
begin
|
||||||
// £amiemy etykietê
|
// £amiemy etykietê
|
||||||
FindBreakPlace(FCaption,BreakPos,RowWidth);
|
FindBreakPlace(FCaption,BreakPos,RowWidth);
|
||||||
@ -1205,7 +1331,7 @@ begin
|
|||||||
|
|
||||||
// *** Dropdown ***
|
// *** Dropdown ***
|
||||||
case FButtonKind of
|
case FButtonKind of
|
||||||
bkButton:
|
bkButton, bkToggle:
|
||||||
begin
|
begin
|
||||||
// Lewa krawêdŸ przycisku
|
// Lewa krawêdŸ przycisku
|
||||||
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
|
if FGroupBehaviour in [gbContinuesGroup, gbEndsGroup] then
|
||||||
@ -1317,39 +1443,32 @@ begin
|
|||||||
drawBtn := true;
|
drawBtn := true;
|
||||||
if (FButtonState = bsIdle) and (not FHideFrameWhenIdle) then
|
if (FButtonState = bsIdle) and (not FHideFrameWhenIdle) then
|
||||||
begin
|
begin
|
||||||
frameColor := FAppearance.Element.IdleFrameColor;
|
FAppearance.Element.GetIdleColors(Checked,
|
||||||
innerLightColor := FAppearance.Element.IdleInnerLightColor;
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerDarkColor := FAppearance.Element.IdleInnerDarkColor;
|
gradientFromColor, gradientToColor, gradientKind
|
||||||
gradientFromColor := FAppearance.Element.IdleGradientFromColor;
|
);
|
||||||
gradientToColor := FAppearance.Element.IdleGradientToColor;
|
|
||||||
gradientKind := FAppearance.Element.IdleGradientType;
|
|
||||||
end else
|
end else
|
||||||
if FButtonState = bsBtnHottrack then
|
if FButtonState = bsBtnHottrack then
|
||||||
begin
|
begin
|
||||||
frameColor := FAppearance.Element.HotTrackFrameColor;
|
FAppearance.Element.GetHotTrackColors(Checked,
|
||||||
innerLightColor := FAppearance.Element.HotTrackInnerLightColor;
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerDarkColor := FAppearance.Element.HotTrackInnerDarkColor;
|
gradientFromColor, gradientToColor, gradientKind
|
||||||
gradientFromColor := FAppearance.Element.HotTrackGradientFromColor;
|
);
|
||||||
gradientToColor := FAppearance.Element.HotTrackGradientToColor;
|
|
||||||
gradientKind := FAppearance.Element.HotTrackGradientType;
|
|
||||||
end else
|
end else
|
||||||
if FButtonState = bsBtnPressed then
|
if FButtonState = bsBtnPressed then
|
||||||
begin
|
begin
|
||||||
frameColor := FAppearance.Element.ActiveFrameColor;
|
FAppearance.Element.GetActiveColors(Checked,
|
||||||
innerDarkColor := FAppearance.Element.ActiveInnerDarkColor;
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerLightColor := FAppearance.Element.ActiveInnerLightColor;
|
gradientFromColor, gradientToColor, gradientKind
|
||||||
gradientFromColor := FAppearance.Element.ActiveGradientFromColor;
|
);
|
||||||
gradientToColor := FAppearance.Element.ActiveGradientToColor;
|
|
||||||
gradientKind := FAppearance.Element.ActiveGradientType;
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState in [bsDropdownHotTrack, bsDropdownPressed]) then
|
if (FButtonState in [bsDropdownHotTrack, bsDropdownPressed]) then
|
||||||
begin
|
begin
|
||||||
frameColor := TColorTools.Brighten(FAppearance.Element.HotTrackFrameColor, delta);
|
FAppearance.Element.GetHotTrackColors(Checked,
|
||||||
innerDarkColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerDarkColor, delta);
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerLightColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerLightColor, delta);
|
gradientFromColor, gradientToColor, gradientKind,
|
||||||
gradientFromColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientFromColor, delta);
|
delta
|
||||||
gradientToColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientToColor, delta);
|
);
|
||||||
gradientKind := FAppearance.Element.HotTrackGradientType;
|
|
||||||
end else
|
end else
|
||||||
drawBtn := false;
|
drawBtn := false;
|
||||||
|
|
||||||
@ -1437,39 +1556,32 @@ begin
|
|||||||
drawBtn := true;
|
drawBtn := true;
|
||||||
if (FButtonState = bsIdle) and (not FHideFrameWhenIdle) then
|
if (FButtonState = bsIdle) and (not FHideFrameWhenIdle) then
|
||||||
begin
|
begin
|
||||||
frameColor := FAppearance.Element.IdleFrameColor;
|
FAppearance.Element.GetIdleColors(Checked,
|
||||||
innerLightColor := FAppearance.Element.IdleInnerLightColor;
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerDarkColor := FAppearance.Element.IdleInnerDarkColor;
|
gradientFromColor, gradientToColor, gradientkind
|
||||||
gradientFromColor := FAppearance.Element.IdleGradientFromColor;
|
);
|
||||||
gradientToColor := FAppearance.Element.IdleGradientToColor;
|
|
||||||
gradientKind := FAppearance.Element.IdleGradientType;
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState in [bsBtnHottrack, bsBtnPressed]) then
|
if (FButtonState in [bsBtnHottrack, bsBtnPressed]) then
|
||||||
begin
|
begin
|
||||||
frameColor := TColorTools.Brighten(FAppearance.Element.HotTrackFrameColor, delta);
|
FAppearance.Element.GetHotTrackColors(Checked,
|
||||||
innerLightColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerLightColor, delta);
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerDarkColor := TColorTools.Brighten(FAppearance.Element.HotTrackInnerDarkColor, delta);
|
gradientFromColor, gradientToColor, gradientKind,
|
||||||
gradientFromColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientFromColor, delta);
|
delta
|
||||||
gradientToColor := TColorTools.Brighten(FAppearance.Element.HotTrackGradientToColor, delta);
|
);
|
||||||
gradientKind := FAppearance.Element.HotTrackGradientType;
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState = bsDropdownHottrack) then
|
if (FButtonState = bsDropdownHottrack) then
|
||||||
begin
|
begin
|
||||||
frameColor := FAppearance.Element.HotTrackFrameColor;
|
FAppearance.Element.GetHotTrackColors(Checked,
|
||||||
innerLightColor := FAppearance.Element.HotTrackInnerLightColor;
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerDarkColor := FAppearance.Element.HotTrackInnerDarkColor;
|
gradientFromColor, gradientToColor, gradientkind
|
||||||
gradientFromColor := FAppearance.Element.HotTrackGradientFromColor;
|
);
|
||||||
gradientToColor := FAppearance.Element.HotTrackGradientToColor;
|
|
||||||
gradientKind := FAppearance.Element.HotTrackGradientType;
|
|
||||||
end else
|
end else
|
||||||
if (FButtonState = bsDropdownPressed) then
|
if (FButtonState = bsDropdownPressed) then
|
||||||
begin
|
begin
|
||||||
frameColor := FAppearance.Element.ActiveFrameColor;
|
FAppearance.Element.GetActiveColors(Checked,
|
||||||
innerlightColor := FAppearance.Element.ActiveInnerLightColor;
|
frameColor, innerLightColor, innerDarkColor,
|
||||||
innerDarkColor := FAppearance.Element.ActiveInnerDarkColor;
|
gradientFromColor, gradientToColor, gradientKind
|
||||||
gradientFromColor := FAppearance.Element.ActiveGradientFromColor;
|
);
|
||||||
gradientToColor := FAppearance.Element.ActiveGradientToColor;
|
|
||||||
gradientKind := FAppearance.Element.ActiveGradientType;
|
|
||||||
end else
|
end else
|
||||||
drawBtn := false;
|
drawBtn := false;
|
||||||
|
|
||||||
|
@ -26,8 +26,6 @@ type
|
|||||||
FTableBehaviour : TSpkItemTableBehaviour;
|
FTableBehaviour : TSpkItemTableBehaviour;
|
||||||
FGroupBehaviour : TSPkItemGroupBehaviour;
|
FGroupBehaviour : TSPkItemGroupBehaviour;
|
||||||
FCheckboxStyle: TSpkCheckboxStyle;
|
FCheckboxStyle: TSpkCheckboxStyle;
|
||||||
function GetChecked: Boolean;
|
|
||||||
procedure SetChecked(AValue: Boolean);
|
|
||||||
procedure SetGroupBehaviour(const Value: TSpkItemGroupBehaviour);
|
procedure SetGroupBehaviour(const Value: TSpkItemGroupBehaviour);
|
||||||
procedure SetTableBehaviour(const Value: TSpkItemTableBehaviour);
|
procedure SetTableBehaviour(const Value: TSpkItemTableBehaviour);
|
||||||
protected
|
protected
|
||||||
@ -36,8 +34,10 @@ type
|
|||||||
procedure CalcRects; override;
|
procedure CalcRects; override;
|
||||||
procedure Click; override;
|
procedure Click; override;
|
||||||
procedure ConstructRect(var BtnRect: T2DIntRect);
|
procedure ConstructRect(var BtnRect: T2DIntRect);
|
||||||
|
function GetChecked: Boolean; override;
|
||||||
function GetDefaultCaption: String; override;
|
function GetDefaultCaption: String; override;
|
||||||
procedure SetAction(const AValue: TBasicAction); override;
|
procedure SetAction(const AValue: TBasicAction); override;
|
||||||
|
procedure SetChecked(const AValue: Boolean); override;
|
||||||
procedure SetEnabled(const AValue: Boolean); override;
|
procedure SetEnabled(const AValue: Boolean); override;
|
||||||
procedure SetState(AValue: TCheckboxState); virtual;
|
procedure SetState(AValue: TCheckboxState); virtual;
|
||||||
public
|
public
|
||||||
@ -54,7 +54,7 @@ type
|
|||||||
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: Integer); override;
|
X, Y: Integer); override;
|
||||||
published
|
published
|
||||||
property Checked: Boolean read GetChecked write SetChecked;
|
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;
|
property GroupBehaviour : TSpkItemGroupBehaviour read FGroupBehaviour write SetGroupBehaviour;
|
||||||
@ -69,7 +69,7 @@ type
|
|||||||
protected
|
protected
|
||||||
function GetDefaultCaption: String; override;
|
function GetDefaultCaption: String; override;
|
||||||
procedure SetState(AValue: TCheckboxState); override;
|
procedure SetState(AValue: TCheckboxState); override;
|
||||||
procedure UncheckSiblings;
|
procedure UncheckSiblings; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
end;
|
end;
|
||||||
@ -435,7 +435,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSpkCustomCheckbox.SetChecked(AValue: Boolean);
|
procedure TSpkCustomCheckbox.SetChecked(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if AValue then
|
if AValue then
|
||||||
SetState(cbChecked)
|
SetState(cbChecked)
|
||||||
@ -470,7 +470,7 @@ procedure TSpkCustomCheckbox.SetTableBehaviour(const Value: TSpkItemTableBehavio
|
|||||||
begin
|
begin
|
||||||
FTableBehaviour := Value;
|
FTableBehaviour := Value;
|
||||||
if Assigned(FToolbarDispatch) then
|
if Assigned(FToolbarDispatch) then
|
||||||
FToolbarDispatch.NotifyMetricsChanged;
|
FToolbarDispatch.NotifyMetricsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -507,13 +507,17 @@ procedure TSpkRadioButton.UncheckSiblings;
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
pane: TSpkPane;
|
pane: TSpkPane;
|
||||||
|
rb: TSpkRadioButton;
|
||||||
begin
|
begin
|
||||||
if (Parent is TSpkPane) then
|
if (Parent is TSpkPane) then begin
|
||||||
begin
|
|
||||||
pane := TSpkPane(Parent);
|
pane := TSpkPane(Parent);
|
||||||
for i:=0 to pane.Items.Count-1 do
|
for i := 0 to pane.Items.Count-1 do
|
||||||
if (pane.items[i] is TSpkRadioButton) and (pane.items[i] <> self) then
|
if (pane.Items[i] is TSpkRadioButton) then
|
||||||
TSpkRadioButton(pane.items[i]).State := cbUnchecked;
|
begin
|
||||||
|
rb := TSpkRadioButton(pane.Items[i]);
|
||||||
|
if (rb <> self) and (rb.GroupIndex = GroupIndex) then
|
||||||
|
rb.State := cbUnchecked;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user