[FEAT] basic concept of box to simple manage the HTML rectangle rendering
This commit is contained in:
parent
2743abe410
commit
847bcb14f4
50
pom.xml
50
pom.xml
@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.atriasoft</groupId>
|
<groupId>org.atriasoft</groupId>
|
||||||
<artifactId>ewol</artifactId>
|
<artifactId>ewol</artifactId>
|
||||||
<version>0.1.0</version>
|
<version>0.1.0</version>
|
||||||
<licenses>
|
<licenses>
|
||||||
<license>
|
<license>
|
||||||
<name>Mozilla Public License 2.0</name>
|
<name>Mozilla Public License 2.0</name>
|
||||||
@ -21,24 +21,22 @@
|
|||||||
</roles>
|
</roles>
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>gitea</id>
|
<id>gitea</id>
|
||||||
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
<repository>
|
<repository>
|
||||||
<id>gitea</id>
|
<id>gitea</id>
|
||||||
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||||
</repository>
|
</repository>
|
||||||
<snapshotRepository>
|
<snapshotRepository>
|
||||||
<id>gitea</id>
|
<id>gitea</id>
|
||||||
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
<url>https://gitea.atria-soft.org/api/packages/org.atriasoft/maven</url>
|
||||||
</snapshotRepository>
|
</snapshotRepository>
|
||||||
</distributionManagement>
|
</distributionManagement>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.atriasoft</groupId>
|
<groupId>org.atriasoft</groupId>
|
||||||
@ -76,10 +74,10 @@
|
|||||||
<version>0.1.0</version>
|
<version>0.1.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter-api</artifactId>
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
<version>5.11.0</version>
|
<version>5.11.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
@ -87,8 +85,7 @@
|
|||||||
<version>2.1.0-alpha1</version>
|
<version>2.1.0-alpha1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<sourceDirectory>src/main</sourceDirectory>
|
<sourceDirectory>src/main</sourceDirectory>
|
||||||
<resources>
|
<resources>
|
||||||
@ -132,7 +129,7 @@
|
|||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>3.2.5</version>
|
<version>3.2.5</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<archive>
|
<archive>
|
||||||
@ -144,7 +141,7 @@
|
|||||||
<descriptorRef>jar-with-dependencies</descriptorRef>
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
</descriptorRefs>
|
</descriptorRefs>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- Java-doc generation for stand-alone site -->
|
<!-- Java-doc generation for stand-alone site -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@ -170,5 +167,4 @@
|
|||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</reporting>
|
</reporting>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
@ -12,6 +12,7 @@ import org.atriasoft.esignal.Connection;
|
|||||||
import org.atriasoft.esignal.Signal;
|
import org.atriasoft.esignal.Signal;
|
||||||
import org.atriasoft.esignal.SignalEmpty;
|
import org.atriasoft.esignal.SignalEmpty;
|
||||||
import org.atriasoft.etk.Color;
|
import org.atriasoft.etk.Color;
|
||||||
|
import org.atriasoft.etk.Dimension1f;
|
||||||
import org.atriasoft.etk.Dimension2f;
|
import org.atriasoft.etk.Dimension2f;
|
||||||
import org.atriasoft.etk.Dimension3f;
|
import org.atriasoft.etk.Dimension3f;
|
||||||
import org.atriasoft.etk.Distance;
|
import org.atriasoft.etk.Distance;
|
||||||
@ -148,7 +149,44 @@ public class BasicWindows extends Windows {
|
|||||||
this.conections.add(con);
|
this.conections.add(con);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addMenuDimension1f(final Widget widget, final IntrospectionProperty pojo) {
|
||||||
|
Object valueRaw = null;
|
||||||
|
try {
|
||||||
|
valueRaw = pojo.getValue(widget);
|
||||||
|
} catch (final AknotException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (valueRaw instanceof final Dimension1f value) {
|
||||||
|
{
|
||||||
|
final Sizer lineSizer = new Sizer(DisplayMode.HORIZONTAL);
|
||||||
|
lineSizer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE);
|
||||||
|
lineSizer.setPropertyFill(Vector3b.TRUE);
|
||||||
|
this.sizerMenu.subWidgetAdd(lineSizer);
|
||||||
|
|
||||||
|
final Spin spin = new Spin();
|
||||||
|
spin.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE);
|
||||||
|
spin.setPropertyFill(Vector3b.TRUE);
|
||||||
|
spin.setPropertyValue((int) value.size());
|
||||||
|
lineSizer.subWidgetAdd(spin);
|
||||||
|
final Connection con = spin.signalValue.connect(valueButton -> {
|
||||||
|
try {
|
||||||
|
final Object oldValue = pojo.getValue(widget);
|
||||||
|
if (oldValue instanceof final Dimension1f castedValue) {
|
||||||
|
LOGGER.warn("Set new value: {}", castedValue.withSize(valueButton));
|
||||||
|
pojo.setExistingValue(widget, new Dimension1f(valueButton));
|
||||||
|
}
|
||||||
|
} catch (final AknotException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.conections.add(con);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void addMenuDimension2f(final Widget widget, final IntrospectionProperty pojo) {
|
public void addMenuDimension2f(final Widget widget, final IntrospectionProperty pojo) {
|
||||||
Object valueRaw = null;
|
Object valueRaw = null;
|
||||||
try {
|
try {
|
||||||
@ -1139,6 +1177,8 @@ public class BasicWindows extends Windows {
|
|||||||
addMenuDimension3f(widget, pojo);
|
addMenuDimension3f(widget, pojo);
|
||||||
} else if (pojo.getType() == Dimension2f.class) {
|
} else if (pojo.getType() == Dimension2f.class) {
|
||||||
addMenuDimension2f(widget, pojo);
|
addMenuDimension2f(widget, pojo);
|
||||||
|
} else if (pojo.getType() == Dimension1f.class) {
|
||||||
|
addMenuDimension1f(widget, pojo);
|
||||||
} else if (pojo.getType() == DisplayMode.class) {
|
} else if (pojo.getType() == DisplayMode.class) {
|
||||||
LOGGER.error(" ==> plop");
|
LOGGER.error(" ==> plop");
|
||||||
} else if (pojo.getType() == Uri.class) {
|
} else if (pojo.getType() == Uri.class) {
|
||||||
|
@ -0,0 +1,83 @@
|
|||||||
|
package sample.atriasoft.ewol.simpleWindowsWithBox;
|
||||||
|
|
||||||
|
import org.atriasoft.etk.Configs;
|
||||||
|
import org.atriasoft.etk.math.Vector2f;
|
||||||
|
import org.atriasoft.ewol.context.EwolApplication;
|
||||||
|
import org.atriasoft.ewol.context.EwolContext;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
public class Appl implements EwolApplication {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(Appl.class);
|
||||||
|
|
||||||
|
//! [ewol_sample_HW_main_application]
|
||||||
|
private void localCreate(final EwolContext context) {
|
||||||
|
//! [ewol_sample_HW_main_parse_arguments]
|
||||||
|
// parse all the argument of the application
|
||||||
|
for (int iii = 0; iii < context.getCmd().size(); iii++) {
|
||||||
|
final String tmpppp = context.getCmd().get(iii);
|
||||||
|
if (tmpppp == "-h" || tmpppp == "--help") {
|
||||||
|
LOGGER.info(" -h/--help display this help");
|
||||||
|
System.exit(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//! [ewol_sample_HW_main_parse_arguments]
|
||||||
|
//! [ewol_sample_HW_main_set_windows_size]
|
||||||
|
// TODO : Remove this: Move if in the windows properties
|
||||||
|
context.setSize(new Vector2f(800, 600));
|
||||||
|
//! [ewol_sample_HW_main_set_windows_size]
|
||||||
|
//! [ewol_sample_HW_main_set_font_property]
|
||||||
|
// select font preference of der with a basic application size
|
||||||
|
Configs.getConfigFonts().set("FreeSherif", 12);
|
||||||
|
//! [ewol_sample_HW_main_set_font_property]
|
||||||
|
//! [ewol_sample_HW_main_set_windows]
|
||||||
|
// Create the windows
|
||||||
|
final MainWindows basicWindows = new MainWindows();
|
||||||
|
// configure the ewol context to use the new windows
|
||||||
|
context.setWindows(basicWindows);
|
||||||
|
//! [ewol_sample_HW_main_set_windows]
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(final EwolContext context) {
|
||||||
|
LOGGER.info("Application onCreate: [BEGIN]");
|
||||||
|
localCreate(context);
|
||||||
|
LOGGER.info("Application onCreate: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy(final EwolContext context) {
|
||||||
|
LOGGER.info("Application onDestroy: [BEGIN]");
|
||||||
|
|
||||||
|
LOGGER.info("Application onDestroy: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause(final EwolContext context) {
|
||||||
|
LOGGER.info("Application onPause: [BEGIN]");
|
||||||
|
|
||||||
|
LOGGER.info("Application onPause: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(final EwolContext context) {
|
||||||
|
LOGGER.info("Application onResume: [BEGIN]");
|
||||||
|
|
||||||
|
LOGGER.info("Application onResume: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart(final EwolContext context) {
|
||||||
|
LOGGER.info("Application onStart: [BEGIN]");
|
||||||
|
|
||||||
|
LOGGER.info("Application onStart: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop(final EwolContext context) {
|
||||||
|
LOGGER.info("Application onStop: [BEGIN]");
|
||||||
|
|
||||||
|
LOGGER.info("Application onStop: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package sample.atriasoft.ewol.simpleWindowsWithBox;
|
||||||
|
|
||||||
|
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.Vector3b;
|
||||||
|
import org.atriasoft.ewol.widget.Box;
|
||||||
|
|
||||||
|
import sample.atriasoft.ewol.BasicWindows;
|
||||||
|
|
||||||
|
public class MainWindows extends BasicWindows {
|
||||||
|
|
||||||
|
Box testWidget;
|
||||||
|
|
||||||
|
public MainWindows() {
|
||||||
|
//! [ewol_sample_HW_windows_title]
|
||||||
|
setPropertyTitle("Simple CheckBox");
|
||||||
|
|
||||||
|
final Box innerWidget = new Box();
|
||||||
|
//this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
|
||||||
|
innerWidget.setPropertyExpand(Vector3b.FALSE);
|
||||||
|
innerWidget.setPropertyFill(Vector3b.TRUE);
|
||||||
|
innerWidget.setPropertyColor(Color.PINK);
|
||||||
|
|
||||||
|
this.testWidget = new Box(innerWidget);
|
||||||
|
//this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
|
||||||
|
this.testWidget.setPropertyExpand(Vector3b.TRUE);
|
||||||
|
this.testWidget.setPropertyFill(Vector3b.TRUE);
|
||||||
|
this.testWidget.setPropertyBorderWidth(new Dimension1f(10));
|
||||||
|
this.testWidget.setPropertyBorderRadius(new Dimension1f(25));
|
||||||
|
this.testWidget.setPropertyBorderColor(Color.BLACK);
|
||||||
|
this.testWidget.setPropertyColor(Color.GREEN_YELLOW);
|
||||||
|
this.testWidget.setPropertyPadding(new Dimension2f(new Vector2f(15, 15)));
|
||||||
|
this.testWidget.setPropertyMargin(new Dimension2f(new Vector2f(25, 25)));
|
||||||
|
setTestWidget(this.testWidget);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package sample.atriasoft.ewol.simpleWindowsWithBox;
|
||||||
|
|
||||||
|
import org.atriasoft.etk.Uri;
|
||||||
|
import org.atriasoft.ewol.Ewol;
|
||||||
|
|
||||||
|
public class SimpleWindowsWithBoxMain {
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
Ewol.init();
|
||||||
|
//Uri.addLibrary("test-data", SimpleWindowsWithImageMain.class, "test-ewol/");
|
||||||
|
Uri.setApplication(SimpleWindowsWithBoxMain.class, "test-ewol/");
|
||||||
|
Ewol.run(new Appl(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SimpleWindowsWithBoxMain() {}
|
||||||
|
}
|
@ -3,13 +3,13 @@ package sample.atriasoft.ewol.simpleWindowsWithCheckBox;
|
|||||||
import org.atriasoft.etk.Uri;
|
import org.atriasoft.etk.Uri;
|
||||||
import org.atriasoft.ewol.Ewol;
|
import org.atriasoft.ewol.Ewol;
|
||||||
|
|
||||||
public class SimpleWindowsWithCheckBoxMain {
|
public class Main {
|
||||||
public static void main(final String[] args) {
|
public static void main(final String[] args) {
|
||||||
Ewol.init();
|
Ewol.init();
|
||||||
//Uri.addLibrary("test-data", SimpleWindowsWithImageMain.class, "test-ewol/");
|
//Uri.addLibrary("test-data", SimpleWindowsWithImageMain.class, "test-ewol/");
|
||||||
Uri.setApplication(SimpleWindowsWithCheckBoxMain.class, "test-ewol/");
|
Uri.setApplication(Main.class, "test-ewol/");
|
||||||
Ewol.run(new Appl(), args);
|
Ewol.run(new Appl(), args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SimpleWindowsWithCheckBoxMain() {}
|
private Main() {}
|
||||||
}
|
}
|
@ -6,18 +6,18 @@ import org.atriasoft.ewol.widget.CheckBox;
|
|||||||
import sample.atriasoft.ewol.BasicWindows;
|
import sample.atriasoft.ewol.BasicWindows;
|
||||||
|
|
||||||
public class MainWindows extends BasicWindows {
|
public class MainWindows extends BasicWindows {
|
||||||
|
|
||||||
CheckBox testWidget;
|
CheckBox testWidget;
|
||||||
|
|
||||||
public MainWindows() {
|
public MainWindows() {
|
||||||
//! [ewol_sample_HW_windows_title]
|
//! [ewol_sample_HW_windows_title]
|
||||||
setPropertyTitle("Simple CheckBox");
|
setPropertyTitle("Simple CheckBox");
|
||||||
|
|
||||||
this.testWidget = new CheckBox("<b>Hello, how Are</b> You?<br/>second-life?");
|
this.testWidget = new CheckBox("<b>Hello, how Are</b> You?<br/>second-life?");
|
||||||
//this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
|
//this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
|
||||||
this.testWidget.setPropertyExpand(Vector3b.TRUE);
|
this.testWidget.setPropertyExpand(Vector3b.TRUE);
|
||||||
this.testWidget.setPropertyFill(Vector3b.TRUE);
|
this.testWidget.setPropertyFill(Vector3b.TRUE);
|
||||||
this.setTestWidget(this.testWidget);
|
setTestWidget(this.testWidget);
|
||||||
/*
|
/*
|
||||||
Button simpleButton = new Button();
|
Button simpleButton = new Button();
|
||||||
simpleButton.setPropertyValue("Top Button");
|
simpleButton.setPropertyValue("Top Button");
|
||||||
|
@ -34,25 +34,27 @@ public class CompositingSVG extends Compositing {
|
|||||||
private float angle = 0; //!< Angle to set at the axes
|
private float angle = 0; //!< Angle to set at the axes
|
||||||
private Color color = new Color(1, 1, 1); //!< The text foreground color
|
private Color color = new Color(1, 1, 1); //!< The text foreground color
|
||||||
private String svgData;
|
private String svgData;
|
||||||
|
private EsvgDocument svgDoc;
|
||||||
protected int oGLMatrixProjection = -1; //!< openGL id on the element (Projection matrix)
|
protected int oGLMatrixProjection = -1; //!< openGL id on the element (Projection matrix)
|
||||||
protected int oGLMatrixTransformation = -1; //!< openGL id on the element (transformation matrix)
|
protected int oGLMatrixTransformation = -1; //!< openGL id on the element (transformation matrix)
|
||||||
protected int oGLMatrixView = -1; //!< openGL id on the element (view matrix)
|
protected int oGLMatrixView = -1; //!< openGL id on the element (view matrix)
|
||||||
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;
|
private ResourceTexture2 resource = null; //!< texture resources
|
||||||
private ResourceTexture2 resourceImage = 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("<svg></svg>", CompositingSVG.SIZE_AUTO);
|
this("""
|
||||||
|
<svg width="10" height="10"></svg>
|
||||||
|
""", 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:
|
||||||
@ -63,10 +65,10 @@ public class CompositingSVG extends Compositing {
|
|||||||
}
|
}
|
||||||
// TO facilitate some debugs we add a name of the VBO:
|
// TO facilitate some debugs we add a name of the VBO:
|
||||||
this.vbo.setName("[VBO] of " + this.getClass().getCanonicalName());
|
this.vbo.setName("[VBO] of " + this.getClass().getCanonicalName());
|
||||||
setSource(data, 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
|
||||||
*/
|
*/
|
||||||
@ -81,7 +83,7 @@ public class CompositingSVG extends Compositing {
|
|||||||
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
|
||||||
@ -94,7 +96,7 @@ public class CompositingSVG extends Compositing {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if (this.resourceImage == null) {
|
if (this.resource == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this.oGLprogram == null) {
|
if (this.oGLprogram == null) {
|
||||||
@ -116,12 +118,12 @@ public class CompositingSVG extends Compositing {
|
|||||||
this.oGLprogram.uniformMatrix(this.oGLMatrixTransformation, this.matrixApply);
|
this.oGLprogram.uniformMatrix(this.oGLMatrixTransformation, this.matrixApply);
|
||||||
this.oGLprogram.uniformMatrix(this.oGLMatrixView, camMatrix);
|
this.oGLprogram.uniformMatrix(this.oGLMatrixView, camMatrix);
|
||||||
// TextureID
|
// TextureID
|
||||||
this.resourceImage.bindForRendering(0);
|
this.resource.bindForRendering(0);
|
||||||
this.vbo.renderArrays(RenderMode.TRIANGLE);
|
this.vbo.renderArrays(RenderMode.TRIANGLE);
|
||||||
this.vbo.unBindForRendering();
|
this.vbo.unBindForRendering();
|
||||||
this.oGLprogram.unUse();
|
this.oGLprogram.unUse();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void flush() {
|
public void flush() {
|
||||||
this.vbo.setPosition(this.vboDataCoords);
|
this.vbo.setPosition(this.vboDataCoords);
|
||||||
@ -130,7 +132,7 @@ public class CompositingSVG extends Compositing {
|
|||||||
this.vbo.setVertexCount(this.vboDataCoords.length);
|
this.vbo.setVertexCount(this.vboDataCoords.length);
|
||||||
this.vbo.flush();
|
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.
|
||||||
@ -138,18 +140,18 @@ public class CompositingSVG extends Compositing {
|
|||||||
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
|
||||||
*/
|
*/
|
||||||
public Vector2i getRealSize() {
|
public Vector2i getRealSize() {
|
||||||
if (this.resourceImage == null) {
|
if (this.resource == null) {
|
||||||
return Vector2i.ZERO;
|
return Vector2i.ZERO;
|
||||||
}
|
}
|
||||||
return this.resourceImage.getUsableSize();
|
return this.resource.getUsableSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
|
* Sometimes the user declare an image but not allocate the ressources all the time, this is to know it ..
|
||||||
* @return the validity od the resources.
|
* @return the validity od the resources.
|
||||||
@ -157,7 +159,7 @@ public class CompositingSVG extends Compositing {
|
|||||||
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
|
||||||
*/
|
*/
|
||||||
@ -171,11 +173,11 @@ public class CompositingSVG extends Compositing {
|
|||||||
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
|
||||||
@ -183,7 +185,7 @@ public class CompositingSVG extends Compositing {
|
|||||||
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
|
||||||
@ -201,73 +203,73 @@ public class CompositingSVG extends Compositing {
|
|||||||
final Vector2f sourcePosStop = sourcePosStopIn.multiply(ratio);
|
final Vector2f sourcePosStop = sourcePosStopIn.multiply(ratio);
|
||||||
LOGGER.trace(" openGLSize=" + openGLSize + " usableSize=" + usefullSize + " start=" + sourcePosStart
|
LOGGER.trace(" openGLSize=" + openGLSize + " usableSize=" + usefullSize + " start=" + sourcePosStart
|
||||||
+ " stop=" + sourcePosStop);
|
+ " stop=" + sourcePosStop);
|
||||||
|
|
||||||
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);
|
||||||
@ -275,7 +277,7 @@ public class CompositingSVG extends Compositing {
|
|||||||
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);
|
||||||
@ -283,12 +285,12 @@ public class CompositingSVG extends Compositing {
|
|||||||
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);
|
||||||
@ -296,16 +298,16 @@ public class CompositingSVG extends Compositing {
|
|||||||
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.
|
||||||
@ -313,7 +315,7 @@ public class CompositingSVG extends Compositing {
|
|||||||
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)
|
||||||
@ -321,11 +323,11 @@ public class CompositingSVG extends Compositing {
|
|||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set position for the next text writen
|
* set position for the next text writen
|
||||||
* @param pos Position of the text (in 3D)
|
* @param pos Position of the text (in 3D)
|
||||||
@ -333,11 +335,11 @@ public class CompositingSVG extends Compositing {
|
|||||||
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 writen
|
* set relative position for the next text writen
|
||||||
* @param pos ofset apply of the text (in 3D)
|
* @param pos ofset apply of the text (in 3D)
|
||||||
@ -345,26 +347,31 @@ public class CompositingSVG extends Compositing {
|
|||||||
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;
|
||||||
this.requestSize = image.getSize();
|
this.requestSize = image.getSize();
|
||||||
this.resourceImage = new ResourceTexture2();
|
this.resource = new ResourceTexture2();
|
||||||
this.resourceImage.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));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSource(final String data, final Vector2i size) {
|
public void setSource(final String data, final Vector2i size) {
|
||||||
|
if (this.svgDoc == null && this.svgData.equals(data) && this.requestSize.x() == size.x()
|
||||||
|
&& this.requestSize.y() == size.y()) {
|
||||||
|
// Nothing to do ...
|
||||||
|
return;
|
||||||
|
}
|
||||||
clear();
|
clear();
|
||||||
|
this.svgDoc = null;
|
||||||
final EsvgDocument doc = new EsvgDocument();
|
final EsvgDocument doc = new EsvgDocument();
|
||||||
doc.parse(data);
|
doc.parse(data);
|
||||||
final ImageByte tmp = ToolImage.convertImageByte(doc.renderImageFloatRGBA(size));
|
final ImageByte tmp = ToolImage.convertImageByte(doc.renderImageFloatRGBA(size));
|
||||||
@ -372,26 +379,33 @@ public class CompositingSVG extends Compositing {
|
|||||||
LOGGER.error("Can not load the Raw SVG ... ");
|
LOGGER.error("Can not load the Raw SVG ... ");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.resourceImage.set(tmp);
|
if (this.resource == null) {
|
||||||
|
this.resource = new ResourceTexture2();
|
||||||
if (this.svgData.equals(data) && this.requestSize.x() == size.x() && this.requestSize.y() == size.y()) {
|
}
|
||||||
|
this.resource.set(tmp);
|
||||||
|
this.svgData = data;
|
||||||
|
this.requestSize = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSource(final EsvgDocument data, final Vector2i size) {
|
||||||
|
if (this.svgData == null && this.svgDoc.equals(data) && this.requestSize.x() == size.x()
|
||||||
|
&& this.requestSize.y() == size.y()) {
|
||||||
// Nothing to do ...
|
// Nothing to do ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final ResourceTexture2 resource = this.resource;
|
this.svgData = null;
|
||||||
final ResourceTexture2 resourceTex = this.resourceImage;
|
clear();
|
||||||
this.svgData = data;
|
final ImageByte tmp = ToolImage.convertImageByte(data.renderImageFloatRGBA(size));
|
||||||
this.requestSize = size;
|
if (tmp == null) {
|
||||||
this.resource = null;
|
LOGGER.error("Can not load the Raw SVG ... ");
|
||||||
this.resourceImage = null;
|
return;
|
||||||
|
|
||||||
final Vector2i tmpSize = new Vector2i(size.x(), size.y());
|
|
||||||
|
|
||||||
// link to new one
|
|
||||||
this.resource = ResourceTexture2.create();
|
|
||||||
if (this.resource == null) {
|
|
||||||
LOGGER.error("Can not get Image resource");
|
|
||||||
}
|
}
|
||||||
|
if (this.resource == null) {
|
||||||
|
this.resource = new ResourceTexture2();
|
||||||
|
}
|
||||||
|
this.resource.set(tmp);
|
||||||
|
this.svgDoc = data;
|
||||||
|
this.requestSize = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
320
src/main/org/atriasoft/ewol/widget/Box.java
Normal file
320
src/main/org/atriasoft/ewol/widget/Box.java
Normal file
@ -0,0 +1,320 @@
|
|||||||
|
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.etk.math.Vector3b;
|
||||||
|
import org.atriasoft.etk.math.Vector3f;
|
||||||
|
import org.atriasoft.ewol.compositing.CompositingSVG;
|
||||||
|
import org.atriasoft.ewol.event.EventTime;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup ewolWidgetGroup
|
||||||
|
* Entry box display :
|
||||||
|
*
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
* -------------
|
||||||
|
* | Content |
|
||||||
|
* -------------
|
||||||
|
* ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
*/
|
||||||
|
public class Box extends Container {
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(Box.class);
|
||||||
|
protected CompositingSVG compositing = new CompositingSVG();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Periodic call to update grapgic display
|
||||||
|
* @param event Time generic event
|
||||||
|
*/
|
||||||
|
protected static void periodicCall(final Box self, final EventTime event) {
|
||||||
|
LOGGER.trace("Periodic call on Entry(" + event + ")");
|
||||||
|
self.markToRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
//private Uri propertyConfig = new Uri("THEME", "shape/Button.json", "ewol");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public Box() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor with his subWidget
|
||||||
|
*/
|
||||||
|
public Box(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 onChangeSize() {
|
||||||
|
super.onChangeSize();
|
||||||
|
if (this.propertyHide) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this.subWidget == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Vector3f origin = this.origin.add(this.offset);
|
||||||
|
final Vector3f minSize = this.subWidget.getCalculateMinSize();
|
||||||
|
final Vector3b expand = this.subWidget.getPropertyExpand();
|
||||||
|
origin = origin.add(this.propertyGravity.gravityGenerateDelta(minSize.less(this.size)));
|
||||||
|
|
||||||
|
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);
|
||||||
|
this.subWidget.setOrigin(origin.add(offsetSubWidget.x(), offsetSubWidget.y(), 0.0f));
|
||||||
|
this.subWidget.setSize(this.size.less(offsetSubWidget.x() * 2, offsetSubWidget.y() * 2, 0.0f));
|
||||||
|
this.subWidget.onChangeSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void calculateMinMaxSize() {
|
||||||
|
super.calculateMinMaxSize();
|
||||||
|
final Vector2f parentMinSize = new Vector2f(this.minSize.x(), this.minSize.y());
|
||||||
|
final Vector2f parentMaxSize = new Vector2f(this.maxSize.x(), this.maxSize.y());
|
||||||
|
|
||||||
|
LOGGER.debug("calculate min size: border=" + this.propertyBorderWidth + " min-size=" + this.propertyMinSize);
|
||||||
|
final Vector2f borderSize = new Vector2f(this.propertyBorderWidth.size() * 2.0f,
|
||||||
|
this.propertyBorderWidth.size() * 2.0f);
|
||||||
|
final Vector2f padding = this.propertyPadding.size();
|
||||||
|
final Vector2f margin = this.propertyMargin.size();
|
||||||
|
final Vector3f minSize = this.propertyMinSize.size();
|
||||||
|
final Vector2f borderMinSize = parentMinSize.add(margin).add(padding).add(borderSize);
|
||||||
|
|
||||||
|
final Vector2f calculatedBoxMinSize = Vector2f.max(borderMinSize, new Vector2f(minSize.x(), minSize.y()));
|
||||||
|
|
||||||
|
this.minSize = new Vector3f(calculatedBoxMinSize.x(), calculatedBoxMinSize.y(), 0);
|
||||||
|
this.maxSize = Vector3f.max(this.minSize, this.propertyMaxSize.size());
|
||||||
|
LOGGER.debug("set widget min=" + this.minSize + " max=" + this.maxSize);
|
||||||
|
markToRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDraw() {
|
||||||
|
if (this.compositing != null) {
|
||||||
|
this.compositing.draw(true);
|
||||||
|
}
|
||||||
|
super.onDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onRegenerateDisplay() {
|
||||||
|
super.onRegenerateDisplay();
|
||||||
|
if (!needRedraw()) {
|
||||||
|
//return;
|
||||||
|
}
|
||||||
|
// remove data of the previous composition :
|
||||||
|
this.compositing.clear();
|
||||||
|
final int borderSize = (int) this.propertyBorderWidth.size();
|
||||||
|
final int paddingCompensateBorder = Math.round(borderSize * 0.5f);
|
||||||
|
|
||||||
|
final Vector2i renderSize = new Vector2i((int) (this.size.x() - this.propertyMargin.size().x() * 2),
|
||||||
|
(int) (this.size.y() - this.propertyMargin.size().y() * 2));
|
||||||
|
final long startTime = System.nanoTime();
|
||||||
|
/*
|
||||||
|
final EsvgDocument doc = new EsvgDocument();
|
||||||
|
doc.addElement();
|
||||||
|
final Rectangle rect = new Rectangle(//
|
||||||
|
new Vector2f(paddingCompensateBorder, paddingCompensateBorder), //
|
||||||
|
new Vector2f(paddingCompensateBorder, paddingCompensateBorder), //
|
||||||
|
|
||||||
|
)
|
||||||
|
==> render is OK
|
||||||
|
this.compositing.setSource("""
|
||||||
|
<svg>
|
||||||
|
<rect
|
||||||
|
x="%d"
|
||||||
|
y="%d"
|
||||||
|
width="%dpx"
|
||||||
|
height="%dpx"
|
||||||
|
rx="%dpx"
|
||||||
|
ry="%dpx"
|
||||||
|
fill="white"
|
||||||
|
stroke="black"
|
||||||
|
stroke-width="%dpx"
|
||||||
|
/>
|
||||||
|
</svg>""".formatted( //
|
||||||
|
paddingCompensateBorder, paddingCompensateBorder, //
|
||||||
|
renderSize.x() - 2 * paddingCompensateBorder, renderSize.y() - 2 * paddingCompensateBorder, //
|
||||||
|
(int) this.propertyBorderRadius.size(), //
|
||||||
|
200, //
|
||||||
|
//this.propertyColor.toStringSharp(), //
|
||||||
|
//this.propertyBorderColor.toStringSharp(), //
|
||||||
|
borderSize //
|
||||||
|
), //
|
||||||
|
renderSize);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Bug intéressant: la parsing de la couleur est foireux, black et #000000FF ne rend pas la même chose ==> pour ètre plus précs le rendu avec alpha est foireux...
|
||||||
|
this.compositing.setSource("""
|
||||||
|
<svg>
|
||||||
|
<rect
|
||||||
|
x="%d"
|
||||||
|
y="%d"
|
||||||
|
width="%d"
|
||||||
|
height="%d"
|
||||||
|
rx="%d"
|
||||||
|
ry="%d"
|
||||||
|
fill="%s"
|
||||||
|
stroke="%s"
|
||||||
|
stroke-width="%d"
|
||||||
|
/>
|
||||||
|
</svg>""".formatted( //
|
||||||
|
paddingCompensateBorder, paddingCompensateBorder, //
|
||||||
|
renderSize.x() - 2 * paddingCompensateBorder, renderSize.y() - 2 * paddingCompensateBorder, //
|
||||||
|
(int) this.propertyBorderRadius.size(), //
|
||||||
|
(int) this.propertyBorderRadius.size(), //
|
||||||
|
this.propertyColor.toStringSharp(), //
|
||||||
|
this.propertyBorderColor.toStringSharp(), //
|
||||||
|
borderSize //
|
||||||
|
), //
|
||||||
|
renderSize);
|
||||||
|
final Vector2f imageRenderSize = new Vector2f(100, 100);
|
||||||
|
final long endTime = System.nanoTime();
|
||||||
|
|
||||||
|
// ca ca ne devrait pas ètre la ...
|
||||||
|
Vector3f delta = this.propertyGravity
|
||||||
|
.gravityGenerateDelta(this.size.less(imageRenderSize.x(), imageRenderSize.y(), 0));
|
||||||
|
//LOGGER.debug("delta : " + delta);
|
||||||
|
if (this.propertyFill.x()) {
|
||||||
|
//imageRealSize = imageRealSize.withX(imageRealSizeMax.x());
|
||||||
|
delta = delta.withX(0.0f);
|
||||||
|
}
|
||||||
|
if (this.propertyFill.y()) {
|
||||||
|
//imageRealSize = imageRealSize.withY(imageRealSizeMax.y());
|
||||||
|
delta = delta.withY(0.0f);
|
||||||
|
}
|
||||||
|
//this.origin = this.origin.add(delta);
|
||||||
|
//this.origin = Vector3f.ZERO;
|
||||||
|
this.compositing.setPos(this.propertyMargin.size());
|
||||||
|
this.compositing.print(renderSize);
|
||||||
|
//LOGGER.debug("generate image in : " + (endTime - startTime));
|
||||||
|
// LOGGER.debug("propertyBorderColor=" + this.propertyBorderColor.toStringSharp());
|
||||||
|
// LOGGER.debug("Paint Image at : " + this.origin + " size=" + this.size);
|
||||||
|
// LOGGER.debug("minSize: " + this.minSize + " size=" + this.size);
|
||||||
|
this.compositing.flush();
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,13 @@ public class Container extends Widget {
|
|||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
public Container() {}
|
public Container() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor with his child
|
||||||
|
*/
|
||||||
|
public Container(final Widget subWidget) {
|
||||||
|
this.subWidget = subWidget;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void calculateMinMaxSize() {
|
public void calculateMinMaxSize() {
|
||||||
@ -249,7 +256,7 @@ public class Container extends Widget {
|
|||||||
//LOGGER.info("Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" + this.size);
|
//LOGGER.info("Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" + this.size);
|
||||||
this.subWidget.systemDraw(prop);
|
this.subWidget.systemDraw(prop);
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("[" + getId() + "] ++++++ : [null]");
|
LOGGER.trace("[" + getId() + "] ++++++ : [null]");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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 Vector3f tmpMax = this.propertyMaxSize.getPixel();
|
final Vector3f tmpMax = this.propertyMaxSize.getPixel();
|
||||||
@ -76,30 +76,30 @@ public class LabelOnSVG extends Widget {
|
|||||||
}
|
}
|
||||||
final Vector3f minSize = this.text.calculateSizeDecorated(this.value);
|
final Vector3f minSize = this.text.calculateSizeDecorated(this.value);
|
||||||
LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize);
|
LOGGER.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize);
|
||||||
|
|
||||||
this.minSize = new Vector3f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()),
|
this.minSize = new Vector3f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()),
|
||||||
FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()), FMath.avg(tmpMin.z(), 4 + minSize.z(), tmpMax.z()));
|
FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()), FMath.avg(tmpMin.z(), 4 + minSize.z(), tmpMax.z()));
|
||||||
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 Vector3f tmpMax = this.propertyMaxSize.getPixel();
|
final Vector3f tmpMax = this.propertyMaxSize.getPixel();
|
||||||
// to know the size of one line :
|
// to know the size of one line :
|
||||||
final Vector3f minSize = this.text.calculateSize('A');
|
final Vector3f 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 Vector3f currentTextSize = this.text.calculateSizeDecorated(this.value);
|
final Vector3f 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 :
|
||||||
Vector3f tmpTextOrigin = new Vector3f((this.size.x() - this.minSize.x()) / 2.0f,
|
Vector3f tmpTextOrigin = new Vector3f((this.size.x() - this.minSize.x()) / 2.0f,
|
||||||
(this.size.y() - this.minSize.y()) / 2.0f, 0);
|
(this.size.y() - this.minSize.y()) / 2.0f, 0);
|
||||||
|
|
||||||
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, 0);
|
tmpTextOrigin = tmpTextOrigin.add(paddingSize, paddingSize, 0);
|
||||||
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 Vector3f textPos = new Vector3f(tmpTextOrigin.x(), tmpTextOrigin.y(), 0);
|
final Vector3f textPos = new Vector3f(tmpTextOrigin.x(), tmpTextOrigin.y(), 0);
|
||||||
|
|
||||||
final Vector3f drawClippingPos = new Vector3f(paddingSize, paddingSize, -0.5f);
|
final Vector3f drawClippingPos = new Vector3f(paddingSize, paddingSize, -0.5f);
|
||||||
final Vector3f drawClippingSize = new Vector3f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1);
|
final Vector3f drawClippingSize = new Vector3f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1);
|
||||||
|
|
||||||
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -56,26 +56,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 Vector3f maxSize = Vector3f.MAX_VALUE; //!< internal: maximum size of the widget
|
protected Vector3f maxSize = Vector3f.MAX_VALUE; //!< internal: maximum size of the widget
|
||||||
|
|
||||||
protected Vector3f minSize = Vector3f.ZERO; //!< internal: minimum size of the widget
|
protected Vector3f minSize = Vector3f.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...
|
||||||
@ -91,28 +91,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 Dimension3f propertyMaxSize = new Dimension3f(Vector3f.MAX_VALUE, Distance.PIXEL); //!< user define the maximum size of the widget
|
protected Dimension3f propertyMaxSize = new Dimension3f(Vector3f.MAX_VALUE, Distance.PIXEL); //!< user define the maximum size of the widget
|
||||||
protected Dimension3f propertyMinSize = new Dimension3f(Vector3f.ZERO, Distance.PIXEL); //!< user define the minimum size of the widget
|
protected Dimension3f propertyMinSize = new Dimension3f(Vector3f.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 Vector3f size = Vector3f.VALUE_16; //!< internal: current size of the widget
|
protected Vector3f size = Vector3f.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
|
||||||
@ -120,16 +120,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
|
||||||
@ -141,7 +141,7 @@ public class Widget extends EwolObject {
|
|||||||
}
|
}
|
||||||
return Vector3b.FALSE;
|
return Vector3b.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)
|
||||||
@ -153,7 +153,7 @@ public class Widget extends EwolObject {
|
|||||||
}
|
}
|
||||||
return Vector3b.FALSE;
|
return Vector3b.FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the filling capabilities xy
|
* get the filling capabilities xy
|
||||||
* @return Vector3b repensent the capacity to xy filling
|
* @return Vector3b repensent the capacity to xy filling
|
||||||
@ -162,15 +162,15 @@ public class Widget extends EwolObject {
|
|||||||
public Vector3b canFill() {
|
public Vector3b 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.
|
||||||
@ -180,7 +180,7 @@ public class Widget extends EwolObject {
|
|||||||
final Vector3f pixelSize = this.propertyMaxSize.getPixel();
|
final Vector3f pixelSize = this.propertyMaxSize.getPixel();
|
||||||
this.maxSize = Vector3f.min(this.maxSize, pixelSize);
|
this.maxSize = Vector3f.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.
|
||||||
@ -190,7 +190,7 @@ public class Widget extends EwolObject {
|
|||||||
final Vector3f pixelSize = this.propertyMinSize.getPixel();
|
final Vector3f pixelSize = this.propertyMinSize.getPixel();
|
||||||
this.minSize = Vector3f.max(this.minSize, pixelSize);
|
this.minSize = Vector3f.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) {
|
||||||
@ -200,7 +200,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
|
||||||
@ -212,7 +212,7 @@ public class Widget extends EwolObject {
|
|||||||
}
|
}
|
||||||
return Vector3f.MAX_VALUE;
|
return Vector3f.MAX_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the widget minimum size calculated
|
* get the widget minimum size calculated
|
||||||
* @return Requested size
|
* @return Requested size
|
||||||
@ -224,7 +224,7 @@ public class Widget extends EwolObject {
|
|||||||
}
|
}
|
||||||
return Vector3f.ZERO;
|
return Vector3f.ZERO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the current cursor.
|
* get the current cursor.
|
||||||
* @return the type of the cursor.
|
* @return the type of the cursor.
|
||||||
@ -232,7 +232,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
|
||||||
@ -240,7 +240,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.
|
||||||
@ -249,7 +249,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]
|
||||||
@ -257,7 +257,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.
|
||||||
@ -265,7 +265,7 @@ public class Widget extends EwolObject {
|
|||||||
Vector3f getOffset() {
|
Vector3f 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.
|
||||||
@ -273,7 +273,7 @@ public class Widget extends EwolObject {
|
|||||||
public Vector3f getOrigin() {
|
public Vector3f getOrigin() {
|
||||||
return this.origin;
|
return this.origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AknotManaged
|
@AknotManaged
|
||||||
@AknotAttribute
|
@AknotAttribute
|
||||||
@AknotName("focus")
|
@AknotName("focus")
|
||||||
@ -281,7 +281,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")
|
||||||
@ -289,7 +289,7 @@ public class Widget extends EwolObject {
|
|||||||
public Vector3b getPropertyExpand() {
|
public Vector3b getPropertyExpand() {
|
||||||
return this.propertyExpand;
|
return this.propertyExpand;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AknotManaged
|
@AknotManaged
|
||||||
@AknotAttribute
|
@AknotAttribute
|
||||||
@AknotName("expand-free")
|
@AknotName("expand-free")
|
||||||
@ -297,7 +297,7 @@ public class Widget extends EwolObject {
|
|||||||
public Vector3b getPropertyExpandIfFree() {
|
public Vector3b getPropertyExpandIfFree() {
|
||||||
return this.propertyExpandIfFree;
|
return this.propertyExpandIfFree;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AknotManaged
|
@AknotManaged
|
||||||
@AknotAttribute
|
@AknotAttribute
|
||||||
@AknotName("fill")
|
@AknotName("fill")
|
||||||
@ -305,7 +305,7 @@ public class Widget extends EwolObject {
|
|||||||
public Vector3b getPropertyFill() {
|
public Vector3b getPropertyFill() {
|
||||||
return this.propertyFill;
|
return this.propertyFill;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AknotManaged
|
@AknotManaged
|
||||||
@AknotAttribute
|
@AknotAttribute
|
||||||
@AknotName("gravity")
|
@AknotName("gravity")
|
||||||
@ -313,7 +313,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")
|
||||||
@ -321,7 +321,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")
|
||||||
@ -329,7 +329,7 @@ public class Widget extends EwolObject {
|
|||||||
public Dimension3f getPropertyMaxSize() {
|
public Dimension3f getPropertyMaxSize() {
|
||||||
return this.propertyMaxSize;
|
return this.propertyMaxSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@AknotManaged
|
@AknotManaged
|
||||||
@AknotAttribute
|
@AknotAttribute
|
||||||
@AknotName("min-size")
|
@AknotName("min-size")
|
||||||
@ -337,7 +337,7 @@ public class Widget extends EwolObject {
|
|||||||
public Dimension3f getPropertyMinSize() {
|
public Dimension3f getPropertyMinSize() {
|
||||||
return this.propertyMinSize;
|
return this.propertyMinSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the widget size
|
* get the widget size
|
||||||
* @return Requested size
|
* @return Requested size
|
||||||
@ -349,7 +349,7 @@ public class Widget extends EwolObject {
|
|||||||
}
|
}
|
||||||
return Vector3f.ZERO;
|
return Vector3f.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
|
||||||
@ -363,21 +363,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
|
||||||
@ -385,7 +385,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.
|
||||||
@ -397,14 +397,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
|
||||||
@ -412,14 +412,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.
|
||||||
*/
|
*/
|
||||||
@ -430,7 +430,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
|
||||||
@ -441,7 +441,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
|
||||||
@ -450,19 +450,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 :
|
||||||
@ -476,7 +476,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
|
||||||
@ -486,7 +486,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.
|
||||||
@ -540,19 +540,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 Vector3f pixelMin = this.propertyMinSize.getPixel();
|
final Vector3f pixelMin = this.propertyMinSize.getPixel();
|
||||||
final Vector3f pixelMax = this.propertyMaxSize.getPixel();
|
final Vector3f pixelMax = this.propertyMaxSize.getPixel();
|
||||||
@ -563,7 +563,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.
|
||||||
@ -572,14 +572,14 @@ public class Widget extends EwolObject {
|
|||||||
public Vector3f relativePosition(final Vector3f pos) {
|
public Vector3f relativePosition(final Vector3f 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)
|
||||||
@ -594,7 +594,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.
|
||||||
@ -604,7 +604,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
|
||||||
@ -623,7 +623,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).
|
||||||
@ -631,7 +631,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]
|
||||||
@ -639,21 +639,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 Dimension3f(Vector3f.MAX_VALUE, Distance.PIXEL));
|
setPropertyMaxSize(new Dimension3f(Vector3f.MAX_VALUE, Distance.PIXEL));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User set No minimum size.
|
* User set No minimum size.
|
||||||
*/
|
*/
|
||||||
public void setNoMinSize() {
|
public void setNoMinSize() {
|
||||||
setPropertyMinSize(new Dimension3f(Vector3f.ZERO, Distance.PIXEL));
|
setPropertyMinSize(new Dimension3f(Vector3f.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.
|
||||||
@ -665,7 +665,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.
|
||||||
@ -675,7 +675,7 @@ public class Widget extends EwolObject {
|
|||||||
public void setOrigin(final Vector3f pos) {
|
public void setOrigin(final Vector3f 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;
|
||||||
@ -688,7 +688,7 @@ public class Widget extends EwolObject {
|
|||||||
rmFocus();
|
rmFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPropertyExpand(final Vector3b value) {
|
public void setPropertyExpand(final Vector3b value) {
|
||||||
if (this.propertyExpand.equals(value)) {
|
if (this.propertyExpand.equals(value)) {
|
||||||
return;
|
return;
|
||||||
@ -697,7 +697,7 @@ public class Widget extends EwolObject {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPropertyExpandIfFree(final Vector3b value) {
|
public void setPropertyExpandIfFree(final Vector3b value) {
|
||||||
if (this.propertyExpandIfFree.equals(value)) {
|
if (this.propertyExpandIfFree.equals(value)) {
|
||||||
return;
|
return;
|
||||||
@ -706,7 +706,7 @@ public class Widget extends EwolObject {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPropertyFill(final Vector3b value) {
|
public void setPropertyFill(final Vector3b value) {
|
||||||
if (this.propertyFill.equals(value)) {
|
if (this.propertyFill.equals(value)) {
|
||||||
return;
|
return;
|
||||||
@ -715,7 +715,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;
|
||||||
@ -724,7 +724,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;
|
||||||
@ -733,7 +733,7 @@ public class Widget extends EwolObject {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPropertyMaxSize(final Dimension3f value) {
|
public void setPropertyMaxSize(final Dimension3f value) {
|
||||||
if (this.propertyMaxSize.equals(value)) {
|
if (this.propertyMaxSize.equals(value)) {
|
||||||
return;
|
return;
|
||||||
@ -741,7 +741,7 @@ public class Widget extends EwolObject {
|
|||||||
this.propertyMaxSize = value;
|
this.propertyMaxSize = value;
|
||||||
onUpdateMinMaxSize();
|
onUpdateMinMaxSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPropertyMinSize(final Dimension3f value) {
|
public void setPropertyMinSize(final Dimension3f value) {
|
||||||
if (this.propertyMinSize.equals(value)) {
|
if (this.propertyMinSize.equals(value)) {
|
||||||
return;
|
return;
|
||||||
@ -749,7 +749,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
|
||||||
@ -757,8 +757,11 @@ public class Widget extends EwolObject {
|
|||||||
*/
|
*/
|
||||||
public void setSize(final Vector3f value) {
|
public void setSize(final Vector3f value) {
|
||||||
this.size = value;
|
this.size = value;
|
||||||
|
if (this.size.x() > 15000) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set the zoom property of the widget
|
* set the zoom property of the widget
|
||||||
* @param newVal newZoom value
|
* @param newVal newZoom value
|
||||||
@ -770,7 +773,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
|
||||||
@ -778,7 +781,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
|
||||||
@ -872,14 +875,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
|
||||||
@ -887,14 +890,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
|
||||||
@ -930,7 +933,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) {
|
||||||
@ -938,13 +941,13 @@ public class Widget extends EwolObject {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final Vector3f displayOrigin = this.origin.add(this.offset);
|
final Vector3f 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;
|
||||||
@ -967,7 +970,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);
|
||||||
@ -981,7 +984,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
|
||||||
@ -996,7 +999,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
|
||||||
@ -1014,7 +1017,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
|
||||||
*/
|
*/
|
||||||
@ -1040,7 +1043,7 @@ public class Widget extends EwolObject {
|
|||||||
}
|
}
|
||||||
onRegenerateDisplay();
|
onRegenerateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Un-Grab the cursor (default mode cursor offset)
|
* Un-Grab the cursor (default mode cursor offset)
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user