source: branches/Xvcl/Drivers/Driver.MouseVCL.pas

Last change on this file was 23, checked in by chronos, 12 years ago
  • Added: Support for mouse move handling. Now forms can be moved by dragging title bar.
  • Fixed: Clearing background during painting in screen and forms.
File size: 1.4 KB
Line 
1unit Driver.MouseVCL;
2
3interface
4
5uses
6 Vcl.Forms, Vcl.Controls, System.Classes, UFormMain, Xvcl.Classes, Xvcl.Kernel;
7
8type
9 TDriverMouseVCL = class(TDriver)
10 private
11 procedure DoMouseDown(Sender: TObject; Button: TMouseButton;
12 Shift: TShiftState; X, Y: Integer);
13 procedure DoMouseUp(Sender: TObject; Button: TMouseButton;
14 Shift: TShiftState; X, Y: Integer);
15 procedure DoMouseMove(Sender: TObject; Shift: TShiftState;
16 X, Y: Integer);
17 public
18 Form: Vcl.Forms.TForm;
19 procedure Initialize; override;
20 procedure Finalize; override;
21 end;
22
23implementation
24
25procedure TDriverMouseVCL.DoMouseDown(Sender: TObject; Button: TMouseButton;
26 Shift: TShiftState; X, Y: Integer);
27begin
28 Kernel.Mouse.HandleDown(TPoint.Create(X, Y));
29end;
30
31procedure TDriverMouseVCL.DoMouseMove(Sender: TObject; Shift: TShiftState; X,
32 Y: Integer);
33begin
34 Kernel.Mouse.HandleMouseMove(TPoint.Create(X, Y));
35end;
36
37procedure TDriverMouseVCL.DoMouseUp(Sender: TObject; Button: TMouseButton;
38 Shift: TShiftState; X, Y: Integer);
39begin
40 Kernel.Mouse.HandleUp(TPoint.Create(X, Y));
41end;
42
43procedure TDriverMouseVCL.Finalize;
44begin
45 inherited;
46
47end;
48
49procedure TDriverMouseVCL.Initialize;
50begin
51 inherited;
52 Form := Application.MainForm;
53 TForm1(Form).Image1.OnMouseDown := DoMouseDown;
54 TForm1(Form).Image1.OnMouseUp := DoMouseUp;
55 TForm1(Form).Image1.OnMouseMove := DoMouseMove;
56end;
57
58
59end.
Note: See TracBrowser for help on using the repository browser.