home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / CONTROLS.INT < prev    next >
Text File  |  1997-02-14  |  26KB  |  711 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Visual Component Library                 }
  5. {                                                       }
  6. {       Copyright (c) 1995,96 Borland International     }
  7. {                                                       }
  8. {*******************************************************}
  9.  
  10. unit Controls;
  11.  
  12. {$P+,S-,W-,R-}
  13. {$C PRELOAD}
  14.  
  15. interface
  16.  
  17. {$R CONTROLS}
  18.  
  19. uses Messages, Windows, Classes, Sysutils, Graphics, Menus, CommCtrl, Imm;
  20.  
  21. { VCL control message IDs }
  22.  
  23. const
  24.   CM_BASE                   = $B000;
  25.   CM_ACTIVATE               = CM_BASE + 0;
  26.   CM_DEACTIVATE             = CM_BASE + 1;
  27.   CM_GOTFOCUS               = CM_BASE + 2;
  28.   CM_LOSTFOCUS              = CM_BASE + 3;
  29.   CM_CANCELMODE             = CM_BASE + 4;
  30.   CM_DIALOGKEY              = CM_BASE + 5;
  31.   CM_DIALOGCHAR             = CM_BASE + 6;
  32.   CM_FOCUSCHANGED           = CM_BASE + 7;
  33.   CM_PARENTFONTCHANGED      = CM_BASE + 8;
  34.   CM_PARENTCOLORCHANGED     = CM_BASE + 9;
  35.   CM_HITTEST                = CM_BASE + 10;
  36.   CM_VISIBLECHANGED         = CM_BASE + 11;
  37.   CM_ENABLEDCHANGED         = CM_BASE + 12;
  38.   CM_COLORCHANGED           = CM_BASE + 13;
  39.   CM_FONTCHANGED            = CM_BASE + 14;
  40.   CM_CURSORCHANGED          = CM_BASE + 15;
  41.   CM_CTL3DCHANGED           = CM_BASE + 16;
  42.   CM_PARENTCTL3DCHANGED     = CM_BASE + 17;
  43.   CM_TEXTCHANGED            = CM_BASE + 18;
  44.   CM_MOUSEENTER             = CM_BASE + 19;
  45.   CM_MOUSELEAVE             = CM_BASE + 20;
  46.   CM_MENUCHANGED            = CM_BASE + 21;
  47.   CM_APPKEYDOWN             = CM_BASE + 22;
  48.   CM_APPSYSCOMMAND          = CM_BASE + 23;
  49.   CM_BUTTONPRESSED          = CM_BASE + 24;
  50.   CM_SHOWINGCHANGED         = CM_BASE + 25;
  51.   CM_ENTER                  = CM_BASE + 26;
  52.   CM_EXIT                   = CM_BASE + 27;
  53.   CM_DESIGNHITTEST          = CM_BASE + 28;
  54.   CM_ICONCHANGED            = CM_BASE + 29;
  55.   CM_WANTSPECIALKEY         = CM_BASE + 30;
  56.   CM_INVOKEHELP             = CM_BASE + 31;
  57.   CM_WINDOWHOOK             = CM_BASE + 32;
  58.   CM_RELEASE                = CM_BASE + 33;
  59.   CM_SHOWHINTCHANGED        = CM_BASE + 34;
  60.   CM_PARENTSHOWHINTCHANGED  = CM_BASE + 35;
  61.   CM_SYSCOLORCHANGE         = CM_BASE + 36;
  62.   CM_WININICHANGE           = CM_BASE + 37;
  63.   CM_FONTCHANGE             = CM_BASE + 38;
  64.   CM_TIMECHANGE             = CM_BASE + 39;
  65.   CM_TABSTOPCHANGED         = CM_BASE + 40;
  66.   CM_UIACTIVATE             = CM_BASE + 41;
  67.   CM_UIDEACTIVATE           = CM_BASE + 42;
  68.   CM_DOCWINDOWACTIVATE      = CM_BASE + 43;
  69.   CM_CONTROLLISTCHANGE      = CM_BASE + 44;
  70.   CM_GETDATALINK            = CM_BASE + 45;
  71.   CM_CHILDKEY               = CM_BASE + 46;
  72.   CM_DRAG                   = CM_BASE + 47;
  73.   CM_HINTSHOW               = CM_BASE + 48;
  74.   CM_DIALOGHANDLE           = CM_BASE + 49;
  75.   CM_ISTOOLCONTROL          = CM_BASE + 50;
  76.   CM_RECREATEWND            = CM_BASE + 51;
  77.   CM_INVALIDATE             = CM_BASE + 52;
  78.  
  79. { VCL control notification IDs }
  80.  
  81. const
  82.   CN_BASE              = $BC00;
  83.   CN_CHARTOITEM        = CN_BASE + WM_CHARTOITEM;
  84.   CN_COMMAND           = CN_BASE + WM_COMMAND;
  85.   CN_COMPAREITEM       = CN_BASE + WM_COMPAREITEM;
  86.   CN_CTLCOLORBTN       = CN_BASE + WM_CTLCOLORBTN;
  87.   CN_CTLCOLORDLG       = CN_BASE + WM_CTLCOLORDLG;
  88.   CN_CTLCOLOREDIT      = CN_BASE + WM_CTLCOLOREDIT;
  89.   CN_CTLCOLORLISTBOX   = CN_BASE + WM_CTLCOLORLISTBOX;
  90.   CN_CTLCOLORMSGBOX    = CN_BASE + WM_CTLCOLORMSGBOX;
  91.   CN_CTLCOLORSCROLLBAR = CN_BASE + WM_CTLCOLORSCROLLBAR;
  92.   CN_CTLCOLORSTATIC    = CN_BASE + WM_CTLCOLORSTATIC;
  93.   CN_DELETEITEM        = CN_BASE + WM_DELETEITEM;
  94.   CN_DRAWITEM          = CN_BASE + WM_DRAWITEM;
  95.   CN_HSCROLL           = CN_BASE + WM_HSCROLL;
  96.   CN_MEASUREITEM       = CN_BASE + WM_MEASUREITEM;
  97.   CN_PARENTNOTIFY      = CN_BASE + WM_PARENTNOTIFY;
  98.   CN_VKEYTOITEM        = CN_BASE + WM_VKEYTOITEM;
  99.   CN_VSCROLL           = CN_BASE + WM_VSCROLL;
  100.   CN_KEYDOWN           = CN_BASE + WM_KEYDOWN;
  101.   CN_KEYUP             = CN_BASE + WM_KEYUP;
  102.   CN_CHAR              = CN_BASE + WM_CHAR;
  103.   CN_SYSKEYDOWN        = CN_BASE + WM_SYSKEYDOWN;
  104.   CN_SYSCHAR           = CN_BASE + WM_SYSCHAR;
  105.   CN_NOTIFY            = CN_BASE + WM_NOTIFY;
  106.  
  107. { TModalResult values }
  108.  
  109. const
  110.   mrNone   = 0;
  111.   mrOk     = idOk;
  112.   mrCancel = idCancel;
  113.   mrAbort  = idAbort;
  114.   mrRetry  = idRetry;
  115.   mrIgnore = idIgnore;
  116.   mrYes    = idYes;
  117.   mrNo     = idNo;
  118.   mrAll    = mrNo + 1;
  119.  
  120. { Cursor identifiers }
  121.  
  122. { Cursor type }
  123. type
  124.   TCursor = -32768..32767;
  125.  
  126. const
  127.   crDefault     = TCursor(0);
  128.   crNone        = TCursor(-1);
  129.   crArrow       = TCursor(-2);
  130.   crCross       = TCursor(-3);
  131.   crIBeam       = TCursor(-4);
  132.   crSize        = TCursor(-5);
  133.   crSizeNESW    = TCursor(-6);
  134.   crSizeNS      = TCursor(-7);
  135.   crSizeNWSE    = TCursor(-8);
  136.   crSizeWE      = TCursor(-9);
  137.   crUpArrow     = TCursor(-10);
  138.   crHourGlass   = TCursor(-11);
  139.   crDrag        = TCursor(-12);
  140.   crNoDrop      = TCursor(-13);
  141.   crHSplit      = TCursor(-14);
  142.   crVSplit      = TCursor(-15);
  143.   crMultiDrag   = TCursor(-16);
  144.   crSQLWait     = TCursor(-17);
  145.   crNo          = TCursor(-18);
  146.   crAppStart    = TCursor(-19);
  147.   crHelp        = TCursor(-20);
  148.  
  149. type
  150.  
  151. { Forward declarations }
  152.  
  153.   TDragObject = class;
  154.   TControl = class;
  155.   TWinControl = class;
  156.   TCustomImageList = class;
  157.  
  158. { VCL control message records }
  159.  
  160.   TCMActivate = TWMNoParams;
  161.   TCMDeactivate = TWMNoParams;
  162.   TCMGotFocus = TWMNoParams;
  163.   TCMLostFocus = TWMNoParams;
  164.   TCMDialogKey = TWMKey;
  165.   TCMDialogChar = TWMKey;
  166.   TCMHitTest = TWMNCHitTest;
  167.   TCMEnter = TWMNoParams;
  168.   TCMExit = TWMNoParams;
  169.   TCMDesignHitTest = TWMMouse;
  170.   TCMWantSpecialKey = TWMKey;
  171.  
  172.   TCMCancelMode = record
  173.     Msg: Cardinal;
  174.     Unused: Integer;
  175.     Sender: TControl;
  176.     Result: Longint;
  177.   end;
  178.  
  179.   TCMFocusChanged = record
  180.     Msg: Cardinal;
  181.     Unused: Integer;
  182.     Sender: TWinControl;
  183.     Result: Longint;
  184.   end;
  185.  
  186.   TCMControlListChange = record
  187.     Msg: Cardinal;
  188.     Control: TControl;
  189.     Inserting: LongBool;
  190.     Result: Longint;
  191.   end;
  192.  
  193.   TCMChildKey = record
  194.     Msg: Cardinal;
  195.     CharCode: Word;
  196.     Unused: Word;
  197.     Sender: TWinControl;
  198.     Result: Longint;
  199.   end;
  200.  
  201.   TDragMessage = (dmDragEnter, dmDragLeave, dmDragMove, dmDragDrop, dmDragCancel,
  202.     dmFindTarget);
  203.  
  204.   PDragRec = ^TDragRec;
  205.   TDragRec = record
  206.     Pos: TPoint;
  207.     Source: TDragObject;
  208.     Target: Pointer;
  209.   end;
  210.  
  211.   TCMDrag = packed record
  212.     Msg: Cardinal;
  213.     DragMessage: TDragMessage;
  214.     Reserved1: Byte;
  215.     Reserved2: Word;
  216.     DragRec: PDragRec;
  217.     Result: Longint;
  218.   end;
  219.  
  220. { Exception classes }
  221.  
  222.   EOutOfResources = class(EOutOfMemory);
  223.   EInvalidOperation = class(Exception);
  224.  
  225. { Dragging objects }
  226.  
  227.   TDragObject = class(TObject)
  228.   protected
  229.     function GetDragImages: TCustomImageList; virtual;
  230.     function GetDragCursor(Accepted: Boolean; X, Y: Integer): TCursor; virtual;
  231.     procedure Finished(Target: TObject; X, Y: Integer; Accepted: Boolean); virtual;
  232.   public
  233.     function Instance: THandle; virtual;
  234.     function GetName: string; virtual;
  235.     procedure HideDragImage; virtual;
  236.     procedure ShowDragImage; virtual;
  237.   end;
  238.  
  239.   TDragControlObject = class(TDragObject)
  240.   public
  241.     function GetDragImages: TCustomImageList; override;
  242.     function GetDragCursor(Accepted: Boolean; X, Y: Integer): TCursor; override;
  243.     procedure Finished(Target: TObject; X, Y: Integer; Accepted: Boolean); override;
  244.   protected
  245.     constructor Create(AControl: TControl);
  246.     property Control: TControl;
  247.     procedure HideDragImage; override;
  248.     procedure ShowDragImage; override;
  249.   end;
  250.  
  251. { Controls }
  252.  
  253.   TControlCanvas = class(TCanvas)
  254.   protected
  255.     procedure CreateHandle; override;
  256.   public
  257.     destructor Destroy; override;
  258.     procedure FreeHandle;
  259.     property Control: TControl;
  260.   end;
  261.  
  262.   TAlign = (alNone, alTop, alBottom, alLeft, alRight, alClient);
  263.  
  264.   TControlState = set of (csLButtonDown, csClicked, csPalette,
  265.     csReadingState, csAlignmentNeeded, csFocusing, csCreating,
  266.     csPaintCopy);
  267.  
  268.   TControlStyle = set of (csAcceptsControls, csCaptureMouse,
  269.     csDesignInteractive, csClickEvents, csFramed, csSetCaption, csOpaque,
  270.     csDoubleClicks, csFixedWidth, csFixedHeight, csNoDesignVisible,
  271.     csReplicatable, csNoStdEvents, csDisplayDragImage);
  272.  
  273.   TMouseButton = (mbLeft, mbRight, mbMiddle);
  274.  
  275.   TDragMode = (dmManual, dmAutomatic);
  276.  
  277.   TDragState = (dsDragEnter, dsDragLeave, dsDragMove);
  278.  
  279.   TTabOrder = -1..32767;
  280.  
  281.   TCaption = type string;
  282.  
  283.   TScalingFlags = set of (sfLeft, sfTop, sfWidth, sfHeight, sfFont);
  284.  
  285.   TMouseEvent = procedure(Sender: TObject; Button: TMouseButton;
  286.     Shift: TShiftState; X, Y: Integer) of object;
  287.   TMouseMoveEvent = procedure(Sender: TObject; Shift: TShiftState;
  288.     X, Y: Integer) of object;
  289.   TKeyEvent = procedure(Sender: TObject; var Key: Word;
  290.     Shift: TShiftState) of object;
  291.   TKeyPressEvent = procedure(Sender: TObject; var Key: Char) of object;
  292.   TDragOverEvent = procedure(Sender, Source: TObject; X, Y: Integer;
  293.     State: TDragState; var Accept: Boolean) of object;
  294.   TDragDropEvent = procedure(Sender, Source: TObject;
  295.     X, Y: Integer) of object;
  296.   TStartDragEvent = procedure(Sender: TObject;
  297.     var DragObject: TDragObject) of object;
  298.   TEndDragEvent = procedure(Sender, Target: TObject;
  299.     X, Y: Integer) of object;
  300.  
  301.   TWndMethod = procedure(var Message: TMessage) of object;
  302.  
  303.   TControl = class(TComponent)
  304.   protected
  305.     procedure ChangeScale(M, D: Integer); dynamic;
  306.     procedure Click; dynamic;
  307.     procedure DblClick; dynamic;
  308.     procedure DefaultHandler(var Message); override;
  309.     procedure DefineProperties(Filer: TFiler); override;
  310.     procedure DragCanceled; dynamic;
  311.     procedure DragOver(Source: TObject; X, Y: Integer; State: TDragState;
  312.       var Accept: Boolean); dynamic;
  313.     procedure DoEndDrag(Target: TObject; X, Y: Integer); dynamic;
  314.     procedure DoStartDrag(var DragObject: TDragObject); dynamic;
  315.     function GetClientOrigin: TPoint; virtual;
  316.     function GetClientRect: TRect; virtual;
  317.     function GetDeviceContext(var WindowHandle: HWnd): HDC; virtual;
  318.     function GetDragImages: TCustomImageList; virtual;
  319.     function GetPalette: HPALETTE; dynamic;
  320.     function GetParentComponent: TComponent; override;
  321.     function GetPopupMenu: TPopupMenu; dynamic;
  322.     function HasParent: Boolean; override;
  323.     procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
  324.       X, Y: Integer); dynamic;
  325.     procedure MouseMove(Shift: TShiftState; X, Y: Integer); dynamic;
  326.     procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
  327.       X, Y: Integer); dynamic;
  328.     procedure Notification(AComponent: TComponent;
  329.       Operation: TOperation); override;
  330.     function PaletteChanged(Foreground: Boolean): Boolean; dynamic;
  331.     procedure ReadState(Reader: TReader); override;
  332.     procedure SendCancelMode(Sender: TControl);
  333.     procedure SetDragMode(Value: TDragMode); virtual;
  334.     procedure SetParent(AParent: TWinControl); virtual;
  335.     procedure SetParentComponent(Value: TComponent); override;
  336.     procedure SetName(const Value: TComponentName); override;
  337.     procedure SetZOrder(TopMost: Boolean); dynamic;
  338.     procedure UpdateBoundsRect(const R: TRect);
  339.     procedure VisibleChanging; dynamic;
  340.     procedure WndProc(var Message: TMessage); virtual;
  341.     property Caption: TCaption;
  342.     property Color: TColor default clWindow;
  343.     property DragCursor: TCursor default crDrag;
  344.     property DragMode: TDragMode default dmManual;
  345.     property Font: TFont;
  346.     property IsControl: Boolean;
  347.     property MouseCapture: Boolean;
  348.     property ParentColor: Boolean default True;
  349.     property ParentFont: Boolean default True;
  350.     property ParentShowHint: Boolean default True;
  351.     property PopupMenu: TPopupMenu;
  352.     property ScalingFlags: TScalingFlags;
  353.     property Text: TCaption;
  354.     property WindowText: PChar;
  355.     property OnClick: TNotifyEvent;
  356.     property OnDblClick: TNotifyEvent;
  357.     property OnDragDrop: TDragDropEvent;
  358.     property OnDragOver: TDragOverEvent;
  359.     property OnEndDrag: TEndDragEvent;
  360.     property OnMouseDown: TMouseEvent;
  361.     property OnMouseMove: TMouseMoveEvent;
  362.     property OnMouseUp: TMouseEvent;
  363.     property OnStartDrag: TStartDragEvent;
  364.   public
  365.     constructor Create(AOwner: TComponent); override;
  366.     destructor Destroy; override;
  367.     procedure BeginDrag(Immediate: Boolean);
  368.     procedure BringToFront;
  369.     function ClientToScreen(const Point: TPoint): TPoint;
  370.     function Dragging: Boolean;
  371.     procedure DragDrop(Source: TObject; X, Y: Integer); dynamic;
  372.     procedure EndDrag(Drop: Boolean);
  373.     function GetTextBuf(Buffer: PChar; BufSize: Integer): Integer;
  374.     function GetTextLen: Integer;
  375.     procedure Hide;
  376.     procedure Invalidate; virtual;
  377.     function Perform(Msg: Cardinal; WParam, LParam: Longint): Longint;
  378.     procedure Refresh;
  379.     procedure Repaint; virtual;
  380.     function ScreenToClient(const Point: TPoint): TPoint;
  381.     procedure SendToBack;
  382.     procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); virtual;
  383.     procedure SetTextBuf(Buffer: PChar);
  384.     procedure Show;
  385.     procedure Update; virtual;
  386.     property Align: TAlign default alNone;
  387.     property BoundsRect: TRect;
  388.     property ClientHeight: Integer;
  389.     property ClientOrigin: TPoint;
  390.     property ClientRect: TRect;
  391.     property ClientWidth: Integer;
  392.     property ControlState: TControlState;
  393.     property ControlStyle: TControlStyle;
  394.     property Parent: TWinControl;
  395.     property ShowHint: Boolean;
  396.     property Visible: Boolean default True;
  397.     property Enabled: Boolean default True;
  398.     property WindowProc: TWndMethod;
  399.   published
  400.     property Left: Integer;
  401.     property Top: Integer;
  402.     property Width: Integer;
  403.     property Height: Integer;
  404.     property Cursor: TCursor default crDefault;
  405.     property Hint: string;
  406.   end;
  407.  
  408.   TControlClass = class of TControl;
  409.  
  410.   TCreateParams = record
  411.     Caption: PChar;
  412.     Style: Longint;
  413.     ExStyle: Longint;
  414.     X, Y: Integer;
  415.     Width, Height: Integer;
  416.     WndParent: HWnd;
  417.     Param: Pointer;
  418.     WindowClass: TWndClass;
  419.     WinClassName: array[0..63] of Char;
  420.   end;
  421.  
  422.   TImeMode = (imDisable, imClose, imOpen, imDontCare,
  423.               imSAlpha, imAlpha, imHira, imSKata, imKata,
  424.               imChinese, imSHanguel, imHanguel);
  425.   TImeName = type string;
  426.  
  427.   TWinControl = class(TControl)
  428.   protected
  429.     FInImeComposition: Boolean;
  430.     procedure AlignControls(AControl: TControl; var Rect: TRect); virtual;
  431.     procedure ChangeScale(M, D: Integer); override;
  432.     procedure CreateHandle; virtual;
  433.     procedure CreateParams(var Params: TCreateParams); virtual;
  434.     procedure CreateSubClass(var Params: TCreateParams;
  435.       ControlClassName: PChar);
  436.     procedure CreateWindowHandle(const Params: TCreateParams); virtual;
  437.     procedure CreateWnd; virtual;
  438.     procedure DefaultHandler(var Message); override;
  439.     procedure DestroyHandle;
  440.     procedure DestroyWindowHandle; virtual;
  441.     procedure DestroyWnd; virtual;
  442.     procedure DoEnter; dynamic;
  443.     procedure DoExit; dynamic;
  444.     function DoKeyDown(var Message: TWMKey): Boolean;
  445.     function DoKeyPress(var Message: TWMKey): Boolean;
  446.     function DoKeyUp(var Message: TWMKey): Boolean;
  447.     function FindNextControl(CurControl: TWinControl;
  448.       GoForward, CheckTabStop, CheckParent: Boolean): TWinControl;
  449.     procedure FixupTabList;
  450.     procedure GetChildren(Proc: TGetChildProc); override;
  451.     function GetClientOrigin: TPoint; override;
  452.     function GetClientRect: TRect; override;
  453.     function GetDeviceContext(var WindowHandle: HWnd): HDC; override;
  454.     function IsControlMouseMsg(var Message: TWMMouse): Boolean;
  455.     procedure KeyDown(var Key: Word; Shift: TShiftState); dynamic;
  456.     procedure KeyUp(var Key: Word; Shift: TShiftState); dynamic;
  457.     procedure KeyPress(var Key: Char); dynamic;
  458.     procedure MainWndProc(var Message: TMessage);
  459.     procedure NotifyControls(Msg: Word);
  460.     procedure PaintControls(DC: HDC; First: TControl);
  461.     procedure PaintHandler(var Message: TWMPaint);
  462.     procedure PaintWindow(DC: HDC); virtual;
  463.     function PaletteChanged(Foreground: Boolean): Boolean; override;
  464.     procedure ReadState(Reader: TReader); override;
  465.     procedure RecreateWnd;
  466.     procedure ResetIme;
  467.     function ResetImeComposition(Action: DWORD): Boolean;
  468.     procedure ScaleControls(M, D: Integer);
  469.     procedure SelectFirst;
  470.     procedure SelectNext(CurControl: TWinControl;
  471.       GoForward, CheckTabStop: Boolean);
  472.     procedure SetChildOrder(Child: TComponent; Order: Integer); override;
  473.     procedure SetIme;
  474.     function SetImeCompositionWindow(hWnd: HWND; Font: TFont;
  475.       XPos, YPos: Integer): Boolean;
  476.     procedure SetZOrder(TopMost: Boolean); override;
  477.     procedure ShowControl(AControl: TControl); virtual;
  478.     procedure WndProc(var Message: TMessage); override;
  479.     property Ctl3D: Boolean;
  480.     property DefWndProc: Pointer;
  481.     property ImeMode: TImeMode default imDontCare;
  482.     property ImeName: TImeName;
  483.     property ParentCtl3D: Boolean default True;
  484.     property WindowHandle: HWnd;
  485.     property OnEnter: TNotifyEvent;
  486.     property OnExit: TNotifyEvent;
  487.     property OnKeyDown: TKeyEvent;
  488.     property OnKeyPress: TKeyPressEvent;
  489.     property OnKeyUp: TKeyEvent;
  490.   public
  491.     constructor Create(AOwner: TComponent); override;
  492.     constructor CreateParented(ParentWindow: HWnd);
  493.     destructor Destroy; override;
  494.     procedure Broadcast(var Message);
  495.     function CanFocus: Boolean;
  496.     function ContainsControl(Control: TControl): Boolean;
  497.     function ControlAtPos(const Pos: TPoint; AllowDisabled: Boolean): TControl;
  498.     procedure DisableAlign;
  499.     procedure EnableAlign;
  500.     function Focused: Boolean;
  501.     procedure GetTabOrderList(List: TList); dynamic;
  502.     function HandleAllocated: Boolean;
  503.     procedure HandleNeeded;
  504.     procedure InsertControl(AControl: TControl);
  505.     procedure Invalidate; override;
  506.     procedure PaintTo(DC: HDC; X, Y: Integer);
  507.     procedure RemoveControl(AControl: TControl);
  508.     procedure Realign;
  509.     procedure Repaint; override;
  510.     procedure ScaleBy(M, D: Integer);
  511.     procedure ScrollBy(DeltaX, DeltaY: Integer);
  512.     procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
  513.     procedure SetFocus; virtual;
  514.     procedure Update; override;
  515.     procedure UpdateControlState;
  516.     property Brush: TBrush;
  517.     property Controls[Index: Integer]: TControl;
  518.     property ControlCount: Integer;
  519.     property Handle: HWnd;
  520.     property ParentWindow: HWnd;
  521.     property Showing: Boolean;
  522.     property TabOrder: TTabOrder default -1;
  523.     property TabStop: Boolean default False;
  524.   published
  525.     property HelpContext: THelpContext default 0;
  526.   end;
  527.  
  528.   TGraphicControl = class(TControl)
  529.   protected
  530.     procedure Paint; virtual;
  531.     property Canvas: TCanvas;
  532.   public
  533.     constructor Create(AOwner: TComponent); override;
  534.     destructor Destroy; override;
  535.   end;
  536.  
  537.   TCustomControl = class(TWinControl)
  538.   protected
  539.     procedure Paint; virtual;
  540.     procedure PaintWindow(DC: HDC); override;
  541.     property Canvas: TCanvas;
  542.   public
  543.     constructor Create(AOwner: TComponent); override;
  544.     destructor Destroy; override;
  545.   end;
  546.  
  547.   THintWindow = class(TCustomControl)
  548.   protected
  549.     procedure CreateParams(var Params: TCreateParams); override;
  550.     procedure Paint; override;
  551.   public
  552.     constructor Create(AOwner: TComponent); override;
  553.     procedure ActivateHint(Rect: TRect; const AHint: string); virtual;
  554.     function IsHintMsg(var Msg: TMsg): Boolean; virtual;
  555.     procedure ReleaseHandle;
  556.     property Caption;
  557.     property Color;
  558.     property Canvas;
  559.   end;
  560.  
  561.   THintWindowClass = class of THintWindow;
  562.  
  563. { TChangeLink }
  564.  
  565.   TChangeLink = class(TObject)
  566.   public
  567.     destructor Destroy; override;
  568.     procedure Change; dynamic;
  569.     property OnChange: TNotifyEvent;
  570.     property Sender: TCustomImageList;
  571.   end;
  572.  
  573.   { TCustomImageList }
  574.  
  575.   TDrawingStyle = (dsFocus, dsSelected, dsNormal, dsTransparent);
  576.   TImageType = (itImage, itMask);
  577.   TResType = (rtBitmap, rtCursor, rtIcon);
  578.   TOverlay = 0..3;
  579.   TLoadResource = (lrDefaultColor, lrDefaultSize, lrFromFile,
  580.     lrMap3DColors, lrTransparent, lrMonoChrome);
  581.   TLoadResources = set of TLoadResource;
  582.  
  583.   TCustomImageList = class(TComponent)
  584.   protected
  585.     procedure Change; dynamic;
  586.     procedure DefineProperties(Filer: TFiler); override;
  587.     procedure GetImages(Index: Integer; Image, Mask: TBitmap);
  588.     procedure HandleNeeded;
  589.     procedure Initialize;
  590.     property BlendColor: TColor default clNone;
  591.     property BkColor: TColor default clNone;
  592.     property AllocBy: Integer default 4;
  593.     property DrawingStyle: TDrawingStyle default dsNormal;
  594.     property Height: Integer default 16;
  595.     property ImageType: TImageType default itImage;
  596.     property Masked: Boolean default True;
  597.     property OnChange: TNotifyEvent;
  598.     property ShareImages: Boolean default False;
  599.     property Width: Integer default 16;
  600.   public
  601.     constructor Create(AOwner: TComponent); override;
  602.     constructor CreateSize(AWidth, AHeight: Integer);
  603.     destructor Destroy; override;
  604.     procedure Assign(Source: TPersistent); override;
  605.     function Add(Image, Mask: TBitmap): Integer;
  606.     function AddIcon(Image: TIcon): Integer;
  607.     procedure AddImages(Value: TCustomImageList);
  608.     function AddMasked(Image: TBitmap; MaskColor: TColor): Integer;
  609.     function BeginDrag(Window: HWND; X, Y: Integer): Boolean;
  610.     procedure Clear;
  611.     procedure Delete(Index: Integer);
  612.     function DragLock(Window: HWND; XPos, YPos: Integer): Boolean;
  613.     function DragMove(X, Y: Integer): Boolean;
  614.     procedure DragUnlock;
  615.     procedure Draw(Canvas: TCanvas; X, Y, Index: Integer);
  616.     procedure DrawOverlay(Canvas: TCanvas; X, Y: Integer;
  617.       ImageIndex: Integer; Overlay: TOverlay);
  618.     function EndDrag: Boolean;
  619.     function FileLoad(ResType: TResType; Name: string;
  620.       MaskColor: TColor): Boolean;
  621.     procedure GetBitmap(Index: Integer; Image: TBitmap);
  622.     function GetHotSpot: TPoint;
  623.     procedure GetIcon(Index: Integer; Image: TIcon);
  624.     function GetImageBitmap: HBITMAP;
  625.     function GetMaskBitmap: HBITMAP;
  626.     function GetResource(ResType: TResType; Name: string;
  627.       Width: Integer; LoadFlags: TLoadResources; MaskColor: TColor): Boolean;
  628.     function HandleAllocated: Boolean;
  629.     procedure HideDragImage;
  630.     procedure Insert(Index: Integer; Image, Mask: TBitmap);
  631.     procedure InsertIcon(Index: Integer; Image: TIcon);
  632.     procedure InsertMasked(Index: Integer; Image: TBitmap; MaskColor: TColor);
  633.     procedure Move(CurIndex, NewIndex: Integer);
  634.     function Overlay(ImageIndex: Integer; Overlay: TOverlay): Boolean;
  635.     procedure RegisterChanges(Value: TChangeLink);
  636.     function ResourceLoad(ResType: TResType; Name: string;
  637.       MaskColor: TColor): Boolean;
  638.     procedure Replace(Index: Integer; Image, Mask: TBitmap);
  639.     procedure ReplaceIcon(Index: Integer; Image: TIcon);
  640.     procedure ReplaceMasked(Index: Integer; NewImage: TBitmap; MaskColor: TColor);
  641.     function SetDragImage(Index, HotSpotX, HotSpotY: Integer): Boolean;
  642.     procedure ShowDragImage;
  643.     procedure UnRegisterChanges(Value: TChangeLink);
  644.     property Count: Integer;
  645.     property DragCursor: TCursor;
  646.     property Dragging: Boolean;
  647.     property Handle: HImageList;
  648.   end;
  649.  
  650. { TImageList }
  651.   TImageList = class(TCustomImageList)
  652.   published
  653.     property BlendColor;
  654.     property BkColor;
  655.     property AllocBy;
  656.     property DrawingStyle;
  657.     property Height;
  658.     property ImageType;
  659.     property Masked;
  660.     property OnChange;
  661.     property ShareImages;
  662.     property Width;
  663.   end;
  664.  
  665. function IsDragObject(Sender: TObject): Boolean;
  666. function FindControl(Handle: HWnd): TWinControl;
  667. function FindVCLWindow(const Pos: TPoint): TWinControl;
  668. function FindDragTarget(const Pos: TPoint; AllowDisabled: Boolean): TControl;
  669. function GetCaptureControl: TControl;
  670. procedure SetCaptureControl(Control: TControl);
  671. procedure CancelDrag;
  672.  
  673. function CursorToString(Cursor: TCursor): string;
  674. function StringToCursor(const S: string): TCursor;
  675. procedure GetCursorValues(Proc: TGetStrProc);
  676. function CursorToIdent(Cursor: Longint; var Ident: string): Boolean;
  677. function IdentToCursor(const Ident: string; var Cursor: Longint): Boolean;
  678.  
  679. function GetShortHint(const Hint: string): string;
  680. function GetLongHint(const Hint: string): string;
  681.  
  682. var
  683.   CreationControl: TWinControl = nil;
  684.  
  685. function InitWndProc(HWindow: HWnd; Message, WParam: Longint;
  686.   LParam: Longint): Longint; stdcall;
  687.  
  688. const
  689.   CTL3D_ALL = $FFFF;
  690.  
  691. var
  692.   NewStyleControls: Boolean;
  693.  
  694. function SendAppMessage(Msg: Cardinal; WParam, LParam: Longint): Longint;
  695. procedure MoveWindowOrg(DC: HDC; DX, DY: Integer);
  696.  
  697. procedure SetImeMode(Handle: HWnd; Mode: TImeMode);
  698. function Win32NLSEnableIME(Handle: HWnd; Enable: Boolean): Boolean;
  699. function Imm32GetContext(hWnd: HWND): HIMC;
  700. function Imm32ReleaseContext(hWnd: HWND; hImc: HIMC): Boolean;
  701. function Imm32GetConversionStatus(hImc: HIMC; var Conversion, Sentence: DWORD): Boolean;
  702. function Imm32SetConversionStatus(hImc: HIMC; Conversion, Sentence: DWORD): Boolean;
  703. function Imm32SetOpenStatus(hImc: HIMC; fOpen: Boolean): Boolean;
  704. function Imm32SetCompositionWindow(hImc: HIMC; lpCompForm: PCOMPOSITIONFORM): Boolean;
  705. function Imm32SetCompositionFont(hImc: HIMC; lpLogfont: PLOGFONTA): Boolean;
  706. function Imm32GetCompositionString(hImc: HIMC; dWord1: DWORD; lpBuf: pointer; dwBufLen: DWORD): Longint;
  707. function Imm32IsIME(hKl: HKL): Boolean;
  708. function Imm32NotifyIME(hImc: HIMC; dwAction, dwIndex, dwValue: DWORD): Boolean;
  709.  
  710. implementation
  711.