[GB.FORM.MDI]
* NEW: Workspace.Remove() is a new method for removing a window from the workspace. * NEW: Workspace.Add() automatically calls Workspace.Remove() to remove the window from its previous workspace if needed. * NEW: Workspace now raises the Attach and Detach events when a window is respectively attached or detached. git-svn-id: svn://localhost/gambas/trunk@6361 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
949dcbd6aa
commit
fee4e6cbaf
3 changed files with 66 additions and 3 deletions
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
@ -161,6 +163,8 @@ Public Sub Attach(hWin As Window)
|
|||
|
||||
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
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue