Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/xwt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLluis Sanchez <lluis@xamarin.com>2013-01-22 16:35:38 +0400
committerLluis Sanchez <lluis@xamarin.com>2013-01-22 16:35:57 +0400
commite6a0b388d3aff2a90e26af61277cc37bc1110e99 (patch)
tree4529c179dad1ae4cf46fabbf73771d03795c0ed3 /Xwt.Gtk/Xwt.GtkBackend/TreeViewBackend.cs
parent9576fbff067ce44f650cfb574a93ee5f476d4dc8 (diff)
Add RowActivated events to ListView and TreeView
Diffstat (limited to 'Xwt.Gtk/Xwt.GtkBackend/TreeViewBackend.cs')
-rw-r--r--Xwt.Gtk/Xwt.GtkBackend/TreeViewBackend.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/Xwt.Gtk/Xwt.GtkBackend/TreeViewBackend.cs b/Xwt.Gtk/Xwt.GtkBackend/TreeViewBackend.cs
index fa2668eb..31a0cc95 100644
--- a/Xwt.Gtk/Xwt.GtkBackend/TreeViewBackend.cs
+++ b/Xwt.Gtk/Xwt.GtkBackend/TreeViewBackend.cs
@@ -33,6 +33,38 @@ namespace Xwt.GtkBackend
{
Gtk.TreePath autoExpandPath;
uint expandTimer;
+
+ protected new ITreeViewEventSink EventSink {
+ get { return (ITreeViewEventSink)base.EventSink; }
+ }
+
+ public override void EnableEvent (object eventId)
+ {
+ base.EnableEvent (eventId);
+ if (eventId is TreeViewEvent) {
+ if (((TreeViewEvent)eventId) == TreeViewEvent.RowActivated)
+ Widget.RowActivated += HandleRowActivated;
+ }
+ }
+
+ public override void DisableEvent (object eventId)
+ {
+ base.DisableEvent (eventId);
+ if (eventId is TreeViewEvent) {
+ if (((TreeViewEvent)eventId) == TreeViewEvent.RowActivated)
+ Widget.RowActivated -= HandleRowActivated;
+ }
+ }
+
+ void HandleRowActivated (object o, Gtk.RowActivatedArgs args)
+ {
+ Gtk.TreeIter it;
+ if (Widget.Model.GetIter (out it, args.Path)) {
+ ApplicationContext.InvokeUserCode (delegate {
+ EventSink.OnRowActivated (new IterPos (-1, it));
+ });
+ }
+ }
protected override void OnSetDragTarget (Gtk.TargetEntry[] table, Gdk.DragAction actions)
{