[hyena] ListView: Fix column headers appearance during drag-and-drop
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] ListView: Fix column headers appearance during drag-and-drop
- Date: Sat, 14 Jun 2014 18:48:48 +0000 (UTC)
commit 444df74beedb2b840d85d62c38c0bf09fa06ff7b
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Sat Jun 14 20:42:12 2014 +0200
ListView: Fix column headers appearance during drag-and-drop
Just add the "dnd" class on the column header, and remove all the custom
drawing we were doing in that situation.
Sadly, this class is not applied with the Adwaita theme (see
bgo#731663), so we don't get the background gradient that's supposed
to be there. But I think it looks good enough, and better than what we
had before.
.../Hyena.Data.Gui/ListView/ListView_Rendering.cs | 26 +++----------------
Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs | 15 -----------
Hyena.Gui/Hyena.Gui.Theming/Theme.cs | 16 ------------
3 files changed, 4 insertions(+), 53 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
index d6e67bd..c616bf1 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
@@ -215,6 +215,10 @@ namespace Hyena.Data.Gui
// RegionFlags.Last is not applied, see https://bugzilla.gnome.org/show_bug.cgi?id=731463
StyleContext.AddRegion ("column-header", column_flags);
StyleContext.AddClass ("button");
+ if (dragging) {
+ // This is not applied in Adwaita, see https://bugzilla.gnome.org/show_bug.cgi?id=731663
+ StyleContext.AddClass ("dnd");
+ }
StyleContext.RenderBackground (cr, area.X, area.Y, area.Width, area.Height);
StyleContext.RenderFrame (cr, area.X, area.Y, area.Width, area.Height);
@@ -227,28 +231,6 @@ namespace Hyena.Data.Gui
StyleContext.RenderFocus (cr, f_x, f_y, f_width, f_height);
}
- if (dragging) {
- Cairo.Color dark_color = CairoExtensions.GdkRGBAToCairoColor
(StyleContext.GetBackgroundColor (StateFlags.Normal));
- dark_color = CairoExtensions.ColorShade (dark_color, 0.7);
-
- Theme.DrawColumnHighlight (cr, area, dark_color);
-
- StyleContext.Save ();
- StyleContext.AddClass ("entry");
- Cairo.Color base_color = CairoExtensions.GdkRGBAToCairoColor
(StyleContext.GetBackgroundColor (StateFlags.Normal));
- StyleContext.Restore ();
-
- Cairo.Color stroke_color = CairoExtensions.ColorShade (base_color, 0.0);
- stroke_color.A = 0.3;
-
- cr.SetSourceColor (stroke_color);
- cr.MoveTo (area.X + 0.5, area.Y + 1.0);
- cr.LineTo (area.X + 0.5, area.Bottom);
- cr.MoveTo (area.Right - 0.5, area.Y + 1.0);
- cr.LineTo (area.Right - 0.5, area.Bottom);
- cr.Stroke ();
- }
-
ColumnCell cell = column_cache[ci].Column.HeaderCell;
if (cell != null) {
diff --git a/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs b/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
index d27f779..9e3f252 100644
--- a/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
+++ b/Hyena.Gui/Hyena.Gui.Theming/GtkTheme.cs
@@ -169,21 +169,6 @@ namespace Hyena.Gui.Theming
cr.Stroke ();
}
- public override void DrawColumnHighlight (Cairo.Context cr, Gdk.Rectangle alloc, Cairo.Color color)
- {
- Cairo.Color light_color = CairoExtensions.ColorShade (color, 1.6);
- Cairo.Color dark_color = CairoExtensions.ColorShade (color, 1.3);
-
- using (var grad = new LinearGradient (alloc.X, alloc.Y, alloc.X, alloc.Bottom - 1)) {
- grad.AddColorStop (0, light_color);
- grad.AddColorStop (1, dark_color);
-
- cr.SetSource (grad);
- cr.Rectangle (alloc.X + 1.5, alloc.Y + 1.5, alloc.Width - 3, alloc.Height - 2);
- cr.Fill ();
- }
- }
-
public override void DrawRowCursor (Cairo.Context cr, int x, int y, int width, int height,
Cairo.Color color, CairoCorners corners)
{
diff --git a/Hyena.Gui/Hyena.Gui.Theming/Theme.cs b/Hyena.Gui/Hyena.Gui.Theming/Theme.cs
index f9c007d..b7458dc 100644
--- a/Hyena.Gui/Hyena.Gui.Theming/Theme.cs
+++ b/Hyena.Gui/Hyena.Gui.Theming/Theme.cs
@@ -134,22 +134,6 @@ namespace Hyena.Gui.Theming
public abstract void DrawFrameBorder (Cairo.Context cr, Gdk.Rectangle alloc);
- public void DrawColumnHighlight (Cairo.Context cr, double cellWidth, double cellHeight)
- {
- Gdk.Rectangle alloc = new Gdk.Rectangle ();
- alloc.Width = (int)cellWidth;
- alloc.Height = (int)cellHeight;
- DrawColumnHighlight (cr, alloc);
- }
-
- public void DrawColumnHighlight (Cairo.Context cr, Gdk.Rectangle alloc)
- {
- Cairo.Color color = CairoExtensions.GdkRGBAToCairoColor (Widget.StyleContext.GetBackgroundColor
(StateFlags.Selected));
- DrawColumnHighlight (cr, alloc, color);
- }
-
- public abstract void DrawColumnHighlight (Cairo.Context cr, Gdk.Rectangle alloc, Cairo.Color color);
-
public void DrawRowCursor (Cairo.Context cr, int x, int y, int width, int height)
{
Cairo.Color color = CairoExtensions.GdkRGBAToCairoColor (Widget.StyleContext.GetBackgroundColor
(StateFlags.Selected));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]