summaryrefslogtreecommitdiff
path: root/prototypes
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-04-12 18:01:53 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2013-04-12 18:29:05 +0100
commite1fe151dc97435361190f3eee698d230e4a61308 (patch)
tree67011e6eb563c35d9c46da0de0befcc20f45e1f8 /prototypes
parent9be4072b65ba67dfb82224ba5cda84489135612f (diff)
downloadfpGUI-e1fe151dc97435361190f3eee698d230e4a61308.tar.xz
MDI child windows now have a OnMove event
Diffstat (limited to 'prototypes')
-rw-r--r--prototypes/mdi/fpg_mdi.pas29
1 files changed, 28 insertions, 1 deletions
diff --git a/prototypes/mdi/fpg_mdi.pas b/prototypes/mdi/fpg_mdi.pas
index d04acb3e..0e290800 100644
--- a/prototypes/mdi/fpg_mdi.pas
+++ b/prototypes/mdi/fpg_mdi.pas
@@ -9,7 +9,10 @@ uses
fpg_button;
type
- // forward declarations
+
+ TfpgMDIChildMoveEvent = procedure(Sender: TObject; const rec: TfpgMoveEventRec) of object;
+
+ // forward declarations
TfpgMDIChildForm = class;
@@ -55,6 +58,7 @@ type
FIsMouseDown: boolean;
FLastPos: TPoint;
FActive: boolean;
+ FOnMove: TfpgMDIChildMoveEvent;
procedure SetWindowTitle(AValue: TfpgString); reintroduce;
procedure TitleMouseMove(Sender: TObject; AShift: TShiftState; const AMousePos: TPoint);
procedure TitleMouseUp(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
@@ -62,7 +66,9 @@ type
procedure TitleMouseExit(Sender: TObject);
procedure CloseMDIWindowClicked(Sender: TObject);
procedure SetActive(AValue: boolean);
+ procedure DoOnMove(const x, y: TfpgCoord);
protected
+ procedure HandleMove(x, y: TfpgCoord); override;
property Active: boolean read FActive write SetActive;
public
constructor Create(AOwner: TfpgMDIWorkArea); reintroduce;
@@ -70,6 +76,8 @@ type
procedure SetClientFrame(AFrame: TfpgFrame);
procedure UpdateWindowTitle;
procedure Close;
+ published
+ property OnMove: TfpgMDIChildMoveEvent read FOnMove write FOnMove;
end;
implementation
@@ -151,6 +159,25 @@ begin
end;
end;
+procedure TfpgMDIChildForm.DoOnMove(const x, y: TfpgCoord);
+var
+ rec: TfpgMoveEventRec;
+begin
+ if Assigned(FOnMove) then
+ begin
+ rec.Sender := self;
+ rec.x := x;
+ rec.y := y;
+ FOnMove(self, rec);
+ end;
+end;
+
+procedure TfpgMDIChildForm.HandleMove(x, y: TfpgCoord);
+begin
+ inherited HandleMove(x, y);
+ DoOnMove(x, y);
+end;
+
procedure TfpgMDIChildForm.SetWindowTitle(AValue: TfpgString);
begin
if FWindowTitle = AValue then