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

« back to all changes in this revision

Viewing changes to external/xwt/Xwt/Xwt/Expander.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
using Xwt.Backends;
 
3
using System.ComponentModel;
 
4
using Xwt.Drawing;
 
5
 
 
6
namespace Xwt
 
7
{
 
8
        public class Expander: Widget
 
9
        {
 
10
                EventHandler expandChanged;
 
11
                Xwt.Widget child;
 
12
 
 
13
                protected new class WidgetBackendHost: Widget.WidgetBackendHost, IExpandEventSink
 
14
                {
 
15
                        public void ExpandChanged ()
 
16
                        {
 
17
                                ((Expander)Parent).OnExpandChanged (EventArgs.Empty);
 
18
                        }
 
19
                }
 
20
                
 
21
                protected override BackendHost CreateBackendHost ()
 
22
                {
 
23
                        return new WidgetBackendHost ();
 
24
                }
 
25
                
 
26
                IExpanderBackend Backend {
 
27
                        get { return (IExpanderBackend)BackendHost.Backend; }
 
28
                }
 
29
 
 
30
                public Expander ()
 
31
                {
 
32
                }
 
33
 
 
34
                public string Label {
 
35
                        get {
 
36
                                return Backend.Label;
 
37
                        }
 
38
                        set {
 
39
                                Backend.Label = value;
 
40
                        }
 
41
                }
 
42
 
 
43
                public bool Expanded {
 
44
                        get {
 
45
                                return Backend.Expanded;
 
46
                        }
 
47
                        set {
 
48
                                Backend.Expanded = value;
 
49
                        }
 
50
                }
 
51
 
 
52
                public new Widget Content {
 
53
                        get { return child; }
 
54
                        set {
 
55
                                if (child != null)
 
56
                                        UnregisterChild (child);
 
57
                                child = value;
 
58
                                if (child != null)
 
59
                                        RegisterChild (child);
 
60
                                Backend.SetContent ((IWidgetBackend)GetBackend (child));
 
61
                                OnPreferredSizeChanged ();
 
62
                        }
 
63
                }
 
64
 
 
65
                protected void OnExpandChanged (EventArgs args)
 
66
                {
 
67
                        if (expandChanged != null)
 
68
                                expandChanged (this, args);
 
69
                }
 
70
 
 
71
                public event EventHandler ExpandChanged {
 
72
                        add {
 
73
                                BackendHost.OnBeforeEventAdd (ExpandEvent.ExpandChanged, expandChanged);
 
74
                                expandChanged += value;
 
75
                        }
 
76
                        remove {
 
77
                                expandChanged -= value;
 
78
                                BackendHost.OnAfterEventRemove (ExpandEvent.ExpandChanged, expandChanged);
 
79
                        }
 
80
                }
 
81
        }
 
82
}
 
83