~ubuntu-branches/ubuntu/jaunty/beagle/jaunty-security

« back to all changes in this revision

Viewing changes to search/Panes.cs

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2008-05-04 00:31:32 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20080504003132-2tkm5o8moo5952ri
Tags: 0.3.7-2ubuntu1
 * Merge from Debian unstable. (LP: #225746) Remaining Ubuntu changes:
  - debian/control:
    + Rename ice{weasel,dove}-beagle to {mozilla,thunderbird}-beagle and
      and update the dependencies accordingly.
    + Change Maintainer to Ubuntu Mono Team.
  - debian/rules:
    + Install the mozilla-beagle and thunderbird-beagle extensions.
  - ice{dove,weasel}.dirs:
    + Renamed to {mozilla,thunderbird}-beagle.dirs.
    + Fixed paths to point to usr/lib/{firefox,thunderbird}

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
using Gtk;
2
 
using Gdk;
3
 
using System;
4
 
using System.Collections;
5
 
 
6
 
namespace Search {
7
 
 
8
 
        public class Panes : Gtk.VPaned {
9
 
 
10
 
                Gtk.ScrolledWindow mainSW, detailsSW;
11
 
                WhiteBox main, details;
12
 
 
13
 
                public Panes ()
14
 
                {
15
 
                        Gtk.Viewport vp;
16
 
 
17
 
                        mainSW = new Gtk.ScrolledWindow ();
18
 
                        mainSW.SetPolicy (Gtk.PolicyType.Never, Gtk.PolicyType.Always);
19
 
                        mainSW.ShadowType = Gtk.ShadowType.In;
20
 
                        mainSW.SizeAllocated += MainResized;
21
 
                        Pack1 (mainSW, true, false);
22
 
 
23
 
                        vp = new Gtk.Viewport (null, null);
24
 
                        vp.ResizeMode = Gtk.ResizeMode.Parent;
25
 
                        vp.ShadowType = ShadowType.None;
26
 
                        mainSW.Add (vp);
27
 
                        vp.Show ();
28
 
 
29
 
                        main = new WhiteBox ();
30
 
                        vp.Add (main);
31
 
                        main.Show ();
32
 
 
33
 
                        detailsSW = new Gtk.ScrolledWindow ();
34
 
                        detailsSW.SetPolicy (Gtk.PolicyType.Never, Gtk.PolicyType.Never);
35
 
                        detailsSW.WidthRequest = 0;
36
 
                        detailsSW.NoShowAll = true;
37
 
                        detailsSW.ShadowType = Gtk.ShadowType.In;
38
 
                        Pack2 (detailsSW, false, false);
39
 
 
40
 
                        vp = new Gtk.Viewport (null, null);
41
 
                        vp.ShadowType = ShadowType.None;
42
 
                        detailsSW.Add (vp);
43
 
                        vp.Show ();
44
 
 
45
 
                        details = new WhiteBox ();
46
 
                        vp.Add (details);
47
 
                        details.Show ();
48
 
                }
49
 
 
50
 
                public Gtk.Widget MainContents {
51
 
                        get {
52
 
                                return main.Child;
53
 
                        }
54
 
                        set {
55
 
                                if (main.Child != null)
56
 
                                        main.Remove (main.Child);
57
 
                                if (value != null) {
58
 
                                        main.Add (value);
59
 
                                        if (value is Container)
60
 
                                                ((Container)value).FocusVadjustment = mainSW.Vadjustment;
61
 
                                }
62
 
                        }
63
 
                }
64
 
 
65
 
                public Gtk.Widget Details {
66
 
                        get {
67
 
                                return details.Child;
68
 
                        }
69
 
                        set {
70
 
                                if (details.Child != null)
71
 
                                        details.Remove (details.Child);
72
 
                                if (value != null)
73
 
                                        details.Add (value);
74
 
                        }
75
 
                }
76
 
 
77
 
                public void ToggleDetails (bool visible)
78
 
                {
79
 
                        if (visible)
80
 
                                detailsSW.Show ();
81
 
                        else
82
 
                                detailsSW.Hide ();
83
 
                }
84
 
 
85
 
                private void MainResized (object obj, Gtk.SizeAllocatedArgs args)
86
 
                {
87
 
                        // If the details pane pops up and covers the selected tile,
88
 
                        // fix it.
89
 
 
90
 
                        Gtk.Container mainChild = main.Child as Gtk.Container;
91
 
                        if (mainChild != null) {
92
 
                                Gtk.Widget focusChild = mainChild.FocusChild;
93
 
                                mainChild.FocusChild = null;
94
 
                                mainChild.FocusChild = focusChild;
95
 
                        }
96
 
                }
97
 
 
98
 
                public class WhiteBox : Gtk.EventBox
99
 
                {
100
 
                        public WhiteBox () : base ()
101
 
                        {
102
 
                                AppPaintable = true;
103
 
                        }
104
 
 
105
 
                        protected override bool OnExposeEvent (Gdk.EventExpose evt)
106
 
                        {
107
 
                                if (!IsDrawable)
108
 
                                        return false;
109
 
 
110
 
                                if (evt.Window == GdkWindow) {
111
 
                                        GdkWindow.DrawRectangle (Style.BaseGC (State), true,
112
 
                                                                 evt.Area.X, evt.Area.Y,
113
 
                                                                 evt.Area.Width, evt.Area.Height);
114
 
                                }
115
 
 
116
 
                                if (Child != null)
117
 
                                        PropagateExpose (Child, evt);
118
 
 
119
 
                                return false;
120
 
                        }
121
 
                }
122
 
        }
123
 
}