Made formatting uniform - commit for logicui
[Mograsim.git] / LogicUI / src / era / mi / gui / wires / WireConnectionPoint.java
1 package era.mi.gui.wires;\r
2 \r
3 import org.eclipse.swt.graphics.Color;\r
4 \r
5 import era.mi.gui.components.BasicGUIComponent;\r
6 import era.mi.logic.wires.WireArray;\r
7 import net.haspamelodica.swt.helper.gcs.GeneralGC;\r
8 import net.haspamelodica.swt.helper.swtobjectwrappers.Point;\r
9 import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;\r
10 \r
11 public class WireConnectionPoint implements BasicGUIComponent\r
12 {\r
13         private final WireArray wa;\r
14         private final int wiresCrossing;\r
15 \r
16         public WireConnectionPoint(WireArray wa, int wiresCrossing)\r
17         {\r
18                 this.wa = wa;\r
19                 this.wiresCrossing = wiresCrossing;\r
20         }\r
21 \r
22         @Override\r
23         public void render(GeneralGC gc)\r
24         {\r
25                 Color oldBG = gc.getBackground();\r
26                 if (wa.length == 1)\r
27                         gc.setBackground(gc.getDevice().getSystemColor(GUIWire.getSWTColorConstantForBit(wa.getValue())));\r
28                 gc.fillOval(-1, -1, 2, 2);\r
29                 gc.setBackground(oldBG);\r
30         }\r
31 \r
32         @Override\r
33         public Rectangle getBounds()\r
34         {\r
35                 return new Rectangle(0, 0, 0, 0);\r
36         }\r
37 \r
38         @Override\r
39         public int getConnectedWireArraysCount()\r
40         {\r
41                 return wiresCrossing;\r
42         }\r
43 \r
44         @Override\r
45         public WireArray getConnectedWireArray(int connectionIndex)\r
46         {\r
47                 return wa;\r
48         }\r
49 \r
50         @Override\r
51         public Point getWireArrayConnectionPoint(int connectionIndex)\r
52         {\r
53                 return new Point(0, 0);\r
54         }\r
55 }