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

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

[Dotgnu-pnet-commits] pnetlib/System.Windows.Forms Form.cs, 1.22, 1.23 M


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/System.Windows.Forms Form.cs, 1.22, 1.23 MessageBox.cs, 1.8, 1.9
Date: Mon, 01 Dec 2003 00:23:30 +0000

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms
In directory subversions:/tmp/cvs-serv6883/System.Windows.Forms

Modified Files:
        Form.cs MessageBox.cs 
Log Message:


Add the "IToolkitTopLevelWindow" interface to encapsulate top-level
window operations; implement some more top-level window operations in "Form".


Index: MessageBox.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/MessageBox.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MessageBox.cs       30 Nov 2003 00:44:06 -0000      1.8
--- MessageBox.cs       1 Dec 2003 00:23:28 -0000       1.9
***************
*** 434,437 ****
--- 434,439 ----
                                // Set the initial message box size to the 
vbox's recommended.
                                ClientSize = vbox.RecommendedSize;
+                               MinimumSize = ClientSize;
+                               MaximumSize = ClientSize;
                        }
  

Index: Form.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Form.cs,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** Form.cs     28 Nov 2003 18:51:04 -0000      1.22
--- Form.cs     1 Dec 2003 00:23:28 -0000       1.23
***************
*** 77,80 ****
--- 77,87 ----
  
        // Get or set this control's properties.
+       private IToolkitTopLevelWindow ToolkitWindow
+                       {
+                               get
+                               {
+                                       return (toolkitWindow as 
IToolkitTopLevelWindow);
+                               }
+                       }
        public IButtonControl AcceptButton
                        {
***************
*** 243,247 ****
                                }
                        }
-       [TODO]
        public Icon Icon
                        {
--- 250,253 ----
***************
*** 252,257 ****
                                set
                                {
!                                       // TODO: send the icon to the window 
manager.
!                                       icon = value;
                                }
                        }
--- 258,269 ----
                                set
                                {
!                                       if(icon != value)
!                                       {
!                                               icon = value;
!                                               if(ToolkitWindow != null)
!                                               {
!                                                       
ToolkitWindow.SetIcon(value);
!                                               }
!                                       }
                                }
                        }
***************
*** 311,315 ****
                                }
                        }
-       [TODO]
        public Size MaximumSize
                        {
--- 323,326 ----
***************
*** 320,324 ****
                                set
                                {
-                                       // TODO: send the maximum size to the 
window manager.
                                        if(value.Width < 0)
                                        {
--- 331,334 ----
***************
*** 331,335 ****
                                                        ("value.Height", 
S._("SWF_NonNegative"));
                                        }
!                                       maximumSize = value;
                                }
                        }
--- 341,352 ----
                                                        ("value.Height", 
S._("SWF_NonNegative"));
                                        }
!                                       if(maximumSize != value)
!                                       {
!                                               maximumSize = value;
!                                               if(ToolkitWindow != null)
!                                               {
!                                                       
ToolkitWindow.SetMaximumSize(value);
!                                               }
!                                       }
                                }
                        }
***************
*** 365,369 ****
                                }
                        }
-       [TODO]
        public Size MinimumSize
                        {
--- 382,385 ----
***************
*** 374,378 ****
                                set
                                {
-                                       // TODO: send the minimum size to the 
window manager.
                                        if(value.Width < 0)
                                        {
--- 390,393 ----
***************
*** 385,389 ****
                                                        ("value.Height", 
S._("SWF_NonNegative"));
                                        }
!                                       minimumSize = value;
                                }
                        }
--- 400,411 ----
                                                        ("value.Height", 
S._("SWF_NonNegative"));
                                        }
!                                       if(minimumSize != value)
!                                       {
!                                               minimumSize = value;
!                                               if(ToolkitWindow != null)
!                                               {
!                                                       
ToolkitWindow.SetMinimumSize(value);
!                                               }
!                                       }
                                }
                        }
***************
*** 551,555 ****
                                }
                        }
-       [TODO]
        public FormWindowState WindowState
                        {
--- 573,576 ----
***************
*** 560,565 ****
                                set
                                {
!                                       // TODO: pass the state change to the 
window manager
!                                       windowState = value;
                                }
                        }
--- 581,605 ----
                                set
                                {
!                                       if(windowState != value)
!                                       {
!                                               windowState = value;
!                                               if(ToolkitWindow != null)
!                                               {
!                                                       if(value == 
FormWindowState.Normal)
!                                                       {
!                                                               
ToolkitWindow.Restore();
!                                                       }
!                                               #if !CONFIG_COMPACT_FORMS
!                                                       else if(value == 
FormWindowState.Minimized)
!                                                       {
!                                                               
ToolkitWindow.Iconify();
!                                                       }
!                                               #endif
!                                                       else if(value == 
FormWindowState.Maximized)
!                                                       {
!                                                               
ToolkitWindow.Maximize();
!                                                       }
!                                               }
!                                       }
                                }
                        }
***************
*** 572,582 ****
  
                                // Create the window and set its initial 
caption.
!                               IToolkitWindow window =
                                        
ToolkitManager.Toolkit.CreateTopLevelWindow
!                                               (cp.Width - 
ToolkitDrawSize.Width, cp.Height - ToolkitDrawSize.Height, this);
                                window.SetTitle(cp.Caption);
  
!                               // Adjust the window decorations to match our 
requirements.
                                SetWindowFlags(window);
  
                                // Center the window on-screen if necessary.
--- 612,640 ----
  
                                // Create the window and set its initial 
caption.
!                               IToolkitTopLevelWindow window =
                                        
ToolkitManager.Toolkit.CreateTopLevelWindow
!                                               (cp.Width - 
ToolkitDrawSize.Width,
!                                                cp.Height - 
ToolkitDrawSize.Height, this);
                                window.SetTitle(cp.Caption);
  
!                               // Adjust the window hints to match our 
requirements.
                                SetWindowFlags(window);
+                               if(icon != null)
+                               {
+                                       window.SetIcon(icon);
+                               }
+                               window.SetMaximumSize(maximumSize);
+                               window.SetMinimumSize(minimumSize);
+                       #if !CONFIG_COMPACT_FORMS
+                               if(windowState == FormWindowState.Minimized)
+                               {
+                                       window.Iconify();
+                               }
+                               else
+                       #endif
+                               if(windowState == FormWindowState.Maximized)
+                               {
+                                       window.Maximize();
+                               }
  
                                // Center the window on-screen if necessary.
***************
*** 658,662 ****
        private void SetWindowFlags(IToolkitWindow window)
                        {
!                               window.SetWindowFlags(GetFullFlags());
                        }
  
--- 716,720 ----
        private void SetWindowFlags(IToolkitWindow window)
                        {
!                               
((IToolkitTopLevelWindow)window).SetWindowFlags(GetFullFlags());
                        }
  
***************
*** 1201,1207 ****
        protected override void OnTextChanged(EventArgs e)
                        {
!                               if(toolkitWindow != null)
                                {
!                                       toolkitWindow.SetTitle(Text);
                                }
                                base.OnTextChanged(e);
--- 1259,1265 ----
        protected override void OnTextChanged(EventArgs e)
                        {
!                               if(ToolkitWindow != null)
                                {
!                                       ToolkitWindow.SetTitle(Text);
                                }
                                base.OnTextChanged(e);
***************
*** 1227,1250 ****
        protected override bool ProcessDialogKey(Keys keyData)
                        {
!                               if ((keyData & (Keys.Control | Keys.Alt)) == 0)
!                               {
!                                       Keys key = keyData & Keys.KeyCode;
!                                       if (key == Keys.Return)
!                                       {
!                                               if (acceptButton != null)
!                                               {
!                                                       
acceptButton.PerformClick();
!                                                       return true;
!                                               }
!                                       }
!                                       else if (key == Keys.Escape)
!                                       {
!                                               if (cancelButton != null)
!                                               {
!                                                       
cancelButton.PerformClick();
!                                                       return true;
!                                               }
!                                       }
!                               }
                                return base.ProcessDialogKey(keyData);
                        }
--- 1285,1308 ----
        protected override bool ProcessDialogKey(Keys keyData)
                        {
!                               if ((keyData & (Keys.Control | Keys.Alt)) == 0)
!                               {
!                                       Keys key = keyData & Keys.KeyCode;
!                                       if (key == Keys.Return)
!                                       {
!                                               if (acceptButton != null)
!                                               {
!                                                       
acceptButton.PerformClick();
!                                                       return true;
!                                               }
!                                       }
!                                       else if (key == Keys.Escape)
!                                       {
!                                               if (cancelButton != null)
!                                               {
!                                                       
cancelButton.PerformClick();
!                                                       return true;
!                                               }
!                                       }
!                               }
                                return base.ProcessDialogKey(keyData);
                        }
***************
*** 1267,1279 ****
        protected override bool ProcessTabKey(bool forward)
                        {
!                               return SelectNextControl(ActiveControl, 
forward, true, true, true);
                        }
  
!       protected override bool ProcessDialogChar(char charCode)
!                       {
!                               if (GetTopLevel() && ProcessMnemonic(charCode))
!                                       return true; 
!                               return base.ProcessDialogChar(charCode); 
!                       }
  
        // Inner core of "Scale".
--- 1325,1337 ----
        protected override bool ProcessTabKey(bool forward)
                        {
!                               return SelectNextControl(ActiveControl, 
forward, true, true, true);
                        }
  
!       protected override bool ProcessDialogChar(char charCode)
!                       {
!                               if (GetTopLevel() && ProcessMnemonic(charCode))
!                                       return true; 
!                               return base.ProcessDialogChar(charCode); 
!                       }
  
        // Inner core of "Scale".
***************
*** 1288,1319 ****
        protected override void Select(bool directed, bool forward)
                        {
!                               if (directed)
!                                       base.SelectNextControl(null, forward, 
true, true, false);
!                       
!                               if (TopLevel)
!                                       toolkitWindow.Focus();
! 
!                               Form parent = ParentForm;
!                               if (parent != null)
!                                       parent.ActiveControl = this;
                        }
  
!       protected override void UpdateDefaultButton()
!                       {
!                               // Find the bottom active control.
!                               Control c = this;
!                               while (c is ContainerControl)
!                                       c = (c as 
ContainerControl).ActiveControl;
! 
!                               if (c is IButtonControl)
!                               {
!                                       // Notify the previous button that it 
is not the default.
!                                       if (acceptButton != null)
!                                               (acceptButton as 
IButtonControl).NotifyDefault(false);
!                                       acceptButton = c as IButtonControl;
!                                       if (acceptButton != null)
!                                               (acceptButton as 
IButtonControl).NotifyDefault(true);
!                               }
!                       } 
  
        // Inner core of "SetBounds".
--- 1346,1377 ----
        protected override void Select(bool directed, bool forward)
                        {
!                               if (directed)
!                                       base.SelectNextControl(null, forward, 
true, true, false);
!                       
!                               if (TopLevel)
!                                       toolkitWindow.Focus();
! 
!                               Form parent = ParentForm;
!                               if (parent != null)
!                                       parent.ActiveControl = this;
                        }
  
!       protected override void UpdateDefaultButton()
!                       {
!                               // Find the bottom active control.
!                               Control c = this;
!                               while (c is ContainerControl)
!                                       c = (c as 
ContainerControl).ActiveControl;
! 
!                               if (c is IButtonControl)
!                               {
!                                       // Notify the previous button that it 
is not the default.
!                                       if (acceptButton != null)
!                                               (acceptButton as 
IButtonControl).NotifyDefault(false);
!                                       acceptButton = c as IButtonControl;
!                                       if (acceptButton != null)
!                                               (acceptButton as 
IButtonControl).NotifyDefault(true);
!                               }
!                       } 
  
        // Inner core of "SetBounds".





reply via email to

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