banshee r3914 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Sources.Gui



Author: abock
Date: Fri May  9 22:28:56 2008
New Revision: 3914
URL: http://svn.gnome.org/viewvc/banshee?rev=3914&view=rev

Log:
2008-05-09  Aaron Bockover  <abock gnome org>

    * src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs:
    Set ParentWidget on the renderer to self

    * src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs:
    Fixed small selection rendering regression and fix the state calculation
    for when the widget is a combo box and is prelit but not showing the menu



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceComboBox.cs	Fri May  9 22:28:56 2008
@@ -41,6 +41,7 @@
         public SourceComboBox ()
         {
             SourceRowRenderer renderer = new SourceRowRenderer ();
+            renderer.ParentWidget = this;
             PackStart (renderer, true);
             SetCellDataFunc (renderer, new CellLayoutDataFunc (SourceCellDataFunc));
             

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/SourceRowRenderer.cs	Fri May  9 22:28:56 2008
@@ -67,9 +67,11 @@
         }
         
         private SourceView view;
-        public SourceView View {
-            get { return view; }
-            set { view = value; }
+        
+        private Widget parent_widget;
+        public Widget ParentWidget {
+            get { return parent_widget; }
+            set { parent_widget = value; }
         }
         
         private TreePath path;
@@ -95,7 +97,8 @@
             } else if ((flags & CellRendererState.Selected) == CellRendererState.Selected) {
                 return widget.HasFocus ? StateType.Selected : StateType.Active;
             } else if ((flags & CellRendererState.Prelit) == CellRendererState.Prelit) {
-                return StateType.Prelight;
+                ComboBox box = parent_widget as ComboBox;
+                return box == null || box.PopupShown ? StateType.Prelight : StateType.Normal;
             } else if (widget.State == StateType.Insensitive) {
                 return StateType.Insensitive;
             } else {
@@ -129,10 +132,11 @@
                 return;
             }
             
+            view = widget as SourceView;
             bool path_selected = view != null && view.Selection.PathIsSelected (path);            
             StateType state = RendererStateToWidgetState (widget, flags);
             
-            RenderSelection (widget, drawable, background_area, path_selected, state);
+            RenderSelection (drawable, background_area, path_selected, state);
             
             int title_layout_width = 0, title_layout_height = 0;
             int count_layout_width = 0, count_layout_height = 0;
@@ -188,7 +192,7 @@
             }
                 
             Gdk.GC mod_gc = widget.Style.TextGC (state);
-            if (!state.Equals (StateType.Selected)) {
+            if (state == StateType.Normal || (view != null && state == StateType.Prelight)) {
                 Gdk.Color fgcolor = widget.Style.Base (state);
                 Gdk.Color bgcolor = widget.Style.Text (state);
                 
@@ -204,7 +208,7 @@
                 count_layout);
         }
         
-        private void RenderSelection (Gtk.Widget widget, Gdk.Drawable drawable, Gdk.Rectangle background_area, 
+        private void RenderSelection (Gdk.Drawable drawable, Gdk.Rectangle background_area, 
             bool path_selected, StateType state)
         {
             if (view == null) {
@@ -217,7 +221,7 @@
                 rect.Width += 4;
                 
                 // clear the standard GTK selection and focus
-                drawable.DrawRectangle (widget.Style.BaseGC (StateType.Normal), true, rect);
+                drawable.DrawRectangle (view.Style.BaseGC (StateType.Normal), true, rect);
                 
                 // draw the hot cairo selection
                 if (!view.EditingRow) { 
@@ -245,7 +249,7 @@
             return area.Y + (int)Math.Round ((double)(area.Height - height) / 2.0) + 1;
         }
         
-        public override CellEditable StartEditing (Gdk.Event evnt , Widget widget, string path, 
+        public override CellEditable StartEditing (Gdk.Event evnt, Widget widget, string path, 
             Gdk.Rectangle background_area, Gdk.Rectangle cell_area, CellRendererState flags)
         {
             CellEditEntry text = new CellEditEntry ();



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