[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms Application.cs,
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms Application.cs,1.4,1.5 Control.cs,1.15,1.16 Form.cs,1.9,1.10 |
Date: |
Sat, 21 Jun 2003 23:19:47 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms
In directory subversions:/tmp/cvs-serv30487/System.Windows.Forms
Modified Files:
Application.cs Control.cs Form.cs
Log Message:
Correct "Close" handling for top-level forms; implement
"DestroyHandle" and "Dispose".
Index: Application.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Application.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** Application.cs 22 Jun 2003 00:12:14 -0000 1.4
--- Application.cs 22 Jun 2003 03:19:45 -0000 1.5
***************
*** 31,34 ****
--- 31,37 ----
public sealed class Application
{
+ // Internal state.
+ private static ApplicationContext context;
+
// Cannot instantiate this class.
private Application() {}
Index: Control.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Control.cs,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** Control.cs 21 Jun 2003 04:34:35 -0000 1.15
--- Control.cs 22 Jun 2003 03:19:45 -0000 1.16
***************
*** 1405,1412 ****
// Destroy the handle associated with the control.
- [TODO]
protected virtual void DestroyHandle()
{
! // TODO
}
--- 1405,1438 ----
// Destroy the handle associated with the control.
protected virtual void DestroyHandle()
{
! // Bail out if we don't have a handle.
! if(toolkitWindow == null)
! {
! return;
! }
!
! // Remove the control from the screen if we are
top-level.
! if(Visible)
! {
! Visible = false;
! }
!
! // Destroy all of the child controls.
! int child;
! for(child = 0; child < numChildren; ++child)
! {
! children[child].DestroyHandle();
! }
!
! // Destroy the toolkit window.
! if(toolkitWindow != null)
! {
! toolkitWindow.Destroy();
! toolkitWindow = null;
! }
!
! // Notify event handlers that the handle is
destroyed.
! OnHandleDestroyed(EventArgs.Empty);
}
***************
*** 1439,1443 ****
#endif
{
! // TODO
}
--- 1465,1470 ----
#endif
{
! DestroyHandle();
! disposed = true;
}
***************
*** 4375,4378 ****
--- 4402,4415 ----
}
}
+
+ // Event that is emitted when the close button on a window
+ // is selected by the user.
+ void IToolkitEventSink.ToolkitClose()
+ {
+ CloseRequest();
+ }
+
+ // Close request received - processed by the "Form" class.
+ internal virtual void CloseRequest() {}
// Create a brush that can be used to fill with the background
color/image.
Index: Form.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Form.cs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** Form.cs 18 Jun 2003 08:42:02 -0000 1.9
--- Form.cs 22 Jun 2003 03:19:45 -0000 1.10
***************
*** 658,665 ****
// Close this form.
- [TODO]
public void Close()
{
! // TODO
}
--- 658,664 ----
// Close this form.
public void Close()
{
! CloseRequest();
}
***************
*** 1192,1195 ****
--- 1191,1206 ----
{
base.SetVisibleCore(value);
+ }
+
+ // Close request received from "Control.ToolkitClose".
+ internal override void CloseRequest()
+ {
+ CancelEventArgs args = new CancelEventArgs();
+ OnClosing(args);
+ if(!(args.Cancel))
+ {
+ OnClosed(EventArgs.Empty);
+ DestroyHandle();
+ }
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms Application.cs,1.4,1.5 Control.cs,1.15,1.16 Form.cs,1.9,1.10,
Rhys Weatherley <address@hidden> <=