本文整理汇总了C#中Gtk.ListStore.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# ListStore.Remove方法的具体用法?C# ListStore.Remove怎么用?C# ListStore.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ListStore
的用法示例。
在下文中一共展示了ListStore.Remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveItem
void MoveItem (TreeView sourceList, ListStore sourceStore, TreeView targetList, ListStore targetStore)
{
TreeModel model;
TreeIter iter;
if (sourceList.Selection.GetSelected (out model, out iter)) {
TreeIter newiter = targetStore.AppendValues (sourceStore.GetValue (iter, 0), sourceStore.GetValue (iter, 1));
targetList.Selection.SelectIter (newiter);
TreeIter oldIter = iter;
if (sourceStore.IterNext (ref iter))
sourceList.Selection.SelectIter (iter);
sourceStore.Remove (ref oldIter);
}
}
示例2: GenerateNotebookPages
//.........这里部分代码省略.........
tvList.Selection.SelectIter(tiFirst);
selRow = ts.GetSelectedRows();
}
if(selRow.Length<1) return;
Gtk.TreePath tp = selRow[0];
TreeIter ti = new TreeIter();
ls.GetIter(out ti,tp);
CombinePublish combinePublish= (CombinePublish)ls.GetValue(ti,2);
if(combinePublish!=null){
Menu popupMenu = new Menu();
if(!showAll){
MenuItem miShowDenied = new MenuItem( MainClass.Languages.Translate("show_denied" ));
miShowDenied.Activated+= delegate(object sender, EventArgs e) {
// odoberem zakazane, ktore sa zobrazuju kedze su zaceknute na publish
List<TreeIter> lst= new List<TreeIter>();
ls.Foreach((model, path, iterr) => {
bool cp =(bool) ls.GetValue(iterr,4);
bool selected =(bool) ls.GetValue(iterr,0);
if(!cp && selected){
lst.Add(iterr);
}
return false;
});
foreach(TreeIter ti2 in lst){
TreeIter ti3 =ti2;
ls.Remove(ref ti3);
}
// pridam zakazane
if( (lcpDennied==null) || (lcpDennied.Count<1))
return;
foreach (CombinePublish cp in lcpDennied){
ls.AppendValues(cp.IsSelected,cp.ProjectName,cp,cp.ProjectName,false);
}
showAll = true;
};
popupMenu.Append(miShowDenied);
} else {
MenuItem miHideDenied = new MenuItem( MainClass.Languages.Translate("hide_denied" ));
miHideDenied.Activated+= delegate(object sender, EventArgs e) {
List<TreeIter> lst= new List<TreeIter>();
ls.Foreach((model, path, iterr) => {
bool cp =(bool) ls.GetValue(iterr,4);
bool selected =(bool) ls.GetValue(iterr,0);
if(!cp && !selected){
lst.Add(iterr);
}
return false;
});
foreach(TreeIter ti2 in lst){
TreeIter ti3 =ti2;
ls.Remove(ref ti3);
}
示例3: LaunchDialogue
public override void LaunchDialogue ()
{
//the Type in the collection
IList collection = (IList) Value;
string displayName = Property.DisplayName;
//populate list with existing items
ListStore itemStore = new ListStore (typeof (object), typeof (int), typeof (string));
for (int i=0; i<collection.Count; i++)
itemStore.AppendValues(collection [i], i, collection [i].ToString ());
#region Building Dialogue
TreeView itemTree;
PropertyGrid grid;
TreeIter previousIter = TreeIter.Zero;
//dialogue and buttons
Dialog dialog = new Dialog () {
Title = displayName + " Editor",
Modal = true,
AllowGrow = true,
AllowShrink = true,
};
var toplevel = this.Container.Toplevel as Window;
if (toplevel != null)
dialog.TransientFor = toplevel;
dialog.AddActionWidget (new Button (Stock.Cancel), ResponseType.Cancel);
dialog.AddActionWidget (new Button (Stock.Ok), ResponseType.Ok);
//three columns for items, sorting, PropGrid
HBox hBox = new HBox ();
dialog.VBox.PackStart (hBox, true, true, 5);
//propGrid at end
grid = new PropertyGrid (base.EditorManager) {
CurrentObject = null,
WidthRequest = 200,
ShowHelp = false
};
hBox.PackEnd (grid, true, true, 5);
//followed by a ButtonBox
VBox buttonBox = new VBox ();
buttonBox.Spacing = 6;
hBox.PackEnd (buttonBox, false, false, 5);
//add/remove buttons
Button addButton = new Button (new Image (Stock.Add, IconSize.Button));
buttonBox.PackStart (addButton, false, false, 0);
if (types [0].IsAbstract)
addButton.Sensitive = false;
Button removeButton = new Button (new Gtk.Image (Stock.Remove, IconSize.Button));
buttonBox.PackStart (removeButton, false, false, 0);
//sorting buttons
Button upButton = new Button (new Image (Stock.GoUp, IconSize.Button));
buttonBox.PackStart (upButton, false, false, 0);
Button downButton = new Button (new Image (Stock.GoDown, IconSize.Button));
buttonBox.PackStart (downButton, false, false, 0);
//Third column has list (TreeView) in a ScrolledWindow
ScrolledWindow listScroll = new ScrolledWindow ();
listScroll.WidthRequest = 200;
listScroll.HeightRequest = 320;
hBox.PackStart (listScroll, false, false, 5);
itemTree = new TreeView (itemStore);
itemTree.Selection.Mode = SelectionMode.Single;
itemTree.HeadersVisible = false;
listScroll.AddWithViewport (itemTree);
//renderers and attribs for TreeView
CellRenderer rdr = new CellRendererText ();
itemTree.AppendColumn (new TreeViewColumn ("Index", rdr, "text", 1));
rdr = new CellRendererText ();
itemTree.AppendColumn (new TreeViewColumn ("Object", rdr, "text", 2));
#endregion
#region Events
addButton.Clicked += delegate {
//create the object
object instance = System.Activator.CreateInstance (types[0]);
//get existing selection and insert after it
TreeIter oldIter, newIter;
if (itemTree.Selection.GetSelected (out oldIter))
newIter = itemStore.InsertAfter (oldIter);
//or append if no previous selection
else
newIter = itemStore.Append ();
itemStore.SetValue (newIter, 0, instance);
//select, set name and update all the indices
itemTree.Selection.SelectIter (newIter);
UpdateName (itemStore, newIter);
UpdateIndices (itemStore);
//.........这里部分代码省略.........
示例4: RemoveItems
private void RemoveItems(ref Contacts cnts, ref ListStore lstore, TreePath[] tPath)
{
for(int p=(tPath.Length-1); p>=0; p--)
{
// remove contact from list
cnts.SimContacts.RemoveAt(tPath[p].Indices[0]);
}
for(int p=(tPath.Length-1); p>=0; p--)
{
// remove contact from list
TreeIter ti;
bool isIter = lstore.GetIter(out ti, tPath[p]);
if (isIter)
{
lstore.Remove(ref ti);
}
}
}