LCL: fixed using parent borderspacing, fixed anchor spacing for parallel controls, fixed endless loop autosize interdependencies, implemented auto fixing anchor circles, implemented auto fixing center anchoring, fixed calculation of static childsizing layouts, fixed autosizing for controls without preferred size by providing default sizes also used in creation, fixed TSizeConstraints.MinMaxWidth/Height

git-svn-id: trunk@12461 -
This commit is contained in:
mattias 2007-10-14 12:54:29 +00:00
parent 9f052f558f
commit 6264aac23c
52 changed files with 1557 additions and 381 deletions

View File

@ -41,6 +41,8 @@ Type
TArrowType = (atUp, atDown, atLeft, atRight); TArrowType = (atUp, atDown, atLeft, atRight);
TShadowType = (stNone, stIn, stOut, stEtchedIn, stEtchedOut); TShadowType = (stNone, stIn, stOut, stEtchedIn, stEtchedOut);
{ TArrow }
TArrow = class(TCustomControl) TArrow = class(TCustomControl)
private private
FArrowType : TArrowType; FArrowType : TArrowType;
@ -52,6 +54,7 @@ Type
procedure SetProps; procedure SetProps;
protected protected
procedure Paint; override; procedure Paint; override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -97,7 +100,7 @@ begin
fCompStyle := csArrow; fCompStyle := csArrow;
fArrowType := atLeft; fArrowType := atLeft;
fShadowType := stEtchedIn; fShadowType := stEtchedIn;
SetInitialBounds(0,0,10,10); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
destructor TArrow.Destroy; destructor TArrow.Destroy;
@ -117,6 +120,12 @@ begin
inherited Paint; inherited Paint;
end; end;
class function TArrow.GetControlClassDefaultSize: TPoint;
begin
Result.X:=10;
Result.Y:=10;
end;
procedure TArrow.InitializeWnd; procedure TArrow.InitializeWnd;
begin begin
inherited InitializeWnd; inherited InitializeWnd;

View File

@ -122,6 +122,7 @@ type
procedure InitializeWnd; override; procedure InitializeWnd; override;
procedure TextChanged; override; procedure TextChanged; override;
function IsBorderSpacingInnerBorderStored: Boolean; override; function IsBorderSpacingInnerBorderStored: Boolean; override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; Override; destructor Destroy; Override;
@ -254,6 +255,7 @@ type
property MouseInControl: Boolean read FMouseInControl; property MouseInControl: Boolean read FMouseInControl;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override; procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
function GetActionLinkClass: TControlActionLinkClass; override; function GetActionLinkClass: TControlActionLinkClass; override;
class function GetControlClassDefaultSize: TPoint; override;
procedure Loaded; override; procedure Loaded; override;
protected protected
function GetGlyphSize(PaintRect: TRect): TSize; virtual; function GetGlyphSize(PaintRect: TRect): TSize; virtual;

View File

@ -77,6 +77,7 @@ Type
procedure LMMonthChanged(var Message: TLMessage); message LM_MONTHCHANGED; procedure LMMonthChanged(var Message: TLMessage); message LM_MONTHCHANGED;
procedure LMYearChanged(var Message: TLMessage); message LM_YEARCHANGED; procedure LMYearChanged(var Message: TLMessage); message LM_YEARCHANGED;
procedure LMDayChanged(var Message: TLMessage); message LM_DAYCHANGED; procedure LMDayChanged(var Message: TLMessage); message LM_DAYCHANGED;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -147,7 +148,7 @@ constructor TCustomCalendar.Create(TheOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
fCompStyle := csCalendar; fCompStyle := csCalendar;
SetInitialBounds(0,0,190,153); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
fDisplaySettings := [dsShowHeadings, dsShowDayNames]; fDisplaySettings := [dsShowHeadings, dsShowDayNames];
ControlStyle:=ControlStyle-[csTripleClicks,csQuadClicks,csAcceptsControls]; ControlStyle:=ControlStyle-[csTripleClicks,csQuadClicks,csAcceptsControls];
Date := FormatDateTime(ShortDateFormat,Now); Date := FormatDateTime(ShortDateFormat,Now);
@ -307,6 +308,12 @@ begin
if Assigned(OnChange) then OnChange(self); if Assigned(OnChange) then OnChange(self);
end; end;
class function TCustomCalendar.GetControlClassDefaultSize: TPoint;
begin
Result.X:=190;
Result.Y:=153;
end;
procedure TCustomCalendar.LMMonthChanged(var Message: TLMessage); procedure TCustomCalendar.LMMonthChanged(var Message: TLMessage);
begin begin
if Assigned(OnMonthChanged) then OnMonthChanged(self); if Assigned(OnMonthChanged) then OnMonthChanged(self);

View File

@ -79,6 +79,7 @@ type
procedure SetLabelPosition(const AValue: TPosLabel); procedure SetLabelPosition(const AValue: TPosLabel);
protected protected
procedure Paint; override; procedure Paint; override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -157,7 +158,7 @@ begin
FBars:=TBarChartItems.Create(Self); FBars:=TBarChartItems.Create(Self);
FDepth:=5; FDepth:=5;
FLabelPosition:=plLeft; FLabelPosition:=plLeft;
SetInitialBounds(0,0,150,120); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
destructor TCustomBarChart.Destroy; destructor TCustomBarChart.Destroy;
@ -366,6 +367,12 @@ begin
Canvas.Pen.Style:=psSolid; Canvas.Pen.Style:=psSolid;
end; end;
class function TCustomBarChart.GetControlClassDefaultSize: TPoint;
begin
Result.X:=150;
Result.Y:=120;
end;
procedure TCustomBarChart.Clear; procedure TCustomBarChart.Clear;
begin begin
FBars.Clear; FBars.Clear;

View File

@ -445,6 +445,7 @@ type
procedure UpdateTabImages; procedure UpdateTabImages;
procedure ImageListChange(Sender: TObject); procedure ImageListChange(Sender: TObject);
procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override; procedure DoSetBounds(ALeft, ATop, AWidth, AHeight: integer); override;
class function GetControlClassDefaultSize: TPoint; override;
procedure Paint; override; procedure Paint; override;
function GetDisplayRectWithBorder: TRect; virtual; function GetDisplayRectWithBorder: TRect; virtual;
procedure AdjustClientRect(var ARect: TRect); override; procedure AdjustClientRect(var ARect: TRect); override;
@ -1116,6 +1117,7 @@ type
procedure ApplyChanges; procedure ApplyChanges;
procedure InitializeWnd; override; procedure InitializeWnd; override;
procedure Loaded; override; procedure Loaded; override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
procedure StepIt; procedure StepIt;
@ -1217,6 +1219,7 @@ type
Procedure AssociateKeyDown(Sender: TObject; var Key: Word; ShiftState : TShiftState); Procedure AssociateKeyDown(Sender: TObject; var Key: Word; ShiftState : TShiftState);
procedure OnAssociateChangeBounds(Sender: TObject); procedure OnAssociateChangeBounds(Sender: TObject);
procedure DoOnResize; override; procedure DoOnResize; override;
class function GetControlClassDefaultSize: TPoint; override;
function CanChange: Boolean; dynamic; function CanChange: Boolean; dynamic;
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure Click(Button: TUDBtnType); dynamic; overload; procedure Click(Button: TUDBtnType); dynamic; overload;
@ -1359,6 +1362,7 @@ type
procedure CalculatePreferredSize( procedure CalculatePreferredSize(
var PreferredWidth, PreferredHeight: integer; var PreferredWidth, PreferredHeight: integer;
WithThemeSpace: Boolean); override; WithThemeSpace: Boolean); override;
class function GetControlClassDefaultSize: TPoint; override;
procedure Loaded; override; procedure Loaded; override;
procedure RefreshControl; virtual; procedure RefreshControl; virtual;
procedure SetToolBar(NewToolBar: TToolBar); procedure SetToolBar(NewToolBar: TToolBar);
@ -1475,6 +1479,7 @@ type
procedure RemoveButton(Button: TToolButton); procedure RemoveButton(Button: TToolButton);
protected protected
procedure AdjustClientRect(var ARect: TRect); override; procedure AdjustClientRect(var ARect: TRect); override;
class function GetControlClassDefaultSize: TPoint; override;
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; override; function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; override;
function CheckMenuDropdown(Button: TToolButton): Boolean; dynamic; function CheckMenuDropdown(Button: TToolButton): Boolean; dynamic;
procedure ClickButton(Button: TToolButton); dynamic; procedure ClickButton(Button: TToolButton); dynamic;
@ -1598,6 +1603,7 @@ type
protected protected
procedure ApplyChanges; procedure ApplyChanges;
procedure DoChange(var msg); message LM_CHANGED; procedure DoChange(var msg); message LM_CHANGED;
class function GetControlClassDefaultSize: TPoint; override;
procedure InitializeWnd; override; procedure InitializeWnd; override;
procedure Loaded; override; procedure Loaded; override;
public public
@ -2574,6 +2580,7 @@ type
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override; X, Y: Integer); override;
procedure UpdateState; procedure UpdateState;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;

View File

@ -652,7 +652,7 @@ type
tries to keep the distance between the left side of the control and the tries to keep the distance between the left side of the control and the
right side of its parent client area. right side of its parent client area.
With AnchorSide[akLeft] you can define a different reference side. The With AnchorSide[akLeft] you can define a different reference side. The
kept distance is defined by the BorderSpacing. kept distance is defined by the BorderSpacing and Parent.ChildSizing.
Example1: Example1:
+-----+ +-----+ +-----+ +-----+
@ -684,8 +684,6 @@ type
Or use this. It's equivalent: Or use this. It's equivalent:
A.AnchorSide[akBottom].Side:=arsCenter; A.AnchorSide[akBottom].Side:=arsCenter;
A.AnchorSide[akBottom].Control:=B; A.AnchorSide[akBottom].Control:=B;
} }
TAnchorSideChangeOperation = (ascoAdd, ascoRemove, ascoChangeSide); TAnchorSideChangeOperation = (ascoAdd, ascoRemove, ascoChangeSide);
@ -760,7 +758,9 @@ type
cfClientHeightLoaded, cfClientHeightLoaded,
cfLastAlignedBoundsValid, cfLastAlignedBoundsValid,
cfBoundsRectForNewParentValid, cfBoundsRectForNewParentValid,
cfBaseBoundsValid,
cfPreferredSizeValid, cfPreferredSizeValid,
cfPreferredMinSizeValid,
cfOnResizeNeeded, cfOnResizeNeeded,
cfOnChangeBoundsNeeded cfOnChangeBoundsNeeded
); );
@ -863,6 +863,8 @@ type
FParentFont: Boolean; FParentFont: Boolean;
FParentShowHint: Boolean; FParentShowHint: Boolean;
FPopupMenu: TPopupMenu; FPopupMenu: TPopupMenu;
FPreferredMinWidth: integer;// without theme space
FPreferredMinHeight: integer;// without theme space
FPreferredWidth: integer;// with theme space FPreferredWidth: integer;// with theme space
FPreferredHeight: integer;// with theme space FPreferredHeight: integer;// with theme space
FReadBounds: TRect; FReadBounds: TRect;
@ -1172,6 +1174,10 @@ type
procedure GetPreferredSize(var PreferredWidth, PreferredHeight: integer; procedure GetPreferredSize(var PreferredWidth, PreferredHeight: integer;
Raw: boolean = false; Raw: boolean = false;
WithThemeSpace: boolean = true); virtual; WithThemeSpace: boolean = true); virtual;
function GetDefaultWidth: integer;
function GetDefaultHeight: integer;
class function GetControlClassDefaultSize: TPoint; virtual;
function GetSidePosition(Side: TAnchorKind): integer;
procedure CNPreferredSizeChanged; procedure CNPreferredSizeChanged;
procedure InvalidatePreferredSize; virtual; procedure InvalidatePreferredSize; virtual;
function GetAnchorsDependingOnParent(WithNormalAnchors: Boolean): TAnchors; function GetAnchorsDependingOnParent(WithNormalAnchors: Boolean): TAnchors;
@ -1574,6 +1580,8 @@ type
protected protected
FWinControlFlags: TWinControlFlags; FWinControlFlags: TWinControlFlags;
procedure AdjustClientRect(var ARect: TRect); virtual; procedure AdjustClientRect(var ARect: TRect); virtual;
procedure CreateControlAlignList(TheAlign: TAlign;
AlignList: TFPList; StartControl: TControl);
procedure AlignControls(AControl: TControl; procedure AlignControls(AControl: TControl;
var RemainingClientRect: TRect); virtual; var RemainingClientRect: TRect); virtual;
function DoAlignChildControls(TheAlign: TAlign; AControl: TControl; function DoAlignChildControls(TheAlign: TAlign; AControl: TControl;
@ -1596,8 +1604,6 @@ type
procedure CalculatePreferredSize(var PreferredWidth, procedure CalculatePreferredSize(var PreferredWidth,
PreferredHeight: integer; PreferredHeight: integer;
WithThemeSpace: Boolean); override; WithThemeSpace: Boolean); override;
procedure GetChildBounds(var ChildBounds: TRect; WithBorderSpace,
FixateParentAnchors: boolean); virtual;
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
function ChildClassAllowed(ChildClass: TClass): boolean; override; function ChildClassAllowed(ChildClass: TClass): boolean; override;
procedure PaintControls(DC: HDC; First: TControl); procedure PaintControls(DC: HDC; First: TControl);
@ -2204,6 +2210,8 @@ procedure AdjustBorderSpace(var RemainingClientRect, CurBorderSpace: TRect;
function DbgS(a: TAnchorKind): string; overload; function DbgS(a: TAnchorKind): string; overload;
function DbgS(Anchors: TAnchors): string; overload; function DbgS(Anchors: TAnchors): string; overload;
function DbgS(a: TAlign): string; overload;
function DbgS(a: TAnchorKind; Side: TAnchorSideReference): string;
// register (called by the package initialization in design mode) // register (called by the package initialization in design mode)
procedure Register; procedure Register;
@ -2308,6 +2316,21 @@ begin
Result:='['+Result+']'; Result:='['+Result+']';
end; end;
function DbgS(a: TAlign): string;
begin
Result:=AlignNames[a];
end;
function DbgS(a: TAnchorKind; Side: TAnchorSideReference): string;
begin
case Side of
asrTop: if a in [akLeft,akRight] then Result:='asrLeft' else Result:='asrTop';
asrBottom: if a in [akLeft,akRight] then Result:='asrRight' else Result:='asrBottom';
asrCenter: Result:='asrCenter';
else Result:='asr???';
end;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
RecreateWnd RecreateWnd
This function was originally member of TWincontrol. From a VCL point of view This function was originally member of TWincontrol. From a VCL point of view
@ -3079,24 +3102,25 @@ begin
OwnerBorderSpacing:=FOwner.BorderSpacing.GetSpace(Kind); OwnerBorderSpacing:=FOwner.BorderSpacing.GetSpace(Kind);
case ReferenceSide of case ReferenceSide of
asrTop: asrTop: // asrTop = asrLeft
if Kind in [akLeft,akRight] then begin if Kind in [akLeft,akRight] then begin
// anchor to left side of ReferenceControl // anchor to left side of ReferenceControl
if ReferenceControl=OwnerParent then if ReferenceControl=OwnerParent then
Position:=0 Position:=0
else else
Position:=ReferenceControl.Left; Position:=ReferenceControl.Left;
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.LeftRightSpacing)
else if Kind=akRight then
OwnerBorderSpacing:=Max(Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(OppositeAnchor[Kind])),
OwnerParent.ChildSizing.HorizontalSpacing);
if Kind=akLeft then begin if Kind=akLeft then begin
// anchor left of ReferenceControl and left of Owner // anchor left of ReferenceControl and left of Owner
inc(Position,OwnerBorderSpacing); inc(Position,OwnerBorderSpacing);
end else begin end else begin
// anchor left of ReferenceControl and right of Owner // anchor left of ReferenceControl and right of Owner
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.LeftRightSpacing)
else
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(akLeft));
dec(Position,OwnerBorderSpacing); dec(Position,OwnerBorderSpacing);
end; end;
end else begin end else begin
@ -3105,36 +3129,38 @@ begin
Position:=0 Position:=0
else else
Position:=ReferenceControl.Top; Position:=ReferenceControl.Top;
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.TopBottomSpacing)
else if Kind=akBottom then
OwnerBorderSpacing:=Max(Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(OppositeAnchor[Kind])),
OwnerParent.ChildSizing.VerticalSpacing);
if Kind=akTop then begin if Kind=akTop then begin
// anchor top of ReferenceControl and top of Owner // anchor top of ReferenceControl and top of Owner
inc(Position,OwnerBorderSpacing); inc(Position,OwnerBorderSpacing);
end else begin end else begin
// anchor top of ReferenceControl and bottom of Owner // anchor top of ReferenceControl and bottom of Owner
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.TopBottomSpacing)
else
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(akTop));
dec(Position,OwnerBorderSpacing); dec(Position,OwnerBorderSpacing);
end; end;
end; end;
asrBottom: asrBottom: // asrBottom = asrRight
if Kind in [akLeft,akRight] then begin if Kind in [akLeft,akRight] then begin
// anchor to right side of ReferenceControl // anchor to right side of ReferenceControl
if ReferenceControl=OwnerParent then if ReferenceControl=OwnerParent then
Position:=OwnerParent.ClientWidth Position:=OwnerParent.ClientWidth
else else
Position:=ReferenceControl.Left+ReferenceControl.Width; Position:=ReferenceControl.Left+ReferenceControl.Width;
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.LeftRightSpacing)
else if Kind=akLeft then
OwnerBorderSpacing:=Max(Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(OppositeAnchor[Kind])),
OwnerParent.ChildSizing.HorizontalSpacing);
if Kind=akLeft then begin if Kind=akLeft then begin
// anchor right of ReferenceControl and left of Owner // anchor right of ReferenceControl and left of Owner
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.LeftRightSpacing)
else
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(akRight));
inc(Position,OwnerBorderSpacing); inc(Position,OwnerBorderSpacing);
end else begin end else begin
// anchor right of ReferenceControl and right of Owner // anchor right of ReferenceControl and right of Owner
@ -3146,14 +3172,15 @@ begin
Position:=OwnerParent.ClientHeight Position:=OwnerParent.ClientHeight
else else
Position:=ReferenceControl.Top+ReferenceControl.Height; Position:=ReferenceControl.Top+ReferenceControl.Height;
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.TopBottomSpacing)
else if Kind=akTop then
OwnerBorderSpacing:=Max(Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(OppositeAnchor[Kind])),
OwnerParent.ChildSizing.VerticalSpacing);
if Kind=akTop then begin if Kind=akTop then begin
// anchor bottom of ReferenceControl and top of Owner // anchor bottom of ReferenceControl and top of Owner
if ReferenceControl=OwnerParent then
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
OwnerParent.ChildSizing.TopBottomSpacing)
else
OwnerBorderSpacing:=Max(OwnerBorderSpacing,
ReferenceControl.BorderSpacing.GetSpace(akBottom));
inc(Position,OwnerBorderSpacing); inc(Position,OwnerBorderSpacing);
end else begin end else begin
// anchor bottom of ReferenceControl and bottom of Owner // anchor bottom of ReferenceControl and bottom of Owner

View File

@ -870,6 +870,7 @@ type
procedure HintsChanged(Sender: TObject); virtual; procedure HintsChanged(Sender: TObject); virtual;
procedure ButtonClickHandler(Sender: TObject); virtual; procedure ButtonClickHandler(Sender: TObject); virtual;
procedure DoOnResize; override; procedure DoOnResize; override;
class function GetControlClassDefaultSize: TPoint; override;
procedure BeginUpdateButtons; virtual; procedure BeginUpdateButtons; virtual;
procedure EndUpdateButtons; virtual; procedure EndUpdateButtons; virtual;
public public

View File

@ -253,6 +253,7 @@ type
function GetGlyphSize(PaintRect: TRect): TSize; override; function GetGlyphSize(PaintRect: TRect): TSize; override;
function DrawGlyph(ACanvas: TCanvas; const AClient: TRect; const AOffset: TPoint; function DrawGlyph(ACanvas: TCanvas; const AClient: TRect; const AOffset: TPoint;
AState: TButtonState; ATransparent: Boolean; BiDiFlags: Longint): TRect; override; AState: TButtonState; ATransparent: Boolean; BiDiFlags: Longint): TRect; override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AnOwner: TComponent); override; constructor Create(AnOwner: TComponent); override;
destructor Destroy; Override; destructor Destroy; Override;

View File

@ -188,6 +188,7 @@ type
procedure ShowControl(APage: TControl); override; procedure ShowControl(APage: TControl); override;
procedure UpdateTabProperties; virtual; procedure UpdateTabProperties; virtual;
function ChildClassAllowed(ChildClass: TClass): boolean; override; function ChildClassAllowed(ChildClass: TClass): boolean; override;
class function GetControlClassDefaultSize: TPoint; 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
@ -356,6 +357,8 @@ type
procedure SetBrush(Value: TBrush); procedure SetBrush(Value: TBrush);
procedure SetPen(Value: TPen); procedure SetPen(Value: TPen);
procedure SetShape(Value: TShapeType); procedure SetShape(Value: TShapeType);
protected
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -494,6 +497,7 @@ type
TPaintBox = class(TGraphicControl) TPaintBox = class(TGraphicControl)
protected protected
procedure Paint; override; procedure Paint; override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
property Canvas; property Canvas;
@ -556,6 +560,7 @@ type
procedure CalculatePreferredSize(var PreferredWidth, procedure CalculatePreferredSize(var PreferredWidth,
PreferredHeight: integer; PreferredHeight: integer;
WithThemeSpace: Boolean); override; WithThemeSpace: Boolean); override;
class function GetControlClassDefaultSize: TPoint; override;
procedure DoAutoSize; override; procedure DoAutoSize; override;
procedure Paint; override; procedure Paint; override;
public public
@ -994,6 +999,7 @@ type
procedure SetBorderWidth(const Value: TBorderWidth); procedure SetBorderWidth(const Value: TBorderWidth);
protected protected
procedure AdjustClientRect(var Rect: TRect); override; procedure AdjustClientRect(var Rect: TRect); override;
class function GetControlClassDefaultSize: TPoint; override;
procedure CMParentColorChanged(var Message: TLMessage); message CM_PARENTCOLORCHANGED; procedure CMParentColorChanged(var Message: TLMessage); message CM_PARENTCOLORCHANGED;
procedure Loaded; override; procedure Loaded; override;
procedure RealSetText(const Value: TCaption); override; procedure RealSetText(const Value: TCaption); override;

View File

@ -43,6 +43,7 @@ type
protected protected
procedure SetPreviewFileDialog(const AValue: TPreviewFileDialog); procedure SetPreviewFileDialog(const AValue: TPreviewFileDialog);
procedure CreateParams(var Params: TCreateParams); override; procedure CreateParams(var Params: TCreateParams); override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
property PreviewFileDialog: TPreviewFileDialog read FPreviewFileDialog property PreviewFileDialog: TPreviewFileDialog read FPreviewFileDialog
@ -255,11 +256,17 @@ begin
Params.Style := Params.Style and DWORD(not WS_CHILD); Params.Style := Params.Style and DWORD(not WS_CHILD);
end; end;
class function TPreviewFileControl.GetControlClassDefaultSize: TPoint;
begin
Result.X:=200;
Result.Y:=200;
end;
constructor TPreviewFileControl.Create(TheOwner: TComponent); constructor TPreviewFileControl.Create(TheOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
FCompStyle:=csPreviewFileControl; FCompStyle:=csPreviewFileControl;
SetInitialBounds(0,0,200,200); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
{ TPreviewFileDialog } { TPreviewFileDialog }

View File

@ -157,6 +157,7 @@ type
procedure CreateWnd; override; procedure CreateWnd; override;
function GetClientScrollOffset: TPoint; override; function GetClientScrollOffset: TPoint; override;
procedure DoOnResize; override; procedure DoOnResize; override;
class function GetControlClassDefaultSize: TPoint; override;
procedure WMHScroll(var Message : TLMHScroll); message LM_HScroll; procedure WMHScroll(var Message : TLMHScroll); message LM_HScroll;
procedure WMVScroll(var Message : TLMVScroll); message LM_VScroll; procedure WMVScroll(var Message : TLMVScroll); message LM_VScroll;
procedure ScrollBy(DeltaX, DeltaY: Integer); procedure ScrollBy(DeltaX, DeltaY: Integer);
@ -250,6 +251,7 @@ type
procedure Notification(AComponent: TComponent; procedure Notification(AComponent: TComponent;
Operation: TOperation); override; Operation: TOperation); override;
procedure SetParent(AParent: TWinControl); override; procedure SetParent(AParent: TWinControl); override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
end; end;
@ -464,6 +466,7 @@ type
function VisibleIsStored: boolean; function VisibleIsStored: boolean;
function ColorIsStored: boolean; override; function ColorIsStored: boolean; override;
procedure DoSendBoundsToInterface; override; procedure DoSendBoundsToInterface; override;
class function GetControlClassDefaultSize: TPoint; override;
protected protected
// drag and dock // drag and dock
procedure DoDock(NewDockSite: TWinControl; var ARect: TRect); override; procedure DoDock(NewDockSite: TWinControl; var ARect: TRect); override;
@ -683,6 +686,7 @@ type
procedure SetHideInterval(Value : Integer); procedure SetHideInterval(Value : Integer);
protected protected
procedure Paint; override; procedure Paint; override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;

View File

@ -30,7 +30,6 @@ begin
FButtonGlyph.OnChange := @GlyphChanged; FButtonGlyph.OnChange := @GlyphChanged;
Align := alNone; Align := alNone;
BorderSpacing.InnerBorder:=4; BorderSpacing.InnerBorder:=4;
SetInitialBounds(0,0,75,30);
RealizeKind; RealizeKind;
end; end;
@ -263,4 +262,10 @@ begin
Result:=BorderSpacing.InnerBorder<>4; Result:=BorderSpacing.InnerBorder<>4;
end; end;
class function TCustomBitBtn.GetControlClassDefaultSize: TPoint;
begin
Result.X:=75;
Result.Y:=30;
end;
// included by buttons.pp // included by buttons.pp

View File

@ -36,7 +36,7 @@ begin
Align := alNone; Align := alNone;
BorderSpacing.InnerBorder:=4; BorderSpacing.InnerBorder:=4;
// setup default sizes // setup default sizes
SetInitialBounds(0,0,75,25); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -271,6 +271,12 @@ begin
Result:=BorderSpacing.InnerBorder<>2; Result:=BorderSpacing.InnerBorder<>2;
end; end;
class function TCustomButton.GetControlClassDefaultSize: TPoint;
begin
Result.X:=75;
Result.Y:=25;
end;
function TCustomButton.UseRightToLeftAlignment: Boolean; function TCustomButton.UseRightToLeftAlignment: Boolean;
begin begin
//Button always has center alignment //Button always has center alignment

View File

@ -26,7 +26,7 @@ begin
FButtonColorSize := 16; FButtonColorSize := 16;
FBorderWidth := 2; FBorderWidth := 2;
FButtonColorAutoSize := True; FButtonColorAutoSize := True;
SetInitialBounds(1, 1, 75, 25); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
destructor TColorButton.Destroy; destructor TColorButton.Destroy;
@ -129,6 +129,12 @@ begin
Canvas.Rectangle(Result); Canvas.Rectangle(Result);
end; end;
class function TColorButton.GetControlClassDefaultSize: TPoint;
begin
Result.X:=75;
Result.Y:=25;
end;
procedure TColorButton.SetButtonColorSize(const AValue: Integer); procedure TColorButton.SetButtonColorSize(const AValue: Integer);
begin begin
if FButtonColorSize = AValue then Exit; if FButtonColorSize = AValue then Exit;

View File

@ -2811,6 +2811,7 @@ begin
' NewClientSize='+dbgs(NewBaseParentClientSize)+ ' NewClientSize='+dbgs(NewBaseParentClientSize)+
'');} '');}
FBaseBounds:=NewBaseBounds; FBaseBounds:=NewBaseBounds;
Include(FControlFlags,cfBaseBoundsValid);
FBaseParentClientSize:=NewBaseParentClientSize; FBaseParentClientSize:=NewBaseParentClientSize;
fLastAlignedBounds:=Rect(0,0,0,0); fLastAlignedBounds:=Rect(0,0,0,0);
end; end;
@ -4007,7 +4008,7 @@ end;
instead. instead.
Raw: If not Raw then the values will be adjusted by the constraints and Raw: If not Raw then the values will be adjusted by the constraints and
undefined values will be replaced by the current width and height. undefined values will be replaced by GetDefaultWidth/GetDefaultHeight.
WithThemeSpace: If true, adds space for stacking. For example: TRadioButton WithThemeSpace: If true, adds space for stacking. For example: TRadioButton
has a minimum size. But for stacking multiple TRadioButtons there should be has a minimum size. But for stacking multiple TRadioButtons there should be
@ -4020,17 +4021,31 @@ end;
procedure TControl.GetPreferredSize(var PreferredWidth, procedure TControl.GetPreferredSize(var PreferredWidth,
PreferredHeight: integer; Raw: boolean; WithThemeSpace: boolean); PreferredHeight: integer; Raw: boolean; WithThemeSpace: boolean);
begin begin
if not (cfPreferredSizeValid in FControlFlags) then begin if WithThemeSpace then begin
CalculatePreferredSize(FPreferredWidth,FPreferredHeight,WithThemeSpace); if not (cfPreferredSizeValid in FControlFlags) then begin
Include(FControlFlags,cfPreferredSizeValid); CalculatePreferredSize(FPreferredWidth,FPreferredHeight,true);
Include(FControlFlags,cfPreferredSizeValid);
end;
PreferredWidth:=FPreferredWidth;
PreferredHeight:=FPreferredHeight;
end else begin
if not (cfPreferredMinSizeValid in FControlFlags) then begin
CalculatePreferredSize(FPreferredMinWidth,FPreferredMinHeight,false);
Include(FControlFlags,cfPreferredMinSizeValid);
end;
PreferredWidth:=FPreferredMinWidth;
PreferredHeight:=FPreferredMinHeight;
end; end;
PreferredWidth:=FPreferredWidth;
PreferredHeight:=FPreferredHeight;
if not Raw then begin if not Raw then begin
// use Width and Height for undefined preferred size // use defaults for undefined preferred size
if PreferredWidth<=0 then PreferredWidth:=Width; if AutoSize then begin
if PreferredHeight<=0 then PreferredHeight:=Height; if PreferredWidth<=0 then PreferredWidth:=GetDefaultWidth;
if PreferredHeight<=0 then PreferredHeight:=GetDefaultHeight;
end else begin
if PreferredWidth<=0 then PreferredWidth:=Width;
if PreferredHeight<=0 then PreferredHeight:=Height;
end;
// if this control is aligned adjust PreferredWidth and/or PreferredHeight // if this control is aligned adjust PreferredWidth and/or PreferredHeight
if Parent<>nil then begin if Parent<>nil then begin
@ -4054,6 +4069,71 @@ begin
end; end;
end; end;
{------------------------------------------------------------------------------
function TControl.GetDefaultWidth: integer;
The default width for this control independent of any calculated values
like Width and GetPreferredSize.
------------------------------------------------------------------------------}
function TControl.GetDefaultWidth: integer;
begin
if cfBaseBoundsValid in FControlFlags then
Result:=FBaseBounds.Right-FBaseBounds.Left
else if cfWidthLoaded in FControlFlags then
Result:=FReadBounds.Right-FReadBounds.Left
else
Result:=GetControlClassDefaultSize.X;
end;
{------------------------------------------------------------------------------
function TControl.GetDefaultHeight: integer;
The default height for this control independent of any calculated values
like Height and GetPreferredSize.
------------------------------------------------------------------------------}
function TControl.GetDefaultHeight: integer;
begin
if cfBaseBoundsValid in FControlFlags then
Result:=BaseBounds.Bottom-BaseBounds.Top
else if cfHeightLoaded in FControlFlags then
Result:=FReadBounds.Bottom-FReadBounds.Top
else
Result:=GetControlClassDefaultSize.Y;
end;
{------------------------------------------------------------------------------
class function TControl.GetControlClassDefaultSize: TPoint;
The default size of this type of controls.
Used by GetDefaultWidth and GetDefaultHeight.
------------------------------------------------------------------------------}
class function TControl.GetControlClassDefaultSize: TPoint;
begin
Result.X:=75;
Result.Y:=50;
end;
{------------------------------------------------------------------------------
procedure TControl.CNPreferredSizeChanged;
Utility function to retrieve Left,Top,Right and Bottom.
------------------------------------------------------------------------------}
function TControl.GetSidePosition(Side: TAnchorKind): integer;
begin
case Side of
akLeft: Result:=Left;
akTop: Result:=Top;
akRight: Result:=Left+Width;
akBottom: Result:=Top+Height;
end;
end;
{------------------------------------------------------------------------------
procedure TControl.CNPreferredSizeChanged;
Called by the LCL interface, when something changed that effects the result
of the interface values for GetPreferredSize.
------------------------------------------------------------------------------}
procedure TControl.CNPreferredSizeChanged; procedure TControl.CNPreferredSizeChanged;
begin begin
InvalidatePreferredSize; InvalidatePreferredSize;
@ -4071,6 +4151,7 @@ begin
AControl:=Self; AControl:=Self;
while AControl<>nil do begin while AControl<>nil do begin
Exclude(AControl.FControlFlags,cfPreferredSizeValid); Exclude(AControl.FControlFlags,cfPreferredSizeValid);
Exclude(AControl.FControlFlags,cfPreferredMinSizeValid);
AControl:=AControl.Parent; AControl:=AControl.Parent;
end; end;
end; end;

View File

@ -90,7 +90,7 @@ begin
FState := cbUnchecked; FState := cbUnchecked;
FAllowGrayed := false; FAllowGrayed := false;
TabStop := true; TabStop := true;
SetInitialBounds(0, 0, 90, 23); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
AutoSize := true; AutoSize := true;
end; end;
@ -183,6 +183,12 @@ begin
end; end;
end; end;
class function TCustomCheckBox.GetControlClassDefaultSize: TPoint;
begin
Result.X:=90;
Result.Y:=23;
end;
procedure TCustomCheckBox.Loaded; procedure TCustomCheckBox.Loaded;
begin begin
// Send first the FState to the interface before calling inherited, // Send first the FState to the interface before calling inherited,

View File

@ -41,7 +41,6 @@ begin
ChildSizing.EnlargeVertical:=crsHomogenousChildResize; ChildSizing.EnlargeVertical:=crsHomogenousChildResize;
ChildSizing.LeftRightSpacing:=6; ChildSizing.LeftRightSpacing:=6;
ChildSizing.TopBottomSpacing:=6; ChildSizing.TopBottomSpacing:=6;
SetInitialBounds(0,0,150,100);
end; end;
destructor TCustomCheckGroup.Destroy; destructor TCustomCheckGroup.Destroy;

View File

@ -103,6 +103,12 @@ begin
end; end;
end; end;
class function TCustomComboBox.GetControlClassDefaultSize: TPoint;
begin
Result.X:=100;
Result.Y:=25;
end;
procedure TCustomComboBox.DoEnter; procedure TCustomComboBox.DoEnter;
begin begin
inherited DoEnter; inherited DoEnter;
@ -709,7 +715,7 @@ begin
inherited Create(TheOwner); inherited Create(TheOwner);
fCompStyle := csComboBox; fCompStyle := csComboBox;
SetInitialBounds(0,0,100,25); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
FItems := TStringlist.Create; FItems := TStringlist.Create;
FItemIndex:=-1; FItemIndex:=-1;
FMaxLength := -1; FMaxLength := -1;

View File

@ -52,7 +52,7 @@ begin
FMaxLength:= -1; FMaxLength:= -1;
ParentColor := false; ParentColor := false;
TabStop := true; TabStop := true;
SetInitialBounds(0,0,80,23); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
FEchoMode := emNormal; FEchoMode := emNormal;
BorderStyle := bsSingle; BorderStyle := bsSingle;
FAutoSelect := False; FAutoSelect := False;
@ -347,6 +347,12 @@ begin
Result:=false; Result:=false;
end; end;
class function TCustomEdit.GetControlClassDefaultSize: TPoint;
begin
Result.X:=80;
Result.Y:=23;
end;
procedure TCustomEdit.KeyUp(var Key: Word; Shift: TShiftState); procedure TCustomEdit.KeyUp(var Key: Word; Shift: TShiftState);
begin begin
inherited KeyUp(Key, Shift); inherited KeyUp(Key, Shift);

View File

@ -971,6 +971,12 @@ begin
end; end;
end; end;
class function TCustomForm.GetControlClassDefaultSize: TPoint;
begin
Result.X:=320;
Result.Y:=240;
end;
procedure TCustomForm.DoDock(NewDockSite: TWinControl; var ARect: TRect); procedure TCustomForm.DoDock(NewDockSite: TWinControl; var ARect: TRect);
begin begin
if (NewDockSite<>HostDockSite) then begin if (NewDockSite<>HostDockSite) then begin
@ -1379,7 +1385,7 @@ begin
ControlStyle := ControlStyle + [csAcceptsControls, csCaptureMouse, ControlStyle := ControlStyle + [csAcceptsControls, csCaptureMouse,
csClickEvents, csSetCaption, csDoubleClicks]; csClickEvents, csSetCaption, csDoubleClicks];
SetInitialBounds(0,0,320,240); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
ParentColor := False; ParentColor := False;
ParentFont := False; ParentFont := False;
Ctl3D := True; Ctl3D := True;

View File

@ -83,6 +83,12 @@ begin
if Parent<>nil then UpdateActionLists(opInsert); if Parent<>nil then UpdateActionLists(opInsert);
end; end;
class function TCustomFrame.GetControlClassDefaultSize: TPoint;
begin
Result.X:=320;
Result.Y:=240;
end;
constructor TCustomFrame.Create(AOwner: TComponent); constructor TCustomFrame.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
@ -92,7 +98,7 @@ begin
if not InitInheritedComponent(Self,TFrame) then if not InitInheritedComponent(Self,TFrame) then
raise EResNotFound.CreateFmt(rsResourceNotFound, [ClassName]); raise EResNotFound.CreateFmt(rsResourceNotFound, [ClassName]);
end else begin end else begin
SetInitialBounds(0,0,320,240); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
end; end;

View File

@ -14,16 +14,21 @@
***************************************************************************** *****************************************************************************
} }
{------------------------------------------------------------------------------} class function TCustomGroupBox.GetControlClassDefaultSize: TPoint;
{ function TCustomGroupBox.Create } begin
{------------------------------------------------------------------------------} Result.X:=185;
Result.Y:=105;
end;
{------------------------------------------------------------------------------
function TCustomGroupBox.Create
------------------------------------------------------------------------------}
constructor TCustomGroupBox.Create(AOwner: TComponent); constructor TCustomGroupBox.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
fCompStyle := csGroupBox; fCompStyle := csGroupBox;
ControlStyle := ControlStyle + [csAcceptsControls]; ControlStyle := ControlStyle + [csAcceptsControls];
Width:= 185; SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
Height:= 105;
end; end;
// included by stdctrls.pp // included by stdctrls.pp

View File

@ -28,7 +28,7 @@ begin
FPicture := TPicture.Create; FPicture := TPicture.Create;
FPicture.OnChange := @PictureChanged; FPicture.OnChange := @PictureChanged;
FUseParentCanvas := false; FUseParentCanvas := false;
SetInitialBounds(0,0,100,100); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
destructor TCustomImage.Destroy; destructor TCustomImage.Destroy;
@ -91,7 +91,6 @@ var
end; end;
begin begin
if not AutoSize then Exit; // needless to check
if AutoSizing then Exit; // we shouldn't come here in the first place if AutoSizing then Exit; // we shouldn't come here in the first place
BeginAutoSizing; BeginAutoSizing;
@ -109,7 +108,6 @@ begin
if (NewWidth<>Width) or (NewHeight<>Height) if (NewWidth<>Width) or (NewHeight<>Height)
then begin then begin
SetBounds(Left, Top, NewWidth, NewHeight); SetBounds(Left, Top, NewWidth, NewHeight);
// PictureChanged(Self);
end; end;
finally finally
EndAutoSizing; EndAutoSizing;
@ -198,6 +196,12 @@ begin
PreferredHeight := Picture.Height; PreferredHeight := Picture.Height;
end; end;
class function TCustomImage.GetControlClassDefaultSize: TPoint;
begin
Result.X:=90;
Result.Y:=90;
end;
procedure TCustomImage.Paint; procedure TCustomImage.Paint;
procedure DrawFrame; procedure DrawFrame;

View File

@ -62,6 +62,12 @@ begin
AdjustSize; AdjustSize;
end; end;
class function TCustomLabel.GetControlClassDefaultSize: TPoint;
begin
Result.X:=65;
Result.Y:=17;
end;
function TCustomLabel.HasMultiLine: boolean; function TCustomLabel.HasMultiLine: boolean;
var var
s: String; s: String;
@ -196,7 +202,7 @@ constructor TCustomLabel.Create(TheOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
ControlStyle := [csSetCaption, csClickEvents, csDoubleClicks, csReplicatable]; ControlStyle := [csSetCaption, csClickEvents, csDoubleClicks, csReplicatable];
setInitialBounds(0,0,65,17); setInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
FShowAccelChar := True; FShowAccelChar := True;
Color := clNone; Color := clNone;
AutoSize:=true; AutoSize:=true;

View File

@ -105,7 +105,6 @@ begin
FLabelPosition := lpAbove; FLabelPosition := lpAbove;
FLabelSpacing := 3; FLabelSpacing := 3;
CreateInternalLabel; CreateInternalLabel;
SetInitialBounds(0,0,80,25);
end; end;
procedure TCustomLabeledEdit.CreateInternalLabel; procedure TCustomLabeledEdit.CreateInternalLabel;

View File

@ -135,9 +135,15 @@ begin
UnlockSelectionChange; UnlockSelectionChange;
end; end;
{------------------------------------------------------------------------------} class function TCustomListBox.GetControlClassDefaultSize: TPoint;
{ procedure TCustomListBox.UpdateSelectionMode } begin
{------------------------------------------------------------------------------} Result.X:=100;
Result.Y:=80;
end;
{------------------------------------------------------------------------------
procedure TCustomListBox.UpdateSelectionMode
------------------------------------------------------------------------------}
procedure TCustomListBox.UpdateSelectionMode; procedure TCustomListBox.UpdateSelectionMode;
begin begin
if not HandleAllocated then exit; if not HandleAllocated then exit;
@ -461,9 +467,9 @@ begin
end; end;
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------
{ function TCustomListBox.Create } function TCustomListBox.Create
{------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
constructor TCustomListBox.Create(TheOwner : TComponent); constructor TCustomListBox.Create(TheOwner : TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
@ -479,13 +485,13 @@ begin
TControlCanvas(FCanvas).Control := Self; TControlCanvas(FCanvas).Control := Self;
ParentColor := false; ParentColor := false;
TabStop := true; TabStop := true;
SetInitialBounds(0, 0, 100, 80); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
UnlockSelectionChange; UnlockSelectionChange;
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------
{ function TCustomListBox.Destroy } function TCustomListBox.Destroy
{------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
destructor TCustomListBox.Destroy; destructor TCustomListBox.Destroy;
begin begin
Destroying; Destroying;

View File

@ -37,7 +37,7 @@ begin
end; end;
FHoverTime := -1; FHoverTime := -1;
TabStop := true; TabStop := true;
SetInitialBounds(0,0,100,90); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
ParentColor := False; ParentColor := False;
Color := clWindow; Color := clWindow;
FCanvas := TControlCanvas.Create; FCanvas := TControlCanvas.Create;
@ -45,9 +45,9 @@ begin
FProperties := [lvpColumnClick, lvpHideSelection, lvpShowColumnHeaders, lvpToolTips]; FProperties := [lvpColumnClick, lvpHideSelection, lvpShowColumnHeaders, lvpToolTips];
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------
{ TCustomListView CustomDraw } TCustomListView CustomDraw
{------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
function TCustomListView.CustomDraw(const ARect: TRect; AStage: TCustomDrawStage): Boolean; function TCustomListView.CustomDraw(const ARect: TRect; AStage: TCustomDrawStage): Boolean;
begin begin
Result := True; Result := True;

View File

@ -38,7 +38,6 @@ begin
//TMemoStrings(FLines).MemoWidgetClass := TWSCustomMemoClass(WidgetSetClass); //TMemoStrings(FLines).MemoWidgetClass := TWSCustomMemoClass(WidgetSetClass);
FVertScrollbar := TMemoScrollBar.Create(Self, sbVertical); FVertScrollbar := TMemoScrollBar.Create(Self, sbVertical);
FHorzScrollbar := TMemoScrollBar.Create(Self, sbHorizontal); FHorzScrollbar := TMemoScrollBar.Create(Self, sbHorizontal);
SetInitialBounds(0,0,150,90);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -248,6 +247,12 @@ begin
end; end;
end; end;
class function TCustomMemo.GetControlClassDefaultSize: TPoint;
begin
Result.X:=150;
Result.Y:=90;
end;
procedure TCustomMemo.SetWantTabs(const NewWantTabs: boolean); procedure TCustomMemo.SetWantTabs(const NewWantTabs: boolean);
begin begin
if FWantTabs = NewWantTabs then exit; if FWantTabs = NewWantTabs then exit;

View File

@ -212,7 +212,7 @@ begin
TabPosition := tpTop; TabPosition := tpTop;
TabStop := true; TabStop := true;
ShowTabs := True; ShowTabs := True;
SetInitialBounds(0,0,200,200); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -719,6 +719,12 @@ begin
Result:=(ChildClass<>nil) and (ChildClass.InheritsFrom(PageClass)); Result:=(ChildClass<>nil) and (ChildClass.InheritsFrom(PageClass));
end; end;
class function TCustomNotebook.GetControlClassDefaultSize: TPoint;
begin
Result.X:=200;
Result.Y:=200;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
TCustomNotebook Change TCustomNotebook Change
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}

View File

@ -41,7 +41,7 @@ begin
FAlignment := taCenter; FAlignment := taCenter;
FFullRepaint := true; FFullRepaint := true;
Color:=clBtnFace;// clBackground; Color:=clBtnFace;// clBackground;
SetInitialBounds(0,0,170,50); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
ParentColor := True; ParentColor := True;
end; end;
@ -138,6 +138,12 @@ begin
InflateRect(Rect, -BevelSize, -BevelSize); InflateRect(Rect, -BevelSize, -BevelSize);
end; end;
class function TCustomPanel.GetControlClassDefaultSize: TPoint;
begin
Result.X:=170;
Result.Y:=50;
end;
procedure TCustomPanel.Loaded; procedure TCustomPanel.Loaded;
begin begin
inherited Loaded; inherited Loaded;

View File

@ -33,7 +33,7 @@ begin
FShowAccelChar:= true; FShowAccelChar:= true;
FStaticBorderStyle:=sbsNone; FStaticBorderStyle:=sbsNone;
ControlStyle := ControlStyle + [csOpaque, csReplicatable]; ControlStyle := ControlStyle + [csOpaque, csReplicatable];
SetInitialBounds(0, 0, 65, 17); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -123,6 +123,12 @@ begin
Result := inherited; Result := inherited;
end; end;
class function TCustomStaticText.GetControlClassDefaultSize: TPoint;
begin
Result.X:=65;
Result.Y:=17;
end;
Procedure TCustomStaticText.SetStaticBorderStyle(Value : TStaticBorderStyle); Procedure TCustomStaticText.SetStaticBorderStyle(Value : TStaticBorderStyle);
procedure RaiseNotImplemented; procedure RaiseNotImplemented;

View File

@ -209,7 +209,7 @@ begin
FOrientation := udVertical; FOrientation := udVertical;
MinBtn := TUpDownButton.CreateWithParams(Self, btPrev); MinBtn := TUpDownButton.CreateWithParams(Self, btPrev);
MaxBtn := TUpDownButton.CreateWithParams(Self, btNext); MaxBtn := TUpDownButton.CreateWithParams(Self, btNext);
SetInitialBounds(0,0,17,31); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
BTimerProc := nil; BTimerProc := nil;
BTimerBounds := Rect(0,0,0,0); BTimerBounds := Rect(0,0,0,0);
FArrowKeys := True; FArrowKeys := True;
@ -392,6 +392,12 @@ begin
UpdateOrientation; UpdateOrientation;
end; end;
class function TCustomUpDown.GetControlClassDefaultSize: TPoint;
begin
Result.X:=17;
Result.Y:=31;
end;
procedure TCustomUpDown.Notification(AComponent: TComponent; procedure TCustomUpDown.Notification(AComponent: TComponent;
Operation: TOperation); Operation: TOperation);
begin begin

View File

@ -1,4 +1,4 @@
{%MainUnit ../dbctrls.pas} {%MainUnit ../dbctrls.pp}
{ {
***************************************************************************** *****************************************************************************
* * * *
@ -336,6 +336,12 @@ begin
UpdateButtons; UpdateButtons;
end; end;
class function TDBCustomNavigator.GetControlClassDefaultSize: TPoint;
begin
Result.X:=241;
Result.Y:=25;
end;
procedure TDBCustomNavigator.BeginUpdateButtons; procedure TDBCustomNavigator.BeginUpdateButtons;
begin begin
inc(FUpdateButtonsLock); inc(FUpdateButtonsLock);
@ -367,7 +373,7 @@ begin
BevelOuter:=bvNone; BevelOuter:=bvNone;
BevelInner:=bvNone; BevelInner:=bvNone;
FConfirmDelete:=True; FConfirmDelete:=True;
SetInitialBounds(0,0,241,25); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
UpdateButtons; UpdateButtons;
EndUpdateButtons; EndUpdateButtons;
UpdateHints; UpdateHints;

View File

@ -67,7 +67,7 @@ begin
FSections := CreateSections; FSections := CreateSections;
ControlStyle := ControlStyle + [csCaptureMouse, csClickEvents, csNoFocus, csOpaque] - ControlStyle := ControlStyle + [csCaptureMouse, csClickEvents, csNoFocus, csOpaque] -
[csSetCaption]; [csSetCaption];
SetInitialBounds(0, 0, 170, 30); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
destructor TCustomHeaderControl.Destroy; destructor TCustomHeaderControl.Destroy;
@ -193,6 +193,12 @@ begin
Sections[i].State := MaxState; Sections[i].State := MaxState;
end; end;
class function TCustomHeaderControl.GetControlClassDefaultSize: TPoint;
begin
Result.X:=170;
Result.Y:=30;
end;
procedure TCustomHeaderControl.Paint; procedure TCustomHeaderControl.Paint;
var var
Details: TThemedElementDetails; Details: TThemedElementDetails;

View File

@ -36,7 +36,7 @@ begin
Canvas.Font := Screen.HintFont; Canvas.Font := Screen.HintFont;
BorderStyle := bsNone; BorderStyle := bsNone;
Caption := 'THintWindow'; Caption := 'THintWindow';
SetInitialBounds(1,1,25,25); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
FHideInterval := 3000; FHideInterval := 3000;
TheTimer := TCustomTimer.Create(self); TheTimer := TCustomTimer.Create(self);
FAutoHideTimer := TheTimer; FAutoHideTimer := TheTimer;
@ -91,6 +91,12 @@ begin
DT_NOPREFIX or DT_CENTER or DT_VCENTER or DT_WORDBREAK); DT_NOPREFIX or DT_CENTER or DT_VCENTER or DT_WORDBREAK);
end; end;
class function THintWindow.GetControlClassDefaultSize: TPoint;
begin
Result.X:=25;
Result.Y:=25;
end;
procedure THintWindow.ActivateHint(ARect: TRect; const AHint: String); procedure THintWindow.ActivateHint(ARect: TRect; const AHint: String);
begin begin
ActivateHintData(ARect, AHint, nil); ActivateHintData(ARect, AHint, nil);

View File

@ -20,7 +20,7 @@ constructor TPaintBox.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
ControlStyle := ControlStyle + [csReplicatable]; ControlStyle := ControlStyle + [csReplicatable];
SetInitialBounds(0,0,105,105); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
procedure TPaintBox.Paint; procedure TPaintBox.Paint;
@ -45,4 +45,10 @@ begin
end; end;
end; end;
class function TPaintBox.GetControlClassDefaultSize: TPoint;
begin
Result.X:=105;
Result.Y:=105;
end;
// included by extctrls.pp // included by extctrls.pp

View File

@ -46,13 +46,13 @@ begin
fCompStyle := csProgressBar; fCompStyle := csProgressBar;
FPosition := 0; FPosition := 0;
FStep := 10; FStep := 10;
FMin := 0; FMin := 0;
FMax := 100; FMax := 100;
FSmooth := false; FSmooth := false;
FOrientation := pbHorizontal; FOrientation := pbHorizontal;
FBarShowText := false; FBarShowText := false;
FBarTextFormat := '%v from [%l-%u] (=%p%%)'; FBarTextFormat := '%v from [%l-%u] (=%p%%)';
SetInitialBounds(0,0,100,20); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -75,6 +75,12 @@ begin
ApplyChanges; ApplyChanges;
end; end;
class function TCustomProgressBar.GetControlClassDefaultSize: TPoint;
begin
Result.X:=100;
Result.Y:=20;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TCustomProgressBar.GetMin Method: TCustomProgressBar.GetMin
Params: Nothing Params: Nothing

View File

@ -51,7 +51,6 @@ begin
ChildSizing.EnlargeVertical:=crsHomogenousChildResize; ChildSizing.EnlargeVertical:=crsHomogenousChildResize;
ChildSizing.LeftRightSpacing:=6; ChildSizing.LeftRightSpacing:=6;
ChildSizing.TopBottomSpacing:=6; ChildSizing.TopBottomSpacing:=6;
SetInitialBounds(0,0,150,100);
TabStop := True; TabStop := True;
end; end;

View File

@ -62,6 +62,12 @@ begin
UpdateScrollBars; UpdateScrollBars;
end; end;
class function TScrollingWinControl.GetControlClassDefaultSize: TPoint;
begin
Result.X:=150;
Result.Y:=150;
end;
procedure TScrollingWinControl.SetHorzScrollBar(Value: TControlScrollBar); procedure TScrollingWinControl.SetHorzScrollBar(Value: TControlScrollBar);
begin begin
FHorzScrollbar.Assign(Value); FHorzScrollbar.Assign(Value);
@ -219,7 +225,7 @@ begin
ControlStyle := [csAcceptsControls, csClickEvents, csDoubleClicks]; ControlStyle := [csAcceptsControls, csClickEvents, csDoubleClicks];
SetInitialBounds(0,0, 150, 150); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
destructor TScrollingWinControl.Destroy; destructor TScrollingWinControl.Destroy;

View File

@ -17,7 +17,7 @@
constructor TShape.Create(TheOwner: TComponent); constructor TShape.Create(TheOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
SetInitialBounds(0,0,65,65); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
ControlStyle := ControlStyle + [csReplicatable]; ControlStyle := ControlStyle + [csReplicatable];
FPen := TPen.Create; FPen := TPen.Create;
FPen.OnChange := @StyleChanged; FPen.OnChange := @StyleChanged;
@ -105,3 +105,10 @@ begin
StyleChanged(Self); StyleChanged(Self);
end; end;
end; end;
class function TShape.GetControlClassDefaultSize: TPoint;
begin
Result.X:=65;
Result.Y:=65;
end;

View File

@ -137,9 +137,9 @@ var
begin begin
Result:=Width; Result:=Width;
MinW:=EffectiveMinWidth; MinW:=EffectiveMinWidth;
if (MinW>0) and (Width<MinW) then Width:=MinW; if (MinW>0) and (Result<MinW) then Result:=MinW;
MaxW:=EffectiveMaxWidth; MaxW:=EffectiveMaxWidth;
if (MaxW>0) and (Width>MaxW) then Width:=MaxW; if (MaxW>0) and (Result>MaxW) then Result:=MaxW;
end; end;
function TSizeConstraints.MinMaxHeight(Height: integer): integer; function TSizeConstraints.MinMaxHeight(Height: integer): integer;
@ -149,9 +149,9 @@ var
begin begin
Result:=Height; Result:=Height;
MinH:=EffectiveMinHeight; MinH:=EffectiveMinHeight;
if (MinH>0) and (Height<MinH) then Height:=MinH; if (MinH>0) and (Result<MinH) then Result:=MinH;
MaxH:=EffectiveMaxHeight; MaxH:=EffectiveMaxHeight;
if (MaxH>0) and (Height>MaxH) then Height:=MaxH; if (MaxH>0) and (Result>MaxH) then Result:=MaxH;
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------

View File

@ -39,7 +39,7 @@ begin
FGlyph := TButtonGlyph.Create; FGlyph := TButtonGlyph.Create;
FGlyph.OnChange := @GlyphChanged; FGlyph.OnChange := @GlyphChanged;
SetInitialBounds(0, 0, 23, 22); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
ControlStyle := ControlStyle + [csCaptureMouse]-[csSetCaption, csClickEvents]; ControlStyle := ControlStyle + [csCaptureMouse]-[csSetCaption, csClickEvents];
FLayout:= blGlyphLeft; FLayout:= blGlyphLeft;
@ -393,6 +393,12 @@ begin
Result := TSpeedButtonActionLink; Result := TSpeedButtonActionLink;
end; end;
class function TCustomSpeedButton.GetControlClassDefaultSize: TPoint;
begin
Result.X:=23;
Result.Y:=22;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TCustomSpeedButton.UpdateExclusive Method: TCustomSpeedButton.UpdateExclusive
Params: none Params: none

View File

@ -104,6 +104,12 @@ begin
if FUpdatePending then UpdateControl; if FUpdatePending then UpdateControl;
end; end;
class function TCustomFloatSpinEdit.GetControlClassDefaultSize: TPoint;
begin
Result.X:=50;
Result.Y:=23;
end;
procedure TCustomFloatSpinEdit.SetValue(const AValue: Single); procedure TCustomFloatSpinEdit.SetValue(const AValue: Single);
begin begin
if FValue = AValue then Exit; if FValue = AValue then Exit;
@ -146,7 +152,7 @@ begin
FUpdatePending := True; FUpdatePending := True;
FValueChanged := True; FValueChanged := True;
SetInitialBounds(0, 0, 50, 23); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
function TCustomFloatSpinEdit.GetLimitedValue(const AValue: Single): Single; function TCustomFloatSpinEdit.GetLimitedValue(const AValue: Single): Single;

View File

@ -530,6 +530,12 @@ begin
TTabControlStrings(FTabs).TabControlBoundsChange; TTabControlStrings(FTabs).TabControlBoundsChange;
end; end;
class function TCustomTabControl.GetControlClassDefaultSize: TPoint;
begin
Result.X:=200;
Result.Y:=150;
end;
procedure TCustomTabControl.Paint; procedure TCustomTabControl.Paint;
var var
ARect: TRect; ARect: TRect;
@ -587,7 +593,7 @@ begin
FImageChangeLink := TChangeLink.Create; FImageChangeLink := TChangeLink.Create;
FImageChangeLink.OnChange := @ImageListChange; FImageChangeLink.OnChange := @ImageListChange;
FTabs:=TTabControlNoteBookStrings.Create(Self); FTabs:=TTabControlNoteBookStrings.Create(Self);
SetInitialBounds(0,0,200,150); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
BorderWidth:=2; BorderWidth:=2;
FTabControlCreating:=false; FTabControlCreating:=false;
end; end;

View File

@ -21,7 +21,6 @@ begin
inherited Create(TheOwner); inherited Create(TheOwner);
fCompStyle := csToggleBox; fCompStyle := csToggleBox;
AutoSize:=false; AutoSize:=false;
SetInitialBounds(0,0,90,25);
end; end;
{------------------------------------------------------------------------------} {------------------------------------------------------------------------------}

View File

@ -72,7 +72,7 @@ begin
FHotImageChangeLink := TChangeLink.Create; FHotImageChangeLink := TChangeLink.Create;
FHotImageChangeLink.OnChange := @HotImageListChange; FHotImageChangeLink.OnChange := @HotImageListChange;
EdgeBorders := [ebTop]; EdgeBorders := [ebTop];
SetInitialBounds(0,0,150,26); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
Align := alTop; Align := alTop;
end; end;
@ -547,6 +547,12 @@ begin
inc(ARect.Left,Indent); inc(ARect.Left,Indent);
end; end;
class function TToolBar.GetControlClassDefaultSize: TPoint;
begin
Result.X:=150;
Result.Y:=26;
end;
function TToolBar.FindButtonFromAccel(Accel: Word): TToolButton; function TToolBar.FindButtonFromAccel(Accel: Word): TToolButton;
var var
i: Integer; i: Integer;

View File

@ -60,7 +60,7 @@ begin
FImageIndex := -1; FImageIndex := -1;
FStyle := tbsButton; FStyle := tbsButton;
ControlStyle := [csCaptureMouse, csSetCaption, csDesignNoSmoothResize]; ControlStyle := [csCaptureMouse, csSetCaption, csDesignNoSmoothResize];
SetInitialBounds(0,0,23,22); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
procedure TToolButton.MouseDown(Button: TMouseButton; Shift: TShiftState; procedure TToolButton.MouseDown(Button: TMouseButton; Shift: TShiftState;
@ -811,6 +811,12 @@ begin
end; end;
end; end;
class function TToolButton.GetControlClassDefaultSize: TPoint;
begin
Result.X:=23;
Result.Y:=22;
end;
// included by comctrls.pp // included by comctrls.pp

View File

@ -70,7 +70,7 @@ begin
FTickMarks:=tmBottomRight; FTickMarks:=tmBottomRight;
FTickStyle:=tsAuto; FTickStyle:=tsAuto;
TabStop := true; TabStop := true;
SetInitialBounds(0,0,100,25); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
end; end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
@ -313,6 +313,12 @@ begin
if Assigned (FOnChange) then FOnChange(Self); if Assigned (FOnChange) then FOnChange(Self);
end; end;
class function TCustomTrackBar.GetControlClassDefaultSize: TPoint;
begin
Result.X:=100;
Result.Y:=25;
end;
{------------------------------------------------------------------------------ {------------------------------------------------------------------------------
Method: TCustomTrackBar.SetScalePos Method: TCustomTrackBar.SetScalePos
Params: value : position of the scaling text Params: value : position of the scaling text

File diff suppressed because it is too large Load Diff

View File

@ -101,6 +101,7 @@ type
protected protected
function GetCursor: TCursor; override; function GetCursor: TCursor; override;
procedure SetCursor(Value: TCursor); override; procedure SetCursor(Value: TCursor); override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -331,6 +332,12 @@ begin
inherited SetCursor(Value); inherited SetCursor(Value);
end; end;
class function TCustomPairSplitter.GetControlClassDefaultSize: TPoint;
begin
Result.X:=90;
Result.Y:=90;
end;
constructor TCustomPairSplitter.Create(TheOwner: TComponent); constructor TCustomPairSplitter.Create(TheOwner: TComponent);
begin begin
inherited Create(TheOwner); inherited Create(TheOwner);
@ -338,7 +345,7 @@ begin
ControlStyle := ControlStyle - [csAcceptsControls]; ControlStyle := ControlStyle - [csAcceptsControls];
FSplitterType := pstHorizontal; FSplitterType := pstHorizontal;
Cursor := crHSplit; Cursor := crHSplit;
SetInitialBounds(0, 0, 90, 90); SetInitialBounds(0,0,GetControlClassDefaultSize.X,GetControlClassDefaultSize.Y);
FPosition:=45; FPosition:=45;
CreateSides; CreateSides;
end; end;

View File

@ -60,6 +60,7 @@ type
procedure InitializeWnd; override; procedure InitializeWnd; override;
procedure FinalizeWnd; override; procedure FinalizeWnd; override;
procedure Loaded; override; procedure Loaded; override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(TheOwner: TComponent); override; constructor Create(TheOwner: TComponent); override;
function GetLimitedValue(const AValue: Single): Single; function GetLimitedValue(const AValue: Single): Single;

View File

@ -160,6 +160,7 @@ type
TCustomGroupBox = class (TWinControl) TCustomGroupBox = class (TWinControl)
protected protected
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AOwner: TComponent); Override; constructor Create(AOwner: TComponent); Override;
end; end;
@ -293,6 +294,7 @@ type
procedure DoExit; override; procedure DoExit; override;
procedure DrawItem(Index: Integer; ARect: TRect; procedure DrawItem(Index: Integer; ARect: TRect;
State: TOwnerDrawState); virtual; State: TOwnerDrawState); virtual;
class function GetControlClassDefaultSize: TPoint; override;
procedure LMChanged(var Msg); message LM_CHANGED; procedure LMChanged(var Msg); message LM_CHANGED;
procedure Change; dynamic; procedure Change; dynamic;
procedure Select; dynamic; procedure Select; dynamic;
@ -484,6 +486,7 @@ type
procedure Loaded; override; procedure Loaded; override;
procedure InitializeWnd; override; procedure InitializeWnd; override;
procedure FinalizeWnd; override; procedure FinalizeWnd; override;
class function GetControlClassDefaultSize: TPoint; override;
procedure CheckIndex(const AIndex: Integer); procedure CheckIndex(const AIndex: Integer);
function GetItemHeight: Integer; function GetItemHeight: Integer;
function GetItemIndex: integer; virtual; function GetItemIndex: integer; virtual;
@ -671,6 +674,7 @@ type
procedure SetSelText(const Val: string); virtual; procedure SetSelText(const Val: string); virtual;
procedure RealSetText(const Value: TCaption); override; procedure RealSetText(const Value: TCaption); override;
function ChildClassAllowed(ChildClass: TClass): boolean; override; function ChildClassAllowed(ChildClass: TClass): boolean; override;
class function GetControlClassDefaultSize: TPoint; override;
procedure KeyUp(var Key: Word; Shift: TShiftState); override; procedure KeyUp(var Key: Word; Shift: TShiftState); override;
procedure WMChar(var Message: TLMChar); message LM_CHAR; procedure WMChar(var Message: TLMChar); message LM_CHAR;
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y: Integer); override; procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X, Y: Integer); override;
@ -752,6 +756,7 @@ type
function WordWrapIsStored: boolean; virtual; function WordWrapIsStored: boolean; virtual;
procedure ControlKeyDown(var Key: Word; Shift: TShiftState); override; procedure ControlKeyDown(var Key: Word; Shift: TShiftState); override;
procedure CNChar(var Message: TLMKeyUp); message CN_CHAR; procedure CNChar(var Message: TLMKeyUp); message CN_CHAR;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
@ -893,6 +898,7 @@ type
procedure SetFocusControl(Val: TWinControl); virtual; procedure SetFocusControl(Val: TWinControl); virtual;
procedure SetShowAccelChar(Val: boolean); virtual; procedure SetShowAccelChar(Val: boolean); virtual;
function DialogChar(var Message: TLMKey): boolean; override; function DialogChar(var Message: TLMKey): boolean; override;
class function GetControlClassDefaultSize: TPoint; override;
public public
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify; property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
@ -1005,6 +1011,7 @@ type
function DialogChar(var Message: TLMKey): boolean; override; function DialogChar(var Message: TLMKey): boolean; override;
function ChildClassAllowed(ChildClass: TClass): boolean; override; function ChildClassAllowed(ChildClass: TClass): boolean; override;
function IsBorderSpacingInnerBorderStored: Boolean; override; function IsBorderSpacingInnerBorderStored: Boolean; override;
class function GetControlClassDefaultSize: TPoint; override;
property ParentColor default false; property ParentColor default false;
function UseRightToLeftAlignment: Boolean; override; function UseRightToLeftAlignment: Boolean; override;
procedure WSSetDefault; procedure WSSetDefault;
@ -1097,6 +1104,7 @@ type
procedure SetChecked(Value: Boolean); override; procedure SetChecked(Value: Boolean); override;
procedure RealSetText(const Value: TCaption); override; procedure RealSetText(const Value: TCaption); override;
procedure ApplyChanges; virtual; procedure ApplyChanges; virtual;
class function GetControlClassDefaultSize: TPoint; override;
procedure Loaded; override; procedure Loaded; override;
procedure WSSetText(const AText: String); override; procedure WSSetText(const AText: String); override;
public public
@ -1355,6 +1363,7 @@ type
procedure TextChanged; override; procedure TextChanged; override;
procedure Resize; override; procedure Resize; override;
procedure FontChanged(Sender: TObject); override; procedure FontChanged(Sender: TObject); override;
class function GetControlClassDefaultSize: TPoint; override;
procedure WMActivate(var Message: TLMActivate); message LM_ACTIVATE; procedure WMActivate(var Message: TLMActivate); message LM_ACTIVATE;
procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure Notification(AComponent: TComponent; Operation: TOperation); override;
@ -1380,12 +1389,12 @@ type
property WordWrap: Boolean read FWordWrap write SetWordWrap default false; property WordWrap: Boolean read FWordWrap write SetWordWrap default false;
property OptimalFill: Boolean read FOptimalFill write SetOptimalFill default false; property OptimalFill: Boolean read FOptimalFill write SetOptimalFill default false;
public public
constructor Create(TheOwner: TComponent); override;
function CalcFittingFontHeight(const TheText: string; function CalcFittingFontHeight(const TheText: string;
MaxWidth, MaxHeight: Integer; var FontHeight, MaxWidth, MaxHeight: Integer; var FontHeight,
NeededWidth, NeededHeight: integer): Boolean; NeededWidth, NeededHeight: integer): Boolean;
function ColorIsStored: boolean; override; function ColorIsStored: boolean; override;
function AdjustFontForOptimalFill: Boolean; function AdjustFontForOptimalFill: Boolean;
constructor Create(TheOwner: TComponent); override;
procedure Paint; override; procedure Paint; override;
property AutoSize default True; property AutoSize default True;
property Color default clNone; property Color default clNone;