Show total number of results for google driver too. Helps to know if my query resulte...
[beagle.git] / search / Pages / Base.cs
blobee1ee612b8870d47a2b7918fadcf2c1728968765
1 using Gtk;
2 using System;
3 using Mono.Unix;
5 namespace Search.Pages {
7 public class Base : EventBox {
9 static Gdk.Pixbuf arrow;
11 static Base ()
13 arrow = Beagle.Images.GetPixbuf ("tip-arrow.png");
16 Gtk.Fixed fixed_widget;
17 Gtk.Table table;
18 Gtk.Image headerIcon;
19 Gtk.Label header;
21 public Base ()
23 fixed_widget = new Fixed ();
24 fixed_widget.HasWindow = true;
25 Add (fixed_widget);
27 table = new Gtk.Table (1, 2, false);
28 table.RowSpacing = table.ColumnSpacing = 12;
30 headerIcon = new Gtk.Image ();
31 headerIcon.Yalign = 0.0f;
32 table.Attach (headerIcon, 0, 1, 0, 1,
33 0, Gtk.AttachOptions.Fill,
34 0, 0);
36 header = new Gtk.Label ();
37 header.SetAlignment (0.0f, 0.5f);
38 table.Attach (header, 1, 2, 0, 1,
39 Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
40 Gtk.AttachOptions.Fill,
41 0, 0);
43 fixed_widget.Add (table);
44 fixed_widget.ShowAll ();
47 protected override void OnRealized ()
49 base.OnRealized ();
50 ModifyBg (Gtk.StateType.Normal, Style.Base (Gtk.StateType.Normal));
53 public Gdk.Pixbuf HeaderIcon {
54 set {
55 headerIcon.Pixbuf = value;
59 public string HeaderIconStock {
60 set {
61 headerIcon.SetFromStock (value, Gtk.IconSize.Dnd);
65 public string HeaderMarkup {
66 set {
67 header.Markup = value;
71 public void Append (string tip)
73 uint row = table.NRows;
74 Gtk.Image image;
75 Gtk.Label label;
77 image = new Gtk.Image (arrow);
78 image.Yalign = 0.0f;
79 image.Xalign = 1.0f;
80 image.Show ();
81 table.Attach (image, 0, 1, row, row + 1,
82 Gtk.AttachOptions.Fill,
83 Gtk.AttachOptions.Fill,
84 0, 0);
86 label = new Gtk.Label ();
87 label.Markup = tip;
88 label.SetAlignment (0.0f, 0.5f);
89 label.LineWrap = true;
90 label.ModifyFg (Gtk.StateType.Normal, label.Style.Foreground (Gtk.StateType.Insensitive));
91 label.Show ();
92 table.Attach (label, 1, 2, row, row + 1,
93 Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
94 0, 0, 0);
98 public void Append (Gtk.Widget widget)
100 uint row = table.NRows;
102 table.Attach (widget, 1, 2, row, row + 1, 0, 0, 0, 0);
105 protected override void OnSizeRequested (ref Gtk.Requisition req)
107 req = table.SizeRequest ();
110 protected override void OnSizeAllocated (Gdk.Rectangle allocation)
112 base.OnSizeAllocated (allocation);
114 Gtk.Requisition tableReq = table.ChildRequisition;
115 allocation.X = Math.Max ((allocation.Width - tableReq.Width) / 2, 0);
116 allocation.Y = Math.Max ((allocation.Height - tableReq.Height) / 2, 0);
117 allocation.Width = tableReq.Width;
118 allocation.Height = tableReq.Height;
119 table.SizeAllocate (allocation);