本文整理汇总了C#中Gtk.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Equals方法的具体用法?C# Gtk.Equals怎么用?C# Gtk.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk
的用法示例。
在下文中一共展示了Gtk.Equals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildTreeChildren
static void BuildTreeChildren (Gtk.TreeStore store, Gtk.TreeIter parent, XContainer p)
{
foreach (XNode n in p.Nodes) {
Gtk.TreeIter childIter;
if (!parent.Equals (Gtk.TreeIter.Zero))
childIter = store.AppendValues (parent, n);
else
childIter = store.AppendValues (n);
XContainer c = n as XContainer;
if (c != null && c.FirstChild != null)
BuildTreeChildren (store, childIter, c);
}
}
示例2: AddToMenu
protected bool AddToMenu(Gtk.MenuItem parentMenu,
Gtk.MenuItem itemToBeAdded,
Gtk.MenuItem beforeThis)
{
Gtk.Menu menu = (Gtk.Menu) parentMenu.Submenu;
if (menu == null)
{
menu = new Menu ();
menu.Show ();
parentMenu.Submenu = menu;
}
if (beforeThis == null)
{
menu.Append (itemToBeAdded);
return true;
}
// find the index
int index = 0;
foreach (Gtk.MenuItem item in menu.
AllChildren)
{
if (beforeThis.Equals (item))
{
menu.Insert (itemToBeAdded,
index);
return true;
}
index++;
}
return false;
}
示例3: BuildTreeChildren
void BuildTreeChildren (Gtk.TreeStore store, Gtk.TreeIter parent, ParentNode p, IList<Block> blocks)
{
foreach (Node node in p) {
if (!(node is TagNode)) {
var startLoc = new TextLocation (node.Location.BeginLine, node.Location.BeginColumn);
var endLoc = new TextLocation (node.Location.EndLine, node.Location.EndColumn);
var doc = defaultDocument.Editor.Document;
var blocksBetween = blocks.Where (n => n.Start.AbsoluteIndex >= doc.GetOffset (startLoc)
&& n.Start.AbsoluteIndex <= doc.GetOffset (endLoc));
foreach (var block in blocksBetween) {
var outlineNode = new OutlineNode (block) {
Location = new DomRegion (doc.OffsetToLocation (block.Start.AbsoluteIndex),
doc.OffsetToLocation (block.Start.AbsoluteIndex + block.Length))
};
if (!parent.Equals (Gtk.TreeIter.Zero))
store.AppendValues (parent, outlineNode);
else
store.AppendValues (outlineNode);
}
continue;
}
Gtk.TreeIter childIter;
if (!parent.Equals (Gtk.TreeIter.Zero))
childIter = store.AppendValues (parent, new OutlineNode(node as TagNode));
else
childIter = store.AppendValues (new OutlineNode(node as TagNode));
ParentNode pChild = node as ParentNode;
if (pChild != null)
BuildTreeChildren (store, childIter, pChild, blocks);
}
}
示例4: 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;
}
}
示例5: BuildTreeChildren
void BuildTreeChildren (Gtk.TreeStore store, Gtk.TreeIter parent, XContainer p, IList<Block> blocks)
{
foreach (XNode node in p.Nodes) {
var el = node as XElement;
if (el == null) {
var startLoc = node.Region.Begin;
var endLoc = node.Region.End;
var doc = defaultDocument.Editor.Document;
var blocksBetween = blocks.Where (n => n.Start.AbsoluteIndex >= doc.GetOffset (startLoc)
&& n.Start.AbsoluteIndex <= doc.GetOffset (endLoc));
foreach (var block in blocksBetween) {
var outlineNode = new RazorOutlineNode (block) {
Location = new DomRegion (doc.OffsetToLocation (block.Start.AbsoluteIndex),
doc.OffsetToLocation (block.Start.AbsoluteIndex + block.Length))
};
if (!parent.Equals (Gtk.TreeIter.Zero))
store.AppendValues (parent, outlineNode);
else
store.AppendValues (outlineNode);
}
continue;
}
Gtk.TreeIter childIter;
if (!parent.Equals (Gtk.TreeIter.Zero))
childIter = store.AppendValues (parent, new RazorOutlineNode(el));
else
childIter = store.AppendValues (new RazorOutlineNode(el));
BuildTreeChildren (store, childIter, el, blocks);
}
}
示例6: OnAdded
protected override void OnAdded(Gtk.Widget widget)
{
if (widget.Equals(this.vboxWindow))
base.OnAdded (widget);
this.vboxClient.PackStart (widget, true, true, 0);
widget.Show();
}
示例7: LoadRepositories
public void LoadRepositories (Repository r, Gtk.TreeIter parent)
{
if (r.VersionControlSystem == null)
return;
TreeIter it;
if (!parent.Equals (TreeIter.Zero))
it = store.AppendValues (parent, r, r.Name, r.VersionControlSystem.Name, false, "vc-repository");
else
it = store.AppendValues (r, r.Name, r.VersionControlSystem.Name, false, "vc-repository");
try {
if (r.HasChildRepositories)
store.AppendValues (it, null, "", "", true, null);
}
catch (Exception ex) {
LoggingService.LogError (ex.ToString ());
}
}
示例8: IterNChildren
public int IterNChildren (Gtk.TreeIter iter)
{
if (iter.Equals (TreeIter.Zero))
return Nodes.Count;
else
return GetNode (iter).ChildCount;
}
示例9: AddNode
protected virtual void AddNode(string label, object customizer, Gtk.TreeIter iter, IDialogPanelDescriptor descriptor)
{
if (descriptor.DialogPanel != null) { // may be null, if it is only a "path"
descriptor.DialogPanel.CustomizationObject = customizer;
((Gtk.Frame)descriptor.DialogPanel.Control).Shadow = Gtk.ShadowType.None;
OptionPanels.Add (descriptor.DialogPanel);
mainBook.AppendPage (descriptor.DialogPanel.Control, new Gtk.Label ("a"));
}
Gtk.TreeIter i;
if (iter.Equals (Gtk.TreeIter.Zero)) {
i = treeStore.AppendValues (label, descriptor);
} else {
i = treeStore.AppendValues (iter, label, descriptor);
}
AddChildNodes (customizer, i, descriptor);
}
示例10: IsChildIter
bool IsChildIter(Gtk.TreeIter pit, Gtk.TreeIter cit, bool recursive)
{
while (store.IterParent (out cit, cit)) {
if (cit.Equals (pit)) return true;
if (!recursive) return false;
}
return false;
}
示例11: getPrevIterFromSelection
/**
* Gets both iters from the provided ListStore obj based on the passed TreePath object(the selected row)
*/
private bool getPrevIterFromSelection(out Gtk.TreeIter selectedIter, out Gtk.TreeIter prevIter,
Gtk.TreePath selectedRow, Gtk.ListStore listModel)
{
listModel.GetIter(out selectedIter, selectedRow);
selectedRow.Prev();
listModel.GetIter(out prevIter, selectedRow);
return (prevIter.Stamp!=0 && !prevIter.Equals(selectedIter));
}
示例12: getNextIterFromSelection
/**
* Gets both iters from the provided ListStore obj based on the passed TreePath object(the selected row)
*/
private bool getNextIterFromSelection(out Gtk.TreeIter selectedIter, out Gtk.TreeIter nextIter,
Gtk.TreePath selectedRow, Gtk.ListStore listModel)
{
listModel.GetIter(out selectedIter, selectedRow);
selectedRow.Next();
listModel.GetIter(out nextIter, selectedRow);
return (nextIter.Stamp!=0 && !nextIter.Equals(selectedIter));
}
示例13: GetSelectedFileDirectory
public void GetSelectedFileDirectory(out string filename, out int fileTyp, out Gtk.TreeIter ti)
{
GetSelectedFile(out filename, out fileTyp, out ti);
if(fileTyp == (int)TypeFile.Directory)
return;
ti = GetSelectedParentTreeIter(false);
//if (ti. != null) {
if(!ti.Equals(TreeIter.Zero)){
filename = store.GetValue(ti, PATH_ROW).ToString();
fileTyp = (Int32)store.GetValue(ti, TYPE_ROW);
} else {
filename = "";
fileTyp = -1;
}
}
示例14: GetSelectedFile
public void GetSelectedFile(out string filename, out int fileTyp, out Gtk.TreeIter ti)
{
ti = GetSelectedIter();
//if(ti.Equals(TreeIter.Zero)) return;
//if (ti == TreeIter.Zero)
//if (ti. != null) {
if(!ti.Equals(TreeIter.Zero)){
filename = store.GetValue(ti, PATH_ROW).ToString();
fileTyp = (Int32)store.GetValue(ti, TYPE_ROW);
} else {
filename = "";
fileTyp = -1;
}
}
示例15: FillDirRec
ChildInfo FillDirRec (Gtk.TreeIter iter, IWorkspaceFileObject item, HashSet<string> itemFiles, HashSet<string> knownPaths, FilePath dir, bool forceSet)
{
ChildInfo cinfo = ChildInfo.AllSelected;
bool hasChildren = false;
foreach (string sd in knownSubdirs) {
if (dir == item.BaseDirectory.Combine (sd)) {
forceSet = true;
break;
}
}
TreeIter dit;
if (!iter.Equals (TreeIter.Zero)) {
dit = store.AppendValues (iter, false, DesktopService.GetPixbufForFile (dir, IconSize.Menu), dir.FileName.ToString (), dir.ToString ());
fileList.ExpandRow (store.GetPath (iter), false);
}
else
dit = store.AppendValues (false, DesktopService.GetPixbufForFile (dir, IconSize.Menu), dir.FileName.ToString (), dir.ToString ());
paths [dir] = dit;
foreach (string file in Directory.GetFiles (dir)) {
string path = System.IO.Path.GetFileName (file);
Gdk.Pixbuf pix = DesktopService.GetPixbufForFile (file, IconSize.Menu);
bool active = itemFiles.Contains (file);
string color = null;
if (!active) {
pix = ImageService.MakeTransparent (pix, 0.5);
color = "dimgrey";
} else
cinfo |= ChildInfo.HasProjectFiles;
active = active || forceSet || knownPaths.Contains (file);
if (!active)
cinfo &= ~ChildInfo.AllSelected;
else
cinfo |= ChildInfo.SomeSelected;
paths [file] = store.AppendValues (dit, active, pix, path, file, color);
if (!hasChildren) {
hasChildren = true;
fileList.ExpandRow (store.GetPath (dit), false);
}
}
foreach (string cdir in Directory.GetDirectories (dir)) {
hasChildren = true;
ChildInfo ci = FillDirRec (dit, item, itemFiles, knownPaths, cdir, forceSet);
if ((ci & ChildInfo.AllSelected) == 0)
cinfo &= ~ChildInfo.AllSelected;
cinfo |= ci & (ChildInfo.SomeSelected | ChildInfo.HasProjectFiles);
}
if ((cinfo & ChildInfo.AllSelected) != 0 && hasChildren)
store.SetValue (dit, 0, true);
if ((cinfo & ChildInfo.HasProjectFiles) == 0) {
Gdk.Pixbuf pix = DesktopService.GetPixbufForFile (dir, IconSize.Menu);
pix = ImageService.MakeTransparent (pix, 0.5);
store.SetValue (dit, 1, pix);
store.SetValue (dit, 4, "dimgrey");
}
if ((cinfo & ChildInfo.SomeSelected) != 0 && (cinfo & ChildInfo.AllSelected) == 0) {
fileList.ExpandRow (store.GetPath (dit), false);
} else {
fileList.CollapseRow (store.GetPath (dit));
}
return cinfo;
}