Hit.cs: Remove FIXME by using binary search while searching properties.
[beagle.git] / search / ConversationCategory.cs
blob3d93a7d2af9cf27f46304b1b45f2f667ffcf5e68
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 (string name, int rows) : base (name, rows, 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 = headerReq.Height + PageSize * tileReq.Height;
45 req.Width = Math.Max (headerReq.Width + headerReq.Height,
46 tileReq.Width + 2 * headerReq.Height);
48 req.Width += (int)(2 * BorderWidth);
49 req.Height += (int)(2 * BorderWidth);
52 protected override void OnSizeAllocated (Rectangle allocation)
54 Requisition headerReq;
55 Rectangle childAlloc;
57 base.OnSizeAllocated (allocation);
59 headerReq = header.ChildRequisition;
61 childAlloc.X = allocation.X + (int)BorderWidth + headerReq.Height;
62 childAlloc.Width = allocation.Width - (int)BorderWidth - headerReq.Height;
63 childAlloc.Y = allocation.Y + (int)BorderWidth;
64 childAlloc.Height = headerReq.Height;
65 header.Allocation = childAlloc;
67 childAlloc.X += headerReq.Height;
68 childAlloc.Width -= headerReq.Height;
69 foreach (Widget w in VisibleTiles) {
70 childAlloc.Y += childAlloc.Height;
71 childAlloc.Height = w.ChildRequisition.Height;
72 w.Allocation = childAlloc;