4
namespace Stetic.Wrapper {
6
public class ImageMenuItem : MenuItem {
8
public static new Gtk.ImageMenuItem CreateInstance ()
10
// Use the ctor that will create an AccelLabel
11
return new Gtk.ImageMenuItem ("");
14
protected override void ReadProperties (ObjectReader reader, XmlElement elem)
16
Gtk.StockItem stockItem = Gtk.StockItem.Zero;
17
bool use_stock = (bool)GladeUtils.ExtractProperty (elem, "use_stock", false);
19
string label = (string)GladeUtils.GetProperty (elem, "label", "");
20
stockItem = Gtk.Stock.Lookup (label);
21
if (stockItem.Label != null)
22
GladeUtils.ExtractProperty (elem, "label", "");
24
base.ReadProperties (reader, elem);
26
if (stockItem.StockId != null)
27
Image = "stock:" + stockItem.StockId;
28
if (stockItem.Keyval != 0)
29
Accelerator = Gtk.Accelerator.Name (stockItem.Keyval, stockItem.Modifier);
42
Gtk.StockItem stockItem = Gtk.StockItem.Zero;
44
if (image.StartsWith ("stock:"))
45
stockItem = Gtk.Stock.Lookup (image.Substring (6));
47
if (stockItem.StockId != null) {
48
icon = new Gtk.Image (stockItem.StockId, Gtk.IconSize.Menu);
49
Label = stockItem.Label;
51
} else if (image.StartsWith ("file:"))
52
icon = new Gtk.Image (image.Substring (5));
54
icon = new Gtk.Image (WidgetUtils.MissingIcon);
56
((Gtk.ImageMenuItem)Wrapped).Image = icon;