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