59 lines
2.0 KiB
Java
59 lines
2.0 KiB
Java
package openonyx.ui.internal;
|
|
|
|
import openonyx.history.internal.ActionSetting;
|
|
import openonyx.render.Render2D;
|
|
import openonyx.theme.Fonts;
|
|
import openonyx.ui.RenderContext;
|
|
import openonyx.ui.UiSupport_545;
|
|
|
|
public class ActionControl extends SettingControl {
|
|
private static final float m = 30.0F;
|
|
private final ActionSetting actionSetting;
|
|
private final UiSupport_545 uiSupport_545 = new UiSupport_545();
|
|
|
|
@Override
|
|
protected float L(RenderContext renderContext) {
|
|
return 30.0F;
|
|
}
|
|
|
|
public ActionControl(ActionSetting actionSetting) {
|
|
super(actionSettingx);
|
|
this.actionSetting = actionSettingx;
|
|
}
|
|
|
|
@Override
|
|
public boolean mouseClicked(float f, float g, int i) {
|
|
if (this.i() && i == 0 && this.contains(f, g)) {
|
|
this.actionSetting.run();
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void update(RenderContext renderContext) {
|
|
super.update(renderContext);
|
|
this.uiSupport_545.L(renderContext.i, this.h, this.H);
|
|
}
|
|
|
|
@Override
|
|
protected void d(RenderContext renderContext, float f) {
|
|
ActionControl actionControl1 = this;
|
|
Render2D render2D;
|
|
Render2D render2D1 = render2D = renderContext.render2D;
|
|
Render2D render2D2 = renderContext.render2D;
|
|
int i = actionControl1.L(renderContext.palette().onSecondaryContainer());
|
|
render2D2.roundedRect(
|
|
actionControl1.f, actionControl1.d, actionControl1.e, 30.0F, Float.MAX_VALUE, actionControl1.L(renderContext.palette().secondaryContainer())
|
|
);
|
|
actionControl1.uiSupport_545.L(render2D, actionControl1.f, actionControl1.d, actionControl1.e, 30.0F, Float.MAX_VALUE, i);
|
|
render2D1.drawTextCenteredVCentered(
|
|
Fonts.FONT_STYLE14, actionControl1.actionSetting.getButtonLabel(), actionControl1.f + actionControl1.e / 2.0F, actionControl1.d + 15.0F, i
|
|
);
|
|
if (actionControl1.h && actionControl1.i()) {
|
|
render2D.usePointerCursor();
|
|
}
|
|
}
|
|
}
|