diff --git a/comp/src/gb.form.mdi/.info b/comp/src/gb.form.mdi/.info index 916666d8c..e5fa57a61 100644 --- a/comp/src/gb.form.mdi/.info +++ b/comp/src/gb.form.mdi/.info @@ -110,6 +110,14 @@ Special :Close : +(Window)Window; +:Attach +: + +(Window)Window; +:Detach +: + (Window)Window; ActiveWindow p @@ -151,6 +159,10 @@ Add m Window (hWindow)Window;[(Resizable)b] +Remove +m + +(hWindow)Window; Detach m @@ -171,7 +183,15 @@ _Activate m -_Close +_RaiseClose m b (hWindow)Window; +_RaiseAttach +m + +(hWindow)Window; +_RaiseDetach +m + +(hWindow)Window; diff --git a/comp/src/gb.form.mdi/.src/Workspace/FWorkspace.class b/comp/src/gb.form.mdi/.src/Workspace/FWorkspace.class index 0b87e65ed..aa61471ea 100644 --- a/comp/src/gb.form.mdi/.src/Workspace/FWorkspace.class +++ b/comp/src/gb.form.mdi/.src/Workspace/FWorkspace.class @@ -139,6 +139,8 @@ Public Sub Detach(hWin As Window) hWindow.Detached = True Inc $nDetach + GetParent()._RaiseDetach(hWin) + End Public Sub Attach(hWin As Window) @@ -160,6 +162,8 @@ Public Sub Attach(hWin As Window) Dec $nDetach Activate + + GetParent()._RaiseAttach(hWin) End @@ -873,7 +877,7 @@ End Public Sub tabWorkspace_Close(Index As Integer) - If GetParent()._Close($aWindow[Index].Window) Then + If GetParent()._RaiseClose($aWindow[Index].Window) Then Stop Event Return Endif diff --git a/comp/src/gb.form.mdi/.src/Workspace/Workspace.class b/comp/src/gb.form.mdi/.src/Workspace/Workspace.class index ee9ab750e..2c4750706 100644 --- a/comp/src/gb.form.mdi/.src/Workspace/Workspace.class +++ b/comp/src/gb.form.mdi/.src/Workspace/Workspace.class @@ -10,6 +10,8 @@ Public Const _Group As String = "Special" Event Activate Event Close({Window} As Window) +Event Attach({Window} As Window) +Event Detach({Window} As Window) Property ActiveWindow As Window Property Read Windows As Window[] @@ -30,14 +32,38 @@ Public Sub _new() End +Private Sub GetWorkspace(hWindow As Window) As Workspace + + Dim hCtrl As Control = hWindow + + While hCtrl + If hCtrl Is Workspace Then Return hCtrl + hCtrl = hCtrl.Parent + Wend + +End + + Public Sub Add(hWindow As Window, Optional Resizable As Boolean) As Window + Dim hPrev As Workspace + + hPrev = GetWorkspace(hWindow) + If hPrev Then hPrev.Remove(hWindow) + $hWorkspace.Add(hWindow, Resizable) Return hWindow End +Public Sub Remove(hWindow As Window) + + $hWorkspace.Remove(hWindow) + +End + + Public Sub Detach(hWindow As Window) $hWorkspace.Detach(hWindow) @@ -95,7 +121,7 @@ Public Sub _Activate() End -Public Sub _Close(hWindow As Window) As Boolean +Public Sub _RaiseClose(hWindow As Window) As Boolean Dim bCancel As Boolean @@ -104,6 +130,19 @@ Public Sub _Close(hWindow As Window) As Boolean End +Public Sub _RaiseAttach(hWindow As Window) + + Raise Attach(hWindow) + +End + +Public Sub _RaiseDetach(hWindow As Window) + + Raise Detach(hWindow) + +End + + ' Private Function ShowTitle_Read() As Boolean ' ' Return $hWorkspace.IsShowTitle()