summaryrefslogtreecommitdiff
path: root/gfx/gfxbase.pas
diff options
context:
space:
mode:
Diffstat (limited to 'gfx/gfxbase.pas')
-rw-r--r--gfx/gfxbase.pas71
1 files changed, 49 insertions, 22 deletions
diff --git a/gfx/gfxbase.pas b/gfx/gfxbase.pas
index 9b5c2724..bf50bbfd 100644
--- a/gfx/gfxbase.pas
+++ b/gfx/gfxbase.pas
@@ -245,13 +245,15 @@ type
etMouseEnter, etMouseLeave, etMousePressed, etMouseReleased,
etMouseMove, etMouseWheel, etPaint, etMove, etResize, etShow);
- TFEvent = class
- public
+ TFEvent = record
EventType: TFEventType;
+ { Key fields }
+ Key: Word;
+ KeyChar: Char;
{ Mouse fields }
+ MousePos: TPoint;
MouseButton: TMouseButton;
- X, Y: Cardinal;
- Width, Height: Cardinal;
+ WheelDelta: Single;
end;
{ TFCustomFont }
@@ -506,24 +508,7 @@ type
procedure DoSetCursor; virtual; abstract;
function GetHandle: PtrUInt; virtual; abstract;
- procedure EvPaint; virtual; abstract;
- public
- { Constructors / Destructors }
- constructor Create(AParent: TFCustomWindow; AWindowOptions: TFWindowOptions); virtual;
- destructor Destroy; override;
- { Widget controling methods }
- function CanClose: Boolean; virtual;
- procedure SetPosition(const APosition: TPoint); virtual;
- procedure SetSize(const ASize: TSize); virtual;
- procedure SetMinMaxSize(const AMinSize, AMaxSize: TSize); virtual;
- procedure SetClientSize(const ASize: TSize); virtual;
- procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); virtual;
- procedure Show; virtual; abstract;
- procedure Invalidate; virtual; abstract;
- procedure CaptureMouse; virtual; abstract;
- procedure ReleaseMouse; virtual; abstract;
{ Event processing methods }
-// procedure ProcessEvent(AEvent: TFEvent); virtual; abstract;
procedure EvCreate; virtual; abstract;
procedure EvFocusIn; virtual; abstract;
procedure EvFocusOut; virtual; abstract;
@@ -537,10 +522,27 @@ type
procedure EvMouseReleased(AButton: TMouseButton; const AMousePos: TPoint); virtual; abstract;
procedure EvMouseMove(const AMousePos: TPoint); virtual; abstract;
procedure EvMouseWheel(AWheelDelta: Single; const AMousePos: TPoint); virtual; abstract;
-// procedure EvPaint; virtual; abstract;
+ procedure EvPaint; virtual; abstract;
procedure EvMove; virtual; abstract;
procedure EvResize; virtual; abstract;
procedure EvShow; virtual; abstract;
+ public
+ { Constructors / Destructors }
+ constructor Create(AParent: TFCustomWindow; AWindowOptions: TFWindowOptions); virtual;
+ destructor Destroy; override;
+ { Widget controling methods }
+ function CanClose: Boolean; virtual;
+ procedure SetPosition(const APosition: TPoint); virtual;
+ procedure SetSize(const ASize: TSize); virtual;
+ procedure SetMinMaxSize(const AMinSize, AMaxSize: TSize); virtual;
+ procedure SetClientSize(const ASize: TSize); virtual;
+ procedure SetMinMaxClientSize(const AMinSize, AMaxSize: TSize); virtual;
+ procedure Show; virtual; abstract;
+ procedure Invalidate; virtual; abstract;
+ procedure CaptureMouse; virtual; abstract;
+ procedure ReleaseMouse; virtual; abstract;
+ { Event processing methods }
+ procedure ProcessEvent(AEvent: TFEvent);
{ Properties }
property WindowOptions: TFWindowOptions read FWindowOptions write SetWindowOptions;
@@ -1037,6 +1039,31 @@ begin
// Empty
end;
+procedure TFCustomWindow.ProcessEvent(AEvent: TFEvent);
+begin
+ case AEvent.EventType of
+ etCreate: EvCreate();
+ etCanClose: Exit;
+ etClose: Exit;
+ etFocusIn: EvFocusIn();
+ etFocusOut: EvFocusOut();
+ etHide: EvHide();
+ etKeyPressed: EvKeyPressed(AEvent.Key);
+ etKeyReleased: EvKeyReleased(AEvent.Key);
+ etKeyChar: EvKeyChar(AEvent.KeyChar);
+ etMouseEnter: EvMouseEnter(AEvent.MousePos);
+ etMouseLeave: EvMouseLeave();
+ etMousePressed: EvMousePressed(AEvent.MouseButton, AEvent.MousePos);
+ etMouseReleased: EvMouseReleased(AEvent.MouseButton, AEvent.MousePos);
+ etMouseMove: EvMouseMove(AEvent.MousePos);
+ etMouseWheel: EvMouseWheel(AEvent.WheelDelta, AEvent.MousePos);
+ etPaint: EvPaint();
+ etMove: EvMove();
+ etResize: EvResize();
+ etShow: EvShow();
+ end;
+end;
+
constructor TFCustomWindow.Create(AParent: TFCustomWindow;
AWindowOptions: TFWindowOptions);
begin