本文整理汇总了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);
}