diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2013-04-12 18:01:53 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2013-04-12 18:29:05 +0100 |
commit | e1fe151dc97435361190f3eee698d230e4a61308 (patch) | |
tree | 67011e6eb563c35d9c46da0de0befcc20f45e1f8 | |
parent | 9be4072b65ba67dfb82224ba5cda84489135612f (diff) | |
download | fpGUI-e1fe151dc97435361190f3eee698d230e4a61308.tar.xz |
MDI child windows now have a OnMove event
-rw-r--r-- | prototypes/mdi/fpg_mdi.pas | 29 |
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 |