summaryrefslogtreecommitdiff
path: root/gfx/gdi
diff options
context:
space:
mode:
authorsekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-12 17:10:01 +0000
committersekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-12 17:10:01 +0000
commitb30cac91fb2b8579657bffea62bfe8c344fb40f9 (patch)
tree60801861ed7bf5854f7b80b6ea3289d48d79893a /gfx/gdi
parentc1add0626ace53bac8e67dbef7e95c7d346187ab (diff)
downloadfpGUI-b30cac91fb2b8579657bffea62bfe8c344fb40f9.tar.xz
Moved gfx event methods to protected
Diffstat (limited to 'gfx/gdi')
-rw-r--r--gfx/gdi/fpgfxpackage.pas2
-rw-r--r--gfx/gdi/gfx_gdi.pas117
2 files changed, 91 insertions, 28 deletions
diff --git a/gfx/gdi/fpgfxpackage.pas b/gfx/gdi/fpgfxpackage.pas
index 0669f181..0c2e3f6c 100644
--- a/gfx/gdi/fpgfxpackage.pas
+++ b/gfx/gdi/fpgfxpackage.pas
@@ -7,7 +7,7 @@ unit fpGFXPackage;
interface
uses
- GfxBase, GFXInterface, GFX_GDI, fpgfx, GELDirty, GELImage, fpUTF8Utils;
+ GfxBase, GFXInterface, gfx_gdi, fpgfx, GELDirty, GELImage, fpUTF8Utils;
implementation
diff --git a/gfx/gdi/gfx_gdi.pas b/gfx/gdi/gfx_gdi.pas
index b04a4bb7..0bab2535 100644
--- a/gfx/gdi/gfx_gdi.pas
+++ b/gfx/gdi/gfx_gdi.pas
@@ -13,7 +13,7 @@
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
}
-unit GFX_GDI;
+unit gfx_gdi;
{$ifdef fpc}
{$mode delphi}{$H+}
@@ -190,22 +190,6 @@ type
function DoMouseEnterLeaveCheck(uMsg, wParam, lParam: Cardinal): Boolean;
procedure EvInternalPaint;
{ Event processing methods }
- procedure EvPaint; override;
- public
- { Constructors / Destructors }
- constructor Create(AParent: TFCustomWindow; AWindowOptions: TFWindowOptions); override;
- destructor Destroy; override;
- { Widget controling methods }
- procedure SetPosition(const APosition: TPoint); override;
- procedure SetSize(const ASize: TSize); override;
- procedure SetMinMaxSize(const AMinSize, AMaxSize: TSize); override;
- procedure SetClientSize(const ASize: TSize); override;
- procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); override;
- procedure Show; override;
- procedure Invalidate; override;
- procedure CaptureMouse; override;
- procedure ReleaseMouse; override;
- { Event processing methods }
procedure EvCreate; override;
procedure EvFocusIn; override;
procedure EvFocusOut; override;
@@ -219,10 +203,24 @@ type
procedure EvMouseReleased(AButton: TMouseButton; const AMousePos: TPoint); override;
procedure EvMouseMove(const AMousePos: TPoint); override;
procedure EvMouseWheel(AWheelDelta: Single; const AMousePos: TPoint); override;
-// procedure EvPaint; override;
+ procedure EvPaint; override;
procedure EvMove; override;
procedure EvResize; override;
procedure EvShow; override;
+ public
+ { Constructors / Destructors }
+ constructor Create(AParent: TFCustomWindow; AWindowOptions: TFWindowOptions); override;
+ destructor Destroy; override;
+ { Widget controling methods }
+ procedure SetPosition(const APosition: TPoint); override;
+ procedure SetSize(const ASize: TSize); override;
+ procedure SetMinMaxSize(const AMinSize, AMaxSize: TSize); override;
+ procedure SetClientSize(const ASize: TSize); override;
+ procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); override;
+ procedure Show; override;
+ procedure Invalidate; override;
+ procedure CaptureMouse; override;
+ procedure ReleaseMouse; override;
end;
@@ -1569,64 +1567,129 @@ begin
end;
procedure TGDIWindow.EvKeyPressed(AKey: Word);
+var
+ vEvent: TFEvent;
begin
if Assigned(OnKeyPressed) then OnKeyPressed(Self, AKey, GetKeyboardShiftState)
- else if Assigned(Parent) then Parent.EvKeyPressed(AKey);
+ else if Assigned(Parent) then
+ begin
+ vEvent.EventType := etKeyPressed;
+ vEvent.Key := AKey;
+ Parent.ProcessEvent(vEvent);
+ end;
end;
procedure TGDIWindow.EvKeyReleased(AKey: Word);
+var
+ vEvent: TFEvent;
begin
if Assigned(OnKeyReleased) then OnKeyReleased(Self, AKey, GetKeyboardShiftState)
- else if Assigned(Parent) then Parent.EvKeyReleased(AKey);
+ else if Assigned(Parent) then
+ begin
+ vEvent.EventType := etKeyReleased;
+ vEvent.Key := AKey;
+ Parent.ProcessEvent(vEvent);
+ end;
end;
procedure TGDIWindow.EvKeyChar(AKeyChar: Char);
+var
+ vEvent: TFEvent;
begin
if Assigned(OnKeyChar) then OnKeyChar(Self, AKeyChar)
- else if Assigned(Parent) then Parent.EvKeyChar(AKeyChar);
+ else if Assigned(Parent) then
+ begin
+ vEvent.EventType := etKeyChar;
+ vEvent.KeyChar := AKeyChar;
+ Parent.ProcessEvent(vEvent);
+ end;
end;
procedure TGDIWindow.EvMouseEnter(const AMousePos: TPoint);
+var
+ vEvent: TFEvent;
begin
if Assigned(OnMouseEnter) then
OnMouseEnter(Self, GetKeyboardShiftState, AMousePos)
- else if Assigned(Parent) then Parent.EvMouseEnter(AMousePos);
+ else if Assigned(Parent) then
+ begin
+ vEvent.EventType := etMouseEnter;
+ vEvent.MousePos := AMousePos;
+ Parent.ProcessEvent(vEvent);
+ end;
end;
procedure TGDIWindow.EvMouseLeave;
+var
+ vEvent: TFEvent;
begin
if Assigned(OnMouseLeave) then OnMouseLeave(Self)
- else if Assigned(Parent) then Parent.EvMouseLeave;
+ else if Assigned(Parent) then
+ begin
+ vEvent.EventType := etMouseLeave;
+ Parent.ProcessEvent(vEvent);
+ end;
end;
procedure TGDIWindow.EvMousePressed(AButton: TMouseButton;
const AMousePos: TPoint);
+var
+ vEvent: TFEvent;
begin
if Assigned(OnMousePressed) then
OnMousePressed(Self, AButton, GetKeyboardShiftState, AMousePos)
- else if Assigned(Parent) then Parent.EvMousePressed(AButton, AMousePos);
+ else if Assigned(Parent) then
+ begin
+ vEvent.EventType := etMousePressed;
+ vEvent.MousePos := AMousePos;
+ vEvent.MouseButton := AButton;
+ Parent.ProcessEvent(vEvent);
+ end;
end;
procedure TGDIWindow.EvMouseReleased(AButton: TMouseButton;
const AMousePos: TPoint);
+var
+ vEvent: TFEvent;
begin
if Assigned(OnMouseReleased) then
OnMouseReleased(Self, AButton, GetKeyboardShiftState, AMousePos)
- else if Assigned(Parent) then Parent.EvMouseReleased(AButton, AMousePos);
+ else if Assigned(Parent) then
+ begin
+ vEvent.EventType := etMouseReleased;
+ vEvent.MousePos := AMousePos;
+ vEvent.MouseButton := AButton;
+ Parent.ProcessEvent(vEvent);
+ end;
end;
procedure TGDIWindow.EvMouseMove(const AMousePos: TPoint);
+var
+ vEvent: TFEvent;
begin
if Assigned(OnMouseMove) then
OnMouseMove(Self, GetKeyboardShiftState, AMousePos)
- else if Assigned(Parent) then Parent.EvMouseMove(AMousePos);
+ else if Assigned(Parent) then
+ begin
+ vEvent.EventType := etMouseMove;
+ vEvent.MousePos := AMousePos;
+ Parent.ProcessEvent(vEvent);
+ end;
end;
procedure TGDIWindow.EvMouseWheel(AWheelDelta: Single; const AMousePos: TPoint);
+var
+ vEvent: TFEvent;
begin
if Assigned(OnMouseWheel) then
OnMouseWheel(Self, GetKeyboardShiftState, AWheelDelta, AMousePos)
- else if Assigned(Parent) then Parent.EvMouseWheel(AWheelDelta, AMousePos);
+ else if Assigned(Parent) then
+ begin
+ vEvent.EventType := etMouseMove;
+ vEvent.WheelDelta := AWheelDelta;
+ vEvent.MousePos := AMousePos;
+ Parent.ProcessEvent(vEvent);
+ end;
end;
{ Because the painting code is executed on the middle of the processing