Skip to content

Commit

Permalink
Rename Widget some Methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Nedelosk committed Aug 1, 2017
1 parent b0503fe commit 5c40de2
Show file tree
Hide file tree
Showing 12 changed files with 186 additions and 130 deletions.
Expand Up @@ -25,7 +25,7 @@ public ControlColorOption(ControlList<IFlowerColor> controlList, IFlowerColor op
textWidget.setSize(textWidget.getSize().sub(new Point(24, 0)));
int th = CraftGUI.RENDER.textHeight(textWidget.getValue(), textWidget.getSize().x());
int height = Math.max(20, th + 6);
setSize(new Point(size().x(), height));
setSize(new Point(this.getSize().x(), height));
textWidget.setSize(new Point(textWidget.getSize().x(), height));
boxPosition = new Point(2, (height - 18) / 2);
}
Expand Down
Expand Up @@ -106,7 +106,7 @@ public void onValueChanged(IAlleleSpecies species) {
int numOfLines = 1 + (tot - 1) / 3;
new ControlText(contents, new Area(0, y - (numOfLines - 1) * 18, w2, 4 + 18 * numOfLines), I18N.localise(DatabaseConstants.BOTANY_GENOME_KEY + ".varieties"), TextJustification.MIDDLE_RIGHT);
y += th;
contents.setSize(new Point(contents.size().x(), y));
contents.setSize(new Point(contents.getSize().x(), y));
scrollable.setScrollableContent(contents);
}
}
118 changes: 83 additions & 35 deletions src/main/java/binnie/core/gui/IWidget.java
Expand Up @@ -12,46 +12,70 @@
import binnie.core.gui.geometry.Point;

public interface IWidget {
/**
*
* @return the parent of this widget
*/
@Nullable
IWidget getParent();

void deleteChild(final IWidget p0);

void deleteAllChildren();

ITopLevelWidget getTopParent();

/**
* @return true if this widget is the {@link #getTopParent()}
*/
boolean isTopLevel();

/**
* @return the position of this widget
*/
Point getPosition();

void setPosition(final Point p0);

Point getSize();

void setSize(final Point p0);

Point size();

Point getOriginalPosition();

Point getAbsolutePosition();

Point getOriginalAbsolutePosition();

void setPosition(Point position);

/**
* @return the size of this widget
*/
Point getSize();

void setSize(Point size);

/**
* @return the offset of this widget
*/
Point getOffset();

void setOffset(final Point p0);

/**
* @return the area of this widget
*/
Area getArea();

/**
* @return the position of the mouse
*/
Point getMousePosition();

Point getRelativeMousePosition();

int getXPos();

int getYPos();

int getWidth();

int getHeight();

int getColor();

void setColor(final int p0);
void setColor(int color);

@SideOnly(Side.CLIENT)
void render(int guiWidth, int guiHeight);
Expand Down Expand Up @@ -79,21 +103,44 @@ public interface IWidget {

boolean isDragged();

boolean isChildVisible(final IWidget p0);

boolean isChildEnabled(final IWidget p0);

boolean canMouseOver();

boolean canFocus();

IWidget addChild(final IWidget p0);
/* CHILDREN */
boolean isChildVisible(IWidget child);

boolean isChildEnabled(IWidget child);

IWidget addChild(IWidget child);

List<IWidget> getChildren();

void callEvent(final Event p0);
void deleteChild(IWidget child);

void deleteAllChildren();

/* EVENTS*/

/**
* Calls an event
*/
void callEvent(Event event);

/**
* Called if this widget receives an event
*/
void receiveEvent(Event event);

/**
* Adds an event handler to this widget
*/
<E extends Event> void addEventHandler(EventHandler<E> eventHandler);

void recieveEvent(final Event p0);
/**
* Adds an event handler to this widget and sets his origin to self
*/
<E extends Event> void addSelfEventHandler(EventHandler<E> eventHandler);

@SideOnly(Side.CLIENT)
void onUpdateClient();
Expand All @@ -120,26 +167,27 @@ public interface IWidget {

boolean isDescendant(final IWidget p0);

List<IWidgetAttribute> getAttributes();

boolean hasAttribute(final IWidgetAttribute p0);

boolean addAttribute(final IWidgetAttribute p0);

<E extends Event> void addEventHandler(final EventHandler<E> p0);

<E extends Event> void addSelfEventHandler(final EventHandler<E> p0);
/* ATTRIBUTES */

boolean contains(final Point point);
/**
* @return a list with all attributes that this widget has.
*/
List<IWidgetAttribute> getAttributes();

int getXPos();
/**
*
* @return true if this widget has this attribute
*/
boolean hasAttribute(IWidgetAttribute attribute);

int getYPos();
/**
* Adds an attribute to this widget
*/
boolean addAttribute(IWidgetAttribute attribute);

int getWidth();
boolean contains(Point point);

int getHeight();

@SideOnly(Side.CLIENT)
void onRender(final RenderStage stage, int guiWidth, int guiHeight);
void onRender(RenderStage stage, int guiWidth, int guiHeight);
}

0 comments on commit 5c40de2

Please sign in to comment.