home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 May
/
VPR9705A.ISO
/
VPR_DATA
/
PROGRAM
/
CBTRIAL
/
SETUP
/
DATA.Z
/
FORMS.INT
< prev
next >
Wrap
Text File
|
1997-02-14
|
15KB
|
434 lines
{*******************************************************}
{ }
{ Delphi Visual Component Library }
{ }
{ Copyright (c) 1995-1997 Borland International }
{ }
{*******************************************************}
unit Forms; // $Revision: 1.12 $
{$P+,S-,W-,R-}
{$C PRELOAD}
interface
uses Messages, Windows, SysUtils, Classes, Graphics, Menus, Controls;
type
{ Forward declarations }
TScrollingWinControl = class;
TForm = class;
{ TControlScrollBar }
TScrollBarKind = (sbHorizontal, sbVertical);
TScrollBarInc = 1..32767;
TControlScrollBar = class(TPersistent)
public
procedure Assign(Source: TPersistent); override;
property Kind: TScrollBarKind;
property ScrollPos: Integer;
published
property Margin: Word default 0;
property Increment: TScrollBarInc default 8;
property Range: Integer default 0;
property Position: Integer default 0;
property Tracking: Boolean default False;
property Visible: Boolean default True;
end;
{ TScrollingWinControl }
TScrollingWinControl = class(TWinControl)
protected
procedure AutoScrollInView(AControl: TControl);
procedure ChangeScale(M, D: Integer); override;
procedure CreateWnd; override;
procedure AlignControls(AControl: TControl; var ARect: TRect); override;
property AutoScroll: Boolean default True;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure ScrollInView(AControl: TControl);
published
property HorzScrollBar: TControlScrollBar;
property VertScrollBar: TControlScrollBar;
end;
{ TScrollBox }
TFormBorderStyle = (bsNone, bsSingle, bsSizeable, bsDialog, bsToolWindow,
bsSizeToolWin);
TBorderStyle = bsNone..bsSingle;
TScrollBox = class(TScrollingWinControl)
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure Resize; dynamic;
public
constructor Create(AOwner: TComponent); override;
published
property Align;
property AutoScroll;
property BorderStyle: TBorderStyle default bsSingle;
property DragCursor;
property DragMode;
property Enabled;
property Color nodefault;
property Ctl3D;
property Font;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize: TNotifyEvent;
end;
{ TDesigner }
TDesigner = class(TObject)
public
function IsDesignMsg(Sender: TControl; var Message: TMessage): Boolean;
virtual; abstract;
procedure Modified; virtual; abstract;
procedure Notification(AComponent: TComponent;
Operation: TOperation); virtual; abstract;
procedure PaintGrid; virtual; abstract;
procedure ValidateRename(AComponent: TComponent;
const CurName, NewName: string); virtual; abstract;
property IsControl: Boolean;
property Form: TForm;
end;
{ TOleFormObject }
TOleFormObject = class(TObject)
protected
procedure OnDestroy; virtual; abstract;
procedure OnResize; virtual; abstract;
end;
{ TForm }
TWindowState = (wsNormal, wsMinimized, wsMaximized);
TFormStyle = (fsNormal, fsMDIChild, fsMDIForm, fsStayOnTop);
TBorderIcon = (biSystemMenu, biMinimize, biMaximize, biHelp);
TBorderIcons = set of TBorderIcon;
TPosition = (poDesigned, poDefault, poDefaultPosOnly, poDefaultSizeOnly,
poScreenCenter);
TPrintScale = (poNone, poProportional, poPrintToFit);
TShowAction = (saIgnore, saRestore, saMinimize, saMaximize);
TTileMode = (tbHorizontal, tbVertical);
TModalResult = Low(Integer)..High(Integer);
TCloseAction = (caNone, caHide, caFree, caMinimize);
TCloseEvent = procedure(Sender: TObject; var Action: TCloseAction) of object;
TCloseQueryEvent = procedure(Sender: TObject;
var CanClose: Boolean) of object;
TFormState = set of (fsCreating, fsVisible, fsShowing, fsModal,
fsCreatedMDIChild);
TForm = class(TScrollingWinControl)
protected
procedure Activate; dynamic;
procedure ActiveChanged; dynamic;
procedure ChangeScale(M, D: Integer); override;
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWindowHandle(const Params: TCreateParams); override;
procedure CreateWnd; override;
procedure Deactivate; dynamic;
procedure DefaultHandler(var Message); override;
procedure DefineProperties(Filer: TFiler); override;
procedure DestroyWindowHandle; override;
procedure DoHide; dynamic;
procedure DoShow; dynamic;
function GetClientRect: TRect; override;
procedure GetChildren(Proc: TGetChildProc); override;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure Paint; dynamic;
procedure PaintWindow(DC: HDC); override;
function PaletteChanged(Foreground: Boolean): Boolean; override;
procedure SetChildOrder(Child: TComponent; Order: Integer); override;
procedure ReadState(Reader: TReader); override;
procedure Resize; dynamic;
procedure SetParent(AParent: TWinControl); override;
procedure ValidateRename(AComponent: TComponent;
const CurName, NewName: string); override;
procedure VisibleChanging; override;
procedure WndProc(var Message: TMessage); override;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
public
constructor Create(AOwner: TComponent); override;
constructor CreateNew(AOwner: TComponent; Dummy: Integer);
destructor Destroy; override;
procedure ArrangeIcons;
procedure Cascade;
procedure Close;
function CloseQuery: Boolean;
procedure DefocusControl(Control: TWinControl; Removing: Boolean);
procedure FocusControl(Control: TWinControl);
function GetFormImage: TBitmap;
procedure Hide;
procedure Next;
procedure Previous;
procedure Print;
procedure Release;
procedure SendCancelMode(Sender: TControl);
procedure SetFocus; override;
function SetFocusedControl(Control: TWinControl): Boolean;
procedure Show;
function ShowModal: Integer;
procedure Tile;
property Active: Boolean;
property ActiveMDIChild: TForm;
property ActiveOleControl: TWinControl;
property Canvas: TCanvas;
property ClientHandle: HWND;
property Designer: TDesigner;
property DropTarget: Boolean;
property IgnoreFontProperty: Boolean;
property ModalResult: TModalResult;
property MDIChildCount: Integer;
property MDIChildren[I: Integer]: TForm;
property OleFormObject: TOleFormObject;
property TileMode: TTileMode default tbHorizontal;
published
property ActiveControl: TWinControl;
property BorderIcons: TBorderIcons default [biSystemMenu, biMinimize, biMaximize];
property BorderStyle: TFormBorderStyle default bsSizeable;
property AutoScroll stored IsAutoScrollStored;
property Caption stored IsForm;
property ClientHeight write SetClientHeight stored IsClientSizeStored;
property ClientWidth write SetClientWidth stored IsClientSizeStored;
property Ctl3D default True;
property Color stored IsColorStored;
property Enabled;
property Font;
property FormStyle: TFormStyle default fsNormal;
property Height stored IsFormSizeStored;
property HorzScrollBar stored IsForm;
property Icon: TIcon;
property KeyPreview: Boolean default False;
property Menu: TMainMenu;
property ObjectMenuItem: TMenuItem;
property PixelsPerInch: Integer;
property PopupMenu stored IsForm;
property Position: TPosition default poDesigned;
property PrintScale: TPrintScale default poProportional;
property Scaled: Boolean default True;
property ShowHint;
property VertScrollBar stored IsForm;
property Visible write SetVisible default False;
property Width stored IsFormSizeStored;
property WindowState: TWindowState default wsNormal;
property WindowMenu: TMenuItem;
property OnActivate: TNotifyEvent;
property OnClick stored IsForm;
property OnClose: TCloseEvent;
property OnCloseQuery: TCloseQueryEvent;
property OnCreate: TNotifyEvent;
property OnDblClick stored IsForm;
property OnDestroy: TNotifyEvent;
property OnDeactivate: TNotifyEvent;
property OnDragDrop stored IsForm;
property OnDragOver stored IsForm;
property OnHide: TNotifyEvent;
property OnKeyDown stored IsForm;
property OnKeyPress stored IsForm;
property OnKeyUp stored IsForm;
property OnMouseDown stored IsForm;
property OnMouseMove stored IsForm;
property OnMouseUp stored IsForm;
property OnPaint: TNotifyEvent;
property OnResize: TNotifyEvent;
property OnShow: TNotifyEvent;
end;
TFormClass = class of TForm;
{ TDataModule }
TDataModule = class(TComponent)
protected
procedure DefineProperties(Filer: TFiler); override;
procedure GetChildren(Proc: TGetChildProc); override;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
public
constructor Create(AOwner: TComponent); override;
constructor CreateNew(AOwner: TComponent; Dummy: Integer);
destructor Destroy; override;
property DesignOffset: TPoint;
property DesignSize: TPoint;
published
property OnCreate: TNotifyEvent;
property OnDestroy: TNotifyEvent;
end;
{ TScreen }
PCursorRec = ^TCursorRec;
TCursorRec = record
Next: PCursorRec;
Index: Integer;
Handle: HCURSOR;
end;
TScreen = class(TComponent)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property ActiveControl: TWinControl;
property ActiveForm: TForm;
property Cursor: TCursor;
property Cursors[Index: Integer]: HCURSOR;
property DataModules[Index: Integer]: TDataModule;
property DataModuleCount: Integer;
property Fonts: TStrings;
property Height: Integer;
property Imes: TStrings;
property DefaultIme: string;
property DefaultKbLayout: HKL;
property RestoreFocusForms: TList read FRestoreFocusForms write FRestoreFocusForms;
property PixelsPerInch: Integer;
property Width: Integer;
property Forms[Index: Integer]: TForm;
property FormCount: Integer;
property OnActiveControlChange: TNotifyEvent;
property OnActiveFormChange: TNotifyEvent;
end;
{ TApplication }
TTimerMode = (tmShow, tmHide);
THintInfo = record
HintControl: TControl;
HintPos: TPoint;
HintMaxWidth: Integer;
HintColor: TColor;
CursorRect: TRect;
CursorPos: TPoint;
end;
TMessageEvent = procedure (var Msg: TMsg; var Handled: Boolean) of object;
TExceptionEvent = procedure (Sender: TObject; E: Exception) of object;
TIdleEvent = procedure (Sender: TObject; var Done: Boolean) of object;
TShowHintEvent = procedure (var HintStr: string; var CanShow: Boolean;
var HintInfo: THintInfo) of object;
TWindowHook = function (var Message: TMessage): Boolean of object;
TApplication = class(TComponent)
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure BringToFront;
procedure ControlDestroyed(Control: TControl);
procedure CancelHint;
procedure CreateForm(InstanceClass: TComponentClass; var Reference);
procedure CreateHandle;
procedure HandleException(Sender: TObject);
procedure HandleMessage;
function HelpCommand(Command: Integer; Data: Longint): Boolean;
function HelpContext(Context: THelpContext): Boolean;
function HelpJump(const JumpID: string): Boolean;
procedure HideHint;
procedure HintMouseMessage(Control: TControl; var Message: TMessage);
procedure HookMainWindow(Hook: TWindowHook);
procedure Initialize;
function MessageBox(Text, Caption: PChar; Flags: Word): Integer;
procedure Minimize;
procedure NormalizeTopMosts;
procedure ProcessMessages;
procedure Restore;
procedure RestoreTopMosts;
procedure Run;
procedure ShowException(E: Exception);
procedure Terminate;
procedure UnhookMainWindow(Hook: TWindowHook);
property Active: Boolean;
property DialogHandle: HWnd;
property ExeName: string;
property Handle: HWnd;
property HelpFile: string;
property Hint: string;
property HintColor: TColor;
property HintPause: Integer;
property HintShortPause: Integer;
property HintHidePause: Integer;
property Icon: TIcon;
property IgnoreFontProperty: Boolean;
property MainForm: TForm;
property ShowHint: Boolean;
property ShowMainForm: Boolean;
property Terminated: Boolean;
property Title: string;
property UpdateFormatSettings: Boolean;
property OnActivate: TNotifyEvent;
property OnDeactivate: TNotifyEvent;
property OnException: TExceptionEvent;
property OnIdle: TIdleEvent;
property OnHelp: THelpEvent;
property OnHint: TNotifyEvent;
property OnMessage: TMessageEvent;
property OnMinimize: TNotifyEvent;
property OnRestore: TNotifyEvent;
property OnShowHint: TShowHintEvent;
end;
TWndMethod = procedure(var Message: TMessage) of object;
{ Global objects }
var
Application: TApplication;
Screen: TScreen;
Ctl3DBtnWndProc: Pointer = nil;
Ctl3DDlgFramePaint: function(Window: HWnd; Msg, wParam, lParam: Longint): Longint stdcall = nil;
Ctl3DCtlColorEx : function(Window: HWnd; Msg, wParam, lParam: Longint): Longint stdcall = nil;
HintWindowClass: THintWindowClass = THintWindow;
function GetParentForm(Control: TControl): TForm;
function ValidParentForm(Control: TControl): TForm;
function DisableTaskWindows(ActiveWindow: HWnd): Pointer;
procedure EnableTaskWindows(WindowList: Pointer);
function MakeObjectInstance(Method: TWndMethod): Pointer;
procedure FreeObjectInstance(ObjectInstance: Pointer);
function IsAccel(VK: Word; const Str: string): Boolean;
function Subclass3DWnd(Wnd: HWnd): Boolean;
procedure Subclass3DDlg(Wnd: HWnd; Flags: Word);
procedure SetAutoSubClass(Enable: Boolean);
function AllocateHWnd(Method: TWndMethod): HWND;
procedure DeallocateHWnd(Wnd: HWND);
procedure DoneCtl3D;
procedure InitCtl3D;
function KeysToShiftState(Keys: Word): TShiftState;
function KeyDataToShiftState(KeyData: Longint): TShiftState;
implementation