[DEV] some updates

This commit is contained in:
Edouard DUPIN 2025-08-10 00:50:06 +02:00
parent 163e2e17ea
commit df65afb204
20 changed files with 626 additions and 1065 deletions

View File

@ -18,20 +18,20 @@ import org.slf4j.LoggerFactory;
public class BasicWindows extends Windows { public class BasicWindows extends Windows {
private static final Logger LOGGER = LoggerFactory.getLogger(BasicWindows.class); private static final Logger LOGGER = LoggerFactory.getLogger(BasicWindows.class);
private int index = -1; private int index = -1;
private final List<TestWidgetInterface> testedElement = new ArrayList<>(); private final List<TestWidgetInterface> testedElement = new ArrayList<>();
private Container container = null; private Container container = null;
private Label title = null; private Label title = null;
public static void staticRequestNext(final BasicWindows self) { public static void staticRequestNext(final BasicWindows self) {
self.requestNext(); self.requestNext();
} }
public static void staticRequestPrevious(final BasicWindows self) { public static void staticRequestPrevious(final BasicWindows self) {
self.requestPrevious(); self.requestPrevious();
} }
public void requestNext() { public void requestNext() {
LOGGER.info("Request Next"); LOGGER.info("Request Next");
this.index++; this.index++;
@ -40,7 +40,7 @@ public class BasicWindows extends Windows {
} }
updateDisplay(); updateDisplay();
} }
public void requestPrevious() { public void requestPrevious() {
LOGGER.info("Request Previous"); LOGGER.info("Request Previous");
this.index--; this.index--;
@ -49,7 +49,7 @@ public class BasicWindows extends Windows {
} }
updateDisplay(); updateDisplay();
} }
public void updateDisplay() { public void updateDisplay() {
final var test = this.testedElement.get(this.index); final var test = this.testedElement.get(this.index);
final var titlegenerated = "<b>[" + (this.index + 1) + "/" + this.testedElement.size() + "] " + test.getTitle() final var titlegenerated = "<b>[" + (this.index + 1) + "/" + this.testedElement.size() + "] " + test.getTitle()
@ -58,14 +58,14 @@ public class BasicWindows extends Windows {
setPropertyTitle(titlegenerated); setPropertyTitle(titlegenerated);
this.container.setSubWidget(new ModelWidget(test)); this.container.setSubWidget(new ModelWidget(test));
} }
public BasicWindows() { public BasicWindows() {
final var sizerMain = new Sizer(DisplayMode.VERTICAL); final var sizerMain = new Sizer(DisplayMode.VERTICAL);
sizerMain.setPropertyExpand(Vector2b.TRUE); sizerMain.setPropertyExpand(Vector2b.TRUE);
sizerMain.setPropertyFill(Vector2b.TRUE); sizerMain.setPropertyFill(Vector2b.TRUE);
setSubWidget(sizerMain); setSubWidget(sizerMain);
final var menu = new Sizer(DisplayMode.HORIZONTAL); final var menu = new Sizer(DisplayMode.HORIZONTAL);
menu.setPropertyExpand(Vector2b.TRUE_FALSE); menu.setPropertyExpand(Vector2b.TRUE_FALSE);
menu.setPropertyExpandIfFree(Vector2b.TRUE_FALSE); menu.setPropertyExpandIfFree(Vector2b.TRUE_FALSE);
@ -73,40 +73,40 @@ public class BasicWindows extends Windows {
menu.setPropertyLockExpand(Vector2b.TRUE); menu.setPropertyLockExpand(Vector2b.TRUE);
menu.setPropertyMaxSize(new Dimension2f(new Vector2f(9999, 3), Distance.CENTIMETER)); menu.setPropertyMaxSize(new Dimension2f(new Vector2f(9999, 3), Distance.CENTIMETER));
sizerMain.subWidgetAdd(menu); sizerMain.subWidgetAdd(menu);
this.container = new Container(); this.container = new Container();
this.container.setPropertyExpand(Vector2b.TRUE); this.container.setPropertyExpand(Vector2b.TRUE);
this.container.setPropertyFill(Vector2b.TRUE); this.container.setPropertyFill(Vector2b.TRUE);
sizerMain.subWidgetAdd(this.container); sizerMain.subWidgetAdd(this.container);
final var next = Button.createLabelButton("&lt;&lt; Previous"); final var next = Button.createLabelButton("&lt;&lt; Previous");
next.setPropertyMaxSize(new Dimension2f(new Vector2f(9999, 2), Distance.CENTIMETER)); next.setPropertyMaxSize(new Dimension2f(new Vector2f(9999, 2), Distance.CENTIMETER));
menu.subWidgetAdd(next); menu.subWidgetAdd(next);
next.signalClick.connectAuto(this, BasicWindows::staticRequestNext); next.signalClick.connectAuto(this, BasicWindows::staticRequestNext);
this.title = new Label("unknown"); this.title = new Label("unknown");
this.title.setPropertyFill(Vector2b.FALSE); this.title.setPropertyFill(Vector2b.FALSE);
this.title.setPropertyExpand(Vector2b.TRUE); this.title.setPropertyExpand(Vector2b.TRUE);
menu.subWidgetAdd(this.title); menu.subWidgetAdd(this.title);
final var previous = Button.createLabelButton("Next &gt;&gt;"); final var previous = Button.createLabelButton("Next &gt;&gt;");
previous.setPropertyMaxSize(new Dimension2f(new Vector2f(9999, 2), Distance.CENTIMETER)); previous.setPropertyMaxSize(new Dimension2f(new Vector2f(9999, 2), Distance.CENTIMETER));
menu.subWidgetAdd(previous); menu.subWidgetAdd(previous);
previous.signalClick.connectAuto(this, BasicWindows::staticRequestPrevious); previous.signalClick.connectAuto(this, BasicWindows::staticRequestPrevious);
this.container.setPropertyExpand(Vector2b.TRUE); this.container.setPropertyExpand(Vector2b.TRUE);
this.container.setPropertyFill(Vector2b.TRUE); this.container.setPropertyFill(Vector2b.TRUE);
this.container.setPropertyExpandIfFree(Vector2b.TRUE); this.container.setPropertyExpandIfFree(Vector2b.TRUE);
this.testedElement.add(new TestWidgetSlider());
this.testedElement.add(new TestWidgetEntry()); this.testedElement.add(new TestWidgetEntry());
this.testedElement.add(new TestWidgetBox()); this.testedElement.add(new TestWidgetBox());
this.testedElement.add(new TestWidgetSlider());
this.testedElement.add(new TestWidgetButton()); this.testedElement.add(new TestWidgetButton());
this.testedElement.add(new TestWidgetButtonToggle()); this.testedElement.add(new TestWidgetButtonToggle());
this.testedElement.add(new TestWidgetCheckBox()); this.testedElement.add(new TestWidgetCheckBox());
this.testedElement.add(new TestWidgetImage()); this.testedElement.add(new TestWidgetImage());
this.testedElement.add(new TestWidgetLabel()); this.testedElement.add(new TestWidgetLabel());
requestNext(); requestNext();
} }
} }

View File

@ -8,23 +8,13 @@ package org.atriasoft.ewol.compositing;
import org.atriasoft.egami.ImageByte; import org.atriasoft.egami.ImageByte;
import org.atriasoft.egami.ImageByteRGBA; import org.atriasoft.egami.ImageByteRGBA;
import org.atriasoft.egami.ToolImage; import org.atriasoft.egami.ToolImage;
import org.atriasoft.esvg.CapMode;
import org.atriasoft.esvg.Circle;
import org.atriasoft.esvg.Ellipse;
import org.atriasoft.esvg.EsvgDocument; import org.atriasoft.esvg.EsvgDocument;
import org.atriasoft.esvg.JoinMode;
import org.atriasoft.esvg.Line;
import org.atriasoft.esvg.PaintState;
import org.atriasoft.esvg.Rectangle;
import org.atriasoft.etk.BorderRadius;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.Insets;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.etk.util.Pair;
import org.atriasoft.gale.backend3d.OpenGL; import org.atriasoft.gale.backend3d.OpenGL;
import org.atriasoft.gale.backend3d.OpenGL.RenderMode; import org.atriasoft.gale.backend3d.OpenGL.RenderMode;
import org.atriasoft.gale.resource.ResourceProgram; import org.atriasoft.gale.resource.ResourceProgram;
@ -33,7 +23,7 @@ import org.atriasoft.gale.resource.ResourceVirtualArrayObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class CompositingSVG extends CompositingDraw { public class CompositingSVG extends Compositing {
private static final Logger LOGGER = LoggerFactory.getLogger(CompositingSVG.class); private static final Logger LOGGER = LoggerFactory.getLogger(CompositingSVG.class);
public static final int NB_VBO = 3; public static final int NB_VBO = 3;
public static final int SIZE_AUTO = 0; public static final int SIZE_AUTO = 0;
@ -51,20 +41,20 @@ public class CompositingSVG extends CompositingDraw {
private ResourceProgram oGLprogram = null; //!< pointer on the opengl display program private ResourceProgram oGLprogram = null; //!< pointer on the opengl display program
private Vector3f position = Vector3f.ZERO; //!< The current position to draw private Vector3f position = Vector3f.ZERO; //!< The current position to draw
private Vector2i requestSize = new Vector2i(2, 2); private Vector2i requestSize = new Vector2i(2, 2);
private ResourceTexture2 resource = null; //!< texture resources private ResourceTexture2 resource = null; //!< texture resources
private ResourceVirtualArrayObject vbo = null; private ResourceVirtualArrayObject vbo = null;
private Color[] vboDataColors = null; private Color[] vboDataColors = null;
private Vector3f[] vboDataCoords = null; private Vector3f[] vboDataCoords = null;
private Vector2f[] vboDataCoordsTex = null; private Vector2f[] vboDataCoordsTex = null;
public CompositingSVG() { public CompositingSVG() {
this(""" this("""
<svg width="10" height="10"></svg> <svg width="10" height="10"></svg>
""", CompositingSVG.SIZE_AUTO); """, CompositingSVG.SIZE_AUTO);
} }
public CompositingSVG(final String data, final int size) { public CompositingSVG(final String data, final int size) {
this.svgData = data; this.svgData = data;
// Create the VBO: // Create the VBO:
@ -78,7 +68,7 @@ public class CompositingSVG extends CompositingDraw {
setSource(this.svgData, size); setSource(this.svgData, size);
loadProgram(); loadProgram();
} }
/** /**
* clear alll tre registered element in the current element * clear alll tre registered element in the current element
*/ */
@ -93,7 +83,7 @@ public class CompositingSVG extends CompositingDraw {
this.color = Color.WHITE; this.color = Color.WHITE;
this.angle = 0; this.angle = 0;
} }
/** /**
* draw All the registered text in the current element on openGL * draw All the registered text in the current element on openGL
* @param disableDepthTest disable the Depth test for display * @param disableDepthTest disable the Depth test for display
@ -133,19 +123,16 @@ public class CompositingSVG extends CompositingDraw {
this.vbo.unBindForRendering(); this.vbo.unBindForRendering();
this.oGLprogram.unUse(); this.oGLprogram.unUse();
} }
@Override @Override
public void flush() { public void flush() {
generate(); this.vbo.setPosition(this.vboDataCoords);
if (this.vboDataCoords != null) { this.vbo.setTextureCoordinate(this.vboDataCoordsTex);
this.vbo.setPosition(this.vboDataCoords); this.vbo.setColors(this.vboDataColors);
this.vbo.setTextureCoordinate(this.vboDataCoordsTex); this.vbo.setVertexCount(this.vboDataCoords.length);
this.vbo.setColors(this.vboDataColors); this.vbo.flush();
this.vbo.setVertexCount(this.vboDataCoords.length);
this.vbo.flush();
}
} }
/** /**
* get the current display position (sometime needed in the gui control) * get the current display position (sometime needed in the gui control)
* @return the current position. * @return the current position.
@ -153,7 +140,7 @@ public class CompositingSVG extends CompositingDraw {
public Vector3f getPos() { public Vector3f getPos() {
return this.position; return this.position;
} }
/** /**
* get the source image registered size in the file (<0 when multiple size image) * get the source image registered size in the file (<0 when multiple size image)
* @return tre image registered size * @return tre image registered size
@ -164,7 +151,7 @@ public class CompositingSVG extends CompositingDraw {
} }
return this.resource.getUsableSize(); return this.resource.getUsableSize();
} }
/** /**
* Sometimes the user declare an image but not allocate the resources all the time, this is to know it .. * Sometimes the user declare an image but not allocate the resources all the time, this is to know it ..
* @return the validity of the resources. * @return the validity of the resources.
@ -172,7 +159,7 @@ public class CompositingSVG extends CompositingDraw {
public boolean hasSources() { public boolean hasSources() {
return this.resource != null; return this.resource != null;
} }
/** /**
* load the openGL program and get all the ID needed * load the openGL program and get all the ID needed
*/ */
@ -186,11 +173,11 @@ public class CompositingSVG extends CompositingDraw {
this.oGLMatrixView = this.oGLprogram.getUniform("in_matrixView"); this.oGLMatrixView = this.oGLprogram.getUniform("in_matrixView");
} }
} }
public void print(final Vector2f size) { public void print(final Vector2f size) {
printPart(size, Vector2f.ZERO, Vector2f.ONE); printPart(size, Vector2f.ZERO, Vector2f.ONE);
} }
/** /**
* add a compleate of the image to display with the requested size * add a compleate of the image to display with the requested size
* @param size size of the output image * @param size size of the output image
@ -198,7 +185,7 @@ public class CompositingSVG extends CompositingDraw {
public void print(final Vector2i size) { public void print(final Vector2i size) {
print(new Vector2f(size.x(), size.y())); print(new Vector2f(size.x(), size.y()));
} }
/** /**
* add a part of the image to display with the requested size * add a part of the image to display with the requested size
* @param size size of the output image * @param size size of the output image
@ -220,69 +207,69 @@ public class CompositingSVG extends CompositingDraw {
this.vboDataColors = new Color[6]; this.vboDataColors = new Color[6];
this.vboDataCoords = new Vector3f[6]; this.vboDataCoords = new Vector3f[6];
this.vboDataCoordsTex = new Vector2f[6]; this.vboDataCoordsTex = new Vector2f[6];
if (this.angle == 0.0f) { if (this.angle == 0.0f) {
Vector3f point = this.position; Vector3f point = this.position;
int indexElem = 0; int indexElem = 0;
Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
this.vboDataCoords[indexElem] = point; this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
indexElem++; indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y()); tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y());
point = new Vector3f(this.position.x() + size.x(), this.position.y(), 0); point = new Vector3f(this.position.x() + size.x(), this.position.y(), 0);
this.vboDataCoords[indexElem] = point; this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
indexElem++; indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y()); tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y());
point = new Vector3f(this.position.x() + size.x(), this.position.y() + size.y(), 0); point = new Vector3f(this.position.x() + size.x(), this.position.y() + size.y(), 0);
this.vboDataCoords[indexElem] = point; this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
indexElem++; indexElem++;
this.vboDataCoords[indexElem] = point; this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
indexElem++; indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y()); tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y());
point = new Vector3f(this.position.x(), this.position.y() + size.y(), 0); point = new Vector3f(this.position.x(), this.position.y() + size.y(), 0);
this.vboDataCoords[indexElem] = point; this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
indexElem++; indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
point = new Vector3f(this.position.x(), this.position.y(), 0); point = new Vector3f(this.position.x(), this.position.y(), 0);
this.vboDataCoords[indexElem] = point; this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
return; return;
} }
final Vector3f center = this.position.add(new Vector3f(size.x(), size.y(), 0)).divide(2.0f); final Vector3f center = this.position.add(new Vector3f(size.x(), size.y(), 0)).divide(2.0f);
final Vector3f limitedSize = new Vector3f(size.x() * 0.5f, size.y() * 0.5f, 0.0f); final Vector3f limitedSize = new Vector3f(size.x() * 0.5f, size.y() * 0.5f, 0.0f);
Vector3f point = Vector3f.ZERO; Vector3f point = Vector3f.ZERO;
Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); Vector2f tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
int indexElem = 0; int indexElem = 0;
point = new Vector3f(-limitedSize.x(), -limitedSize.y(), 0); point = new Vector3f(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center);
this.vboDataCoords[indexElem] = point; this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
indexElem++; indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y()); tex = new Vector2f(sourcePosStop.x(), sourcePosStop.y());
point = new Vector3f(limitedSize.x(), -limitedSize.y(), 0); point = new Vector3f(limitedSize.x(), -limitedSize.y(), 0);
point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center);
@ -290,7 +277,7 @@ public class CompositingSVG extends CompositingDraw {
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
indexElem++; indexElem++;
tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y()); tex = new Vector2f(sourcePosStop.x(), sourcePosStart.y());
point = new Vector3f(limitedSize.x(), limitedSize.y(), 0); point = new Vector3f(limitedSize.x(), limitedSize.y(), 0);
point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center);
@ -298,12 +285,12 @@ public class CompositingSVG extends CompositingDraw {
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
indexElem++; indexElem++;
this.vboDataCoords[indexElem] = point; this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
indexElem++; indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y()); tex = new Vector2f(sourcePosStart.x(), sourcePosStart.y());
point = new Vector3f(-limitedSize.x(), limitedSize.y(), 0); point = new Vector3f(-limitedSize.x(), limitedSize.y(), 0);
point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center);
@ -311,16 +298,16 @@ public class CompositingSVG extends CompositingDraw {
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
indexElem++; indexElem++;
tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y()); tex = new Vector2f(sourcePosStart.x(), sourcePosStop.y());
point = new Vector3f(-limitedSize.x(), -limitedSize.y(), 0); point = new Vector3f(-limitedSize.x(), -limitedSize.y(), 0);
point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center); point = point.rotateNew(new Vector3f(0, 0, 1), this.angle).add(center);
this.vboDataCoords[indexElem] = point; this.vboDataCoords[indexElem] = point;
this.vboDataCoordsTex[indexElem] = tex; this.vboDataCoordsTex[indexElem] = tex;
this.vboDataColors[indexElem] = this.color; this.vboDataColors[indexElem] = this.color;
} }
/** /**
* set a unique rotation of this element (not set in the rotate Generic system) * set a unique rotation of this element (not set in the rotate Generic system)
* @param angleRad Angle to set in radiant. * @param angleRad Angle to set in radiant.
@ -328,7 +315,7 @@ public class CompositingSVG extends CompositingDraw {
public void setAngle(final float angleRad) { public void setAngle(final float angleRad) {
this.angle = angleRad; this.angle = angleRad;
} }
/** /**
* set the Color of the current foreground font * set the Color of the current foreground font
* @param color Color to set on foreground (for next print) * @param color Color to set on foreground (for next print)
@ -336,15 +323,15 @@ public class CompositingSVG extends CompositingDraw {
public void setColor(final Color color) { public void setColor(final Color color) {
this.color = color; this.color = color;
} }
public void setPos(final Vector2f pos) { public void setPos(final Vector2f pos) {
setPos(new Vector3f(pos.x(), pos.y(), 0)); setPos(new Vector3f(pos.x(), pos.y(), 0));
} }
public void setPos(final Vector2i pos) { public void setPos(final Vector2i pos) {
setPos(new Vector3f(pos.x(), pos.y(), 0)); setPos(new Vector3f(pos.x(), pos.y(), 0));
} }
/** /**
* set position for the next text written * set position for the next text written
* @param pos Position of the text (in 3D) * @param pos Position of the text (in 3D)
@ -352,11 +339,11 @@ public class CompositingSVG extends CompositingDraw {
public void setPos(final Vector3f pos) { public void setPos(final Vector3f pos) {
this.position = pos; this.position = pos;
} }
public void setRelPos(final Vector2f pos) { public void setRelPos(final Vector2f pos) {
setRelPos(new Vector3f(pos.x(), pos.y(), 0)); setRelPos(new Vector3f(pos.x(), pos.y(), 0));
} }
/** /**
* set relative position for the next text written * set relative position for the next text written
* @param pos offset apply of the text (in 3D) * @param pos offset apply of the text (in 3D)
@ -364,7 +351,7 @@ public class CompositingSVG extends CompositingDraw {
public void setRelPos(final Vector3f pos) { public void setRelPos(final Vector3f pos) {
this.position = this.position.add(pos); this.position = this.position.add(pos);
} }
public void setSource(final ImageByteRGBA image) { public void setSource(final ImageByteRGBA image) {
clear(); clear();
this.svgData = null; this.svgData = null;
@ -372,11 +359,11 @@ public class CompositingSVG extends CompositingDraw {
this.resource = new ResourceTexture2(); this.resource = new ResourceTexture2();
this.resource.set(image); this.resource.set(image);
} }
public void setSource(final String data) { public void setSource(final String data) {
setSource(data, 32); setSource(data, 32);
} }
public void setSource(final String data, final int size) { public void setSource(final String data, final int size) {
setSource(data, new Vector2i(size, size)); setSource(data, new Vector2i(size, size));
} }
@ -385,7 +372,7 @@ public class CompositingSVG extends CompositingDraw {
// data // data
// setSource // setSource
// } // }
public void setSource(final String data, final Vector2i size) { public void setSource(final String data, final Vector2i size) {
if (data == null) { if (data == null) {
LOGGER.error("try to set NULL data in svg"); LOGGER.error("try to set NULL data in svg");
@ -413,153 +400,25 @@ public class CompositingSVG extends CompositingDraw {
this.svgData = data; this.svgData = data;
this.requestSize = size; this.requestSize = size;
} }
public void setSource(final EsvgDocument data, final Vector2i size) { public void setSource(final EsvgDocument data, final Vector2i size) {
if (this.svgData == null && this.svgDoc.equals(data) && this.requestSize.x() == size.x() if (this.svgData == null && this.svgDoc.equals(data) && this.requestSize.x() == size.x()
&& this.requestSize.y() == size.y()) { && this.requestSize.y() == size.y()) {
// Nothing to do ... // Nothing to do ...
return; return;
} }
this.svgData = null;
clear(); clear();
final ImageByte tmp = ToolImage.convertImageByte(data.renderImageFloatRGBA(size));
if (tmp == null) {
LOGGER.error("Can not load the Raw SVG ... ");
return;
}
if (this.resource == null) {
this.resource = new ResourceTexture2();
}
this.resource.set(tmp);
this.svgDoc = data; this.svgDoc = data;
this.requestSize = size; this.requestSize = size;
generate();
}
protected void generate() {
final Vector2i size = this.requestSize;
if (this.svgDoc != null) {
final ImageByte tmp = ToolImage.convertImageByte(this.svgDoc.renderImageFloatRGBA(size));
if (tmp == null) {
LOGGER.error("Can not load the Raw SVG ... ");
return;
}
if (this.resource == null) {
this.resource = new ResourceTexture2();
}
this.resource.set(tmp);
}
}
PaintState paint = new PaintState();
public void clearPaint() {
this.paint.clear();
}
public void createSize(final Vector2i size) {
clear();
this.paint.clear();
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument(size);
}
this.requestSize = size;
}
@Override
public void setPaintFillColor(final Color color) {
this.paint.fill = new Pair<>(color, "");
}
@Override
public void setPaintStrokeColor(final Color color) {
this.paint.stroke = new Pair<>(color, "");
}
@Override
public void setPaintStrokeWidth(final float width) {
this.paint.strokeWidth = width;
}
public void setPaintLineJoin(final JoinMode lineJoin) {
this.paint.lineJoin = lineJoin;
}
public void setPaintLineCap(final CapMode lineCap) {
this.paint.lineCap = lineCap;
}
public void setPaintMiterLimit(final float miterLimit) {
this.paint.miterLimit = miterLimit;
}
public void setPaintOpacity(final float opacity) {
this.paint.opacity = opacity;
}
@Override
public void addLine(final Vector2f startPos, final Vector2f stopPos) {
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument();
}
this.svgDoc.addElement(new Line(startPos, stopPos, this.paint));
}
@Override
public void addRectangle(final Vector2f position, final Vector2f size) {
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument();
}
this.svgDoc.addElement(new Rectangle(position, size, this.paint));
}
@Override
public void addRectangle(final Vector2f position, final Vector2f size, final Vector2f roundedCorner) {
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument();
}
this.svgDoc.addElement(new Rectangle(position, size, roundedCorner, this.paint));
}
@Override
public void addCircle(final Vector2f position, final float radius) {
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument();
}
this.svgDoc.addElement(new Circle(position, radius, this.paint));
}
@Override
public void addEllipse(final Vector2f center, final Vector2f radius) {
if (this.svgDoc == null) {
this.svgDoc = new EsvgDocument();
}
this.svgDoc.addElement(new Ellipse(center, radius, this.paint));
}
public void setRectangleAsSource(final int sizeX, final int sizeY, final Color color) {
createSize(new Vector2i(sizeX, sizeY)); // specific for SVG
setPaintFillColor(color);
addRectangle(Vector2f.ZERO, new Vector2f(sizeX, sizeY));
flush();
}
public void setRectangleBorderAsSource(
final int sizeX,
final int sizeY,
final Color color,
final int borderSize,
final int borderRadius,
final Color borderColor) {
final int paddingCompensateBorder = Math.round(borderSize * 0.5f);
createSize(new Vector2i(sizeX, sizeY)); // specific for SVG
setPaintFillColor(color);
setPaintStrokeColor(borderColor);
setPaintStrokeWidth(borderSize);
addRectangle(new Vector2f(paddingCompensateBorder, paddingCompensateBorder), //
new Vector2f(sizeX - 2 * paddingCompensateBorder, sizeY - 2 * paddingCompensateBorder), //
new Vector2f(borderRadius, borderRadius));
flush();
}
@Override
public void addRectangle(
final Vector2f position,
final Vector2f size,
final Insets thickness,
final BorderRadius radius) {
// TODO Auto-generated method stub
} }
} }

View File

@ -274,10 +274,15 @@ public class Box extends Container {
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
super.onRegenerateDisplay();
if (!needRedraw()) { if (!needRedraw()) {
return; return;
} }
regenerateDisplay();
}
@Override
public void regenerateDisplay() {
super.regenerateDisplay();
final Insets localMargin = this.propertyMargin.size(); final Insets localMargin = this.propertyMargin.size();
Vector2f renderSize = calculateSizeRendering(); Vector2f renderSize = calculateSizeRendering();
this.overPositionStart = calculateOriginRendering(renderSize); this.overPositionStart = calculateOriginRendering(renderSize);

View File

@ -1,293 +0,0 @@
package org.atriasoft.ewol.widget;
import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Dimension1f;
import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.compositing.CompositingSVG;
import org.atriasoft.ewol.event.EventTime;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class BoxSVG extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(BoxSVG.class);
protected CompositingSVG vectorialDraw = new CompositingSVG();
public static class BoxParameter {
public Float margin;
public Float padding;
public Float borderWidth;
public Float borderRadius;
public String borderColor;
public String color;
}
/**
* Periodic call to update grapgic display
* @param event Time generic event
*/
protected static void periodicCall(final BoxSVG self, final EventTime event) {
LOGGER.trace("Periodic call on Entry(" + event + ")");
self.markToRedraw();
}
Vector2i startPosition = Vector2i.ZERO;
Vector2i endPosition = Vector2i.ZERO;
public boolean isInside(final Vector2f value) {
return value.x() > this.startPosition.x() //
&& value.y() > this.startPosition.y() //
&& value.x() < this.endPosition.x() //
&& value.y() < this.endPosition.y();
}
/**
* Constructor
*/
public BoxSVG() {}
/**
* Constructor with his subWidget
*/
public BoxSVG(final Widget subWidget) {
super(subWidget);
}
protected Dimension1f propertyBorderWidth = Dimension1f.ZERO;
@AknotManaged
@AknotAttribute
@AknotName(value = "border-width")
@AknotDescription(value = "Border of the box")
public Dimension1f getPropertyBorderWidth() {
return this.propertyBorderWidth;
}
public void setPropertyBorderWidth(final Dimension1f propertyBorder) {
if (this.propertyBorderWidth.equals(propertyBorder)) {
return;
}
this.propertyBorderWidth = propertyBorder;
markToRedraw();
requestUpdateSize();
}
protected Dimension1f propertyBorderRadius = new Dimension1f(0);
@AknotManaged
@AknotAttribute
@AknotName(value = "border-radius")
@AknotDescription(value = "Border radius of the box")
public Dimension1f getPropertyBorderRadius() {
return this.propertyBorderRadius;
}
public void setPropertyBorderRadius(final Dimension1f propertyBorderRadius) {
if (this.propertyBorderRadius.equals(propertyBorderRadius)) {
return;
}
this.propertyBorderRadius = propertyBorderRadius;
markToRedraw();
requestUpdateSize();
}
protected Color propertyBorderColor = Color.NONE;
@AknotManaged
@AknotAttribute
@AknotName(value = "border-color")
@AknotDescription(value = "Border color of the box")
public Color getPropertyBorderColor() {
return this.propertyBorderColor;
}
public void setPropertyBorderColor(final Color propertyBorderColor) {
if (this.propertyBorderColor.equals(propertyBorderColor)) {
return;
}
this.propertyBorderColor = propertyBorderColor;
markToRedraw();
requestUpdateSize();
}
protected Color propertyColor = Color.NONE;
@AknotManaged
@AknotAttribute
@AknotName(value = "color")
@AknotDescription(value = "Border color of the box")
public Color getPropertyColor() {
return this.propertyColor;
}
public void setPropertyColor(final Color propertyColor) {
if (this.propertyColor.equals(propertyColor)) {
return;
}
this.propertyColor = propertyColor;
markToRedraw();
requestUpdateSize();
}
protected Dimension2f propertyMargin = Dimension2f.ZERO;
@AknotManaged
@AknotAttribute
@AknotName(value = "margin")
@AknotDescription(value = "margin of the box")
public Dimension2f getPropertyMargin() {
return this.propertyMargin;
}
public void setPropertyMargin(final Dimension2f propertyMargin) {
if (this.propertyMargin.equals(propertyMargin)) {
return;
}
this.propertyMargin = propertyMargin;
markToRedraw();
requestUpdateSize();
}
protected Dimension2f propertyPadding = Dimension2f.ZERO;
@AknotManaged
@AknotAttribute
@AknotName(value = "padding")
@AknotDescription(value = "Padding of the box")
public Dimension2f getPropertyPadding() {
return this.propertyPadding;
}
public void setPropertyPadding(final Dimension2f propertyPadding) {
if (this.propertyPadding.equals(propertyPadding)) {
return;
}
this.propertyPadding = propertyPadding;
markToRedraw();
requestUpdateSize();
}
@Override
public void calculateMinMaxSize() {
super.calculateMinMaxSize();
final Vector2f childMinSize = new Vector2f(this.minSize.x(), this.minSize.y());
LOGGER.debug("calculate min size: border=" + this.propertyBorderWidth);
final Vector2f borderSize = new Vector2f(this.propertyBorderWidth.size() * 2.0f,
this.propertyBorderWidth.size() * 2.0f);
final Vector2f padding = this.propertyPadding.size().multiply(2);
final Vector2f margin = this.propertyMargin.size().multiply(2);
final Vector2f calculatedBoxMinSize = childMinSize.add(margin).add(padding).add(borderSize);
this.minSize = calculatedBoxMinSize;
this.maxSize = Vector2f.max(this.minSize, this.propertyMaxSize.size());
markToRedraw();
}
@Override
public void onChangeSize() {
markToRedraw();
if (this.propertyHide) {
return;
}
if (this.subWidget == null) {
return;
}
final Vector2f localPadding = this.propertyPadding.size();
final Vector2f localMargin = this.propertyMargin.size();
final float localBorderSize = this.propertyBorderWidth.size();
final Vector2f offsetSubWidget = localPadding.add(localMargin).add(localBorderSize);
Vector2f subWidgetSize = this.subWidget.getCalculateMinSize();
if (this.subWidget.canExpand().x() && this.propertyFill.x()) {
subWidgetSize = subWidgetSize.withX(this.size.x());
} else {
subWidgetSize = subWidgetSize.withX(this.minSize.x());
}
if (this.subWidget.canExpand().y() && this.propertyFill.y()) {
subWidgetSize = subWidgetSize.withY(this.size.y());
} else {
subWidgetSize = subWidgetSize.withY(this.minSize.y());
}
subWidgetSize = subWidgetSize.less(offsetSubWidget.multiply(2));
subWidgetSize = subWidgetSize.clipInteger();
final Vector2f freeSizeWithoutWidget = this.size.less(offsetSubWidget.multiply(2)).less(subWidgetSize);
Vector2f subWidgetOrigin = this.origin.add(this.propertyGravity.gravityGenerateDelta(freeSizeWithoutWidget));
subWidgetOrigin = subWidgetOrigin.add(offsetSubWidget);
subWidgetOrigin = subWidgetOrigin.clipInteger();
this.subWidget.setOrigin(subWidgetOrigin);
this.subWidget.setSize(subWidgetSize);
this.subWidget.onChangeSize();
}
protected Vector2i renderOrigin;
protected Vector2i renderSize;
private Vector2f calculateOriginRendering(final Vector2f renderSize) {
return this.propertyGravity.gravityGenerateDelta(this.size.less(renderSize));
}
private Vector2f calculateSizeRendering() {
Vector2f tmpRenderSize = this.minSize;
if (this.propertyFill.x()) {
tmpRenderSize = tmpRenderSize.withX(this.size.x());
}
if (this.propertyFill.y()) {
tmpRenderSize = tmpRenderSize.withY(this.size.y());
}
return tmpRenderSize;
}
@Override
public void onRegenerateDisplay() {
super.onRegenerateDisplay();
if (!needRedraw()) {
return;
}
final Vector2f localMargin = this.propertyMargin.size();
Vector2f tmpRenderSize = calculateSizeRendering();
Vector2f tmpRenderOrigin = calculateOriginRendering(tmpRenderSize);
tmpRenderOrigin = tmpRenderOrigin.add(localMargin);
tmpRenderSize = tmpRenderSize.less(localMargin.multiply(2));
// not sure this is needed...
tmpRenderSize = tmpRenderSize.clipInteger();
tmpRenderOrigin = tmpRenderOrigin.clipInteger();
this.renderOrigin = new Vector2i((int) tmpRenderOrigin.x(), (int) tmpRenderOrigin.y());
this.renderSize = new Vector2i((int) tmpRenderSize.x(), (int) tmpRenderSize.y());
//System.out.println("renderSize: " + this.renderSize);
// remove data of the previous composition :
this.vectorialDraw.clear();
final int borderSize = (int) this.propertyBorderWidth.size();
final int paddingCompensateBorder = Math.round(borderSize * 0.5f);
if (borderSize > 0.0f) {
this.vectorialDraw.setRectangleBorderAsSource(this.renderSize.x(), this.renderSize.y(), this.propertyColor,
borderSize, (int) this.propertyBorderRadius.size(), this.propertyBorderColor);
} else {
this.vectorialDraw.setRectangleAsSource(this.renderSize.x(), this.renderSize.y(), this.propertyColor);
}
this.vectorialDraw.setPos(this.renderOrigin);
// For events:
this.startPosition = this.renderOrigin;
this.endPosition = this.renderOrigin.add(this.renderSize);
this.vectorialDraw.print(this.renderSize);
this.vectorialDraw.flush();
}
@Override
protected void onDraw() {
if (this.vectorialDraw != null) {
this.vectorialDraw.draw(true);
}
super.onDraw();
}
}

View File

@ -32,11 +32,11 @@ import org.slf4j.LoggerFactory;
*/ */
public class Composer extends Container { public class Composer extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(Composer.class); private static final Logger LOGGER = LoggerFactory.getLogger(Composer.class);
public static Widget composerGenerateFile(final Uri data) { public static Widget composerGenerateFile(final Uri data) {
return composerGenerateFile(data, 0); return composerGenerateFile(data, 0);
} }
public static Widget composerGenerateFile(final Uri uri, final long id) { public static Widget composerGenerateFile(final Uri uri, final long id) {
final byte[] elemData = Uri.getAllData(uri); final byte[] elemData = Uri.getAllData(uri);
if (elemData == null) { if (elemData == null) {
@ -50,11 +50,11 @@ public class Composer extends Container {
} }
return tmp; return tmp;
} }
public static Widget composerGenerateString(final String data) { public static Widget composerGenerateString(final String data) {
return composerGenerateString(data, 0); return composerGenerateString(data, 0);
} }
public static Widget composerGenerateString(String data, final long id) { public static Widget composerGenerateString(String data, final long id) {
boolean requestComposer = true; boolean requestComposer = true;
if (!data.startsWith("<Composer>")) { if (!data.startsWith("<Composer>")) {
@ -78,19 +78,19 @@ public class Composer extends Container {
} }
return result.getSubWidget(); return result.getSubWidget();
} }
protected boolean propertyRemoveIfUnderRemove; //!< Remove the composer if sub element request a remove protected boolean propertyRemoveIfUnderRemove; //!< Remove the composer if sub element request a remove
protected Uri propertySubFile; //!< If loading a sub-file, we must do it here ==> permit to configure it in the xml and not have wrong display protected Uri propertySubFile; //!< If loading a sub-file, we must do it here ==> permit to configure it in the xml and not have wrong display
/** /**
* Constructor * Constructor
*/ */
public Composer() { public Composer() {
// nothing to do... // nothing to do...
} }
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -99,44 +99,44 @@ public class Composer extends Container {
} }
super.calculateMinMaxSize(); super.calculateMinMaxSize();
} }
@Override @Override
public void calculateSize() { public void calculateSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.calculateSize(); this.subWidget.calculateSize();
return; return;
} }
super.calculateSize(); super.calculateSize();
} }
@Override @Override
public Vector2b canExpand() { public Vector2b canExpand() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.canExpand(); return this.subWidget.canExpand();
} }
return super.canExpand(); return super.canExpand();
} }
@Override @Override
public Vector2b canExpandIfFree() { public Vector2b canExpandIfFree() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.canExpandIfFree(); return this.subWidget.canExpandIfFree();
} }
return super.canExpandIfFree(); return super.canExpandIfFree();
} }
@Override @Override
public Vector2b canFill() { public Vector2b canFill() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.canFill(); return this.subWidget.canFill();
} }
return super.canFill(); return super.canFill();
} }
@Override @Override
void changeZoom(final float range) { void changeZoom(final float range) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -145,7 +145,7 @@ public class Composer extends Container {
} }
super.changeZoom(range); super.changeZoom(range);
} }
@Override @Override
public void checkMaxSize() { public void checkMaxSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -154,71 +154,71 @@ public class Composer extends Container {
} }
super.checkMaxSize(); super.checkMaxSize();
} }
@Override @Override
public void checkMinSize() { public void checkMinSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.checkMinSize(); this.subWidget.checkMinSize();
return; return;
} }
super.checkMinSize(); super.checkMinSize();
} }
@Override @Override
public Vector2f getCalculateMaxSize() { public Vector2f getCalculateMaxSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getCalculateMaxSize(); return this.subWidget.getCalculateMaxSize();
} }
return super.getCalculateMaxSize(); return super.getCalculateMaxSize();
} }
@Override @Override
public Vector2f getCalculateMinSize() { public Vector2f getCalculateMinSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getCalculateMinSize(); return this.subWidget.getCalculateMinSize();
} }
return super.getCalculateMinSize(); return super.getCalculateMinSize();
} }
@Override @Override
public Cursor getCursor() { public Cursor getCursor() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getCursor(); return this.subWidget.getCursor();
} }
return super.getCursor(); return super.getCursor();
} }
@Override @Override
public boolean getGrabStatus() { public boolean getGrabStatus() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getGrabStatus(); return this.subWidget.getGrabStatus();
} }
return super.getGrabStatus(); return super.getGrabStatus();
} }
@Override @Override
public boolean getKeyboardRepeat() { public boolean getKeyboardRepeat() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getKeyboardRepeat(); return this.subWidget.getKeyboardRepeat();
} }
return super.getKeyboardRepeat(); return super.getKeyboardRepeat();
} }
@Override @Override
public int getMouseLimit() { public int getMouseLimit() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getMouseLimit(); return this.subWidget.getMouseLimit();
} }
return super.getMouseLimit(); return super.getMouseLimit();
} }
@Override @Override
Vector2f getOffset() { Vector2f getOffset() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -226,7 +226,7 @@ public class Composer extends Container {
} }
return super.getOffset(); return super.getOffset();
} }
@Override @Override
public Vector2f getOrigin() { public Vector2f getOrigin() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -234,79 +234,79 @@ public class Composer extends Container {
} }
return super.getOrigin(); return super.getOrigin();
} }
@Override @Override
public boolean getPropertyCanFocus() { public boolean getPropertyCanFocus() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyCanFocus(); return this.subWidget.getPropertyCanFocus();
} }
return super.getPropertyCanFocus(); return super.getPropertyCanFocus();
} }
@Override @Override
public Vector2b getPropertyExpand() { public Vector2b getPropertyExpand() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyExpand(); return this.subWidget.getPropertyExpand();
} }
return super.getPropertyExpand(); return super.getPropertyExpand();
} }
@Override @Override
public Vector2b getPropertyExpandIfFree() { public Vector2b getPropertyExpandIfFree() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyExpandIfFree(); return this.subWidget.getPropertyExpandIfFree();
} }
return super.getPropertyExpandIfFree(); return super.getPropertyExpandIfFree();
} }
@Override @Override
public Vector2b getPropertyFill() { public Vector2b getPropertyFill() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyFill(); return this.subWidget.getPropertyFill();
} }
return super.getPropertyFill(); return super.getPropertyFill();
} }
@Override @Override
public Gravity getPropertyGravity() { public Gravity getPropertyGravity() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyGravity(); return this.subWidget.getPropertyGravity();
} }
return super.getPropertyGravity(); return super.getPropertyGravity();
} }
@Override @Override
public boolean getPropertyHide() { public boolean getPropertyHide() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyHide(); return this.subWidget.getPropertyHide();
} }
return super.getPropertyHide(); return super.getPropertyHide();
} }
@Override @Override
public Dimension2f getPropertyMaxSize() { public Dimension2f getPropertyMaxSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyMaxSize(); return this.subWidget.getPropertyMaxSize();
} }
return super.getPropertyMaxSize(); return super.getPropertyMaxSize();
} }
@Override @Override
public Dimension2f getPropertyMinSize() { public Dimension2f getPropertyMinSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getPropertyMinSize(); return this.subWidget.getPropertyMinSize();
} }
return super.getPropertyMinSize(); return super.getPropertyMinSize();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "sub-file") @AknotName(value = "sub-file")
@ -314,16 +314,16 @@ public class Composer extends Container {
public Uri getPropertySubFile() { public Uri getPropertySubFile() {
return this.propertySubFile; return this.propertySubFile;
} }
@Override @Override
public Vector2f getSize() { public Vector2f getSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
return this.subWidget.getSize(); return this.subWidget.getSize();
} }
return super.getSize(); return super.getSize();
} }
@Override @Override
public EwolObject getSubObjectNamed(final String objectName) { public EwolObject getSubObjectNamed(final String objectName) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -331,7 +331,7 @@ public class Composer extends Container {
} }
return super.getSubObjectNamed(objectName); return super.getSubObjectNamed(objectName);
} }
@Override @Override
public float getZoom() { public float getZoom() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -339,7 +339,7 @@ public class Composer extends Container {
} }
return super.getZoom(); return super.getZoom();
} }
@Override @Override
public void grabCursor() { public void grabCursor() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -348,7 +348,7 @@ public class Composer extends Container {
} }
super.grabCursor(); super.grabCursor();
} }
@Override @Override
public boolean isFocused() { public boolean isFocused() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -356,7 +356,7 @@ public class Composer extends Container {
} }
return super.isFocused(); return super.isFocused();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "remove-if-under-remove") @AknotName(value = "remove-if-under-remove")
@ -364,7 +364,7 @@ public class Composer extends Container {
public boolean isPropertyRemoveIfUnderRemove() { public boolean isPropertyRemoveIfUnderRemove() {
return this.propertyRemoveIfUnderRemove; return this.propertyRemoveIfUnderRemove;
} }
@Override @Override
public void keepFocus() { public void keepFocus() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -373,7 +373,7 @@ public class Composer extends Container {
} }
super.keepFocus(); super.keepFocus();
} }
/** /**
* load a composition with a file * load a composition with a file
* @param _uri Name of the file * @param _uri Name of the file
@ -396,7 +396,7 @@ public class Composer extends Container {
// T O D O: Change this with a throw.a..a // T O D O: Change this with a throw.a..a
return true; return true;
} }
/** /**
* load a composition with a file * load a composition with a file
* @param composerXmlString xml to parse directly * @param composerXmlString xml to parse directly
@ -419,17 +419,17 @@ public class Composer extends Container {
// T O D O: Change this with a throw.a..a // T O D O: Change this with a throw.a..a
return true; return true;
} }
@Override @Override
public void markToRedraw() { public void markToRedraw() {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.calculateMinMaxSize(); this.subWidget.calculateMinMaxSize();
return; return;
} }
super.markToRedraw(); super.markToRedraw();
} }
protected void onChangePropertySubFile() { protected void onChangePropertySubFile() {
LOGGER.info("Load compositing form external file : " + this.propertySubFile); LOGGER.info("Load compositing form external file : " + this.propertySubFile);
if (this.propertySubFile.isEmpty()) { if (this.propertySubFile.isEmpty()) {
@ -441,7 +441,7 @@ public class Composer extends Container {
LOGGER.error("Can not load Player GUI from file ... " + this.propertySubFile); LOGGER.error("Can not load Player GUI from file ... " + this.propertySubFile);
} }
} }
@Override @Override
public void onChangeSize() { public void onChangeSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -450,7 +450,7 @@ public class Composer extends Container {
} }
super.onChangeSize(); super.onChangeSize();
} }
@Override @Override
public void onEventClipboard(final ClipboardList clipboardID) { public void onEventClipboard(final ClipboardList clipboardID) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -459,7 +459,7 @@ public class Composer extends Container {
} }
super.onEventClipboard(clipboardID); super.onEventClipboard(clipboardID);
} }
@Override @Override
public boolean onEventShortCut( public boolean onEventShortCut(
final KeySpecial special, final KeySpecial special,
@ -471,7 +471,7 @@ public class Composer extends Container {
} }
return super.onEventShortCut(special, unicodeValue, kbMove, isDown); return super.onEventShortCut(special, unicodeValue, kbMove, isDown);
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -480,7 +480,7 @@ public class Composer extends Container {
} }
super.onRegenerateDisplay(); super.onRegenerateDisplay();
} }
@Override @Override
public Vector2f relativePosition(final Vector2f pos) { public Vector2f relativePosition(final Vector2f pos) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -488,7 +488,7 @@ public class Composer extends Container {
} }
return super.relativePosition(pos); return super.relativePosition(pos);
} }
@Override @Override
public void requestDestroyFromChild(final EwolObject child) { public void requestDestroyFromChild(final EwolObject child) {
super.requestDestroyFromChild(child); super.requestDestroyFromChild(child);
@ -497,7 +497,7 @@ public class Composer extends Container {
autoDestroy(); autoDestroy();
} }
} }
@Override @Override
public void requestUpdateSize() { public void requestUpdateSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -506,7 +506,7 @@ public class Composer extends Container {
} }
super.requestUpdateSize(); super.requestUpdateSize();
} }
@Override @Override
public boolean rmFocus() { public boolean rmFocus() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -514,7 +514,7 @@ public class Composer extends Container {
} }
return super.rmFocus(); return super.rmFocus();
} }
@Override @Override
public void setCursor(final Cursor newCursor) { public void setCursor(final Cursor newCursor) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -523,7 +523,7 @@ public class Composer extends Container {
} }
super.setCursor(newCursor); super.setCursor(newCursor);
} }
@Override @Override
public boolean setFocus() { public boolean setFocus() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -531,7 +531,7 @@ public class Composer extends Container {
} }
return super.setFocus(); return super.setFocus();
} }
@Override @Override
public void setMouseLimit(final int numberState) { public void setMouseLimit(final int numberState) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -540,7 +540,7 @@ public class Composer extends Container {
} }
super.setMouseLimit(numberState); super.setMouseLimit(numberState);
} }
@Override @Override
public void setNoMaxSize() { public void setNoMaxSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -549,7 +549,7 @@ public class Composer extends Container {
} }
super.setNoMaxSize(); super.setNoMaxSize();
} }
@Override @Override
public void setNoMinSize() { public void setNoMinSize() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -558,7 +558,7 @@ public class Composer extends Container {
} }
super.setNoMinSize(); super.setNoMinSize();
} }
@Override @Override
public void setOffset(final Vector2f newVal) { public void setOffset(final Vector2f newVal) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -567,7 +567,7 @@ public class Composer extends Container {
} }
super.setOffset(newVal); super.setOffset(newVal);
} }
@Override @Override
public void setOrigin(final Vector2f pos) { public void setOrigin(final Vector2f pos) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -576,7 +576,7 @@ public class Composer extends Container {
} }
super.setOrigin(pos); super.setOrigin(pos);
} }
@Override @Override
public void setPropertyCanFocus(final boolean canFocus) { public void setPropertyCanFocus(final boolean canFocus) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -585,7 +585,7 @@ public class Composer extends Container {
} }
super.setPropertyCanFocus(canFocus); super.setPropertyCanFocus(canFocus);
} }
@Override @Override
public void setPropertyExpand(final Vector2b value) { public void setPropertyExpand(final Vector2b value) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -594,7 +594,7 @@ public class Composer extends Container {
} }
super.setPropertyExpand(value); super.setPropertyExpand(value);
} }
@Override @Override
public void setPropertyExpandIfFree(final Vector2b value) { public void setPropertyExpandIfFree(final Vector2b value) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -603,7 +603,7 @@ public class Composer extends Container {
} }
super.setPropertyExpandIfFree(value); super.setPropertyExpandIfFree(value);
} }
@Override @Override
public void setPropertyFill(final Vector2b value) { public void setPropertyFill(final Vector2b value) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -612,7 +612,7 @@ public class Composer extends Container {
} }
super.setPropertyFill(value); super.setPropertyFill(value);
} }
@Override @Override
public void setPropertyGravity(final Gravity gravity) { public void setPropertyGravity(final Gravity gravity) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -621,7 +621,7 @@ public class Composer extends Container {
} }
super.setPropertyGravity(gravity); super.setPropertyGravity(gravity);
} }
@Override @Override
public void setPropertyHide(final boolean value) { public void setPropertyHide(final boolean value) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -630,7 +630,7 @@ public class Composer extends Container {
} }
super.setPropertyHide(value); super.setPropertyHide(value);
} }
@Override @Override
public void setPropertyMaxSize(final Dimension2f value) { public void setPropertyMaxSize(final Dimension2f value) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -639,7 +639,7 @@ public class Composer extends Container {
} }
super.setPropertyMaxSize(value); super.setPropertyMaxSize(value);
} }
@Override @Override
public void setPropertyMinSize(final Dimension2f value) { public void setPropertyMinSize(final Dimension2f value) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -648,14 +648,14 @@ public class Composer extends Container {
} }
super.setPropertyMinSize(value); super.setPropertyMinSize(value);
} }
public void setPropertyRemoveIfUnderRemove(final boolean propertyRemoveIfUnderRemove) { public void setPropertyRemoveIfUnderRemove(final boolean propertyRemoveIfUnderRemove) {
if (this.propertyRemoveIfUnderRemove == propertyRemoveIfUnderRemove) { if (this.propertyRemoveIfUnderRemove == propertyRemoveIfUnderRemove) {
return; return;
} }
this.propertyRemoveIfUnderRemove = propertyRemoveIfUnderRemove; this.propertyRemoveIfUnderRemove = propertyRemoveIfUnderRemove;
} }
public void setPropertySubFile(final Uri propertySubFile) { public void setPropertySubFile(final Uri propertySubFile) {
if (this.propertySubFile.equals(propertySubFile)) { if (this.propertySubFile.equals(propertySubFile)) {
return; return;
@ -663,7 +663,7 @@ public class Composer extends Container {
this.propertySubFile = propertySubFile; this.propertySubFile = propertySubFile;
onChangePropertySubFile(); onChangePropertySubFile();
} }
@Override @Override
public void setSize(final Vector2f value) { public void setSize(final Vector2f value) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -672,7 +672,7 @@ public class Composer extends Container {
} }
super.setSize(value); super.setSize(value);
} }
@Override @Override
public void setZoom(final float newVal) { public void setZoom(final float newVal) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -681,7 +681,7 @@ public class Composer extends Container {
} }
super.setZoom(newVal); super.setZoom(newVal);
} }
@Override @Override
public void systemDraw(final DrawProperty displayProp) { public void systemDraw(final DrawProperty displayProp) {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -690,7 +690,7 @@ public class Composer extends Container {
} }
super.systemDraw(displayProp); super.systemDraw(displayProp);
} }
@Override @Override
public void unGrabCursor() { public void unGrabCursor() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -699,5 +699,5 @@ public class Composer extends Container {
} }
super.unGrabCursor(); super.unGrabCursor();
} }
} }

View File

@ -158,11 +158,15 @@ public class Container extends Widget {
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
regenerateDisplay();
}
public void regenerateDisplay() {
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.systemRegenerateDisplay(); this.subWidget.systemRegenerateDisplay();
} }
} }
@Override @Override
public void requestDestroyFromChild(final EwolObject child) { public void requestDestroyFromChild(final EwolObject child) {
if (this.subWidget != child) { if (this.subWidget != child) {

View File

@ -160,6 +160,10 @@ public class ContainerN extends Widget {
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
regenerateDisplay();
}
public void regenerateDisplay() {
for (final Widget it : this.subWidget) { for (final Widget it : this.subWidget) {
if (it != null) { if (it != null) {
it.systemRegenerateDisplay(); it.systemRegenerateDisplay();

View File

@ -23,7 +23,7 @@ public class ContainerToggle extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(ContainerToggle.class); private static final Logger LOGGER = LoggerFactory.getLogger(ContainerToggle.class);
protected Widget[] subWidget = new Widget[2]; protected Widget[] subWidget = new Widget[2];
int idWidgetDisplayed = 0; //!< current widget displayed int idWidgetDisplayed = 0; //!< current widget displayed
/** /**
* Constructor * Constructor
*/ */
@ -31,7 +31,7 @@ public class ContainerToggle extends Widget {
this.subWidget[0] = null; this.subWidget[0] = null;
this.subWidget[1] = null; this.subWidget[1] = null;
} }
void calculateMinMaxSizePadded(final Padding padding) { void calculateMinMaxSizePadded(final Padding padding) {
// call main class // call main class
this.minSize = Vector2f.ZERO; this.minSize = Vector2f.ZERO;
@ -50,7 +50,7 @@ public class ContainerToggle extends Widget {
//markToRedraw(); //markToRedraw();
LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize); LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize);
} }
@Override @Override
public void drawWidgetTree(int level) { public void drawWidgetTree(int level) {
super.drawWidgetTree(level); super.drawWidgetTree(level);
@ -62,7 +62,7 @@ public class ContainerToggle extends Widget {
this.subWidget[1].drawWidgetTree(level); this.subWidget[1].drawWidgetTree(level);
} }
} }
@Override @Override
public EwolObject getSubObjectNamed(final String widgetName) { public EwolObject getSubObjectNamed(final String widgetName) {
EwolObject tmpObject = super.getSubObjectNamed(widgetName); EwolObject tmpObject = super.getSubObjectNamed(widgetName);
@ -80,14 +80,14 @@ public class ContainerToggle extends Widget {
} }
return null; return null;
} }
@AknotManaged @AknotManaged
@AknotFactory(value = WidgetXmlFactory.class) @AknotFactory(value = WidgetXmlFactory.class)
@AknotDescription(value = "Request the widget Expand size while free space is detected (does not generate expand in upper widget)") @AknotDescription(value = "Request the widget Expand size while free space is detected (does not generate expand in upper widget)")
public Widget[] getSubWidgets() { public Widget[] getSubWidgets() {
return this.subWidget; return this.subWidget;
} }
public Padding onChangeSizePadded(final Padding padding) { public Padding onChangeSizePadded(final Padding padding) {
super.onChangeSize(); super.onChangeSize();
final Vector2f localAvaillable = this.size.less(padding.x(), padding.y()); final Vector2f localAvaillable = this.size.less(padding.x(), padding.y());
@ -121,14 +121,14 @@ public class ContainerToggle extends Widget {
return new Padding(selectableAreaPos.x(), selectableAreaEndPos.y(), selectableAreaEndPos.x(), return new Padding(selectableAreaPos.x(), selectableAreaEndPos.y(), selectableAreaEndPos.x(),
selectableAreaPos.y()); selectableAreaPos.y());
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
if (this.subWidget[this.idWidgetDisplayed] != null) { if (this.subWidget[this.idWidgetDisplayed] != null) {
this.subWidget[this.idWidgetDisplayed].onRegenerateDisplay(); this.subWidget[this.idWidgetDisplayed].onRegenerateDisplay();
} }
} }
@Override @Override
public void requestDestroyFromChild(final EwolObject child) { public void requestDestroyFromChild(final EwolObject child) {
if (this.subWidget[0] == child) { if (this.subWidget[0] == child) {
@ -148,7 +148,7 @@ public class ContainerToggle extends Widget {
markToRedraw(); markToRedraw();
} }
} }
@Override @Override
public void setOffset(final Vector2f newVal) { public void setOffset(final Vector2f newVal) {
if (this.offset.equals(newVal)) { if (this.offset.equals(newVal)) {
@ -158,12 +158,12 @@ public class ContainerToggle extends Widget {
// recalculate the new size and position of sub widget ... // recalculate the new size and position of sub widget ...
onChangeSize(); onChangeSize();
} }
@AknotManaged(value = false) @AknotManaged(value = false)
public void setSubWidget(final Widget newWidget) { public void setSubWidget(final Widget newWidget) {
setSubWidget(newWidget, 0); setSubWidget(newWidget, 0);
} }
/** /**
* set the subWidget node widget. * set the subWidget node widget.
* @param newWidget The widget to add. * @param newWidget The widget to add.
@ -178,13 +178,13 @@ public class ContainerToggle extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setSubWidgets(final Widget[] newWidget) { public void setSubWidgets(final Widget[] newWidget) {
for (int iii = 0; iii < Math.min(newWidget.length, this.subWidget.length); iii++) { for (int iii = 0; iii < Math.min(newWidget.length, this.subWidget.length); iii++) {
setSubWidget(newWidget[iii], iii); setSubWidget(newWidget[iii], iii);
} }
} }
public void subWidgetRemove(final int idWidget) { public void subWidgetRemove(final int idWidget) {
if (this.subWidget[idWidget] != null) { if (this.subWidget[idWidget] != null) {
LOGGER.trace("Remove widget : " + idWidget); LOGGER.trace("Remove widget : " + idWidget);
@ -194,7 +194,7 @@ public class ContainerToggle extends Widget {
requestUpdateSize(); requestUpdateSize();
} }
} }
public void subWidgetReplace(final Widget oldWidget, final Widget newWidget) { public void subWidgetReplace(final Widget oldWidget, final Widget newWidget) {
boolean haveChange = false; boolean haveChange = false;
for (int iii = 0; iii < this.subWidget.length; ++iii) { for (int iii = 0; iii < this.subWidget.length; ++iii) {
@ -215,7 +215,7 @@ public class ContainerToggle extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void subWidgetUnLink(final int idWidget) { public void subWidgetUnLink(final int idWidget) {
if (this.subWidget[idWidget] != null) { if (this.subWidget[idWidget] != null) {
this.subWidget[idWidget].removeParent(); this.subWidget[idWidget].removeParent();
@ -223,7 +223,7 @@ public class ContainerToggle extends Widget {
} }
this.subWidget[idWidget] = null; this.subWidget[idWidget] = null;
} }
@Override @Override
public void systemDraw(final DrawProperty displayProp) { public void systemDraw(final DrawProperty displayProp) {
if (this.propertyHide) { if (this.propertyHide) {

View File

@ -41,7 +41,7 @@ import org.slf4j.LoggerFactory;
*/ */
public class Entry extends Box { public class Entry extends Box {
private static final Logger LOGGER = LoggerFactory.getLogger(Entry.class); private static final Logger LOGGER = LoggerFactory.getLogger(Entry.class);
/** /**
* Periodic call to update graphic display * Periodic call to update graphic display
* @param _event Time generic event * @param _event Time generic event
@ -53,7 +53,7 @@ public class Entry extends Box {
// } // }
self.markToRedraw(); self.markToRedraw();
} }
/// color property of the text foreground /// color property of the text foreground
private int colorIdTextFg; private int colorIdTextFg;
/// Cursor must be display only when the widget has the focus /// Cursor must be display only when the widget has the focus
@ -74,16 +74,16 @@ public class Entry extends Box {
protected Connection periodicConnectionHanble = new Connection(); protected Connection periodicConnectionHanble = new Connection();
private int propertyMaxCharacter = Integer.MAX_VALUE; //!< number max of Character in the list private int propertyMaxCharacter = Integer.MAX_VALUE; //!< number max of Character in the list
private boolean propertyPassword = false; //!< Disable display of the content of the entry private boolean propertyPassword = false; //!< Disable display of the content of the entry
/// regular expression value /// regular expression value
private String propertyRegex = ".*"; private String propertyRegex = ".*";
/// Text to display when nothing in in the entry (decorated text...) /// Text to display when nothing in in the entry (decorated text...)
private String propertyTextWhenNothing = null; private String propertyTextWhenNothing = null;
private String propertyValue = "Test Text..."; //!< string that must be displayed private String propertyValue = "Test Text..."; //!< string that must be displayed
private Pattern regex = null; //!< regular expression to check content private Pattern regex = null; //!< regular expression to check content
//.create() //.create()
@AknotSignal @AknotSignal
@AknotName(value = "click") @AknotName(value = "click")
@ -93,12 +93,12 @@ public class Entry extends Box {
@AknotName(value = "enter") @AknotName(value = "enter")
@AknotDescription("The cursor enter inside the button") @AknotDescription("The cursor enter inside the button")
public Signal<String> signalEnter = new Signal<>(); //!< Enter key is pressed public Signal<String> signalEnter = new Signal<>(); //!< Enter key is pressed
@AknotSignal @AknotSignal
@AknotName(value = "modify") @AknotName(value = "modify")
@AknotDescription("Entry box value change") @AknotDescription("Entry box value change")
public Signal<String> signalModify = new Signal<>(); //!< data change public Signal<String> signalModify = new Signal<>(); //!< data change
/** /**
* Constructor * Constructor
* @param _newData The USting that might be set in the Entry box (no event generation!!) * @param _newData The USting that might be set in the Entry box (no event generation!!)
@ -106,7 +106,7 @@ public class Entry extends Box {
public Entry() { public Entry() {
this.propertyCanFocus = true; this.propertyCanFocus = true;
//onChangePropertyShaper(); //onChangePropertyShaper();
this.regex = Pattern.compile(this.propertyRegex); this.regex = Pattern.compile(this.propertyRegex);
if (this.regex == null) { if (this.regex == null) {
LOGGER.error("can not parse regex for : " + this.propertyRegex); LOGGER.error("can not parse regex for : " + this.propertyRegex);
@ -124,12 +124,12 @@ public class Entry extends Box {
setPropertyBorderWidth(new DimensionInsets(2)); setPropertyBorderWidth(new DimensionInsets(2));
setPropertyPadding(new DimensionInsets(4)); setPropertyPadding(new DimensionInsets(4));
} }
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
calculateMinMaxSizeChild(new Vector2f(25, this.text.getHeight())); calculateMinMaxSizeChild(new Vector2f(25, this.text.getHeight()));
} }
protected void changeStatusIn(final GuiShapeMode newStatusId) { protected void changeStatusIn(final GuiShapeMode newStatusId) {
// if (this.shape.changeStatusIn(newStatusId)) { // if (this.shape.changeStatusIn(newStatusId)) {
// if (!this.periodicConnectionHanble.isConnected()) { // if (!this.periodicConnectionHanble.isConnected()) {
@ -140,7 +140,7 @@ public class Entry extends Box {
// markToRedraw(); // markToRedraw();
// } // }
} }
/** /**
* Copy the selected data on the specify clipboard * Copy the selected data on the specify clipboard
* @param clipboardID Selected clipboard * @param clipboardID Selected clipboard
@ -160,44 +160,44 @@ public class Entry extends Box {
final String tmpData = this.propertyValue.substring(pos1, pos2); final String tmpData = this.propertyValue.substring(pos1, pos2);
ClipBoard.set(clipboardID, tmpData); ClipBoard.set(clipboardID, tmpData);
} }
public int getPropertyMaxCharacter() { public int getPropertyMaxCharacter() {
return this.propertyMaxCharacter; return this.propertyMaxCharacter;
} }
public String getPropertyRegex() { public String getPropertyRegex() {
return this.propertyRegex; return this.propertyRegex;
} }
public String getPropertyTextWhenNothing() { public String getPropertyTextWhenNothing() {
return this.propertyTextWhenNothing; return this.propertyTextWhenNothing;
} }
public String getPropertyValue() { public String getPropertyValue() {
return this.propertyValue; return this.propertyValue;
} }
public boolean isPropertyPassword() { public boolean isPropertyPassword() {
return this.propertyPassword; return this.propertyPassword;
} }
/** /**
* informe the system thet the text change and the start position change * informe the system thet the text change and the start position change
*/ */
protected void markToUpdateTextPosition() { protected void markToUpdateTextPosition() {
this.needUpdateTextPos = true; this.needUpdateTextPos = true;
} }
private void onCallbackCopy() { private void onCallbackCopy() {
copySelectionToClipBoard(ClipboardList.CLIPBOARD_STD); copySelectionToClipBoard(ClipboardList.CLIPBOARD_STD);
} }
private void onCallbackCut() { private void onCallbackCut() {
copySelectionToClipBoard(ClipboardList.CLIPBOARD_STD); copySelectionToClipBoard(ClipboardList.CLIPBOARD_STD);
removeSelected(); removeSelected();
this.signalModify.emit(this.propertyValue); this.signalModify.emit(this.propertyValue);
} }
private void onCallbackEntryClean() { private void onCallbackEntryClean() {
this.propertyValue = ""; this.propertyValue = "";
this.displayStartPosition = 0; this.displayStartPosition = 0;
@ -205,11 +205,11 @@ public class Entry extends Box {
this.displayCursorPosSelection = this.displayCursorPos; this.displayCursorPosSelection = this.displayCursorPos;
markToRedraw(); markToRedraw();
} }
private void onCallbackPaste() { private void onCallbackPaste() {
ClipBoard.request(ClipboardList.CLIPBOARD_STD); ClipBoard.request(ClipboardList.CLIPBOARD_STD);
} }
private void onCallbackSelect(final boolean all) { private void onCallbackSelect(final boolean all) {
if (all) { if (all) {
this.displayCursorPosSelection = 0; this.displayCursorPosSelection = 0;
@ -219,7 +219,7 @@ public class Entry extends Box {
} }
markToRedraw(); markToRedraw();
} }
private void onCallbackShortCut(final String value) { private void onCallbackShortCut(final String value) {
if (value.equals("clean")) { if (value.equals("clean")) {
onCallbackEntryClean(); onCallbackEntryClean();
@ -238,15 +238,15 @@ public class Entry extends Box {
LOGGER.warn("Unknow event from ShortCut : " + value); LOGGER.warn("Unknow event from ShortCut : " + value);
} }
} }
protected void onChangePropertyMaxCharacter() { protected void onChangePropertyMaxCharacter() {
// TODO : check number of char in the data // TODO : check number of char in the data
} }
protected void onChangePropertyPassword() { protected void onChangePropertyPassword() {
markToRedraw(); markToRedraw();
} }
protected void onChangePropertyRegex() { protected void onChangePropertyRegex() {
this.regex = Pattern.compile(this.propertyRegex); this.regex = Pattern.compile(this.propertyRegex);
if (this.regex != null) { if (this.regex != null) {
@ -254,11 +254,11 @@ public class Entry extends Box {
} }
markToRedraw(); markToRedraw();
} }
protected void onChangePropertyTextWhenNothing() { protected void onChangePropertyTextWhenNothing() {
markToRedraw(); markToRedraw();
} }
protected void onChangePropertyValue() { protected void onChangePropertyValue() {
String newData = this.propertyValue; String newData = this.propertyValue;
if ((long) newData.length() > this.propertyMaxCharacter) { if ((long) newData.length() > this.propertyMaxCharacter) {
@ -274,13 +274,13 @@ public class Entry extends Box {
} }
markToRedraw(); markToRedraw();
} }
@Override @Override
protected void onDraw() { protected void onDraw() {
super.onDraw(); super.onDraw();
this.text.draw(); this.text.draw();
} }
@Override @Override
public void onEventClipboard(final ClipboardList clipboardID) { public void onEventClipboard(final ClipboardList clipboardID) {
// remove current selected data ... // remove current selected data ...
@ -304,7 +304,7 @@ public class Entry extends Box {
} }
this.signalModify.emit(this.propertyValue); this.signalModify.emit(this.propertyValue);
} }
@Override @Override
public boolean onEventEntry(final EventEntry event) { public boolean onEventEntry(final EventEntry event) {
LOGGER.trace("Event on Entry ... " + event); LOGGER.trace("Event on Entry ... " + event);
@ -380,7 +380,7 @@ public class Entry extends Box {
} }
return false; return false;
} }
@Override @Override
protected boolean onEventInput(final EventInput event) { protected boolean onEventInput(final EventInput event) {
final Vector2f absolutePosition = event.pos(); final Vector2f absolutePosition = event.pos();
@ -482,7 +482,7 @@ public class Entry extends Box {
} }
return false; return false;
} }
@Override @Override
protected void onGetFocus() { protected void onGetFocus() {
this.displayCursor = true; this.displayCursor = true;
@ -490,7 +490,7 @@ public class Entry extends Box {
showKeyboard(); showKeyboard();
markToRedraw(); markToRedraw();
} }
@Override @Override
protected void onLostFocus() { protected void onLostFocus() {
this.displayCursor = false; this.displayCursor = false;
@ -498,17 +498,22 @@ public class Entry extends Box {
hideKeyboard(); hideKeyboard();
markToRedraw(); markToRedraw();
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
if (!needRedraw()) { if (!needRedraw()) {
return; return;
} }
super.onRegenerateDisplay(); regenerateDisplay();
}
@Override
public void regenerateDisplay() {
super.regenerateDisplay();
// calculate the vertical offset to center the text: // calculate the vertical offset to center the text:
final float offsetCenter = FMath.max(0.0f, final float offsetCenter = FMath.max(0.0f,
(FMath.abs(this.insidePositionStop.y() - this.insidePositionStart.y()) - this.text.getHeight()) * 0.5f); (FMath.abs(this.insidePositionStop.y() - this.insidePositionStart.y()) - this.text.getHeight()) * 0.5f);
this.text.clear(); this.text.clear();
//this.text.setClippingWidth(this.insidePositionStart, this.insidePositionStop); //this.text.setClippingWidth(this.insidePositionStart, this.insidePositionStop);
this.text.setPos(this.insidePositionStart.add(0, offsetCenter)); this.text.setPos(this.insidePositionStart.add(0, offsetCenter));
@ -521,7 +526,7 @@ public class Entry extends Box {
if (this.propertyPassword) { if (this.propertyPassword) {
Arrays.fill(valueToDisplay, '*'); Arrays.fill(valueToDisplay, '*');
} }
//final Vector2f plop = new Vector2f(tmpOriginText.x() + this.displayStartPosition, tmpOriginText.y()); //final Vector2f plop = new Vector2f(tmpOriginText.x() + this.displayStartPosition, tmpOriginText.y());
if (valueToDisplay.length != 0) { if (valueToDisplay.length != 0) {
this.text.print(new String(valueToDisplay)); this.text.print(new String(valueToDisplay));
@ -531,7 +536,7 @@ public class Entry extends Box {
this.text.setClippingMode(false); this.text.setClippingMode(false);
this.text.flush(); this.text.flush();
} }
/** /**
* remove the selected area * remove the selected area
* @note This request a regeneration of the display * @note This request a regeneration of the display
@ -559,7 +564,7 @@ public class Entry extends Box {
this.propertyValue = tmp.toString(); this.propertyValue = tmp.toString();
markToRedraw(); markToRedraw();
} }
/** /**
* internal check the value with RegExp checking * internal check the value with RegExp checking
* @param newData The new string to display * @param newData The new string to display
@ -586,7 +591,7 @@ public class Entry extends Box {
this.propertyValue = newData; this.propertyValue = newData;
markToRedraw(); markToRedraw();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "max") @AknotName(value = "max")
@ -598,7 +603,7 @@ public class Entry extends Box {
this.propertyMaxCharacter = propertyMaxCharacter; this.propertyMaxCharacter = propertyMaxCharacter;
onChangePropertyMaxCharacter(); onChangePropertyMaxCharacter();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "password") @AknotName(value = "password")
@ -610,7 +615,7 @@ public class Entry extends Box {
this.propertyPassword = propertyPassword; this.propertyPassword = propertyPassword;
onChangePropertyPassword(); onChangePropertyPassword();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "regex") @AknotName(value = "regex")
@ -622,7 +627,7 @@ public class Entry extends Box {
this.propertyRegex = propertyRegex; this.propertyRegex = propertyRegex;
onChangePropertyRegex(); onChangePropertyRegex();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "empty-text") @AknotName(value = "empty-text")
@ -634,7 +639,7 @@ public class Entry extends Box {
this.propertyTextWhenNothing = propertyTextWhenNothing; this.propertyTextWhenNothing = propertyTextWhenNothing;
onChangePropertyTextWhenNothing(); onChangePropertyTextWhenNothing();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "value") @AknotName(value = "value")
@ -646,22 +651,22 @@ public class Entry extends Box {
this.propertyValue = propertyValue; this.propertyValue = propertyValue;
onChangePropertyValue(); onChangePropertyValue();
} }
/** /**
* change the cursor position with the curent position requested on the display * change the cursor position with the current position requested on the display
* @param pos Absolute position of the event * @param pos Absolute position of the event
* @note The display is automaticly requested when change apear. * @note The display is automatically requested when change appear.
*/ */
protected void updateCursorPosition(final Vector2f pos) { protected void updateCursorPosition(final Vector2f pos) {
updateCursorPosition(pos, false); updateCursorPosition(pos, false);
} }
protected void updateCursorPosition(final Vector2f pos, final boolean selection/*=false*/) { protected void updateCursorPosition(final Vector2f pos, final boolean selection/*=false*/) {
final Padding padding = Padding.ZERO; final Padding padding = Padding.ZERO;
final Vector2f relPos = relativePosition(pos).less(this.overPositionStart); final Vector2f relPos = relativePosition(pos).less(this.overPositionStart);
// reject when outside ... // reject when outside ...
// try to find the new cursor position : // try to find the new cursor position :
if (this.displayStartPosition > this.propertyValue.length()) { if (this.displayStartPosition > this.propertyValue.length()) {
this.displayStartPosition = this.propertyValue.length(); this.displayStartPosition = this.propertyValue.length();
@ -699,7 +704,7 @@ public class Entry extends Box {
} }
markToUpdateTextPosition(); markToUpdateTextPosition();
} }
/** /**
* update the display position start == > depending of the position of the Cursor and the size of the Data inside * update the display position start == > depending of the position of the Cursor and the size of the Data inside
* @change this.displayStartPosition < == updated * @change this.displayStartPosition < == updated
@ -709,7 +714,7 @@ public class Entry extends Box {
return; return;
} }
final Padding padding = Padding.ZERO; final Padding padding = Padding.ZERO;
int tmpSizeX = (int) this.minSize.x(); int tmpSizeX = (int) this.minSize.x();
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
tmpSizeX = (int) this.size.x(); tmpSizeX = (int) this.size.x();
@ -739,5 +744,5 @@ public class Entry extends Box {
//this.displayStartPosition = -totalWidth + tmpUserSize; //this.displayStartPosition = -totalWidth + tmpUserSize;
} }
} }
} }

View File

@ -18,29 +18,29 @@ import org.slf4j.LoggerFactory;
*/ */
class Gird extends Widget { class Gird extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Gird.class); private static final Logger LOGGER = LoggerFactory.getLogger(Gird.class);
protected class GirdProperties { protected class GirdProperties {
public Widget widget; public Widget widget;
public int row; public int row;
public int col; public int col;
} }
protected int sizeRow = 0; //!< size of all lines (row) (if set (otherwise 0)) == > we have a only one size ==> multiple size will have no use ... protected int sizeRow = 0; //!< size of all lines (row) (if set (otherwise 0)) == > we have a only one size ==> multiple size will have no use ...
protected int uniformSizeRow = 0; protected int uniformSizeRow = 0;
protected List<Integer> sizeCol = new ArrayList<>(); //!< size of all colomn (if set (otherwise 0)) protected List<Integer> sizeCol = new ArrayList<>(); //!< size of all colomn (if set (otherwise 0))
protected List<GirdProperties> subWidget = new ArrayList<>(); //!< all sub widget are contained in this element protected List<GirdProperties> subWidget = new ArrayList<>(); //!< all sub widget are contained in this element
protected Widget tmpWidget = null; //!< use when replace a widget ... protected Widget tmpWidget = null; //!< use when replace a widget ...
protected boolean gavityButtom = true; protected boolean gavityButtom = true;
protected Vector2f propertyBorderSize = Vector2f.ZERO; //!< Border size needed for all the display protected Vector2f propertyBorderSize = Vector2f.ZERO; //!< Border size needed for all the display
/** /**
* Constructor * Constructor
*/ */
public Gird() { public Gird() {
} }
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
for (int iii = 0; iii < this.sizeCol.size(); iii++) { for (int iii = 0; iii < this.sizeCol.size(); iii++) {
@ -72,7 +72,7 @@ class Gird extends Widget {
} }
} }
} }
if (this.sizeRow > 0) { if (this.sizeRow > 0) {
this.uniformSizeRow = this.sizeRow; this.uniformSizeRow = this.sizeRow;
} }
@ -83,12 +83,12 @@ class Gird extends Widget {
LOGGER.debug(" tmpSizeWidth=" + tmpSizeWidth); LOGGER.debug(" tmpSizeWidth=" + tmpSizeWidth);
LOGGER.debug(" this.uniformSizeRow=" + this.uniformSizeRow); LOGGER.debug(" this.uniformSizeRow=" + this.uniformSizeRow);
this.minSize = this.minSize.add(tmpSizeWidth, (lastLineID + 1) * this.uniformSizeRow); this.minSize = this.minSize.add(tmpSizeWidth, (lastLineID + 1) * this.uniformSizeRow);
LOGGER.debug("Calculate min size : " + this.minSize); LOGGER.debug("Calculate min size : " + this.minSize);
//LOGGER.debug("Vert Result : expand="+ this.userExpand + " minSize="+ this.minSize); //LOGGER.debug("Vert Result : expand="+ this.userExpand + " minSize="+ this.minSize);
} }
/** /**
* get the current border size of the current element: * get the current border size of the current element:
* @return the border size (0 if not used) * @return the border size (0 if not used)
@ -96,7 +96,7 @@ class Gird extends Widget {
public Vector2f getBorderSize() { public Vector2f getBorderSize() {
return this.propertyBorderSize; return this.propertyBorderSize;
} }
/** /**
* get the size view of a colomn. * get the size view of a colomn.
* @param colId Id of the colomn [0..x]. * @param colId Id of the colomn [0..x].
@ -112,11 +112,11 @@ class Gird extends Widget {
LOGGER.error("Can not get the Colomn size : " + colId + 1 + " we have " + this.sizeCol.size() + " colomn"); LOGGER.error("Can not get the Colomn size : " + colId + 1 + " we have " + this.sizeCol.size() + " colomn");
return 0; return 0;
} }
public Vector2f getPropertyBorderSize() { public Vector2f getPropertyBorderSize() {
return this.propertyBorderSize; return this.propertyBorderSize;
} }
/** /**
* get the size view of the lines. * get the size view of the lines.
* @return The size of the lines. * @return The size of the lines.
@ -124,7 +124,7 @@ class Gird extends Widget {
public int getRowSize() { public int getRowSize() {
return this.sizeRow; return this.sizeRow;
} }
@Override @Override
public Widget getWidgetAtPos(final Vector2f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
if (this.propertyHide) { if (this.propertyHide) {
@ -149,12 +149,12 @@ class Gird extends Widget {
} }
return null; return null;
} }
@Override @Override
public void onChangeSize() { public void onChangeSize() {
//LOGGER.debug("Update size"); //LOGGER.debug("Update size");
this.size = this.size.less(this.propertyBorderSize.multiply(2)); this.size = this.size.less(this.propertyBorderSize.multiply(2));
for (int iii = 0; iii < this.subWidget.size(); iii++) { for (int iii = 0; iii < this.subWidget.size(); iii++) {
if (this.subWidget.get(iii).widget != null) { if (this.subWidget.get(iii).widget != null) {
//calculate the origin : //calculate the origin :
@ -162,7 +162,7 @@ class Gird extends Widget {
if (!this.gavityButtom) { if (!this.gavityButtom) {
tmpOrigin = tmpOrigin.add(0, this.size.y() - this.propertyBorderSize.y()); tmpOrigin = tmpOrigin.add(0, this.size.y() - this.propertyBorderSize.y());
} }
int tmpSizeWidth = 0; int tmpSizeWidth = 0;
for (int jjj = 0; jjj < this.subWidget.get(iii).col; jjj++) { for (int jjj = 0; jjj < this.subWidget.get(iii).col; jjj++) {
tmpSizeWidth += Math.abs(this.sizeCol.get(jjj)); tmpSizeWidth += Math.abs(this.sizeCol.get(jjj));
@ -175,7 +175,7 @@ class Gird extends Widget {
addingPos = -(this.subWidget.get(iii).row + 1) * this.uniformSizeRow; addingPos = -(this.subWidget.get(iii).row + 1) * this.uniformSizeRow;
} }
tmpOrigin = tmpOrigin.add(tmpSizeWidth, addingPos); tmpOrigin = tmpOrigin.add(tmpSizeWidth, addingPos);
LOGGER.debug(" [{}] set subwidget origin={} size={}", iii, tmpOrigin, LOGGER.debug(" [{}] set subwidget origin={} size={}", iii, tmpOrigin,
new Vector2f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow)); new Vector2f(Math.abs(this.sizeCol.get(this.subWidget.get(iii).col)), this.uniformSizeRow));
// set the origin : // set the origin :
@ -191,7 +191,7 @@ class Gird extends Widget {
LOGGER.debug("Calculate size : " + this.size); LOGGER.debug("Calculate size : " + this.size);
markToRedraw(); markToRedraw();
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
for (final GirdProperties it : this.subWidget) { for (final GirdProperties it : this.subWidget) {
@ -200,7 +200,7 @@ class Gird extends Widget {
} }
} }
} }
/** /**
* set the current border size of the current element: * set the current border size of the current element:
* @param newBorderSize The border size to set (0 if not used) * @param newBorderSize The border size to set (0 if not used)
@ -208,7 +208,7 @@ class Gird extends Widget {
public void setBorderSize(final Vector2f newBorderSize) { public void setBorderSize(final Vector2f newBorderSize) {
this.propertyBorderSize = newBorderSize; this.propertyBorderSize = newBorderSize;
} }
/** /**
* set the number of colomn * set the number of colomn
* @param colNumber Nuber of colomn * @param colNumber Nuber of colomn
@ -244,7 +244,7 @@ class Gird extends Widget {
} }
} }
} }
/** /**
* change a size view of a colomn. * change a size view of a colomn.
* @param colId Id of the colomn [0..x]. * @param colId Id of the colomn [0..x].
@ -258,7 +258,7 @@ class Gird extends Widget {
+ this.sizeCol.size() + " colomn"); + this.sizeCol.size() + " colomn");
} }
} }
/** /**
* set the gravity of the widget on the Button (index 0 is on buttom) * set the gravity of the widget on the Button (index 0 is on buttom)
*/ */
@ -266,7 +266,7 @@ class Gird extends Widget {
this.gavityButtom = true; this.gavityButtom = true;
markToRedraw(); markToRedraw();
} }
/** /**
* set the gravity of the widget on the Top (index 0 is on top) * set the gravity of the widget on the Top (index 0 is on top)
*/ */
@ -274,7 +274,7 @@ class Gird extends Widget {
this.gavityButtom = false; this.gavityButtom = false;
markToRedraw(); markToRedraw();
} }
public void setPropertyBorderSize(final Vector2f propertyBorderSize) { public void setPropertyBorderSize(final Vector2f propertyBorderSize) {
this.propertyBorderSize = propertyBorderSize; this.propertyBorderSize = propertyBorderSize;
if (this.propertyBorderSize.x() < 0) { if (this.propertyBorderSize.x() < 0) {
@ -288,7 +288,7 @@ class Gird extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
/** /**
* change a size view of a line. * change a size view of a line.
* @param size size of the line. * @param size size of the line.
@ -296,7 +296,7 @@ class Gird extends Widget {
public void setRowSize(final int size) { public void setRowSize(final int size) {
this.sizeRow = size; this.sizeRow = size;
} }
/** /**
* add at end position a Widget (note : This system use an inverted phylisophie (button to top, and left to right) * add at end position a Widget (note : This system use an inverted phylisophie (button to top, and left to right)
* @param colId Id of the colomn [0..x]. * @param colId Id of the colomn [0..x].
@ -311,7 +311,7 @@ class Gird extends Widget {
prop.row = rowId; prop.row = rowId;
prop.col = colId; prop.col = colId;
prop.widget = newWidget; prop.widget = newWidget;
// need to find the correct position : // need to find the correct position :
for (int iii = 0; iii < this.subWidget.size(); iii++) { for (int iii = 0; iii < this.subWidget.size(); iii++) {
if (this.subWidget.get(iii).row < prop.row) { if (this.subWidget.get(iii).row < prop.row) {
@ -336,7 +336,7 @@ class Gird extends Widget {
// not find == > just adding it ... // not find == > just adding it ...
this.subWidget.add(prop); this.subWidget.add(prop);
} }
/** /**
* remove definitly a widget from the system and this Gird. * remove definitly a widget from the system and this Gird.
* @param colId Id of the colomn [0..x]. * @param colId Id of the colomn [0..x].
@ -357,7 +357,7 @@ class Gird extends Widget {
} }
LOGGER.warn("[" + getId() + "] Can not remove unExistant widget"); LOGGER.warn("[" + getId() + "] Can not remove unExistant widget");
} }
/** /**
* remove definitly a widget from the system and this Gird. * remove definitly a widget from the system and this Gird.
* @param newWidget the element pointer. * @param newWidget the element pointer.
@ -371,7 +371,7 @@ class Gird extends Widget {
} }
LOGGER.warn("[" + getId() + "] Can not remove unExistant widget"); LOGGER.warn("[" + getId() + "] Can not remove unExistant widget");
} }
/** /**
* remove all sub element from the widget. * remove all sub element from the widget.
*/ */
@ -379,7 +379,7 @@ class Gird extends Widget {
final int errorControl = this.subWidget.size(); final int errorControl = this.subWidget.size();
this.subWidget.clear(); this.subWidget.clear();
} }
/** /**
* Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...). * Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...).
* @param colId Id of the colomn [0..x]. * @param colId Id of the colomn [0..x].
@ -399,7 +399,7 @@ class Gird extends Widget {
} }
LOGGER.warn("[" + getId() + "] Can not unLink unExistant widget"); LOGGER.warn("[" + getId() + "] Can not unLink unExistant widget");
} }
/** /**
* Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...). * Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...).
* @param newWidget the element pointer. * @param newWidget the element pointer.
@ -415,7 +415,7 @@ class Gird extends Widget {
} }
} }
} }
@Override @Override
public void systemDraw(final DrawProperty displayProp) { public void systemDraw(final DrawProperty displayProp) {
super.systemDraw(displayProp); super.systemDraw(displayProp);

View File

@ -16,7 +16,6 @@ import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.compositing.CompositingImage; import org.atriasoft.ewol.compositing.CompositingImage;
import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.ewol.resource.ResourceColorFile; import org.atriasoft.ewol.resource.ResourceColorFile;
@ -30,13 +29,13 @@ public class ImageDisplay extends Widget {
protected ResourceColorFile colorProperty = null; //!< theme color property protected ResourceColorFile colorProperty = null; //!< theme color property
protected CompositingImage compositing = new CompositingImage(); //!< compositing element of the image. protected CompositingImage compositing = new CompositingImage(); //!< compositing element of the image.
protected Vector2f imageRenderSize = Vector2f.ZERO; //!< size of the image when we render it protected Vector2f imageRenderSize = Vector2f.ZERO; //!< size of the image when we render it
protected Dimension2f propertyBorder = Dimension2f.ZERO; //!< border to add at the image. protected Dimension2f propertyBorder = Dimension2f.ZERO; //!< border to add at the image.
protected Dimension2f propertyImageSize = Dimension2f.ZERO; //!< border to add at the image. protected Dimension2f propertyImageSize = Dimension2f.ZERO; //!< border to add at the image.
protected boolean propertyKeepRatio = true; //!< keep the image ratio between width and height protected boolean propertyKeepRatio = true; //!< keep the image ratio between width and height
protected Vector2f propertyPosStart = Vector2f.ZERO; //!< position in the image to start the display (when we want not to display all the image) protected Vector2f propertyPosStart = Vector2f.ZERO; //!< position in the image to start the display (when we want not to display all the image)
protected Vector2f propertyPosStop = Vector2f.ONE; //!< position in the image to start the display (when we want not to display all the image) protected Vector2f propertyPosStop = Vector2f.ONE; //!< position in the image to start the display (when we want not to display all the image)
protected boolean propertySmooth = true; //!< display is done in the pixel approximation if false protected boolean propertySmooth = true; //!< display is done in the pixel approximation if false
protected Uri propertySource = null; //!< file name of the image. protected Uri propertySource = null; //!< file name of the image.
protected boolean propertyUseThemeColor = false; //!< Use the themo color management ("THEMECOLOR:///Image.json?lib=ewol") default false protected boolean propertyUseThemeColor = false; //!< Use the themo color management ("THEMECOLOR:///Image.json?lib=ewol") default false
@ -44,12 +43,12 @@ public class ImageDisplay extends Widget {
@AknotName("pressed") @AknotName("pressed")
@AknotDescription(value = "Image is pressed") @AknotDescription(value = "Image is pressed")
public final SignalEmpty signalPressed = new SignalEmpty(); public final SignalEmpty signalPressed = new SignalEmpty();
/** /**
* *
*/ */
public ImageDisplay() {} public ImageDisplay() {}
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
LOGGER.debug("calculate min size: border=" + this.propertyBorder + " size=" + this.propertyImageSize LOGGER.debug("calculate min size: border=" + this.propertyBorder + " size=" + this.propertyImageSize
@ -80,7 +79,7 @@ public class ImageDisplay extends Widget {
+ this.imageRenderSize + " img size=" + imageSize + " " + this.propertyImageSize); + this.imageRenderSize + " img size=" + imageSize + " " + this.propertyImageSize);
markToRedraw(); markToRedraw();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "image-border") @AknotName(value = "image-border")
@ -88,7 +87,7 @@ public class ImageDisplay extends Widget {
public Dimension2f getPropertyBorder() { public Dimension2f getPropertyBorder() {
return this.propertyBorder; return this.propertyBorder;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "image-size") @AknotName(value = "image-size")
@ -96,7 +95,7 @@ public class ImageDisplay extends Widget {
public Dimension2f getPropertyImageSize() { public Dimension2f getPropertyImageSize() {
return this.propertyImageSize; return this.propertyImageSize;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "part-start") @AknotName(value = "part-start")
@ -104,7 +103,7 @@ public class ImageDisplay extends Widget {
public Vector2f getPropertyPosStart() { public Vector2f getPropertyPosStart() {
return this.propertyPosStart; return this.propertyPosStart;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "part-stop") @AknotName(value = "part-stop")
@ -112,7 +111,7 @@ public class ImageDisplay extends Widget {
public Vector2f getPropertyPosStop() { public Vector2f getPropertyPosStop() {
return this.propertyPosStop; return this.propertyPosStop;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "src") @AknotName(value = "src")
@ -120,7 +119,7 @@ public class ImageDisplay extends Widget {
public Uri getPropertySource() { public Uri getPropertySource() {
return this.propertySource; return this.propertySource;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "ratio") @AknotName(value = "ratio")
@ -128,7 +127,7 @@ public class ImageDisplay extends Widget {
public boolean isPropertyKeepRatio() { public boolean isPropertyKeepRatio() {
return this.propertyKeepRatio; return this.propertyKeepRatio;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "smooth") @AknotName(value = "smooth")
@ -136,7 +135,7 @@ public class ImageDisplay extends Widget {
public boolean isPropertySmooth() { public boolean isPropertySmooth() {
return this.propertySmooth; return this.propertySmooth;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "use-theme-color") @AknotName(value = "use-theme-color")
@ -144,12 +143,12 @@ public class ImageDisplay extends Widget {
public boolean isPropertyUseThemeColor() { public boolean isPropertyUseThemeColor() {
return this.propertyUseThemeColor; return this.propertyUseThemeColor;
} }
@Override @Override
protected void onDraw() { protected void onDraw() {
this.compositing.draw(); this.compositing.draw();
} }
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
//LOGGER.debug("Event on BT ..."); //LOGGER.debug("Event on BT ...");
@ -161,7 +160,7 @@ public class ImageDisplay extends Widget {
} }
return false; return false;
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
if (!needRedraw()) { if (!needRedraw()) {
@ -178,10 +177,10 @@ public class ImageDisplay extends Widget {
imageBoder = imageBoder.multiply(2.0f); imageBoder = imageBoder.multiply(2.0f);
Vector2f imageRealSize = this.imageRenderSize.less(imageBoder); Vector2f imageRealSize = this.imageRenderSize.less(imageBoder);
final Vector2f imageRealSizeMax = this.size.less(imageBoder.x(), imageBoder.y()); final Vector2f imageRealSizeMax = this.size.less(imageBoder.x(), imageBoder.y());
final Vector2f ratioSizeDisplayRequested = this.propertyPosStop.less(this.propertyPosStart); final Vector2f ratioSizeDisplayRequested = this.propertyPosStop.less(this.propertyPosStart);
//imageRealSizeMax *= ratioSizeDisplayRequested; //imageRealSizeMax *= ratioSizeDisplayRequested;
Vector2f delta = this.propertyGravity Vector2f delta = this.propertyGravity
.gravityGenerateDelta(this.size.less(this.imageRenderSize.x(), this.imageRenderSize.y())); .gravityGenerateDelta(this.size.less(this.imageRenderSize.x(), this.imageRenderSize.y()));
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
@ -193,7 +192,7 @@ public class ImageDisplay extends Widget {
delta = delta.withY(0.0f); delta = delta.withY(0.0f);
} }
origin = origin.add(delta); origin = origin.add(delta);
if (this.propertyKeepRatio) { if (this.propertyKeepRatio) {
final Vector2i tmpSize = this.compositing.getRealSize(); final Vector2i tmpSize = this.compositing.getRealSize();
//float ratio = tmpSize.x() / tmpSize.y(); //float ratio = tmpSize.x() / tmpSize.y();
@ -213,7 +212,7 @@ public class ImageDisplay extends Widget {
origin = origin.add(0, (oldY - imageRealSize.y()) * 0.5f); origin = origin.add(0, (oldY - imageRealSize.y()) * 0.5f);
} }
} }
// set the somposition properties : // set the somposition properties :
if (this.propertySmooth) { if (this.propertySmooth) {
this.compositing.setPos(origin); this.compositing.setPos(origin);
@ -227,7 +226,7 @@ public class ImageDisplay extends Widget {
LOGGER.debug(" start=" + this.propertyPosStart + " stop=" + this.propertyPosStop); LOGGER.debug(" start=" + this.propertyPosStart + " stop=" + this.propertyPosStop);
this.compositing.flush(); this.compositing.flush();
} }
/** /**
* set All the configuration of the current image * set All the configuration of the current image
* @param uri URI of the new image * @param uri URI of the new image
@ -238,7 +237,7 @@ public class ImageDisplay extends Widget {
setPropertyBorder(border); setPropertyBorder(border);
setPropertySource(uri); setPropertySource(uri);
} }
/** /**
* Set an image with direct elements * Set an image with direct elements
* @param image Image to set in the display * @param image Image to set in the display
@ -249,7 +248,7 @@ public class ImageDisplay extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyBorder(final Dimension2f propertyBorder) { public void setPropertyBorder(final Dimension2f propertyBorder) {
if (this.propertyBorder.equals(propertyBorder)) { if (this.propertyBorder.equals(propertyBorder)) {
return; return;
@ -258,7 +257,7 @@ public class ImageDisplay extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyImageSize(final Dimension2f propertyImageSize) { public void setPropertyImageSize(final Dimension2f propertyImageSize) {
if (this.propertyImageSize.equals(propertyImageSize)) { if (this.propertyImageSize.equals(propertyImageSize)) {
return; return;
@ -269,7 +268,7 @@ public class ImageDisplay extends Widget {
LOGGER.trace("Set sources : " + this.propertySource + " size=" + propertyImageSize); LOGGER.trace("Set sources : " + this.propertySource + " size=" + propertyImageSize);
this.compositing.setSource(this.propertySource, propertyImageSize.getPixeli()); this.compositing.setSource(this.propertySource, propertyImageSize.getPixeli());
} }
public void setPropertyKeepRatio(final boolean propertyKeepRatio) { public void setPropertyKeepRatio(final boolean propertyKeepRatio) {
if (this.propertyKeepRatio == propertyKeepRatio) { if (this.propertyKeepRatio == propertyKeepRatio) {
return; return;
@ -278,7 +277,7 @@ public class ImageDisplay extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyPosStart(final Vector2f propertyPosStart) { public void setPropertyPosStart(final Vector2f propertyPosStart) {
if (this.propertyPosStart.equals(propertyPosStart)) { if (this.propertyPosStart.equals(propertyPosStart)) {
return; return;
@ -287,7 +286,7 @@ public class ImageDisplay extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyPosStop(final Vector2f propertyPosStop) { public void setPropertyPosStop(final Vector2f propertyPosStop) {
if (this.propertyPosStop.equals(propertyPosStop)) { if (this.propertyPosStop.equals(propertyPosStop)) {
return; return;
@ -296,7 +295,7 @@ public class ImageDisplay extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertySmooth(final boolean propertySmooth) { public void setPropertySmooth(final boolean propertySmooth) {
if (this.propertySmooth == propertySmooth) { if (this.propertySmooth == propertySmooth) {
return; return;
@ -304,7 +303,7 @@ public class ImageDisplay extends Widget {
this.propertySmooth = propertySmooth; this.propertySmooth = propertySmooth;
markToRedraw(); markToRedraw();
} }
public void setPropertySource(final Uri propertySource) { public void setPropertySource(final Uri propertySource) {
if (this.propertySource != null && this.propertySource.equals(propertySource)) { if (this.propertySource != null && this.propertySource.equals(propertySource)) {
return; return;
@ -315,7 +314,7 @@ public class ImageDisplay extends Widget {
LOGGER.trace("Set sources : " + propertySource + " size=" + this.propertyImageSize); LOGGER.trace("Set sources : " + propertySource + " size=" + this.propertyImageSize);
this.compositing.setSource(propertySource, this.propertyImageSize.getPixeli()); this.compositing.setSource(propertySource, this.propertyImageSize.getPixeli());
} }
public void setPropertyUseThemeColor(final boolean propertyUseThemeColor) { public void setPropertyUseThemeColor(final boolean propertyUseThemeColor) {
if (this.propertyUseThemeColor == propertyUseThemeColor) { if (this.propertyUseThemeColor == propertyUseThemeColor) {
return; return;

View File

@ -35,16 +35,16 @@ public class Label extends Widget {
private int propertyFontSize = 0; //!< default size of the font. private int propertyFontSize = 0; //!< default size of the font.
private final CompositingText textCompose = new CompositingText(); //!< Compositing text element. private final CompositingText textCompose = new CompositingText(); //!< Compositing text element.
private String value = ""; private String value = "";
protected int colorDefaultBgText = -1; //!< Default Background color of the text protected int colorDefaultBgText = -1; //!< Default Background color of the text
protected int colorDefaultFgText = -1; //!< Default color of the text protected int colorDefaultFgText = -1; //!< Default color of the text
protected ResourceColorFile colorProperty; //!< theme color property protected ResourceColorFile colorProperty; //!< theme color property
protected boolean propertyAutoTranslate = true; //!< if at true the data is translate automaticaly translate. protected boolean propertyAutoTranslate = true; //!< if at true the data is translate automaticaly translate.
public Label() { public Label() {
this("---"); this("---");
} }
public Label(final String label) { public Label(final String label) {
this.colorProperty = ResourceColorFile.create(new Uri("THEME", "/color/Label.json", "ewol")); this.colorProperty = ResourceColorFile.create(new Uri("THEME", "/color/Label.json", "ewol"));
if (this.colorProperty != null) { if (this.colorProperty != null) {
@ -55,7 +55,7 @@ public class Label extends Widget {
setPropertyCanFocus(false); setPropertyCanFocus(false);
setPropertyValue(label); setPropertyValue(label);
} }
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
LOGGER.trace("calculateMinMaxSize !!! data = '{}'", this.value); LOGGER.trace("calculateMinMaxSize !!! data = '{}'", this.value);
@ -72,29 +72,29 @@ public class Label extends Widget {
this.textCompose.flush(); this.textCompose.flush();
minSize = minSize.add(2, 2); minSize = minSize.add(2, 2);
//EWOL_DEBUG("[" + getId() + "] {" + getObjectType() + "} minSize : " + minSize); //EWOL_DEBUG("[" + getId() + "] {" + getObjectType() + "} minSize : " + minSize);
this.minSize = new Vector2f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), // this.minSize = new Vector2f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), //
FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y())); FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize); LOGGER.trace("[{}] Result min size : {}", getId(), this.minSize);
} }
public int getPropertyFontSize() { public int getPropertyFontSize() {
return this.propertyFontSize; return this.propertyFontSize;
} }
public String getPropertyValue() { public String getPropertyValue() {
return this.propertyValue; return this.propertyValue;
} }
public boolean isPropertyAutoTranslate() { public boolean isPropertyAutoTranslate() {
return this.propertyAutoTranslate; return this.propertyAutoTranslate;
} }
@Override @Override
protected void onDraw() { protected void onDraw() {
this.textCompose.draw(); this.textCompose.draw();
} }
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
//LOGGER.debug("Event on Label ..."); //LOGGER.debug("Event on Label ...");
@ -107,7 +107,7 @@ public class Label extends Widget {
} }
return false; return false;
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
if (!needRedraw()) { if (!needRedraw()) {
@ -116,26 +116,26 @@ public class Label extends Widget {
this.textCompose.clear(); this.textCompose.clear();
//final int paddingSize = 2; //final int paddingSize = 2;
final Padding padding = new Padding(2, 2, 2, 2); final Padding padding = new Padding(2, 2, 2, 2);
final Vector2f tmpMax = this.propertyMaxSize.getPixel(); final Vector2f tmpMax = this.propertyMaxSize.getPixel();
// to know the size of one line : // to know the size of one line :
final Vector2f minSize = this.textCompose.calculateSize('A'); final Vector2f minSize = this.textCompose.calculateSize('A');
//minSize.setX(etk::max(minSize.x(), this.minSize.x())); //minSize.setX(etk::max(minSize.x(), this.minSize.x()));
//minSize.setY(etk::max(minSize.y(), this.minSize.y())); //minSize.setY(etk::max(minSize.y(), this.minSize.y()));
if (tmpMax.x() <= 999999) { if (tmpMax.x() <= 999999) {
this.textCompose.setTextAlignment(0, tmpMax.x() - padding.x(), AlignMode.LEFT); this.textCompose.setTextAlignment(0, tmpMax.x() - padding.x(), AlignMode.LEFT);
} }
final Vector2f curentTextSize = this.textCompose.calculateSizeDecorated(this.value); final Vector2f curentTextSize = this.textCompose.calculateSizeDecorated(this.value);
//Vector2f localSize = this.minSize.clipInteger(); //Vector2f localSize = this.minSize.clipInteger();
Vector2f tmpSizeShaper = this.minSize; Vector2f tmpSizeShaper = this.minSize;
// no change for the text origin : // no change for the text origin :
Vector2f tmpTextOrigin = new Vector2f((this.size.x() - minSize.x()) * 0.5f, Vector2f tmpTextOrigin = new Vector2f((this.size.x() - minSize.x()) * 0.5f,
(this.size.y() - minSize.y()) * 0.5f); (this.size.y() - minSize.y()) * 0.5f);
Vector2f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize)); Vector2f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize));
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
tmpSizeShaper = tmpSizeShaper.withX(this.size.x()); tmpSizeShaper = tmpSizeShaper.withX(this.size.x());
delta = delta.withX(0.0f); delta = delta.withX(0.0f);
@ -148,21 +148,20 @@ public class Label extends Widget {
} }
final Vector2f tmpOriginShaper = delta; final Vector2f tmpOriginShaper = delta;
final Vector2f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y()); final Vector2f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y());
tmpTextOrigin = tmpOriginShaper;//tmpTextOrigin.add(paddingSize, paddingSize, 0); tmpTextOrigin = tmpOriginShaper;//tmpTextOrigin.add(paddingSize, paddingSize, 0);
//localSize = localSize.less(2 * paddingSize, 2 * paddingSize, 0); //localSize = localSize.less(2 * paddingSize, 2 * paddingSize, 0);
//tmpTextOrigin = tmpTextOrigin.withY(tmpTextOrigin.y() + (this.minSize.y() - 2 * paddingSize) - minSize.y()); //tmpTextOrigin = tmpTextOrigin.withY(tmpTextOrigin.y() + (this.minSize.y() - 2 * paddingSize) - minSize.y());
tmpTextOrigin = tmpTextOrigin tmpTextOrigin = tmpTextOrigin
.withY(tmpTextOrigin.y() + this.minSize.y() - this.textCompose.getHeight() - padding.top());// - this.minSize.y() - paddingSize); .withY(tmpTextOrigin.y() + this.minSize.y() - this.textCompose.getHeight() - padding.top());// - this.minSize.y() - paddingSize);
tmpTextOrigin = tmpTextOrigin.withX(tmpTextOrigin.x() + padding.left()); tmpTextOrigin = tmpTextOrigin.withX(tmpTextOrigin.x() + padding.left());
final Vector2f textPos = new Vector2f(tmpTextOrigin.x(), tmpTextOrigin.y()); final Vector2f textPos = new Vector2f(tmpTextOrigin.x(), tmpTextOrigin.y());
final Vector2f drawClippingPos = tmpOriginShaper final Vector2f drawClippingPos = tmpOriginShaper.less(new Vector2f(padding.left(), padding.bottom()));
.less(new Vector2f(padding.left(), padding.bottom()));
final Vector2f drawClippingSize = tmpOriginShaper.add(tmpSizeShaper); /// new Vector2f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1); final Vector2f drawClippingSize = tmpOriginShaper.add(tmpSizeShaper); /// new Vector2f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1);
// clean the element // clean the element
this.textCompose.reset(); this.textCompose.reset();
if (this.propertyFontSize != 0) { if (this.propertyFontSize != 0) {
@ -179,7 +178,7 @@ public class Label extends Widget {
this.textCompose.printDecorated(this.value); this.textCompose.printDecorated(this.value);
this.textCompose.flush(); this.textCompose.flush();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "auto-translate") @AknotName(value = "auto-translate")
@ -197,7 +196,7 @@ public class Label extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "font-size") @AknotName(value = "font-size")
@ -210,7 +209,7 @@ public class Label extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
@AknotManaged @AknotManaged
@AknotText @AknotText
@AknotName(value = "value") @AknotName(value = "value")
@ -228,5 +227,5 @@ public class Label extends Widget {
requestUpdateSize(); requestUpdateSize();
this.propertyValue = propertyValue; this.propertyValue = propertyValue;
} }
} }

View File

@ -30,7 +30,7 @@ public class LabelOnSVG extends Widget {
protected int colorDefaultFgText = -1; //!< Default color of the text protected int colorDefaultFgText = -1; //!< Default color of the text
protected ResourceColorFile colorProperty; //!< theme color property protected ResourceColorFile colorProperty; //!< theme color property
protected boolean propertyAutoTranslate = true; //!< if at true the data is translate automaticaly translate. protected boolean propertyAutoTranslate = true; //!< if at true the data is translate automaticaly translate.
protected int propertyFontSize = 0; //!< default size of the font. protected int propertyFontSize = 0; //!< default size of the font.
protected String propertyValue = ""; //!< decorated text to display. protected String propertyValue = ""; //!< decorated text to display.
@AknotSignal @AknotSignal
@ -39,7 +39,7 @@ public class LabelOnSVG extends Widget {
public SignalEmpty signalPressed = new SignalEmpty(); public SignalEmpty signalPressed = new SignalEmpty();
protected CompositingText text = new CompositingText(); //!< Compositing text element. protected CompositingText text = new CompositingText(); //!< Compositing text element.
protected String value = ""; protected String value = "";
public LabelOnSVG() { public LabelOnSVG() {
this.colorProperty = ResourceColorFile.create(new Uri("THEME", "/color/Label.json", "ewol")); this.colorProperty = ResourceColorFile.create(new Uri("THEME", "/color/Label.json", "ewol"));
if (this.colorProperty != null) { if (this.colorProperty != null) {
@ -49,7 +49,7 @@ public class LabelOnSVG extends Widget {
setMouseLimit(1); setMouseLimit(1);
setPropertyCanFocus(false); setPropertyCanFocus(false);
} }
/** /**
* Constructor * Constructor
* @param newLabel The displayed decorated text. * @param newLabel The displayed decorated text.
@ -64,7 +64,7 @@ public class LabelOnSVG extends Widget {
setPropertyCanFocus(false); setPropertyCanFocus(false);
setPropertyValue(newLabel); setPropertyValue(newLabel);
} }
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
final Vector2f tmpMax = this.propertyMaxSize.getPixel(); final Vector2f tmpMax = this.propertyMaxSize.getPixel();
@ -76,30 +76,30 @@ public class LabelOnSVG extends Widget {
} }
final Vector2f minSize = this.text.calculateSizeDecorated(this.value); final Vector2f minSize = this.text.calculateSizeDecorated(this.value);
LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize); LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize);
this.minSize = new Vector2f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), this.minSize = new Vector2f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()),
FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y())); FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} Result min size : " + tmpMin + " < " LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} Result min size : " + tmpMin + " < "
+ this.minSize + " < " + tmpMax); + this.minSize + " < " + tmpMax);
} }
public int getPropertyFontSize() { public int getPropertyFontSize() {
return this.propertyFontSize; return this.propertyFontSize;
} }
public String getPropertyValue() { public String getPropertyValue() {
return this.propertyValue; return this.propertyValue;
} }
public boolean isPropertyAutoTranslate() { public boolean isPropertyAutoTranslate() {
return this.propertyAutoTranslate; return this.propertyAutoTranslate;
} }
@Override @Override
protected void onDraw() { protected void onDraw() {
this.text.draw(); this.text.draw();
} }
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
//LOGGER.debug("Event on Label ..."); //LOGGER.debug("Event on Label ...");
@ -112,7 +112,7 @@ public class LabelOnSVG extends Widget {
} }
return false; return false;
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
if (!needRedraw()) { if (!needRedraw()) {
@ -120,24 +120,24 @@ public class LabelOnSVG extends Widget {
} }
this.text.clear(); this.text.clear();
final int paddingSize = 2; final int paddingSize = 2;
final Vector2f tmpMax = this.propertyMaxSize.getPixel(); final Vector2f tmpMax = this.propertyMaxSize.getPixel();
// to know the size of one line : // to know the size of one line :
final Vector2f minSize = this.text.calculateSize('A'); final Vector2f minSize = this.text.calculateSize('A');
//minSize.setX(etk::max(minSize.x(), this.minSize.x())); //minSize.setX(etk::max(minSize.x(), this.minSize.x()));
//minSize.setY(etk::max(minSize.y(), this.minSize.y())); //minSize.setY(etk::max(minSize.y(), this.minSize.y()));
if (tmpMax.x() <= 999999) { if (tmpMax.x() <= 999999) {
this.text.setTextAlignment(0, tmpMax.x() - 2 * paddingSize, AlignMode.LEFT); this.text.setTextAlignment(0, tmpMax.x() - 2 * paddingSize, AlignMode.LEFT);
} }
final Vector2f currentTextSize = this.text.calculateSizeDecorated(this.value); final Vector2f currentTextSize = this.text.calculateSizeDecorated(this.value);
Vector2i localSize = new Vector2i((int) this.minSize.x(), (int) this.minSize.y()); Vector2i localSize = new Vector2i((int) this.minSize.x(), (int) this.minSize.y());
// no change for the text origin : // no change for the text origin :
Vector2f tmpTextOrigin = new Vector2f((this.size.x() - this.minSize.x()) / 2.0f, Vector2f tmpTextOrigin = new Vector2f((this.size.x() - this.minSize.x()) / 2.0f,
(this.size.y() - this.minSize.y()) / 2.0f); (this.size.y() - this.minSize.y()) / 2.0f);
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
localSize = localSize.withX((int) this.size.x()); localSize = localSize.withX((int) this.size.x());
tmpTextOrigin = tmpTextOrigin.withX(0); tmpTextOrigin = tmpTextOrigin.withX(0);
@ -148,14 +148,14 @@ public class LabelOnSVG extends Widget {
} }
tmpTextOrigin = tmpTextOrigin.add(paddingSize, paddingSize); tmpTextOrigin = tmpTextOrigin.add(paddingSize, paddingSize);
localSize = localSize.less(2 * paddingSize, 2 * paddingSize); localSize = localSize.less(2 * paddingSize, 2 * paddingSize);
tmpTextOrigin = tmpTextOrigin.withY(tmpTextOrigin.y() + (this.minSize.y() - 2 * paddingSize) - minSize.y()); tmpTextOrigin = tmpTextOrigin.withY(tmpTextOrigin.y() + (this.minSize.y() - 2 * paddingSize) - minSize.y());
final Vector2f textPos = new Vector2f(tmpTextOrigin.x(), tmpTextOrigin.y()); final Vector2f textPos = new Vector2f(tmpTextOrigin.x(), tmpTextOrigin.y());
final Vector2f drawClippingPos = new Vector2f(paddingSize, paddingSize); final Vector2f drawClippingPos = new Vector2f(paddingSize, paddingSize);
final Vector2f drawClippingSize = new Vector2f((this.size.x() - paddingSize), (this.size.y() - paddingSize)); final Vector2f drawClippingSize = new Vector2f((this.size.x() - paddingSize), (this.size.y() - paddingSize));
// clean the element // clean the element
this.text.reset(); this.text.reset();
if (this.propertyFontSize != 0) { if (this.propertyFontSize != 0) {
@ -170,10 +170,10 @@ public class LabelOnSVG extends Widget {
this.text.setTextAlignment(tmpTextOrigin.x(), tmpTextOrigin.x() + localSize.x(), AlignMode.LEFT); this.text.setTextAlignment(tmpTextOrigin.x(), tmpTextOrigin.x() + localSize.x(), AlignMode.LEFT);
this.text.setClipping(drawClippingPos, drawClippingSize); this.text.setClipping(drawClippingPos, drawClippingSize);
this.text.printDecorated(this.value); this.text.printDecorated(this.value);
this.text.flush(); this.text.flush();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("auto-translate") @AknotName("auto-translate")
@ -191,7 +191,7 @@ public class LabelOnSVG extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("font-size") @AknotName("font-size")
@ -204,7 +204,7 @@ public class LabelOnSVG extends Widget {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("value") @AknotName("value")
@ -222,5 +222,5 @@ public class LabelOnSVG extends Widget {
requestUpdateSize(); requestUpdateSize();
this.propertyValue = propertyValue; this.propertyValue = propertyValue;
} }
} }

View File

@ -17,23 +17,23 @@ import org.atriasoft.ewol.compositing.CompositingGC;
class ProgressBar extends Widget { class ProgressBar extends Widget {
private static final int DOT_RADIUS = 6; private static final int DOT_RADIUS = 6;
private final CompositingDrawing vectorialDraw = new CompositingGC(); // basic drawing element private final CompositingDrawing vectorialDraw = new CompositingGC(); // basic drawing element
protected Color propertyTextColorBgOff = Color.NONE; protected Color propertyTextColorBgOff = Color.NONE;
protected Color propertyTextColorBgOn = Color.GREEN; protected Color propertyTextColorBgOn = Color.GREEN;
protected Color propertyTextColorFg = Color.BLACK; protected Color propertyTextColorFg = Color.BLACK;
protected float propertyValue = 0; protected float propertyValue = 0;
public ProgressBar() { public ProgressBar() {
setPropertyCanFocus(true); setPropertyCanFocus(true);
} }
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
final Vector2f tmpMin = this.propertyMinSize.getPixel(); final Vector2f tmpMin = this.propertyMinSize.getPixel();
this.minSize = new Vector2f(Math.max(tmpMin.x(), 40.0f), Math.max(tmpMin.y(), ProgressBar.DOT_RADIUS * 2.0f)); this.minSize = new Vector2f(Math.max(tmpMin.x(), 40.0f), Math.max(tmpMin.y(), ProgressBar.DOT_RADIUS * 2.0f));
markToRedraw(); markToRedraw();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "color-off") @AknotName(value = "color-off")
@ -41,7 +41,7 @@ class ProgressBar extends Widget {
public Color getPropertyTextColorBgOff() { public Color getPropertyTextColorBgOff() {
return this.propertyTextColorBgOff; return this.propertyTextColorBgOff;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "color-on") @AknotName(value = "color-on")
@ -49,7 +49,7 @@ class ProgressBar extends Widget {
public Color getPropertyTextColorBgOn() { public Color getPropertyTextColorBgOn() {
return this.propertyTextColorBgOn; return this.propertyTextColorBgOn;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "color-bg") @AknotName(value = "color-bg")
@ -57,7 +57,7 @@ class ProgressBar extends Widget {
public Color getPropertyTextColorFg() { public Color getPropertyTextColorFg() {
return this.propertyTextColorFg; return this.propertyTextColorFg;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "value") @AknotName(value = "value")
@ -65,12 +65,12 @@ class ProgressBar extends Widget {
public float getPropertyValue() { public float getPropertyValue() {
return this.propertyValue; return this.propertyValue;
} }
@Override @Override
protected void onDraw() { protected void onDraw() {
this.vectorialDraw.draw(); this.vectorialDraw.draw();
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
if (!needRedraw()) { if (!needRedraw()) {
@ -78,9 +78,9 @@ class ProgressBar extends Widget {
} }
// clean the object list ... // clean the object list ...
this.vectorialDraw.clear(); this.vectorialDraw.clear();
this.vectorialDraw.setColor(this.propertyTextColorFg); this.vectorialDraw.setColor(this.propertyTextColorFg);
final int tmpSizeX = (int) (this.size.x() - 10); final int tmpSizeX = (int) (this.size.x() - 10);
final int tmpSizeY = (int) (this.size.y() - 10); final int tmpSizeY = (int) (this.size.y() - 10);
final int tmpOriginX = 5; final int tmpOriginX = 5;
@ -91,12 +91,12 @@ class ProgressBar extends Widget {
this.vectorialDraw.setColor(this.propertyTextColorBgOff); this.vectorialDraw.setColor(this.propertyTextColorBgOff);
this.vectorialDraw.setPos(new Vector2f(tmpOriginX + tmpSizeX * this.propertyValue, tmpOriginY)); this.vectorialDraw.setPos(new Vector2f(tmpOriginX + tmpSizeX * this.propertyValue, tmpOriginY));
this.vectorialDraw.rectangleWidth(new Vector2f(tmpSizeX * (1.0f - this.propertyValue), tmpSizeY)); this.vectorialDraw.rectangleWidth(new Vector2f(tmpSizeX * (1.0f - this.propertyValue), tmpSizeY));
// TODO : Create a better progress Bar ... // TODO : Create a better progress Bar ...
//this.draw.setColor(propertyTextColorFg); //this.draw.setColor(propertyTextColorFg);
//this.draw.rectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, 1); //this.draw.rectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, 1);
} }
public void setPropertyTextColorBgOff(final Color propertyTextColorBgOff) { public void setPropertyTextColorBgOff(final Color propertyTextColorBgOff) {
if (propertyTextColorBgOff.equals(this.propertyTextColorBgOff)) { if (propertyTextColorBgOff.equals(this.propertyTextColorBgOff)) {
return; return;
@ -104,7 +104,7 @@ class ProgressBar extends Widget {
this.propertyTextColorBgOff = propertyTextColorBgOff; this.propertyTextColorBgOff = propertyTextColorBgOff;
markToRedraw(); markToRedraw();
} }
public void setPropertyTextColorBgOn(final Color propertyTextColorBgOn) { public void setPropertyTextColorBgOn(final Color propertyTextColorBgOn) {
if (propertyTextColorBgOn.equals(this.propertyTextColorBgOn)) { if (propertyTextColorBgOn.equals(this.propertyTextColorBgOn)) {
return; return;
@ -112,7 +112,7 @@ class ProgressBar extends Widget {
this.propertyTextColorBgOn = propertyTextColorBgOn; this.propertyTextColorBgOn = propertyTextColorBgOn;
markToRedraw(); markToRedraw();
} }
public void setPropertyTextColorFg(final Color propertyTextColorFg) { public void setPropertyTextColorFg(final Color propertyTextColorFg) {
if (propertyTextColorFg.equals(this.propertyTextColorFg)) { if (propertyTextColorFg.equals(this.propertyTextColorFg)) {
return; return;
@ -120,7 +120,7 @@ class ProgressBar extends Widget {
this.propertyTextColorFg = propertyTextColorFg; this.propertyTextColorFg = propertyTextColorFg;
markToRedraw(); markToRedraw();
} }
public void setPropertyValue(final float propertyValue) { public void setPropertyValue(final float propertyValue) {
if (propertyValue == this.propertyValue) { if (propertyValue == this.propertyValue) {
return; return;

View File

@ -9,10 +9,8 @@ import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.aknot.annotation.AknotDescription; import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
@ -30,13 +28,13 @@ class Scroll extends Container {
private static final Logger LOGGER = LoggerFactory.getLogger(Scroll.class); private static final Logger LOGGER = LoggerFactory.getLogger(Scroll.class);
protected static final int SCROLL_BAR_SPACE = 15; protected static final int SCROLL_BAR_SPACE = 15;
protected Vector2f propertyLimit = new Vector2f(0.15f, 0.5f); //!< Set the limitation of the ratio in the screen protected Vector2f propertyLimit = new Vector2f(0.15f, 0.5f); //!< Set the limitation of the ratio in the screen
protected Uri propertyShapeVert = new Uri("THEME_GUI", "WidgetScrolled.json", "ewol"); //!< Vertical shaper name protected Uri propertyShapeVert = new Uri("THEME_GUI", "WidgetScrolled.json", "ewol"); //!< Vertical shaper name
protected Uri propertyShapeHori = new Uri("THEME_GUI", "WidgetScrolled.json", "ewol"); //!< Horizontal shaper name protected Uri propertyShapeHori = new Uri("THEME_GUI", "WidgetScrolled.json", "ewol"); //!< Horizontal shaper name
protected boolean propertyHover = true; //!< Horizontal shaper name protected boolean propertyHover = true; //!< Horizontal shaper name
protected CompositingSVG compositingH = new CompositingSVG(); protected CompositingSVG compositingH = new CompositingSVG();
protected CompositingSVG compositingV = new CompositingSVG(); protected CompositingSVG compositingV = new CompositingSVG();
protected float pixelScrolling = 20; protected float pixelScrolling = 20;
@ -44,12 +42,12 @@ class Scroll extends Container {
protected HighSpeedMode highSpeedMode = HighSpeedMode.speedModeDisable; protected HighSpeedMode highSpeedMode = HighSpeedMode.speedModeDisable;
protected int highSpeedButton = -1; protected int highSpeedButton = -1;
protected KeyType highSpeedType = KeyType.unknow; protected KeyType highSpeedType = KeyType.unknow;
public Scroll() { public Scroll() {
onChangePropertyShapeVert(); onChangePropertyShapeVert();
onChangePropertyShapeHori(); onChangePropertyShapeHori();
} }
@Override @Override
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
// Note: No call of container ==> normal case ... // Note: No call of container ==> normal case ...
@ -59,7 +57,7 @@ class Scroll extends Container {
this.subWidget.calculateMinMaxSize(); this.subWidget.calculateMinMaxSize();
} }
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "limit") @AknotName(value = "limit")
@ -67,7 +65,7 @@ class Scroll extends Container {
public Vector2f getPropertyLimit() { public Vector2f getPropertyLimit() {
return this.propertyLimit; return this.propertyLimit;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "shape-hori") @AknotName(value = "shape-hori")
@ -75,7 +73,7 @@ class Scroll extends Container {
public Uri getPropertyShapeHori() { public Uri getPropertyShapeHori() {
return this.propertyShapeHori; return this.propertyShapeHori;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "shape-vert") @AknotName(value = "shape-vert")
@ -83,7 +81,7 @@ class Scroll extends Container {
public Uri getPropertyShapeVert() { public Uri getPropertyShapeVert() {
return this.propertyShapeVert; return this.propertyShapeVert;
} }
@Override @Override
public Widget getWidgetAtPos(final Vector2f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
final Widget tmpWidget = super.getWidgetAtPos(pos); final Widget tmpWidget = super.getWidgetAtPos(pos);
@ -92,7 +90,7 @@ class Scroll extends Container {
} }
return this; return this;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName(value = "hover") @AknotName(value = "hover")
@ -100,21 +98,21 @@ class Scroll extends Container {
public boolean isPropertyHover() { public boolean isPropertyHover() {
return this.propertyHover; return this.propertyHover;
} }
void onChangePropertyLimit() { void onChangePropertyLimit() {
markToRedraw(); markToRedraw();
} }
protected void onChangePropertyShapeHori() { protected void onChangePropertyShapeHori() {
//TODO: this.shaperH.setSource(this.propertyShapeHori); //TODO: this.shaperH.setSource(this.propertyShapeHori);
markToRedraw(); markToRedraw();
} }
protected void onChangePropertyShapeVert() { protected void onChangePropertyShapeVert() {
//TODO: this.shaperV.setSource(this.propertyShapeVert); //TODO: this.shaperV.setSource(this.propertyShapeVert);
markToRedraw(); markToRedraw();
} }
@Override @Override
public void onChangeSize() { public void onChangeSize() {
// Note: No call of container ==> normal case ... // Note: No call of container ==> normal case ...
@ -130,7 +128,7 @@ class Scroll extends Container {
if (!this.propertyHover) { if (!this.propertyHover) {
basicSize = basicSize.less(SCROLL_BAR_SPACE, SCROLL_BAR_SPACE); basicSize = basicSize.less(SCROLL_BAR_SPACE, SCROLL_BAR_SPACE);
} }
Vector2f origin = this.origin.add(this.offset); Vector2f origin = this.origin.add(this.offset);
Vector2f minSize = this.subWidget.getCalculateMinSize(); Vector2f minSize = this.subWidget.getCalculateMinSize();
final Vector2b expand = this.subWidget.propertyExpand; final Vector2b expand = this.subWidget.propertyExpand;
@ -156,13 +154,13 @@ class Scroll extends Container {
this.subWidget.setOrigin(origin); this.subWidget.setOrigin(origin);
this.subWidget.onChangeSize(); this.subWidget.onChangeSize();
} }
@Override @Override
protected void onDraw() { protected void onDraw() {
this.compositingH.draw(); this.compositingH.draw();
this.compositingV.draw(); this.compositingV.draw();
} }
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
//ewol::event::Input _event = event; //ewol::event::Input _event = event;
@ -404,7 +402,7 @@ class Scroll extends Container {
} }
return false; return false;
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
if (this.propertyHide) { if (this.propertyHide) {
@ -432,13 +430,13 @@ class Scroll extends Container {
float originScrollBar = scrollOffset.y() / (scrollSize.y() - this.size.y() * this.propertyLimit.y()); float originScrollBar = scrollOffset.y() / (scrollSize.y() - this.size.y() * this.propertyLimit.y());
originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f); originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (this.size.y() - lenScrollBar); originScrollBar *= (this.size.y() - lenScrollBar);
final Vector2f renderOrigin = new Vector2f(this.size.x() - paddingVert.x(), 0); final Vector2f renderOrigin = new Vector2f(this.size.x() - paddingVert.x(), 0);
final Vector2f renderSize = new Vector2f(paddingVert.x(), this.size.y()); final Vector2f renderSize = new Vector2f(paddingVert.x(), this.size.y());
this.compositingV.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN); // this.compositingV.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
this.compositingV.setPos(renderOrigin); // this.compositingV.setPos(renderOrigin);
this.compositingV.print(renderSize); // this.compositingV.print(renderSize);
this.compositingV.flush(); // this.compositingV.flush();
/* /*
this.shaperV.setShape(new Vector2f(this.size.x() - paddingVert.x(), 0), this.shaperV.setShape(new Vector2f(this.size.x() - paddingVert.x(), 0),
new Vector2f(paddingVert.x(), this.size.y()), new Vector2f(paddingVert.x(), this.size.y()),
@ -453,27 +451,27 @@ class Scroll extends Container {
float originScrollBar = scrollOffset.x() / (scrollSize.x() - this.size.x() * this.propertyLimit.x()); float originScrollBar = scrollOffset.x() / (scrollSize.x() - this.size.x() * this.propertyLimit.x());
originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f); originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (this.size.x() - paddingHori.right() - lenScrollBar); originScrollBar *= (this.size.x() - paddingHori.right() - lenScrollBar);
final Vector2f renderOrigin = Vector2f.ZERO; final Vector2f renderOrigin = Vector2f.ZERO;
final Vector2f renderSize = new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()); final Vector2f renderSize = new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y());
this.compositingH.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN); // this.compositingH.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
this.compositingH.setPos(renderOrigin); // this.compositingH.setPos(renderOrigin);
this.compositingH.print(renderSize); // this.compositingH.print(renderSize);
this.compositingH.flush(); // this.compositingH.flush();
/* /*
this.shaperH.setShape(Vector2f.ZERO, new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()), this.shaperH.setShape(Vector2f.ZERO, new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()),
new Vector2f(originScrollBar, paddingHori.bottom()), new Vector2f(lenScrollBar, 0)); new Vector2f(originScrollBar, paddingHori.bottom()), new Vector2f(lenScrollBar, 0));
*/ */
} }
} }
public void setPropertyHover(final boolean propertyHover) { public void setPropertyHover(final boolean propertyHover) {
if (propertyHover == this.propertyHover) { if (propertyHover == this.propertyHover) {
return; return;
} }
this.propertyHover = propertyHover; this.propertyHover = propertyHover;
} }
public void setPropertyLimit(final Vector2f propertyLimit) { public void setPropertyLimit(final Vector2f propertyLimit) {
final Vector2f tmp = Vector2f.avg(Vector2f.ZERO, propertyLimit, Vector2f.ONE); final Vector2f tmp = Vector2f.avg(Vector2f.ZERO, propertyLimit, Vector2f.ONE);
if (tmp.equals(this.propertyLimit)) { if (tmp.equals(this.propertyLimit)) {
@ -482,7 +480,7 @@ class Scroll extends Container {
this.propertyLimit = propertyLimit; this.propertyLimit = propertyLimit;
onChangePropertyLimit(); onChangePropertyLimit();
} }
public void setPropertyShapeHori(final Uri value) { public void setPropertyShapeHori(final Uri value) {
if (this.propertyShapeHori.equals(value)) { if (this.propertyShapeHori.equals(value)) {
return; return;
@ -490,7 +488,7 @@ class Scroll extends Container {
this.propertyShapeHori = value; this.propertyShapeHori = value;
onChangePropertyShapeHori(); onChangePropertyShapeHori();
} }
public void setPropertyShapeVert(final Uri value) { public void setPropertyShapeVert(final Uri value) {
if (this.propertyShapeVert.equals(value)) { if (this.propertyShapeVert.equals(value)) {
return; return;
@ -498,7 +496,7 @@ class Scroll extends Container {
this.propertyShapeVert = value; this.propertyShapeVert = value;
onChangePropertyShapeVert(); onChangePropertyShapeVert();
} }
@Override @Override
public void systemDraw(final DrawProperty displayProp) { public void systemDraw(final DrawProperty displayProp) {
if (this.propertyHide) { if (this.propertyHide) {

View File

@ -6,13 +6,15 @@ import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.aknot.annotation.AknotSignal; import org.atriasoft.aknot.annotation.AknotSignal;
import org.atriasoft.esignal.Signal; import org.atriasoft.esignal.Signal;
import org.atriasoft.etk.BorderRadius;
import org.atriasoft.etk.Color; import org.atriasoft.etk.Color;
import org.atriasoft.etk.Dimension1f;
import org.atriasoft.etk.Insets;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i; import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.Padding; import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.compositing.CompositingGC; import org.atriasoft.ewol.compositing.CompositingGC;
import org.atriasoft.ewol.compositing.CompositingSVG;
import org.atriasoft.ewol.event.EventInput; import org.atriasoft.ewol.event.EventInput;
import org.atriasoft.gale.key.KeyStatus; import org.atriasoft.gale.key.KeyStatus;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -31,7 +33,6 @@ public class Slider extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Slider.class); private static final Logger LOGGER = LoggerFactory.getLogger(Slider.class);
private Float propertyValue = 0.0f; //!< string that must be displayed private Float propertyValue = 0.0f; //!< string that must be displayed
protected CompositingSVG compositing = new CompositingSVG();
@AknotSignal @AknotSignal
@AknotName("value") @AknotName("value")
@AknotDescription("Tick value change") @AknotDescription("Tick value change")
@ -56,6 +57,8 @@ public class Slider extends Widget {
private final Color textColorBg = Color.BLACK.withA(0x3F); //!< Background color private final Color textColorBg = Color.BLACK.withA(0x3F); //!< Background color
CompositingGC vectorialDraw = new CompositingGC(); //!< drawing tool. CompositingGC vectorialDraw = new CompositingGC(); //!< drawing tool.
private final Dimension1f propertyLineWidth = new Dimension1f(20);
public Slider() { public Slider() {
this.propertyCanFocus = true; this.propertyCanFocus = true;
@ -168,7 +171,7 @@ public class Slider extends Widget {
@Override @Override
public void onDraw() { public void onDraw() {
this.compositing.draw(); this.vectorialDraw.draw();
} }
@Override @Override
@ -234,48 +237,35 @@ public class Slider extends Widget {
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
if (!needRedraw()) { if (!needRedraw()) {
return; //return;
} }
//LOGGER.trace("Regenerate Display ==> is needed: '" + this.propertyValue + "'"); this.vectorialDraw.clear();
this.compositing.clear();
//this.gc.clear();
/*
if (this.colorIdTextFg >= 0) {
//this.text.setDefaultColorFg(this.shape.getColor(this.colorIdTextFg));
//this.text.setDefaultColorBg(this.shape.getColor(this.colorIdTextBg));
//this.text.setCursorColor(this.shape.getColor(this.colorIdCursor));
//this.text.setSelectionColor(this.shape.getColor(this.colorIdSelection));
}
*/
final Padding padding = Padding.ZERO;//this.shape.getPadding(); final Padding padding = Padding.ZERO;//this.shape.getPadding();
{ {
// Manage external shape: // Manage external shape:
Vector2f tmpSizeShaper = this.minSize; Vector2f sizeInsideRender = this.minSize;
Vector2f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize)); Vector2f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize));
if (this.propertyFill.x()) { if (this.propertyFill.x()) {
tmpSizeShaper = tmpSizeShaper.withX(this.size.x()); sizeInsideRender = sizeInsideRender.withX(this.size.x());
delta = delta.withX(0.0f); delta = delta.withX(0.0f);
} }
if (this.propertyFill.y()) { if (this.propertyFill.y()) {
tmpSizeShaper = tmpSizeShaper.withY(this.size.y()); sizeInsideRender = sizeInsideRender.withY(this.size.y());
delta = delta.withY(0.0f); delta = delta.withY(0.0f);
} }
Vector2f tmpOriginShaper = delta; Vector2f tmpOriginShaper = delta;
Vector2f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y());
//Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
Vector2f tmpOriginInside = Vector2f.ZERO;
// sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ...
// fix all the position in the int class: // fix all the position in the int class:
tmpSizeShaper = Vector2f.clipInt(tmpSizeShaper); sizeInsideRender = Vector2f.clipInt(sizeInsideRender);
tmpOriginShaper = Vector2f.clipInt(tmpOriginShaper); tmpOriginShaper = Vector2f
tmpSizeInside = Vector2f.clipInt(tmpSizeInside); .clipInt(tmpOriginShaper.addY(sizeInsideRender.y() * 0.5f - this.propertyLineWidth.size() * 0.5f));
tmpOriginInside = Vector2f.clipInt(tmpOriginInside);
this.overPositionStart = tmpOriginShaper; this.overPositionStart = tmpOriginShaper;
this.overPositionSize = tmpSizeShaper; this.overPositionSize = sizeInsideRender.withY(this.propertyLineWidth.size());
this.overPositionStop = tmpOriginShaper.add(tmpSizeShaper); this.overPositionStop = tmpOriginShaper.add(this.overPositionSize);
//this.shape.setShape(0, tmpOriginShaper, tmpSizeShaper, tmpOriginInside, tmpSizeInside); this.vectorialDraw.setPaintFillColor(this.textColorBg);
this.vectorialDraw.addRectangle(this.overPositionStart, this.overPositionStop, new Insets(0),
new BorderRadius(this.propertyLineWidth.size() * 0.5f));
} }
{ {
// Manage cursor: // Manage cursor:
@ -287,7 +277,8 @@ public class Slider extends Widget {
} }
Vector2f tmpOriginShaper = delta; Vector2f tmpOriginShaper = delta;
Vector2f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y()); Vector2f tmpSizeInside = new Vector2f(this.propertyLineWidth.size() * 2.0f,
this.propertyLineWidth.size() * 2.0f);
//Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f); //Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
Vector2f tmpOriginInside = Vector2f.ZERO; Vector2f tmpOriginInside = Vector2f.ZERO;
@ -304,17 +295,11 @@ public class Slider extends Widget {
this.overCursorPositionStart = tmpOriginShaper; this.overCursorPositionStart = tmpOriginShaper;
this.overCursorPositionSize = tmpSizeShaper; this.overCursorPositionSize = tmpSizeShaper;
this.overCursorPositionStop = tmpOriginShaper.add(tmpSizeShaper); this.overCursorPositionStop = tmpOriginShaper.add(this.overCursorPositionSize);
//this.shape.setShape(1, tmpOriginShaper, tmpSizeShaper, tmpOriginInside, tmpSizeInside); this.vectorialDraw.addRectangle(this.overCursorPositionStart, this.overCursorPositionStop, new Insets(0),
new BorderRadius(this.propertyLineWidth.size() * 2.0f));
} }
LOGGER.error("REQUEST display an immage with size={}x{}", (int) this.overPositionSize.x(), this.vectorialDraw.flush();
(int) this.overPositionSize.y());
this.compositing.setRectangleAsSource((int) this.overPositionSize.x(), (int) this.overPositionSize.y(),
Color.GREEN);
// TODO: Refaire le design de cet affichage...
this.compositing.setPos(this.overPositionStart);
this.compositing.print(new Vector2f(this.overPositionSize.x(), this.overPositionSize.y()));
this.compositing.flush();
} }

View File

@ -53,7 +53,6 @@ public class Tick extends Box {
/// Periodic call handle to remove it when needed /// Periodic call handle to remove it when needed
protected Connection periodicConnectionHanble = new Connection(); protected Connection periodicConnectionHanble = new Connection();
private final Uri propertyConfig = new Uri("THEME", "shape/Tick.json", "ewol");
private final Uri uriCheckGreen = new Uri("THEME", "CheckBoxCrossRed.svg", "ewol"); private final Uri uriCheckGreen = new Uri("THEME", "CheckBoxCrossRed.svg", "ewol");
private Boolean propertyValue = false; //!< string that must be displayed private Boolean propertyValue = false; //!< string that must be displayed
@ -74,9 +73,6 @@ public class Tick extends Box {
@AknotName("value") @AknotName("value")
@AknotDescription("Tick value change") @AknotDescription("Tick value change")
public Signal<Boolean> signalValue = new Signal<>(); public Signal<Boolean> signalValue = new Signal<>();
// element over:
Vector2f overPositionStart = Vector2f.ZERO;
Vector2f overPositionStop = Vector2f.ZERO;
private boolean isDown; private boolean isDown;
@ -153,14 +149,10 @@ public class Tick extends Box {
@Override @Override
protected void onDraw() { protected void onDraw() {
super.onDraw(); super.onDraw();
if (this.propertyValue) { //if (this.propertyValue) {
if (this.compositingTick != null) { if (this.compositingTick != null && this.propertyValue) {
this.compositingTick.draw(true); this.compositingTick.draw(true);
}
} }
// if (this.shape != null) {
// this.shape.draw(true, this.propertyValue ? 0 : 1);
// }
} }
@Override @Override
@ -227,13 +219,19 @@ public class Tick extends Box {
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
super.onRegenerateDisplay();
if (!needRedraw()) { if (!needRedraw()) {
//return; //return;
} }
this.compositingTick.setSource(Uri.getAllDataString(this.uriCheckGreen));//, this.overPositionStart.less(4)); regenerateDisplay();
}
@Override
public void regenerateDisplay() {
super.regenerateDisplay();
final Vector2f size = this.overPositionStop.less(this.overPositionStart);
this.compositingTick.setSource(Uri.getAllDataString(this.uriCheckGreen), size.toVector2i());
this.compositingTick.setPos(this.overPositionStart.add(2)); this.compositingTick.setPos(this.overPositionStart.add(2));
this.compositingTick.print(this.overPositionStop.less(this.overPositionStart).less(4)); this.compositingTick.print(size.less(4));
this.compositingTick.flush(); this.compositingTick.flush();
} }

View File

@ -20,9 +20,9 @@ import org.atriasoft.etk.Dimension2f;
import org.atriasoft.etk.Distance; import org.atriasoft.etk.Distance;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector2b; import org.atriasoft.etk.math.Vector2b;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.etk.math.Vector3f; import org.atriasoft.etk.math.Vector3f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.Gravity; import org.atriasoft.ewol.Gravity;
@ -57,26 +57,26 @@ public class Widget extends EwolObject {
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
private boolean allowRepeatKeyboardEvent = true; //!< This remove the repeating keybord event due to the ant pressing key. private boolean allowRepeatKeyboardEvent = true; //!< This remove the repeating keybord event due to the ant pressing key.
private Cursor cursorDisplay = Cursor.arrow; private Cursor cursorDisplay = Cursor.arrow;
private final CompositingDrawing drawDebugBorder = null;//new CompositingDrawing(); //!< Compositing drawing element private final CompositingDrawing drawDebugBorder = null;//new CompositingDrawing(); //!< Compositing drawing element
// grab cursor mode // grab cursor mode
private boolean grabCursor = false; private boolean grabCursor = false;
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- focus Area // -- focus Area
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
private boolean hasFocus = false; //!< set the focus on this widget private boolean hasFocus = false; //!< set the focus on this widget
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- Mouse event properties Area // -- Mouse event properties Area
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
private int limitMouseEvent = 3; //!< this is to limit the number of mouse event that the widget can supported private int limitMouseEvent = 3; //!< this is to limit the number of mouse event that the widget can supported
private final List<EventShortCut> localShortcut = new ArrayList<>(); //!< list of all shortcut in the widget private final List<EventShortCut> localShortcut = new ArrayList<>(); //!< list of all shortcut in the widget
protected Vector2f maxSize = Vector2f.MAX_VALUE; //!< internal: maximum size of the widget protected Vector2f maxSize = Vector2f.MAX_VALUE; //!< internal: maximum size of the widget
protected Vector2f minSize = Vector2f.ZERO; //!< internal: minimum size of the widget protected Vector2f minSize = Vector2f.ZERO; //!< internal: minimum size of the widget
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working... // -- drawing : All drawing must be done in 2 separate buffer 1 for the current display and 1 for the working...
@ -92,28 +92,28 @@ public class Widget extends EwolObject {
protected boolean propertyHide = false; //!< hide a widget on the display protected boolean propertyHide = false; //!< hide a widget on the display
protected Dimension2f propertyMaxSize = new Dimension2f(Vector2f.MAX_VALUE, Distance.PIXEL); //!< user define the maximum size of the widget protected Dimension2f propertyMaxSize = new Dimension2f(Vector2f.MAX_VALUE, Distance.PIXEL); //!< user define the maximum size of the widget
protected Dimension2f propertyMinSize = new Dimension2f(Vector2f.ZERO, Distance.PIXEL); //!< user define the minimum size of the widget protected Dimension2f propertyMinSize = new Dimension2f(Vector2f.ZERO, Distance.PIXEL); //!< user define the minimum size of the widget
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- Shortcut : management of the shortcut // -- Shortcut : management of the shortcut
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
@AknotSignal @AknotSignal
@AknotName("shortcut") @AknotName("shortcut")
public Signal<String> signalShortcut; //!< signal handle of the message public Signal<String> signalShortcut; //!< signal handle of the message
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
// -- Widget size: // -- Widget size:
// ---------------------------------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------------------------------
protected Vector2f size = Vector2f.VALUE_16; //!< internal: current size of the widget protected Vector2f size = Vector2f.VALUE_16; //!< internal: current size of the widget
// internal element calculated by the system // internal element calculated by the system
protected float zoom = 1.0f; //!< generic widget zoom protected float zoom = 1.0f; //!< generic widget zoom
/** /**
* Constructor of the widget classes * Constructor of the widget classes
* @return (no exception generated (not managed in embedded platform)) * @return (no exception generated (not managed in embedded platform))
*/ */
public Widget() {} public Widget() {}
/** /**
* calculate the minimum and maximum size (need to estimate expend properties of the widget) * calculate the minimum and maximum size (need to estimate expend properties of the widget)
* @note : INTERNAL EWOL SYSTEM * @note : INTERNAL EWOL SYSTEM
@ -121,16 +121,16 @@ public class Widget extends EwolObject {
public void calculateMinMaxSize() { public void calculateMinMaxSize() {
calculateMinMaxSizeWidget(); calculateMinMaxSizeWidget();
} }
protected void calculateMinMaxSizeWidget() { protected void calculateMinMaxSizeWidget() {
this.minSize = this.propertyMinSize.getPixel(); this.minSize = this.propertyMinSize.getPixel();
//LOGGER.error("[" + getId() + "] convert in min size : " + propertyMinSize + " out=" + this.minSize); //LOGGER.error("[" + getId() + "] convert in min size : " + propertyMinSize + " out=" + this.minSize);
this.maxSize = this.propertyMaxSize.getPixel(); this.maxSize = this.propertyMaxSize.getPixel();
markToRedraw(); markToRedraw();
} }
public void calculateSize() {} public void calculateSize() {}
/** /**
* get the expend capabilities (xy) * get the expend capabilities (xy)
* @return 2D boolean represents the capacity to expend * @return 2D boolean represents the capacity to expend
@ -142,7 +142,7 @@ public class Widget extends EwolObject {
} }
return Vector2b.FALSE; return Vector2b.FALSE;
} }
/** /**
* get the expend if free capabilities (xy) * get the expend if free capabilities (xy)
* @return 2D boolean represents the capacity to expend (if some free space is available) * @return 2D boolean represents the capacity to expend (if some free space is available)
@ -154,7 +154,7 @@ public class Widget extends EwolObject {
} }
return Vector2b.FALSE; return Vector2b.FALSE;
} }
/** /**
* get the filling capabilities xy * get the filling capabilities xy
* @return Vector2b repensent the capacity to xy filling * @return Vector2b repensent the capacity to xy filling
@ -163,15 +163,15 @@ public class Widget extends EwolObject {
public Vector2b canFill() { public Vector2b canFill() {
return this.propertyFill; return this.propertyFill;
} }
/** /**
* Change Zoom property. * Change Zoom property.
* @param range Range of the zoom change. * @param range Range of the zoom change.
*/ */
void changeZoom(final float range) { void changeZoom(final float range) {
} }
/** /**
* Check if the current max size is compatible with the user maximum size * Check if the current max size is compatible with the user maximum size
* If it is not the user maximum size will overWrite the maximum size set. * If it is not the user maximum size will overWrite the maximum size set.
@ -181,7 +181,7 @@ public class Widget extends EwolObject {
final Vector2f pixelSize = this.propertyMaxSize.getPixel(); final Vector2f pixelSize = this.propertyMaxSize.getPixel();
this.maxSize = Vector2f.min(this.maxSize, pixelSize); this.maxSize = Vector2f.min(this.maxSize, pixelSize);
} }
/** /**
* Check if the current min size is compatible with the user minimum size * Check if the current min size is compatible with the user minimum size
* If it is not the user minimum size will overWrite the minimum size set. * If it is not the user minimum size will overWrite the minimum size set.
@ -191,7 +191,7 @@ public class Widget extends EwolObject {
final Vector2f pixelSize = this.propertyMinSize.getPixel(); final Vector2f pixelSize = this.propertyMinSize.getPixel();
this.minSize = Vector2f.max(this.minSize, pixelSize); this.minSize = Vector2f.max(this.minSize, pixelSize);
} }
public void drawWidgetTree(final int level) { public void drawWidgetTree(final int level) {
final StringBuilder space = new StringBuilder(); final StringBuilder space = new StringBuilder();
for (int iii = 0; iii < level; ++iii) { for (int iii = 0; iii < level; ++iii) {
@ -201,7 +201,7 @@ public class Widget extends EwolObject {
.append(getClass().getCanonicalName()).append(" o=").append(this.origin).append(" s=") .append(getClass().getCanonicalName()).append(" o=").append(this.origin).append(" s=")
.append(this.size).append(" hide=").append(this.propertyHide).toString()); .append(this.size).append(" hide=").append(this.propertyHide).toString());
} }
/** /**
* get the widget maximum size calculated * get the widget maximum size calculated
* @return Requested size * @return Requested size
@ -213,7 +213,7 @@ public class Widget extends EwolObject {
} }
return Vector2f.MAX_VALUE; return Vector2f.MAX_VALUE;
} }
/** /**
* get the widget minimum size calculated * get the widget minimum size calculated
* @return Requested size * @return Requested size
@ -225,7 +225,7 @@ public class Widget extends EwolObject {
} }
return Vector2f.ZERO; return Vector2f.ZERO;
} }
/** /**
* get the current cursor. * get the current cursor.
* @return the type of the cursor. * @return the type of the cursor.
@ -233,7 +233,7 @@ public class Widget extends EwolObject {
public Cursor getCursor() { public Cursor getCursor() {
return this.cursorDisplay; return this.cursorDisplay;
} }
/** /**
* get the grabbing status of the cursor. * get the grabbing status of the cursor.
* @return true if the cursor is currently grabbed * @return true if the cursor is currently grabbed
@ -241,7 +241,7 @@ public class Widget extends EwolObject {
public boolean getGrabStatus() { public boolean getGrabStatus() {
return this.grabCursor; return this.grabCursor;
} }
/** /**
* get the keyboard repeating event supporting. * get the keyboard repeating event supporting.
* @return true : the event can be repeated. * @return true : the event can be repeated.
@ -250,7 +250,7 @@ public class Widget extends EwolObject {
public boolean getKeyboardRepeat() { public boolean getKeyboardRepeat() {
return this.allowRepeatKeyboardEvent; return this.allowRepeatKeyboardEvent;
} }
/** /**
* get the number of mouse event supported * get the number of mouse event supported
* @return return the number of event that the mouse supported [0..3] * @return return the number of event that the mouse supported [0..3]
@ -258,7 +258,7 @@ public class Widget extends EwolObject {
public int getMouseLimit() { public int getMouseLimit() {
return this.limitMouseEvent; return this.limitMouseEvent;
} }
/** /**
* get the offset property of the widget. * get the offset property of the widget.
* @return The current offset value. * @return The current offset value.
@ -266,7 +266,7 @@ public class Widget extends EwolObject {
Vector2f getOffset() { Vector2f getOffset() {
return this.offset; return this.offset;
} }
/** /**
* Get the origin (absolute position in the windows). * Get the origin (absolute position in the windows).
* @return Coordinate of the origin requested. * @return Coordinate of the origin requested.
@ -274,7 +274,7 @@ public class Widget extends EwolObject {
public Vector2f getOrigin() { public Vector2f getOrigin() {
return this.origin; return this.origin;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("focus") @AknotName("focus")
@ -282,7 +282,7 @@ public class Widget extends EwolObject {
public boolean getPropertyCanFocus() { public boolean getPropertyCanFocus() {
return this.propertyCanFocus; return this.propertyCanFocus;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("expand") @AknotName("expand")
@ -290,7 +290,7 @@ public class Widget extends EwolObject {
public Vector2b getPropertyExpand() { public Vector2b getPropertyExpand() {
return this.propertyExpand; return this.propertyExpand;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("expand-free") @AknotName("expand-free")
@ -298,7 +298,7 @@ public class Widget extends EwolObject {
public Vector2b getPropertyExpandIfFree() { public Vector2b getPropertyExpandIfFree() {
return this.propertyExpandIfFree; return this.propertyExpandIfFree;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("fill") @AknotName("fill")
@ -306,7 +306,7 @@ public class Widget extends EwolObject {
public Vector2b getPropertyFill() { public Vector2b getPropertyFill() {
return this.propertyFill; return this.propertyFill;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("gravity") @AknotName("gravity")
@ -314,7 +314,7 @@ public class Widget extends EwolObject {
public Gravity getPropertyGravity() { public Gravity getPropertyGravity() {
return this.propertyGravity; return this.propertyGravity;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("hide") @AknotName("hide")
@ -322,7 +322,7 @@ public class Widget extends EwolObject {
public boolean getPropertyHide() { public boolean getPropertyHide() {
return this.propertyHide; return this.propertyHide;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("max-size") @AknotName("max-size")
@ -330,7 +330,7 @@ public class Widget extends EwolObject {
public Dimension2f getPropertyMaxSize() { public Dimension2f getPropertyMaxSize() {
return this.propertyMaxSize; return this.propertyMaxSize;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("min-size") @AknotName("min-size")
@ -338,7 +338,7 @@ public class Widget extends EwolObject {
public Dimension2f getPropertyMinSize() { public Dimension2f getPropertyMinSize() {
return this.propertyMinSize; return this.propertyMinSize;
} }
/** /**
* get the widget size * get the widget size
* @return Requested size * @return Requested size
@ -350,7 +350,7 @@ public class Widget extends EwolObject {
} }
return Vector2f.ZERO; return Vector2f.ZERO;
} }
/** /**
* get the widget at the specific windows absolute position * get the widget at the specific windows absolute position
* @param pos gAbsolute position of the requested widget knowledge * @param pos gAbsolute position of the requested widget knowledge
@ -364,21 +364,21 @@ public class Widget extends EwolObject {
} }
return null; return null;
} }
/** /**
* Get the current Widget Manager. * Get the current Widget Manager.
*/ */
public WidgetManager getWidgetManager() { public WidgetManager getWidgetManager() {
return EwolObject.getContext().getWidgetManager(); return EwolObject.getContext().getWidgetManager();
} }
/** /**
* Get the current Windows. * Get the current Windows.
*/ */
public Windows getWindows() { public Windows getWindows() {
return EwolObject.getContext().getWindows(); return EwolObject.getContext().getWindows();
} }
/** /**
* get the zoom property of the widget * get the zoom property of the widget
* @return the current zoom value * @return the current zoom value
@ -386,7 +386,7 @@ public class Widget extends EwolObject {
public float getZoom() { public float getZoom() {
return this.zoom; return this.zoom;
} }
/** /**
* Grab the cursor : This get all the movement of the mouse in PC mode, and generate an offset instead of a position. * Grab the cursor : This get all the movement of the mouse in PC mode, and generate an offset instead of a position.
* @note : the generation of the offset is due to the fact the cursor position is forced at the center of the widget. * @note : the generation of the offset is due to the fact the cursor position is forced at the center of the widget.
@ -398,14 +398,14 @@ public class Widget extends EwolObject {
this.grabCursor = true; this.grabCursor = true;
} }
} }
/** /**
* Hide the keyboard (if needed) * Hide the keyboard (if needed)
*/ */
protected void hideKeyboard() { protected void hideKeyboard() {
EwolObject.getContext().keyboardHide(); EwolObject.getContext().keyboardHide();
} }
/** /**
* get the focus state of the widget * get the focus state of the widget
* @return focus state * @return focus state
@ -413,14 +413,14 @@ public class Widget extends EwolObject {
public boolean isFocused() { public boolean isFocused() {
return this.hasFocus; return this.hasFocus;
} }
/** /**
* keep the focus on this widget == > this remove the previous focus on all other widget * keep the focus on this widget == > this remove the previous focus on all other widget
*/ */
public void keepFocus() { public void keepFocus() {
getWidgetManager().focusKeep(this); getWidgetManager().focusKeep(this);
} }
/** /**
* The widget mark itself that it need to regenerate the nest time. * The widget mark itself that it need to regenerate the nest time.
*/ */
@ -431,7 +431,7 @@ public class Widget extends EwolObject {
this.needRegenerateDisplay = true; this.needRegenerateDisplay = true;
getWidgetManager().markDrawingIsNeeded(); getWidgetManager().markDrawingIsNeeded();
} }
/** /**
* get the need of the redrawing of the widget and reset it to false * get the need of the redrawing of the widget and reset it to false
* @return true if we need to redraw * @return true if we need to redraw
@ -442,7 +442,7 @@ public class Widget extends EwolObject {
this.needRegenerateDisplay = false; this.needRegenerateDisplay = false;
return tmpData; return tmpData;
} }
/** /**
* Parent have set the size and the origin. The container need to update the child widget property * Parent have set the size and the origin. The container need to update the child widget property
* @note INTERNAL EWOL SYSTEM * @note INTERNAL EWOL SYSTEM
@ -451,19 +451,19 @@ public class Widget extends EwolObject {
LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} update size : " + this.size); LOGGER.trace("[" + getId() + "] {" + getClass().getCanonicalName() + "} update size : " + this.size);
markToRedraw(); markToRedraw();
} }
/** /**
* Common widget drawing function (called by the drawing thread [Android, X11, ...]) * Common widget drawing function (called by the drawing thread [Android, X11, ...])
*/ */
protected void onDraw() {} protected void onDraw() {}
/** /**
* Event on a past event == > this event is asynchronous due to all system does not support direct getting data. * Event on a past event == > this event is asynchronous due to all system does not support direct getting data.
* @note : need to have focus ... * @note : need to have focus ...
* @param clipboardID Mode of data requested * @param clipboardID Mode of data requested
*/ */
public void onEventClipboard(final ClipboardList clipboardID) {} public void onEventClipboard(final ClipboardList clipboardID) {}
/** /**
* Entry event. * Entry event.
* represent the physical event : * represent the physical event :
@ -477,7 +477,7 @@ public class Widget extends EwolObject {
protected boolean onEventEntry(final EventEntry event) { protected boolean onEventEntry(final EventEntry event) {
return false; return false;
} }
/** /**
* Event on an input of this Widget (finger, mouse, stylet) * Event on an input of this Widget (finger, mouse, stylet)
* @param event Event properties * @param event Event properties
@ -487,7 +487,7 @@ public class Widget extends EwolObject {
protected boolean onEventInput(final EventInput event) { protected boolean onEventInput(final EventInput event) {
return false; return false;
} }
/** /**
* Event on a short-cut of this Widget (in case of return false, the event on the keyevent will arrive in the function @ref onEventKb). * Event on a short-cut of this Widget (in case of return false, the event on the keyevent will arrive in the function @ref onEventKb).
* @param special All the special kay pressed at this time. * @param special All the special kay pressed at this time.
@ -541,19 +541,19 @@ public class Widget extends EwolObject {
} }
return false; return false;
} }
/** /**
* Event of the focus has been grabed by the current widget * Event of the focus has been grabed by the current widget
*/ */
protected void onGetFocus() {} protected void onGetFocus() {}
/** /**
* Event of the focus has been lost by the current widget * Event of the focus has been lost by the current widget
*/ */
protected void onLostFocus() {} protected void onLostFocus() {}
protected void onRegenerateDisplay() {} protected void onRegenerateDisplay() {}
protected void onUpdateMinMaxSize() { protected void onUpdateMinMaxSize() {
final Vector2f pixelMin = this.propertyMinSize.getPixel(); final Vector2f pixelMin = this.propertyMinSize.getPixel();
final Vector2f pixelMax = this.propertyMaxSize.getPixel(); final Vector2f pixelMax = this.propertyMaxSize.getPixel();
@ -564,7 +564,7 @@ public class Widget extends EwolObject {
} }
requestUpdateSize(); requestUpdateSize();
} }
/** /**
* Convert the absolute position in the local Position (Relative) * Convert the absolute position in the local Position (Relative)
* @param pos Absolute position that you request conversion. * @param pos Absolute position that you request conversion.
@ -573,14 +573,14 @@ public class Widget extends EwolObject {
public Vector2f relativePosition(final Vector2f pos) { public Vector2f relativePosition(final Vector2f pos) {
return pos.less(this.origin); return pos.less(this.origin);
} }
/** /**
* Need to be call When the size of the current widget have change ==> this force the system to recalculate all the widget positions. * Need to be call When the size of the current widget have change ==> this force the system to recalculate all the widget positions.
*/ */
public void requestUpdateSize() { public void requestUpdateSize() {
EwolObject.getContext().requestUpdateSize(); EwolObject.getContext().requestUpdateSize();
} }
/** /**
* remove the focus on this widget * remove the focus on this widget
* @return return true if the widget have release his focus (if he has it) * @return return true if the widget have release his focus (if he has it)
@ -595,7 +595,7 @@ public class Widget extends EwolObject {
} }
return false; return false;
} }
/** /**
* set the cursor display type. * set the cursor display type.
* @param newCursor selected new cursor. * @param newCursor selected new cursor.
@ -605,7 +605,7 @@ public class Widget extends EwolObject {
this.cursorDisplay = newCursor; this.cursorDisplay = newCursor;
EwolObject.getContext().setCursor(this.cursorDisplay); EwolObject.getContext().setCursor(this.cursorDisplay);
} }
/** /**
* set focus on this widget * set focus on this widget
* @return return true if the widget keep the focus * @return return true if the widget keep the focus
@ -624,7 +624,7 @@ public class Widget extends EwolObject {
LOGGER.trace("set focus (stop) ret false"); LOGGER.trace("set focus (stop) ret false");
return false; return false;
} }
/** /**
* set the keyboard repeating event supporting. * set the keyboard repeating event supporting.
* @param state The repeating status (true: enable, false disable). * @param state The repeating status (true: enable, false disable).
@ -632,7 +632,7 @@ public class Widget extends EwolObject {
protected void setKeyboardRepeat(final boolean state) { protected void setKeyboardRepeat(final boolean state) {
this.allowRepeatKeyboardEvent = state; this.allowRepeatKeyboardEvent = state;
} }
/** /**
* get the number of mouse event supported * get the number of mouse event supported
* @param numberState The number of event that the mouse supported [0..3] * @param numberState The number of event that the mouse supported [0..3]
@ -640,21 +640,21 @@ public class Widget extends EwolObject {
public void setMouseLimit(final int numberState) { public void setMouseLimit(final int numberState) {
this.limitMouseEvent = numberState; this.limitMouseEvent = numberState;
} }
/** /**
* User set No maximum size. * User set No maximum size.
*/ */
public void setNoMaxSize() { public void setNoMaxSize() {
setPropertyMaxSize(new Dimension2f(Vector2f.MAX_VALUE, Distance.PIXEL)); setPropertyMaxSize(new Dimension2f(Vector2f.MAX_VALUE, Distance.PIXEL));
} }
/** /**
* User set No minimum size. * User set No minimum size.
*/ */
public void setNoMinSize() { public void setNoMinSize() {
setPropertyMinSize(new Dimension2f(Vector2f.ZERO, Distance.PIXEL)); setPropertyMinSize(new Dimension2f(Vector2f.ZERO, Distance.PIXEL));
} }
/** /**
* set the zoom property of the widget. * set the zoom property of the widget.
* @param newVal offset value. * @param newVal offset value.
@ -666,7 +666,7 @@ public class Widget extends EwolObject {
markToRedraw(); markToRedraw();
} }
} }
/** /**
* Set origin at the widget (must be an parent widget that set this parameter). * Set origin at the widget (must be an parent widget that set this parameter).
* This represent the absolute origin in the program windows. * This represent the absolute origin in the program windows.
@ -676,7 +676,7 @@ public class Widget extends EwolObject {
public void setOrigin(final Vector2f pos) { public void setOrigin(final Vector2f pos) {
this.origin = pos; this.origin = pos;
} }
public void setPropertyCanFocus(final boolean canFocus) { public void setPropertyCanFocus(final boolean canFocus) {
if (this.propertyCanFocus == canFocus) { if (this.propertyCanFocus == canFocus) {
return; return;
@ -689,7 +689,7 @@ public class Widget extends EwolObject {
rmFocus(); rmFocus();
} }
} }
public void setPropertyExpand(final Vector2b value) { public void setPropertyExpand(final Vector2b value) {
if (this.propertyExpand.equals(value)) { if (this.propertyExpand.equals(value)) {
return; return;
@ -698,7 +698,7 @@ public class Widget extends EwolObject {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyExpandIfFree(final Vector2b value) { public void setPropertyExpandIfFree(final Vector2b value) {
if (this.propertyExpandIfFree.equals(value)) { if (this.propertyExpandIfFree.equals(value)) {
return; return;
@ -707,7 +707,7 @@ public class Widget extends EwolObject {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyFill(final Vector2b value) { public void setPropertyFill(final Vector2b value) {
if (this.propertyFill.equals(value)) { if (this.propertyFill.equals(value)) {
return; return;
@ -716,7 +716,7 @@ public class Widget extends EwolObject {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyGravity(final Gravity gravity) { public void setPropertyGravity(final Gravity gravity) {
if (this.propertyGravity.equals(gravity)) { if (this.propertyGravity.equals(gravity)) {
return; return;
@ -725,7 +725,7 @@ public class Widget extends EwolObject {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyHide(final boolean value) { public void setPropertyHide(final boolean value) {
if (this.propertyHide == value) { if (this.propertyHide == value) {
return; return;
@ -734,7 +734,7 @@ public class Widget extends EwolObject {
markToRedraw(); markToRedraw();
requestUpdateSize(); requestUpdateSize();
} }
public void setPropertyMaxSize(final Dimension2f value) { public void setPropertyMaxSize(final Dimension2f value) {
if (this.propertyMaxSize.equals(value)) { if (this.propertyMaxSize.equals(value)) {
return; return;
@ -742,7 +742,7 @@ public class Widget extends EwolObject {
this.propertyMaxSize = value; this.propertyMaxSize = value;
onUpdateMinMaxSize(); onUpdateMinMaxSize();
} }
public void setPropertyMinSize(final Dimension2f value) { public void setPropertyMinSize(final Dimension2f value) {
if (this.propertyMinSize.equals(value)) { if (this.propertyMinSize.equals(value)) {
return; return;
@ -750,7 +750,7 @@ public class Widget extends EwolObject {
this.propertyMinSize = value; this.propertyMinSize = value;
onUpdateMinMaxSize(); onUpdateMinMaxSize();
} }
/** /**
* set the widget size * set the widget size
* @return Requested size * @return Requested size
@ -762,7 +762,7 @@ public class Widget extends EwolObject {
return; return;
} }
} }
/** /**
* set the zoom property of the widget * set the zoom property of the widget
* @param newVal newZoom value * @param newVal newZoom value
@ -774,7 +774,7 @@ public class Widget extends EwolObject {
this.zoom = FMath.avg(0.0000001f, newVal, 1000000.0f); this.zoom = FMath.avg(0.0000001f, newVal, 1000000.0f);
markToRedraw(); markToRedraw();
} }
/** /**
* add a specific shortcut with his description * add a specific shortcut with his description
* @param descriptiveString Description string of the shortcut * @param descriptiveString Description string of the shortcut
@ -782,7 +782,7 @@ public class Widget extends EwolObject {
protected void shortCutAdd(final String descriptiveString) { protected void shortCutAdd(final String descriptiveString) {
shortCutAdd(descriptiveString, ""); shortCutAdd(descriptiveString, "");
} }
/** /**
* add a specific shortcut with his description * add a specific shortcut with his description
* @param descriptiveString Description string of the shortcut * @param descriptiveString Description string of the shortcut
@ -876,14 +876,14 @@ public class Widget extends EwolObject {
// add it on the List ... // add it on the List ...
this.localShortcut.add(new EventShortCut(message, specialKey, unicodeValue, keyboardMoveValue, true)); this.localShortcut.add(new EventShortCut(message, specialKey, unicodeValue, keyboardMoveValue, true));
} }
/** /**
* remove all current shortCut * remove all current shortCut
*/ */
protected void shortCutClean() { protected void shortCutClean() {
this.localShortcut.clear(); this.localShortcut.clear();
} }
/** /**
* remove a specific shortCut with his event name * remove a specific shortCut with his event name
* @param message generated event name * @param message generated event name
@ -891,14 +891,14 @@ public class Widget extends EwolObject {
protected void shortCutRemove(final String message) { protected void shortCutRemove(final String message) {
this.localShortcut.removeIf(eventShortCut -> eventShortCut.message().contentEquals(message)); this.localShortcut.removeIf(eventShortCut -> eventShortCut.message().contentEquals(message));
} }
/** /**
* display the keyboard (if needed) * display the keyboard (if needed)
*/ */
protected void showKeyboard() { protected void showKeyboard() {
EwolObject.getContext().keyboardShow(); EwolObject.getContext().keyboardShow();
} }
/** /**
* {SYSTEM} extern interface to request a draw ... (called by the drawing thread [Android, X11, ...]) * {SYSTEM} extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
* This function generate a clipping with the view-port openGL system. Like this a widget draw can not draw over an other widget * This function generate a clipping with the view-port openGL system. Like this a widget draw can not draw over an other widget
@ -934,7 +934,7 @@ public class Widget extends EwolObject {
public void systemDraw(final DrawProperty displayProp) { public void systemDraw(final DrawProperty displayProp) {
systemDrawWidget(displayProp); systemDrawWidget(displayProp);
} }
protected void systemDrawWidget(final DrawProperty displayProp) { protected void systemDrawWidget(final DrawProperty displayProp) {
//LOGGER.info("[" + getId() + "] Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" << this.size << " hide=" << propertyHide); //LOGGER.info("[" + getId() + "] Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" << this.size << " hide=" << propertyHide);
if (this.propertyHide) { if (this.propertyHide) {
@ -942,13 +942,13 @@ public class Widget extends EwolObject {
return; return;
} }
final Vector2f displayOrigin = this.origin.add(this.offset); final Vector2f displayOrigin = this.origin.add(this.offset);
// check if the element is displayable in the windows : // check if the element is displayable in the windows :
if (displayProp.windowsSize().x() < this.origin.x() || displayProp.windowsSize().y() < this.origin.y()) { if (displayProp.windowsSize().x() < this.origin.x() || displayProp.windowsSize().y() < this.origin.y()) {
// out of the windows == > nothing to display ... // out of the windows == > nothing to display ...
return; return;
} }
final DrawProperty tmpSize = displayProp.withLimit(this.origin, this.size); final DrawProperty tmpSize = displayProp.withLimit(this.origin, this.size);
if (tmpSize.size().x() <= 0 || tmpSize.size().y() <= 0) { if (tmpSize.size().x() <= 0 || tmpSize.size().y() <= 0) {
return; return;
@ -971,7 +971,7 @@ public class Widget extends EwolObject {
final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-tmpSize.size().x() / 2, tmpSize.size().x() / 2, final Matrix4f tmpProjection = Matrix4f.createMatrixOrtho(-tmpSize.size().x() / 2, tmpSize.size().x() / 2,
-tmpSize.size().y() / 2, tmpSize.size().y() / 2, -500, 500); -tmpSize.size().y() / 2, tmpSize.size().y() / 2, -500, 500);
//Matrix4f tmpMat = tmpProjection.multiply(tmpScale).multiply(tmpTranslate); //Matrix4f tmpMat = tmpProjection.multiply(tmpScale).multiply(tmpTranslate);
OpenGL.push(); OpenGL.push();
// set internal matrix system : // set internal matrix system :
//OpenGL.setMatrix(tmpMat); //OpenGL.setMatrix(tmpMat);
@ -985,7 +985,7 @@ public class Widget extends EwolObject {
OpenGL.pop(); OpenGL.pop();
GL11.glFinish(); GL11.glFinish();
} }
/** /**
* {SYSTEM} Entry event (only meta widget might overwrite this function). * {SYSTEM} Entry event (only meta widget might overwrite this function).
* @param event Event properties * @param event Event properties
@ -1000,7 +1000,7 @@ public class Widget extends EwolObject {
} }
return onEventEntry(event.event()); return onEventEntry(event.event());
} }
/** /**
* {SYSTEM} system event input (only meta widget might overwrite this function). * {SYSTEM} system event input (only meta widget might overwrite this function).
* @param event Event properties * @param event Event properties
@ -1018,7 +1018,7 @@ public class Widget extends EwolObject {
} }
return onEventInput(event.event()); return onEventInput(event.event());
} }
/** /**
* Event generated when a redraw is needed * Event generated when a redraw is needed
*/ */
@ -1044,7 +1044,7 @@ public class Widget extends EwolObject {
} }
onRegenerateDisplay(); onRegenerateDisplay();
} }
/** /**
* Un-Grab the cursor (default mode cursor offset) * Un-Grab the cursor (default mode cursor offset)
*/ */

View File

@ -4,12 +4,10 @@ import org.atriasoft.aknot.annotation.AknotAttribute;
import org.atriasoft.aknot.annotation.AknotDescription; import org.atriasoft.aknot.annotation.AknotDescription;
import org.atriasoft.aknot.annotation.AknotManaged; import org.atriasoft.aknot.annotation.AknotManaged;
import org.atriasoft.aknot.annotation.AknotName; import org.atriasoft.aknot.annotation.AknotName;
import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri; import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.FMath; import org.atriasoft.etk.math.FMath;
import org.atriasoft.etk.math.Matrix4f; import org.atriasoft.etk.math.Matrix4f;
import org.atriasoft.etk.math.Vector2f; import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.DrawProperty; import org.atriasoft.ewol.DrawProperty;
import org.atriasoft.ewol.HighSpeedMode; import org.atriasoft.ewol.HighSpeedMode;
import org.atriasoft.ewol.Padding; import org.atriasoft.ewol.Padding;
@ -26,17 +24,17 @@ import org.slf4j.LoggerFactory;
*/ */
class WidgetScrolled extends Widget { class WidgetScrolled extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(WidgetScrolled.class); private static final Logger LOGGER = LoggerFactory.getLogger(WidgetScrolled.class);
public enum ScrollingMode { public enum ScrollingMode {
scroolModeNormal, //!< No Zoom , can UP and down, left and right scroolModeNormal, //!< No Zoom , can UP and down, left and right
scroolModeCenter, //!< Zoom enable, no move left and right scroolModeCenter, //!< Zoom enable, no move left and right
scroolModeGame, //!< Zoom enable, no move left and right scroolModeGame, //!< Zoom enable, no move left and right
} }
public static final int CALCULATE_SIMULTANEOUS_FINGER = 5; public static final int CALCULATE_SIMULTANEOUS_FINGER = 5;
protected Uri propertyShapeVert = new Uri("THEME", "shape/WidgetScrolled.json", "ewol"); //!< Vertical shaper name protected Uri propertyShapeVert = new Uri("THEME", "shape/WidgetScrolled.json", "ewol"); //!< Vertical shaper name
protected Uri propertyShapeHori = new Uri("THEME", "shape/WidgetScrolled.json", "ewol"); //!< Horizontal shaper name protected Uri propertyShapeHori = new Uri("THEME", "shape/WidgetScrolled.json", "ewol"); //!< Horizontal shaper name
protected CompositingSVG compositingH = new CompositingSVG(); protected CompositingSVG compositingH = new CompositingSVG();
protected CompositingSVG compositingV = new CompositingSVG(); protected CompositingSVG compositingV = new CompositingSVG();
protected Vector2f originScrooled = Vector2f.ZERO; //!< pixel distance from the origin of the display (Bottum left) protected Vector2f originScrooled = Vector2f.ZERO; //!< pixel distance from the origin of the display (Bottum left)
@ -54,7 +52,7 @@ class WidgetScrolled extends Widget {
private final boolean[] fingerPresent = { false, false, false, false, false }; private final boolean[] fingerPresent = { false, false, false, false, false };
private boolean fingerScoolActivated = false; private boolean fingerScoolActivated = false;
private final Vector2f[] fingerMoveStartPos = new Vector2f[CALCULATE_SIMULTANEOUS_FINGER]; private final Vector2f[] fingerMoveStartPos = new Vector2f[CALCULATE_SIMULTANEOUS_FINGER];
/** /**
* Scroll Widget main constructor to be inherited from an other widget (this is not a stand-alone widget) * Scroll Widget main constructor to be inherited from an other widget (this is not a stand-alone widget)
* @param _shaperName Shaper name if the scrolled widget. * @param _shaperName Shaper name if the scrolled widget.
@ -63,7 +61,7 @@ class WidgetScrolled extends Widget {
onChangePropertyShapeVert(); onChangePropertyShapeVert();
onChangePropertyShapeHori(); onChangePropertyShapeHori();
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("shape-hori") @AknotName("shape-hori")
@ -71,7 +69,7 @@ class WidgetScrolled extends Widget {
public Uri getPropertyShapeHori() { public Uri getPropertyShapeHori() {
return this.propertyShapeHori; return this.propertyShapeHori;
} }
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("shape-vert") @AknotName("shape-vert")
@ -79,7 +77,7 @@ class WidgetScrolled extends Widget {
public Uri getPropertyShapeVert() { public Uri getPropertyShapeVert() {
return this.propertyShapeVert; return this.propertyShapeVert;
} }
/** /**
* Get the single finger capabilities * Get the single finger capabilities
* @return true The single finger mode is active * @return true The single finger mode is active
@ -88,7 +86,7 @@ class WidgetScrolled extends Widget {
public boolean getSingleFinger() { public boolean getSingleFinger() {
return this.singleFingerMode; return this.singleFingerMode;
} }
protected void onChangePropertyShapeHori() { protected void onChangePropertyShapeHori() {
// if (this.shaperH == null) { // if (this.shaperH == null) {
// this.shaperH = new GuiShape(this.propertyShapeHori); // this.shaperH = new GuiShape(this.propertyShapeHori);
@ -97,7 +95,7 @@ class WidgetScrolled extends Widget {
// } // }
markToRedraw(); markToRedraw();
} }
protected void onChangePropertyShapeVert() { protected void onChangePropertyShapeVert() {
// if (this.shaperV == null) { // if (this.shaperV == null) {
// this.shaperV = new GuiShape(this.propertyShapeVert); // this.shaperV = new GuiShape(this.propertyShapeVert);
@ -106,13 +104,13 @@ class WidgetScrolled extends Widget {
// } // }
markToRedraw(); markToRedraw();
} }
@Override @Override
protected void onDraw() { protected void onDraw() {
this.compositingH.draw(); this.compositingH.draw();
this.compositingV.draw(); this.compositingV.draw();
} }
@Override @Override
public boolean onEventInput(final EventInput event) { public boolean onEventInput(final EventInput event) {
LOGGER.trace("event XXX {}", event); LOGGER.trace("event XXX {}", event);
@ -436,13 +434,13 @@ class WidgetScrolled extends Widget {
} }
} }
} else if (this.scroollingMode == ScrollingMode.scroolModeGame) { } else if (this.scroollingMode == ScrollingMode.scroolModeGame) {
} else { } else {
LOGGER.error("Scrolling mode unknow ... " + this.scroollingMode); LOGGER.error("Scrolling mode unknow ... " + this.scroollingMode);
} }
return false; return false;
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
this.compositingH.clear(); this.compositingH.clear();
@ -460,14 +458,14 @@ class WidgetScrolled extends Widget {
/ (this.maxSize.y() - this.size.y() * this.limitScrolling.y()); / (this.maxSize.y() - this.size.y() * this.limitScrolling.y());
originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f); originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (this.size.y() - lenScrollBar); originScrollBar *= (this.size.y() - lenScrollBar);
final Vector2f renderOrigin = new Vector2f(this.size.x() - paddingVert.x(), 0); final Vector2f renderOrigin = new Vector2f(this.size.x() - paddingVert.x(), 0);
final Vector2f renderSize = new Vector2f(paddingVert.x(), this.size.y()); final Vector2f renderSize = new Vector2f(paddingVert.x(), this.size.y());
this.compositingV.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN); // this.compositingV.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
this.compositingV.setPos(renderOrigin); // this.compositingV.setPos(renderOrigin);
this.compositingV.print(renderSize); // this.compositingV.print(renderSize);
this.compositingV.flush(); // this.compositingV.flush();
// this.shaperV.setShape(new Vector2f(this.size.x() - paddingVert.x(), 0), // this.shaperV.setShape(new Vector2f(this.size.x() - paddingVert.x(), 0),
// new Vector2f(paddingVert.x(), this.size.y()), // new Vector2f(paddingVert.x(), this.size.y()),
// new Vector2f(this.size.x() - paddingVert.right(), this.size.y() - originScrollBar - lenScrollBar), // new Vector2f(this.size.x() - paddingVert.right(), this.size.y() - originScrollBar - lenScrollBar),
@ -481,26 +479,26 @@ class WidgetScrolled extends Widget {
/ (this.maxSize.x() - this.size.x() * this.limitScrolling.x()); / (this.maxSize.x() - this.size.x() * this.limitScrolling.x());
originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f); originScrollBar = FMath.avg(0.0f, originScrollBar, 1.0f);
originScrollBar *= (this.size.x() - paddingHori.right() - lenScrollBar); originScrollBar *= (this.size.x() - paddingHori.right() - lenScrollBar);
final Vector2f renderOrigin = Vector2f.ZERO; final Vector2f renderOrigin = Vector2f.ZERO;
final Vector2f renderSize = new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()); final Vector2f renderSize = new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y());
this.compositingH.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN); // this.compositingH.setRectangleAsSource((int) renderSize.x(), (int) renderSize.y(), Color.GREEN);
this.compositingH.setPos(renderOrigin); // this.compositingH.setPos(renderOrigin);
this.compositingH.print(renderSize); // this.compositingH.print(renderSize);
this.compositingH.flush(); // this.compositingH.flush();
//
// this.shaperH.setShape(new Vector2f(0, 0), new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()), // this.shaperH.setShape(new Vector2f(0, 0), new Vector2f(this.size.x() - paddingVert.x(), paddingHori.y()),
// new Vector2f(originScrollBar, paddingHori.bottom()), new Vector2f(lenScrollBar, 0)); // new Vector2f(originScrollBar, paddingHori.bottom()), new Vector2f(lenScrollBar, 0));
} }
} }
/** /**
* Reset the scoll of the subWidget * Reset the scoll of the subWidget
*/ */
public void resetScrollOrigin() { public void resetScrollOrigin() {
this.originScrooled = new Vector2f(0, 0); this.originScrooled = new Vector2f(0, 0);
} }
/** /**
* Specify the mode of scrolling for this windows * Specify the mode of scrolling for this windows
* @param newMode the selected mode for the scrolling... * @param newMode the selected mode for the scrolling...
@ -513,7 +511,7 @@ class WidgetScrolled extends Widget {
this.zoom = 1; this.zoom = 1;
} }
} }
/** /**
* set the scrolling limit when arriving at he end of the widget * set the scrolling limit when arriving at he end of the widget
* @param poucentageLimit pourcent of the limit of view nothing in the widget when arriving at the end ... * @param poucentageLimit pourcent of the limit of view nothing in the widget when arriving at the end ...
@ -522,7 +520,7 @@ class WidgetScrolled extends Widget {
poucentageLimit = FMath.avg(0.1f, poucentageLimit, 1.0f); poucentageLimit = FMath.avg(0.1f, poucentageLimit, 1.0f);
this.limitScrolling = new Vector2f(poucentageLimit, poucentageLimit); this.limitScrolling = new Vector2f(poucentageLimit, poucentageLimit);
} }
/** /**
* set the scrolling limit when arriving at he end of the widget * set the scrolling limit when arriving at he end of the widget
* @param poucentageLimit pourcent of the limit of view nothing in the widget when arriving at the end for axis specific... * @param poucentageLimit pourcent of the limit of view nothing in the widget when arriving at the end for axis specific...
@ -531,7 +529,7 @@ class WidgetScrolled extends Widget {
this.limitScrolling = new Vector2f(FMath.avg(0.1f, poucentageLimit.x(), 1.0f), this.limitScrolling = new Vector2f(FMath.avg(0.1f, poucentageLimit.x(), 1.0f),
FMath.avg(0.1f, poucentageLimit.y(), 1.0f)); FMath.avg(0.1f, poucentageLimit.y(), 1.0f));
} }
/** /**
* set the specific mawimum size of the widget * set the specific mawimum size of the widget
* @param localSize new Maximum size * @param localSize new Maximum size
@ -539,7 +537,7 @@ class WidgetScrolled extends Widget {
protected void setMaxSize(final Vector2f localSize) { protected void setMaxSize(final Vector2f localSize) {
this.maxSize = localSize; this.maxSize = localSize;
} }
public void setPropertyShapeHori(final Uri value) { public void setPropertyShapeHori(final Uri value) {
if (this.propertyShapeHori.equals(value)) { if (this.propertyShapeHori.equals(value)) {
return; return;
@ -547,7 +545,7 @@ class WidgetScrolled extends Widget {
this.propertyShapeHori = value; this.propertyShapeHori = value;
onChangePropertyShapeHori(); onChangePropertyShapeHori();
} }
public void setPropertyShapeVert(final Uri value) { public void setPropertyShapeVert(final Uri value) {
if (this.propertyShapeVert.equals(value)) { if (this.propertyShapeVert.equals(value)) {
return; return;
@ -555,7 +553,7 @@ class WidgetScrolled extends Widget {
this.propertyShapeVert = value; this.propertyShapeVert = value;
onChangePropertyShapeVert(); onChangePropertyShapeVert();
} }
/** /**
* Request a specific position for the scrolling of the current windows. * Request a specific position for the scrolling of the current windows.
* @param borderWidth size of the border that requested the element might not to be * @param borderWidth size of the border that requested the element might not to be
@ -565,7 +563,7 @@ class WidgetScrolled extends Widget {
protected void setScrollingPositionDynamic(final Vector2f borderWidth, final Vector2f currentPosition) { protected void setScrollingPositionDynamic(final Vector2f borderWidth, final Vector2f currentPosition) {
setScrollingPositionDynamic(borderWidth, currentPosition, false); setScrollingPositionDynamic(borderWidth, currentPosition, false);
} }
protected void setScrollingPositionDynamic( protected void setScrollingPositionDynamic(
Vector2f borderWidth, Vector2f borderWidth,
final Vector2f currentPosition, final Vector2f currentPosition,
@ -590,7 +588,7 @@ class WidgetScrolled extends Widget {
this.originScrooled = this.originScrooled.withY(FMath.max(0.0f, this.originScrooled.y())); this.originScrooled = this.originScrooled.withY(FMath.max(0.0f, this.originScrooled.y()));
} }
} }
/** /**
* For mouse event when we have a scrolling UP and dows, specify the number of pixel that we scrooled * For mouse event when we have a scrolling UP and dows, specify the number of pixel that we scrooled
* @param nbPixel number of pixel scrolling * @param nbPixel number of pixel scrolling
@ -598,7 +596,7 @@ class WidgetScrolled extends Widget {
protected void setScrollingSize(final float nbPixel) { protected void setScrollingSize(final float nbPixel) {
this.pixelScrolling = nbPixel; this.pixelScrolling = nbPixel;
} }
/** /**
* Set the single finger capabilities/ * Set the single finger capabilities/
* @param status True if single inger mode, two otherwise/ * @param status True if single inger mode, two otherwise/
@ -609,7 +607,7 @@ class WidgetScrolled extends Widget {
} }
this.singleFingerMode = status; this.singleFingerMode = status;
} }
@Override @Override
public void systemDraw(final DrawProperty displayProp) { public void systemDraw(final DrawProperty displayProp) {
OpenGL.push(); OpenGL.push();

View File

@ -31,11 +31,11 @@ import org.slf4j.LoggerFactory;
*/ */
public class Windows extends Widget { public class Windows extends Widget {
private static final Logger LOGGER = LoggerFactory.getLogger(Windows.class); private static final Logger LOGGER = LoggerFactory.getLogger(Windows.class);
protected int colorBg = -1; //!< Default background color of the windows protected int colorBg = -1; //!< Default background color of the windows
protected List<Widget> popUpWidgetList = new ArrayList<>(); protected List<Widget> popUpWidgetList = new ArrayList<>();
@AknotManaged @AknotManaged
@AknotAttribute @AknotAttribute
@AknotName("file-color") @AknotName("file-color")
@ -46,16 +46,16 @@ public class Windows extends Widget {
@AknotName("title") @AknotName("title")
@AknotDescription("Title of the windows") @AknotDescription("Title of the windows")
public String propertyTitle = "No title"; //!< Current title of the windows public String propertyTitle = "No title"; //!< Current title of the windows
protected ResourceColorFile resourceColor = null; //!< theme color property (name of file in @ref propertyColorConfiguration)
protected Widget subWidget;
protected ResourceColorFile resourceColor = null; //!< theme color property (name of file in @ref propertyColorConfiguration)
protected Widget subWidget;
protected Windows() { protected Windows() {
this.propertyCanFocus = true; this.propertyCanFocus = true;
onChangePropertyColor(); onChangePropertyColor();
} }
//!< List of pop-up displayed //!< List of pop-up displayed
@Override @Override
public void drawWidgetTree(int level) { public void drawWidgetTree(int level) {
@ -70,15 +70,15 @@ public class Windows extends Widget {
} }
} }
} }
public Uri getPropertyColorConfiguration() { public Uri getPropertyColorConfiguration() {
return this.propertyColorConfiguration; return this.propertyColorConfiguration;
} }
public String getPropertyTitle() { public String getPropertyTitle() {
return this.propertyTitle; return this.propertyTitle;
} }
@Override @Override
public EwolObject getSubObjectNamed(final String objectName) { public EwolObject getSubObjectNamed(final String objectName) {
EwolObject tmpObject = super.getSubObjectNamed(objectName); EwolObject tmpObject = super.getSubObjectNamed(objectName);
@ -104,7 +104,7 @@ public class Windows extends Widget {
// not find ... // not find ...
return null; return null;
} }
@Override @Override
public Widget getWidgetAtPos(final Vector2f pos) { public Widget getWidgetAtPos(final Vector2f pos) {
LOGGER.trace("Get widget at pos : " + pos); LOGGER.trace("Get widget at pos : " + pos);
@ -121,7 +121,7 @@ public class Windows extends Widget {
// otherwise the event go to this widget ... // otherwise the event go to this widget ...
return this; return this;
} }
protected void onChangePropertyColor() { protected void onChangePropertyColor() {
this.resourceColor = ResourceColorFile.create(this.propertyColorConfiguration); this.resourceColor = ResourceColorFile.create(this.propertyColorConfiguration);
if (this.resourceColor != null) { if (this.resourceColor != null) {
@ -131,7 +131,7 @@ public class Windows extends Widget {
+ this.propertyColorConfiguration); + this.propertyColorConfiguration);
} }
} }
@Override @Override
public void onChangeSize() { public void onChangeSize() {
super.onChangeSize(); super.onChangeSize();
@ -151,7 +151,7 @@ public class Windows extends Widget {
} }
} }
} }
@Override @Override
public void onRegenerateDisplay() { public void onRegenerateDisplay() {
if (this.subWidget != null) { if (this.subWidget != null) {
@ -163,7 +163,7 @@ public class Windows extends Widget {
} }
} }
} }
/** /**
* Get the number of pop-up * Get the number of pop-up
* @return Count of pop-up * @return Count of pop-up
@ -171,7 +171,7 @@ public class Windows extends Widget {
public int popUpCount() { public int popUpCount() {
return this.popUpWidgetList.size(); return this.popUpWidgetList.size();
} }
/** /**
* Remove the pop-up on top. * Remove the pop-up on top.
*/ */
@ -181,7 +181,7 @@ public class Windows extends Widget {
} }
this.popUpWidgetList.remove(this.popUpWidgetList.size() - 1); this.popUpWidgetList.remove(this.popUpWidgetList.size() - 1);
} }
/** /**
* Add a pop-up on the Windows. * Add a pop-up on the Windows.
* @param widget Widget to set on top of the pop-up. * @param widget Widget to set on top of the pop-up.
@ -201,7 +201,7 @@ public class Windows extends Widget {
// TODO : it is dangerous to access directly to the system ... // TODO : it is dangerous to access directly to the system ...
EwolObject.getContext().resetIOEvent(); EwolObject.getContext().resetIOEvent();
} }
//!< main sub-widget of the Windows. //!< main sub-widget of the Windows.
@Override @Override
public void requestDestroyFromChild(final EwolObject child) { public void requestDestroyFromChild(final EwolObject child) {
@ -229,7 +229,7 @@ public class Windows extends Widget {
markToRedraw(); markToRedraw();
} }
} }
public void setPropertyColorConfiguration(final Uri propertyColorConfiguration) { public void setPropertyColorConfiguration(final Uri propertyColorConfiguration) {
if (this.propertyColorConfiguration.equals(propertyColorConfiguration)) { if (this.propertyColorConfiguration.equals(propertyColorConfiguration)) {
return; return;
@ -237,7 +237,7 @@ public class Windows extends Widget {
this.propertyColorConfiguration = propertyColorConfiguration; this.propertyColorConfiguration = propertyColorConfiguration;
onChangePropertyColor(); onChangePropertyColor();
} }
public void setPropertyTitle(final String propertyTitle) { public void setPropertyTitle(final String propertyTitle) {
if (this.propertyTitle.contentEquals(propertyTitle)) { if (this.propertyTitle.contentEquals(propertyTitle)) {
return; return;
@ -250,7 +250,7 @@ public class Windows extends Widget {
LOGGER.info("Set title is delayed ..."); LOGGER.info("Set title is delayed ...");
} }
} }
/** /**
* Set the main widget of the application. * Set the main widget of the application.
* @param widget Widget to set in the windows. * @param widget Widget to set in the windows.
@ -268,7 +268,7 @@ public class Windows extends Widget {
// Regenerate the size calculation : // Regenerate the size calculation :
onChangeSize(); onChangeSize();
} }
public void sysDraw() { public void sysDraw() {
//LOGGER.trace("Draw on " + this.size); //LOGGER.trace("Draw on " + this.size);
// set the size of the open GL system // set the size of the open GL system
@ -281,11 +281,11 @@ public class Windows extends Widget {
OpenGL.disable(OpenGL.Flag.flag_texture2D); OpenGL.disable(OpenGL.Flag.flag_texture2D);
OpenGL.disable(OpenGL.Flag.flag_depthTest); OpenGL.disable(OpenGL.Flag.flag_depthTest);
OpenGL.disable(OpenGL.Flag.flag_cullFace); OpenGL.disable(OpenGL.Flag.flag_cullFace);
OpenGL.enable(OpenGL.Flag.flag_blend); OpenGL.enable(OpenGL.Flag.flag_blend);
//OpenGL.enable(OpenGL.Flag.flag_cullFace); //OpenGL.enable(OpenGL.Flag.flag_cullFace);
OpenGL.blendFuncAuto(); OpenGL.blendFuncAuto();
// clear the matrix system : // clear the matrix system :
OpenGL.setBasicMatrix(Matrix4f.IDENTITY); OpenGL.setBasicMatrix(Matrix4f.IDENTITY);
final Vector2i tmpSize = new Vector2i((int) this.size.x(), (int) this.size.y()); final Vector2i tmpSize = new Vector2i((int) this.size.x(), (int) this.size.y());
@ -293,7 +293,7 @@ public class Windows extends Widget {
systemDraw(displayProp); systemDraw(displayProp);
OpenGL.disable(OpenGL.Flag.flag_blend); OpenGL.disable(OpenGL.Flag.flag_blend);
} }
@Override @Override
public void systemDraw(final DrawProperty displayProp) { public void systemDraw(final DrawProperty displayProp) {
super.systemDraw(displayProp); super.systemDraw(displayProp);
@ -306,14 +306,14 @@ public class Windows extends Widget {
OpenGL.clearColor(Color.PURPLE); OpenGL.clearColor(Color.PURPLE);
OpenGL.clear(OpenGL.ClearFlag.clearFlag_colorBuffer); OpenGL.clear(OpenGL.ClearFlag.clearFlag_colorBuffer);
OpenGL.clear(OpenGL.ClearFlag.clearFlag_depthBuffer); OpenGL.clear(OpenGL.ClearFlag.clearFlag_depthBuffer);
//LOGGER.warn(" WINDOWS draw on " + this.currentDrawId); //LOGGER.warn(" WINDOWS draw on " + this.currentDrawId);
// first display the windows on the display // first display the windows on the display
if (this.subWidget != null) { if (this.subWidget != null) {
this.subWidget.systemDraw(displayProp); this.subWidget.systemDraw(displayProp);
//LOGGER.debug("Draw Windows"); //LOGGER.debug("Draw Windows");
} }
// second display the pop-up // second display the pop-up
for (final Widget it : this.popUpWidgetList) { for (final Widget it : this.popUpWidgetList) {
if (it != null) { if (it != null) {