Author: dna
Date: 2006-12-17 14:47:34 -0500 (Sun, 17 Dec 2006)
New Revision: 69630

Added:
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DockingAttribute.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatButtonAppearance.cs
Modified:
   trunk/mcs/class/Managed.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
Log:
2006-12-17  Daniel Nauck  <[EMAIL PROTECTED]>

        * ButtonBase.cs: Added FlatButtonAppearance 2.0 support.
        * FlatButtonAppearance.cs: add
        * DockingAttribute.cs: add



Modified: trunk/mcs/class/Managed.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/ChangeLog     2006-12-17 19:45:29 UTC 
(rev 69629)
+++ trunk/mcs/class/Managed.Windows.Forms/ChangeLog     2006-12-17 19:47:34 UTC 
(rev 69630)
@@ -1,3 +1,8 @@
+2006-12-17  Daniel Nauck  <[EMAIL PROTECTED]>
+
+       * System.Windows.Forms.dll.sources: Add
+               DockingAttribute.cs, FlatButtonAppearance.cs
+
 2006-12-17  Chris Toshok  <[EMAIL PROTECTED]>
 
        * build-csproj2k5: a couple of changes.  use "exec >" instead of

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs    
2006-12-17 19:45:29 UTC (rev 69629)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ButtonBase.cs    
2006-12-17 19:47:34 UTC (rev 69630)
@@ -48,6 +48,7 @@
 #if NET_2_0
                private bool                    use_compatible_text_rendering;
                private bool                    use_visual_style_back_color;
+               private FlatButtonAppearance flat_button_appearance;
 #endif
                #endregion      // Local Variables
 
@@ -132,6 +133,9 @@
                protected ButtonBase() : base()
                {
                        flat_style      = FlatStyle.Standard;
+#if NET_2_0
+                       flat_button_appearance = new FlatButtonAppearance 
(this);
+#endif
                        image_index     = -1;
                        image           = null;
                        image_list      = null;
@@ -176,7 +180,15 @@
                                Invalidate();
                        }
                }
-               
+#if NET_2_0
+               [MonoTODO("FlatAppearance is currently ignored on drawing.")]
+               
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
+               [Browsable(true)]
+               public FlatButtonAppearance FlatAppearance
+               {
+                       get { return flat_button_appearance; }
+               }
+#endif         
                [Localizable(true)]
                [MWFDescription("Sets image to be displayed on button face"), 
MWFCategory("Appearance")]
                public Image Image {

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-12-17 19:45:29 UTC (rev 69629)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-12-17 19:47:34 UTC (rev 69630)
@@ -1,3 +1,9 @@
+2006-12-17  Daniel Nauck  <[EMAIL PROTECTED]>
+
+       * ButtonBase.cs: Added FlatButtonAppearance 2.0 support.
+       * FlatButtonAppearance.cs: add
+       * DockingAttribute.cs: add
+
 2006-12-17  Chris Toshok  <[EMAIL PROTECTED]>
 
        * DataGrid.cs: hook up MetaDataChanged event on the list manager,

Added: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DockingAttribute.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DockingAttribute.cs  
    2006-12-17 19:45:29 UTC (rev 69629)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DockingAttribute.cs  
    2006-12-17 19:47:34 UTC (rev 69630)
@@ -0,0 +1,76 @@
+//
+//  DockingAttribute.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Daniel Nauck
+//
+// Author:
+//      Daniel Nauck    (dna(at)mono-project(dot)de)
+
+#if NET_2_0
+
+using System;
+using System.Windows.Forms;
+
+namespace System.Windows.Forms
+{
+       [AttributeUsageAttribute(AttributeTargets.Class)] 
+       public sealed class DockingAttribute : Attribute
+       {
+               private DockingBehavior dockingBehavior;
+
+               public DockingAttribute()
+               {
+                       dockingBehavior = DockingBehavior.Never;
+               }
+
+               public DockingAttribute(DockingBehavior dockingBehavior)
+               {
+                       this.dockingBehavior = dockingBehavior;
+               }
+
+               public static readonly DockingAttribute Default = new 
DockingAttribute();
+
+               public DockingBehavior DockingBehavior
+               {
+                       get { return dockingBehavior; }
+               }
+
+               public override bool Equals(object obj)
+               {
+                       if (obj is DockingAttribute)
+                               return (dockingBehavior == 
((DockingAttribute)obj).DockingBehavior);
+                       else
+                               return false;
+               }
+
+               public override int GetHashCode()
+               {
+                       return dockingBehavior.GetHashCode();
+               }
+
+               public override bool IsDefaultAttribute()
+               {
+                       return Default.Equals(this);
+               }
+       }
+}
+#endif
\ No newline at end of file


Property changes on: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DockingAttribute.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Added: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatButtonAppearance.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatButtonAppearance.cs
  2006-12-17 19:45:29 UTC (rev 69629)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatButtonAppearance.cs
  2006-12-17 19:47:34 UTC (rev 69630)
@@ -0,0 +1,145 @@
+//
+//  FlatButtonAppearance.cs
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+// Copyright (c) 2006 Daniel Nauck
+//
+// Author:
+//      Daniel Nauck    (dna(at)mono-project(dot)de)
+
+#if NET_2_0
+
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace System.Windows.Forms
+{
+       public class FlatButtonAppearance
+       {
+               private Color borderColor = Color.Empty;
+               private int borderSize = 1;
+               private Color checkedBackColor = Color.Empty;
+               private Color mouseDownBackColor = Color.Empty;
+               private Color mouseOverBackColor = Color.Empty;
+               private ButtonBase owner = null;
+
+               internal FlatButtonAppearance (ButtonBase owner)
+               {
+                       this.owner = owner;
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Always)]
+               [DefaultValue(typeof(Color), "")]
+               [NotifyParentProperty(true)]
+               [Browsable(true)]
+               public Color BorderColor
+               {
+                       get { return borderColor; }
+                       set {
+                               if(borderColor == value)
+                                       return;
+
+                               borderColor = value;
+                               
+                               if(owner != null)
+                                       owner.Invalidate ();
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Always)]
+               [DefaultValue(1)]
+               [NotifyParentProperty(true)]
+               [Browsable(true)]
+               public int BorderSize
+               {
+                       get { return borderSize; }
+                       set {
+                               if(borderSize == value)
+                                       return;
+
+                               if (value < 0)
+                                       throw new ArgumentOutOfRangeException 
("value", string.Format ("'{0}' is not a valid value for 'BorderSize'. 
'BorderSize' must be greater or equal than {1}.", value, 0));
+
+                               borderSize = value;
+
+                               if(owner != null)
+                                       owner.Invalidate ();
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Always)]
+               [DefaultValue(typeof(Color), "")]
+               [NotifyParentProperty(true)]
+               [Browsable(true)]
+               public Color CheckedBackColor 
+               {
+                       get { return checkedBackColor; }
+                       set {
+                               if(checkedBackColor == value)
+                                       return;
+
+                               checkedBackColor = value;
+
+                               if(owner != null)
+                                       owner.Invalidate ();
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Always)]
+               [DefaultValue(typeof(Color), "")]
+               [Browsable(true)]
+               [NotifyParentProperty(true)]
+               public Color MouseDownBackColor
+               {
+                       get { return mouseDownBackColor; }
+                       set {
+                               if(mouseDownBackColor == value)
+                                       return;
+
+                               mouseDownBackColor = value;
+
+                               if(owner != null)
+                                       owner.Invalidate ();
+                       }
+               }
+
+               [EditorBrowsable(EditorBrowsableState.Always)]
+               [DefaultValue(typeof(Color), "")]
+               [NotifyParentProperty(true)]
+               [Browsable(true)]
+               public Color MouseOverBackColor
+               {
+                       get { return mouseOverBackColor; }
+                       set {
+                               if(mouseOverBackColor == value)
+                                       return;
+
+                               mouseOverBackColor = value;
+
+                               if(owner != null)
+                                       owner.Invalidate ();
+                       }
+               }
+       }
+}
+#endif
\ No newline at end of file


Property changes on: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/FlatButtonAppearance.cs
___________________________________________________________________
Name: svn:eol-style
   + native

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources      
2006-12-17 19:45:29 UTC (rev 69629)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources      
2006-12-17 19:47:34 UTC (rev 69630)
@@ -278,6 +278,7 @@
 System.Windows.Forms/DateTimePickerFormat.cs
 System.Windows.Forms/Day.cs
 System.Windows.Forms/DialogResult.cs
+System.Windows.Forms/DockingAttribute.cs
 System.Windows.Forms/DockStyle.cs
 System.Windows.Forms/DockingBehavior.cs
 System.Windows.Forms/DomainUpDown.cs
@@ -297,6 +298,7 @@
 System.Windows.Forms/FileDialog.cs
 System.Windows.Forms/FixedPanel.cs
 System.Windows.Forms/FixedSizeTextBox.cs
+System.Windows.Forms/FlatButtonAppearance.cs
 System.Windows.Forms/FlatStyle.cs
 System.Windows.Forms/FlowDirection.cs
 System.Windows.Forms/FlowLayoutPanel.cs

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs   
    2006-12-17 19:45:29 UTC (rev 69629)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ButtonTest.cs   
    2006-12-17 19:47:34 UTC (rev 69630)
@@ -22,8 +22,42 @@
                        Button B1 = new Button ();
                        Assert.AreEqual (FlatStyle.Standard, B1.FlatStyle, 
"#1");
                }
+#if NET_2_0
+               [Test]
+               public void FlatButtonAppearanceTest ()
+               {
+                       Button B1 = new Button ();
+                       FlatButtonAppearance flatApp = B1.FlatAppearance;
 
+                       Assert.AreEqual (Color.Empty, flatApp.BorderColor, 
"#A1");
+                       Assert.AreEqual (1, flatApp.BorderSize, "#A2");
+                       Assert.AreEqual (Color.Empty, flatApp.CheckedBackColor, 
"#A3");
+                       Assert.AreEqual (Color.Empty, 
flatApp.MouseDownBackColor, "#A4");
+                       Assert.AreEqual (Color.Empty, 
flatApp.MouseOverBackColor, "#A5");
+
+                       flatApp.BorderColor = Color.Blue;
+                       Assert.AreEqual (Color.Blue, flatApp.BorderColor, 
"#B1");
+                       flatApp.BorderSize = 10;
+                       Assert.AreEqual (10, flatApp.BorderSize, "#B2");
+                       flatApp.CheckedBackColor = Color.Blue;
+                       Assert.AreEqual (Color.Blue, flatApp.CheckedBackColor, 
"#B3");
+                       flatApp.MouseDownBackColor = Color.Blue;
+                       Assert.AreEqual (Color.Blue, 
flatApp.MouseDownBackColor, "#B4");
+                       flatApp.MouseOverBackColor = Color.Blue;
+                       Assert.AreEqual (Color.Blue, 
flatApp.MouseOverBackColor, "#B5");
+               }
+
                [Test]
+               [ExpectedException(typeof(ArgumentOutOfRangeException))]
+               public void FlatButtonAppearanceExceptionTest ()
+               {
+                       Button B1 = new Button ();
+                       FlatButtonAppearance flatApp = B1.FlatAppearance;
+
+                       flatApp.BorderSize = -1;
+               }
+#endif
+               [Test]
                public void ImageTest ()
                {
                        Button B1 = new Button ();

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-12-17 19:45:29 UTC (rev 69629)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-12-17 19:47:34 UTC (rev 69630)
@@ -1,3 +1,7 @@
+2006-12-17  Daniel Nauck  <[EMAIL PROTECTED]>
+
+       * ButtonTest.cs: Added tests for FlatButtonAppearance.
+
 2006-12-17  Gert Driesen  <[EMAIL PROTECTED]>
 
        * TreeViewTest.cs: Added tests for bug #80284.

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to