2006-07-17 Mike Kestner <mkestner@novell.com>
authorMike Kestner <mkestner@gmail.com>
Tue, 18 Jul 2006 16:36:32 +0000 (16:36 -0000)
committerMike Kestner <mkestner@gmail.com>
Tue, 18 Jul 2006 16:36:32 +0000 (16:36 -0000)
* ListViewItem.cs: restructure Font and subitem Font handling
to hold a specific font and refer back to owner on null.
Fixes #78761.

svn path=/trunk/mcs/; revision=62709

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListViewItem.cs

index 908f1283ac9075a0e2d64b96cd51b1bec7b3f6fa..47d8bc4719fc681b9ad80064c6c36da9dc7e9f36 100644 (file)
@@ -1,3 +1,9 @@
+2006-07-17  Mike Kestner  <mkestner@novell.com>
+
+       * ListViewItem.cs: restructure Font and subitem Font handling 
+       to hold a specific font and refer back to owner on null.
+       Fixes #78761.
+
 2006-07-17  Mike Kestner  <mkestner@novell.com>
 
        * ToolBar.cs: bandaid for side-effect of previous patch which was
index b4916428e613e955a48a8505afa1f80af6beff73..2116fea4fe6d724b5e26dc2d3533432a0ec51f08 100644 (file)
@@ -57,6 +57,7 @@ namespace System.Windows.Forms
                Rectangle item_rect;
                Rectangle label_rect;
                ListView owner;
+               Font font;
                bool selected;
 
                internal int row;
@@ -108,7 +109,7 @@ namespace System.Windows.Forms
                        this.image_index = imageIndex;
                        ForeColor = foreColor;
                        BackColor = backColor;
-                       Font = font;
+                       this.font = font;
                }
                #endregion      // Public Constructors
 
@@ -183,19 +184,18 @@ namespace System.Windows.Forms
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public Font Font {
                        get {
-                               if (sub_items.Count > 0)
-                                       return sub_items[0].Font;
-
-                               if (owner != null)
+                               if (font != null)
+                                       return font;
+                               else if (owner != null)
                                        return owner.Font;
 
                                return ThemeEngine.Current.DefaultFont;
                        }
                        set {   
-                               if (sub_items[0].Font == value)
+                               if (font == value)
                                        return;
 
-                               sub_items[0].Font = value; 
+                               font = value; 
 
                                if (owner != null)
                                        Layout ();
@@ -629,8 +629,7 @@ namespace System.Windows.Forms
 
                        public ListViewSubItem (ListViewItem owner, string text)
                                : this (owner, text, ThemeEngine.Current.ColorWindowText,
-                                       ThemeEngine.Current.ColorWindow,
-                                       ThemeEngine.Current.DefaultFont)
+                                       ThemeEngine.Current.ColorWindow, null)
                        {
                        }
 
@@ -661,9 +660,11 @@ namespace System.Windows.Forms
                                                return font;
                                        else if (owner != null)
                                                return owner.Font;
-                                       return font;
+                                       return ThemeEngine.Current.DefaultFont;
                                }
                                set { 
+                                       if (font == value)
+                                               return;
                                        font = value; 
                                        Invalidate ();
                                    }