~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/xwt/Xwt.Gtk/Xwt.GtkBackend/ExpanderBackend.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using System;
 
2
 
 
3
using Xwt;
 
4
using Xwt.Engine;
 
5
using Xwt.Backends;
 
6
 
 
7
namespace Xwt.GtkBackend
 
8
{
 
9
        public class ExpanderBackend : WidgetBackend, IExpanderBackend
 
10
        {
 
11
                public ExpanderBackend ()
 
12
                {
 
13
                        Widget = new Gtk.Expander (string.Empty);
 
14
                        Widget.Show ();
 
15
                }
 
16
 
 
17
                protected new Gtk.Expander Widget {
 
18
                        get { return (Gtk.Expander)base.Widget; }
 
19
                        set { base.Widget = value; }
 
20
                }
 
21
                
 
22
                protected new IExpandEventSink EventSink {
 
23
                        get { return (IExpandEventSink)base.EventSink; }
 
24
                }
 
25
 
 
26
                public string Label {
 
27
                        get {
 
28
                                return Widget.Label;
 
29
                        }
 
30
                        set {
 
31
                                Widget.Label = value;
 
32
                        }
 
33
                }
 
34
 
 
35
                public bool Expanded {
 
36
                        get {
 
37
                                return Widget.Expanded;
 
38
                        }
 
39
                        set {
 
40
                                Widget.Expanded = value;
 
41
                        }
 
42
                }
 
43
 
 
44
                public void SetContent (IWidgetBackend child)
 
45
                {
 
46
                        Widget.Child = GetWidget (child);
 
47
                }
 
48
 
 
49
                public override void EnableEvent (object eventId)
 
50
                {
 
51
                        base.EnableEvent (eventId);
 
52
                        if (eventId is ExpandEvent) {
 
53
                                if ((ExpandEvent)eventId == ExpandEvent.ExpandChanged)
 
54
                                        Widget.Activated += HandleExpandedChanged;
 
55
                        }
 
56
                }
 
57
                
 
58
                public override void DisableEvent (object eventId)
 
59
                {
 
60
                        base.DisableEvent (eventId);
 
61
                        if (eventId is ExpandEvent) {
 
62
                                if ((ExpandEvent)eventId == ExpandEvent.ExpandChanged)
 
63
                                        Widget.Activated += HandleExpandedChanged;
 
64
                        }
 
65
                }
 
66
 
 
67
                void HandleExpandedChanged (object sender, EventArgs e)
 
68
                {
 
69
                        Toolkit.Invoke (delegate {
 
70
                                EventSink.ExpandChanged ();
 
71
                        });
 
72
                }
 
73
        }
 
74
}
 
75