diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-14 11:13:16 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2007-07-14 11:13:16 +0000 |
commit | 337ee2c72452d9ad5520d463c355d6d6dd1f6c5d (patch) | |
tree | fe72768da9abf0038afa902803bc2c9bd777079e /prototypes | |
parent | ef0bbc4737df2fb71898a5044f56e397282ecbe9 (diff) | |
download | fpGUI-337ee2c72452d9ad5520d463c355d6d6dd1f6c5d.tar.xz |
fpgui2: implemented CaptureMouse and ReleaseMouse for TfpgBaseWindow.
Diffstat (limited to 'prototypes')
-rw-r--r-- | prototypes/fpgui2/source/core/gdi/gfx_gdi.pas | 12 | ||||
-rw-r--r-- | prototypes/fpgui2/source/core/gfxbase.pas | 2 | ||||
-rw-r--r-- | prototypes/fpgui2/source/core/x11/gfx_x11.pas | 20 |
3 files changed, 34 insertions, 0 deletions
diff --git a/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas b/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas index 12599e11..4d8abfc5 100644 --- a/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas +++ b/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas @@ -134,6 +134,8 @@ type property WinHandle: TfpgWinHandle read FWinHandle; public constructor Create(AOwner: TComponent); override; + procedure CaptureMouse; override; + procedure ReleaseMouse; override; end; @@ -920,6 +922,16 @@ begin FWinHandle := 0; end; +procedure TfpgWindowImpl.CaptureMouse; +begin + Windows.SetCapture(FWinHandle); +end; + +procedure TfpgWindowImpl.ReleaseMouse; +begin + Windows.ReleaseCapture; +end; + function TfpgWindowImpl.HandleIsValid: boolean; begin Result := FWinHandle > 0; diff --git a/prototypes/fpgui2/source/core/gfxbase.pas b/prototypes/fpgui2/source/core/gfxbase.pas index 3c290dec..63d150a8 100644 --- a/prototypes/fpgui2/source/core/gfxbase.pas +++ b/prototypes/fpgui2/source/core/gfxbase.pas @@ -363,6 +363,8 @@ type procedure UpdateWindowPosition; procedure MoveWindow(const x: TfpgCoord; const y: TfpgCoord); function WindowToScreen(ASource: TfpgWindowBase; const AScreenPos: TPoint): TPoint; + procedure CaptureMouse; virtual; abstract; + procedure ReleaseMouse; virtual; abstract; property HasHandle: boolean read HandleIsValid; property WindowType: TWindowType read FWindowType write FWindowType; property WindowAttributes: TWindowAttributes read FWindowAttributes write FWindowAttributes; diff --git a/prototypes/fpgui2/source/core/x11/gfx_x11.pas b/prototypes/fpgui2/source/core/x11/gfx_x11.pas index 7b37a42a..446dac05 100644 --- a/prototypes/fpgui2/source/core/x11/gfx_x11.pas +++ b/prototypes/fpgui2/source/core/x11/gfx_x11.pas @@ -131,6 +131,8 @@ type property WinHandle: TfpgWinHandle read FWinHandle; public constructor Create(AOwner: TComponent); override; + procedure CaptureMouse; override; + procedure ReleaseMouse; override; end; @@ -970,6 +972,24 @@ begin FWinHandle := 0; end; +procedure TfpgWindowImpl.CaptureMouse; +begin + XGrabPointer(xapplication.Display, FWinHandle, + True, + ButtonPressMask or ButtonReleaseMask or ButtonMotionMask or PointerMotionMask, + GrabModeAsync, + GrabModeAsync, + None, + 0, + CurrentTime + ); +end; + +procedure TfpgWindowImpl.ReleaseMouse; +begin + XUngrabPointer(xapplication.display, CurrentTime); +end; + { TfpgFontResourceImpl } constructor TfpgFontResourceImpl.Create(const afontdesc: string); |