For writable files, if previously attributes were stored in sqlite db, remove it...
[beagle.git] / search / Pages / Base.cs
blobdd798bb833b5b1077c753e9e779063c38887213b
1 using Gtk;
2 using System;
3 using Mono.Unix;
5 namespace Search.Pages {
7 public class Base : Fixed {
9 static Gdk.Pixbuf arrow;
11 static Base ()
13 arrow = Beagle.Images.GetPixbuf ("tip-arrow.png");
16 Gtk.Table table;
17 Gtk.Image headerIcon;
18 Gtk.Label header;
20 public Base ()
22 HasWindow = true;
24 table = new Gtk.Table (1, 2, false);
25 table.RowSpacing = table.ColumnSpacing = 12;
27 headerIcon = new Gtk.Image ();
28 headerIcon.Yalign = 0.0f;
29 table.Attach (headerIcon, 0, 1, 0, 1,
30 0, Gtk.AttachOptions.Fill,
31 0, 0);
33 header = new Gtk.Label ();
34 header.SetAlignment (0.0f, 0.5f);
35 table.Attach (header, 1, 2, 0, 1,
36 Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
37 Gtk.AttachOptions.Fill,
38 0, 0);
40 table.ShowAll ();
41 Add (table);
44 protected override void OnRealized ()
46 base.OnRealized ();
47 ModifyBg (Gtk.StateType.Normal, Style.Base (Gtk.StateType.Normal));
50 public Gdk.Pixbuf HeaderIcon {
51 set {
52 headerIcon.Pixbuf = value;
56 public string HeaderIconStock {
57 set {
58 headerIcon.SetFromStock (value, Gtk.IconSize.Dnd);
62 public string HeaderMarkup {
63 set {
64 header.Markup = value;
68 public void Append (string tip)
70 uint row = table.NRows;
71 Gtk.Image image;
72 Gtk.Label label;
74 image = new Gtk.Image (arrow);
75 image.Yalign = 0.0f;
76 image.Xalign = 1.0f;
77 image.Show ();
78 table.Attach (image, 0, 1, row, row + 1,
79 Gtk.AttachOptions.Fill,
80 Gtk.AttachOptions.Fill,
81 0, 0);
83 label = new Gtk.Label ();
84 label.Markup = tip;
85 label.SetAlignment (0.0f, 0.5f);
86 label.LineWrap = true;
87 label.ModifyFg (Gtk.StateType.Normal, label.Style.Foreground (Gtk.StateType.Insensitive));
88 label.Show ();
89 table.Attach (label, 1, 2, row, row + 1,
90 Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
91 0, 0, 0);
95 public void Append (Gtk.Widget widget)
97 uint row = table.NRows;
99 table.Attach (widget, 1, 2, row, row + 1, 0, 0, 0, 0);
102 protected override void OnSizeRequested (ref Gtk.Requisition req)
104 req = table.SizeRequest ();
107 protected override void OnSizeAllocated (Gdk.Rectangle allocation)
109 base.OnSizeAllocated (allocation);
111 Gtk.Requisition tableReq = table.ChildRequisition;
112 allocation.X = Math.Max ((allocation.Width - tableReq.Width) / 2, 0);
113 allocation.Y = Math.Max ((allocation.Height - tableReq.Height) / 2, 0);
114 allocation.Width = tableReq.Width;
115 allocation.Height = tableReq.Height;
116 table.SizeAllocate (allocation);