1 package net.mograsim.logic.ui.model.wires;
\r
3 import net.mograsim.logic.ui.ColorHelper;
\r
4 import net.mograsim.logic.ui.model.ViewModel;
\r
5 import net.mograsim.logic.ui.model.components.GUIComponent;
\r
6 import net.haspamelodica.swt.helper.gcs.GeneralGC;
\r
7 import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
\r
8 import net.mograsim.logic.core.types.BitVectorFormatter;
\r
9 import net.mograsim.logic.core.wires.Wire.ReadEnd;
\r
11 public class WireCrossPoint extends GUIComponent
\r
13 private final Pin pin;
\r
15 private ReadEnd end;
\r
16 private final int logicWidth;
\r
18 public WireCrossPoint(ViewModel model, int logicWidth)
\r
21 this.logicWidth = logicWidth;
\r
23 addPin(this.pin = new Pin(this, logicWidth, 0, 0));
\r
27 public void render(GeneralGC gc, Rectangle visibleRegion)
\r
29 Rectangle bounds = getBounds();
\r
30 ColorHelper.executeWithDifferentBackground(gc, BitVectorFormatter.formatAsColor(end),
\r
31 () -> gc.fillOval(bounds.x - 1, bounds.y - 1, 2, 2));
\r
34 public void setLogicModelBinding(ReadEnd end)
\r
37 end.registerObserver((i) -> callComponentLookChangedListeners());
\r
40 public int getLogicWidth()
\r