protected override bool OnMatchSelected (TreeModel filter, TreeIter iter){ Location.Item = (Model.Item)filter.GetValue(iter,0); Entry entry = (Entry)Entry; entry.FinishEditing(); entry.RemoveWidget(); return true; }
/// <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; }
protected override bool OnMatchSelected (TreeModel filter, TreeIter iter){ Entry entry = (Entry)Entry; entry.Text = ((ItemTag)filter.GetValue(iter,0)).Name; entry.FinishEditing(); entry.RemoveWidget(); return true; }
private void TextDataFunc(CellLayout cell_layout, CellRenderer renderer, TreeModel model, TreeIter iter) { CellRendererText textRenderer = (CellRendererText) renderer; Tilegroup group = (Tilegroup) Model.GetValue(iter, 0); textRenderer.Text = group.Name; }
public void LoadData(TreeViewBackend treeBackend, TreeModel treeModel, TreeIter iter) { this.treeModel = treeModel; this.iter = iter; cellView.Initialize (this); Visible = cellView.Visible; }
/// <summary> /// Override the default filter mechanism so that we show only /// completed tasks in this group. /// </summary> /// <param name="model"> /// A <see cref="TreeModel"/> /// </param> /// <param name="iter"> /// A <see cref="TreeIter"/> /// </param> /// <returns> /// A <see cref="System.Boolean"/> /// </returns> protected override bool FilterTasks(TreeModel model, TreeIter iter) { // Don't show any task here if showCompletedTasks is false if (!showCompletedTasks) return false; ITask task = model.GetValue (iter, 0) as ITask; if (task == null || task.State != TaskState.Completed) return false; // Make sure that the task fits into the specified range depending // on what the user has set the range slider to be. if (task.CompletionDate < this.timeRangeStart) return false; if (task.CompletionDate == DateTime.MinValue) return true; // Just in case // Don't show tasks in the completed group that were completed // today. Tasks completed today should still appear under their // original group until tomorrow. DateTime today = DateTime.Now; if (today.Year == task.CompletionDate.Year && today.DayOfYear == task.CompletionDate.DayOfYear) return false; return true; }
public YouTrackTreeViewController(ISolution solution, TreeSimpleModel treeModel) : base(solution) { this.treeModel = treeModel; this.solution = solution; this.presenter = new YouTrackIssuePresenter(); }
public static void CellDataHandler (CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter) { SourceRowRenderer renderer = cell as SourceRowRenderer; if (renderer == null) { return; } var type = model.GetValue (iter, (int)SourceModel.Columns.Type); if (type == null || (SourceModel.EntryType) type != SourceModel.EntryType.Source) { renderer.Visible = false; return; } Source source = model.GetValue (iter, 0) as Source; renderer.Source = source; renderer.Iter = iter; if (source == null) { return; } renderer.Visible = true; renderer.Text = source.Name; renderer.Sensitive = source.CanActivate; }
/* * Constructor */ public FindBar(PhotoQuery query, TreeModel model) : base(new HBox()) { this.query = query; box = Child as HBox; box.Spacing = 6; box.BorderWidth = 2; box.PackStart (new Label (Catalog.GetString ("Find:")), false, false, 0); entry = new Entry (); entry.Completion = new LogicEntryCompletion (entry, model); entry.TextInserted += HandleEntryTextInserted; entry.TextDeleted += HandleEntryTextDeleted; entry.KeyPressEvent += HandleEntryKeyPress; box.PackStart (entry, true, true, 0); Button clear_button = new Gtk.Button (); clear_button.Add (new Gtk.Image ("gtk-close", Gtk.IconSize.Button)); clear_button.Clicked += HandleCloseButtonClicked; clear_button.Relief = Gtk.ReliefStyle.None; box.PackStart (clear_button, false, false, 0); }
public GtkTreeModelResult (Widget parent, TreeModel treeModel, int column, TreeIter iter) : base (parent) { ParentWidget = parent; TModel = treeModel; Column = column; resultIter = iter; }
private void OnPixbufCellLayout(CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter) { CellRendererPixbuf pixbufCell = (cell as CellRendererPixbuf); IVirtualDevice device = (IVirtualDevice) model.GetValue (iter, 0); switch (device.DeviceType) { case VirtualDeviceType.HardDisk: pixbufCell.Pixbuf = hdPixbuf; break; case VirtualDeviceType.CdRom: pixbufCell.Pixbuf = cdromPixbuf; break; case VirtualDeviceType.Ethernet: pixbufCell.Pixbuf = ethernetPixbuf; break; case VirtualDeviceType.Floppy: pixbufCell.Pixbuf = floppyPixbuf; break; default: pixbufCell.Pixbuf = null; break; } }
// 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; }
static void ImageDataFunc (TreeViewColumn tree_column, CellRenderer cell, TreeModel tree_model, TreeIter iter) { var isError = (bool)tree_model.GetValue (iter, 2); var crpixbuf = (CellRendererPixbuf)cell; crpixbuf.Visible = isError; crpixbuf.Pixbuf = isError ? errorPixbuf.Value : null; }
private void ContentDataFunc (CellLayout layout, CellRenderer cell, TreeModel model, TreeIter iter) { object dataObject = model.GetValue (iter, columnIndex); if (dataObject == null) nullRenderer.SetContent (cell as CellRendererText, dataObject); else contentRenderer.SetContent (cell as CellRendererText, dataObject); }
private void AlbumCellDataFunc(TreeViewColumn column, CellRenderer renderer, TreeModel model, TreeIter iter) { MusicStoreTrackInfo track = (MusicStoreTrackInfo) model.GetValue (iter, 0); ((CellRendererText)renderer).Text = track.Album; }
/// <summary> Compare ZPos Values and return which comes first </summary> public int compareLayer(TreeModel model, TreeIter tia, TreeIter tib) { object objA = model.GetValue (tia, 0); object objB = model.GetValue (tib, 0); int a = getZPos(objA); int b = getZPos(objB); return a.CompareTo(b); }
public static void RenderCoverage (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) { var txt = cell as CellRendererText; CodeRecord rc = (CodeRecord)model.GetValue (iter, 0); if (txt != null) { txt.Foreground = CellColor (rc.Coverage); txt.Text = String.Format ("{0:00.0}%", rc.Coverage * 100.0); } }
public void LoadData(TreeModel treeModel, TreeIter iter) { this.treeModel = treeModel; this.iter = iter; view.Initialize (this); Active = view.Active; Activatable = view.Editable; }
private static void GetChildCategories(TreeModel<DevCategory> tree, List<DevCategory> categories) { foreach (var item in categories.Where(c => c.ParentId == tree.Id)) { var node = new TreeModel<DevCategory> { Id = item.CategoryId, Name = item.CategoryName, Entity = item }; tree.Children.Add(node); GetChildCategories(node, categories); } }
public ObservableListTreeModel(IObservableList list) { adapter = new TreeModelAdapter (this); sourceList = list; sourceList.ElementChanged += SourceList_ElementChanged; sourceList.ElementAdded += SourceList_ElementAdded; sourceList.ElementRemoved += SourceList_ElementRemoved; sourceList.ListChanged += SourceList_ListChanged; }
public TreeEnumerator (TreeModel model) { this.model = model; model.RowChanged += new RowChangedHandler (row_changed); model.RowDeleted += new RowDeletedHandler (row_deleted); model.RowInserted += new RowInsertedHandler (row_inserted); model.RowsReordered += new RowsReorderedHandler (rows_reordered); }
public static void Copy(TreeModel tree, ListStore list) { list.Clear(); TreeIter tree_iter; if (tree.IterChildren(out tree_iter)) { Copy(tree, tree_iter, list, true); } }
private void RenderFont (CellLayout layout, CellRenderer renderer, TreeModel model, TreeIter iter) { string fontName = (string)model.GetValue (iter, 0); CellRendererText cell = renderer as CellRendererText; cell.Text = fontName; cell.Font = string.Format ("{0} 10", fontName); cell.Family = fontName; }
public TreePathReference (TreeModel model, TreePath path) { model.RowsReordered += HandleRowsReordered; model.RowInserted += HandleRowInserted; model.RowDeleted += HandleRowDeleted; indices = path.Indices; this.path = path; Model = model; }
static int CompareTagsSortFunc (TreeModel model, TreeIter a, TreeIter b) { Tag tag_a = model.GetValue (a, 0) as Tag; Tag tag_b = model.GetValue (b, 0) as Tag; if (tag_a == null || tag_b == null) return 0; return string.Compare (tag_a.NormalizedName, tag_b.NormalizedName); }
public PayAccrual() { this.Build (); ComboBox IncomeCombo = new ComboBox(); ComboWorks.ComboFillReference(IncomeCombo,"income_items", ComboWorks.ListMode.OnlyItems); IncomeNameList = IncomeCombo.Model; IncomeCombo.Destroy (); //Создаем таблицу "Услуги" ServiceListStore = new Gtk.ListStore (typeof (bool), typeof (int), typeof (string), typeof (int), typeof (string), typeof (int), typeof (string), typeof (decimal), typeof(long)); CellRendererToggle CellPay = new CellRendererToggle(); CellPay.Activatable = true; CellPay.Toggled += onCellPayToggled; Gtk.TreeViewColumn IncomeItemsColumn = new Gtk.TreeViewColumn (); IncomeItemsColumn.Title = "Статья дохода"; IncomeItemsColumn.MinWidth = 130; Gtk.CellRendererCombo CellIncomeItems = new CellRendererCombo(); CellIncomeItems.TextColumn = 0; CellIncomeItems.Editable = true; CellIncomeItems.Model = IncomeNameList; CellIncomeItems.HasEntry = false; CellIncomeItems.Edited += OnIncomeItemComboEdited; IncomeItemsColumn.PackStart (CellIncomeItems, true); Gtk.TreeViewColumn SumColumn = new Gtk.TreeViewColumn (); SumColumn.Title = "Сумма"; SumColumn.MinWidth = 90; Gtk.CellRendererText CellSum = new CellRendererText(); CellSum.Editable = true; CellSum.Edited += OnSumTextEdited; SumColumn.PackStart (CellSum, true); treeviewServices.AppendColumn("Оплатить", CellPay, "active", (int)ServiceCol.pay); treeviewServices.AppendColumn ("Услуга", new Gtk.CellRendererText (), "text", (int)ServiceCol.service); treeviewServices.AppendColumn ("Касса", new Gtk.CellRendererText (), "text", (int)ServiceCol.cash); treeviewServices.AppendColumn (IncomeItemsColumn); IncomeItemsColumn.AddAttribute (CellIncomeItems, "text", (int)ServiceCol.income); treeviewServices.AppendColumn (SumColumn); SumColumn.SetCellDataFunc (CellSum, RenderSumColumn); treeviewServices.Model = ServiceListStore; treeviewServices.ShowAll(); }
public SelectAccrualRow(TreeModel AccrualRows) { this.Build (); AccrualTreeView.AppendColumn ("Услуга", new Gtk.CellRendererText (), "text", 1); AccrualTreeView.AppendColumn ("Начислено", new Gtk.CellRendererText (), "text", 3); AccrualTreeView.AppendColumn ("Уже оплачено", new Gtk.CellRendererText (), "text", 5); AccrualTreeView.Model = AccrualRows; AccrualTreeView.ShowAll(); }
public static void ProfileNameDataFunc (CellLayout layout, CellRenderer renderer, TreeModel model, TreeIter iter) { if (model.GetValue (iter, 0) != null) { Cms.Profile profile = (Cms.Profile) model.GetValue (iter, 0); if (profile.ProductName.Length < NameLenth) (renderer as Gtk.CellRendererText).Text = profile.ProductName; else (renderer as Gtk.CellRendererText).Text = profile.ProductName.Substring(0, NameLenth) + "..."; } else (renderer as Gtk.CellRendererText).Text = ""; }
private int CompareNodes (TreeModel model, TreeIter iter1, TreeIter iter2) { if ((string) store.GetValue (iter1, 0) == "__other") return 1; if ((string) store.GetValue (iter2, 0) == "__other") return -1; string s1 = (string) store.GetValue (iter1, 1); string s2 = (string) store.GetValue (iter2, 1); return string.Compare (s1, s2); }
public void LoadData(TreeViewBackend treeBackend, TreeModel treeModel, TreeIter iter) { this.treeBackend = treeBackend; this.treeModel = treeModel; this.iter = iter; view.Initialize (this); Inconsistent = view.State == CheckBoxState.Mixed; Active = view.State == CheckBoxState.On; Activatable = view.Editable; Visible = view.Visible; }
public CellDataSource(TreeIter iter, TreeModel treeModel) { this.iter = iter; this.treeModel = treeModel; }
protected virtual void Init(TreeModel <T> model) { m_TreeModel = model; m_TreeModel.modelChanged += ModelChanged; }
static void SetText(CellRendererText textRenderer, TreeModel model, TreeIter iter, TaskListEntry task, string text) { textRenderer.Text = text; textRenderer.Weight = (int)((bool)model.GetValue(iter, DataColumns.Read) ? Pango.Weight.Normal : Pango.Weight.Bold); textRenderer.Strikethrough = task.Completed; }
static int SortSchemas(TreeModel model, TreeIter a, TreeIter b) { var listStore = (ListStore)model; return(string.Compare(GetSchema(listStore, a).NamespaceUri, GetSchema(listStore, b).NamespaceUri, StringComparison.Ordinal)); }
void ResultTextDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { if (TreeIter.Zero.Equals(iter)) { return; } var textRenderer = (CellRendererText)cell; var searchResult = (SearchResult)store.GetValue(iter, SearchResultColumn); if (searchResult == null || searchResult.Offset < 0) { textRenderer.Markup = "Invalid search result"; return; } var doc = GetDocument(searchResult); if (doc == null) { textRenderer.Markup = "Can't create document for:" + searchResult.FileName; return; } bool isSelected = treeviewSearchResults.Selection.IterIsSelected(iter); if (searchResult.Markup == null) { if (searchResult.LineNumber <= 0) { searchResult.LineNumber = doc.OffsetToLineNumber(searchResult.Offset); } DocumentLine line = doc.GetLine(searchResult.LineNumber); if (line == null) { textRenderer.Markup = "Invalid line number " + searchResult.LineNumber + " from offset: " + searchResult.Offset; return; } int indent = line.GetIndentation(doc).Length; var data = new Mono.TextEditor.TextEditorData(doc); data.ColorStyle = highlightStyle; var lineText = doc.GetTextAt(line.Offset + indent, line.Length - indent); int col = searchResult.Offset - line.Offset - indent; // search result contained part of the indent. if (col + searchResult.Length < lineText.Length) { lineText = doc.GetTextAt(line.Offset, line.Length); } var markup = doc.SyntaxMode != null? data.GetMarkup(line.Offset + indent, line.Length - indent, true, !isSelected, false) : GLib.Markup.EscapeText(lineText); searchResult.Markup = AdjustColors(markup.Replace("\t", new string (' ', TextEditorOptions.DefaultOptions.TabSize))); if (col >= 0) { uint start; uint end; try { start = (uint)TextViewMargin.TranslateIndexToUTF8(lineText, col); end = (uint)TextViewMargin.TranslateIndexToUTF8(lineText, Math.Min(lineText.Length, col + searchResult.Length)); } catch (Exception e) { LoggingService.LogError("Exception while translating index to utf8 (column was:" + col + " search result length:" + searchResult.Length + " line text:" + lineText + ")", e); return; } searchResult.StartIndex = start; searchResult.EndIndex = end; } } try { textRenderer.Markup = searchResult.Markup; if (!isSelected) { var searchColor = searchResult.GetBackgroundMarkerColor(highlightStyle).Color; double b1 = Mono.TextEditor.HslColor.Brightness(searchColor); double b2 = Mono.TextEditor.HslColor.Brightness(AdjustColor(Style.Base(StateType.Normal), (Mono.TextEditor.HslColor)highlightStyle.PlainText.Foreground)); double delta = Math.Abs(b1 - b2); if (delta < 0.1) { Mono.TextEditor.HslColor color1 = highlightStyle.SearchResult.Color; if (color1.L + 0.5 > 1.0) { color1.L -= 0.5; } else { color1.L += 0.5; } searchColor = color1; } if (searchResult.StartIndex != searchResult.EndIndex) { var attr = new Pango.AttrBackground((ushort)(searchColor.R * ushort.MaxValue), (ushort)(searchColor.G * ushort.MaxValue), (ushort)(searchColor.B * ushort.MaxValue)); attr.StartIndex = searchResult.StartIndex; attr.EndIndex = searchResult.EndIndex; using (var list = textRenderer.Attributes.Copy()) { list.Insert(attr); textRenderer.Attributes = list; } } } } catch (Exception e) { LoggingService.LogError("Error whil setting the text renderer markup to: " + searchResult.Markup, e); } }
static bool RuntimeIsSeparator(TreeModel model, TreeIter iter) { var runtime = (IRuntimeModel)model.GetValue(iter, 0); return(runtime == null || runtime.IsSeparator); }
public DependentListStore(TreeModel tree_model) { Parent = tree_model; }
public void DrawGraphExplorer(Rect r) { var result = EditorGUILayout.Popup(CurrentViewIndex, ExplorerViewsStrings); if (result != CurrentViewIndex) { CurrentViewIndex = result; TreeModel.Data = CurrentViewProvider.GetItems(Container.Resolve <IRepository>()); } if (_hardDirty) { if (TreeModel == null) { return; } if (WorkspaceService == null || WorkspaceService.CurrentWorkspace == null) { TreeModel.Data = new List <IItem>(); } else { TreeModel.Data = CurrentViewProvider.GetItems(Container.Resolve <IRepository>()); TreeModel.IsDirty = true; } _hardDirty = false; } if (TreeModel == null) { return; } if (TreeModel.IsDirty) { TreeModel.Refresh(); } Rect window = r; var searcbarRect = window.WithHeight(32).Pad(5, 22, 5, 5); var listRect = window.Below(searcbarRect).Clip(window).PadSides(5); var searchIconRect = new Rect().WithSize(32, 32).InnerAlignWithBottomRight(searcbarRect).AlignHorisonallyByCenter(searcbarRect).PadSides(10); PlatformDrawer.DrawImage(searchIconRect, "SearchIcon", true); GUI.SetNextControlName("GraphTreeSearch"); EditorGUI.BeginChangeCheck(); SearchCriteria = GUI.TextField(searcbarRect, SearchCriteria ?? "", ElementDesignerStyles.SearchBarTextStyle); PlatformDrawer.DrawImage(searchIconRect, "SearchIcon", true); if (EditorGUI.EndChangeCheck()) { if (string.IsNullOrEmpty(SearchCriteria)) { TreeModel.Predicate = null; } else { TreeModel.Predicate = i => { if (string.IsNullOrEmpty(i.Title)) { return(false); } if ( CultureInfo.CurrentCulture.CompareInfo.IndexOf(i.Title, SearchCriteria, CompareOptions.IgnoreCase) != -1) { return(true); } if (!string.IsNullOrEmpty(i.SearchTag) && CultureInfo.CurrentCulture.CompareInfo.IndexOf(i.SearchTag, SearchCriteria, CompareOptions.IgnoreCase) != -1) { return(true); } return(false); }; } TreeModel.IsDirty = true; } // PlatformDrawer.DrawTextbox("GraphTreeWindow_Search",searcbarRect,_searchCriterial,GUI.skin.textField.WithFont("Verdana",15), // (val,submit) => // { // _searchCriterial = val; // }); InvertApplication.SignalEvent <IDrawTreeView>(_ => { _.DrawTreeView(listRect, TreeModel, (m, i) => { TryNavigateToItem(i); }); }); GUI.FocusControl("GraphTreeSearch"); }
public ControlsTreeView(TreeViewState state, TreeModel <ControlElement> model) : base(state, model) { Reload(); }
static void SetTemplateTextCellData(TreeViewColumn col, CellRenderer renderer, TreeModel model, TreeIter it) { var template = (SolutionTemplate)model.GetValue(it, TemplateColumn); var templateTextRenderer = (GtkTemplateCellRenderer)renderer; templateTextRenderer.Template = template; templateTextRenderer.TemplateIcon = model.GetValue(it, TemplateIconColumn) as Xwt.Drawing.Image; templateTextRenderer.TemplateCategory = model.GetValue(it, TemplateNameColumn) as string; }
public InternalTree(PropertyGridTree tree, TreeModel model) : base(model) { this.tree = tree; layout = new Pango.Layout(this.PangoContext); layout.Wrap = Pango.WrapMode.Char; }
public AH_TreeViewWithTreeModel(TreeViewState state, MultiColumnHeader multicolumnHeader, TreeModel <AH_TreeviewElement> model) : base(state, multicolumnHeader, model) { Assert.AreEqual(m_SortOptions.Length, Enum.GetValues(typeof(MyColumns)).Length, "Ensure number of sort options are in sync with number of MyColumns enum values"); // Custom setup rowHeight = kRowHeights; columnIndexForTreeFoldouts = 1; showAlternatingRowBackgrounds = true; showBorder = true; customFoldoutYOffset = (kRowHeights - EditorGUIUtility.singleLineHeight) * 0.5f; // center foldout in the row since we also center content. See RowGUI extraSpaceBeforeIconAndLabel = kToggleWidth; multicolumnHeader.sortingChanged += OnSortingChanged; //IF we want to start expanded one level if (model.root.hasChildren) { SetExpanded(model.root.children[0].id, true); } Reload(); }
public ListTreeView(TreeViewState state, MultiColumnHeader multiColumnHeader, TreeModel <T> model) : base(state, multiColumnHeader, model) { }
public MainWindow() { //Categories = new List<string>(); //Components = new List<string>(); //CVs = new List<string>(); //ParserDefinition.Parse(); //ParserDefinition.CategoryList.ForEach(t => Categories.Add(t.Name)); //ParserDefinition.ComponentList.ForEach(t => Components.Add(t.Name)); //ParserDefinition.CVList.ForEach(t => CVs.Add(t.Value)); InitializeComponent(); ParserDefinition.Parse(); ParserConstraint.Parse(); #region Data Access Categories = new List <Category>(); Components = new List <Component>(); CVs = new List <ComponentValue>(); Categories = ParserDefinition.CategoryList; Components = ParserDefinition.ComponentList; CVs = ParserDefinition.CVList; _restrictedList = ParserConstraint.Restriction; #endregion #region View Model (before) //CategoriesVM = new List<CategoryVM>(); //Categories.ForEach(t => CategoriesVM.Add(new CategoryVM(t))); //ComponentsVM = new List<ComponentVM>(); //foreach (var cat in CategoriesVM) //{ // ComponentsVM.AddRange(cat.Components); //} //CVsVM = new List<CV_VM>(); //foreach (var comp in ComponentsVM) //{ // CVsVM.AddRange(comp.CVs_VM); //} #endregion var viewModel = new TreeViewModel(); _previousAnsCollection = new ObservableCollection <PreviousAnsModel>(); MainTreeView.DataContext = viewModel; _preAnsDict = new Dictionary <string, ComponentValue>(); _modelItem = new TreeModel(); MainTreeView.SelectedItemChanged += delegate(object sender, RoutedPropertyChangedEventArgs <object> e) { _modelItem = e.NewValue as TreeModel; if (!_modelItem.Type.Equals(EnumComponentType.Component) || _modelItem == null) { return; } viewModel.SelectedModel = _modelItem; var list = FIlterCV.Filter(viewModel.SelectedModel.Name, viewModel.ComponentValueChoices.ToList(), _restrictedList, _preAnsDict); _compValuesAvail = new ObservableCollection <ComponentValue>(list); ComboBox_CV.ItemsSource = _compValuesAvail; ComboBox_CVContent.Visibility = Visibility.Hidden; }; ComboBox_CV.SelectionChanged += ComboBox_CV_SelectionChanged; }
static void SetTemplateCategoryCellData(TreeViewColumn col, CellRenderer renderer, TreeModel model, TreeIter it) { var categoryTextRenderer = (GtkTemplateCategoryCellRenderer)renderer; categoryTextRenderer.Category = (TemplateCategory)model.GetValue(it, TemplateCategoryColumn); categoryTextRenderer.CategoryIcon = model.GetValue(it, TemplateCategoryIconColumn) as Xwt.Drawing.Image; categoryTextRenderer.CategoryName = model.GetValue(it, TemplateCategoryNameColumn) as string; }
public TreeViewWithTreeModel(TreeViewState state, TreeModel <T> model) : base(state) { Init(model); }
void ResultTextDataFunc(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { if (TreeIter.Zero.Equals(iter)) { return; } var textRenderer = (CellRendererText)cell; var searchResult = (SearchResult)store.GetValue(iter, SearchResultColumn); if (searchResult == null || searchResult.Offset < 0) { textRenderer.Markup = "Invalid search result"; return; } string textMarkup = markupCache.FirstOrDefault(t => t.Item1 == searchResult)?.Item2; bool isSelected = treeviewSearchResults.Selection.IterIsSelected(iter); if (isSelected) { textMarkup = null; } if (textMarkup == null) { var doc = GetDocument(searchResult); if (doc == null) { textMarkup = "Can't create document for:" + searchResult.FileName; goto end; } int lineNumber, startIndex = 0, endIndex = 0; try { lineNumber = doc.OffsetToLineNumber(searchResult.Offset); } catch (ArgumentOutOfRangeException) { lineNumber = -1; textMarkup = "Invalid search result offset"; goto end; } var line = doc.GetLine(lineNumber); if (line == null) { textMarkup = "Invalid line number " + lineNumber + " from offset: " + searchResult.Offset; goto end; } int indent = line.GetIndentation(doc).Length; var lineText = doc.GetTextAt(line.Offset + indent, line.Length - indent); int col = searchResult.Offset - line.Offset - indent; // search result contained part of the indent. if (col + searchResult.Length < lineText.Length) { lineText = doc.GetTextAt(line.Offset, line.Length); } string markup; if (isSelected) { markup = Ambience.EscapeText(doc.GetTextAt(line.Offset + indent, line.Length - indent)); } else { markup = doc.GetMarkup(line.Offset + indent, line.Length - indent, new MarkupOptions(MarkupFormat.Pango)); markup = AdjustColors(markup); } if (col >= 0) { uint start; uint end; try { start = (uint)TranslateIndexToUTF8(lineText, col); end = (uint)TranslateIndexToUTF8(lineText, Math.Min(lineText.Length, col + searchResult.Length)); } catch (Exception e) { LoggingService.LogError("Exception while translating index to utf8 (column was:" + col + " search result length:" + searchResult.Length + " line text:" + lineText + ")", e); return; } startIndex = (int)start; endIndex = (int)end; } try { textMarkup = markup; if (!isSelected) { var searchColor = searchResult.GetBackgroundMarkerColor(highlightStyle); double b1 = HslColor.Brightness(searchColor); double b2 = HslColor.Brightness(AdjustColor(Style.Base(StateType.Normal), SyntaxHighlightingService.GetColor(highlightStyle, EditorThemeColors.Foreground))); double delta = Math.Abs(b1 - b2); if (delta < 0.1) { var color1 = SyntaxHighlightingService.GetColor(highlightStyle, EditorThemeColors.FindHighlight); if (color1.L + 0.5 > 1.0) { color1.L -= 0.5; } else { color1.L += 0.5; } searchColor = color1; } if (startIndex != endIndex) { textMarkup = PangoHelper.ColorMarkupBackground(textMarkup, (int)startIndex, (int)endIndex, searchColor); } } else { var searchColor = this.treeviewSearchResults.Style.Base(StateType.Selected); searchColor = searchColor.AddLight(-0.2); textMarkup = PangoHelper.ColorMarkupBackground(textMarkup, (int)startIndex, (int)endIndex, searchColor); } } catch (Exception e) { LoggingService.LogError("Error whil setting the text renderer markup to: " + markup, e); } end: textMarkup = textMarkup.Replace("\t", new string (' ', doc.Options.TabSize)); if (!isSelected) { markupCache.Add(Tuple.Create(searchResult, textMarkup)); if (markupCache.Count > 100) { markupCache.RemoveAt(0); } } } textRenderer.Markup = textMarkup; }
public QuestTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader, TreeModel <QuestElement> model) : base(state, multicolumnHeader, model) { Assert.AreEqual(m_SortOptions.Length, Enum.GetValues(typeof(MyColumns)).Length, "Ensure number of sort options are in sync with number of MyColumns enum values"); // Custom setup rowHeight = kRowHeights; columnIndexForTreeFoldouts = 2; showAlternatingRowBackgrounds = true; showBorder = true; customFoldoutYOffset = (kRowHeights - EditorGUIUtility.singleLineHeight) * 0.5f; // center foldout in the row since we also center content. See RowGUI extraSpaceBeforeIconAndLabel = kToggleWidth; multicolumnHeader.sortingChanged += OnSortingChanged; Reload(); }
public PrefabsListTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader, TreeModel <PrefabsListElement> model) : base(state, multicolumnHeader, model) { Assert.AreEqual(m_SortOptions.Length, Enum.GetValues(typeof(Columns)).Length, "Ensure number of sort options are in sync with number of MyColumns enum values"); rowHeight = 20f; columnIndexForTreeFoldouts = 0; showAlternatingRowBackgrounds = true; showBorder = true; customFoldoutYOffset = (20f - EditorGUIUtility.singleLineHeight) * 0.5f; extraSpaceBeforeIconAndLabel = 18f; multicolumnHeader.sortingChanged += OnSortingChanged; Reload(); }
static int DefaultSortFunc(TreeModel model, TreeIter first, TreeIter second) { return(0); }
public TreeViewWithTreeModel(TreeViewState state, MultiColumnHeader multiColumnHeader, TreeModel <T> model) : base(state, multiColumnHeader) { Init(model); }
static bool Search(TreeModel model, int column, string key, TreeIter iter) { string value = (string)model.GetValue(iter, column); return(!value.Contains(key)); }
protected MaintainerTreeView(TreeViewState state, MultiColumnHeader multiColumnHeader, TreeModel <T> model) : base(state, multiColumnHeader) { multiColumnHeader.sortingChanged += OnSortingChanged; Init(model); }
public FormsGridView(TreeModel model) : base(model) { }
/* public methods */ public LinePlot(TreeModel model, PlotColor color, PointShape shape) : base(model) { this.color = color; this.shape = shape; }
public ListTreeView(TreeViewState state, TreeModel <T> model) : base(state, model) { }
private bool HasParent(TreeModel model, TreeIter iter) { TreeIter ti; return(model.IterParent(out ti, iter)); }
public void DrawUI(SerializedProperty property) { objectId = property.serializedObject.targetObject.GetInstanceID().ToString(); var prefabItemArray = property.FindPropertyRelative("locationPrefabList"); var layersRect = EditorGUILayout.GetControlRect(GUILayout.MinHeight(Mathf.Max(prefabItemArray.arraySize + 1, 1) * _lineHeight + MultiColumnHeader.DefaultGUI.defaultHeight), GUILayout.MaxHeight((prefabItemArray.arraySize + 1) * _lineHeight + MultiColumnHeader.DefaultGUI.defaultHeight)); if (!m_Initialized) { bool firstInit = m_MultiColumnHeaderState == null; var headerState = FeatureSubLayerTreeView.CreateDefaultMultiColumnHeaderState(); if (MultiColumnHeaderState.CanOverwriteSerializedFields(m_MultiColumnHeaderState, headerState)) { MultiColumnHeaderState.OverwriteSerializedFields(m_MultiColumnHeaderState, headerState); } m_MultiColumnHeaderState = headerState; var multiColumnHeader = new FeatureSectionMultiColumnHeader(headerState); if (firstInit) { multiColumnHeader.ResizeToFit(); } treeModel = new TreeModel <FeatureTreeElement>(GetData(prefabItemArray)); if (m_TreeViewState == null) { m_TreeViewState = new TreeViewState(); } if (layerTreeView == null) { layerTreeView = new FeatureSubLayerTreeView(m_TreeViewState, multiColumnHeader, treeModel, FeatureSubLayerTreeView.uniqueIdPoI); } layerTreeView.multiColumnHeader = multiColumnHeader; m_Initialized = true; } layerTreeView.Layers = prefabItemArray; layerTreeView.Reload(); layerTreeView.OnGUI(layersRect); if (layerTreeView.hasChanged) { EditorHelper.CheckForModifiedProperty(property); layerTreeView.hasChanged = false; } selectedLayers = layerTreeView.GetSelection(); //if there are selected elements, set the selection index at the first element. //if not, use the Selection index to persist the selection at the right index. if (selectedLayers.Count > 0) { //ensure that selectedLayers[0] isn't out of bounds if (selectedLayers[0] - FeatureSubLayerTreeView.uniqueIdPoI > prefabItemArray.arraySize - 1) { selectedLayers[0] = prefabItemArray.arraySize - 1 + FeatureSubLayerTreeView.uniqueIdPoI; } SelectionIndex = selectedLayers[0]; } else { selectedLayers = new int[1] { SelectionIndex }; if (SelectionIndex > 0 && (SelectionIndex - FeatureSubLayerTreeView.uniqueIdPoI <= prefabItemArray.arraySize - 1)) { layerTreeView.SetSelection(selectedLayers); } } GUILayout.Space(EditorGUIUtility.singleLineHeight); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button(new GUIContent("Add Layer"), (GUIStyle)"minibuttonleft")) { prefabItemArray.arraySize++; var prefabItem = prefabItemArray.GetArrayElementAtIndex(prefabItemArray.arraySize - 1); var prefabItemName = prefabItem.FindPropertyRelative("coreOptions.sublayerName"); prefabItemName.stringValue = "New Location"; // Set defaults here because SerializedProperty copies the previous element. prefabItem.FindPropertyRelative("coreOptions.isActive").boolValue = true; prefabItem.FindPropertyRelative("coreOptions.snapToTerrain").boolValue = true; prefabItem.FindPropertyRelative("presetFeatureType").enumValueIndex = (int)PresetFeatureType.Points; var categories = prefabItem.FindPropertyRelative("categories"); categories.intValue = (int)(LocationPrefabCategories.AnyCategory); //To select any category option var density = prefabItem.FindPropertyRelative("density"); density.intValue = 15; //To select all locations option //Refreshing the tree layerTreeView.Layers = prefabItemArray; layerTreeView.AddElementToTree(prefabItem); layerTreeView.Reload(); selectedLayers = new int[1] { prefabItemArray.arraySize - 1 }; layerTreeView.SetSelection(selectedLayers); if (EditorHelper.DidModifyProperty(property)) { isLayerAdded = true; } } if (GUILayout.Button(new GUIContent("Remove Selected"), (GUIStyle)"minibuttonright")) { foreach (var index in selectedLayers.OrderByDescending(i => i)) { if (layerTreeView != null) { var poiSubLayer = prefabItemArray.GetArrayElementAtIndex(index - FeatureSubLayerTreeView.uniqueIdPoI); VectorLayerProperties vectorLayerProperties = (VectorLayerProperties)EditorHelper.GetTargetObjectOfProperty(property); PrefabItemOptions poiSubLayerProperties = (PrefabItemOptions)EditorHelper.GetTargetObjectOfProperty(poiSubLayer); vectorLayerProperties.OnSubLayerPropertyRemoved(new VectorLayerUpdateArgs { property = poiSubLayerProperties }); layerTreeView.RemoveItemFromTree(index); prefabItemArray.DeleteArrayElementAtIndex(index - FeatureSubLayerTreeView.uniqueIdPoI); layerTreeView.treeModel.SetData(GetData(prefabItemArray)); } } selectedLayers = new int[0]; layerTreeView.SetSelection(selectedLayers); } EditorGUILayout.EndHorizontal(); if (selectedLayers.Count == 1 && prefabItemArray.arraySize != 0 && selectedLayers[0] - FeatureSubLayerTreeView.uniqueIdPoI >= 0) { //ensure that selectedLayers[0] isn't out of bounds if (selectedLayers[0] - FeatureSubLayerTreeView.uniqueIdPoI > prefabItemArray.arraySize - 1) { selectedLayers[0] = prefabItemArray.arraySize - 1 + FeatureSubLayerTreeView.uniqueIdPoI; } SelectionIndex = selectedLayers[0]; var layerProperty = prefabItemArray.GetArrayElementAtIndex(SelectionIndex - FeatureSubLayerTreeView.uniqueIdPoI); layerProperty.isExpanded = true; var subLayerCoreOptions = layerProperty.FindPropertyRelative("coreOptions"); bool isLayerActive = subLayerCoreOptions.FindPropertyRelative("isActive").boolValue; if (!isLayerActive) { GUI.enabled = false; } DrawLayerLocationPrefabProperties(layerProperty, property); if (!isLayerActive) { GUI.enabled = true; } } else { GUILayout.Space(15); GUILayout.Label("Select a visualizer to see properties"); } }
public ReplaceUISpriteTreeView(TreeViewState state, MultiColumnHeader multicolumnHeader, TreeModel <ReplaceUISpriteTreeElement> model) : base(state, multicolumnHeader, model) { rowHeight = 20; columnIndexForTreeFoldouts = 2; showAlternatingRowBackgrounds = true; showBorder = true; customFoldoutYOffset = (rowHeight - EditorGUIUtility.singleLineHeight) * 0.5f; extraSpaceBeforeIconAndLabel = 18f; Reload(); }
public ActionResult GetCheckTree() { var moduleList = _meun.GetMenuList(); #region GetmoduleListTree List <TreeModel> moduleListTreeList = new List <TreeModel>(); foreach (var item in moduleList) { TreeModel node = new TreeModel(); node.id = item.F_ModuleId; node.text = item.F_FullName; node.value = item.F_EnCode; node.showcheck = true; node.checkstate = 0; node.isexpand = true; node.icon = item.F_Icon; node.parentId = item.F_ParentId; moduleListTreeList.Add(node); } #endregion #region GetButtonCheckTree //var buttonList = moduleIBLL.GetButtonCheckTree(); List <TreeModel> buttonListTreeList = new List <TreeModel>(); foreach (var module in moduleList) { TreeModel node = new TreeModel(); node.id = module.F_ModuleId + "_luo_moduleId"; node.text = module.F_FullName; node.value = module.F_EnCode; node.showcheck = true; node.checkstate = 0; node.isexpand = true; node.icon = module.F_Icon; node.parentId = module.F_ParentId + "_luo_moduleId"; if (module.F_Target != "expand") { List <Sys_ModuleButton> buttonList = _but.GetButtonList(module.F_ModuleId).ToList(); if (buttonList.Count > 0) { buttonListTreeList.Add(node); } foreach (var button in buttonList) { TreeModel buttonNode = new TreeModel(); buttonNode.id = button.ModuleButtonId; buttonNode.text = button.FullName; buttonNode.value = button.EnCode; buttonNode.showcheck = true; buttonNode.checkstate = 0; buttonNode.isexpand = true; buttonNode.icon = "fa fa-wrench"; buttonNode.parentId = (button.ParentId == "0" ? button.ModuleId + "_luo_moduleId" : button.ParentId); buttonListTreeList.Add(buttonNode); } ; } else { buttonListTreeList.Add(node); } } #endregion #region GetColumnCheckTree List <TreeModel> columnListTreeList = new List <TreeModel>(); //var columnList = moduleIBLL.GetColumnCheckTree(); foreach (var module in moduleList) { TreeModel node = new TreeModel(); node.id = module.F_ModuleId + "_luo_moduleId"; node.text = module.F_FullName; node.value = module.F_EnCode; node.showcheck = true; node.checkstate = 0; node.isexpand = true; node.icon = module.F_Icon; node.parentId = module.F_ParentId + "_luo_moduleId"; if (module.F_Target != "expand") { List <Sys_ModuleColumn> columnList = this._col.GetColumnList(module.F_ModuleId).ToList(); if (columnList.Count > 0) { columnListTreeList.Add(node); } foreach (var column in columnList) { TreeModel columnNode = new TreeModel(); columnNode.id = column.ModuleColumnId; columnNode.text = column.FullName; columnNode.value = column.EnCode; columnNode.showcheck = true; columnNode.checkstate = 0; columnNode.isexpand = true; columnNode.icon = "fa fa-filter"; columnNode.parentId = column.ModuleId + "_luo_moduleId"; columnListTreeList.Add(columnNode); } ; } else { columnListTreeList.Add(node); } } #endregion var mList = moduleListTreeList.ToTree(); var bList = buttonListTreeList.ToTree(); var cList = columnListTreeList.ToTree(); var jsonData = new { moduleList = mList, buttonList = bList, columnList = cList }; return(this.Success(jsonData)); }