public void Read(Wrapper.Widget baseWidget, XmlElement elem) { name = elem.GetAttribute("name"); if (elem.HasAttribute("type")) { type = (Gtk.UIManagerItemType)Enum.Parse(typeof(Gtk.UIManagerItemType), elem.GetAttribute("type")); } // The name of an action may be empty in some situations (e.g. when adding a new action but before entering the name) XmlAttribute actionAt = elem.Attributes ["action"]; if (actionAt != null) { string aname = actionAt.Value; foreach (ActionGroup grp in baseWidget.LocalActionGroups) { action = grp.GetAction(aname); if (action != null) { break; } } if (action == null) { foreach (ActionGroup group in baseWidget.Project.ActionGroups) { action = group.GetAction(aname); if (action != null) { break; } } } if (action != null) { lastActionName = action.Name; action.Deleted += OnActionDeleted; action.ObjectChanged += OnActionChanged; } } try { loading = true; foreach (XmlElement child in elem.SelectNodes("node")) { ActionTreeNode node = new ActionTreeNode(); node.Read(baseWidget, child); Children.Add(node); } } finally { loading = false; } }
public void AddUi(uint merge_id, string path, string name, string action, Gtk.UIManagerItemType type, bool top) { IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup(path); IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name); IntPtr native_action = GLib.Marshaller.StringToPtrGStrdup(action); gtk_ui_manager_add_ui(Handle, merge_id, native_path, native_name, native_action, (int)type, top); GLib.Marshaller.Free(native_path); GLib.Marshaller.Free(native_name); GLib.Marshaller.Free(native_action); }
public ActionTreeNode(Gtk.UIManagerItemType type, string name, Action action) { this.type = type; this.name = name; this.action = action; if (this.action != null) { lastActionName = this.action.Name; this.action.Deleted += OnActionDeleted; this.action.ObjectChanged += OnActionChanged; } }
public Widget[] GetToplevels(Gtk.UIManagerItemType types) { IntPtr raw_ret = gtk_ui_manager_get_toplevels(Handle, (int)types); GLib.SList list = new GLib.SList(raw_ret); Widget[] result = new Widget [list.Count]; for (int i = 0; i < list.Count; i++) { result [i] = list [i] as Widget; } return(result); }
public ActionPaletteItem(Gtk.UIManagerItemType type, string name, Action action) : this(new ActionTreeNode(type, name, action)) { disposeNode = true; }
public void Read(Wrapper.Widget baseWidget, XmlElement elem) { name = elem.GetAttribute ("name"); if (elem.HasAttribute ("type")) type = (Gtk.UIManagerItemType) Enum.Parse (typeof(Gtk.UIManagerItemType), elem.GetAttribute ("type")); // The name of an action may be empty in some situations (e.g. when adding a new action but before entering the name) XmlAttribute actionAt = elem.Attributes ["action"]; if (actionAt != null) { string aname = actionAt.Value; foreach (ActionGroup grp in baseWidget.LocalActionGroups) { action = grp.GetAction (aname); if (action != null) break; } if (action == null) { foreach (ActionGroup group in baseWidget.Project.ActionGroups) { action = group.GetAction (aname); if (action != null) break; } } if (action != null) { lastActionName = action.Name; action.Deleted += OnActionDeleted; action.ObjectChanged += OnActionChanged; } } try { loading = true; foreach (XmlElement child in elem.SelectNodes ("node")) { ActionTreeNode node = new ActionTreeNode (); node.Read (baseWidget, child); Children.Add (node); } } finally { loading = false; } }