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

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

[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms ContainerContro


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms ContainerControl.cs,NONE,1.1 FormStartPosition.cs,NONE,1.1 MainMenu.cs,NONE,1.1 ScrollableControl.cs,NONE,1.1 SizeGripStyle.cs,NONE,1.1 Application.cs,1.1,1.2 Form.cs,1.2,1.3 IContainerControl.cs,1.1,1.2
Date: Thu, 12 Jun 2003 01:50:31 -0400

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

Modified Files:
        Application.cs Form.cs IContainerControl.cs 
Added Files:
        ContainerControl.cs FormStartPosition.cs MainMenu.cs 
        ScrollableControl.cs SizeGripStyle.cs 
Log Message:


Implement more of the "Form" class.


--- NEW FILE ---
/*
 * ContainerControl.cs - Implementation of the
 *                      "System.Windows.Forms.ContainerControl" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Windows.Forms
{

using System.Drawing;

public class ContainerControl : ScrollableControl, IContainerControl
{
        // Internal state.
        private Control activeControl;

        // Constructor.
        public ContainerControl() {}

        // Get or set this control's properties.
        public Control ActiveControl
                        {
                                get
                                {
                                        return activeControl;
                                }
                                set
                                {
                                        if(!ActivateControl(value))
                                        {
                                                throw new ArgumentException
                                                        
(S._("SWF_CouldNotActivate"));
                                        }
                                }
                        }
        public override BindingContext BindingContext
                        {
                                get
                                {
                                        // Containers must always have a 
binding context.
                                        BindingContext context = 
base.BindingContext;
                                        if(context == null)
                                        {
                                                context = new BindingContext();
                                                base.BindingContext = context;
                                        }
                                        return context;
                                }
                                set
                                {
                                        base.BindingContext = value;
                                }
                        }
        protected override CreateParams CreateParams
                        {
                                get
                                {
                                        return base.CreateParams;
                                }
                        }
        public Form ParentForm
                        {
                                get
                                {
                                        return FindForm();
                                }
                        }

        // Activate a specific control.
        [TODO]
        public bool ActivateControl(Control active)
                        {
                                // TODO
                                return true;
                        }

        // Dispose of this control.
        protected override void Dispose(bool disposing)
                        {
                                activeControl = null;
                                base.Dispose(disposing);
                        }

        // Validate the last invalidated control.
        [TODO]
        public bool Validate()
                        {
                                // TODO
                                return true;
                        }

        // Override the "control removed" event.
        protected override void OnControlRemoved(ControlEventArgs e)
                        {
                                if(activeControl == e.Control)
                                {
                                        activeControl = null;
                                }
                                base.OnControlRemoved(e);
                        }

        // Override the "control created" event.
        protected override void OnCreateControl()
                        {
                                base.OnCreateControl();
                                OnBindingContextChanged(EventArgs.Empty);
                        }

        // Process a dialog character.
        [TODO]
        protected override bool ProcessDialogChar(char charCode)
                        {
                                // TODO
                                return base.ProcessDialogChar(charCode);
                        }

        // Process a dialog key.
        [TODO]
        protected override bool ProcessDialogKey(Keys keyData)
                        {
                                // TODO
                                return base.ProcessDialogKey(keyData);
                        }

        // Process a key mnemonic.
        [TODO]
        protected override bool ProcessMnemonic(char charCode)
                        {
                                // TODO
                                return base.ProcessMnemonic(charCode);
                        }

        // Process the tab key.
        [TODO]
        protected virtual bool ProcessTabKey(bool forward)
                        {
                                // TODO
                                return false;
                        }

        // Select this control.
        [TODO]
        protected override void Select(bool directed, bool forward)
                        {
                                // TODO
                        }

#if !CONFIG_COMPACT_FORMS

        // Process a message.
        public override void WndProc(ref Message m)
                        {
                                base.WndProc(ref m);
                        }

#endif // !CONFIG_COMPACT_FORMS

}; // class ContainerControl

}; // namespace System.Windows.Forms

--- NEW FILE ---
/*
 * FormStartPosition.cs - Implementation of the
 *                      "System.Windows.Forms.FormStartPosition" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Windows.Forms
{

using System.Runtime.InteropServices;

#if !ECMA_COMPAT
[ComVisible(true)]
#endif
public enum FormStartPosition
{
        Manual                                  = 0,
        CenterScreen                    = 1,
        WindowsDefaultLocation  = 2,
        WindowsDefaultBounds    = 3,
        CenterParent                    = 4

}; // enum FormStartPosition

}; // namespace System.Windows.Forms

--- NEW FILE ---
/*
 * MainMenu.cs - Implementation of the
 *                      "System.Windows.Forms.MainMenu" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Windows.Forms
{

[TODO]
public class MainMenu
{
        // TODO

}; // class MainMenu

}; // namespace System.Windows.Forms

--- NEW FILE ---
/*
 * ScrollableControl.cs - Implementation of the
 *                      "System.Windows.Forms.ScrollableControl" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Windows.Forms
{

using System.Drawing;
using System.ComponentModel;

#if CONFIG_COMPONENT_MODEL
[Designer
        ("System.Windows.Forms.Design.ScrollableControlDesigner, 
System.Design")]
#endif
public class ScrollableControl : Control
{
        // Internal state.
        private bool autoScroll;
        private bool hscroll;
        private bool vscroll;
        private Size autoScrollMargin;
        private Size autoScrollMinSize;
        private Point autoScrollPosition;
        private DockPaddingEdges dockPadding;

        // Constructor.
        public ScrollableControl() {}

        // Get or set this control's properties.
        public virtual bool AutoScroll
                        {
                                get
                                {
                                        return autoScroll;
                                }
                                set
                                {
                                        autoScroll = value;
                                }
                        }
        public Size AutoScrollMargin
                        {
                                get
                                {
                                        return autoScrollMargin;
                                }
                                set
                                {
                                        if(value.Width < 0)
                                        {
                                                throw new 
ArgumentOutOfRangeException
                                                        ("value.Width", 
S._("SWF_NonNegative"));
                                        }
                                        if(value.Height < 0)
                                        {
                                                throw new 
ArgumentOutOfRangeException
                                                        ("value.Height", 
S._("SWF_NonNegative"));
                                        }
                                        autoScrollMargin = value;
                                }
                        }
        public Size AutoScrollMinSize
                        {
                                get
                                {
                                        return autoScrollMinSize;
                                }
                                set
                                {
                                        autoScrollMinSize = value;
                                }
                        }
        public Point AutoScrollPosition
                        {
                                get
                                {
                                        return autoScrollPosition;
                                }
                                set
                                {
                                        autoScrollPosition = value;
                                }
                        }
        protected override CreateParams CreateParams
                        {
                                get
                                {
                                        return base.CreateParams;
                                }
                        }
        [TODO]
        public override Rectangle DisplayRectangle
                        {
                                get
                                {
                                        // TODO: subtract the scroll bars from 
the client size
                                        return base.DisplayRectangle;
                                }
                        }
        public DockPaddingEdges DockPadding
                        {
                                get
                                {
                                        return dockPadding;
                                }
                                set
                                {
                                        dockPadding = value;
                                }
                        }
        protected bool HScroll
                        {
                                get
                                {
                                        return hscroll;
                                }
                                set
                                {
                                        hscroll = value;
                                }
                        }
        protected bool VScroll
                        {
                                get
                                {
                                        return vscroll;
                                }
                                set
                                {
                                        vscroll = value;
                                }
                        }

        // Set the auto scroll margin.
        public void SetAutoScrollMargin(int x, int y)
                        {
                                if(x < 0)
                                {
                                        x = 0;
                                }
                                if(y < 0)
                                {
                                        y = 0;
                                }
                                AutoScrollMargin = new Size(x, y);
                        }

        // Handle a layout event.
        [TODO]
        protected override void OnLayout(LayoutEventArgs e)
                        {
                                // TODO
                                base.OnLayout(e);
                        }

        // Handle a mouse wheel event.
        [TODO]
        protected override void OnMouseWheel(MouseEventArgs e)
                        {
                                // TODO
                                base.OnMouseWheel(e);
                        }

        // Handle a visibility change event.
        [TODO]
        protected override void OnVisibleChanged(EventArgs e)
                        {
                                // TODO
                                base.OnVisibleChanged(e);
                        }

        // Inner core of "Scale".
        [TODO]
        protected override void ScaleCore(float dx, float dy)
                        {
                                // TODO
                                base.ScaleCore(dx, dy);
                        }

        // Dock padding edge definitions.
        [TODO]
        public class DockPaddingEdges : ICloneable
        {
                // TODO

                public Object Clone() { return this; }

        }; // class DockPaddingEdges

#if !CONFIG_COMPACT_FORMS

        // Process a message.
        public override void WndProc(ref Message m)
                        {
                                base.WndProc(ref m);
                        }

#endif // !CONFIG_COMPACT_FORMS

}; // class ScrollableControl

}; // namespace System.Windows.Forms

--- NEW FILE ---
/*
 * SizeGripStyle.cs - Implementation of the
 *                      "System.Windows.Forms.SizeGripStyle" class.
 *
 * Copyright (C) 2003  Southern Storm Software, Pty Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

namespace System.Windows.Forms
{

public enum SizeGripStyle
{
        Auto = 0,
        Show = 1,
        Hide = 2

}; // enum SizeGripStyle

}; // namespace System.Windows.Forms

Index: Application.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Application.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** Application.cs      11 Jun 2003 07:07:19 -0000      1.1
--- Application.cs      12 Jun 2003 05:50:29 -0000      1.2
***************
*** 381,384 ****
--- 381,385 ----
                                {
                                        mainForm.Show();
+                                       Form.activeForm = mainForm;
                                }
                                RunMessageLoop();

Index: Form.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/Form.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Form.cs     11 Jun 2003 10:37:28 -0000      1.2
--- Form.cs     12 Jun 2003 05:50:29 -0000      1.3
***************
*** 23,42 ****
  {
  
  using System.Drawing.Toolkit;
  
! public class Form : Control
  {
!       // TODO
  
!       public DialogResult DialogResult
                        {
                                get
                                {
!                                       // TODO
!                                       return DialogResult.None;
                                }
                                set
                                {
                                        // TODO
                                }
                        }
--- 23,495 ----
  {
  
+ using System.Drawing;
  using System.Drawing.Toolkit;
  
! [TODO]
! public class Form : ContainerControl
  {
!       // Internal state.
!       private IButtonControl acceptButton;
!       private IButtonControl cancelButton;
!       private bool autoScale;
!       private bool isMdiChild;
!       private bool isMdiContainer;
!       private bool keyPreview;
!       private bool topLevel;
!       private Size autoScaleBaseSize;
!       private DialogResult dialogResult;
!       private FormBorderStyle borderStyle;
!       private Icon icon;
!       private ToolkitWindowFlags windowFlags;
!       private Size maximumSize;
!       private Size minimumSize;
!       private Form[] mdiChildren;
!       private Form[] ownedForms;
!       private Form mdiParent;
!       private Form owner;
!       private MainMenu menu;
!       private MainMenu mergedMenu;
!       private double opacity;
!       private SizeGripStyle sizeGripStyle;
!       private FormStartPosition formStartPosition;
!       private Color transparencyKey;
!       private FormWindowState windowState;
!       internal static Form activeForm;
  
!       // Constructor.
!       public Form()
!                       {
!                               autoScale = true;
!                               topLevel = true;
!                               borderStyle = FormBorderStyle.Sizable;
!                               mdiChildren = new Form [0];
!                               ownedForms = new Form [0];
!                               opacity = 1.0;
!                               windowFlags = ToolkitWindowFlags.Default;
!                               formStartPosition = 
FormStartPosition.WindowsDefaultLocation;
!                               windowState = FormWindowState.Normal;
!                       }
! 
!       // Get or set this control's properties.
!       public IButtonControl AcceptButton
                        {
                                get
                                {
!                                       return acceptButton;
                                }
                                set
                                {
+                                       acceptButton = value;
+                               }
+                       }
+       public static Form ActiveForm
+                       {
+                               get
+                               {
+                                       return activeForm;
+                               }
+                       }
+       [TODO]
+       public Form ActiveMdiChild
+                       {
+                               get
+                               {
                                        // TODO
+                                       return null;
+                               }
+                       }
+       public bool AutoScale
+                       {
+                               get
+                               {
+                                       return autoScale;
+                               }
+                               set
+                               {
+                                       autoScale = value;
+                               }
+                       }
+       public Size AutoScaleBaseSize
+                       {
+                               get
+                               {
+                                       return autoScaleBaseSize;
+                               }
+                               set
+                               {
+                                       autoScaleBaseSize = value;
+                               }
+                       }
+       public override bool AutoScroll
+                       {
+                               get
+                               {
+                                       return base.AutoScroll;
+                               }
+                               set
+                               {
+                                       base.AutoScroll = value;
+                               }
+                       }
+       public override Color BackColor
+                       {
+                               get
+                               {
+                                       // The base implementation takes care 
of the default.
+                                       return base.BackColor;
+                               }
+                               set
+                               {
+                                       base.BackColor = value;
+                               }
+                       }
+       public IButtonControl CancelButton
+                       {
+                               get
+                               {
+                                       return cancelButton;
+                               }
+                               set
+                               {
+                                       cancelButton = value;
+                               }
+                       }
+       public Rectangle DesktopBounds
+                       {
+                               get
+                               {
+                                       // Use the ordinary bounds.
+                                       return Bounds;
+                               }
+                               set
+                               {
+                                       Bounds = value;
+                               }
+                       }
+       public Point DesktopLocation
+                       {
+                               get
+                               {
+                                       // Use the ordinary location.
+                                       return Location;
+                               }
+                               set
+                               {
+                                       Location = value;
+                               }
+                       }
+       public DialogResult DialogResult
+                       {
+                               get
+                               {
+                                       return dialogResult;
+                               }
+                               set
+                               {
+                                       dialogResult = value;
+                               }
+                       }
+       public FormBorderStyle FormBorderStyle
+                       {
+                               get
+                               {
+                                       return borderStyle;
+                               }
+                               set
+                               {
+                                       if(borderStyle != value)
+                                       {
+                                               borderStyle = value;
+                                               SetWindowFlag(0, true);
+                                       }
+                               }
+                       }
+       public bool HelpButton
+                       {
+                               get
+                               {
+                                       return 
GetWindowFlag(ToolkitWindowFlags.Help);
+                               }
+                               set
+                               {
+                                       SetWindowFlag(ToolkitWindowFlags.Help, 
value);
+                               }
+                       }
+       [TODO]
+       public Icon Icon
+                       {
+                               get
+                               {
+                                       return icon;
+                               }
+                               set
+                               {
+                                       // TODO: send the icon to the window 
manager.
+                                       icon = value;
+                               }
+                       }
+       public bool IsMdiChild
+                       {
+                               get
+                               {
+                                       return isMdiChild;
+                               }
+                       }
+       [TODO]
+       public bool IsMdiContainer
+                       {
+                               get
+                               {
+                                       return isMdiContainer;
+                               }
+                               set
+                               {
+                                       // TODO: switch the form into MDI mode
+                                       isMdiContainer = value;
+                               }
+                       }
+       public bool KeyPreview
+                       {
+                               get
+                               {
+                                       return keyPreview;
+                               }
+                               set
+                               {
+                                       keyPreview = value;
+                               }
+                       }
+       public bool MaximizeBox
+                       {
+                               get
+                               {
+                                       return 
GetWindowFlag(ToolkitWindowFlags.Maximize);
+                               }
+                               set
+                               {
+                                       
SetWindowFlag(ToolkitWindowFlags.Maximize, value);
+                               }
+                       }
+       [TODO]
+       public Size MaximumSize
+                       {
+                               get
+                               {
+                                       return maximumSize;
+                               }
+                               set
+                               {
+                                       // TODO: send the maximum size to the 
window manager.
+                                       if(value.Width < 0)
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("value.Width", 
S._("SWF_NonNegative"));
+                                       }
+                                       if(value.Height < 0)
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("value.Height", 
S._("SWF_NonNegative"));
+                                       }
+                                       maximumSize = value;
+                               }
+                       }
+       public Form[] MdiChildren
+                       {
+                               get
+                               {
+                                       return mdiChildren;
+                               }
+                       }
+       [TODO]
+       public Form MdiParent
+                       {
+                               get
+                               {
+                                       return mdiParent;
+                               }
+                               set
+                               {
+                                       // TODO: validate the parent
+                                       mdiParent = value;
+                               }
+                       }
+       public bool MinimizeBox
+                       {
+                               get
+                               {
+                                       return 
GetWindowFlag(ToolkitWindowFlags.Minimize);
+                               }
+                               set
+                               {
+                                       
SetWindowFlag(ToolkitWindowFlags.Minimize, value);
+                               }
+                       }
+       [TODO]
+       public Size MinimumSize
+                       {
+                               get
+                               {
+                                       return minimumSize;
+                               }
+                               set
+                               {
+                                       // TODO: send the minimum size to the 
window manager.
+                                       if(value.Width < 0)
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("value.Width", 
S._("SWF_NonNegative"));
+                                       }
+                                       if(value.Height < 0)
+                                       {
+                                               throw new 
ArgumentOutOfRangeException
+                                                       ("value.Height", 
S._("SWF_NonNegative"));
+                                       }
+                                       minimumSize = value;
+                               }
+                       }
+       public MainMenu Menu
+                       {
+                               get
+                               {
+                                       return menu;
+                               }
+                               set
+                               {
+                                       menu = value;
+                               }
+                       }
+       public MainMenu MergedMenu
+                       {
+                               get
+                               {
+                                       return mergedMenu;
+                               }
+                       }
+       public bool Modal
+                       {
+                               get
+                               {
+                                       return 
GetWindowFlag(ToolkitWindowFlags.Modal);
+                               }
+                       }
+       public double Opacity
+                       {
+                               get
+                               {
+                                       return opacity;
+                               }
+                               set
+                               {
+                                       // We don't support transparent windows,
+                                       // so just save the value away for 
later.
+                                       opacity = value;
+                               }
+                       }
+       public Form[] OwnedForms
+                       {
+                               get
+                               {
+                                       return ownedForms;
+                               }
+                       }
+       public Form Owner
+                       {
+                               get
+                               {
+                                       return owner;
+                               }
+                               set
+                               {
+                                       owner = value;
+                               }
+                       }
+       public bool ShowInTaskBar
+                       {
+                               get
+                               {
+                                       return 
GetWindowFlag(ToolkitWindowFlags.ShowInTaskBar);
+                               }
+                               set
+                               {
+                                       
SetWindowFlag(ToolkitWindowFlags.ShowInTaskBar, value);
+                               }
+                       }
+       public new Size Size
+                       {
+                               get
+                               {
+                                       return base.Size;
+                               }
+                               set
+                               {
+                                       base.Size = value;
+                               }
+                       }
+       public SizeGripStyle SizeGripStyle
+                       {
+                               get
+                               {
+                                       return sizeGripStyle;
+                               }
+                               set
+                               {
+                                       sizeGripStyle = value;
+                               }
+                       }
+       public FormStartPosition FormStartPosition
+                       {
+                               get
+                               {
+                                       return formStartPosition;
+                               }
+                               set
+                               {
+                                       formStartPosition = value;
+                               }
+                       }
+       public bool TopLevel
+                       {
+                               get
+                               {
+                                       return topLevel;
+                               }
+                               set
+                               {
+                                       topLevel = value;
+                               }
+                       }
+       public bool TopMost
+                       {
+                               get
+                               {
+                                       return 
GetWindowFlag(ToolkitWindowFlags.TopMost);
+                               }
+                               set
+                               {
+                                       
SetWindowFlag(ToolkitWindowFlags.TopMost, value);
+                               }
+                       }
+       public Color TransparencyKey
+                       {
+                               get
+                               {
+                                       return transparencyKey;
+                               }
+                               set
+                               {
+                                       transparencyKey = value;
+                               }
+                       }
+       [TODO]
+       public FormWindowState WindowState
+                       {
+                               get
+                               {
+                                       return windowState;
+                               }
+                               set
+                               {
+                                       // TODO: pass the state change to the 
window manager
+                                       windowState = value;
                                }
                        }
***************
*** 51,54 ****
--- 504,508 ----
                                                (cp.Width, cp.Height);
                                window.SetTitle(cp.Caption);
+                               SetWindowFlags(window);
                                return window;
                        }
***************
*** 60,63 ****
--- 514,590 ----
                                {
                                        return true;
+                               }
+                       }
+ 
+       // Get the current state of a window decoration flag.
+       private bool GetWindowFlag(ToolkitWindowFlags flag)
+                       {
+                               return ((windowFlags & flag) == flag);
+                       }
+ 
+       // Set the current state of the window decoration flags on a window.
+       private void SetWindowFlags(IToolkitWindow window)
+                       {
+                               ToolkitWindowFlags flags = windowFlags;
+                               switch(borderStyle)
+                               {
+                                       case FormBorderStyle.None:
+                                       {
+                                               flags &= 
~(ToolkitWindowFlags.Maximize |
+                                                                  
ToolkitWindowFlags.ResizeHandles |
+                                                                  
ToolkitWindowFlags.Resize |
+                                                                  
ToolkitWindowFlags.Border);
+                                       }
+                                       break;
+ 
+                                       case FormBorderStyle.Fixed3D:
+                                       case FormBorderStyle.FixedDialog:
+                                       case FormBorderStyle.FixedSingle:
+                                       {
+                                               flags &= 
~(ToolkitWindowFlags.Maximize |
+                                                                  
ToolkitWindowFlags.ResizeHandles |
+                                                                  
ToolkitWindowFlags.Resize);
+                                       }
+                                       break;
+ 
+                                       case FormBorderStyle.FixedToolWindow:
+                                       {
+                                               flags &= 
~(ToolkitWindowFlags.Maximize |
+                                                                  
ToolkitWindowFlags.ResizeHandles |
+                                                                  
ToolkitWindowFlags.Resize |
+                                                                  
ToolkitWindowFlags.ShowInTaskBar);
+                                               flags |= 
ToolkitWindowFlags.ToolWindow;
+                                       }
+                                       break;
+ 
+                                       case FormBorderStyle.Sizable: break;
+ 
+                                       case FormBorderStyle.SizableToolWindow:
+                                       {
+                                               flags &= 
~(ToolkitWindowFlags.ShowInTaskBar);
+                                               flags |= 
ToolkitWindowFlags.ToolWindow;
+                                       }
+                                       break;
+                               }
+                               window.SetWindowFlags(flags);
+                       }
+ 
+       // Set the current state of a window decoration flag.
+       private void SetWindowFlag(ToolkitWindowFlags flag, bool value)
+                       {
+                               // Alter the flag setting.
+                               if(value)
+                               {
+                                       windowFlags |= flag;
+                               }
+                               else
+                               {
+                                       windowFlags &= ~flag;
+                               }
+ 
+                               // Pass the flags to the window manager.
+                               if(toolkitWindow != null)
+                               {
+                                       SetWindowFlags(toolkitWindow);
                                }
                        }

Index: IContainerControl.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/IContainerControl.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** IContainerControl.cs        11 Jun 2003 07:07:19 -0000      1.1
--- IContainerControl.cs        12 Jun 2003 05:50:29 -0000      1.2
***************
*** 23,30 ****
  {
  
- [TODO]
  public interface IContainerControl
  {
!       // TODO
  }; // interface IContainerControl
  
--- 23,34 ----
  {
  
  public interface IContainerControl
  {
!       // Get or set the active control within the container.
!       Control ActiveControl { get; set; }
! 
!       // Activate a specific control.
!       bool ActivateControl(Control active);
! 
  }; // interface IContainerControl
  





reply via email to

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