dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] CVS: pnetlib/Xsharp TopLevelWindow.cs,1.4,1.5


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/Xsharp TopLevelWindow.cs,1.4,1.5
Date: Wed, 11 Jun 2003 03:07:21 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/Xsharp
In directory subversions:/tmp/cvs-serv17639/Xsharp

Modified Files:
        TopLevelWindow.cs 
Log Message:


Initial check-in of a "System.Windows.Forms" implementation (only "Control"
works right now); changes to Xsharp and System.Drawing to support Forms;
new "FormsHello" sample.


Index: TopLevelWindow.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/Xsharp/TopLevelWindow.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** TopLevelWindow.cs   7 Jun 2003 00:13:09 -0000       1.4
--- TopLevelWindow.cs   11 Jun 2003 07:07:19 -0000      1.5
***************
*** 37,40 ****
--- 37,41 ----
        private bool iconic;
        private bool hasPrimaryFocus;
+       private bool reparented;
        private IntPtr keyBuffer;
        private InputOnlyWidget focusWidget;
***************
*** 116,119 ****
--- 117,121 ----
                                this.iconic = false;
                                this.hasPrimaryFocus = false;
+                               this.reparented = false;
                                this.keyBuffer = IntPtr.Zero;
                                this.focusWidget = this;
***************
*** 143,147 ****
                                        // Top-level widgets receive all key 
and focus events.
                                        SelectInput(EventMask.KeyPressMask |
!                                                               
EventMask.FocusChangeMask);
                                }
                                finally
--- 145,150 ----
                                        // Top-level widgets receive all key 
and focus events.
                                        SelectInput(EventMask.KeyPressMask |
!                                                               
EventMask.FocusChangeMask |
!                                                               
EventMask.StructureNotifyMask);
                                }
                                finally
***************
*** 179,182 ****
--- 182,217 ----
  
        /// <summary>
+       /// <para>Determine if this widget is currently iconified.</para>
+       /// </summary>
+       ///
+       /// <value>
+       /// <para>Returns <see langword="true"/> if the widget is iconified;
+       /// <see langword="false"/> otherwise.</para>
+       /// </value>
+       ///
+       /// <remarks>
+       /// <para>Setting this property is equivalent to calling either
+       /// <c>Iconify</c> or <c>Deiconify</c>.</para>
+       /// </remarks>
+       public bool IsIconic
+                       {
+                               get
+                               {
+                                       return iconic;
+                               }
+                               set
+                               {
+                                       if(value)
+                                       {
+                                               Iconify();
+                                       }
+                                       else
+                                       {
+                                               Deiconify();
+                                       }
+                               }
+                       }
+ 
+       /// <summary>
        /// <para>Map this widget to the screen.</para>
        /// </summary>
***************
*** 789,792 ****
--- 824,911 ----
                                                        }
                                                        widget = widget.Parent;
+                                               }
+                                       }
+                                       break;
+ 
+                                       case EventType.ConfigureNotify:
+                                       {
+                                               // The window manager may have 
caused us to move/resize.
+                                               if(xevent.xconfigure.window != 
xevent.window)
+                                               {
+                                                       // SubstructureNotify - 
not interesting to us.
+                                                       break;
+                                               }
+                                               if(xevent.xconfigure.width != 
width ||
+                                                  xevent.xconfigure.height != 
height)
+                                               {
+                                                       // The size has been 
changed by the window manager.
+                                                       width = 
xevent.xconfigure.width;
+                                                       height = 
xevent.xconfigure.height;
+                                                       OnResize(width, height);
+                                               }
+                                               if(xevent.send_event || 
!reparented)
+                                               {
+                                                       // The window manager 
moved us to a new position.
+                                                       if(x != 
xevent.xconfigure.x ||
+                                                          y != 
xevent.xconfigure.y)
+                                                       {
+                                                               x = 
xevent.xconfigure.x;
+                                                               y = 
xevent.xconfigure.y;
+                                                               OnMove(x, y);
+                                                       }
+                                               }
+                                       }
+                                       break;
+ 
+                                       case EventType.ReparentNotify:
+                                       {
+                                               // We may have been reparented 
by the window manager.
+                                               if(xevent.xreparent.window != 
(Xlib.Window)handle)
+                                               {
+                                                       // SubstructureNotify - 
not interesting to us.
+                                                       break;
+                                               }
+                                               if(xevent.xreparent.parent !=
+                                                               
(Xlib.Window)(screen.RootWindow.handle))
+                                               {
+                                                       // Reparented by the 
window manager.
+                                                       reparented = true;
+                                               }
+                                               else
+                                               {
+                                                       // Window manager 
crashed: we are back on the root.
+                                                       reparented = false;
+                                                       x = xevent.xreparent.x;
+                                                       y = xevent.xreparent.y;
+                                                       OnMove(x, y);
+                                               }
+                                       }
+                                       break;
+ 
+                                       case EventType.MapNotify:
+                                       {
+                                               // The window manager mapped us 
to the screen.
+                                               if(iconic)
+                                               {
+                                                       iconic = false;
+                                                       
OnIconicStateChanged(false);
+                                               }
+                                               if(!mapped)
+                                               {
+                                                       mapped = true;
+                                                       OnMapStateChanged();
+                                               }
+                                       }
+                                       break;
+ 
+                                       case EventType.UnmapNotify:
+                                       {
+                                               // We were unmapped from the 
screen.  If "mapped"
+                                               // is true, then we are being 
iconified by the window
+                                               // manager.  Otherwise, we 
asked to be withdrawn.
+                                               if(!iconic && mapped)
+                                               {
+                                                       iconic = true;
+                                                       
OnIconicStateChanged(true);
                                                }
                                        }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]