void OutlineTreeIconFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { var pixRenderer = (CellRendererPixbuf)cell; object o = model.GetValue(iter, 0); string id = null; if (o is DNode) { var icon = DIcons.GetNodeIcon(o as DNode); if (!icon.IsNull) { id = icon.Name; } } else if (o is StatementContainingStatement) { id = "gtk-add"; } if (id != null) { using (var img = ImageService.GetIcon(id)) pixRenderer.Pixbuf = img.ToPixbuf(IconSize.Menu); } }
private void UpdatePath(object sender, Mono.TextEditor.DocumentLocationEventArgs e) { var SyntaxTree = Document.GetDAst(); if (SyntaxTree == null) { return; } // Resolve the hovered piece of code var loc = new CodeLocation(Document.Editor.Caret.Location.Column, Document.Editor.Caret.Location.Line); var currentblock = DResolver.SearchBlockAt(SyntaxTree, loc); //could be an enum value, which is not IBlockNode if (currentblock is DEnum) { foreach (INode nd in (currentblock as DEnum).Children) { if ((nd is DEnumValue) && ((nd.Location <= loc) && (nd.EndLocation >= loc))) { currentblock = nd as IBlockNode; break; } } } List <PathEntry> result = new List <PathEntry>(); INode node = currentblock; PathEntry entry; while ((node != null) && ((node is IBlockNode) || (node is DEnumValue))) { var icon = DIcons.GetNodeIcon(node as DNode); entry = new PathEntry(icon.IsNull?null: ImageService.GetIcon(icon.Name, IconSize.Menu), node.Name + DParameterDataProvider.GetNodeParamString(node)); entry.Position = EntryPosition.Left; entry.Tag = node; //do not include the module in the path bar if ((node.Parent != null) && !((node is DNode) && (node as DNode).IsAnonymous)) { result.Insert(0, entry); } node = node.Parent; } if (!((currentblock is DMethod) || (currentblock is DEnumValue))) { PathEntry noSelection = new PathEntry(GettextCatalog.GetString("No Selection")) { Tag = new NoSelectionCustomNode(currentblock) }; result.Add(noSelection); } entry = GetRegionEntry(Document.GetDDocument(), Document.Editor.Caret.Location); if (entry != null) { result.Add(entry); } var prev = CurrentPath; CurrentPath = result.ToArray(); OnPathChanged(new DocumentPathChangedEventArgs(prev)); }
public Xwt.Drawing.Image GetIcon(int n) { return(ImageService.GetIcon(DIcons.GetNodeIcon(Symbols[n] as DNode).Name, Gtk.IconSize.Menu)); }
Xwt.Drawing.Image DropDownBoxListWindow.IListDataProvider.GetIcon(int n) { var icon = DIcons.GetNodeIcon(memberList[n] as DNode); return(ImageService.GetIcon(icon.Name, IconSize.Menu)); }