[banshee: 17/61] [ListView] Expose Width and MaxWidth properties



commit f28e5523a6da9f31b94f2d92042f86e04166d73a
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Thu Oct 8 21:21:40 2009 -0700

    [ListView] Expose Width and MaxWidth properties

 .../Hyena.Data.Gui/ListView/ListView_Header.cs     |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
index 707a6e7..e47c37d 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
@@ -57,6 +57,7 @@ namespace Hyena.Data.Gui
 
         private bool resizable;
         private int header_width;
+        private double list_width, max_width;
         private int sort_column_index = -1;
         private int resizing_column_index = -1;
         private int pressed_column_index = -1;
@@ -72,6 +73,14 @@ namespace Hyena.Data.Gui
         
         private CachedColumn [] column_cache;
         private List<int> elastic_columns;
+
+        public int Width {
+            get { return (int)list_width; }
+        }
+
+        public int MaxWidth {
+            get { return (int)max_width + Theme.TotalBorderWidth*2; }
+        }
         
 #region Columns
         
@@ -203,6 +212,15 @@ namespace Hyena.Data.Gui
                     column_cache[i].Column.Width = column_cache[i].ElasticWidth / (double)header_width;
                 }
             }
+
+            double tmp_width = 0.0;
+            double tmp_max = 0.0;
+            foreach (var col in column_cache) {
+                tmp_width += col.ElasticWidth;
+                tmp_max += col.MaxWidth;
+            }
+            list_width = tmp_width;
+            max_width = tmp_max;
         }
         
         private double RecalculateColumnSizes (double total_width, double total_elastic_width)



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