[hyena] Make RatingEntry and RatingMenuItem extendable
- From: Mike Gemünde <mgemuende src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hyena] Make RatingEntry and RatingMenuItem extendable
- Date: Wed, 25 Aug 2010 08:54:55 +0000 (UTC)
commit 899dea664aaa4a042e1ba1dd49f16de9d625cf81
Author: Mike Gemünde <mike gemuende de>
Date: Mon Aug 23 20:10:50 2010 +0200
Make RatingEntry and RatingMenuItem extendable
https://bugzilla.gnome.org/show_bug.cgi?id=627833
Hyena.Gui/Hyena.Gui/RatingRenderer.cs | 2 +-
Hyena.Gui/Hyena.Widgets/RatingEntry.cs | 10 +++++++---
Hyena.Gui/Hyena.Widgets/RatingMenuItem.cs | 10 ++++++++--
3 files changed, 16 insertions(+), 6 deletions(-)
---
diff --git a/Hyena.Gui/Hyena.Gui/RatingRenderer.cs b/Hyena.Gui/Hyena.Gui/RatingRenderer.cs
index 8ee9ad6..50974ba 100644
--- a/Hyena.Gui/Hyena.Gui/RatingRenderer.cs
+++ b/Hyena.Gui/Hyena.Gui/RatingRenderer.cs
@@ -103,7 +103,7 @@ namespace Hyena.Gui
}
}
- private void ComputePosition (Gdk.Rectangle area, out double x, out double y)
+ protected void ComputePosition (Gdk.Rectangle area, out double x, out double y)
{
double cell_width = area.Width - 2 * Xpad;
double cell_height = area.Height - 2 * Ypad;
diff --git a/Hyena.Gui/Hyena.Widgets/RatingEntry.cs b/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
index f6678a8..0d251ba 100644
--- a/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
+++ b/Hyena.Gui/Hyena.Widgets/RatingEntry.cs
@@ -59,10 +59,14 @@ namespace Hyena.Widgets
WidgetFlags |= Gtk.WidgetFlags.NoWindow;
}
- public RatingEntry (int rating)
+ public RatingEntry (int rating) : this (rating, new RatingRenderer ())
{
- renderer = new RatingRenderer ();
- renderer.Value = rating;
+ }
+
+ protected RatingEntry (int rating, RatingRenderer renderer)
+ {
+ this.renderer = renderer;
+ this.renderer.Value = rating;
CanFocus = true;
Name = "GtkEntry";
}
diff --git a/Hyena.Gui/Hyena.Widgets/RatingMenuItem.cs b/Hyena.Gui/Hyena.Widgets/RatingMenuItem.cs
index 32ee848..8a0a73d 100644
--- a/Hyena.Gui/Hyena.Widgets/RatingMenuItem.cs
+++ b/Hyena.Gui/Hyena.Widgets/RatingMenuItem.cs
@@ -30,6 +30,8 @@ using System;
using Gtk;
using Mono.Unix;
+using Hyena.Gui;
+
namespace Hyena.Widgets
{
public class RatingMenuItem : ComplexMenuItem
@@ -38,7 +40,7 @@ namespace Hyena.Widgets
private bool can_activate = true;
private Box box;
- public RatingMenuItem () : base ()
+ protected RatingMenuItem (RatingEntry entry) : base ()
{
box = new HBox ();
box.Spacing = 5;
@@ -49,7 +51,7 @@ namespace Hyena.Widgets
box.PackStart (label, false, false, 0);
label.Show ();
- entry = new RatingEntry ();
+ this.entry = entry;
entry.HasFrame = false;
entry.PreviewOnHover = true;
entry.AlwaysShowEmptyStars = true;
@@ -60,6 +62,10 @@ namespace Hyena.Widgets
Add (box);
}
+ public RatingMenuItem () : this (new RatingEntry ())
+ {
+ }
+
protected RatingMenuItem (IntPtr raw) : base (raw)
{
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]