[DEV] try checkbox
This commit is contained in:
parent
7bccb092d1
commit
a374caf9ba
@ -1,25 +1,24 @@
|
|||||||
{
|
{
|
||||||
mode:2,
|
# padding "outside" the object in pixel ==> prevent bad display
|
||||||
display-outside:false,
|
"padding-out-left":2,
|
||||||
|
"padding-out-right":2,
|
||||||
|
"padding-out-top":2,
|
||||||
|
"padding-out-buttom":2,
|
||||||
|
|
||||||
padding-out-left:1,
|
# padding "inside" the object in pixel ==> prevent bad display
|
||||||
padding-out-right:1,
|
"padding-in-left":2,
|
||||||
padding-out-top:1,
|
"padding-in-right":2,
|
||||||
padding-out-buttom:1,
|
"padding-in-top":2,
|
||||||
|
"padding-in-buttom":2,
|
||||||
|
|
||||||
border-left:1,
|
# render program:
|
||||||
border-right:1,
|
"program-vert":"THEME:shape/aaRenderShape.vert?lib=ewol",
|
||||||
border-top:1,
|
"program-frag":"THEME:shape/aaRenderShape.frag?lib=ewol",
|
||||||
border-buttom:1,
|
|
||||||
|
|
||||||
padding-in-left:1,
|
# Object to render (with modification)
|
||||||
padding-in-right:1,
|
"object-file":"THEME:shape/CheckBox.emf?lib=ewol",
|
||||||
padding-in-top:1,
|
|
||||||
padding-in-buttom:1,
|
|
||||||
|
|
||||||
box-size:20,
|
"palette":"THEME:shape/palette_gui.json?lib=ewol",
|
||||||
box-inside:12,
|
|
||||||
change-time:356,
|
"change-time":200
|
||||||
program:"THEME_GUI:///CheckBox.prog?lib=ewol",
|
|
||||||
color:"THEME_COLOR:///CheckBox.json?lib=ewol"
|
|
||||||
}
|
}
|
Binary file not shown.
@ -0,0 +1,80 @@
|
|||||||
|
package sample.atriasoft.ewol.simpleWindowsWithCheckBox;
|
||||||
|
|
||||||
|
import org.atriasoft.etk.Configs;
|
||||||
|
import org.atriasoft.etk.math.Vector2f;
|
||||||
|
import org.atriasoft.ewol.context.EwolApplication;
|
||||||
|
import org.atriasoft.ewol.context.EwolContext;
|
||||||
|
|
||||||
|
public class Appl implements EwolApplication {
|
||||||
|
|
||||||
|
//! [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++) {
|
||||||
|
String tmpppp = context.getCmd().get(iii);
|
||||||
|
if (tmpppp == "-h" || tmpppp == "--help") {
|
||||||
|
Log.print(" -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
|
||||||
|
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) {
|
||||||
|
Log.info("Application onCreate: [BEGIN]");
|
||||||
|
localCreate(context);
|
||||||
|
Log.info("Application onCreate: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onDestroy(final EwolContext context) {
|
||||||
|
Log.info("Application onDestroy: [BEGIN]");
|
||||||
|
|
||||||
|
Log.info("Application onDestroy: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPause(final EwolContext context) {
|
||||||
|
Log.info("Application onPause: [BEGIN]");
|
||||||
|
|
||||||
|
Log.info("Application onPause: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume(final EwolContext context) {
|
||||||
|
Log.info("Application onResume: [BEGIN]");
|
||||||
|
|
||||||
|
Log.info("Application onResume: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart(final EwolContext context) {
|
||||||
|
Log.info("Application onStart: [BEGIN]");
|
||||||
|
|
||||||
|
Log.info("Application onStart: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop(final EwolContext context) {
|
||||||
|
Log.info("Application onStop: [BEGIN]");
|
||||||
|
|
||||||
|
Log.info("Application onStop: [ END ]");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
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() {}
|
||||||
|
}
|
@ -0,0 +1,220 @@
|
|||||||
|
package sample.atriasoft.ewol.simpleWindowsWithCheckBox;
|
||||||
|
|
||||||
|
import org.atriasoft.etk.Color;
|
||||||
|
import org.atriasoft.etk.Dimension;
|
||||||
|
import org.atriasoft.etk.Distance;
|
||||||
|
import org.atriasoft.etk.math.Vector2b;
|
||||||
|
import org.atriasoft.etk.math.Vector2f;
|
||||||
|
import org.atriasoft.ewol.Gravity;
|
||||||
|
import org.atriasoft.ewol.widget.Button;
|
||||||
|
import org.atriasoft.ewol.widget.CheckBox;
|
||||||
|
import org.atriasoft.ewol.widget.Sizer;
|
||||||
|
import org.atriasoft.ewol.widget.Sizer.DisplayMode;
|
||||||
|
import org.atriasoft.ewol.widget.Spacer;
|
||||||
|
import org.atriasoft.ewol.widget.Windows;
|
||||||
|
|
||||||
|
public class MainWindows extends Windows {
|
||||||
|
CheckBox testWidget;
|
||||||
|
Button buttonExpandX;
|
||||||
|
Button buttonExpandY;
|
||||||
|
Button buttonFillX;
|
||||||
|
Button buttonFillY;
|
||||||
|
Button buttonGravity;
|
||||||
|
Button buttonAspectRatio;
|
||||||
|
public MainWindows() {
|
||||||
|
//! [ewol_sample_HW_windows_title]
|
||||||
|
setPropertyTitle("Simple CheckBox");
|
||||||
|
|
||||||
|
Sizer sizerMain = new Sizer(DisplayMode.modeVert);
|
||||||
|
sizerMain.setPropertyExpand(new Vector2b(true, true));
|
||||||
|
sizerMain.setPropertyFill(new Vector2b(true, true));
|
||||||
|
setSubWidget(sizerMain);
|
||||||
|
|
||||||
|
Sizer sizerHori1 = new Sizer(DisplayMode.modeHori);
|
||||||
|
sizerHori1.setPropertyExpand(new Vector2b(true, false));
|
||||||
|
sizerHori1.setPropertyLockExpand(new Vector2b(true, true));
|
||||||
|
sizerHori1.setPropertyFill(new Vector2b(true, true));
|
||||||
|
sizerMain.subWidgetAdd(sizerHori1);
|
||||||
|
|
||||||
|
{
|
||||||
|
Spacer simpleSpacer = new Spacer();
|
||||||
|
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(100, 100), Distance.PIXEL));
|
||||||
|
simpleSpacer.setPropertyColor(Color.ALICE_BLUE);
|
||||||
|
simpleSpacer.setPropertyExpand(new Vector2b(true, false));
|
||||||
|
simpleSpacer.setPropertyFill(new Vector2b(true, true));
|
||||||
|
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerMain.subWidgetAdd(simpleSpacer);
|
||||||
|
}
|
||||||
|
|
||||||
|
Sizer sizerHori2 = new Sizer(DisplayMode.modeHori);
|
||||||
|
sizerHori2.setPropertyExpand(new Vector2b(true, true));
|
||||||
|
sizerHori2.setPropertyFill(new Vector2b(true, true));
|
||||||
|
sizerMain.subWidgetAdd(sizerHori2);
|
||||||
|
|
||||||
|
{
|
||||||
|
Spacer simpleSpacer = new Spacer();
|
||||||
|
simpleSpacer.setPropertyColor(Color.DARK_GREEN);
|
||||||
|
simpleSpacer.setPropertyExpand(new Vector2b(true, false));
|
||||||
|
simpleSpacer.setPropertyFill(new Vector2b(true, true));
|
||||||
|
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerMain.subWidgetAdd(simpleSpacer);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Spacer simpleSpacer = new Spacer();
|
||||||
|
simpleSpacer.setPropertyColor(Color.CHOCOLATE);
|
||||||
|
simpleSpacer.setPropertyExpand(new Vector2b(false, true));
|
||||||
|
simpleSpacer.setPropertyFill(new Vector2b(true, true));
|
||||||
|
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerHori2.subWidgetAdd(simpleSpacer);
|
||||||
|
}
|
||||||
|
this.testWidget = new CheckBox();
|
||||||
|
//this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
|
||||||
|
this.testWidget.setPropertyExpand(new Vector2b(true, true));
|
||||||
|
this.testWidget.setPropertyFill(new Vector2b(true, true));
|
||||||
|
sizerHori2.subWidgetAdd(this.testWidget);
|
||||||
|
{
|
||||||
|
Spacer simpleSpacer = new Spacer();
|
||||||
|
simpleSpacer.setPropertyColor(Color.GREEN_YELLOW);
|
||||||
|
simpleSpacer.setPropertyExpand(new Vector2b(false, true));
|
||||||
|
simpleSpacer.setPropertyFill(new Vector2b(true, true));
|
||||||
|
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerHori2.subWidgetAdd(simpleSpacer);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
Spacer simpleSpacer = new Spacer();
|
||||||
|
simpleSpacer.setPropertyColor(Color.PINK);
|
||||||
|
simpleSpacer.setPropertyExpand(new Vector2b(true, true));
|
||||||
|
simpleSpacer.setPropertyFill(new Vector2b(true, true));
|
||||||
|
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(30, 30), Distance.PIXEL));
|
||||||
|
sizerHori1.subWidgetAdd(simpleSpacer);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
this.buttonExpandX = new Button();
|
||||||
|
this.buttonExpandX.setPropertyValue("un-expand X");
|
||||||
|
this.buttonExpandX.setPropertyExpand(new Vector2b(false, false));
|
||||||
|
this.buttonExpandX.setPropertyFill(new Vector2b(false, false));
|
||||||
|
this.buttonExpandX.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerHori1.subWidgetAdd(this.buttonExpandX);
|
||||||
|
this.buttonExpandX.signalClick.connectAuto(this, MainWindows::eventButtonExpandX);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
this.buttonExpandY = new Button();
|
||||||
|
this.buttonExpandY.setPropertyValue("un-expand Y");
|
||||||
|
this.buttonExpandY.setPropertyExpand(new Vector2b(false, false));
|
||||||
|
this.buttonExpandY.setPropertyFill(new Vector2b(false, false));
|
||||||
|
this.buttonExpandY.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerHori1.subWidgetAdd(this.buttonExpandY);
|
||||||
|
this.buttonExpandY.signalClick.connectAuto(this, MainWindows::eventButtonExpandY);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
this.buttonFillX = new Button();
|
||||||
|
this.buttonFillX.setPropertyValue("un-fill X");
|
||||||
|
this.buttonFillX.setPropertyExpand(new Vector2b(false, false));
|
||||||
|
this.buttonFillX.setPropertyFill(new Vector2b(false, false));
|
||||||
|
this.buttonFillX.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerHori1.subWidgetAdd(this.buttonFillX);
|
||||||
|
this.buttonFillX.signalClick.connectAuto(this, MainWindows::eventButtonFillX);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
this.buttonFillY = new Button();
|
||||||
|
this.buttonFillY.setPropertyValue("un-fill Y");
|
||||||
|
this.buttonFillY.setPropertyExpand(new Vector2b(false, false));
|
||||||
|
this.buttonFillY.setPropertyFill(new Vector2b(false, false));
|
||||||
|
this.buttonFillY.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerHori1.subWidgetAdd(this.buttonFillY);
|
||||||
|
this.buttonFillY.signalClick.connectAuto(this, MainWindows::eventButtonFillY);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
Button button = new Button();
|
||||||
|
button.setPropertyValue("Change image");
|
||||||
|
button.setPropertyExpand(new Vector2b(false, false));
|
||||||
|
button.setPropertyFill(new Vector2b(false, false));
|
||||||
|
button.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerHori1.subWidgetAdd(button);
|
||||||
|
button.signalClick.connectAuto(this, MainWindows::eventButtonChangeImage);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
this.buttonGravity = new Button();
|
||||||
|
this.buttonGravity.setPropertyValue("gravity");
|
||||||
|
this.buttonGravity.setPropertyExpand(new Vector2b(false, false));
|
||||||
|
this.buttonGravity.setPropertyFill(new Vector2b(false, false));
|
||||||
|
this.buttonGravity.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerHori1.subWidgetAdd(this.buttonGravity);
|
||||||
|
this.buttonGravity.signalClick.connectAuto(this, MainWindows::eventButtonChangeGravity);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
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.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||||
|
sizerHori1.subWidgetAdd(this.buttonAspectRatio);
|
||||||
|
this.buttonAspectRatio.signalClick.connectAuto(this, MainWindows::eventButtonChangeKeepRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public static void eventButtonExpandX(final MainWindows self) {
|
||||||
|
Vector2b state = self.testWidget.getPropertyExpand();
|
||||||
|
self.testWidget.setPropertyExpand(state.withX(!state.x()));
|
||||||
|
self.buttonExpandX.setPropertyValue(state.x()?"expand X":"un-expand X");
|
||||||
|
}
|
||||||
|
public static void eventButtonExpandY(final MainWindows self) {
|
||||||
|
Vector2b state = self.testWidget.getPropertyExpand();
|
||||||
|
self.testWidget.setPropertyExpand(state.withY(!state.y()));
|
||||||
|
self.buttonExpandY.setPropertyValue(state.y()?"expand Y":"un-expand Y");
|
||||||
|
}
|
||||||
|
public static void eventButtonFillX(final MainWindows self) {
|
||||||
|
Vector2b state = self.testWidget.getPropertyFill();
|
||||||
|
self.testWidget.setPropertyFill(state.withX(!state.x()));
|
||||||
|
self.buttonFillX.setPropertyValue(state.x()?"fill X":"un-fill X");
|
||||||
|
}
|
||||||
|
public static void eventButtonFillY(final MainWindows self) {
|
||||||
|
Vector2b state = self.testWidget.getPropertyFill();
|
||||||
|
self.testWidget.setPropertyFill(state.withY(!state.y()));
|
||||||
|
self.buttonFillY.setPropertyValue(state.y()?"fill Y":"un-fill Y");
|
||||||
|
}
|
||||||
|
public static void eventButtonChangeKeepRatio(final MainWindows self) {
|
||||||
|
//boolean state = self.testWidget.isPropertyKeepRatio();
|
||||||
|
//self.testWidget.setPropertyKeepRatio(!state);
|
||||||
|
//self.buttonAspectRatio.setPropertyValue(state?"fkeep aspect ratio":"un-keep aspect ratio");
|
||||||
|
}
|
||||||
|
public static void eventButtonChangeGravity(final MainWindows self) {
|
||||||
|
Gravity state = self.testWidget.getPropertyGravity();
|
||||||
|
switch(state) {
|
||||||
|
case BUTTOM:
|
||||||
|
state = Gravity.BUTTOM_LEFT;
|
||||||
|
break;
|
||||||
|
case BUTTOM_LEFT:
|
||||||
|
state = Gravity.BUTTOM_RIGHT;
|
||||||
|
break;
|
||||||
|
case BUTTOM_RIGHT:
|
||||||
|
state = Gravity.CENTER;
|
||||||
|
break;
|
||||||
|
case CENTER:
|
||||||
|
state = Gravity.LEFT;
|
||||||
|
break;
|
||||||
|
case LEFT:
|
||||||
|
state = Gravity.RIGHT;
|
||||||
|
break;
|
||||||
|
case RIGHT:
|
||||||
|
state = Gravity.TOP;
|
||||||
|
break;
|
||||||
|
case TOP:
|
||||||
|
state = Gravity.TOP_LEFT;
|
||||||
|
break;
|
||||||
|
case TOP_LEFT:
|
||||||
|
state = Gravity.TOP_RIGHT;
|
||||||
|
break;
|
||||||
|
case TOP_RIGHT:
|
||||||
|
state = Gravity.BUTTOM;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
self.testWidget.setPropertyGravity(state);
|
||||||
|
self.buttonGravity.setPropertyValue("gravity: " + state);
|
||||||
|
}
|
||||||
|
public static void eventButtonChangeImage(final MainWindows self) {
|
||||||
|
self.testWidget.setPropertyValue(!self.testWidget.getPropertyValue());
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
package sample.atriasoft.ewol.simpleWindowsWithCheckBox;
|
||||||
|
|
||||||
|
import org.atriasoft.etk.Uri;
|
||||||
|
import org.atriasoft.ewol.Ewol;
|
||||||
|
|
||||||
|
public class SimpleWindowsWithCheckBoxMain {
|
||||||
|
public static void main(final String[] args) {
|
||||||
|
Ewol.init();
|
||||||
|
//Uri.addLibrary("test-data", SimpleWindowsWithImageMain.class, "test-ewol/");
|
||||||
|
Uri.setApplication(SimpleWindowsWithCheckBoxMain.class, "test-ewol/");
|
||||||
|
Ewol.run(new Appl(), args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SimpleWindowsWithCheckBoxMain() {}
|
||||||
|
}
|
@ -21,6 +21,7 @@ import org.atriasoft.ewol.resource.font.GlyphProperty;
|
|||||||
import org.atriasoft.exml.Exml;
|
import org.atriasoft.exml.Exml;
|
||||||
import org.atriasoft.exml.exception.ExmlAttributeDoesNotExist;
|
import org.atriasoft.exml.exception.ExmlAttributeDoesNotExist;
|
||||||
import org.atriasoft.exml.exception.ExmlBuilderException;
|
import org.atriasoft.exml.exception.ExmlBuilderException;
|
||||||
|
import org.atriasoft.exml.exception.ExmlException;
|
||||||
import org.atriasoft.exml.exception.ExmlNodeDoesNotExist;
|
import org.atriasoft.exml.exception.ExmlNodeDoesNotExist;
|
||||||
import org.atriasoft.exml.exception.ExmlParserErrorMulti;
|
import org.atriasoft.exml.exception.ExmlParserErrorMulti;
|
||||||
import org.atriasoft.exml.model.XmlElement;
|
import org.atriasoft.exml.model.XmlElement;
|
||||||
@ -805,6 +806,9 @@ public abstract class TextBase extends Compositing {
|
|||||||
} catch (final ExmlNodeDoesNotExist e) {
|
} catch (final ExmlNodeDoesNotExist e) {
|
||||||
Log.error("Error in finding node from XML data in printHTML:" + e.getMessage());
|
Log.error("Error in finding node from XML data in printHTML:" + e.getMessage());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
} catch (ExmlException e) {
|
||||||
|
Log.error("Error in finding node from XML data in printHTML:" + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,14 +3,12 @@ package org.atriasoft.ewol.widget;
|
|||||||
import org.atriasoft.esignal.Connection;
|
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.Uri;
|
import org.atriasoft.etk.Uri;
|
||||||
import org.atriasoft.etk.math.Vector2f;
|
import org.atriasoft.etk.math.Vector2f;
|
||||||
import org.atriasoft.etk.math.Vector2i;
|
import org.atriasoft.etk.math.Vector2i;
|
||||||
import org.atriasoft.ewol.Padding;
|
import org.atriasoft.ewol.Padding;
|
||||||
import org.atriasoft.ewol.annotation.EwolDescription;
|
import org.atriasoft.ewol.annotation.EwolDescription;
|
||||||
import org.atriasoft.ewol.annotation.EwolSignal;
|
import org.atriasoft.ewol.annotation.EwolSignal;
|
||||||
import org.atriasoft.ewol.compositing.CompositingGraphicContext;
|
|
||||||
import org.atriasoft.ewol.compositing.GuiShape;
|
import org.atriasoft.ewol.compositing.GuiShape;
|
||||||
import org.atriasoft.ewol.compositing.GuiShapeMode;
|
import org.atriasoft.ewol.compositing.GuiShapeMode;
|
||||||
import org.atriasoft.ewol.event.EventInput;
|
import org.atriasoft.ewol.event.EventInput;
|
||||||
@ -45,12 +43,12 @@ public class CheckBox extends Widget {
|
|||||||
/// color property of the text foreground
|
/// color property of the text foreground
|
||||||
private int colorIdTextFg;
|
private int colorIdTextFg;
|
||||||
/// text display this.text
|
/// text display this.text
|
||||||
private final CompositingGraphicContext gc = new CompositingGraphicContext();
|
//private final CompositingGraphicContext gc = new CompositingGraphicContext();
|
||||||
/// Periodic call handle to remove it when needed
|
/// Periodic call handle to remove it when needed
|
||||||
protected Connection periodicConnectionHanble = new Connection();
|
protected Connection periodicConnectionHanble = new Connection();
|
||||||
private Uri propertyConfig = new Uri("THEME", "shape/CheckBox.json", "ewol");
|
private Uri propertyConfig = new Uri("THEME", "shape/CheckBox.json", "ewol");
|
||||||
|
|
||||||
private String propertyValue = "Test Text..."; //!< string that must be displayed
|
private Boolean propertyValue = false; //!< string that must be displayed
|
||||||
|
|
||||||
private GuiShape shape;
|
private GuiShape shape;
|
||||||
@EwolSignal(name = "down", description = "CheckBox is Down")
|
@EwolSignal(name = "down", description = "CheckBox is Down")
|
||||||
@ -70,7 +68,7 @@ public class CheckBox extends Widget {
|
|||||||
/**
|
/**
|
||||||
* Constuctor
|
* Constuctor
|
||||||
*/
|
*/
|
||||||
public Button() {
|
public CheckBox() {
|
||||||
this.propertyCanFocus = true;
|
this.propertyCanFocus = true;
|
||||||
onChangePropertyShaper();
|
onChangePropertyShaper();
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
@ -86,7 +84,7 @@ public class CheckBox extends Widget {
|
|||||||
if (this.shape != null) {
|
if (this.shape != null) {
|
||||||
padding = this.shape.getPadding();
|
padding = this.shape.getPadding();
|
||||||
}
|
}
|
||||||
Vector2i minHeight = this.gc.calculateTextSize(this.propertyValue);
|
Vector2i minHeight = Vector2i.VALUE_16;
|
||||||
|
|
||||||
Vector2f minimumSizeBase = new Vector2f(minHeight.x(), minHeight.y());
|
Vector2f minimumSizeBase = new Vector2f(minHeight.x(), minHeight.y());
|
||||||
// add padding :
|
// add padding :
|
||||||
@ -101,7 +99,7 @@ public class CheckBox extends Widget {
|
|||||||
if (this.shape.changeStatusIn(newStatusId)) {
|
if (this.shape.changeStatusIn(newStatusId)) {
|
||||||
if (!this.periodicConnectionHanble.isConnected()) {
|
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);
|
this.periodicConnectionHanble = EwolObject.getObjectManager().periodicCall.connect(this, CheckBox::periodicCall);
|
||||||
}
|
}
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
@ -118,8 +116,8 @@ public class CheckBox extends Widget {
|
|||||||
@XmlManaged
|
@XmlManaged
|
||||||
@XmlAttribute
|
@XmlAttribute
|
||||||
@XmlName(value = "value")
|
@XmlName(value = "value")
|
||||||
@EwolDescription(value = "Value display in the entry (decorated text)")
|
@EwolDescription(value = "State of the checkbox")
|
||||||
public String getPropertyValue() {
|
public Boolean getPropertyValue() {
|
||||||
return this.propertyValue;
|
return this.propertyValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,14 +135,14 @@ public class CheckBox extends Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void onChangePropertyValue() {
|
protected void onChangePropertyValue() {
|
||||||
String newData = this.propertyValue;
|
//Boolean newData = this.propertyValue;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDraw() {
|
protected void onDraw() {
|
||||||
if (this.shape != null) {
|
if (this.shape != null) {
|
||||||
this.shape.draw(this.gc.getResourceTexture(), true);
|
//this.shape.draw(this.gc.getResourceTexture(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +198,7 @@ public class CheckBox extends Widget {
|
|||||||
}
|
}
|
||||||
//Log.verbose("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
|
//Log.verbose("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
|
||||||
this.shape.clear();
|
this.shape.clear();
|
||||||
this.gc.clear();
|
//this.gc.clear();
|
||||||
if (this.colorIdTextFg >= 0) {
|
if (this.colorIdTextFg >= 0) {
|
||||||
//this.text.setDefaultColorFg(this.shape.getColor(this.colorIdTextFg));
|
//this.text.setDefaultColorFg(this.shape.getColor(this.colorIdTextFg));
|
||||||
//this.text.setDefaultColorBg(this.shape.getColor(this.colorIdTextBg));
|
//this.text.setDefaultColorBg(this.shape.getColor(this.colorIdTextBg));
|
||||||
@ -220,7 +218,7 @@ public class CheckBox extends Widget {
|
|||||||
Vector2f tmpOriginShaper = this.size.less(tmpSizeShaper).multiply(0.5f);
|
Vector2f tmpOriginShaper = this.size.less(tmpSizeShaper).multiply(0.5f);
|
||||||
Vector2f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y());
|
Vector2f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y());
|
||||||
//Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
|
//Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
|
||||||
Vector2f tmpOriginText = new Vector2f(0, this.gc.getTextSize());
|
Vector2f tmpOriginText = 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 ...
|
// 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();
|
int minHeight = this.gc.getTextHeight();
|
||||||
@ -234,17 +232,17 @@ public class CheckBox extends Widget {
|
|||||||
tmpSizeText = Vector2f.clipInt(tmpSizeText);
|
tmpSizeText = Vector2f.clipInt(tmpSizeText);
|
||||||
tmpOriginText = Vector2f.clipInt(tmpOriginText);
|
tmpOriginText = Vector2f.clipInt(tmpOriginText);
|
||||||
|
|
||||||
this.gc.clear();
|
//this.gc.clear();
|
||||||
this.gc.setSize((int)tmpSizeText.x(), (int)tmpSizeText.y());
|
//this.gc.setSize((int)tmpSizeText.x(), (int)tmpSizeText.y());
|
||||||
|
|
||||||
this.gc.setColorFill(Color.BLACK);
|
//this.gc.setColorFill(Color.BLACK);
|
||||||
this.gc.setColorStroke(Color.NONE);
|
//this.gc.setColorStroke(Color.NONE);
|
||||||
this.gc.setStrokeWidth(1);
|
//this.gc.setStrokeWidth(1);
|
||||||
this.gc.text(tmpOriginText, this.propertyValue);
|
//this.gc.text(tmpOriginText, this.propertyValue);
|
||||||
this.overPositionStart = tmpOriginShaper;
|
this.overPositionStart = tmpOriginShaper;
|
||||||
this.overPositionStop = tmpOriginShaper.add(tmpSizeShaper);
|
this.overPositionStop = tmpOriginShaper.add(tmpSizeShaper);
|
||||||
this.shape.setShape(tmpOriginShaper, tmpSizeShaper, tmpOriginText, tmpSizeText);
|
this.shape.setShape(tmpOriginShaper, tmpSizeShaper, tmpOriginText, tmpSizeText);
|
||||||
this.gc.flush();
|
//this.gc.flush();
|
||||||
this.shape.flush();
|
this.shape.flush();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -253,7 +251,7 @@ public class CheckBox extends Widget {
|
|||||||
* Periodic call to update grapgic display
|
* Periodic call to update grapgic display
|
||||||
* @param _event Time generic event
|
* @param _event Time generic event
|
||||||
*/
|
*/
|
||||||
protected static void periodicCall(final Button self, final EventTime event) {
|
protected static void periodicCall(final CheckBox self, final EventTime event) {
|
||||||
Log.verbose("Periodic call on Entry(" + event + ")");
|
Log.verbose("Periodic call on Entry(" + event + ")");
|
||||||
if (!self.shape.periodicCall(event)) {
|
if (!self.shape.periodicCall(event)) {
|
||||||
self.periodicConnectionHanble.close();
|
self.periodicConnectionHanble.close();
|
||||||
@ -265,25 +263,7 @@ public class CheckBox extends Widget {
|
|||||||
* internal check the value with RegExp checking
|
* internal check the value with RegExp checking
|
||||||
* @param newData The new string to display
|
* @param newData The new string to display
|
||||||
*/
|
*/
|
||||||
protected void setInternalValue(final String newData) {
|
protected void setInternalValue(final Boolean newData) {
|
||||||
String previous = this.propertyValue;
|
|
||||||
// check the RegExp :
|
|
||||||
if (newData.length() > 0) {
|
|
||||||
/*
|
|
||||||
if (this.regex.parse(_newData, 0, _newData.size()) == false) {
|
|
||||||
Log.info("The input data does not match with the regExp '" + _newData + "' Regex='" + propertyRegex + "'" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.regex.start() != 0) {
|
|
||||||
Log.info("The input data does not match with the regExp '" + _newData + "' Regex='" + propertyRegex + "' (start position error)" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (this.regex.stop() != _newData.size()) {
|
|
||||||
Log.info("The input data does not match with the regExp '" + _newData + "' Regex='" + propertyRegex + "' (stop position error)" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
this.propertyValue = newData;
|
this.propertyValue = newData;
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
@ -297,7 +277,7 @@ public class CheckBox extends Widget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setPropertyValue(final String propertyValue) {
|
public void setPropertyValue(final Boolean propertyValue) {
|
||||||
if (this.propertyValue.equals(propertyValue)) {
|
if (this.propertyValue.equals(propertyValue)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user