blob: d43c6b1a3f00f686caa31709b272d49845a8db33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using Gorilla.Commons.Utility.Core;
using Gorilla.Commons.Utility.Extensions;
using XPExplorerBar;
namespace MoMoney.Presentation.Presenters
{
public interface IExpandoBuilder : IBuilder<Expando>
{
IExpandoBuilder named(string name);
IExpandoBuilder with_item(IExpandoItemBuilder builder);
}
public class ExpandoBuilder : IExpandoBuilder
{
readonly List<IExpandoItemBuilder> builders = new List<IExpandoItemBuilder>();
string the_name = "";
public IExpandoBuilder named(string name)
{
the_name = name;
return this;
}
public IExpandoBuilder with_item(IExpandoItemBuilder builder)
{
builders.Add(builder);
return this;
}
public Expando build()
{
var pane = new Expando {};
((ISupportInitialize) (pane)).BeginInit();
pane.SuspendLayout();
pane.Anchor = (AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right;
pane.Animate = true;
pane.AutoLayout = true;
pane.Items.AddRange(create_items());
pane.Name = "ux_" + the_name;
pane.SpecialGroup = true;
pane.Text = the_name;
((ISupportInitialize) (pane)).EndInit();
pane.ResumeLayout(false);
return pane;
}
TaskItem[] create_items()
{
var items = new List<TaskItem>();
builders.each(x => items.Add(x.build()));
return items.ToArray();
}
}
}
|