Do not add duplicate tags. At least makes sense in beagle.
[beagle.git] / search / ConversationCategory.cs
blob92eba9d9245c47a212df7e2410dd55ceb460492a
1 using Gtk;
2 using Gdk;
3 using System;
4 using System.Collections;
6 namespace Search {
8 public class ConversationCategory : Category {
10 Gtk.SizeGroup col1, col2, col3;
12 public ConversationCategory (Tiles.TileGroupInfo info) : base (info, 1)
14 col1 = new Gtk.SizeGroup (Gtk.SizeGroupMode.Horizontal);
15 col2 = new Gtk.SizeGroup (Gtk.SizeGroupMode.Horizontal);
16 col3 = new Gtk.SizeGroup (Gtk.SizeGroupMode.Horizontal);
19 protected override void OnAdded (Gtk.Widget widget)
21 base.OnAdded (widget);
23 Tiles.TileFlat tile = widget as Tiles.TileFlat;
24 if (tile != null) {
25 col1.AddWidget (tile.SubjectLabel);
26 col2.AddWidget (tile.FromLabel);
27 col3.AddWidget (tile.DateLabel);
31 protected override void OnSizeRequested (ref Requisition req)
33 Requisition headerReq, tileReq;
35 headerReq = header.SizeRequest ();
37 tileReq.Width = tileReq.Height = 0;
38 foreach (Widget w in AllTiles) {
39 tileReq = w.SizeRequest ();
40 req.Width = Math.Max (req.Width, tileReq.Width);
41 req.Height = Math.Max (req.Height, tileReq.Height);
44 req.Height = (Expanded) ?
45 headerReq.Height + PageSize * tileReq.Height :
46 headerReq.Height + 2;
48 req.Width = Math.Max (headerReq.Width + headerReq.Height,
49 tileReq.Width + 2 * headerReq.Height);
51 req.Width += (int)(2 * BorderWidth);
52 req.Height += (int)(2 * BorderWidth);
55 protected override void OnSizeAllocated (Rectangle allocation)
57 Requisition headerReq;
58 Rectangle childAlloc;
60 base.OnSizeAllocated (allocation);
62 headerReq = header.ChildRequisition;
64 childAlloc.X = allocation.X + (int)BorderWidth + headerReq.Height;
65 childAlloc.Width = allocation.Width - (int)BorderWidth - headerReq.Height;
66 childAlloc.Y = allocation.Y + (int)BorderWidth;
67 childAlloc.Height = headerReq.Height;
68 header.Allocation = childAlloc;
70 childAlloc.X += headerReq.Height;
71 childAlloc.Width -= headerReq.Height;
72 foreach (Widget w in VisibleTiles) {
73 childAlloc.Y += childAlloc.Height;
74 childAlloc.Height = w.ChildRequisition.Height;
75 w.Allocation = childAlloc;