mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 10:49:16 +02:00
added TToolButton.Action and published some props
git-svn-id: trunk@5162 -
This commit is contained in:
parent
033a8d0037
commit
d7b70bb93d
@ -37,9 +37,9 @@ unit ComCtrls;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, Classes, FPCAdds, LCLStrConsts, LCLIntf, LCLType, LCLProc,
|
SysUtils, Classes, Math, FPCAdds, LCLStrConsts, LCLIntf, LCLType, LCLProc,
|
||||||
AvgLvlTree, Controls, Forms, StdCtrls, ExtCtrls, vclGlobals, LMessages, Menus,
|
AvgLvlTree, vclGlobals, LMessages, ImgList, ActnList, GraphType, Graphics,
|
||||||
ImgList, GraphType, Graphics, ToolWin, CommCtrl, Buttons, Math;
|
Menus, Controls, Forms, StdCtrls, ExtCtrls, ToolWin, CommCtrl, Buttons;
|
||||||
|
|
||||||
type
|
type
|
||||||
TStatusPanelStyle = (psText, psOwnerDraw);
|
TStatusPanelStyle = (psText, psOwnerDraw);
|
||||||
@ -761,6 +761,20 @@ type
|
|||||||
TToolButton = class;
|
TToolButton = class;
|
||||||
|
|
||||||
|
|
||||||
|
{ TToolButtonActionLink }
|
||||||
|
|
||||||
|
TToolButtonActionLink = class(TControlActionLink)
|
||||||
|
protected
|
||||||
|
procedure AssignClient(AClient: TObject); override;
|
||||||
|
function IsCheckedLinked: Boolean; override;
|
||||||
|
function IsImageIndexLinked: Boolean; override;
|
||||||
|
procedure SetChecked(Value: Boolean); override;
|
||||||
|
procedure SetImageIndex(Value: Integer); override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TToolButtonActionLinkClass = class of TToolButtonActionLink;
|
||||||
|
|
||||||
|
|
||||||
TToolButton = class(TButtonControl)
|
TToolButton = class(TButtonControl)
|
||||||
private
|
private
|
||||||
FAllowAllUp: Boolean;
|
FAllowAllUp: Boolean;
|
||||||
@ -795,6 +809,8 @@ type
|
|||||||
procedure CMVisibleChanged(var Message: TLMessage); message CM_VISIBLECHANGED;
|
procedure CMVisibleChanged(var Message: TLMessage); message CM_VISIBLECHANGED;
|
||||||
protected
|
protected
|
||||||
FToolBar: TToolBar;
|
FToolBar: TToolBar;
|
||||||
|
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
|
||||||
|
function GetActionLinkClass: TControlActionLinkClass; override;
|
||||||
procedure AssignTo(Dest: TPersistent); override;
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
procedure BeginUpdate; virtual;
|
procedure BeginUpdate; virtual;
|
||||||
procedure EndUpdate; virtual;
|
procedure EndUpdate; virtual;
|
||||||
@ -813,6 +829,7 @@ type
|
|||||||
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
|
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
|
||||||
property Index: Integer read GetIndex;
|
property Index: Integer read GetIndex;
|
||||||
published
|
published
|
||||||
|
property Action;
|
||||||
property AllowAllUp: Boolean read FAllowAllUp write FAllowAllUp default False;
|
property AllowAllUp: Boolean read FAllowAllUp write FAllowAllUp default False;
|
||||||
property AutoSize default False;
|
property AutoSize default False;
|
||||||
property Caption;
|
property Caption;
|
||||||
@ -1955,6 +1972,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.106 2004/02/04 12:59:07 mattias
|
||||||
|
added TToolButton.Action and published some props
|
||||||
|
|
||||||
Revision 1.105 2004/02/02 20:00:45 mattias
|
Revision 1.105 2004/02/02 20:00:45 mattias
|
||||||
published TTreeView.Tab
|
published TTreeView.Tab
|
||||||
|
|
||||||
|
@ -15,6 +15,38 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ TToolButtonActionLink }
|
||||||
|
|
||||||
|
procedure TToolButtonActionLink.AssignClient(AClient: TObject);
|
||||||
|
begin
|
||||||
|
inherited AssignClient(AClient);
|
||||||
|
FClient := AClient as TToolButton;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TToolButtonActionLink.IsCheckedLinked: Boolean;
|
||||||
|
begin
|
||||||
|
Result := inherited IsCheckedLinked
|
||||||
|
and (TToolButton(FClient).Down = (Action as TCustomAction).Checked);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TToolButtonActionLink.IsImageIndexLinked: Boolean;
|
||||||
|
begin
|
||||||
|
Result := inherited IsImageIndexLinked
|
||||||
|
and (TToolButton(FClient).ImageIndex = (Action as TCustomAction).ImageIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TToolButtonActionLink.SetChecked(Value: Boolean);
|
||||||
|
begin
|
||||||
|
if IsCheckedLinked then TToolButton(FClient).Down := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TToolButtonActionLink.SetImageIndex(Value: Integer);
|
||||||
|
begin
|
||||||
|
if IsImageIndexLinked then TToolButton(FClient).ImageIndex := Value;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TToolButton }
|
||||||
|
|
||||||
constructor TToolButton.Create(AOwner: TComponent);
|
constructor TToolButton.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
@ -229,6 +261,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TToolButton.ActionChange(Sender: TObject; CheckDefaults: Boolean);
|
||||||
|
var
|
||||||
|
NewAction: TCustomAction;
|
||||||
|
begin
|
||||||
|
inherited ActionChange(Sender, CheckDefaults);
|
||||||
|
if Sender is TCustomAction then begin
|
||||||
|
NewAction:=TCustomAction(Sender);
|
||||||
|
if not CheckDefaults or (not Down) then
|
||||||
|
Down := NewAction.Checked;
|
||||||
|
if not CheckDefaults or (ImageIndex = -1) then
|
||||||
|
ImageIndex := NewAction.ImageIndex;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TToolButton.GetActionLinkClass: TControlActionLinkClass;
|
||||||
|
begin
|
||||||
|
Result:=TToolButtonActionLink;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TToolButton.CMEnabledChanged(var Message: TLMessage);
|
procedure TToolButton.CMEnabledChanged(var Message: TLMessage);
|
||||||
begin
|
begin
|
||||||
if FToolBar <> nil then
|
if FToolBar <> nil then
|
||||||
@ -454,6 +505,9 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.5 2004/02/04 12:59:08 mattias
|
||||||
|
added TToolButton.Action and published some props
|
||||||
|
|
||||||
Revision 1.4 2003/12/29 14:22:22 micha
|
Revision 1.4 2003/12/29 14:22:22 micha
|
||||||
fix a lot of range check errors win32
|
fix a lot of range check errors win32
|
||||||
|
|
||||||
|
@ -418,6 +418,7 @@ type
|
|||||||
property BorderStyle;
|
property BorderStyle;
|
||||||
property Constraints;
|
property Constraints;
|
||||||
property ExtendedSelect;
|
property ExtendedSelect;
|
||||||
|
property Font;
|
||||||
property Items;
|
property Items;
|
||||||
property ItemHeight;
|
property ItemHeight;
|
||||||
property MultiSelect;
|
property MultiSelect;
|
||||||
@ -438,6 +439,7 @@ type
|
|||||||
property OnMouseWheelUp;
|
property OnMouseWheelUp;
|
||||||
property OnResize;
|
property OnResize;
|
||||||
property ParentShowHint;
|
property ParentShowHint;
|
||||||
|
property ParentFont;
|
||||||
property PopupMenu;
|
property PopupMenu;
|
||||||
property ShowHint;
|
property ShowHint;
|
||||||
property Sorted;
|
property Sorted;
|
||||||
@ -1483,6 +1485,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.124 2004/02/04 12:59:07 mattias
|
||||||
|
added TToolButton.Action and published some props
|
||||||
|
|
||||||
Revision 1.123 2004/02/04 11:09:40 mattias
|
Revision 1.123 2004/02/04 11:09:40 mattias
|
||||||
added DefineProperties check for check lfm
|
added DefineProperties check for check lfm
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user