X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=LogicUI%2Fsrc%2Fera%2Fmi%2Fcomponents%2Fgui%2FBasicGUIComponent.java;h=a7212f9842578cf420484761fa93a145dfadd2ac;hb=0cfea6ef89dea8a797708ff685aa2ef9aefd85b9;hp=29df4f64d252e095216f5ffc8506c32520e00fe2;hpb=7ba7a5160d1167f9d0510d811a2865a7d95b6952;p=Mograsim.git diff --git a/LogicUI/src/era/mi/components/gui/BasicGUIComponent.java b/LogicUI/src/era/mi/components/gui/BasicGUIComponent.java index 29df4f64..a7212f98 100644 --- a/LogicUI/src/era/mi/components/gui/BasicGUIComponent.java +++ b/LogicUI/src/era/mi/components/gui/BasicGUIComponent.java @@ -1,8 +1,42 @@ package era.mi.components.gui; +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(); + /** + * Called when this component is clicked. Relative coordinates of the click are given. + * Returns true if this component has to be redrawn. + */ + public default boolean clicked(double x, double y) + { + return false; + } + + //TODO this code will be replaced by code in BasicComponent. + /** + * Returns how many wire arrays are connected to this component. + * (Connections are static - they can't be removed and no new ones can be added) + */ + public int getConnectedWireArraysCount(); + /** + * Returns the n-th wire array connected to this component. + */ + public WireArray getConnectedWireArray(int connectionIndex); + /** + * Returns relative coordinates where the n-th wire array is connected to this component. + */ + public Point getWireArrayConnectionPoint(int connectionIndex); } \ No newline at end of file