home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Plus! (NZ) 2001 June
/
HDC50.iso
/
Runimage
/
Delphi50
/
Doc
/
EXTCTRLS.INT
< prev
next >
Wrap
Text File
|
1999-08-11
|
19KB
|
606 lines
{*******************************************************}
{ }
{ Borland Delphi Visual Component Library }
{ }
{ Copyright (c) 1995,99 Inprise Corporation }
{ }
{*******************************************************}
unit ExtCtrls;
{$S-,W-,R-,H+,X+}
{$C PRELOAD}
interface
uses Messages, Windows, SysUtils, Classes, Controls, Forms, Menus, Graphics,
StdCtrls;
type
TShapeType = (stRectangle, stSquare, stRoundRect, stRoundSquare,
stEllipse, stCircle);
TShape = class(TGraphicControl)
protected
procedure Paint; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
procedure StyleChanged(Sender: TObject);
property Align;
property Anchors;
property Brush: TBrush;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Constraints;
property ParentShowHint;
property Pen: TPen;
property Shape: TShapeType default stRectangle;
property ShowHint;
property Visible;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
end;
TPaintBox = class(TGraphicControl)
protected
procedure Paint; override;
public
constructor Create(AOwner: TComponent); override;
property Canvas;
published
property Align;
property Anchors;
property Color;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Visible;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnPaint: TNotifyEvent;
property OnStartDock;
property OnStartDrag;
end;
TImage = class(TGraphicControl)
protected
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; override;
function DestRect: TRect;
function DoPaletteChange: Boolean;
function GetPalette: HPALETTE; override;
procedure Paint; override;
procedure Progress(Sender: TObject; Stage: TProgressStage;
PercentDone: Byte; RedrawNow: Boolean; const R: TRect; const Msg: string); dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Canvas: TCanvas;
published
property Align;
property Anchors;
property AutoSize;
property Center: Boolean default False;
property Constraints;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property IncrementalDisplay: Boolean default False;
property ParentShowHint;
property Picture: TPicture;
property PopupMenu;
property ShowHint;
property Stretch: Boolean default False;
property Transparent: Boolean default False;
property Visible;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnProgress: TProgressEvent;
property OnStartDock;
property OnStartDrag;
end;
TBevelStyle = (bsLowered, bsRaised);
TBevelShape = (bsBox, bsFrame, bsTopLine, bsBottomLine, bsLeftLine,
bsRightLine, bsSpacer);
TBevel = class(TGraphicControl)
protected
procedure Paint; override;
public
constructor Create(AOwner: TComponent); override;
published
property Align;
property Anchors;
property Constraints;
property ParentShowHint;
property Shape: TBevelShape default bsBox;
property ShowHint;
property Style: TBevelStyle default bsLowered;
property Visible;
end;
TTimer = class(TComponent)
protected
procedure Timer; dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property Enabled: Boolean default True;
property Interval: Cardinal default 1000;
property OnTimer: TNotifyEvent;
end;
TPanelBevel = TBevelCut;
TCustomPanel = class(TCustomControl)
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure AdjustClientRect(var Rect: TRect); override;
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; override;
procedure Paint; override;
property Alignment: TAlignment default taCenter;
property BevelInner: TPanelBevel default bvNone;
property BevelOuter: TPanelBevel default bvRaised;
property BevelWidth: TBevelWidth default 1;
property BorderWidth: TBorderWidth default 0;
property BorderStyle: TBorderStyle default bsNone;
property Color default clBtnFace;
property FullRepaint: Boolean default True;
property Locked: Boolean default False;
property ParentColor default False;
public
constructor Create(AOwner: TComponent); override;
function GetControlsAlignment: TAlignment; override;
end;
TPanel = class(TCustomPanel)
public
property DockManager;
published
property Align;
property Alignment;
property Anchors;
property AutoSize;
property BevelInner;
property BevelOuter;
property BevelWidth;
property BiDiMode;
property BorderWidth;
property BorderStyle;
property Caption;
property Color;
property Constraints;
property Ctl3D;
property UseDockManager default True;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FullRepaint;
property Font;
property Locked;
property ParentBiDiMode;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnCanResize;
property OnClick;
property OnConstrainedResize;
property OnContextPopup;
property OnDockDrop;
property OnDockOver;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
TPage = class(TCustomControl)
protected
procedure ReadState(Reader: TReader); override;
procedure Paint; override;
public
constructor Create(AOwner: TComponent); override;
published
property Caption;
property Height stored False;
property TabOrder stored False;
property Visible stored False;
property Width stored False;
end;
TNotebook = class(TCustomControl)
protected
procedure CreateParams(var Params: TCreateParams); override;
function GetChildOwner: TComponent; override;
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
procedure ReadState(Reader: TReader); override;
procedure ShowControl(AControl: TControl); override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
published
property ActivePage: string;
property Align;
property Anchors;
property Color;
property Ctl3D;
property DragCursor;
property DragKind;
property DragMode;
property Font;
property Enabled;
property Constraints;
property PageIndex: Integer default 0;
property Pages: TStrings;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnPageChanged: TNotifyEvent;
property OnStartDock;
property OnStartDrag;
end;
{ THeader
Purpose - Creates sectioned visual header that allows each section to be
resized with the mouse.
Features - This is a design-interactive control. In design mode, the
sections are named using the string-list editor. Each section
can now be manually resized using the right mouse button the grab
the divider and drag to the new size. Changing the section list
at design (or even run-time), will attempt to maintain the
section widths for sections that have not been changed.
Properties:
Align - Standard property.
AllowResize - If True, the control allows run-time mouse resizing of the
sections.
BorderStyle - Turns the border on and off.
Font - Standard property.
Sections - A special string-list that contains the section text.
ParentFont - Standard property.
OnSizing - Event called for each mouse move during a section resize
operation.
OnSized - Event called once the size operation is complete.
SectionWidth - Array property allowing run-time getting and setting of
each section's width. }
TSectionEvent = procedure(Sender: TObject;
ASection, AWidth: Integer) of object;
THeader = class(TCustomControl)
protected
procedure Paint; override;
procedure CreateParams(var Params: TCreateParams); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure Sizing(ASection, AWidth: Integer); dynamic;
procedure Sized(ASection, AWidth: Integer); dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property SectionWidth[X: Integer]: Integer;
published
property Align;
property AllowResize: Boolean default True;
property Anchors;
property BorderStyle: TBorderStyle default bsSingle;
property Constraints;
property Enabled;
property Font;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property Sections: TStrings;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnContextPopup;
property OnSizing: TSectionEvent;
property OnSized: TSectionEvent;
end;
TCustomRadioGroup = class(TCustomGroupBox)
protected
procedure Loaded; override;
procedure ReadState(Reader: TReader); override;
function CanModify: Boolean; virtual;
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
property Columns: Integer default 1;
property ItemIndex: Integer default -1;
property Items: TStrings;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure FlipChildren(AllLevels: Boolean); override;
end;
TRadioGroup = class(TCustomRadioGroup)
published
property Align;
property Anchors;
property BiDiMode;
property Caption;
property Color;
property Columns;
property Ctl3D;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ItemIndex;
property Items;
property Constraints;
property ParentBiDiMode;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnStartDock;
property OnStartDrag;
end;
NaturalNumber = 1..High(Integer);
TCanResizeEvent = procedure(Sender: TObject; var NewSize: Integer;
var Accept: Boolean) of object;
TResizeStyle = (rsNone, rsLine, rsUpdate, rsPattern);
TSplitter = class(TGraphicControl)
protected
function CanResize(var NewSize: Integer): Boolean; reintroduce; virtual;
function DoCanResize(var NewSize: Integer): Boolean; virtual;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure Paint; override;
procedure RequestAlign; override;
procedure StopSizing; dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property Canvas;
published
property Align default alLeft;
property AutoSnap: Boolean default True;
property Beveled: Boolean default False;
property Color;
property Constraints;
property MinSize: NaturalNumber default 30;
property ParentColor;
property ResizeStyle: TResizeStyle default rsPattern;
property Visible;
property OnCanResize: TCanResizeEvent;
property OnMoved: TNotifyEvent;
property OnPaint: TNotifyEvent;
end;
{ TControlBar }
TBandPaintOption = (bpoGrabber, bpoFrame);
TBandPaintOptions = set of TBandPaintOption;
TBandDragEvent = procedure (Sender: TObject; Control: TControl;
var Drag: Boolean) of object;
TBandInfoEvent = procedure (Sender: TObject; Control: TControl;
var Insets: TRect; var PreferredSize, RowCount: Integer) of object;
TBandMoveEvent = procedure (Sender: TObject; Control: TControl;
var ARect: TRect) of object;
TBandPaintEvent = procedure (Sender: TObject; Control: TControl;
Canvas: TCanvas; var ARect: TRect; var Options: TBandPaintOptions) of object;
TRowSize = 1..MaxInt;
TCustomControlBar = class(TCustomControl)
protected
procedure AlignControls(AControl: TControl; var ARect: TRect); override;
function CanAutoSize(var NewWidth, NewHeight: Integer): Boolean; override;
procedure CreateParams(var Params: TCreateParams); override;
procedure DoBandMove(Control: TControl; var ARect: TRect); virtual;
procedure DoBandPaint(Control: TControl; Canvas: TCanvas; var ARect: TRect;
var Options: TBandPaintOptions); virtual;
procedure DockOver(Source: TDragDockObject; X, Y: Integer; State: TDragState;
var Accept: Boolean); override;
function DoPaletteChange: Boolean;
function DragControl(AControl: TControl; X, Y: Integer;
KeepCapture: Boolean = False): Boolean; virtual;
procedure GetControlInfo(AControl: TControl; var Insets: TRect;
var PreferredSize, RowCount: Integer); virtual;
function GetPalette: HPALETTE; override;
procedure GetSiteInfo(Client: TControl; var InfluenceRect: TRect;
MousePos: TPoint; var CanDock: Boolean); override;
function HitTest(X, Y: Integer): TControl;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure Paint; override;
procedure PaintControlFrame(Canvas: TCanvas; AControl: TControl;
var ARect: TRect); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure FlipChildren(AllLevels: Boolean); override;
procedure StickControls; virtual;
property Picture: TPicture;
protected
property AutoDock: Boolean default True;
property AutoDrag: Boolean default True;
property AutoSize;
property BevelKind default bkTile;
property DockSite default True;
property RowSize: TRowSize default 26;
property RowSnap: Boolean default True;
property OnBandDrag: TBandDragEvent;
property OnBandInfo: TBandInfoEvent;
property OnBandMove: TBandMoveEvent;
property OnBandPaint: TBandPaintEvent;
property OnPaint: TNotifyEvent;
end;
TControlBar = class(TCustomControlBar)
public
property Canvas;
published
property Align;
property Anchors;
property AutoDock;
property AutoDrag;
property AutoSize;
property BevelEdges;
property BevelInner;
property BevelOuter;
property BevelKind;
property BevelWidth;
property BorderWidth;
property Color;
property Constraints;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property Picture;
property PopupMenu;
property RowSize;
property RowSnap;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnBandDrag;
property OnBandInfo;
property OnBandMove;
property OnBandPaint;
property OnCanResize;
property OnClick;
property OnConstrainedResize;
property OnContextPopup;
property OnDockDrop;
property OnDockOver;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnPaint;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
procedure Frame3D(Canvas: TCanvas; var Rect: TRect;
TopColor, BottomColor: TColor; Width: Integer);
procedure NotebookHandlesNeeded(Notebook: TNotebook);
implementation