5 namespace Search
.Pages
{
7 public class Base
: EventBox
{
9 static Gdk
.Pixbuf arrow
;
13 arrow
= Beagle
.Images
.GetPixbuf ("tip-arrow.png");
16 Gtk
.Fixed fixed_widget
;
23 fixed_widget
= new Fixed ();
24 fixed_widget
.HasWindow
= true;
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
,
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
,
43 fixed_widget
.Add (table
);
44 fixed_widget
.ShowAll ();
47 protected override void OnRealized ()
50 ModifyBg (Gtk
.StateType
.Normal
, Style
.Base (Gtk
.StateType
.Normal
));
53 public Gdk
.Pixbuf HeaderIcon
{
55 headerIcon
.Pixbuf
= value;
59 public string HeaderIconStock
{
61 headerIcon
.SetFromStock (value, Gtk
.IconSize
.Dnd
);
65 public string HeaderMarkup
{
67 header
.Markup
= value;
71 public void Append (string tip
)
73 uint row
= table
.NRows
;
77 image
= new Gtk
.Image (arrow
);
81 table
.Attach (image
, 0, 1, row
, row
+ 1,
82 Gtk
.AttachOptions
.Fill
,
83 Gtk
.AttachOptions
.Fill
,
86 label
= new Gtk
.Label ();
88 label
.SetAlignment (0.0f
, 0.5f
);
89 label
.LineWrap
= true;
90 label
.ModifyFg (Gtk
.StateType
.Normal
, label
.Style
.Foreground (Gtk
.StateType
.Insensitive
));
92 table
.Attach (label
, 1, 2, row
, row
+ 1,
93 Gtk
.AttachOptions
.Expand
| Gtk
.AttachOptions
.Fill
,
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
);