import era.mi.logic.wires.WireArray;
import net.haspamelodica.swt.helper.gcs.GeneralGC;
import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
public interface BasicGUIComponent
{
* Render this component to the given gc, at coordinates (0, 0).
*/
public void render(GeneralGC gc);
+ /**
+ * Returns the bounds of this component.
+ * Used for calculating which component is clicked.
+ */
+ public Rectangle getBounds();
//TODO this code will be replaced by code in BasicComponent.
/**
import net.haspamelodica.swt.helper.gcs.GeneralGC;
import net.haspamelodica.swt.helper.swtobjectwrappers.Font;
import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
public class GUIAndGate extends AndGate implements BasicGUIComponent
{
this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);
}
+ @Override
+ public Rectangle getBounds()
+ {
+ return new Rectangle(0, 0, 20, height);
+ }
@Override
public void render(GeneralGC gc)
{
import era.mi.logic.wires.WireArray;
import net.haspamelodica.swt.helper.gcs.GeneralGC;
import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
public class GUIMerger extends Merger implements BasicGUIComponent
{
this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);
}
+ @Override
+ public Rectangle getBounds()
+ {
+ return new Rectangle(0, 0, 20, height);
+ }
@Override
public void render(GeneralGC gc)
{
import era.mi.logic.wires.WireArray;
import net.haspamelodica.swt.helper.gcs.GeneralGC;
import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
public class GUIMux extends Mux implements BasicGUIComponent
{
this.connectedWireArrays = Collections.unmodifiableList(connectedWireArraysModifiable);
this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);
}
+
+ @Override
+ public Rectangle getBounds()
+ {
+ return new Rectangle(0, 0, 20, height + 20);
+ }
@Override
public void render(GeneralGC gc)
{
import net.haspamelodica.swt.helper.gcs.GeneralGC;
import net.haspamelodica.swt.helper.swtobjectwrappers.Font;
import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
public class GUINotGate extends NotGate implements BasicGUIComponent
{
this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);
}
+ @Override
+ public Rectangle getBounds()
+ {
+ return new Rectangle(0, 0, 20, 10);
+ }
@Override
public void render(GeneralGC gc)
{
import era.mi.logic.wires.WireArray;
import net.haspamelodica.swt.helper.gcs.GeneralGC;
import net.haspamelodica.swt.helper.swtobjectwrappers.Point;
+import net.haspamelodica.swt.helper.swtobjectwrappers.Rectangle;
public class GUISplitter extends Splitter implements BasicGUIComponent
{
this.wireArrayConnectionPoints = Collections.unmodifiableList(wireArrayConnectionPointsModifiable);
}
+ @Override
+ public Rectangle getBounds()
+ {
+ return new Rectangle(0, 0, 20, height);
+ }
@Override
public void render(GeneralGC gc)
{