5 namespace Search
.Pages
{
7 public class Base
: EventBox
{
9 private static Gdk
.Pixbuf arrow
= Beagle
.Images
.GetPixbuf ("tip-arrow.png");
11 Gtk
.Fixed fixed_widget
;
18 fixed_widget
= new Fixed ();
19 fixed_widget
.HasWindow
= true;
22 table
= new Gtk
.Table (1, 2, false);
23 table
.RowSpacing
= table
.ColumnSpacing
= 12;
25 headerIcon
= new Gtk
.Image ();
26 headerIcon
.Yalign
= 0.0f
;
27 table
.Attach (headerIcon
, 0, 1, 0, 1,
28 0, Gtk
.AttachOptions
.Fill
,
31 header
= new Gtk
.Label ();
32 header
.SetAlignment (0.0f
, 0.5f
);
33 table
.Attach (header
, 1, 2, 0, 1,
34 Gtk
.AttachOptions
.Expand
| Gtk
.AttachOptions
.Fill
,
35 Gtk
.AttachOptions
.Fill
,
38 fixed_widget
.Add (table
);
39 fixed_widget
.ShowAll ();
42 protected override void OnRealized ()
45 ModifyBg (Gtk
.StateType
.Normal
, Style
.Base (Gtk
.StateType
.Normal
));
48 public Gdk
.Pixbuf HeaderIcon
{
49 set { headerIcon.Pixbuf = value; }
52 public string HeaderIconStock
{
53 set { headerIcon.SetFromStock (value, Gtk.IconSize.Dnd); }
56 public string HeaderMarkup
{
57 set { header.Markup = value; }
60 public void Append (string tip
)
62 uint row
= table
.NRows
;
66 image
= new Gtk
.Image (arrow
);
70 table
.Attach (image
, 0, 1, row
, row
+ 1,
71 Gtk
.AttachOptions
.Fill
,
72 Gtk
.AttachOptions
.Fill
,
75 label
= new Gtk
.Label ();
77 label
.SetAlignment (0.0f
, 0.5f
);
78 label
.LineWrap
= true;
79 label
.ModifyFg (Gtk
.StateType
.Normal
, label
.Style
.Foreground (Gtk
.StateType
.Insensitive
));
81 table
.Attach (label
, 1, 2, row
, row
+ 1,
82 Gtk
.AttachOptions
.Expand
| Gtk
.AttachOptions
.Fill
,
87 public void Append (Gtk
.Widget widget
)
89 uint row
= table
.NRows
;
91 table
.Attach (widget
, 1, 2, row
, row
+ 1, 0, 0, 0, 0);
94 protected override void OnSizeRequested (ref Gtk
.Requisition req
)
96 req
= table
.SizeRequest ();
99 protected override void OnSizeAllocated (Gdk
.Rectangle allocation
)
101 base.OnSizeAllocated (allocation
);
103 Gtk
.Requisition tableReq
= table
.ChildRequisition
;
104 allocation
.X
= Math
.Max ((allocation
.Width
- tableReq
.Width
) / 2, 0);
105 allocation
.Y
= Math
.Max ((allocation
.Height
- tableReq
.Height
) / 2, 0);
106 allocation
.Width
= tableReq
.Width
;
107 allocation
.Height
= tableReq
.Height
;
108 table
.SizeAllocate (allocation
);