/// <summary> /// Fill a list of events from a list of paths, if the first and unique path is an EventType the list /// is filled with al the child events in this EventType category. /// </summary> /// <param name = "model">Model.</param> /// <param name="events">Events.</param> /// <param name="paths">Paths.</param> public static List<TimelineEventLongoMatch> EventsListFromPaths(TreeModel model, TreePath[] paths) { List<TimelineEventLongoMatch> events = new List<TimelineEventLongoMatch> (); // If it's an EventType or a Player, traverse all children to fill the list if (paths.Length == 1 && !(model.GetValue (paths [0]) is TimelineEventLongoMatch)) { TreeIter parentIter; TreeIter child; bool hasChild; model.GetIter (out parentIter, paths [0]); hasChild = model.IterHasChild (parentIter); model.IterChildren (out child, parentIter); while (hasChild) { TimelineEventLongoMatch evt = model.GetValue (child, 0) as TimelineEventLongoMatch; if (evt != null) { events.Add (evt); } hasChild = model.IterNext (ref child); } } else { foreach (var path in paths) { TimelineEventLongoMatch evt = model.GetValue (path) as TimelineEventLongoMatch; if (evt != null) { events.Add (evt); } } } return events; }
bool IsSolutionTemplateOnActivatedRow(TreeView treeView, RowActivatedArgs args) { TreeModel model = treeView.Model; TreeIter iter; if (model.GetIter(out iter, args.Path)) { var template = model.GetValue(iter, TemplateColumn) as SolutionTemplate; return(template != null); } return(false); }
protected virtual bool SelectFunction(TreeSelection selection, TreeModel model, TreePath path, bool selected) { TreePath [] selectedRows; selectedRows = selection.GetSelectedRows(); if (!selected && selectedRows.Length > 0) { object currentSelected; object firstSelected; TreeIter iter; model.GetIter(out iter, selectedRows [0]); firstSelected = model.GetValue(iter, COL_DATA); model.GetIter(out iter, path); currentSelected = model.GetValue(iter, COL_DATA); if (currentSelected.GetType().BaseType == firstSelected.GetType().BaseType) { return(true); } return(false); } return(true); }
protected void OnTreeview1RowActivated(object o, RowActivatedArgs args) { TreeModel model = treeview1.Model; TreeIter iter; model.GetIter(out iter, args.Path); String agentId = model.GetValue(iter, 1).ToString(); LoadGpuInformationView(agentId); LoadFabricInformationView(agentId); LoadAssignmentView(agentId); LoadSrvRuntimeConfig(agentId); LoadClientRuntimeConfig(agentId); }
protected void OnTreeview2RowActivated(object o, RowActivatedArgs args) { TreeIter iter; TreeModel model = treeview2.Model; model.GetIter(out iter, args.Path); List <string> record = new List <string>(); for (int i = 0; i < 10; i++) { var value = model.GetValue(iter, i); record.Add(value.ToString()); } values = record; }
/* private void KeyPressed (object o, KeyPressEventArgs args) * { * Console.WriteLine ("key {0}", args.Event.keyval); * switch (args.Event.keyval) { * case 65293: //FIXME: Enter * //Select (); * break; * } * } */ private void RowActivated(object o, RowActivatedArgs args) { TreeModel store = (o as TreeView).Model; TreeIter iter; if (store.GetIter(out iter, args.Path)) { browser.SelectType((string)store.GetValue(iter, 1)); browser.SelectAllMembers(); if (!(bool)store.GetValue(iter, 3)) { browser.SelectMember((string)store.GetValue(iter, 0)); } } }
bool TemplateCategoriesTreeViewSelection(TreeSelection selection, TreeModel model, TreePath path, bool path_currently_selected) { TreeIter iter; if (model.GetIter(out iter, path)) { var category = model.GetValue(iter, TemplateCategoryColumn) as TemplateCategory; if (category.IsTopLevel) { return(false); } } return(true); }
bool TemplatesTreeViewSelection(TreeSelection selection, TreeModel model, TreePath path, bool path_currently_selected) { TreeIter iter; if (model.GetIter(out iter, path)) { var template = model.GetValue(iter, TemplateColumn) as SolutionTemplate; if (template == null) { return(false); } } return(true); }
public override bool GetSelected(out TreeModel model, out TreeIter iter) { model = this.model; iter = TreeIter.Zero; if (selected_path == null) { return(false); } if (!model.GetIter(out iter, selected_path)) { return(false); } return(true); }
public bool GetFocused(out TreeModel model, out TreeIter iter) { model = this.model; iter = TreeIter.Zero; if (focused_path == null) { return(false); } if (!model.GetIter(out iter, focused_path)) { return(false); } return(true); }
void toggelcellEdited(object o, ToggledArgs args) { TreePath path = new TreePath(args.Path); // int i = path.Indices[0]; TreeModel m = this.treeview1.Model; TreeIter iter; m.GetIter(out iter, path); Dragon d = (Dragon)m.GetValue(iter, 0); string colTitle = string.Empty; if ((o as CellRenderer).Data.ContainsKey("_colTitle")) { colTitle = Convert.ToString((o as CellRenderer).Data["_colTitle"]); } System.Diagnostics.Debug.WriteLine(colTitle); }
/// <summary> /// Get the selected items /// </summary> /// <param name="tModel"></param> /// <returns>a queue</returns> private Queue GetSelectedItemsInQueue(out TreeModel tModel) { Queue iterQueue; iterQueue = new Queue(); TreeSelection tSelect = ConflictTreeView.Selection; Array treePaths = tSelect.GetSelectedRows(out tModel); // We can't remove anything while getting the iters // because it will change the paths and we'll remove // the wrong stuff. foreach (TreePath tPath in treePaths) { TreeIter iter; if (tModel.GetIter(out iter, tPath)) { iterQueue.Enqueue(iter); } } return(iterQueue); }
/// <summary> /// Fill a list of events from a list of paths, if the first and unique path is an EventType the list /// is filled with al the child events in this EventType category. /// </summary> /// <param name = "model">Model.</param> /// <param name="events">Events.</param> /// <param name="paths">Paths.</param> public static List <LMTimelineEvent> EventsListFromPaths(TreeModel model, TreePath[] paths) { List <LMTimelineEvent> events = new List <LMTimelineEvent> (); // If it's an EventType or a Player, traverse all children to fill the list if (paths.Length == 1 && !(model.GetValue(paths [0]) is LMTimelineEvent)) { TreeIter parentIter; TreeIter child; bool hasChild; model.GetIter(out parentIter, paths [0]); hasChild = model.IterHasChild(parentIter); model.IterChildren(out child, parentIter); while (hasChild) { LMTimelineEvent evt = model.GetValue(child, 0) as LMTimelineEvent; if (evt != null) { events.Add(evt); } hasChild = model.IterNext(ref child); } } else { foreach (var path in paths) { LMTimelineEvent evt = model.GetValue(path) as LMTimelineEvent; if (evt != null) { events.Add(evt); } } } return(events); }
bool TemplatesTreeViewSelection (TreeSelection selection, TreeModel model, TreePath path, bool path_currently_selected) { TreeIter iter; if (model.GetIter (out iter, path)) { var template = model.GetValue (iter, TemplateColumn) as SolutionTemplate; if (template == null) { return false; } } return true; }
bool TemplateCategoriesTreeViewSelection (TreeSelection selection, TreeModel model, TreePath path, bool path_currently_selected) { TreeIter iter; if (model.GetIter (out iter, path)) { var category = model.GetValue (iter, TemplateCategoryColumn) as TemplateCategory; if (category.IsTopLevel) { return false; } } return true; }
//generally useful function... why not in model already? static bool IterPrev (TreeModel model, ref TreeIter iter) { TreePath tp = model.GetPath (iter); return tp.Prev() && model.GetIter (out iter, tp); }
//generally useful function... why not in model already? static bool IterPrev(TreeModel model, ref TreeIter iter) { TreePath tp = model.GetPath(iter); return(tp.Prev() && model.GetIter(out iter, tp)); }
// the treeview is selected private bool tree_select(TreeSelection selection, TreeModel model, TreePath path, bool selected) { if (this != Global.Core.Library.DynamicTree) Global.Core.Library.DynamicTree.Selection.UnselectAll (); if (this != Global.Core.Library.FolderTree) Global.Core.Library.FolderTree.Selection.UnselectAll (); if (this != Global.Core.Library.PlaylistTree) Global.Core.Library.PlaylistTree.Selection.UnselectAll (); //if it isnt already selected if (!selected) { Global.Core.TopBar.SelectedTree = this; Global.Core.Library.MediaTree.SetFilter (FilterMedia); Global.Core.Library.MediaTree.Refilter (); //raise the event if (TreeSelected != null) { TreeIter iter; if (model.GetIter (out iter, path)) TreeSelected (model, iter); } } return true; }
private void FocusHelper(bool move_next) { if (focused_path == null) { return; } TreeIter focused_iter; if (!model.GetIter(out focused_iter, focused_path)) { return; } int focus_x, focus_y; GetPlotPoint(focused_iter, out focus_x, out focus_y); // we can't just do focused_path.Prev () since there is // a disconnect between the order in the model and // where the axis has us place points. besides, we // need to clamp the focus region to the zoom rect. TreeIter iter; if (!model.GetIterFirst(out iter)) { return; } int total_height = (Allocation.Y + Allocation.Height); TreePath min_path = null; int min_x_delta = Int32.MaxValue; int min_y_delta = Int32.MaxValue; do { TreePath path = model.GetPath(iter); // don't try to focus the same point again if (path.Compare(focused_path) == 0) { continue; } int x, y; GetPlotPoint(iter, out x, out y); // if its out of bounds, throw it out if (IsBarOutOfBounds(x, y)) { continue; } int x_delta = 0, y_delta = 0; if (move_next) { // find the bar with the smallest positive x // delta, and smallest y, or if there // is a tie, the one that's larger on the y // axis x_delta = x - focus_x; y_delta = (focus_x != x) ? total_height - y : focus_y - y; } else { // find the bar with the smallest positive x // delta, and largest y, or if there // is a tie, the one that's larger on the y // axis x_delta = focus_x - x; y_delta = (focus_x != x) ? y : y - focus_y; } // don't go backward, and don't pick a bigger // delta than we already have if (x_delta < 0 || x_delta > min_x_delta) { continue; } if (x_delta == min_x_delta && y_delta >= min_y_delta) { continue; } // if we're at the same X value, make sure // we're moving forward in the y direction so // we don't get stuck in loops if (x_delta == 0 && y_delta < 0) { continue; } min_x_delta = x_delta; min_y_delta = y_delta; min_path = path; } while (model.IterNext(ref iter)); if (min_path != null) { focused_path = min_path; } else { if (move_next) { focused_path = TreePath.NewFirst(); } else { focused_path = new TreePath(new int[] { model.IterNChildren() - 1 }); } } if (Changed != null) { Changed(this, new EventArgs()); } }