本文整理汇总了C#中Gtk.GetPath方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.GetPath方法的具体用法?C# Gtk.GetPath怎么用?C# Gtk.GetPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk.GetPath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadCertificateTree
public static void LoadCertificateTree(Gtk.TreeStore certStore)
{
foreach (EveCertGroup group in m_CertGroups.Values)
{
Gtk.TreeIter groupIter = certStore.AppendValues(group.Name, -1, group.ID, true);
group.TreeReference = new Gtk.TreeRowReference(certStore, certStore.GetPath(groupIter));
}
foreach (EveCertificate cert in m_Certificates.Values)
{
EveCertGroup group = m_CertGroups[cert.GroupID];
Gtk.TreeIter groupIter;
Gtk.TreeIter certIter;
if (certStore.GetIter(out groupIter, group.TreeReference.Path))
{
certIter = certStore.AppendValues(groupIter, cert.Name, cert.Grade, cert.ID, false);
cert.TreeReference = new Gtk.TreeRowReference(certStore, certStore.GetPath(certIter));
}
}
}
示例2: RenderTreeCell
protected virtual void RenderTreeCell( Gtk.TreeViewColumn _column, Gtk.CellRenderer _cell, Gtk.TreeModel _model, Gtk.TreeIter _iter)
{
object o = _model.GetValue(_iter, 0);
GuiComponents.TvEpisodeNodeItem node = o as GuiComponents.TvEpisodeNodeItem;
Gdk.Color background = new Gdk.Color(255, 255, 255);
if(node != null && (_model.GetPath(_iter).Indices[1] % 2) == 0)
background = new Gdk.Color(240, 240, 255);
if(_cell is Gtk.CellRendererText)
{
if(node != null)
{
switch(_column.SortColumnId)
{
case 1: (_cell as Gtk.CellRendererText).Text = node.EpisodeNames; break;
case 3: (_cell as Gtk.CellRendererText).Text = node.Filename; break;
}
}
else if(o is KeyNode && _column.SortColumnId == 0)
{
(_cell as Gtk.CellRendererText).Markup = ((KeyNode)o).Markup;
}
else
(_cell as Gtk.CellRendererText).Text = "";
(_cell as Gtk.CellRendererText).BackgroundGdk = background;
}
else if(_cell is TreeItemCellRenderer)
{
TreeItemCellRenderer render = (TreeItemCellRenderer)_cell;
render.CellBackgroundGdk = background;
render.Pixbuf = null;
if(node != null)
{
render.Text = node.EpisodeNumbersString;
render.Pixbuf = node.StatusIcon;
}
else
render.Text = ((KeyNode)o).Key;
}
else
{
if(node != null)
{
switch(_column.SortColumnId)
{
case 2: (_cell as Gtk.CellRendererPixbuf).Pixbuf = node.RatingIcon; break;
}
}
else
{
(_cell as Gtk.CellRendererPixbuf).Pixbuf = Images.Empty;
}
(_cell as Gtk.CellRendererPixbuf).CellBackgroundGdk = background;
}
}
示例3: SetDiffCellData
static void SetDiffCellData (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
CellRendererDiff rc = (CellRendererDiff)cell;
string[] lines = (string[])model.GetValue (iter, colDiff);
if (lines == null)
lines = new string[] { (string)model.GetValue (iter, colOperation) };
rc.InitCell (tree_column.TreeView, ((TreeStore)model).IterDepth (iter) != 0, lines, model.GetPath (iter));
}
示例4: AuthorIconFunc
static void AuthorIconFunc (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
CellRendererImage renderer = (CellRendererImage)cell;
var rev = (Revision)model.GetValue (iter, 0);
if (string.IsNullOrEmpty (rev.Email))
return;
ImageLoader img = ImageService.GetUserIcon (rev.Email, 16);
renderer.Image = img.Image;
if (img.Downloading) {
img.Completed += (sender, e) => {
renderer.Image = img.Image;
if (((ListStore)model).IterIsValid (iter))
model.EmitRowChanged (model.GetPath (iter), iter);
};
}
}
示例5: FilterTree
private bool FilterTree(Gtk.TreeModel model, Gtk.TreeIter iter)
{
lock (inventory)
{
try
{
if (this.entry_search.Text == "")
return true;
if (filtered.Contains(iter))//*sigh*
return true;
object obj = model.GetValue(iter, 1);
if (obj == null)
return false;
string Name = (string)obj;
if (Name.Contains(this.entry_search.Text))
{
filtered.Add(iter);//*sigh*
TreePath path = model.GetPath(iter);
while (path.Depth > 1)
{
path.Up();
TreeIter iter2;
model.GetIter(out iter2, path);
filtered.Add(iter2);//*sigh*
}
return true;
}
return false;
}
catch
{
return false;
}
}
}
示例6: AuthorIconFunc
void AuthorIconFunc (Gtk.TreeViewColumn tree_column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
CellRendererPixbuf renderer = (CellRendererPixbuf)cell;
var rev = (Revision)model.GetValue (iter, 0);
if (string.IsNullOrEmpty (rev.Email))
return;
ImageLoader img = ImageService.GetUserIcon (rev.Email, 16);
if (img.LoadOperation.IsCompleted)
renderer.Pixbuf = img.Pixbuf;
else {
renderer.Pixbuf = null;
img.LoadOperation.Completed += delegate {
Gtk.Application.Invoke (delegate {
if (logstore.IterIsValid (iter))
model.EmitRowChanged (model.GetPath (iter), iter);
});
};
}
}
示例7: UpdateMaps
private void UpdateMaps(Gtk.TreeModel model, Gtk.TreeIter itr)
{
model.EmitRowChanged (model.GetPath (itr), itr);
}
示例8: RenderListItem
internal virtual void RenderListItem(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
CellRendererCustom mycell = (CellRendererCustom) cell;
mycell.ItemIndex = int.Parse( model.GetPath(iter).ToString() );
mycell.Iter = iter;
mycell.Text = this.Items[ mycell.ItemIndex ].ToString();
}
示例9: OnChkDataFunc
//checkbox cell function
private void OnChkDataFunc(
Gtk.TreeViewColumn col, Gtk.CellRenderer cell,
Gtk.TreeModel model, Gtk.TreeIter iter
)
{
CellRendererToggle c = cell as CellRendererToggle;
String path = model.GetPath(iter).ToString();
int item_index = int.Parse( path );
c.Active = ( checked_items.IndexOf( item_index ) != -1 );
}
示例10: TreeviewScrollToLastRow
public static void TreeviewScrollToLastRow(Gtk.TreeView tv, Gtk.ListStore store, int nrows)
{
TreeIter iter = new TreeIter();
bool iterOk = store.GetIterFirst(out iter);
if(! iterOk)
return;
for(int i=0; i < (nrows -1); i++)
iterOk = tv.Model.IterNext (ref iter);
if(! iterOk)
return;
TreePath path = store.GetPath (iter);
LogB.Debug(path.ToString());
tv.ScrollToCell (path, tv.Columns[0], true, 0, 0);
}
示例11: TreeviewSelectRowWithID
//selects a row that has an uniqueID (usually at col 0)
public static bool TreeviewSelectRowWithID(Gtk.TreeView tv, Gtk.TreeStore store, int colNum, int id, bool scrollToRow)
{
if(id <= 0)
return false;
int rowNum = getRowNumOfThisID(store, colNum, id);
if(rowNum == -1)
return false;
//set the selected
int count = 0;
TreeIter iter;
bool iterOk = store.GetIterFirst(out iter);
while(iterOk) {
if(count == rowNum) {
//1 select row
tv.Selection.SelectIter(iter);
//2 scroll to that row
if(scrollToRow) {
TreePath path = store.GetPath (iter);
LogB.Debug(path.ToString());
tv.ScrollToCell (path, tv.Columns[0], true, 0, 0);
}
return true;
}
count ++;
store.IterNext(ref iter);
}
return false;
}
示例12: IsRowSeparator
bool IsRowSeparator(Gtk.TreeModel model, Gtk.TreeIter iter)
{
Gtk.TreePath path = model.GetPath (iter);
bool res = false;
ApplicationContext.InvokeUserCode (delegate {
res = EventSink.RowIsSeparator (path.Indices[0]);
});
return res;
}
示例13: RenderListItem
private void RenderListItem(Gtk.TreeViewColumn column, Gtk.CellRenderer cell, Gtk.TreeModel model, Gtk.TreeIter iter)
{
CellRendererCustom mycell = (CellRendererCustom) cell;
mycell.ItemIndex = int.Parse( model.GetPath(iter).ToString() );
}
示例14: LoadMarket
public static void LoadMarket(Gtk.TreeStore marketStore, Gtk.ListStore itemStore)
{
LoadMarket();
foreach(EveMarketGroup group in m_MarketGroups.Values)
{
Gtk.TreeIter groupIter;
Gtk.TreeIter parentIter;
if (group.ParentID > -1 && marketStore.GetIter(out parentIter, m_MarketGroups[group.ParentID].TreeReference.Path))
{
groupIter = marketStore.AppendNode(parentIter);
}
else
{
groupIter = marketStore.AppendNode();
}
group.TreeReference = new Gtk.TreeRowReference(marketStore, marketStore.GetPath(groupIter));
marketStore.SetValues(groupIter, new Gdk.Pixbuf(ItemDatabase.GetMarketIconStream(group.IconString)), group.Name, group.ID, group.HasItems, true);
}
foreach (EveItem item in m_Items.Values)
{
if (item.MarketGroupID > -1)
{
Gtk.TreeIter parentIter;
if (marketStore.GetIter(out parentIter, m_MarketGroups[item.MarketGroupID].TreeReference.Path))
{
Gtk.TreeIter childIter = marketStore.AppendValues(parentIter, null, item.Name, item.ID, false, false);
itemStore.AppendValues(item.Name, item.ID);
item.TreeReference = new Gtk.TreeRowReference(marketStore, marketStore.GetPath(childIter));
}
}
}
}
示例15: AddToTree
void AddToTree (Gtk.TreeStore treeStore, Gtk.TreeIter iter, PDictionary dict)
{
iterTable[dict] = iter;
foreach (var item in dict) {
var key = item.Key.ToString ();
var subIter = iter.Equals (TreeIter.Zero) ? treeStore.AppendValues (key, item.Value) : treeStore.AppendValues (iter, key, item.Value);
if (item.Value is PArray)
AddToTree (treeStore, subIter, (PArray)item.Value);
if (item.Value is PDictionary)
AddToTree (treeStore, subIter, (PDictionary)item.Value);
if (expandedObjects.Contains (item.Value))
treeview.ExpandRow (treeStore.GetPath (subIter), true);
}
AddCreateNewEntry (iter);
if (!rebuildArrays.Contains (dict)) {
rebuildArrays.Add (dict);
dict.Changed += HandleDictRebuild;
}
}