[hyena] Hyena.Gui: Clean up references to StyleContext
- From: Bertrand Lorentz <blorentz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] Hyena.Gui: Clean up references to StyleContext
- Date: Thu, 12 Jun 2014 19:50:15 +0000 (UTC)
commit 0e07d9a93a2ca3c5415e32cf94b77b40d2d111ff
Author: Bertrand Lorentz <bertrand lorentz gmail com>
Date: Thu Jun 12 21:34:21 2014 +0200
Hyena.Gui: Clean up references to StyleContext
In ColumnCell subclasses, use the new CellContext.StyleContext property.
In the ListView widget itself, we don't need to go through the
CellContext, as the widget set in the CellContext is always the ListView
itself.
Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs | 10 ++++----
Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs | 2 +-
Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs | 2 +-
Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs | 2 +-
.../Hyena.Data.Gui/ListView/ListView_Rendering.cs | 22 ++++++++++----------
Hyena.Gui/Hyena.Gui.Canvas/TextBlock.cs | 10 ++++----
6 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs b/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs
index 89dbdd5..24acd4a 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ColumnCellCheckBox.cs
@@ -58,11 +58,11 @@ namespace Hyena.Data.Gui
if (context.State == StateFlags.Normal && last_hover_bound == BoundObjectParent) {
context.State = StateFlags.Prelight;
}
- context.Widget.StyleContext.Save ();
- context.Widget.StyleContext.AddClass ("check");
- context.Widget.StyleContext.State = (Value ? StateFlags.Active : StateFlags.Normal);
- context.Widget.StyleContext.RenderCheck (context.Context, x, y, Size, Size);
- context.Widget.StyleContext.Restore ();
+ context.StyleContext.Save ();
+ context.StyleContext.AddClass ("check");
+ context.StyleContext.State = context.State | (Value ? StateFlags.Active : StateFlags.Normal);
+ context.StyleContext.RenderCheck (context.Context, x, y, Size, Size);
+ context.StyleContext.Restore ();
}
private object last_pressed_bound;
diff --git a/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs b/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs
index 8738e97..f08771d 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ColumnCellRating.cs
@@ -63,7 +63,7 @@ namespace Hyena.Data.Gui
renderer.Value = Value;
bool is_hovering = hover_bound == BoundObjectParent && hover_bound != null;
- renderer.Render (context.Context, area, CairoExtensions.GdkRGBAToCairoColor
(context.Theme.Widget.StyleContext.GetColor (context.State)),
+ renderer.Render (context.Context, area, CairoExtensions.GdkRGBAToCairoColor
(context.StyleContext.GetColor (context.State)),
is_hovering, is_hovering, hover_value, 0.8, 0.45, 0.35);
// FIXME: Something is hosed in the view when computing cell dimensions
diff --git a/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs b/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
index fc18a9f..111e37a 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
@@ -107,7 +107,7 @@ namespace Hyena.Data.Gui
}
int y_pos = ((int)cellHeight - text_height) / 2;
- context.Widget.StyleContext.RenderLayout (context.Context, Padding.Left, y_pos, context.Layout);
+ context.StyleContext.RenderLayout (context.Context, Padding.Left, y_pos, context.Layout);
}
public void UpdateText (CellContext context, double cellWidth)
diff --git a/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs
b/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs
index b45c738..4cf95b5 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ColumnHeaderCellText.cs
@@ -58,7 +58,7 @@ namespace Hyena.Data.Gui
return;
}
- FontWeight = context.Widget.StyleContext.GetFont (context.State).Weight;
+ FontWeight = context.StyleContext.GetFont (context.State).Weight;
if (!has_sort) {
base.Render (context, cellWidth, cellHeight);
diff --git a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
index 1b73895..dff6ceb 100644
--- a/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
+++ b/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
@@ -212,20 +212,20 @@ namespace Hyena.Data.Gui
column_flags |= RegionFlags.Odd;
}
- cell_context.Widget.StyleContext.Save ();
+ StyleContext.Save ();
// RegionFlags.Last is not applied, see https://bugzilla.gnome.org/show_bug.cgi?id=731463
- cell_context.Widget.StyleContext.AddRegion ("column-header", column_flags);
- cell_context.Widget.StyleContext.AddClass ("button");
- cell_context.Widget.StyleContext.RenderBackground (cr, area.X, area.Y, area.Width, area.Height);
- cell_context.Widget.StyleContext.RenderFrame (cr, area.X, area.Y, area.Width, area.Height);
+ StyleContext.AddRegion ("column-header", column_flags);
+ StyleContext.AddClass ("button");
+ StyleContext.RenderBackground (cr, area.X, area.Y, area.Width, area.Height);
+ StyleContext.RenderFrame (cr, area.X, area.Y, area.Width, area.Height);
if (ci == ActiveColumn && HasFocus && HeaderFocused) {
- var border = cell_context.Widget.StyleContext.GetBorder (StyleContext.State);
+ var border = StyleContext.GetBorder (StyleContext.State);
var f_x = area.X + border.Left;
var f_y = area.Y + border.Top;
var f_width = area.Width - border.Left - border.Right;
var f_height = area.Height - border.Top - border.Bottom;
- cell_context.Widget.StyleContext.RenderFocus (cr, f_x, f_y, f_width, f_height);
+ StyleContext.RenderFocus (cr, f_x, f_y, f_width, f_height);
}
if (dragging) {
@@ -234,10 +234,10 @@ namespace Hyena.Data.Gui
Theme.DrawColumnHighlight (cr, area, dark_color);
- cell_context.Widget.StyleContext.Save ();
- cell_context.Widget.StyleContext.AddClass ("entry");
+ StyleContext.Save ();
+ StyleContext.AddClass ("entry");
Cairo.Color base_color = CairoExtensions.GdkRGBAToCairoColor
(StyleContext.GetBackgroundColor (StateFlags.Normal));
- cell_context.Widget.StyleContext.Restore ();
+ StyleContext.Restore ();
Cairo.Color stroke_color = CairoExtensions.ColorShade (base_color, 0.0);
stroke_color.A = 0.3;
@@ -261,7 +261,7 @@ namespace Hyena.Data.Gui
cr.Restore ();
}
- cell_context.Widget.StyleContext.Restore ();
+ StyleContext.Restore ();
}
#endregion
diff --git a/Hyena.Gui/Hyena.Gui.Canvas/TextBlock.cs b/Hyena.Gui/Hyena.Gui.Canvas/TextBlock.cs
index e0f8cf6..c3d5f39 100644
--- a/Hyena.Gui/Hyena.Gui.Canvas/TextBlock.cs
+++ b/Hyena.Gui/Hyena.Gui.Canvas/TextBlock.cs
@@ -178,13 +178,13 @@ namespace Hyena.Gui.Canvas
}
var cr = context.Context;
- context.Theme.Widget.StyleContext.Save ();
+ context.StyleContext.Save ();
if (context.TextAsForeground) {
- context.Theme.Widget.StyleContext.AddClass ("button");
+ context.StyleContext.AddClass ("button");
} else {
- context.Theme.Widget.StyleContext.AddClass ("entry");
+ context.StyleContext.AddClass ("entry");
}
- Foreground = new Brush (context.Theme.Widget.StyleContext.GetColor (context.State));
+ Foreground = new Brush (context.StyleContext.GetColor (context.State));
Brush foreground = Foreground;
if (!foreground.IsValid) {
@@ -224,7 +224,7 @@ namespace Hyena.Gui.Canvas
}
cr.ResetClip ();
- context.Theme.Widget.StyleContext.Restore ();
+ context.StyleContext.Restore ();
}
private Pango.Weight GetPangoFontWeight (FontWeight weight)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]