mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-17 04:21:00 +01:00
added child-parent checks
git-svn-id: trunk@5218 -
This commit is contained in:
parent
b65e8867cf
commit
39a7a94021
@ -79,6 +79,7 @@ type
|
|||||||
property OnMouseLeave : TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
|
property OnMouseLeave : TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
|
||||||
procedure SetParent(AParent: TWinControl); override;
|
procedure SetParent(AParent: TWinControl); override;
|
||||||
procedure SetText(const Value: TCaption); override;
|
procedure SetText(const Value: TCaption); override;
|
||||||
|
function ChildClassAllowed(ChildClass: TClass): boolean; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
published
|
published
|
||||||
@ -331,6 +332,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.59 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.58 2004/02/10 00:05:03 mattias
|
Revision 1.58 2004/02/10 00:05:03 mattias
|
||||||
TSpeedButton now uses MaskBlt
|
TSpeedButton now uses MaskBlt
|
||||||
|
|
||||||
|
|||||||
@ -799,7 +799,9 @@ type
|
|||||||
FLastButtonDrawFlags: Integer;
|
FLastButtonDrawFlags: Integer;
|
||||||
FMarked: Boolean;
|
FMarked: Boolean;
|
||||||
FMenuItem: TMenuItem;
|
FMenuItem: TMenuItem;
|
||||||
|
FMouseInControl: boolean;
|
||||||
FStyle: TToolButtonStyle;
|
FStyle: TToolButtonStyle;
|
||||||
|
FState: TToolButtonState;
|
||||||
FUpdateCount: Integer;
|
FUpdateCount: Integer;
|
||||||
FWrap: Boolean;
|
FWrap: Boolean;
|
||||||
function GetIndex: Integer;
|
function GetIndex: Integer;
|
||||||
@ -816,7 +818,10 @@ type
|
|||||||
procedure SetMenuItem(Value: TMenuItem);
|
procedure SetMenuItem(Value: TMenuItem);
|
||||||
procedure SetStyle(Value: TToolButtonStyle);
|
procedure SetStyle(Value: TToolButtonStyle);
|
||||||
procedure SetWrap(Value: Boolean);
|
procedure SetWrap(Value: Boolean);
|
||||||
|
procedure SetMouseInControl(NewMouseInControl: Boolean);
|
||||||
procedure CMHitTest(var Message: TCMHitTest); message CM_HITTEST;
|
procedure CMHitTest(var Message: TCMHitTest); message CM_HITTEST;
|
||||||
|
procedure CMMouseEnter(var Message: TLMessage); message CM_MouseEnter;
|
||||||
|
procedure CMMouseLeave(var Message: TLMessage); message CM_MouseLeave;
|
||||||
protected
|
protected
|
||||||
FToolBar: TToolBar;
|
FToolBar: TToolBar;
|
||||||
function GetActionLinkClass: TControlActionLinkClass; override;
|
function GetActionLinkClass: TControlActionLinkClass; override;
|
||||||
@ -838,6 +843,8 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
function CheckMenuDropdown: Boolean; dynamic;
|
function CheckMenuDropdown: Boolean; dynamic;
|
||||||
|
procedure GetCurrentIcon(var ImageList: TCustomImageList;
|
||||||
|
var Index: integer); virtual;
|
||||||
property Index: Integer read GetIndex;
|
property Index: Integer read GetIndex;
|
||||||
published
|
published
|
||||||
property Action;
|
property Action;
|
||||||
@ -884,11 +891,19 @@ type
|
|||||||
);
|
);
|
||||||
|
|
||||||
TToolBarFlags = set of TToolBarFlag;
|
TToolBarFlags = set of TToolBarFlag;
|
||||||
|
|
||||||
|
TToolBarButtonStyle = (
|
||||||
|
tbbsText,
|
||||||
|
tbbsIcon,
|
||||||
|
tbbsIconLeftOfText,
|
||||||
|
tbbsIconAboveText
|
||||||
|
);
|
||||||
|
|
||||||
TToolBar = class(TToolWindow)
|
TToolBar = class(TToolWindow)
|
||||||
private
|
private
|
||||||
FButtonHeight: Integer;
|
FButtonHeight: Integer;
|
||||||
FButtons: TList;
|
FButtons: TList;
|
||||||
|
FButtonStyle: TToolBarButtonStyle;
|
||||||
FButtonWidth: Integer;
|
FButtonWidth: Integer;
|
||||||
FDisabledImageChangeLink: TChangeLink;
|
FDisabledImageChangeLink: TChangeLink;
|
||||||
FDisabledImages: TCustomImageList;
|
FDisabledImages: TCustomImageList;
|
||||||
@ -911,6 +926,7 @@ type
|
|||||||
function GetButton(Index: Integer): TToolButton;
|
function GetButton(Index: Integer): TToolButton;
|
||||||
function GetButtonCount: Integer;
|
function GetButtonCount: Integer;
|
||||||
procedure SetButtonHeight(const AValue: Integer);
|
procedure SetButtonHeight(const AValue: Integer);
|
||||||
|
procedure SetButtonStyle(const AValue: TToolBarButtonStyle);
|
||||||
procedure SetButtonWidth(const AValue: Integer);
|
procedure SetButtonWidth(const AValue: Integer);
|
||||||
procedure SetDisabledImages(const AValue: TCustomImageList);
|
procedure SetDisabledImages(const AValue: TCustomImageList);
|
||||||
procedure SetFlat(const AValue: Boolean);
|
procedure SetFlat(const AValue: Boolean);
|
||||||
@ -960,6 +976,7 @@ type
|
|||||||
property BorderWidth;
|
property BorderWidth;
|
||||||
property ButtonHeight: Integer read FButtonHeight write SetButtonHeight default 22;
|
property ButtonHeight: Integer read FButtonHeight write SetButtonHeight default 22;
|
||||||
property ButtonWidth: Integer read FButtonWidth write SetButtonWidth default 23;
|
property ButtonWidth: Integer read FButtonWidth write SetButtonWidth default 23;
|
||||||
|
property ButtonStyle: TToolBarButtonStyle read FButtonStyle write SetButtonStyle default tbbsIcon;
|
||||||
property Caption;
|
property Caption;
|
||||||
property Color;
|
property Color;
|
||||||
property Ctl3D;
|
property Ctl3D;
|
||||||
@ -2232,6 +2249,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.111 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.110 2004/02/21 15:37:33 mattias
|
Revision 1.110 2004/02/21 15:37:33 mattias
|
||||||
moved compiler options to project menu, added -CX for smartlinking
|
moved compiler options to project menu, added -CX for smartlinking
|
||||||
|
|
||||||
|
|||||||
@ -843,6 +843,7 @@ type
|
|||||||
procedure CMVisibleChanged(var Message : TLMessage); message CM_VISIBLECHANGED;
|
procedure CMVisibleChanged(var Message : TLMessage); message CM_VISIBLECHANGED;
|
||||||
procedure Changed;
|
procedure Changed;
|
||||||
function GetPalette: HPalette; virtual;
|
function GetPalette: HPalette; virtual;
|
||||||
|
function ChildClassAllowed(ChildClass: TClass): boolean; virtual;
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
procedure AssignTo(Dest: TPersistent); override;
|
procedure AssignTo(Dest: TPersistent); override;
|
||||||
procedure BeginAutoDrag; dynamic;
|
procedure BeginAutoDrag; dynamic;
|
||||||
@ -952,6 +953,9 @@ type
|
|||||||
procedure Repaint; virtual;
|
procedure Repaint; virtual;
|
||||||
Procedure Invalidate; virtual;
|
Procedure Invalidate; virtual;
|
||||||
procedure AddControl; virtual;
|
procedure AddControl; virtual;
|
||||||
|
function CheckChildClassAllowed(ChildClass: TClass;
|
||||||
|
ExceptionOnInvalid: boolean): boolean;
|
||||||
|
procedure CheckNewParent(AParent: TWinControl); virtual;
|
||||||
Procedure DragDrop(Source: TObject; X,Y: Integer); Dynamic;
|
Procedure DragDrop(Source: TObject; X,Y: Integer); Dynamic;
|
||||||
procedure SendToBack;
|
procedure SendToBack;
|
||||||
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
procedure SetBounds(aLeft, aTop, aWidth, aHeight: integer); virtual;
|
||||||
@ -1286,6 +1290,7 @@ type
|
|||||||
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight : integer); override;
|
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight : integer); override;
|
||||||
procedure DoAutoSize; Override;
|
procedure DoAutoSize; Override;
|
||||||
procedure GetChildren(Proc : TGetChildProc; Root : TComponent); override;
|
procedure GetChildren(Proc : TGetChildProc; Root : TComponent); override;
|
||||||
|
function ChildClassAllowed(ChildClass: TClass): boolean; override;
|
||||||
procedure PaintControls(DC: HDC; First: TControl);
|
procedure PaintControls(DC: HDC; First: TControl);
|
||||||
procedure PaintHandler(var TheMessage: TLMPaint);
|
procedure PaintHandler(var TheMessage: TLMPaint);
|
||||||
procedure PaintWindow(DC: HDC); virtual;
|
procedure PaintWindow(DC: HDC); virtual;
|
||||||
@ -2361,6 +2366,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.178 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.177 2004/02/21 15:37:33 mattias
|
Revision 1.177 2004/02/21 15:37:33 mattias
|
||||||
moved compiler options to project menu, added -CX for smartlinking
|
moved compiler options to project menu, added -CX for smartlinking
|
||||||
|
|
||||||
|
|||||||
@ -135,7 +135,6 @@ type
|
|||||||
fPageIndex: Integer;
|
fPageIndex: Integer;
|
||||||
fPageIndexOnLastChange: integer;
|
fPageIndexOnLastChange: integer;
|
||||||
fPageList: TList; // List of TCustomPage
|
fPageList: TList; // List of TCustomPage
|
||||||
//fMultiLine: boolean;
|
|
||||||
fOnPageChanged: TNotifyEvent;
|
fOnPageChanged: TNotifyEvent;
|
||||||
fShowTabs: Boolean;
|
fShowTabs: Boolean;
|
||||||
fTabPosition: TTabPosition;
|
fTabPosition: TTabPosition;
|
||||||
@ -150,12 +149,10 @@ type
|
|||||||
function GetPageCount : integer;
|
function GetPageCount : integer;
|
||||||
function GetPageIndex: Integer;
|
function GetPageIndex: Integer;
|
||||||
function IsStoredActivePage: boolean;
|
function IsStoredActivePage: boolean;
|
||||||
//function InternalSetMultiLine(Value: boolean): boolean;
|
|
||||||
procedure SetActivePage(const Value: String);
|
procedure SetActivePage(const Value: String);
|
||||||
procedure SetActivePageComponent(const AValue: TCustomPage);
|
procedure SetActivePageComponent(const AValue: TCustomPage);
|
||||||
procedure SetImages(const AValue: TImageList);
|
procedure SetImages(const AValue: TImageList);
|
||||||
procedure SetOptions(const AValue: TNoteBookOptions);
|
procedure SetOptions(const AValue: TNoteBookOptions);
|
||||||
//procedure SetMultiLine(Value: boolean);
|
|
||||||
procedure SetPageIndex(AValue: Integer);
|
procedure SetPageIndex(AValue: Integer);
|
||||||
procedure SetPages(AValue: TStrings);
|
procedure SetPages(AValue: TStrings);
|
||||||
procedure SetShowTabs(AValue: Boolean);
|
procedure SetShowTabs(AValue: Boolean);
|
||||||
@ -171,6 +168,7 @@ type
|
|||||||
procedure ReadState(Reader: TAbstractReader); override;
|
procedure ReadState(Reader: TAbstractReader); override;
|
||||||
procedure ShowControl(APage: TControl); override;
|
procedure ShowControl(APage: TControl); override;
|
||||||
procedure UpdateTabProperties; virtual;
|
procedure UpdateTabProperties; virtual;
|
||||||
|
function ChildClassAllowed(ChildClass: TClass): boolean; override;
|
||||||
property ActivePageComponent: TCustomPage read GetActivePageComponent
|
property ActivePageComponent: TCustomPage read GetActivePageComponent
|
||||||
write SetActivePageComponent;
|
write SetActivePageComponent;
|
||||||
property ActivePage: String read GetActivePage write SetActivePage
|
property ActivePage: String read GetActivePage write SetActivePage
|
||||||
@ -925,6 +923,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.98 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.97 2004/02/21 01:01:03 mattias
|
Revision 1.97 2004/02/21 01:01:03 mattias
|
||||||
added uninstall popupmenuitem to package graph explorer
|
added uninstall popupmenuitem to package graph explorer
|
||||||
|
|
||||||
|
|||||||
@ -50,8 +50,8 @@ interface
|
|||||||
{$endif}
|
{$endif}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
SysUtils, Classes, FPCAdds, LCLStrConsts, vclGlobals, LCLProc, Graphics,
|
SysUtils, Classes, FPCAdds, LCLStrConsts, LResources, vclGlobals, LCLProc,
|
||||||
GraphType;
|
Graphics, GraphType;
|
||||||
|
|
||||||
type
|
type
|
||||||
TImageIndex = type integer;
|
TImageIndex = type integer;
|
||||||
@ -154,6 +154,7 @@ type
|
|||||||
function AddIcon(Image: TIcon): Integer;
|
function AddIcon(Image: TIcon): Integer;
|
||||||
procedure AddImages(Value: TCustomImageList);
|
procedure AddImages(Value: TCustomImageList);
|
||||||
function AddMasked(Image: TBitmap; MaskColor: TColor): Integer;
|
function AddMasked(Image: TBitmap; MaskColor: TColor): Integer;
|
||||||
|
function AddFromLazarusResource(const ResourceName: string): integer;
|
||||||
procedure Change;
|
procedure Change;
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
constructor CreateSize(AWidth, AHeight: Integer);
|
constructor CreateSize(AWidth, AHeight: Integer);
|
||||||
@ -210,6 +211,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.15 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.14 2004/02/02 19:13:31 mattias
|
Revision 1.14 2004/02/02 19:13:31 mattias
|
||||||
started reading TImageList in Delphi format
|
started reading TImageList in Delphi format
|
||||||
|
|
||||||
|
|||||||
@ -163,9 +163,19 @@ begin
|
|||||||
CNSendMessage(LM_SETSHORTCUT, Self, @FShortcut);
|
CNSendMessage(LM_SETSHORTCUT, Self, @FShortcut);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TButton.ChildClassAllowed(ChildClass: TClass): boolean;
|
||||||
|
begin
|
||||||
|
// no childs
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.17 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.16 2004/01/21 10:19:16 micha
|
Revision 1.16 2004/01/21 10:19:16 micha
|
||||||
enable tabstops for controls; implement tabstops in win32 intf
|
enable tabstops for controls; implement tabstops in win32 intf
|
||||||
|
|
||||||
|
|||||||
@ -685,6 +685,11 @@ begin
|
|||||||
Result:=0;
|
Result:=0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TControl.ChildClassAllowed(ChildClass: TClass): boolean;
|
||||||
|
begin
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
procedure TControl.DoOnResize;
|
procedure TControl.DoOnResize;
|
||||||
|
|
||||||
@ -1643,6 +1648,40 @@ begin
|
|||||||
CNSendMessage(LM_AddChild, Self, nil);
|
CNSendMessage(LM_AddChild, Self, nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
function TControl.CheckChildClassAllowed(ChildClass: TClass;
|
||||||
|
ExceptionOnInvalid: boolean): boolean;
|
||||||
|
|
||||||
|
Checks if this control can be the parent of a control of class ChildClass.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TControl.CheckChildClassAllowed(ChildClass: TClass;
|
||||||
|
ExceptionOnInvalid: boolean): boolean;
|
||||||
|
|
||||||
|
procedure RaiseInvalidChild;
|
||||||
|
begin
|
||||||
|
raise Exception.Create(ClassName+' can not have '+ChildClass.ClassName+' as child');
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Result:=ChildClassAllowed(ChildClass);
|
||||||
|
if (not Result) and ExceptionOnInvalid then
|
||||||
|
RaiseInvalidChild;
|
||||||
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
procedure TControl.CheckNewParent(AParent: TWinControl);
|
||||||
|
|
||||||
|
Checks if this control can be the child of AParent.
|
||||||
|
This check is executed in SetParent.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
procedure TControl.CheckNewParent(AParent: TWinControl);
|
||||||
|
begin
|
||||||
|
if (AParent<>nil) then AParent.CheckChildClassAllowed(ClassType,true);
|
||||||
|
if AParent = Self then begin
|
||||||
|
raise EInvalidOperation.Create('A control can not have itself as parent');
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TControl SetAutoSize
|
TControl SetAutoSize
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -2218,20 +2257,10 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Procedure TControl.SetParent(AParent : TWinControl);
|
Procedure TControl.SetParent(AParent : TWinControl);
|
||||||
begin
|
begin
|
||||||
{ if AParent = nil
|
if FParent = AParent then exit;
|
||||||
then Assert(False, Format('Trace:[TControl.SetParent] %s --> Parent: nil', [ClassName]))
|
CheckNewParent(AParent);
|
||||||
else Assert(False, Format('Trace:[TControl.SetParent] %s --> Parent: %s', [ClassName, AParent.ClassName]));
|
if FParent <> nil then FParent.RemoveControl(Self);
|
||||||
}
|
if AParent <> nil then AParent.InsertControl(Self);
|
||||||
if FParent <> AParent
|
|
||||||
then begin
|
|
||||||
if AParent = Self
|
|
||||||
then begin
|
|
||||||
Assert(False, 'Trace:[TControl.SetParent] EInvalidOperation --> FParent = Self');
|
|
||||||
raise EInvalidOperation.Create('A control can''t have itself as parent');
|
|
||||||
end;
|
|
||||||
if FParent <> nil then FParent.RemoveControl(Self);
|
|
||||||
if AParent <> nil then AParent.InsertControl(Self);
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TControl.SetParentColor(Value : Boolean);
|
procedure TControl.SetParentColor(Value : Boolean);
|
||||||
@ -2769,6 +2798,9 @@ end;
|
|||||||
|
|
||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.171 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.170 2004/02/21 15:37:33 mattias
|
Revision 1.170 2004/02/21 15:37:33 mattias
|
||||||
moved compiler options to project menu, added -CX for smartlinking
|
moved compiler options to project menu, added -CX for smartlinking
|
||||||
|
|
||||||
|
|||||||
@ -308,6 +308,15 @@ begin
|
|||||||
inherited SetText(Value);
|
inherited SetText(Value);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
function TCustomEdit.ChildClassAllowed(ChildClass: TClass): boolean;
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TCustomEdit.ChildClassAllowed(ChildClass: TClass): boolean;
|
||||||
|
begin
|
||||||
|
// no childs
|
||||||
|
Result:=false;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCustomEdit.SetModified
|
Method: TCustomEdit.SetModified
|
||||||
Params: Value to set FModified to
|
Params: Value to set FModified to
|
||||||
@ -357,6 +366,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.23 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.22 2004/02/04 00:04:37 mattias
|
Revision 1.22 2004/02/04 00:04:37 mattias
|
||||||
added some TEdit ideas to TSpinEdit
|
added some TEdit ideas to TSpinEdit
|
||||||
|
|
||||||
|
|||||||
@ -116,6 +116,5 @@ begin
|
|||||||
FEditLabel.FocusControl := Self;
|
FEditLabel.FocusControl := Self;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
// included by extctrls.pp
|
// included by extctrls.pp
|
||||||
|
|
||||||
|
|||||||
@ -315,7 +315,7 @@ begin
|
|||||||
if PageClass=nil then
|
if PageClass=nil then
|
||||||
RaiseGDBException('');
|
RaiseGDBException('');
|
||||||
inherited Create(TheOwner);
|
inherited Create(TheOwner);
|
||||||
{create the control}
|
|
||||||
fCompStyle := csNoteBook;
|
fCompStyle := csNoteBook;
|
||||||
|
|
||||||
fPageList := TList.Create;
|
fPageList := TList.Create;
|
||||||
@ -655,6 +655,11 @@ begin
|
|||||||
CNSendMessage(LM_NB_UpdateTab, Page[i], nil);
|
CNSendMessage(LM_NB_UpdateTab, Page[i], nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomNotebook.ChildClassAllowed(ChildClass: TClass): boolean;
|
||||||
|
begin
|
||||||
|
Result:=(ChildClass<>nil) and (ChildClass=PageClass);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
TCustomNotebook Change
|
TCustomNotebook Change
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
@ -787,6 +792,9 @@ end;}
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.42 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.41 2004/01/21 10:19:16 micha
|
Revision 1.41 2004/01/21 10:19:16 micha
|
||||||
enable tabstops for controls; implement tabstops in win32 intf
|
enable tabstops for controls; implement tabstops in win32 intf
|
||||||
|
|
||||||
|
|||||||
@ -89,6 +89,7 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
if AParent=Parent then exit;
|
if AParent=Parent then exit;
|
||||||
|
CheckNewParent(AParent);
|
||||||
|
|
||||||
OldParent:=Parent;
|
OldParent:=Parent;
|
||||||
if (OldParent<>AParent) and (OldParent<>nil)
|
if (OldParent<>AParent) and (OldParent<>nil)
|
||||||
|
|||||||
@ -165,6 +165,22 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{------------------------------------------------------------------------------
|
||||||
|
function TCustomImageList.AddFromLazarusResource(const ResourceName: string
|
||||||
|
): integer;
|
||||||
|
|
||||||
|
Load TBitmap from lazarus resources and add it.
|
||||||
|
------------------------------------------------------------------------------}
|
||||||
|
function TCustomImageList.AddFromLazarusResource(const ResourceName: string
|
||||||
|
): integer;
|
||||||
|
var
|
||||||
|
ABitmap: TBitmap;
|
||||||
|
begin
|
||||||
|
ABitmap:=TBitmap.Create;
|
||||||
|
ABitmap.LoadFromLazarusResource(ResourceName);
|
||||||
|
Result:=AddDirect(ABitmap,nil);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCustomImageList.AllocBitmap
|
Method: TCustomImageList.AllocBitmap
|
||||||
Params: Amount: the amount of free image position which should be availabe
|
Params: Amount: the amount of free image position which should be availabe
|
||||||
@ -1066,6 +1082,9 @@ end;
|
|||||||
{
|
{
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.23 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.22 2004/02/02 21:31:08 mattias
|
Revision 1.22 2004/02/02 21:31:08 mattias
|
||||||
reduced output
|
reduced output
|
||||||
|
|
||||||
|
|||||||
@ -34,6 +34,7 @@ begin
|
|||||||
csDoubleClicks, csMenuEvents, csSetCaption];
|
csDoubleClicks, csMenuEvents, csSetCaption];
|
||||||
FButtonWidth := 23;
|
FButtonWidth := 23;
|
||||||
FButtonHeight := 22;
|
FButtonHeight := 22;
|
||||||
|
FButtonStyle := tbbsIcon;
|
||||||
FDropDownWidth := 10;
|
FDropDownWidth := 10;
|
||||||
FNewStyle := True;
|
FNewStyle := True;
|
||||||
FWrapable := True;
|
FWrapable := True;
|
||||||
@ -142,7 +143,7 @@ begin
|
|||||||
UpdateVisibleBar;
|
UpdateVisibleBar;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
writeln('TToolBar.ControlsAligned START');
|
//writeln('TToolBar.ControlsAligned START');
|
||||||
// ToDo
|
// ToDo
|
||||||
// hack: stupid put in a row
|
// hack: stupid put in a row
|
||||||
for i:=0 to ControlCount-1 do begin
|
for i:=0 to ControlCount-1 do begin
|
||||||
@ -151,9 +152,9 @@ begin
|
|||||||
NewTop:=0;
|
NewTop:=0;
|
||||||
NewWidth:=ButtonWidth;
|
NewWidth:=ButtonWidth;
|
||||||
NewHeight:=ButtonHeight;
|
NewHeight:=ButtonHeight;
|
||||||
writeln('TToolBar.ControlsAligned ',CurControl.Name,
|
//writeln('TToolBar.ControlsAligned ',CurControl.Name,
|
||||||
' Old=',CurControl.Left,',',CurControl.Top,',',CurControl.Width,',',CurControl.Height,
|
// ' Old=',CurControl.Left,',',CurControl.Top,',',CurControl.Width,',',CurControl.Height,
|
||||||
' New=',NewLeft,',',NewTop,',',NewWidth,',',NewHeight);
|
// ' New=',NewLeft,',',NewTop,',',NewWidth,',',NewHeight);
|
||||||
CurControl.SetBoundsKeepBase(NewLeft,NewTop,NewWidth,NewHeight,true);
|
CurControl.SetBoundsKeepBase(NewLeft,NewTop,NewWidth,NewHeight,true);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -186,6 +187,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TToolBar.SetButtonStyle(const AValue: TToolBarButtonStyle);
|
||||||
|
begin
|
||||||
|
if FButtonStyle=AValue then exit;
|
||||||
|
FButtonStyle:=AValue;
|
||||||
|
UpdateVisibleBar;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TToolBar.SetButtonWidth(const AValue: Integer);
|
procedure TToolBar.SetButtonWidth(const AValue: Integer);
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -322,7 +330,6 @@ begin
|
|||||||
Include(FToolBarFlags,tbfUpdateVisibleBarNeeded);
|
Include(FToolBarFlags,tbfUpdateVisibleBarNeeded);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
writeln('TToolBar.UpdateVisibleBar');
|
|
||||||
ReAlign;
|
ReAlign;
|
||||||
Invalidate;
|
Invalidate;
|
||||||
Exclude(FToolBarFlags,tbfUpdateVisibleBarNeeded);
|
Exclude(FToolBarFlags,tbfUpdateVisibleBarNeeded);
|
||||||
@ -1931,6 +1938,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.20 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.19 2004/02/21 15:37:33 mattias
|
Revision 1.19 2004/02/21 15:37:33 mattias
|
||||||
moved compiler options to project menu, added -CX for smartlinking
|
moved compiler options to project menu, added -CX for smartlinking
|
||||||
|
|
||||||
|
|||||||
@ -55,6 +55,7 @@ begin
|
|||||||
fCompStyle := csToolButton;
|
fCompStyle := csToolButton;
|
||||||
FImageIndex := -1;
|
FImageIndex := -1;
|
||||||
FStyle := tbsButton;
|
FStyle := tbsButton;
|
||||||
|
FState:=tbsEnabled;
|
||||||
ControlStyle := [csCaptureMouse, csSetCaption];
|
ControlStyle := [csCaptureMouse, csSetCaption];
|
||||||
SetInitialBounds(0,0,23,22);
|
SetInitialBounds(0,0,23,22);
|
||||||
end;
|
end;
|
||||||
@ -62,28 +63,33 @@ end;
|
|||||||
procedure TToolButton.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
procedure TToolButton.MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: Integer);
|
X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
|
SetMouseInControl(true);
|
||||||
if (Style=tbsDropDown) and (Button=mbLeft) and Enabled then
|
if (Style=tbsDropDown) and (Button=mbLeft) and Enabled then
|
||||||
// switch
|
// switch
|
||||||
Down := not Down;
|
Down := not Down;
|
||||||
|
if (Style=tbsCheck) and (Button=mbLeft) and Enabled then begin
|
||||||
|
;
|
||||||
|
end;
|
||||||
inherited MouseDown(Button,Shift,X,Y);
|
inherited MouseDown(Button,Shift,X,Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TToolButton.MouseMove(Shift: TShiftState; X, Y: Integer);
|
procedure TToolButton.MouseMove(Shift: TShiftState; X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
|
SetMouseInControl((X>=0) and (X<ClientWidth) and (Y>=0) and (Y<ClientHeight));
|
||||||
inherited MouseMove(Shift, X, Y);
|
inherited MouseMove(Shift, X, Y);
|
||||||
if (Style=tbsDropDown) and MouseCapture then
|
if (Style=tbsDropDown) and MouseCapture then
|
||||||
// while dragging: down when mouse in, and up, when mouse out of control
|
// while dragging: down when mouse in, and up, when mouse out of control
|
||||||
Down := (X>=0) and (X<ClientWidth) and (Y>=0) and (Y<ClientHeight);
|
Down := FMouseInControl;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TToolButton.MouseUp(Button: TMouseButton; Shift: TShiftState;
|
procedure TToolButton.MouseUp(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: Integer);
|
X, Y: Integer);
|
||||||
begin
|
begin
|
||||||
|
SetMouseInControl(true);
|
||||||
inherited MouseUp(Button, Shift, X, Y);
|
inherited MouseUp(Button, Shift, X, Y);
|
||||||
if (Button=mbLeft) and (X>=0) and (X<ClientWidth) and (Y>=0) and
|
if (Button=mbLeft) and FMouseInControl then begin
|
||||||
(Y<ClientHeight)
|
|
||||||
then begin
|
|
||||||
if Style=tbsDropDown then Down:=False;
|
if Style=tbsDropDown then Down:=False;
|
||||||
|
if Style=tbsCheck then Down:=false;
|
||||||
Click;
|
Click;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -101,18 +107,40 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TToolButton.Paint;
|
procedure TToolButton.Paint;
|
||||||
|
|
||||||
|
procedure DrawDropDownArrow(const DropDownButtonRect: TRect);
|
||||||
|
var
|
||||||
|
ArrowRect: TRect;
|
||||||
|
Points: array[1..3] of TPoint;
|
||||||
|
begin
|
||||||
|
ArrowRect:=DropDownButtonRect;
|
||||||
|
ArrowRect.Left:=DropDownButtonRect.Left+2;
|
||||||
|
ArrowRect.Right:=Max(DropDownButtonRect.Right-2,ArrowRect.Left);
|
||||||
|
ArrowRect.Top:=(DropDownButtonRect.Top+DropDownButtonRect.Bottom
|
||||||
|
+ArrowRect.Left-ArrowRect.Right) div 2;
|
||||||
|
ArrowRect.Bottom:=ArrowRect.Top-ArrowRect.Left+ArrowRect.Right;
|
||||||
|
Points[1]:=Point(ArrowRect.Left,ArrowRect.Top);
|
||||||
|
Points[2]:=Point((ArrowRect.Left+ArrowRect.Right) div 2,ArrowRect.Bottom);
|
||||||
|
Points[3]:=Point(ArrowRect.Right,ArrowRect.Top);
|
||||||
|
Canvas.Brush.Color:=clBlack;
|
||||||
|
Canvas.Pen.Color:=clBlack;
|
||||||
|
Canvas.Polygon(@Points[1],3);
|
||||||
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
PaintRect: TRect;
|
PaintRect: TRect;
|
||||||
ButtonRect: TRect;
|
ButtonRect: TRect;
|
||||||
DropDownButtonRect: TRect;
|
DropDownButtonRect: TRect;
|
||||||
DividerRect: TRect;
|
DividerRect: TRect;
|
||||||
IconWidth: Integer;
|
TextSize: TSize;
|
||||||
IconHeight: Integer;
|
TextPos: TPoint;
|
||||||
IconLeft: Integer;
|
IconSize: TPoint;
|
||||||
IconTop: Integer;
|
IconPos: TPoint;
|
||||||
|
ImgList: TCustomImageList;
|
||||||
|
ImgIndex: integer;
|
||||||
begin
|
begin
|
||||||
writeln('TToolButton.Paint A FToolBar=',HexStr(Cardinal(FToolBar),8),' ',ClientWidth,',',ClientHeight);
|
writeln('TToolButton.Paint A ',Name,' FToolBar=',HexStr(Cardinal(FToolBar),8),' ',ClientWidth,',',ClientHeight,' ',ord(Style));
|
||||||
if FToolBar<>nil then begin
|
if (FToolBar<>nil) and (ClientWidth>0) and (ClientHeight>0) then begin
|
||||||
PaintRect:=ClientRect; // the whole paint area
|
PaintRect:=ClientRect; // the whole paint area
|
||||||
|
|
||||||
// calculate button area(s)
|
// calculate button area(s)
|
||||||
@ -123,29 +151,81 @@ begin
|
|||||||
ButtonRect.Right:=DropDownButtonRect.Left;
|
ButtonRect.Right:=DropDownButtonRect.Left;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// calculate text size
|
||||||
|
TextSize.cx:=0;
|
||||||
|
TextSize.cy:=0;
|
||||||
|
if Style in [tbsButton,tbsDropDown,tbsCheck] then begin
|
||||||
|
if (Caption<>'')
|
||||||
|
and (FToolBar.ButtonStyle
|
||||||
|
in [tbbsText,tbbsIconAboveText,tbbsIconLeftOfText])
|
||||||
|
then begin
|
||||||
|
TextSize:=Canvas.TextExtent(Caption);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// calculate icon size
|
||||||
|
IconSize:=Point(0,0);
|
||||||
|
GetCurrentIcon(ImgList,ImgIndex);
|
||||||
|
if (ImgList<>nil) then
|
||||||
|
IconSize:=Point(ImgList.Width,ImgList.Height);
|
||||||
|
|
||||||
|
// calculate text and icon position
|
||||||
|
TextPos:=Point(0,0);
|
||||||
|
IconPos:=Point(0,0);
|
||||||
|
case FToolBar.ButtonStyle of
|
||||||
|
|
||||||
|
tbbsText:
|
||||||
|
begin
|
||||||
|
TextPos.X:=(ButtonRect.Left+ButtonRect.Right-TextSize.cx) div 2;
|
||||||
|
TextPos.Y:=(ButtonRect.Top+ButtonRect.Bottom-TextSize.cy) div 2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
tbbsIcon:
|
||||||
|
begin
|
||||||
|
IconPos.X:=(ButtonRect.Left+ButtonRect.Right-IconSize.x) div 2;
|
||||||
|
IconPos.Y:=(ButtonRect.Top+ButtonRect.Bottom-IconSize.y) div 2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
tbbsIconLeftOfText:
|
||||||
|
begin
|
||||||
|
IconPos.X:=(ButtonRect.Left+ButtonRect.Right-IconSize.x-TextSize.cy-2) div 2;
|
||||||
|
IconPos.Y:=(ButtonRect.Top+ButtonRect.Bottom-IconSize.y) div 2;
|
||||||
|
TextPos.X:=IconPos.X+2;
|
||||||
|
TextPos.Y:=(ButtonRect.Top+ButtonRect.Bottom-TextSize.cy) div 2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
tbbsIconAboveText:
|
||||||
|
begin
|
||||||
|
IconPos.X:=(ButtonRect.Left+ButtonRect.Right-IconSize.x) div 2;
|
||||||
|
IconPos.Y:=(ButtonRect.Top+ButtonRect.Bottom-IconSize.y-TextSize.cy-2) div 2;
|
||||||
|
TextPos.X:=(ButtonRect.Left+ButtonRect.Right-TextSize.cx) div 2;
|
||||||
|
TextPos.Y:=IconPos.Y+IconSize.Y+2;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
// draw button
|
// draw button
|
||||||
FLastButtonDrawFlags:=GetButtonDrawFlags;
|
FLastButtonDrawFlags:=GetButtonDrawFlags;
|
||||||
if Style in [tbsButton,tbsDropDown,tbsCheck] then begin
|
if Style in [tbsButton,tbsDropDown,tbsCheck] then begin
|
||||||
DrawFrameControl(Canvas.GetUpdatedHandle([csBrushValid,csPenValid]),
|
DrawFrameControl(Canvas.GetUpdatedHandle([csBrushValid,csPenValid]),
|
||||||
ButtonRect, DFC_BUTTON, FLastButtonDrawFlags);
|
PaintRect{ButtonRect}, DFC_BUTTON, FLastButtonDrawFlags);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// draw dropdown button
|
// draw dropdown button
|
||||||
if Style in [tbsDropDown] then begin
|
if Style in [tbsDropDown] then begin
|
||||||
DrawFrameControl(Canvas.GetUpdatedHandle([csBrushValid,csPenValid]),
|
//DrawFrameControl(Canvas.GetUpdatedHandle([csBrushValid,csPenValid]),
|
||||||
DropDownButtonRect, DFC_BUTTON, FLastButtonDrawFlags);
|
// DropDownButtonRect, DFC_BUTTON, FLastButtonDrawFlags);
|
||||||
|
DrawDropDownArrow(DropDownButtonRect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// draw icon
|
// draw icon
|
||||||
if (Style in [tbsButton,tbsDropDown,tbsCheck])
|
if (ImgList<>nil) then begin
|
||||||
and (ImageIndex>=0) and (FToolBar.Images<>nil)
|
ImgList.Draw(Canvas,IconPos.X,IconPos.Y,ImgIndex,true);
|
||||||
and (FToolBar.Images.Count>ImageIndex) then begin
|
end;
|
||||||
IconWidth:=FToolBar.Images.Width;
|
|
||||||
IconHeight:=FToolBar.Images.Height;
|
// draw text
|
||||||
IconLeft:=(ButtonRect.Left+ButtonRect.Right-IconWidth) div 2;
|
if (TextSize.cx>0) then begin
|
||||||
IconTop:=(ButtonRect.Top+ButtonRect.Bottom-IconHeight) div 2;
|
Canvas.TextOut(TextPos.X,TextPos.Y,Caption);
|
||||||
FToolBar.Images.Draw(Canvas,IconLeft,IconTop,ImageIndex,
|
|
||||||
Enabled and not Indeterminate);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// draw separator (at runtime: just space, at designtime: a rectangle)
|
// draw separator (at runtime: just space, at designtime: a rectangle)
|
||||||
@ -157,9 +237,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// draw divider
|
// draw divider
|
||||||
if (Style in [tbsSeparator,tbsDivider]) then begin
|
if (Style in [tbsDivider]) then begin
|
||||||
DividerRect.Left:=(ButtonRect.Left+ButtonRect.Right) div 2;
|
DividerRect.Left:=((ButtonRect.Left+ButtonRect.Right) div 2)-2;
|
||||||
DividerRect.Right:=DividerRect.Left+2;
|
DividerRect.Right:=DividerRect.Left+4;
|
||||||
DividerRect.Top:=2;
|
DividerRect.Top:=2;
|
||||||
DividerRect.Bottom:=Max(DividerRect.Top,PaintRect.Bottom-2);
|
DividerRect.Bottom:=Max(DividerRect.Top,PaintRect.Bottom-2);
|
||||||
DrawEdge(Canvas.Handle,DividerRect,EDGE_ETCHED,BF_LEFT);
|
DrawEdge(Canvas.Handle,DividerRect,EDGE_ETCHED,BF_LEFT);
|
||||||
@ -209,13 +289,23 @@ begin
|
|||||||
Message.Result := 0;
|
Message.Result := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TToolButton.CMMouseEnter(var Message: TLMessage);
|
||||||
|
begin
|
||||||
|
SetMouseInControl(true);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TToolButton.CMMouseLeave(var Message: TLMessage);
|
||||||
|
begin
|
||||||
|
SetMouseInControl(false);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TToolButton.SetDown(Value: Boolean);
|
procedure TToolButton.SetDown(Value: Boolean);
|
||||||
begin
|
begin
|
||||||
if Value = FDown then exit;
|
if Value = FDown then exit;
|
||||||
FDown := Value;
|
FDown := Value;
|
||||||
if FToolBar <> nil then begin
|
Invalidate;
|
||||||
|
if FToolBar <> nil then
|
||||||
FToolBar.ToolButtonDown(Self,FDown);
|
FToolBar.ToolButtonDown(Self,FDown);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TToolButton.SetDropdownMenu(Value: TPopupMenu);
|
procedure TToolButton.SetDropdownMenu(Value: TPopupMenu);
|
||||||
@ -293,6 +383,13 @@ begin
|
|||||||
RefreshControl;
|
RefreshControl;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TToolButton.SetMouseInControl(NewMouseInControl: Boolean);
|
||||||
|
begin
|
||||||
|
if FMouseInControl=NewMouseInControl then exit;
|
||||||
|
FMouseInControl:=NewMouseInControl;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TToolButton.BeginUpdate;
|
procedure TToolButton.BeginUpdate;
|
||||||
begin
|
begin
|
||||||
Inc(FUpdateCount);
|
Inc(FUpdateCount);
|
||||||
@ -334,6 +431,36 @@ begin
|
|||||||
and (FToolBar <> nil) and FToolBar.CheckMenuDropdown(Self);
|
and (FToolBar <> nil) and FToolBar.CheckMenuDropdown(Self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TToolButton.GetCurrentIcon(var ImageList: TCustomImageList;
|
||||||
|
var Index: integer);
|
||||||
|
begin
|
||||||
|
ImageList:=nil;
|
||||||
|
Index:=-1;
|
||||||
|
if (ImageIndex<0) or (FToolBar=nil) then exit;
|
||||||
|
|
||||||
|
if Style in [tbsButton,tbsDropDown,tbsCheck] then begin
|
||||||
|
if (FToolBar.ButtonStyle in [tbbsText,tbbsIconAboveText,tbbsIconLeftOfText])
|
||||||
|
then begin
|
||||||
|
Index:=ImageIndex;
|
||||||
|
if Enabled and FMouseInControl then
|
||||||
|
// if mouse over button then use HotImages
|
||||||
|
ImageList:=FToolBar.HotImages
|
||||||
|
else if not Enabled then
|
||||||
|
// if button disabled then use HotImages
|
||||||
|
ImageList:=FToolBar.DisabledImages;
|
||||||
|
if (ImageList=nil) or (ImageList.Count<=ImageIndex) then begin
|
||||||
|
// if no special icon available, then try the default Images
|
||||||
|
ImageList:=FToolBar.Images;
|
||||||
|
if (ImageList=nil) or (ImageList.Count<=ImageIndex) then begin
|
||||||
|
// no icon available
|
||||||
|
ImageList:=nil;
|
||||||
|
Index:=-1;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TToolButton.IsCheckedStored: Boolean;
|
function TToolButton.IsCheckedStored: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := (ActionLink = nil)
|
Result := (ActionLink = nil)
|
||||||
@ -360,7 +487,8 @@ begin
|
|||||||
Result:=DFCS_BUTTONPUSH;
|
Result:=DFCS_BUTTONPUSH;
|
||||||
if FDown then inc(Result,DFCS_PUSHED);
|
if FDown then inc(Result,DFCS_PUSHED);
|
||||||
if not Enabled then inc(Result,DFCS_INACTIVE);
|
if not Enabled then inc(Result,DFCS_INACTIVE);
|
||||||
if Down and (not (csDesigning in ComponentState)) then
|
if (not (csDesigning in ComponentState)) and (not FMouseInControl)
|
||||||
|
and (not FDown) then
|
||||||
inc(Result,DFCS_FLAT);
|
inc(Result,DFCS_FLAT);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -368,6 +496,7 @@ procedure TToolButton.SetParent(AParent: TWinControl);
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
|
CheckNewParent(AParent);
|
||||||
if AParent=Parent then exit;
|
if AParent=Parent then exit;
|
||||||
|
|
||||||
// remove from old button list
|
// remove from old button list
|
||||||
@ -864,6 +993,9 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.10 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.9 2004/02/21 15:37:33 mattias
|
Revision 1.9 2004/02/21 15:37:33 mattias
|
||||||
moved compiler options to project menu, added -CX for smartlinking
|
moved compiler options to project menu, added -CX for smartlinking
|
||||||
|
|
||||||
|
|||||||
@ -834,6 +834,16 @@ Begin
|
|||||||
end;
|
end;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
{-------------------------------------------------------------------------------
|
||||||
|
function TWinControl.ChildClassAllowed(ChildClass: TClass): boolean;
|
||||||
|
|
||||||
|
Allow TControl as child.
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
function TWinControl.ChildClassAllowed(ChildClass: TClass): boolean;
|
||||||
|
begin
|
||||||
|
Result:=(ChildClass<>nil) and ChildClass.InheritsFrom(TControl);
|
||||||
|
end;
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
TWinControl GetClientOrigin
|
TWinControl GetClientOrigin
|
||||||
Result: TPoint
|
Result: TPoint
|
||||||
@ -3378,6 +3388,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.203 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.202 2004/02/21 15:37:33 mattias
|
Revision 1.202 2004/02/21 15:37:33 mattias
|
||||||
moved compiler options to project menu, added -CX for smartlinking
|
moved compiler options to project menu, added -CX for smartlinking
|
||||||
|
|
||||||
|
|||||||
@ -6720,7 +6720,7 @@ begin
|
|||||||
csToolButton:
|
csToolButton:
|
||||||
begin
|
begin
|
||||||
{$IFDEF NewToolBar}
|
{$IFDEF NewToolBar}
|
||||||
p := gtk_button_new_with_label(StrTemp);
|
p := gtk_fixed_new();
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
AccelText := Ampersands2Underscore(StrTemp);
|
AccelText := Ampersands2Underscore(StrTemp);
|
||||||
//p := gtk_button_new_with_label(StrTemp);
|
//p := gtk_button_new_with_label(StrTemp);
|
||||||
@ -9225,6 +9225,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.471 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.470 2004/02/21 15:37:33 mattias
|
Revision 1.470 2004/02/21 15:37:33 mattias
|
||||||
moved compiler options to project menu, added -CX for smartlinking
|
moved compiler options to project menu, added -CX for smartlinking
|
||||||
|
|
||||||
|
|||||||
@ -104,6 +104,7 @@ type
|
|||||||
procedure CreateSides;
|
procedure CreateSides;
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
class function IsSupportedByInterface: boolean;
|
class function IsSupportedByInterface: boolean;
|
||||||
|
function ChildClassAllowed(ChildClass: TClass): boolean; override;
|
||||||
public
|
public
|
||||||
property Sides[Index: integer]: TPairSplitterSide read GetSides;
|
property Sides[Index: integer]: TPairSplitterSide read GetSides;
|
||||||
property SplitterType: TPairSplitterType read FSplitterType
|
property SplitterType: TPairSplitterType read FSplitterType
|
||||||
@ -156,9 +157,7 @@ procedure TPairSplitterSide.SetParent(AParent: TWinControl);
|
|||||||
var
|
var
|
||||||
ASplitter: TCustomPairSplitter;
|
ASplitter: TCustomPairSplitter;
|
||||||
begin
|
begin
|
||||||
if (AParent<>nil) and (not (AParent is TCustomPairSplitter)) then
|
CheckNewParent(AParent);
|
||||||
RaiseGDBException(
|
|
||||||
'TPairSplitterSide.SetParent Parent not TCustomPairSplitter');
|
|
||||||
// remove from side list of old parent
|
// remove from side list of old parent
|
||||||
ASplitter:=Splitter;
|
ASplitter:=Splitter;
|
||||||
if ASplitter<>nil then begin
|
if ASplitter<>nil then begin
|
||||||
@ -360,5 +359,10 @@ begin
|
|||||||
Result:=PairSplitterGetInterfaceInfo;
|
Result:=PairSplitterGetInterfaceInfo;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCustomPairSplitter.ChildClassAllowed(ChildClass: TClass): boolean;
|
||||||
|
begin
|
||||||
|
Result:=ChildClass.InheritsFrom(TPairSplitterSide);
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|||||||
@ -492,6 +492,7 @@ type
|
|||||||
procedure SetSelStart(Val : integer); virtual;
|
procedure SetSelStart(Val : integer); virtual;
|
||||||
procedure SetSelText(const Val : string); virtual;
|
procedure SetSelText(const Val : string); virtual;
|
||||||
procedure SetText(const Value: TCaption); override;
|
procedure SetText(const Value: TCaption); override;
|
||||||
|
function ChildClassAllowed(ChildClass: TClass): boolean; override;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure SelectAll;
|
procedure SelectAll;
|
||||||
@ -1495,6 +1496,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.132 2004/02/22 10:43:20 mattias
|
||||||
|
added child-parent checks
|
||||||
|
|
||||||
Revision 1.131 2004/02/13 18:21:31 mattias
|
Revision 1.131 2004/02/13 18:21:31 mattias
|
||||||
fixed combo chane
|
fixed combo chane
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user