public object GetValue(int row, int column) { Gtk.TreeIter it; if (!List.IterNthChild(out it, row)) { return(null); } return(GetValue(it, column)); }
public void SelectRow(int row) { Gtk.TreeIter iter; if (store.IterNthChild(out iter, row)) { Gtk.TreePath path = store.GetPath(iter); SetCursor(path, null, false); // We want the initial selection to be centered if (!IsRealized) { ScrollToCell(path, null, true, 0.5f, 0.0f); } } }
protected virtual void RemoveActivated(object sender, System.EventArgs e) { TreeIter iter; if (targetView.Selection.GetSelected(out iter)) { WebDeployTarget targetToRemove = (WebDeployTarget)targetList.GetValue(iter, LISTCOL_TARGET); localCollection.Remove(targetToRemove); targetList.Remove(ref iter); } if (targetList.IterIsValid(iter) || (localCollection.Count > 0 && targetList.IterNthChild(out iter, localCollection.Count - 1))) { targetView.Selection.SelectIter(iter); } }
protected virtual void OnTreeviewrefCursorChanged(object sender, System.EventArgs e) { bool isSelect = treeviewref.Selection.CountSelectedRows() == 1; editAction1.Sensitive = isSelect && CanEdit; removeAction1.Sensitive = isSelect && CanDel; bool SelectFirst = false, SelectLast = false; bool Filtered = entryFilter.Text != ""; TreeIter iter, SelectIter; if (treeviewref.Selection.GetSelected(out SelectIter)) { TreePath SelectPath = RefListStore.GetPath(filter.ConvertIterToChildIter(SelectIter)); RefListStore.GetIterFirst(out iter); SelectFirst = RefListStore.GetPath(iter).Compare(SelectPath) == 0; RefListStore.IterNthChild(out iter, RefListStore.IterNChildren() - 1); SelectLast = RefListStore.GetPath(iter).Compare(SelectPath) == 0; } buttonOrdinalUp.Sensitive = isSelect && !Filtered && !SelectFirst; buttonOrdinalDown.Sensitive = isSelect && !Filtered && !SelectLast; buttonOk.Sensitive = isSelect; }
private Widget BuildCombo(PipelineVariable variable) { ListStore model = new ListStore(typeof(string), typeof(string)); PipelineVariableComboBox box = new PipelineVariableComboBox(variable, model); TreeIter active_iter = TreeIter.Zero; box.Changed += OnComboChanged; if(variable.PossibleValuesCount > 0) { foreach(string key in variable.PossibleValuesKeys) { TreeIter iter = ComboAppend(model, variable, variable.PossibleValues[key].Display, key); if(variable.CurrentValue == key || (active_iter.Equals(TreeIter.Zero) && variable.DefaultValue == key)) { active_iter = iter; } } } else { double min = variable.MinValue; double max = variable.MaxValue; double step = variable.StepValue; double current = min; for(; current <= max; current += step) { ComboAppend(model, variable, current.ToString(), current.ToString()); } } if(active_iter.Equals(TreeIter.Zero)) { for(int i = 0, n = model.IterNChildren(); i < n; i++) { TreeIter iter; if(model.IterNthChild(out iter, i)) { string value = (string)model.GetValue(iter, 1); if(value == variable.CurrentValue) { active_iter = iter; break; } } } } CellRendererText text_renderer = new CellRendererText(); box.PackStart(text_renderer, true); box.AddAttribute(text_renderer, "text", 0); box.Model = model; if(active_iter.Equals(TreeIter.Zero)) { if(model.IterNthChild(out active_iter, 0)) { box.SetActiveIter(active_iter); } } else { box.SetActiveIter(active_iter); } return box; }