Class TSnapToGrid (unit cSnapToGrid)

Inherits from

TComponent

Constructors


constructor Create(AOwner: TComponent);

-------------------------------------------------------


Functions

procedure AppMessage(var Msg: TMsg; var Handled: Boolean);

-------------------------------------------------------} (* ** Application.

destructor Destroy;

-------------------------------------------------------

function Snap(intValue: Integer): Integer;

should be CTSnap

-------------------------------------------------------


procedure ChildMouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

------------------------------------------------

procedure ChildMouseMove(Shift: TShiftState; X, Y: Integer);

------------------------------------------------} { excuse me for not declaring constants : 1 = Left 2 = Right 4 = Top 8 = Bottom 1+4 = 5 = TopLeft etc.

procedure ChildMouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

------------------------------------------------

procedure CTDrawFocusRect;

-------------------------------------------------------

procedure Notification(AComponent: TComponent; Operation: TOperation);

-------------------------------------------------------

procedure HandleGridMessage(var Msg: TMsg; var Handled: Boolean);

-------------------------------------------------------} (* ** Determines the type of message that is being handled and ** takes the necessary steps.

procedure HandleKeyboardMessage(var Msg: TMsg; var Handled: Boolean);

-------------------------------------------------------} (* ** A keyboard event occured.

procedure HandleMouseMessage(var Msg: TMsg; var Handled: Boolean);

-------------------------------------------------------} (* ** A mouse event occured.

procedure SetGridSize(grdSize: TGridSize);

-------------------------------------------------------} (* ** make sure grdSize is 0 or a power of 2 ** grid size of 0 -> disable moving

Properties

property GridSize : TGridSize


property isFocusRect : Boolean

property FocusRect: Boolean read FDrawFocusRect write FDrawFocusRect; // obsolete

property isMoveable : Boolean


property isResizeable : Boolean


property SnapToGridWindow : TWinControl

property SnapControl: TWinControl read FWinControl write FWinControl; //obsolete

Events

event OnMouseDown : TMouseEvent


event OnMouseMove : TMoveEvent


event OnMouseUp : TMouseEvent


Variables

bolCapture : Boolean;


ctrActive : TControl;


FDrawFocusRect : Boolean;


FGridSize : TGridSize;


FHitSize : Integer;


FMoveable : Boolean;


FOnMouseDown : TMouseEvent;


FOnMouseMove : TMoveEvent;


FOnMouseUp : TMouseEvent;


FResizeable : Boolean;


FWinControl : TWinControl;


intHitTest : Integer;


OldAppMessage : TMessageEvent;


ptCapture : TPoint;


ptWorld : TPoint;


rctMove : TRect;


rctOriginal : TRect;


ScreenDC : HDC;



Constructors


constructor Create(AOwner: TComponent);

-------------------------------------------------------


Functions


procedure AppMessage(var Msg: TMsg; var Handled: Boolean);

-------------------------------------------------------} (* ** Application.OnMessage calls this method. ** This method determines if the message is relevent. ** If it is, it passes it to HandleGridMessage.


destructor Destroy;

-------------------------------------------------------


function Snap(intValue: Integer): Integer;

should be CTSnap

-------------------------------------------------------


procedure ChildMouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

------------------------------------------------


procedure ChildMouseMove(Shift: TShiftState; X, Y: Integer);

------------------------------------------------} { excuse me for not declaring constants : 1 = Left 2 = Right 4 = Top 8 = Bottom 1+4 = 5 = TopLeft etc..


procedure ChildMouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

------------------------------------------------


procedure CTDrawFocusRect;

-------------------------------------------------------


procedure Notification(AComponent: TComponent; Operation: TOperation);

-------------------------------------------------------


procedure HandleGridMessage(var Msg: TMsg; var Handled: Boolean);

-------------------------------------------------------} (* ** Determines the type of message that is being handled and ** takes the necessary steps.


procedure HandleKeyboardMessage(var Msg: TMsg; var Handled: Boolean);

-------------------------------------------------------} (* ** A keyboard event occured. ** Determine what kind of event it was and pass it along to ** the appropriate message handlers.


procedure HandleMouseMessage(var Msg: TMsg; var Handled: Boolean);

-------------------------------------------------------} (* ** A mouse event occured. ** Determine what kind of event it was and pass it along to ** the appropriate message handlers.


procedure SetGridSize(grdSize: TGridSize);

-------------------------------------------------------} (* ** make sure grdSize is 0 or a power of 2 ** grid size of 0 -> disable moving


Properties


property GridSize : TGridSize


property isFocusRect : Boolean

property FocusRect: Boolean read FDrawFocusRect write FDrawFocusRect; // obsolete


property isMoveable : Boolean


property isResizeable : Boolean


property SnapToGridWindow : TWinControl

property SnapControl: TWinControl read FWinControl write FWinControl; //obsolete


Events


event OnMouseDown : TMouseEvent


event OnMouseMove : TMoveEvent


event OnMouseUp : TMouseEvent


Variables


bolCapture : Boolean;


ctrActive : TControl;


FDrawFocusRect : Boolean;


FGridSize : TGridSize;


FHitSize : Integer;


FMoveable : Boolean;


FOnMouseDown : TMouseEvent;


FOnMouseMove : TMoveEvent;


FOnMouseUp : TMouseEvent;


FResizeable : Boolean;


FWinControl : TWinControl;


intHitTest : Integer;


OldAppMessage : TMessageEvent;


ptCapture : TPoint;


ptWorld : TPoint;


rctMove : TRect;


rctOriginal : TRect;


ScreenDC : HDC;