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


C# TreeView.EnableModelDragSource方法代码示例

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


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

示例1: MakeRecentTree

		void MakeRecentTree ()
		{
		    targets =
			new Gtk.TargetEntry [] {
				new Gtk.TargetEntry ("STRING",
				Gtk.TargetFlags.App,
				(uint) Target.Text),
				new Gtk.TargetEntry ("text/plain",
				Gtk.TargetFlags.App,
				(uint) Target.Text),
				new Gtk.TargetEntry ("text/uri-list",
				Gtk.TargetFlags.App,
				(uint) Target.Uri),
				new Gtk.TargetEntry ("text/path-list",
				Gtk.TargetFlags.App,
				(uint) Target.Path),
			};

			tree = new RecentTreeView ();
			tree.HeadersVisible = true;
			tree.RulesHint = true;
			tree.RowActivated += OnRowActivated;
			tree.Selection.Mode = Gtk.SelectionMode.Multiple;
			tree.Selection.Changed += OnSelectionChanged;
			tree.ButtonPressEvent += OnTreeViewButtonPressed;
			tree.KeyPressEvent += OnTreeViewKeyPressed;
			tree.MotionNotifyEvent += OnTreeViewMotionNotify;
			tree.ButtonReleaseEvent += OnTreeViewButtonReleased;
			tree.DragDataGet += OnTreeViewDragDataGet;

			tree.EnableModelDragSource (Gdk.ModifierType.Button1Mask | Gdk.ModifierType.Button3Mask,
						    targets,
						    Gdk.DragAction.Move);

			Gtk.CellRenderer renderer;

			Gtk.TreeViewColumn title = new Gtk.TreeViewColumn ();
			title.Title = Catalog.GetString ("Note");
			title.MinWidth = 150; // Fix for bgo 575337 - "Matches" column causes notes name not to be shown. jjennings jul 13, 2011
			title.Sizing = Gtk.TreeViewColumnSizing.Autosize;
			title.Expand = true;
			title.Resizable = true;

			renderer = new Gtk.CellRendererPixbuf ();
			title.PackStart (renderer, false);
			title.AddAttribute (renderer, "pixbuf", 0 /* icon */);

			renderer = new Gtk.CellRendererText ();
			(renderer as Gtk.CellRendererText).Ellipsize =
				Pango.EllipsizeMode.End;
			title.PackStart (renderer, true);
			title.AddAttribute (renderer, "text", 1 /* title */);
			title.SortColumnId = 1; /* title */
			title.SortIndicator = false;
			title.Reorderable = false;
			title.SortOrder = Gtk.SortType.Ascending;

			tree.AppendColumn (title);

			Gtk.TreeViewColumn change = new Gtk.TreeViewColumn ();
			change.Title = Catalog.GetString ("Last Changed");
			change.Sizing = Gtk.TreeViewColumnSizing.Autosize;
			change.Resizable = false;

			renderer = new Gtk.CellRendererText ();
			renderer.Data ["xalign"] = 1.0;
			change.PackStart (renderer, false);
			change.AddAttribute (renderer, "text", 2 /* change date */);
			change.SortColumnId = 2; /* change date */
			change.SortIndicator = false;
			change.Reorderable = false;
			change.SortOrder = Gtk.SortType.Descending;

			tree.AppendColumn (change);
		}
开发者ID:MichaelAquilina,项目名称:tomboy,代码行数:75,代码来源:RecentChanges.cs


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