This commit is contained in:
Edouard DUPIN 2022-02-21 18:19:28 +01:00
parent 3e233e5bdf
commit f29254547d
34 changed files with 539 additions and 499 deletions

View File

@ -0,0 +1,121 @@
{
"type":"popup",
"child": [
{
"type":"sizer",
"property": {
"mode": "vert",
"lock": true,
"fill": true,
"expand": true
},
"child": [
{
"type":"sizer",
"property": {
"mode": "hori"
},
"child": [
{
"type":"checkbox-text",
"property": {
"name": "[{ID}]file-shooser:show-hiden-file",
"label": "_T{ShowHiddenFiles}"
}
}, {
"type":"spacer",
"property": {
"expand": "true,false"
}
}, {
"type":"button-icon-text",
"property": {
"name": "[{ID}]file-shooser:button-validate",
"icon": "THEME_GUI:///Load.svg?lib:ewol",
"label": "_T{Validate}"
}
}, {
"type":"button-icon-text",
"property": {
"name": "[{ID}]file-shooser:button-cancel",
"icon": "THEME_GUI:///Remove.svg?lib:ewol",
"label": "_T{Cancel}"
}
}
]
}, {
"type":"sizer",
"property": {
"mode": "hori"
},
"child": [
{
"type":"spacer",
"property": {
"expand": "true,false"
}
}, {
"type":"ListFileSystem",
"property": {
"name":"[{ID}]file-shooser:list-folder",
"min-size":"20,0%",
"expand":"false,true",
"show-hidden":false,
"show-file":false,
"show-folder":true,
"show-temporary":false
}
}, {
"type":"spacer",
"property": {
"expand": "true,false"
}
}, {
"type":"ListFileSystem",
"property": {
"name":"[{ID}]file-shooser:list-files",
"min-size":"20,0%",
"expand":"true,true",
"show-hidden":false,
"show-file":true,
"show-folder":false,
"show-temporary":false
}
}, {
"type":"spacer",
"property": {
"expand": "true,false"
}
}
]
}, {
"type":"sizer",
"property": {
"mode": "hori"
},
"child": [
<image name:"[{ID}]file-shooser:img-file" src:"THEME_GUI:///File.svg?lib:ewol" expand:false, size:"8,8mm"]}
<entry name:"[{ID}]file-shooser:entry-file" expand:"true,false" fill:"true,false"]}
]
}, {
"type":"sizer",
"property": {
"mode": "hori"
},
"child": [
<image name:"[{ID}]file-shooser:img-folder" src:"THEME_GUI:///Folder.svg?lib:ewol" expand:false, size:"8,8mm"]}
<entry name:"[{ID}]file-shooser:entry-folder" expand:"true,false" fill:"true,false"]}
<image name:"[{ID}]file-shooser:img-home" src:"THEME_GUI:///Home.svg?lib:ewol" expand:false, size:"8,8mm"]}
]
},
{
"type":"label",
"property": {
"name":"[{ID}]file-shooser:title-label"
},
"data": "_T{Title}"
}
]
}
]
}

View File

@ -0,0 +1,119 @@
{
"widget-type": "popup",
"child": [
{
"widget-type":"sizer",
"mode": "vert",
"lock": true,
"fill": true,
"expand": true,
"child": [
{
"widget-type":"sizer",
"mode": "hori",
"child": [
{
"widget-type":"checkbox-text",
"name": "[{ID}]file-shooser:show-hiden-file",
"label": "_T{ShowHiddenFiles}"
}, {
"widget-type":"spacer",
"expand": "true,false"
}, {
"widget-type":"button-icon-text",
"name": "[{ID}]file-shooser:button-validate",
"icon": "THEME_GUI:///Load.svg?lib:ewol",
"label": "_T{Validate}"
}, {
"widget-type":"button-icon-text",
"name": "[{ID}]file-shooser:button-cancel",
"icon": "THEME_GUI:///Remove.svg?lib:ewol",
"label": "_T{Cancel}"
}
]
}, {
"widget-type":"sizer",
"mode": "hori",
"child": [
{
"widget-type":"spacer",
"expand": "true,false"
}, {
"widget-type":"ListFileSystem",
"name":"[{ID}]file-shooser:list-folder",
"min-size":"20,0%",
"expand":"false,true",
"show-hidden":false,
"show-file":false,
"show-folder":true,
"show-temporary":false
}, {
"widget-type":"spacer",
"expand": "true,false"
}, {
"widget-type":"ListFileSystem",
"name":"[{ID}]file-shooser:list-files",
"min-size":"20,0%",
"expand":"true,true",
"show-hidden":false,
"show-file":true,
"show-folder":false,
"show-temporary":false
}, {
"widget-type":"spacer",
"expand": "true,false"
}
]
}, {
"widget-type":"sizer",
"mode": "hori",
"child": [
{
"widget-type":"image",
"name": "[{ID}]file-shooser:img-file",
"expand": false,
"size": "8,8mm",
"src": "THEME_GUI:///File.svg?lib:ewol"
},
{
"widget-type":"entry",
"name": "[{ID}]file-shooser:entry-file",
"expand": "true,false",
"fill": "true,false"
}
]
}, {
"widget-type":"sizer",
"mode": "hori",
"child": [
{
"widget-type":"image",
"name": "[{ID}]file-shooser:img-folder",
"expand": false,
"size": "8,8mm",
"src": "THEME_GUI:///Folder.svg?lib:ewol"
},
{
"widget-type":"entry",
"name": "[{ID}]file-shooser:entry-folder",
"expand": "true,false",
"fill": "true,false"
},
{
"widget-type":"image",
"name": "[{ID}]file-shooser:img-home",
"expand": false,
"size": "8,8mm",
"src": "THEME_GUI:///Home.svg?lib:ewol"
}
]
},
{
"widget-type":"label",
"name":"[{ID}]file-shooser:title-label",
"data": "_T{Title}"
}
]
}
]
}

View File

@ -12,7 +12,7 @@ Mesh:CheckBox_Cube
7/0/0 10/1/0 6/2/0| 3/3/1 11/4/1 7/5/1| 6/6/2 8/7/2 2/8/2| 2/9/3 9/10/3 3/11/3| 7/0/0 11/12/0 10/1/0| 3/3/1 9/13/1 11/4/1| 6/6/2 10/14/2 8/7/2| 2/9/3 8/15/3 9/10/3|
palette:gui_border_2
4/16/4 2/17/4 0/18/4| 6/19/5 5/20/5 7/21/5| 1/22/6 7/23/6 5/24/6| 0/25/7 3/26/7 1/27/7| 4/16/4 6/28/4 2/17/4| 6/19/5 4/29/5 5/20/5| 1/22/6 3/30/6 7/23/6| 0/25/7 2/31/7 3/26/7|
pallette_gui_border_inside
palette:gui_border_inside
8/7/8 15/32/8 9/10/8| 13/33/9 8/7/9 10/14/9| 10/14/10 12/34/10 13/33/10| 15/32/11 11/4/11 9/10/11| 8/7/8 14/35/8 15/32/8| 13/33/9 14/35/9 8/7/9| 10/14/10 11/4/10 12/34/10| 15/32/11 12/34/11 11/4/11|
palette:gui_center
15/32/12 13/33/12 12/34/12| 15/32/12 14/35/12 13/33/12|
@ -79,7 +79,7 @@ Palettes:gui_checked
vNi 1.450000
d 1.000000
illum 2
Materials:pallette_gui_border_inside
Palettes:gui_border_inside
Ns 225.000000
Ka 1.000000 1.000000 1.000000
Kd 0.003877 0.001682 0.147314

View File

@ -17,6 +17,7 @@
# Object to render (with modification)
"object-file":"THEME:shape/CheckBox.emf?lib=ewol",
"object-file-2":"THEME:shape/CheckBox.emf?lib=ewol&filter=^CheckBox.*$",
"palette":"THEME:shape/palette_gui.json?lib=ewol",

View File

@ -5,6 +5,8 @@ import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.context.EwolApplication;
import org.atriasoft.ewol.context.EwolContext;
import sample.atriasoft.ewol.Log;
public class Appl implements EwolApplication {
//! [ewol_sample_HW_main_application]

View File

@ -17,54 +17,54 @@ public class MainWindows extends Windows {
setPropertyTitle("Simple sample test");
//EwolObject.getContext().getFontDefault().setName("FreeSans");
Sizer sizerMain = new Sizer(DisplayMode.modeVert);
sizerMain.setPropertyExpand(new Vector2b(true, true));
sizerMain.setPropertyFill(new Vector2b(true, true));
sizerMain.setPropertyExpand(Vector2b.TRUE_TRUE);
sizerMain.setPropertyFill(Vector2b.TRUE_TRUE);
setSubWidget(sizerMain);
Sizer sizerHori1 = new Sizer(DisplayMode.modeHori);
sizerHori1.setPropertyExpand(new Vector2b(true, true));
sizerHori1.setPropertyFill(new Vector2b(true, true));
sizerHori1.setPropertyExpand(Vector2b.TRUE_TRUE);
sizerHori1.setPropertyFill(Vector2b.TRUE_TRUE);
sizerMain.subWidgetAdd(sizerHori1);
Sizer sizerHori2 = new Sizer(DisplayMode.modeHori);
sizerHori2.setPropertyExpand(new Vector2b(true, true));
sizerHori2.setPropertyFill(new Vector2b(true, true));
sizerHori2.setPropertyExpand(Vector2b.TRUE_TRUE);
sizerHori2.setPropertyFill(Vector2b.TRUE_TRUE);
sizerMain.subWidgetAdd(sizerHori2);
{
Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(100, 100), Distance.PIXEL));
simpleSpacer.setPropertyColor(Color.ALICE_BLUE);
simpleSpacer.setPropertyExpand(new Vector2b(true, true));
simpleSpacer.setPropertyFill(new Vector2b(true, true));
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
sizerHori1.subWidgetAdd(simpleSpacer);
}
{
Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.DARK_GREEN);
simpleSpacer.setPropertyExpand(new Vector2b(true, true));
simpleSpacer.setPropertyFill(new Vector2b(true, true));
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
sizerHori1.subWidgetAdd(simpleSpacer);
}
{
Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.CHOCOLATE);
simpleSpacer.setPropertyExpand(new Vector2b(true, true));
simpleSpacer.setPropertyFill(new Vector2b(true, true));
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
sizerHori1.subWidgetAdd(simpleSpacer);
}
{
Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.GREEN_YELLOW);
simpleSpacer.setPropertyExpand(new Vector2b(true, true));
simpleSpacer.setPropertyFill(new Vector2b(true, true));
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
sizerHori2.subWidgetAdd(simpleSpacer);
}
{
Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyColor(Color.PINK);
simpleSpacer.setPropertyExpand(new Vector2b(true, true));
simpleSpacer.setPropertyFill(new Vector2b(true, true));
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
sizerHori2.subWidgetAdd(simpleSpacer);
}
}

View File

@ -1,4 +1,4 @@
package sample.atriasoft.ewol.ComplexWindiows1;
package sample.atriasoft.ewol;
public class Log {
private static final String LIBNAME = "LoxelEngine";

View File

@ -5,6 +5,8 @@ import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.context.EwolApplication;
import org.atriasoft.ewol.context.EwolContext;
import sample.atriasoft.ewol.Log;
public class Appl implements EwolApplication {
//! [ewol_sample_HW_main_application]
@ -25,7 +27,7 @@ public class Appl implements EwolApplication {
//! [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", 48);
Configs.getConfigFonts().set("FreeSherif", 12);
//! [ewol_sample_HW_main_set_font_property]
//! [ewol_sample_HW_main_set_windows]
// Create the windows

View File

@ -1,39 +0,0 @@
package sample.atriasoft.ewol.sampleButton;
public class Log {
private static final String LIBNAME = "sampleEntry";
public static void critical(final String data) {
System.out.println("[C] " + Log.LIBNAME + " | " + data);
}
public static void debug(final String data) {
System.out.println("[D] " + Log.LIBNAME + " | " + data);
}
public static void error(final String data) {
System.out.println("[E] " + Log.LIBNAME + " | " + data);
}
public static void info(final String data) {
System.out.println("[I] " + Log.LIBNAME + " | " + data);
}
public static void print(final String data) {
System.out.println(data);
}
public static void todo(final String data) {
System.out.println("[TODO] " + Log.LIBNAME + " | " + data);
}
public static void verbose(final String data) {
System.out.println("[V] " + Log.LIBNAME + " | " + data);
}
public static void warning(final String data) {
System.out.println("[W] " + Log.LIBNAME + " | " + data);
}
private Log() {}
}

View File

@ -12,8 +12,8 @@ public class MainWindows extends BasicWindows {
Button simpleButton = new Button();
simpleButton.setPropertyValue("Top Button");
simpleButton.setPropertyExpand(new Vector2b(true, true));
simpleButton.setPropertyFill(new Vector2b(true, false));
simpleButton.setPropertyExpand(Vector2b.TRUE_TRUE);
simpleButton.setPropertyFill(Vector2b.TRUE_TRUE);
this.setTestWidget(simpleButton);
}
}

View File

@ -5,6 +5,8 @@ import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.context.EwolApplication;
import org.atriasoft.ewol.context.EwolContext;
import sample.atriasoft.ewol.Log;
public class Appl implements EwolApplication {
//! [ewol_sample_HW_main_application]

View File

@ -1,39 +0,0 @@
package sample.atriasoft.ewol.sampleEntry;
public class Log {
private static final String LIBNAME = "sampleEntry";
public static void critical(final String data) {
System.out.println("[C] " + Log.LIBNAME + " | " + data);
}
public static void debug(final String data) {
System.out.println("[D] " + Log.LIBNAME + " | " + data);
}
public static void error(final String data) {
System.out.println("[E] " + Log.LIBNAME + " | " + data);
}
public static void info(final String data) {
System.out.println("[I] " + Log.LIBNAME + " | " + data);
}
public static void print(final String data) {
System.out.println(data);
}
public static void todo(final String data) {
System.out.println("[TODO] " + Log.LIBNAME + " | " + data);
}
public static void verbose(final String data) {
System.out.println("[V] " + Log.LIBNAME + " | " + data);
}
public static void warning(final String data) {
System.out.println("[W] " + Log.LIBNAME + " | " + data);
}
private Log() {}
}

View File

@ -11,8 +11,8 @@ public class MainWindows extends BasicWindows {
setPropertyTitle("Simple Entry test");
Entry simpleEntry = new Entry();
simpleEntry.setPropertyExpand(new Vector2b(true, true));
simpleEntry.setPropertyFill(new Vector2b(true, false));
simpleEntry.setPropertyExpand(Vector2b.TRUE_TRUE);
simpleEntry.setPropertyFill(Vector2b.TRUE_FALSE);
this.setTestWidget(simpleEntry);
}

View File

@ -5,6 +5,8 @@ import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.context.EwolApplication;
import org.atriasoft.ewol.context.EwolContext;
import sample.atriasoft.ewol.Log;
public class Appl implements EwolApplication {
//! [ewol_sample_HW_main_application]

View File

@ -1,39 +0,0 @@
package sample.atriasoft.ewol.simpleWindowsLabel;
public class Log {
private static final String LIBNAME = "LoxelEngine";
public static void critical(final String data) {
System.out.println("[C] " + Log.LIBNAME + " | " + data);
}
public static void debug(final String data) {
System.out.println("[D] " + Log.LIBNAME + " | " + data);
}
public static void error(final String data) {
System.out.println("[E] " + Log.LIBNAME + " | " + data);
}
public static void info(final String data) {
System.out.println("[I] " + Log.LIBNAME + " | " + data);
}
public static void print(final String data) {
System.out.println(data);
}
public static void todo(final String data) {
System.out.println("[TODO] " + Log.LIBNAME + " | " + data);
}
public static void verbose(final String data) {
System.out.println("[V] " + Log.LIBNAME + " | " + data);
}
public static void warning(final String data) {
System.out.println("[W] " + Log.LIBNAME + " | " + data);
}
private Log() {}
}

View File

@ -18,14 +18,14 @@ public class MainWindows extends BasicWindows {
Label simpleLabel = new Label();
simpleLabel.setPropertyValue(
"He<b>llo.</b> <font color='blue'>World</font><br/><br/> - Coucou comment ca vas ???<br/> - Pas trop bien, je me suis cassé la jambe.<br/><br/><center>The end</center>");
simpleLabel.setPropertyExpand(new Vector2b(true, true));
simpleLabel.setPropertyFill(new Vector2b(true, true));
simpleLabel.setPropertyExpand(Vector2b.TRUE_TRUE);
simpleLabel.setPropertyFill(Vector2b.TRUE_TRUE);
this.setTestWidget(simpleLabel);
//! [ewol_sample_HW_windows_label]
} else {
Spacer simpleSpacer = new Spacer();
simpleSpacer.setPropertyExpand(new Vector2b(true, true));
simpleSpacer.setPropertyFill(new Vector2b(true, true));
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
this.setTestWidget(simpleSpacer);
}
}

View File

@ -5,6 +5,8 @@ import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.context.EwolApplication;
import org.atriasoft.ewol.context.EwolContext;
import sample.atriasoft.ewol.Log;
public class Appl implements EwolApplication {
//! [ewol_sample_HW_main_application]

View File

@ -1,39 +0,0 @@
package sample.atriasoft.ewol.simpleWindowsWithCheckBox;
public class Log {
private static final String LIBNAME = "LoxelEngine";
public static void critical(final String data) {
System.out.println("[C] " + Log.LIBNAME + " | " + data);
}
public static void debug(final String data) {
System.out.println("[D] " + Log.LIBNAME + " | " + data);
}
public static void error(final String data) {
System.out.println("[E] " + Log.LIBNAME + " | " + data);
}
public static void info(final String data) {
System.out.println("[I] " + Log.LIBNAME + " | " + data);
}
public static void print(final String data) {
System.out.println(data);
}
public static void todo(final String data) {
System.out.println("[TODO] " + Log.LIBNAME + " | " + data);
}
public static void verbose(final String data) {
System.out.println("[V] " + Log.LIBNAME + " | " + data);
}
public static void warning(final String data) {
System.out.println("[W] " + Log.LIBNAME + " | " + data);
}
private Log() {}
}

View File

@ -18,5 +18,12 @@ public class MainWindows extends BasicWindows {
this.testWidget.setPropertyExpand(Vector2b.TRUE_TRUE);
this.testWidget.setPropertyFill(Vector2b.TRUE_TRUE);
this.setTestWidget(this.testWidget);
/*
Button simpleButton = new Button();
simpleButton.setPropertyValue("Top Button");
simpleButton.setPropertyExpand(Vector2b.TRUE_TRUE);
simpleButton.setPropertyFill(Vector2b.TRUE_TRUE);
this.setTestWidget(simpleButton);
*/
}
}

View File

@ -5,6 +5,8 @@ import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.ewol.context.EwolApplication;
import org.atriasoft.ewol.context.EwolContext;
import sample.atriasoft.ewol.Log;
public class Appl implements EwolApplication {
//! [ewol_sample_HW_main_application]

View File

@ -1,39 +0,0 @@
package sample.atriasoft.ewol.simpleWindowsWithImage;
public class Log {
private static final String LIBNAME = "LoxelEngine";
public static void critical(final String data) {
System.out.println("[C] " + Log.LIBNAME + " | " + data);
}
public static void debug(final String data) {
System.out.println("[D] " + Log.LIBNAME + " | " + data);
}
public static void error(final String data) {
System.out.println("[E] " + Log.LIBNAME + " | " + data);
}
public static void info(final String data) {
System.out.println("[I] " + Log.LIBNAME + " | " + data);
}
public static void print(final String data) {
System.out.println(data);
}
public static void todo(final String data) {
System.out.println("[TODO] " + Log.LIBNAME + " | " + data);
}
public static void verbose(final String data) {
System.out.println("[V] " + Log.LIBNAME + " | " + data);
}
public static void warning(final String data) {
System.out.println("[W] " + Log.LIBNAME + " | " + data);
}
private Log() {}
}

View File

@ -31,23 +31,23 @@ public class MainWindows extends BasicWindows {
this.testWidget = new ImageDisplay();
this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
this.testWidget.setPropertyExpand(new Vector2b(true, true));
this.testWidget.setPropertyFill(new Vector2b(true, true));
this.testWidget.setPropertyExpand(Vector2b.TRUE_TRUE);
this.testWidget.setPropertyFill(Vector2b.TRUE_TRUE);
this.testWidget.setPropertyMinSize(new Dimension(Vector2f.VALUE_16, Distance.PIXEL));
this.setTestWidget(this.testWidget);
{
Button button = new Button();
button.setPropertyValue("Change image");
button.setPropertyExpand(new Vector2b(false, false));
button.setPropertyFill(new Vector2b(false, false));
button.setPropertyExpand(Vector2b.FALSE_FALSE);
button.setPropertyFill(Vector2b.FALSE_FALSE);
button.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
this.addButton(button);
button.signalClick.connectAuto(this, MainWindows::eventButtonChangeImage);
}
this.buttonAspectRatio = new Button();
this.buttonAspectRatio.setPropertyValue("keep aspect ratio");
this.buttonAspectRatio.setPropertyExpand(new Vector2b(false, false));
this.buttonAspectRatio.setPropertyFill(new Vector2b(false, false));
this.buttonAspectRatio.setPropertyExpand(Vector2b.FALSE_FALSE);
this.buttonAspectRatio.setPropertyFill(Vector2b.FALSE_FALSE);
this.buttonAspectRatio.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
this.addButton(this.buttonAspectRatio);
this.buttonAspectRatio.signalClick.connectAuto(this, MainWindows::eventButtonChangeKeepRatio);

View File

@ -1,12 +1,13 @@
package org.atriasoft.ewol;
import org.atriasoft.esvg.Esvg;
import org.atriasoft.etk.Uri;
/** @file
* @author Edouard DUPIN
* @copyright 2011, Edouard DUPIN, all right reserved
* @license MPL v2.0 (see license file)
*/
import org.atriasoft.esvg.Esvg;
import org.atriasoft.etk.Uri;
import org.atriasoft.etranslate.ETranslate;
import org.atriasoft.ewol.context.EwolApplication;
import org.atriasoft.ewol.context.EwolContext;

View File

@ -40,6 +40,7 @@ public class GuiShape extends Compositing {
private ResourceConfigFile config = null; //!< pointer on the config file resources
private int confObjectFile = -1; //!< Config Id of the object file to display
private int confObjectFile2 = -1; //!< Config Id of the object file to display
private int confProgramFileFrag = -1; //!< ConfigFile opengGl program Name
private int confProgramFileVert = -1; //!< ConfigFile opengGl program Name
private final List<Vector2i> listAssiciatedId = new ArrayList<>(); //!< Correlation ID between ColorProperty (Y) and OpenGL Program (X)
@ -57,7 +58,7 @@ public class GuiShape extends Compositing {
private ResourcePaletteFile palette;
private ResourceTexture2 texture;
private ResourceMesh mesh = null;
private ResourceMesh[] mesh = new ResourceMesh[2];
private Padding sizeObject = Padding.ZERO;
private int stateActivate = -1; //!< Activate state of the element
private GuiShapeMode stateNew = GuiShapeMode.NORMAL; //!< destination state
@ -119,13 +120,32 @@ public class GuiShape extends Compositing {
draw(null, disableDepthTest);
}
public void draw(final boolean disableDepthTest, int idMesh) {
draw(null, disableDepthTest, idMesh);
}
public void draw(final ResourceTexture2 secondaryTexture, final boolean disableDepthTest) {
this.draw(secondaryTexture, disableDepthTest, 0);
}
public void draw(final ResourceTexture2 secondaryTexture, final boolean disableDepthTest, int idMesh) {
if (this.config == null) {
// this is a normal case ... the user can choice to have no config basic file ...
return;
}
if (idMesh == 0 && this.mesh[0] == null) {
Log.error("No Object (0) to display ...");
return;
} else if (idMesh == 1 && this.mesh[1] == null) {
Log.error("No Object (1) to display ...");
return;
} else if (idMesh < 0 && idMesh > 1) {
Log.critical("No Object (" + idMesh + ") to display [0..1]");
return;
}
if (this.oGLprogram == null) {
Log.error("No shader ...");
return;
}
OpenGL.enable(Flag.flag_depthTest);
// set Matrix : translation/positionMatrix
@ -133,12 +153,12 @@ public class GuiShape extends Compositing {
Matrix4f camMatrix = OpenGL.getCameraMatrix();
Matrix4f tmpMatrix = this.matrixApply.multiply(this.transform);
this.oGLprogram.use();
this.mesh.bindForRendering();
this.mesh[idMesh].bindForRendering();
this.oGLprogram.uniformMatrix(this.oGLMatrixProjection, projMatrix);
this.oGLprogram.uniformMatrix(this.oGLMatrixTransformation, tmpMatrix);
this.oGLprogram.uniformMatrix(this.oGLMatrixView, camMatrix);
Set<String> layers = this.mesh.getLayers();
Set<String> layers = this.mesh[idMesh].getLayers();
Log.verbose("get layers:" + layers);
// Texture:
float imageDelta = (float) 1 / ResourcePaletteFile.getHeight();
@ -155,7 +175,6 @@ public class GuiShape extends Compositing {
basicValue -= imageDelta * this.stateTransition;
} else if (this.stateNew == GuiShapeMode.SELECT) {
basicValue += imageDelta * this.stateTransition;
}
} else if (this.stateOld == GuiShapeMode.SELECT) {
if (this.stateNew == GuiShapeMode.NORMAL) {
@ -169,23 +188,23 @@ public class GuiShape extends Compositing {
+ ")");
this.oGLprogram.uniformFloat(this.oGLPaletteOffset, basicValue);
Log.error("plop: " + this.offsetScaleOutside);
Log.error("plop: " + this.offsetScaleInside);
//Log.verbose("plop: " + this.offsetScaleOutside);
//Log.verbose("plop: " + this.offsetScaleInside);
this.oGLprogram.uniformVector(this.oGLOffsetScaleInside, this.offsetScaleInside);
this.oGLprogram.uniformVector(this.oGLOffsetScaleOutside, this.offsetScaleOutside);
this.texture.bindForRendering(0);
this.mesh.render("palette");
this.mesh[idMesh].render("palette");
if (secondaryTexture != null) {
this.oGLprogram.uniformFloat(this.oGLPaletteOffset, 0);
secondaryTexture.bindForRendering(0);
this.mesh.render("gui_dynamic_1");
this.mesh[idMesh].render("gui_dynamic_1");
}
// Request the draw of the elements:
this.mesh.render();
this.mesh[idMesh].render();
this.mesh.unBindForRendering();
this.mesh[idMesh].unBindForRendering();
this.oGLprogram.unUse();
OpenGL.disable(Flag.flag_depthTest);
}
@ -289,6 +308,7 @@ public class GuiShape extends Compositing {
this.confProgramFileVert = this.config.request("program-vert");
this.confProgramFileFrag = this.config.request("program-frag");
this.confObjectFile = this.config.request("object-file");
this.confObjectFile2 = this.config.request("object-file-2");
this.confIdPaletteFile = this.config.request("palette");
}
}
@ -349,8 +369,8 @@ public class GuiShape extends Compositing {
}
String objectFile = this.config.getString(this.confObjectFile);
if (!objectFile.isEmpty()) {
this.mesh = ResourceMesh.create(Uri.valueOf(objectFile));
List<Vector3f> verticesToModify = this.mesh.getGeneratedPosition();
this.mesh[0] = ResourceMesh.create(Uri.valueOf(objectFile));
List<Vector3f> verticesToModify = this.mesh[0].getGeneratedPosition();
float top = 0;
float bottom = 0;
float left = 0;
@ -372,6 +392,30 @@ public class GuiShape extends Compositing {
}
this.sizeObject = new Padding(Math.abs(left), Math.abs(top), Math.abs(right), Math.abs(bottom));
}
String objectFile2 = this.config.getString(this.confObjectFile2);
if (!objectFile2.isEmpty()) {
this.mesh[1] = ResourceMesh.create(Uri.valueOf(objectFile2));
List<Vector3f> verticesToModify = this.mesh[1].getGeneratedPosition();
float top = 0;
float bottom = 0;
float left = 0;
float right = 0;
float back = 0;
float font = 0;
// estimate size of border:
if (verticesToModify == null) {
Log.critical("Element is null : verticesToModify 2");
return;
}
for (int iii = 0; iii < verticesToModify.size(); iii++) {
left = Math.min(left, verticesToModify.get(iii).x());
right = Math.max(right, verticesToModify.get(iii).x());
top = Math.min(top, verticesToModify.get(iii).y());
bottom = Math.max(bottom, verticesToModify.get(iii).y());
back = Math.min(back, verticesToModify.get(iii).z());
font = Math.max(font, verticesToModify.get(iii).z());
}
}
}
/**
@ -438,7 +482,7 @@ public class GuiShape extends Compositing {
* @brief set the shape property:
*
* ********************************************************************************
* * _size *
* * size *
* * *
* * * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * *
* * *
@ -447,7 +491,7 @@ public class GuiShape extends Compositing {
* * | * * | *
* * * * *
* * | * * - - - - - - - - - - - - - - - - - - * * | *
* * * _insideSize * *
* * * insideSize * *
* * | * | | * | *
* * * * *
* * | * | | * | *
@ -459,7 +503,7 @@ public class GuiShape extends Compositing {
* * | * | | * | *
* * * * *
* * | * | | * | *
* * * _insidePos * *
* * * insidePos * *
* * | * * - - - - - - - - - - - - - - - - - - * * | *
* * * * *
* * | *************************************************** | *
@ -470,7 +514,7 @@ public class GuiShape extends Compositing {
* * *
* * *
* ********************************************************************************
* _origin
* origin
*
*
* @param center Center of the object

View File

@ -3,9 +3,15 @@ package org.atriasoft.ewol.object;
import java.lang.ref.WeakReference;
import org.atriasoft.ewol.Ewol;
import org.atriasoft.ewol.annotation.EwolDescription;
import org.atriasoft.ewol.context.EwolContext;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.exml.model.XmlElement;
import org.atriasoft.exml.annotation.XmlAttribute;
import org.atriasoft.exml.annotation.XmlDefaultManaged;
import org.atriasoft.exml.annotation.XmlDefaultOptional;
import org.atriasoft.exml.annotation.XmlIgnoreUnknow;
import org.atriasoft.exml.annotation.XmlManaged;
import org.atriasoft.exml.annotation.XmlName;
/** @file
* @author Edouard DUPIN
@ -17,6 +23,9 @@ import org.atriasoft.exml.model.XmlElement;
* Basic message classes for ewol system
* this class permit at every Object to communicate between them.
*/
@XmlDefaultManaged(value = false)
@XmlDefaultOptional
@XmlIgnoreUnknow
public class EwolObject {
private static Integer valUID = 0; //!< Static used for the unique ID definition
@ -103,36 +112,14 @@ public class EwolObject {
return this.uniqueId;
}
@XmlManaged
@XmlAttribute
@XmlName(value = "name")
@EwolDescription(value = "Name of the object.")
public String getName() {
return this.name;
}
/**
* load attribute properties with an XML node.
* @param node Reference on the XML node.
* @return true : All has been done corectly.
* @return false : An error occured.
*/
/*
boolean loadXMLAttributes( exml::Element node){
if (node.exist() == false) {
return false;
}
boolean errorOccured = false;
for( auto it : node.attributes) {
auto pair = it.getPair();
if (pair.first == "") {
continue;
}
if (properties.set(pair.first, pair.second) == false) {
errorOccured = true;
}
}
return errorOccured;
}
*/
/**
* get the static status of the Object == > mark at true if the user set the object mark as static allocated element ==> not auto remove element
* @return true if it might not be removed == > usefull for conficuration class
@ -141,25 +128,6 @@ public class EwolObject {
return this.staticObject;
}
/**
* store properties in this XML node.
* @param[in,out] node Reference on the XML node.
* @return true : All has been done corectly.
* @return false : An error occured.
*/
/*
boolean storeXML(exml::Element node){
if (node.exist() == false) {
return false;
}
boolean errorOccured = true;
for (auto it : properties.getAll(true)) {
node.attributes.set(it.first, it.second);
}
return errorOccured;
}
*/
/**
* Get the resource status of the element.
* @return the resource status.
@ -190,16 +158,6 @@ public class EwolObject {
return this.destroy;
}
/**
* load properties with an XML node.
* @param node Reference on the XML node.
* @return true : All has been done corectly.
* @return false : An error occured.
*/
protected boolean loadXML(final XmlElement node) {
return true;
}
/**
* Remove the current parenting.
*/

View File

@ -87,7 +87,7 @@ public class ResourceTexturedFont extends ResourceTexture2 {
this.listElement[2] = new ArrayList<>();
this.listElement[3] = new ArrayList<>();
String sizeString = fontBaseUri.getproperty("size");
String sizeString = fontBaseUri.getProperty("size");
if (sizeString == null) {
this.size = 25;
} else {

View File

@ -6,6 +6,7 @@ import org.atriasoft.etk.Color;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.Gravity;
import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.annotation.EwolDescription;
import org.atriasoft.ewol.annotation.EwolSignal;
@ -75,6 +76,8 @@ public class Button extends Widget {
this.propertyCanFocus = true;
onChangePropertyShaper();
markToRedraw();
// can not support multiple click...
setMouseLimit(1);
this.shape = new GuiShape(this.propertyConfig);
}
@ -101,13 +104,17 @@ public class Button extends Widget {
protected void changeStatusIn(final GuiShapeMode newStatusId) {
if (this.shape.changeStatusIn(newStatusId)) {
if (!this.periodicConnectionHanble.isConnected()) {
Log.error("REQUEST: connection on operiodic call");
//Log.error("REQUEST: connection on operiodic call");
this.periodicConnectionHanble = EwolObject.getObjectManager().periodicCall.connect(this, Button::periodicCall);
}
markToRedraw();
}
}
private boolean checkIfOver(Vector2f relPos) {
return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y();
}
@XmlManaged
@XmlAttribute
@XmlName(value = "config")
@ -151,44 +158,57 @@ public class Button extends Widget {
@Override
public boolean onEventInput(final EventInput event) {
Vector2f relPos = relativePosition(event.pos());
Log.verbose("Event on Input ... " + event + " relPos = " + relPos);
Log.warning("Event on Input ... " + event + " relPos = " + relPos);
boolean over = checkIfOver(relPos);
//filter if outside the element...
if (event.status() == KeyStatus.leave) {
changeStatusIn(GuiShapeMode.NORMAL);
this.isDown = false;
return true;
}
if (event.inputId() == 0) {
if (!this.isDown) {
if (KeyStatus.leave == event.status()) {
changeStatusIn(GuiShapeMode.NORMAL);
} else {
Log.verbose("Detect Over : " + this.overPositionStart + " -> " + this.overPositionStop);
if (relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y()) {
if (over) {
changeStatusIn(GuiShapeMode.OVER);
} else {
changeStatusIn(GuiShapeMode.NORMAL);
}
}
}
}
if (event.inputId() == 1) {
if (KeyStatus.pressSingle == event.status()) {
keepFocus();
this.signalClick.emit();
//nothing to do ...
return true;
}
if (KeyStatus.down == event.status()) {
keepFocus();
this.isDown = true;
changeStatusIn(GuiShapeMode.SELECT);
markToRedraw();
this.signalDown.emit();
} else if (KeyStatus.move == event.status()) {
keepFocus();
markToRedraw();
} else if (KeyStatus.up == event.status()) {
keepFocus();
this.isDown = false;
this.signalUp.emit();
changeStatusIn(GuiShapeMode.OVER);
markToRedraw();
}
}
if (event.inputId() != 1) {
return false;
}
if (KeyStatus.pressSingle == event.status() && over) {
keepFocus();
this.signalClick.emit();
return true;
}
if (KeyStatus.down == event.status() && over) {
keepFocus();
this.isDown = true;
changeStatusIn(GuiShapeMode.SELECT);
markToRedraw();
this.signalDown.emit();
return true;
}
if (KeyStatus.move == event.status() && over) {
keepFocus();
markToRedraw();
return true;
}
if (KeyStatus.up == event.status() && this.isDown) {
keepFocus();
this.isDown = false;
this.signalUp.emit();
changeStatusIn(GuiShapeMode.OVER);
markToRedraw();
return true;
}
return false;
}
@ -210,14 +230,17 @@ public class Button extends Widget {
Padding padding = this.shape.getPadding();
Vector2f tmpSizeShaper = this.minSize;
Vector2f delta = Gravity.gravityGenerateDelta(this.propertyGravity, this.size.less(this.minSize));
if (this.propertyFill.x()) {
tmpSizeShaper = tmpSizeShaper.withX(this.size.x());
delta = delta.withX(0.0f);
}
if (this.propertyFill.y()) {
tmpSizeShaper = tmpSizeShaper.withY(this.size.y());
delta = delta.withY(0.0f);
}
Vector2f tmpOriginShaper = this.size.less(tmpSizeShaper).multiply(0.5f);
Vector2f tmpOriginShaper = delta;
Vector2f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y());
//Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
Vector2f tmpOriginText = new Vector2f(0, this.gc.getTextSize());

View File

@ -6,6 +6,7 @@ import org.atriasoft.esignal.SignalEmpty;
import org.atriasoft.etk.Uri;
import org.atriasoft.etk.math.Vector2f;
import org.atriasoft.etk.math.Vector2i;
import org.atriasoft.ewol.Gravity;
import org.atriasoft.ewol.Padding;
import org.atriasoft.ewol.annotation.EwolDescription;
import org.atriasoft.ewol.annotation.EwolSignal;
@ -47,6 +48,7 @@ public class CheckBox extends Widget {
protected static void periodicCall(final CheckBox self, final EventTime event) {
Log.verbose("Periodic call on Entry(" + event + ")");
if (!self.shape.periodicCall(event)) {
//Log.error("end periodic call");
self.periodicConnectionHanble.close();
}
self.markToRedraw();
@ -84,6 +86,8 @@ public class CheckBox extends Widget {
this.propertyCanFocus = true;
onChangePropertyShaper();
markToRedraw();
// can not support multiple click...
setMouseLimit(1);
this.shape = new GuiShape(this.propertyConfig);
}
@ -110,13 +114,17 @@ public class CheckBox extends Widget {
protected void changeStatusIn(final GuiShapeMode newStatusId) {
if (this.shape.changeStatusIn(newStatusId)) {
if (!this.periodicConnectionHanble.isConnected()) {
Log.error("REQUEST: connection on operiodic call");
//Log.error("REQUEST: connection on periodic call");
this.periodicConnectionHanble = EwolObject.getObjectManager().periodicCall.connect(this, CheckBox::periodicCall);
}
markToRedraw();
}
}
private boolean checkIfOver(Vector2f relPos) {
return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y();
}
@XmlManaged
@XmlAttribute
@XmlName(value = "config")
@ -153,51 +161,65 @@ public class CheckBox extends Widget {
@Override
protected void onDraw() {
if (this.shape != null) {
this.shape.draw(true);
this.shape.draw(true, this.propertyValue ? 0 : 1);
}
}
@Override
public boolean onEventInput(final EventInput event) {
Vector2f relPos = relativePosition(event.pos());
Log.verbose("Event on Input ... " + event + " relPos = " + relPos);
Log.warning("Event on Input ... " + event + " relPos = " + relPos);
boolean over = checkIfOver(relPos);
//filter if outside the element...
if (event.status() == KeyStatus.leave) {
changeStatusIn(GuiShapeMode.NORMAL);
this.isDown = false;
return true;
}
if (event.inputId() == 0) {
if (!this.isDown) {
if (KeyStatus.leave == event.status()) {
changeStatusIn(GuiShapeMode.NORMAL);
} else {
Log.verbose("Detect Over : " + this.overPositionStart + " -> " + this.overPositionStop);
if (relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y()) {
if (over) {
changeStatusIn(GuiShapeMode.OVER);
} else {
changeStatusIn(GuiShapeMode.NORMAL);
}
}
}
}
if (event.inputId() == 1) {
if (KeyStatus.pressSingle == event.status()) {
keepFocus();
this.signalClick.emit();
//nothing to do ...
return true;
}
if (KeyStatus.down == event.status()) {
keepFocus();
this.isDown = true;
changeStatusIn(GuiShapeMode.SELECT);
markToRedraw();
this.signalDown.emit();
} else if (KeyStatus.move == event.status()) {
keepFocus();
markToRedraw();
} else if (KeyStatus.up == event.status()) {
keepFocus();
this.isDown = false;
this.signalUp.emit();
changeStatusIn(GuiShapeMode.OVER);
markToRedraw();
}
}
if (event.inputId() != 1) {
return false;
}
if (KeyStatus.pressSingle == event.status() && over) {
keepFocus();
this.signalClick.emit();
this.propertyValue = !this.propertyValue;
return true;
}
if (KeyStatus.down == event.status() && over) {
keepFocus();
this.isDown = true;
changeStatusIn(GuiShapeMode.SELECT);
markToRedraw();
this.signalDown.emit();
return true;
}
if (KeyStatus.move == event.status() && over) {
keepFocus();
markToRedraw();
return true;
}
if (KeyStatus.up == event.status() && this.isDown) {
keepFocus();
this.isDown = false;
this.signalUp.emit();
changeStatusIn(GuiShapeMode.OVER);
markToRedraw();
return true;
}
return false;
}
@ -219,17 +241,20 @@ public class CheckBox extends Widget {
Padding padding = this.shape.getPadding();
Vector2f tmpSizeShaper = this.minSize;
Vector2f delta = Gravity.gravityGenerateDelta(this.propertyGravity, this.size.less(this.minSize));
if (this.propertyFill.x()) {
tmpSizeShaper = tmpSizeShaper.withX(this.size.x());
delta = delta.withX(0.0f);
}
if (this.propertyFill.y()) {
tmpSizeShaper = tmpSizeShaper.withY(this.size.y());
delta = delta.withY(0.0f);
}
Vector2f tmpOriginShaper = this.size.less(tmpSizeShaper).multiply(0.5f);
Vector2f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y());
Vector2f tmpOriginShaper = delta;
Vector2f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y());
//Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
Vector2f tmpOriginText = new Vector2f(0, 0);//this.gc.getTextSize());
Vector2f tmpOriginInside = new Vector2f(0, 0);//this.gc.getTextSize());
// sometimes, the user define an height bigger than the real size needed == > in this case we need to center the text in the shaper ...
/*
int minHeight = this.gc.getTextHeight();
@ -240,8 +265,8 @@ public class CheckBox extends Widget {
// fix all the position in the int class:
tmpSizeShaper = Vector2f.clipInt(tmpSizeShaper);
tmpOriginShaper = Vector2f.clipInt(tmpOriginShaper);
tmpSizeText = Vector2f.clipInt(tmpSizeText);
tmpOriginText = Vector2f.clipInt(tmpOriginText);
tmpSizeInside = Vector2f.clipInt(tmpSizeInside);
tmpOriginInside = Vector2f.clipInt(tmpOriginInside);
//this.gc.clear();
//this.gc.setSize((int)tmpSizeText.x(), (int)tmpSizeText.y());
@ -252,7 +277,7 @@ public class CheckBox extends Widget {
//this.gc.text(tmpOriginText, this.propertyValue);
this.overPositionStart = tmpOriginShaper;
this.overPositionStop = tmpOriginShaper.add(tmpSizeShaper);
this.shape.setShape(tmpOriginShaper, tmpSizeShaper, tmpOriginText, tmpSizeText);
this.shape.setShape(tmpOriginShaper, tmpSizeShaper, tmpOriginInside, tmpSizeInside);
//this.gc.flush();
this.shape.flush();

View File

@ -17,10 +17,9 @@ import org.atriasoft.ewol.annotation.EwolDescription;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.object.EwolObject;
import org.atriasoft.exml.annotation.XmlAttribute;
import org.atriasoft.exml.annotation.XmlFactory;
import org.atriasoft.exml.annotation.XmlManaged;
import org.atriasoft.exml.annotation.XmlName;
import org.atriasoft.exml.model.XmlElement;
import org.atriasoft.exml.model.XmlNode;
/**
* @ingroup ewolWidgetGroup
@ -114,6 +113,13 @@ public class ContainerN extends Widget {
return null;
}
@XmlManaged
@XmlFactory(value = WidgetXmlFactory.class)
@EwolDescription(value = "Request the widget Expand size while free space is detected (does not generate expand in upper widget)")
public List<Widget> getSubWidgets() {
return this.subWidget;
}
@Override
public Widget getWidgetAtPos(final Vector2f pos) {
if (this.propertyHide) {
@ -137,58 +143,6 @@ public class ContainerN extends Widget {
return null;
}
@Override
public boolean loadXML(final XmlElement node) {
if (node == null) {
return false;
}
// parse generic properties :
super.loadXML(node);
// remove previous element :
subWidgetRemoveAll();
String tmpAttributeValue = node.getAttribute("lock", "");
if (tmpAttributeValue.length() != 0) {
setPropertyLockExpand(Vector2b.valueOf(tmpAttributeValue));
}
boolean invertAdding = false;
tmpAttributeValue = node.getAttribute("addmode", "").toLowerCase();
if (tmpAttributeValue.contentEquals("invert")) {
invertAdding = true;
}
// parse all the elements :
for (XmlNode nodeIt : node.getNodes()) {
if (!nodeIt.isElement()) {
// trash here all that is not element
continue;
}
XmlElement pNode = nodeIt.toElement();
String widgetName = pNode.getValue();
Log.verbose(" t=" + this.getClass().getCanonicalName() + " Load node name : '" + widgetName + "'");
if (!getWidgetManager().exist(widgetName)) {
Log.error("[" + getId() + "] {" + this.getClass().getCanonicalName() + "} Unknown basic node='" + widgetName + "' not in : [" + getWidgetManager().list() + "]");
continue;
}
Log.debug("[" + getId() + "] {" + this.getClass().getCanonicalName() + "} load new element : '" + widgetName + "'");
Widget subWidget = getWidgetManager().create(widgetName, pNode);
if (subWidget == null) {
Log.error("[" + getId() + "] {" + this.getClass().getCanonicalName() + "} Can not create the widget : '" + widgetName + "'");
continue;
}
// add sub element :
if (!invertAdding) {
subWidgetAdd(subWidget);
} else {
subWidgetAddStart(subWidget);
}
if (!subWidget.loadXML(pNode)) {
Log.error("[" + getId() + "] {" + this.getClass().getCanonicalName() + "} can not load widget properties : '" + widgetName + "'");
return false;
}
}
return true;
}
@Override
public void onChangeSize() {
for (Widget it : this.subWidget) {
@ -247,6 +201,21 @@ public class ContainerN extends Widget {
requestUpdateSize();
}
public void setSubWidgets(List<Widget> listData) {
// Clean all previous widget
this.subWidgetRemoveAll();
// add separately all widgets
for (Widget elem : listData) {
if (elem == null) {
continue;
}
elem.setParent(this);
this.subWidget.add(0, elem);
}
markToRedraw();
requestUpdateSize();
}
/**
* add at end position a Widget (note : This system use an inverted phylisophie (button to top, and left to right)
* @param newWidget the element pointer

View File

@ -21,7 +21,6 @@ import org.atriasoft.ewol.resource.ResourceColorFile;
import org.atriasoft.exml.annotation.XmlAttribute;
import org.atriasoft.exml.annotation.XmlManaged;
import org.atriasoft.exml.annotation.XmlName;
import org.atriasoft.exml.model.XmlElement;
import org.atriasoft.gale.key.KeyStatus;
public class ImageDisplay extends Widget {
@ -140,50 +139,6 @@ public class ImageDisplay extends Widget {
return this.propertyUseThemeColor;
}
@Override
public boolean loadXML(final XmlElement node) {
if (node == null) {
return false;
}
super.loadXML(node);
// get internal data :
String tmpAttributeValue = node.getAttribute("ratio", "").toLowerCase();
if (tmpAttributeValue.length() != 0) {
if (tmpAttributeValue.equals("true")) {
this.propertyKeepRatio = true;
} else if (tmpAttributeValue.equals("1")) {
this.propertyKeepRatio = true;
} else {
this.propertyKeepRatio = false;
}
}
tmpAttributeValue = node.getAttribute("size", "");
if (tmpAttributeValue.length() != 0) {
//Log.critical(" Parse SIZE : " + tmpAttributeValue);
this.propertyImageSize = Dimension.valueOf(tmpAttributeValue);
//Log.critical(" == > " + propertyImageSize);
}
tmpAttributeValue = node.getAttribute("border", "");
if (tmpAttributeValue.length() != 0) {
this.propertyBorder = Dimension.valueOf(tmpAttributeValue);
}
tmpAttributeValue = node.getAttribute("smooth", "");
if (tmpAttributeValue.length() != 0) {
this.propertySmooth = Boolean.parseBoolean(tmpAttributeValue);
}
//Log.debug("Load label:" + node.ToElement().getText());
if (node.getNodes().size() != 0) {
this.propertySource = Uri.valueOf(node.getText());
} else {
tmpAttributeValue = node.getAttribute("src", "");
if (tmpAttributeValue.length() != 0) {
this.propertySource = Uri.valueOf(tmpAttributeValue);
}
}
return true;
}
@Override
protected void onDraw() {
this.compositing.draw();

View File

@ -22,7 +22,6 @@ import org.atriasoft.ewol.resource.ResourceColorFile;
import org.atriasoft.exml.annotation.XmlAttribute;
import org.atriasoft.exml.annotation.XmlManaged;
import org.atriasoft.exml.annotation.XmlName;
import org.atriasoft.exml.model.XmlElement;
import org.atriasoft.gale.key.KeyStatus;
public class Label extends Widget {
@ -92,18 +91,6 @@ public class Label extends Widget {
return this.propertyAutoTranslate;
}
@Override
public boolean loadXML(final XmlElement node) {
if (node == null) {
return false;
}
super.loadXML(node);
// get internal data :
Log.debug("Load label:" + node.getText());
setPropertyValue(node.getText());
return true;
}
@Override
protected void onDraw() {
this.text.draw();

View File

@ -32,12 +32,8 @@ import org.atriasoft.ewol.event.InputSystem;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.ewol.object.EwolObject;
import org.atriasoft.exml.annotation.XmlAttribute;
import org.atriasoft.exml.annotation.XmlDefaultManaged;
import org.atriasoft.exml.annotation.XmlDefaultOptional;
import org.atriasoft.exml.annotation.XmlIgnoreUnknow;
import org.atriasoft.exml.annotation.XmlManaged;
import org.atriasoft.exml.annotation.XmlName;
import org.atriasoft.exml.model.XmlElement;
import org.atriasoft.gale.backend3d.OpenGL;
import org.atriasoft.gale.context.ClipboardList;
import org.atriasoft.gale.context.Cursor;
@ -53,10 +49,6 @@ import org.lwjgl.opengl.GL11;
* :** Receive Event (keyboard / mouse / ...)
*
*/
@XmlDefaultManaged(value = false)
@XmlDefaultOptional
@XmlIgnoreUnknow
public class Widget extends EwolObject {
// ----------------------------------------------------------------------------------------------------------------
// -- keyboard event properties Area
@ -423,13 +415,6 @@ public class Widget extends EwolObject {
getWidgetManager().focusKeep(this);
}
@Override
public boolean loadXML(final XmlElement node) {
super.loadXML(node);
markToRedraw();
return true;
}
/**
* The widget mark itself that it need to regenerate the nest time.
*/

View File

@ -15,10 +15,10 @@ import org.atriasoft.exml.model.XmlElement;
*/
public class WidgetManager {
// ---------------------------------------------
// -- Factory area
// ---------------------------------------------
private final Map<String, Class<?>> creatorList = new HashMap<>(); //!< List of factory of a widget
private WeakReference<Widget> focusWidgetCurrent; //!< Current focus selected
// ---------------------------------------------
// -- Focus area
@ -94,7 +94,7 @@ public class WidgetManager {
}
//Keep name in lower case :
final String nameLower = name.toLowerCase();
final Class<?> it = this.creatorList.get(nameLower);
final Class<?> it = WidgetXmlFactory..creatorList.get(nameLower);
if (it != null) {
Log.warning("Replace Creator of a specify widget : " + nameLower);
return;
@ -186,7 +186,7 @@ public class WidgetManager {
}
this.focusWidgetCurrent = new WeakReference<>(newWidget);
if (newWidget != null) {
Log.debug("Set focus on WidgetID=" + newWidget.getId() );
Log.debug("Set focus on WidgetID=" + newWidget.getId());
newWidget.setFocus();
}
}

View File

@ -0,0 +1,28 @@
package org.atriasoft.ewol.widget;
import java.util.HashMap;
import java.util.Map;
import org.atriasoft.exml.annotation.XmlFactory.InterfaceXmlFactoryAccess;
public class WidgetXmlFactory implements InterfaceXmlFactoryAccess {
private static Map<String, Class<?>> listWidgetAvaillable = new HashMap<>();
static {
listWidgetAvaillable.put("Button", Button.class);
listWidgetAvaillable.put("Sizer", Sizer.class);
listWidgetAvaillable.put("Label", Label.class);
listWidgetAvaillable.put("CheckBox", CheckBox.class);
listWidgetAvaillable.put("Image", ImageDisplay.class);
}
@Override
public Class<?> findClass(String name) {
return listWidgetAvaillable.get(name);
}
@Override
public String generateName(Object widget) {
return null;
}
}