-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSeg_Controller.cs
77 lines (69 loc) · 2.23 KB
/
Seg_Controller.cs
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Drawing;
using System.Collections.Generic;
using System.Xml.Serialization;
namespace FileIconDemo
{
public class Seg_Controller : Seg
{
public Boolean expanded = true;
public SerializableDictionary<Seg_Icon, Point> controlledSegs = new SerializableDictionary<Seg_Icon, Point>();
public Seg_Controller() { }
public Seg_Controller(int x, int y, string name, int width = 64, int height = 64) : base(x, y, name, width, height)
{
menu.MenuItems.Add("Setup").Click += new EventHandler(setup);
}
public void setup(object sender, EventArgs e)
{
if (Globals.selected != this)
{
Globals.selected = this;
Segmentcolor(Color.Red);
}
foreach (var icon in controlledSegs)
{
icon.Key.Segmentcolor(Color.RoyalBlue);
}
}
public void clear()
{
foreach (var icon in controlledSegs)
{
icon.Key.Segmentcolor(icon.Key.color);
}
}
override public void Run()
{
//Expand controllforeach (var icon in tempSegs)
Dictionary<Seg_Icon, Point> tempSegs = new Dictionary<Seg_Icon, Point>(controlledSegs);
Boolean update = true;
foreach (var icon in tempSegs)
{
if (icon.Key.relocate)
update = false;
}
if (update)
{
if (expanded)
{
controlledSegs.Clear();
foreach (var icon in tempSegs)
{
icon.Key.nextpos(window.Location);//Collapse
Point p = icon.Key.window.Location;
Seg_Icon i = icon.Key;
controlledSegs.Add(i, p);
}
}
else
{
foreach (var icon in controlledSegs)
{
icon.Key.nextpos(icon.Value);//Expand
}
}
expanded = !expanded;
}
}
}
}