5 namespace Search
.Pages
{
7 public class Base
: Fixed
{
9 static Gdk
.Pixbuf arrow
;
13 arrow
= Beagle
.Images
.GetPixbuf ("tip-arrow.png");
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
,
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
,
44 protected override void OnRealized ()
47 ModifyBg (Gtk
.StateType
.Normal
, Style
.Base (Gtk
.StateType
.Normal
));
50 public Gdk
.Pixbuf HeaderIcon
{
52 headerIcon
.Pixbuf
= value;
56 public string HeaderIconStock
{
58 headerIcon
.SetFromStock (value, Gtk
.IconSize
.Dnd
);
62 public string HeaderMarkup
{
64 header
.Markup
= value;
68 public void Append (string tip
)
70 uint row
= table
.NRows
;
74 image
= new Gtk
.Image (arrow
);
78 table
.Attach (image
, 0, 1, row
, row
+ 1,
79 Gtk
.AttachOptions
.Fill
,
80 Gtk
.AttachOptions
.Fill
,
83 label
= new Gtk
.Label ();
85 label
.SetAlignment (0.0f
, 0.5f
);
86 label
.LineWrap
= true;
87 label
.ModifyFg (Gtk
.StateType
.Normal
, label
.Style
.Foreground (Gtk
.StateType
.Insensitive
));
89 table
.Attach (label
, 1, 2, row
, row
+ 1,
90 Gtk
.AttachOptions
.Expand
| Gtk
.AttachOptions
.Fill
,
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
);