[banshee] Add UseMarkup property to ColumnCellText
- From: Gabriel Burt <gburt src gnome org>
- To: svn-commits-list gnome org
- Subject: [banshee] Add UseMarkup property to ColumnCellText
- Date: Wed, 1 Jul 2009 20:50:24 +0000 (UTC)
commit a25e2651726ee03443d6f4553c087f4d8e212d24
Author: Gabriel Burt <gabriel burt gmail com>
Date: Wed Jul 1 15:48:34 2009 -0500
Add UseMarkup property to ColumnCellText
.../Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs | 22 +++++++++++++++++--
1 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
index ab18de7..bc5b6d4 100644
--- a/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
+++ b/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ColumnCellText.cs
@@ -50,6 +50,7 @@ namespace Hyena.Data.Gui
private string text_format = null;
protected string MinString, MaxString;
private string last_text = null;
+ private bool use_markup;
public ColumnCellText (string property, bool expand) : base (property, expand)
{
@@ -100,11 +101,21 @@ namespace Hyena.Data.Gui
context.Layout.FontDescription.Weight = font_weight;
context.Layout.Ellipsize = EllipsizeMode;
context.Layout.Alignment = alignment;
- context.Layout.SetText (GetFormattedText (text));
+ UpdateLayout (context.Layout, text);
context.Layout.GetPixelSize (out text_width, out text_height);
is_ellipsized = context.Layout.IsEllipsized;
}
+ private void UpdateLayout (Pango.Layout layout, string text)
+ {
+ string final_text = GetFormattedText (text);
+ if (use_markup) {
+ layout.SetMarkup (final_text);
+ } else {
+ layout.SetText (final_text);
+ }
+ }
+
public string GetTooltipMarkup (CellContext cellContext, double columnWidth)
{
UpdateText (cellContext, columnWidth);
@@ -184,14 +195,14 @@ namespace Hyena.Data.Gui
min = max = -1;
if (!String.IsNullOrEmpty (MinString)) {
- layout.SetText (GetFormattedText (MinString));
+ UpdateLayout (layout, MinString);
layout.GetPixelSize (out min, out height);
min += 2*Spacing;
//Console.WriteLine ("for {0} got min {1} for {2}", this, min, MinString);
}
if (!String.IsNullOrEmpty (MaxString)) {
- layout.SetText (GetFormattedText (MaxString));
+ UpdateLayout (layout, MaxString);
layout.GetPixelSize (out max, out height);
max += 2*Spacing;
//Console.WriteLine ("for {0} got max {1} for {2}", this, max, MaxString);
@@ -203,6 +214,11 @@ namespace Hyena.Data.Gui
get { return restrict_size; }
set { restrict_size = value; }
}
+
+ public bool UseMarkup {
+ get { return use_markup; }
+ set { use_markup = value; }
+ }
#endregion
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]