当前位置: 首页>>代码示例>>C#>>正文


C# TreeModel.GetPath方法代码示例

本文整理汇总了C#中TreeModel.GetPath方法的典型用法代码示例。如果您正苦于以下问题:C# TreeModel.GetPath方法的具体用法?C# TreeModel.GetPath怎么用?C# TreeModel.GetPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TreeModel的用法示例。


在下文中一共展示了TreeModel.GetPath方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderIcon

		void RenderIcon (TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter) 
		{
			var pixbufCellRenderer = (CellRendererPixbuf)cell;
			if (model.IterHasChild (iter)) {
				pixbufCellRenderer.Pixbuf = ImageService.GetPixbuf (((TreeView)col.TreeView).GetRowExpanded (model.GetPath (iter)) ? MonoDevelop.Ide.Gui.Stock.OpenFolder : MonoDevelop.Ide.Gui.Stock.ClosedFolder, IconSize.Menu);
			} else {
				pixbufCellRenderer.Pixbuf = ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Property, IconSize.Menu);
			}
		}
开发者ID:yayanyang,项目名称:monodevelop,代码行数:9,代码来源:CSharpFormattingProfileDialog.cs

示例2: OnSetCellData

 public void OnSetCellData(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter)
 {
     TreePath path = model.GetPath(iter);
     int rowNo = path.Indices[0];
     int colNo;
     if (colLookup.TryGetValue(cell, out colNo))
     {
         object dataVal = this.DataSource.Rows[rowNo][colNo];
         Type dataType = dataVal.GetType(); //  DataSource.Columns[colNo].DataType;
         string text;
         if (dataType == typeof(float) ||
             dataType == typeof(double))
             text = String.Format("{0:" + NumericFormat + "}", dataVal);
         else if (dataType == typeof(DateTime))
             text = String.Format("{0:d}", dataVal);
         else
             text = dataVal.ToString();
         (cell as CellRendererText).Text = text;
     }
 }
开发者ID:hut104,项目名称:ApsimX,代码行数:20,代码来源:GridView.cs

示例3: IterPrev

		//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);
		}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:6,代码来源:CollectionEditor.cs

示例4: SortFunction

        protected override int SortFunction(TreeModel model, TreeIter a, TreeIter b)
        {
            object objecta, objectb;
            TimelineEvent tna, tnb;

            if (model == null)
                return 0;

            objecta = model.GetValue (a, 0);
            objectb = model.GetValue (b, 0);

            if (objecta == null && objectb == null) {
                return 0;
            } else if (objecta == null) {
                return -1;
            } else if (objectb == null) {
                return 1;
            }

            // Dont't store categories
            if (objecta is EventType && objectb is EventType) {
                return int.Parse (model.GetPath (a).ToString ())
                - int.Parse (model.GetPath (b).ToString ());
            } else if (objecta is TimelineEvent && objectb is TimelineEvent) {
                tna = objecta as TimelineEvent;
                tnb = objectb as TimelineEvent;
                switch (tna.EventType.SortMethod) {
                case(SortMethodType.SortByName):
                    return String.Compare (tna.Name, tnb.Name);
                case(SortMethodType.SortByStartTime):
                    return (tna.Start - tnb.Start).MSeconds;
                case(SortMethodType.SortByStopTime):
                    return (tna.Stop - tnb.Stop).MSeconds;
                case(SortMethodType.SortByDuration):
                    return (tna.Duration - tnb.Duration).MSeconds;
                default:
                    return 0;
                }
            } else {
                return 0;
            }
        }
开发者ID:GNOME,项目名称:longomatch,代码行数:42,代码来源:PlaysTreeView.cs

示例5: OnSetCellData

 public void OnSetCellData(TreeViewColumn col, CellRenderer cell, TreeModel model, TreeIter iter)
 {
     TreePath startPath;
     TreePath endPath;
     TreePath path = model.GetPath(iter);
     int rowNo = path.Indices[0];
     // This gets called a lot, even when it seemingly isn't necessary.
     if (numberLockedCols == 0 && gridview.GetVisibleRange(out startPath, out endPath) && (rowNo < startPath.Indices[0] || rowNo > endPath.Indices[0]))
         return;
     int colNo;
     string text = String.Empty;
     if (colLookup.TryGetValue(cell, out colNo) && rowNo < this.DataSource.Rows.Count && colNo < this.DataSource.Columns.Count)
     {
         object dataVal = this.DataSource.Rows[rowNo][colNo];
         Type dataType = dataVal.GetType();
         if (dataType == typeof(DBNull))
             text = String.Empty;
         else if (NumericFormat != null && ((dataType == typeof(float) && !float.IsNaN((float)dataVal)) ||
             (dataType == typeof(double) && !Double.IsNaN((double)dataVal))))
             text = String.Format("{0:" + NumericFormat + "}", dataVal);
         else if (dataType == typeof(DateTime))
             text = String.Format("{0:d}", dataVal);
         if (col.TreeView == gridview)  // Currently not handling booleans and lists in the "fixed" column grid
         {
             if (dataType == typeof(Boolean))
             {
                 CellRendererToggle toggleRend = col.CellRenderers[1] as CellRendererToggle;
                 if (toggleRend != null)
                 {
                     toggleRend.Active = (Boolean)dataVal;
                     toggleRend.Activatable = true;
                     cell.Visible = false;
                     col.CellRenderers[2].Visible = false;
                     toggleRend.Visible = true;
                     return;
                 }
             }
             else
             {   // This assumes that combobox grid cells are based on the "string" type
                 ListStore store;
                 if (comboLookup.TryGetValue(new Tuple<int, int>(rowNo, colNo), out store))
                 {
                     CellRendererCombo comboRend = col.CellRenderers[2] as CellRendererCombo;
                     if (comboRend != null)
                     {
                         comboRend.Model = store;
                         comboRend.TextColumn = 0;
                         comboRend.Editable = true;
                         comboRend.HasEntry = false;
                         cell.Visible = false;
                         col.CellRenderers[1].Visible = false;
                         comboRend.Visible = true;
                         comboRend.Text = dataVal.ToString();
                         return;
                     }
                 }
                 text = dataVal.ToString();
             }
             col.CellRenderers[1].Visible = false;
             col.CellRenderers[2].Visible = false;
         }
     }
     cell.Visible = true;
     (cell as CellRendererText).Text = text;
 }
开发者ID:hol353,项目名称:ApsimX,代码行数:65,代码来源:GridView.cs

示例6: FilterFunc

            protected bool FilterFunc(TreeModel model,
						   TreeIter iter)
            {
                TreePath path = model.GetPath (iter);
                if (path.Depth <= 2)
                  {
                      return true;
                  }
                if (path.Indices[1] != OTHER_CATEGORY_IDX
                    && path.Indices[1] !=
                    LIGHTNING_CATEGORY_IDX)
                  {
                      path.Up ();
                      gamesView.ExpandRow (path, false);
                  }

                string filterstr = filterEntry.Text.Trim ();
                if (filterstr.Length == 0)
                    return true;

                string str =
                    model.GetValue (iter, 0) as string;

                if (str.IndexOf (filterstr.ToLower ()) >= 0)
                    return true;

                return false;
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:28,代码来源:ObservableGamesWidget.cs

示例7: FilterPhotos

 private bool FilterPhotos(TreeModel model, TreeIter iter)
 {
     int index = model.GetPath(iter).Indices[0];
       Photo p = (Photo) _photos[index];
       return FilterPhoto(p);
 }
开发者ID:joshuacox,项目名称:dfo,代码行数:6,代码来源:DeskFlickrUI.cs

示例8: IdxCellDataFunc

            protected void IdxCellDataFunc(TreeViewColumn col,
							CellRenderer r,
							TreeModel model,
							TreeIter iter)
            {
                CellRendererText renderer =
                    (CellRendererText) r;
                TreePath path = model.GetPath (iter);
                renderer.Markup =
                    "<b>" + (path.Indices[0] + 1) +
                    ".</b>";
            }
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:12,代码来源:GamesListWidget.cs

示例9: FilterTags

 private bool FilterTags(TreeModel model, TreeIter iter)
 {
     int index = model.GetPath(iter).Indices[0];
       string tag = (string) _tags[index];
       string query = entry2.Text;
       System.StringComparison comp = System.StringComparison.OrdinalIgnoreCase;
       return (tag.IndexOf(query, comp) > -1);
 }
开发者ID:joshuacox,项目名称:dfo,代码行数:8,代码来源:PhotoEditorUI.cs

示例10: RenderNumberCell

	/* Cell Renderers */

	private void RenderNumberCell (TreeViewColumn column, CellRenderer cell, TreeModel treeModel, TreeIter iter) {
		(cell as CellRendererText).Text = (Util.PathToInt(treeModel.GetPath(iter)) + 1).ToString();
	}
开发者ID:GNOME,项目名称:gnome-subtitles,代码行数:5,代码来源:SubtitleView.cs

示例11: CategoryComboBoxDataFunc

        void CategoryComboBoxDataFunc(CellLayout layout, CellRenderer renderer, TreeModel model, TreeIter iter)
        {
            var crt = renderer as CellRendererText;
            var catName = model.GetValue (iter, 0) as string;
            var backend = GtkApplication.Instance.Backend;

            int taskCount = 0;
            if (model.GetPath (iter).Indices [0] == TreePath.NewFirst ().Indices [0])
                taskCount = backend.Tasks.Count (t => !t.IsComplete);
            else {
                var cat = backend.Categories.SingleOrDefault (c => c.Name == catName);
                if (cat != null)
                    taskCount = cat.Count (t => !t.IsComplete);
                else
                    catName = null;
            }

            if (catName != null)
                crt.Text = string.Format ("{0} ({1})", catName, taskCount);
            else
                crt.Text = "unknown";
        }
开发者ID:mono-soc-2012,项目名称:Tasque,代码行数:22,代码来源:TaskWindow.cs


注:本文中的TreeModel.GetPath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。