[DEV] update the border model of windet and set back the model of button with subObject
This commit is contained in:
parent
066d067a41
commit
93d6f70765
@ -22,240 +22,6 @@ ewol::widget::Container2::~Container2() {
|
||||
subWidgetRemoveToggle();
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::setSubWidget(Widget _newWidget, int _idWidget) {
|
||||
subWidgetRemove(_idWidget);
|
||||
this.subWidget[_idWidget] = _newWidget;
|
||||
if (this.subWidget[_idWidget] != null) {
|
||||
Log.verbose("Add widget : " + _idWidget);
|
||||
this.subWidget[_idWidget].setParent(sharedFromThis());
|
||||
}
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::subWidgetReplace( Widget _oldWidget,
|
||||
Widget _newWidget) {
|
||||
boolean haveChange = false;
|
||||
for (int iii=0; iii<2; ++iii) {
|
||||
if (this.subWidget[iii] != _oldWidget) {
|
||||
continue;
|
||||
}
|
||||
this.subWidget[iii].removeParent();
|
||||
this.subWidget[iii].reset();
|
||||
this.subWidget[iii] = _newWidget;
|
||||
if (this.subWidget[iii] != null) {
|
||||
this.subWidget[iii].setParent(sharedFromThis());
|
||||
}
|
||||
haveChange = true;
|
||||
}
|
||||
if (haveChange == false) {
|
||||
Log.warning("Request replace with a wrong old widget");
|
||||
return;
|
||||
}
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
|
||||
void ewol::widget::Container2::subWidgetRemove(int _idWidget) {
|
||||
if (this.subWidget[_idWidget] != null) {
|
||||
Log.verbose("Remove widget : " + _idWidget);
|
||||
this.subWidget[_idWidget].removeParent();
|
||||
this.subWidget[_idWidget].reset();
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::subWidgetUnLink(int _idWidget) {
|
||||
if (this.subWidget[_idWidget] != null) {
|
||||
this.subWidget[_idWidget].removeParent();
|
||||
Log.verbose("Unlink widget : " + _idWidget);
|
||||
}
|
||||
this.subWidget[_idWidget].reset();
|
||||
}
|
||||
|
||||
EwolObject ewol::widget::Container2::getSubObjectNamed( String _widgetName) {
|
||||
EwolObject tmpObject = Widget::getSubObjectNamed(_widgetName);
|
||||
if (tmpObject != null) {
|
||||
return tmpObject;
|
||||
}
|
||||
if (this.subWidget[0] != null) {
|
||||
tmpObject = this.subWidget[0].getSubObjectNamed(_widgetName);
|
||||
if (tmpObject != null) {
|
||||
return tmpObject;
|
||||
}
|
||||
}
|
||||
if (this.subWidget[1] != null) {
|
||||
return this.subWidget[1].getSubObjectNamed(_widgetName);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::systemDraw( ewol::DrawProperty _displayProp) {
|
||||
if (propertyHide.get() == true){
|
||||
// widget is hidden ...
|
||||
return;
|
||||
}
|
||||
Widget::systemDraw(_displayProp);
|
||||
if (this.subWidget[this.idWidgetDisplayed] != null) {
|
||||
//Log.info("Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" + this.size);
|
||||
this.subWidget[this.idWidgetDisplayed].systemDraw(_displayProp);
|
||||
}
|
||||
}
|
||||
|
||||
ewol::Padding ewol::widget::Container2::onChangeSizePadded( ewol::Padding _padding) {
|
||||
Widget::onChangeSize();
|
||||
Vector2f localAvaillable = this.size - Vector2f(_padding.x(), _padding.y());
|
||||
// Checkin the filling properties == > for the subElements:
|
||||
Vector2f subElementSize = this.minSize;
|
||||
if (propertyFill.x() == true) {
|
||||
subElementSize.setX(this.size.x());
|
||||
}
|
||||
if (propertyFill.y() == true) {
|
||||
subElementSize.setY(this.size.y());
|
||||
}
|
||||
Vector2f delta = ewol::gravityGenerateDelta(propertyGravity, this.size - subElementSize);
|
||||
Vector2f origin = delta + Vector2f(_padding.xLeft(), _padding.yButtom());
|
||||
subElementSize -= Vector2f(_padding.x(), _padding.y());
|
||||
for (int iii = 0; iii < 2; ++iii) {
|
||||
if (this.subWidget[iii] != null) {
|
||||
Vector2f origin2 = origin+this.offset;
|
||||
Vector2f minSize = this.subWidget[iii].getCalculateMinSize();
|
||||
//Vector2b expand = this.subWidget[iii].propertyExpand.get();
|
||||
origin2 += ewol::gravityGenerateDelta(propertyGravity, minSize - localAvaillable);
|
||||
this.subWidget[iii].setOrigin(this.origin + origin);
|
||||
this.subWidget[iii].setSize(subElementSize);
|
||||
this.subWidget[iii].onChangeSize();
|
||||
}
|
||||
}
|
||||
Vector2f selectableAreaPos = origin-Vector2f(_padding.xLeft(), _padding.yButtom());
|
||||
Vector2f selectableAreaEndPos = this.size - (selectableAreaPos + subElementSize + Vector2f(_padding.x(), _padding.y()));
|
||||
markToRedraw();
|
||||
return ewol::Padding(selectableAreaPos.x(),
|
||||
selectableAreaEndPos.y(),
|
||||
selectableAreaEndPos.x(),
|
||||
selectableAreaPos.y());
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::calculateMinMaxSizePadded( ewol::Padding _padding) {
|
||||
// call main class
|
||||
this.minSize = Vector2f(0,0);
|
||||
// call sub classes
|
||||
for (int iii = 0; iii < 2; ++iii) {
|
||||
if (this.subWidget[iii] != null) {
|
||||
this.subWidget[iii].calculateMinMaxSize();
|
||||
Vector2f min = this.subWidget[iii].getCalculateMinSize();
|
||||
this.minSize.setMax(min);
|
||||
}
|
||||
}
|
||||
// add padding :
|
||||
this.minSize += Vector2f(_padding.x(), _padding.y());
|
||||
// verify the min max of the min size ...
|
||||
checkMinSize();
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::onRegenerateDisplay() {
|
||||
if (this.subWidget[this.idWidgetDisplayed] != null) {
|
||||
this.subWidget[this.idWidgetDisplayed].onRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
/*
|
||||
Widget ewol::widget::Container2::getWidgetAtPos( Vector2f _pos) {
|
||||
if (isHide() == false) {
|
||||
if (this.subWidget[this.idWidgetDisplayed] != null) {
|
||||
return this.subWidget[this.idWidgetDisplayed].getWidgetAtPos(_pos);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
|
||||
boolean ewol::widget::Container2::loadXML( exml::Element _node) {
|
||||
if (_node.exist() == false) {
|
||||
return false;
|
||||
}
|
||||
// parse generic properties :
|
||||
Widget::loadXML(_node);
|
||||
// remove previous element :
|
||||
subWidgetRemove();
|
||||
Log.verbose("Create en element 2 ... with nodes.size()=" + _node.nodes.size());
|
||||
// parse all the elements:
|
||||
for( auto it : _node.nodes) {
|
||||
Log.verbose(" node: " + it);
|
||||
exml::Element pNode = it.toElement();
|
||||
if (pNode.exist() == false) {
|
||||
// trash here all that is not element
|
||||
continue;
|
||||
}
|
||||
String widgetName = pNode.getValue();
|
||||
if (getWidgetManager().exist(widgetName) == false) {
|
||||
Log.error("(l " + pNode.getPos() + ") Unknown basic node='" + widgetName + "' not in: [" + getWidgetManager().list() + "]" );
|
||||
continue;
|
||||
}
|
||||
boolean toogleMode=false;
|
||||
if (getSubWidget() != null) {
|
||||
toogleMode=true;
|
||||
if (getSubWidgetToggle() != null) {
|
||||
Log.error("(l " + pNode.getPos() + ") Can only have one subWidget ??? node='" + widgetName + "'" );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Log.debug("try to create subwidget : '" + widgetName + "'");
|
||||
Widget tmpWidget = getWidgetManager().create(widgetName, pNode);
|
||||
if (tmpWidget == null) {
|
||||
EWOL_ERROR ("(l " + pNode.getPos() + ") Can not create the widget: '" + widgetName + "'");
|
||||
continue;
|
||||
}
|
||||
// add widget :
|
||||
if (toogleMode == false) {
|
||||
setSubWidget(tmpWidget);
|
||||
} else {
|
||||
setSubWidgetToggle(tmpWidget);
|
||||
}
|
||||
if (tmpWidget.loadXML(pNode) == false) {
|
||||
EWOL_ERROR ("(l "+pNode.getPos()+") can not load widget properties: '" + widgetName + "'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::setOffset( Vector2f _newVal) {
|
||||
if (this.offset != _newVal) {
|
||||
Widget::setOffset(_newVal);
|
||||
// recalculate the new sise and position of sub widget ...
|
||||
calculateSize();
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::requestDestroyFromChild( EwolObject _child) {
|
||||
if (this.subWidget[0] == _child) {
|
||||
if (this.subWidget[0] == null) {
|
||||
return;
|
||||
}
|
||||
this.subWidget[0].removeParent();
|
||||
this.subWidget[0].reset();
|
||||
markToRedraw();
|
||||
}
|
||||
if (this.subWidget[1] == _child) {
|
||||
if (this.subWidget[1] == null) {
|
||||
return;
|
||||
}
|
||||
this.subWidget[1].removeParent();
|
||||
this.subWidget[1].reset();
|
||||
markToRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::widget::Container2::drawWidgetTree(int _level) {
|
||||
Widget::drawWidgetTree(_level);
|
||||
_level++;
|
||||
if (this.subWidget[0] != null) {
|
||||
this.subWidget[0].drawWidgetTree(_level);
|
||||
}
|
||||
if (this.subWidget[1] != null) {
|
||||
this.subWidget[1].drawWidgetTree(_level);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package sample.atriasoft.ewol;
|
||||
|
||||
import org.atriasoft.etk.Color;
|
||||
import org.atriasoft.etk.Dimension;
|
||||
import org.atriasoft.etk.Dimension3f;
|
||||
import org.atriasoft.etk.Distance;
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3b;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.Gravity;
|
||||
import org.atriasoft.ewol.widget.Button;
|
||||
import org.atriasoft.ewol.widget.Sizer;
|
||||
@ -16,43 +16,45 @@ import org.atriasoft.ewol.widget.Windows;
|
||||
public class BasicWindows extends Windows {
|
||||
public static void eventButtonChangeGravity(final BasicWindows self) {
|
||||
Gravity state = self.testWidget.getPropertyGravity();
|
||||
state = switch (state) {
|
||||
case BUTTOM -> Gravity.BUTTOM_LEFT;
|
||||
case BUTTOM_LEFT -> Gravity.BUTTOM_RIGHT;
|
||||
// TODO: I change the gravity model to integrate the 3rd rank...
|
||||
/*state = switch (state) {
|
||||
case BUTTOM -> Gravity.BOTTOM_LEFT;
|
||||
case BUTTOM_LEFT -> Gravity.BOTTOM_RIGHT;
|
||||
case BUTTOM_RIGHT -> Gravity.CENTER;
|
||||
case CENTER -> Gravity.LEFT;
|
||||
case LEFT -> Gravity.RIGHT;
|
||||
case RIGHT -> Gravity.TOP;
|
||||
case TOP -> Gravity.TOP_LEFT;
|
||||
case TOP_LEFT -> Gravity.TOP_RIGHT;
|
||||
case TOP_RIGHT -> Gravity.BUTTOM;
|
||||
case TOP_RIGHT -> Gravity.BOTTOM;
|
||||
};
|
||||
*/
|
||||
self.testWidget.setPropertyGravity(state);
|
||||
self.buttonGravity.setPropertyValue("gravity: " + state);
|
||||
//self.buttonGravity.setPropertyValue("gravity: " + state);
|
||||
}
|
||||
|
||||
public static void eventButtonExpandX(final BasicWindows self) {
|
||||
Vector2b state = self.testWidget.getPropertyExpand();
|
||||
Vector3b state = self.testWidget.getPropertyExpand();
|
||||
self.testWidget.setPropertyExpand(state.withX(!state.x()));
|
||||
self.buttonExpandX.setPropertyValue(state.x() ? "expand X" : "un-expand X");
|
||||
//self.buttonExpandX.setPropertyValue(state.x() ? "expand X" : "un-expand X");
|
||||
}
|
||||
|
||||
public static void eventButtonExpandY(final BasicWindows self) {
|
||||
Vector2b state = self.testWidget.getPropertyExpand();
|
||||
Vector3b state = self.testWidget.getPropertyExpand();
|
||||
self.testWidget.setPropertyExpand(state.withY(!state.y()));
|
||||
self.buttonExpandY.setPropertyValue(state.y() ? "expand Y" : "un-expand Y");
|
||||
//self.buttonExpandY.setPropertyValue(state.y() ? "expand Y" : "un-expand Y");
|
||||
}
|
||||
|
||||
public static void eventButtonFillX(final BasicWindows self) {
|
||||
Vector2b state = self.testWidget.getPropertyFill();
|
||||
Vector3b state = self.testWidget.getPropertyFill();
|
||||
self.testWidget.setPropertyFill(state.withX(!state.x()));
|
||||
self.buttonFillX.setPropertyValue(state.x() ? "fill X" : "un-fill X");
|
||||
//self.buttonFillX.setPropertyValue(state.x() ? "fill X" : "un-fill X");
|
||||
}
|
||||
|
||||
public static void eventButtonFillY(final BasicWindows self) {
|
||||
Vector2b state = self.testWidget.getPropertyFill();
|
||||
Vector3b state = self.testWidget.getPropertyFill();
|
||||
self.testWidget.setPropertyFill(state.withY(!state.y()));
|
||||
self.buttonFillY.setPropertyValue(state.y() ? "fill Y" : "un-fill Y");
|
||||
//self.buttonFillY.setPropertyValue(state.y() ? "fill Y" : "un-fill Y");
|
||||
}
|
||||
|
||||
Widget testWidget;
|
||||
@ -69,97 +71,93 @@ public class BasicWindows extends Windows {
|
||||
setPropertyTitle("No title set !!! for this test");
|
||||
|
||||
Sizer sizerVertMain = new Sizer(DisplayMode.modeVert);
|
||||
sizerVertMain.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
sizerVertMain.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
sizerVertMain.setPropertyExpand(Vector3b.TRUE);
|
||||
sizerVertMain.setPropertyFill(Vector3b.TRUE);
|
||||
setSubWidget(sizerVertMain);
|
||||
|
||||
this.sizerMenuHori = new Sizer(DisplayMode.modeHori);
|
||||
this.sizerMenuHori.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
this.sizerMenuHori.setPropertyLockExpand(Vector2b.TRUE_TRUE);
|
||||
this.sizerMenuHori.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
this.sizerMenuHori.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE);
|
||||
this.sizerMenuHori.setPropertyLockExpand(Vector3b.TRUE);
|
||||
this.sizerMenuHori.setPropertyFill(Vector3b.TRUE);
|
||||
sizerVertMain.subWidgetAdd(this.sizerMenuHori);
|
||||
|
||||
{
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(100, 100), Distance.PIXEL));
|
||||
simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_128, Distance.PIXEL));
|
||||
simpleSpacer.setPropertyColor(Color.ALICE_BLUE);
|
||||
simpleSpacer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
simpleSpacer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE);
|
||||
simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
sizerVertMain.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
|
||||
this.sizerTestAreaHori = new Sizer(DisplayMode.modeHori);
|
||||
this.sizerTestAreaHori.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
this.sizerTestAreaHori.setPropertyExpandIfFree(Vector2b.TRUE_TRUE);
|
||||
this.sizerTestAreaHori.setPropertyFill(Vector2b.TRUE_FALSE);
|
||||
this.sizerTestAreaHori.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE);
|
||||
this.sizerTestAreaHori.setPropertyExpandIfFree(Vector3b.TRUE);
|
||||
this.sizerTestAreaHori.setPropertyFill(Vector3b.TRUE_FALSE_FALSE);
|
||||
sizerVertMain.subWidgetAdd(this.sizerTestAreaHori);
|
||||
|
||||
{
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyColor(Color.DARK_GREEN);
|
||||
simpleSpacer.setPropertyExpand(Vector2b.TRUE_FALSE);
|
||||
simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
simpleSpacer.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE);
|
||||
simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
sizerVertMain.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
|
||||
{
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyColor(Color.PINK);
|
||||
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(30, 30), Distance.PIXEL));
|
||||
simpleSpacer.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyMinSize(new Dimension3f(new Vector3f(30, 30, 30), Distance.PIXEL));
|
||||
this.sizerMenuHori.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
/*
|
||||
{
|
||||
this.buttonExpandX = new Button();
|
||||
this.buttonExpandX.setPropertyValue("un-expand X");
|
||||
this.buttonExpandX.setPropertyExpand(Vector2b.FALSE_FALSE);
|
||||
this.buttonExpandX.setPropertyFill(Vector2b.FALSE_FALSE);
|
||||
this.buttonExpandX.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
this.buttonExpandX = Button.createLabelButton("un-expand X");
|
||||
this.buttonExpandX.setPropertyExpand(Vector3b.FALSE);
|
||||
this.buttonExpandX.setPropertyFill(Vector3b.FALSE);
|
||||
this.buttonExpandX.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
this.sizerMenuHori.subWidgetAdd(this.buttonExpandX);
|
||||
this.buttonExpandX.signalClick.connectAuto(this, BasicWindows::eventButtonExpandX);
|
||||
}
|
||||
{
|
||||
this.buttonExpandY = new Button();
|
||||
this.buttonExpandY.setPropertyValue("un-expand Y");
|
||||
this.buttonExpandY.setPropertyExpand(Vector2b.FALSE_FALSE);
|
||||
this.buttonExpandY.setPropertyFill(Vector2b.FALSE_FALSE);
|
||||
this.buttonExpandY.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
this.buttonExpandY = Button.createLabelButton("un-expand Y");
|
||||
this.buttonExpandY.setPropertyExpand(Vector3b.FALSE);
|
||||
this.buttonExpandY.setPropertyFill(Vector3b.FALSE);
|
||||
this.buttonExpandY.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
this.sizerMenuHori.subWidgetAdd(this.buttonExpandY);
|
||||
this.buttonExpandY.signalClick.connectAuto(this, BasicWindows::eventButtonExpandY);
|
||||
}
|
||||
{
|
||||
this.buttonFillX = new Button();
|
||||
this.buttonFillX.setPropertyValue("un-fill X");
|
||||
this.buttonFillX.setPropertyExpand(Vector2b.FALSE_FALSE);
|
||||
this.buttonFillX.setPropertyFill(Vector2b.FALSE_FALSE);
|
||||
this.buttonFillX.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
this.buttonFillX = Button.createLabelButton("un-fill X");
|
||||
this.buttonFillX.setPropertyExpand(Vector3b.FALSE);
|
||||
this.buttonFillX.setPropertyFill(Vector3b.FALSE);
|
||||
this.buttonFillX.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
this.sizerMenuHori.subWidgetAdd(this.buttonFillX);
|
||||
this.buttonFillX.signalClick.connectAuto(this, BasicWindows::eventButtonFillX);
|
||||
}
|
||||
{
|
||||
this.buttonFillY = new Button();
|
||||
this.buttonFillY.setPropertyValue("un-fill Y");
|
||||
this.buttonFillY.setPropertyExpand(Vector2b.FALSE_FALSE);
|
||||
this.buttonFillY.setPropertyFill(Vector2b.FALSE_FALSE);
|
||||
this.buttonFillY.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
this.buttonFillY = Button.createLabelButton("un-fill Y");
|
||||
this.buttonFillY.setPropertyExpand(Vector3b.FALSE);
|
||||
this.buttonFillY.setPropertyFill(Vector3b.FALSE);
|
||||
this.buttonFillY.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
this.sizerMenuHori.subWidgetAdd(this.buttonFillY);
|
||||
this.buttonFillY.signalClick.connectAuto(this, BasicWindows::eventButtonFillY);
|
||||
}
|
||||
{
|
||||
this.buttonGravity = new Button();
|
||||
this.buttonGravity.setPropertyValue("gravity");
|
||||
this.buttonGravity.setPropertyExpand(Vector2b.FALSE_FALSE);
|
||||
this.buttonGravity.setPropertyFill(Vector2b.FALSE_FALSE);
|
||||
this.buttonGravity.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
this.buttonGravity = Button.createLabelButton("gravity");
|
||||
this.buttonGravity.setPropertyExpand(Vector3b.FALSE);
|
||||
this.buttonGravity.setPropertyFill(Vector3b.FALSE);
|
||||
this.buttonGravity.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
this.sizerMenuHori.subWidgetAdd(this.buttonGravity);
|
||||
this.buttonGravity.signalClick.connectAuto(this, BasicWindows::eventButtonChangeGravity);
|
||||
}
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
public void addButton(Widget widget) {
|
||||
@ -171,10 +169,10 @@ public class BasicWindows extends Windows {
|
||||
{
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyColor(Color.CHOCOLATE);
|
||||
simpleSpacer.setPropertyExpand(Vector2b.FALSE_FALSE);
|
||||
simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
simpleSpacer.setPropertyExpand(Vector3b.FALSE);
|
||||
simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
this.sizerTestAreaHori.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
this.testWidget = widget;
|
||||
@ -182,10 +180,10 @@ public class BasicWindows extends Windows {
|
||||
{
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyColor(Color.GREEN_YELLOW);
|
||||
simpleSpacer.setPropertyExpand(Vector2b.FALSE_FALSE);
|
||||
simpleSpacer.setPropertyExpandIfFree(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
simpleSpacer.setPropertyExpand(Vector3b.FALSE);
|
||||
simpleSpacer.setPropertyExpandIfFree(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
this.sizerTestAreaHori.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package sample.atriasoft.ewol.ComplexWindiows1;
|
||||
|
||||
import org.atriasoft.etk.Color;
|
||||
import org.atriasoft.etk.Dimension;
|
||||
import org.atriasoft.etk.Dimension3f;
|
||||
import org.atriasoft.etk.Distance;
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3b;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.widget.Sizer;
|
||||
import org.atriasoft.ewol.widget.Sizer.DisplayMode;
|
||||
import org.atriasoft.ewol.widget.Spacer;
|
||||
@ -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(Vector2b.TRUE_TRUE);
|
||||
sizerMain.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
sizerMain.setPropertyExpand(Vector3b.TRUE);
|
||||
sizerMain.setPropertyFill(Vector3b.TRUE);
|
||||
setSubWidget(sizerMain);
|
||||
|
||||
Sizer sizerHori1 = new Sizer(DisplayMode.modeHori);
|
||||
sizerHori1.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
sizerHori1.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
sizerHori1.setPropertyExpand(Vector3b.TRUE);
|
||||
sizerHori1.setPropertyFill(Vector3b.TRUE);
|
||||
sizerMain.subWidgetAdd(sizerHori1);
|
||||
|
||||
Sizer sizerHori2 = new Sizer(DisplayMode.modeHori);
|
||||
sizerHori2.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
sizerHori2.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
sizerHori2.setPropertyExpand(Vector3b.TRUE);
|
||||
sizerHori2.setPropertyFill(Vector3b.TRUE);
|
||||
sizerMain.subWidgetAdd(sizerHori2);
|
||||
|
||||
{
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyMinSize(new Dimension(new Vector2f(100, 100), Distance.PIXEL));
|
||||
simpleSpacer.setPropertyMinSize(new Dimension3f(new Vector3f(100, 100, 100), Distance.PIXEL));
|
||||
simpleSpacer.setPropertyColor(Color.ALICE_BLUE);
|
||||
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
sizerHori1.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
{
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyColor(Color.DARK_GREEN);
|
||||
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
sizerHori1.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
{
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyColor(Color.CHOCOLATE);
|
||||
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
sizerHori1.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
{
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyColor(Color.GREEN_YELLOW);
|
||||
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
sizerHori2.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
{
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyColor(Color.PINK);
|
||||
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
sizerHori2.subWidgetAdd(simpleSpacer);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package sample.atriasoft.ewol.sampleButton;
|
||||
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
import org.atriasoft.etk.math.Vector3b;
|
||||
import org.atriasoft.ewol.widget.Button;
|
||||
|
||||
import sample.atriasoft.ewol.BasicWindows;
|
||||
@ -10,10 +10,9 @@ public class MainWindows extends BasicWindows {
|
||||
public MainWindows() {
|
||||
setPropertyTitle("Simple Button test");
|
||||
|
||||
Button simpleButton = new Button();
|
||||
simpleButton.setPropertyValue("Top Button");
|
||||
simpleButton.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
simpleButton.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
Button simpleButton = Button.createLabelButton("Top Button");
|
||||
simpleButton.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleButton.setPropertyFill(Vector3b.TRUE);
|
||||
this.setTestWidget(simpleButton);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package sample.atriasoft.ewol.sampleEntry;
|
||||
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
import org.atriasoft.etk.math.Vector3b;
|
||||
import org.atriasoft.ewol.widget.Entry;
|
||||
|
||||
import sample.atriasoft.ewol.BasicWindows;
|
||||
@ -11,8 +11,8 @@ public class MainWindows extends BasicWindows {
|
||||
setPropertyTitle("Simple Entry test");
|
||||
|
||||
Entry simpleEntry = new Entry();
|
||||
simpleEntry.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
simpleEntry.setPropertyFill(Vector2b.TRUE_FALSE);
|
||||
simpleEntry.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleEntry.setPropertyFill(Vector3b.TRUE_FALSE_FALSE);
|
||||
this.setTestWidget(simpleEntry);
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package sample.atriasoft.ewol.simpleWindowsLabel;
|
||||
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
import org.atriasoft.etk.math.Vector3b;
|
||||
import org.atriasoft.ewol.widget.Label;
|
||||
import org.atriasoft.ewol.widget.Spacer;
|
||||
|
||||
@ -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(Vector2b.TRUE_TRUE);
|
||||
simpleLabel.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleLabel.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleLabel.setPropertyFill(Vector3b.TRUE);
|
||||
this.setTestWidget(simpleLabel);
|
||||
//! [ewol_sample_HW_windows_label]
|
||||
} else {
|
||||
Spacer simpleSpacer = new Spacer();
|
||||
simpleSpacer.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleSpacer.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleSpacer.setPropertyFill(Vector3b.TRUE);
|
||||
this.setTestWidget(simpleSpacer);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package sample.atriasoft.ewol.simpleWindowsWithCheckBox;
|
||||
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
import org.atriasoft.etk.math.Vector3b;
|
||||
import org.atriasoft.ewol.widget.CheckBox;
|
||||
|
||||
import sample.atriasoft.ewol.BasicWindows;
|
||||
@ -15,14 +15,14 @@ public class MainWindows extends BasicWindows {
|
||||
|
||||
this.testWidget = new CheckBox();
|
||||
//this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
|
||||
this.testWidget.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
this.testWidget.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
this.testWidget.setPropertyExpand(Vector3b.TRUE);
|
||||
this.testWidget.setPropertyFill(Vector3b.TRUE);
|
||||
this.setTestWidget(this.testWidget);
|
||||
/*
|
||||
Button simpleButton = new Button();
|
||||
simpleButton.setPropertyValue("Top Button");
|
||||
simpleButton.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
simpleButton.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
simpleButton.setPropertyExpand(Vector3b.TRUE);
|
||||
simpleButton.setPropertyFill(Vector3b.TRUE);
|
||||
this.setTestWidget(simpleButton);
|
||||
*/
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
package sample.atriasoft.ewol.simpleWindowsWithImage;
|
||||
|
||||
import org.atriasoft.etk.Dimension;
|
||||
import org.atriasoft.etk.Dimension3f;
|
||||
import org.atriasoft.etk.Distance;
|
||||
import org.atriasoft.etk.Uri;
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3b;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.widget.Button;
|
||||
import org.atriasoft.ewol.widget.ImageDisplay;
|
||||
|
||||
@ -31,24 +31,22 @@ public class MainWindows extends BasicWindows {
|
||||
|
||||
this.testWidget = new ImageDisplay();
|
||||
this.testWidget.setPropertySource(new Uri("DATA", "mireA.png"));
|
||||
this.testWidget.setPropertyExpand(Vector2b.TRUE_TRUE);
|
||||
this.testWidget.setPropertyFill(Vector2b.TRUE_TRUE);
|
||||
this.testWidget.setPropertyMinSize(new Dimension(Vector2f.VALUE_16, Distance.PIXEL));
|
||||
this.testWidget.setPropertyExpand(Vector3b.TRUE);
|
||||
this.testWidget.setPropertyFill(Vector3b.TRUE);
|
||||
this.testWidget.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
this.setTestWidget(this.testWidget);
|
||||
{
|
||||
Button button = new Button();
|
||||
button.setPropertyValue("Change image");
|
||||
button.setPropertyExpand(Vector2b.FALSE_FALSE);
|
||||
button.setPropertyFill(Vector2b.FALSE_FALSE);
|
||||
button.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
Button button = Button.createLabelButton("Change image");
|
||||
button.setPropertyExpand(Vector3b.FALSE);
|
||||
button.setPropertyFill(Vector3b.FALSE);
|
||||
button.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
this.addButton(button);
|
||||
button.signalClick.connectAuto(this, MainWindows::eventButtonChangeImage);
|
||||
}
|
||||
this.buttonAspectRatio = new Button();
|
||||
this.buttonAspectRatio.setPropertyValue("keep aspect ratio");
|
||||
this.buttonAspectRatio.setPropertyExpand(Vector2b.FALSE_FALSE);
|
||||
this.buttonAspectRatio.setPropertyFill(Vector2b.FALSE_FALSE);
|
||||
this.buttonAspectRatio.setPropertyMinSize(new Dimension(new Vector2f(10, 10), Distance.PIXEL));
|
||||
this.buttonAspectRatio = Button.createLabelButton("keep aspect ratio");
|
||||
this.buttonAspectRatio.setPropertyExpand(Vector3b.FALSE);
|
||||
this.buttonAspectRatio.setPropertyFill(Vector3b.FALSE);
|
||||
this.buttonAspectRatio.setPropertyMinSize(new Dimension3f(Vector3f.VALUE_16, Distance.PIXEL));
|
||||
this.addButton(this.buttonAspectRatio);
|
||||
this.buttonAspectRatio.signalClick.connectAuto(this, MainWindows::eventButtonChangeKeepRatio);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.atriasoft.ewol;
|
||||
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector2i;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.etk.math.Vector3i;
|
||||
|
||||
/**
|
||||
* @file
|
||||
@ -36,26 +36,25 @@ import org.atriasoft.etk.math.Vector2i;
|
||||
(0,0)
|
||||
*/
|
||||
//@formatter:on
|
||||
@SuppressWarnings("preview")
|
||||
public record DrawProperty(
|
||||
Vector2i windowsSize, // !< Windows complete size
|
||||
Vector2i origin, // !< Windows clipping upper widget (can not be <0)
|
||||
Vector2i size// !< Windows clipping upper widget (can not be <0 and >this.windowsSize)
|
||||
Vector3i windowsSize, // !< Windows complete size
|
||||
Vector3i origin, // !< Windows clipping upper widget (can not be <0)
|
||||
Vector3i size// !< Windows clipping upper widget (can not be <0 and >this.windowsSize)
|
||||
) {
|
||||
public DrawProperty() {
|
||||
this(Vector2i.ZERO, Vector2i.ZERO, Vector2i.ZERO);
|
||||
this(Vector3i.ZERO, Vector3i.ZERO, Vector3i.ZERO);
|
||||
}
|
||||
|
||||
public DrawProperty(final Vector2i windowsSize, final Vector2i origin, final Vector2i size) {
|
||||
public DrawProperty(final Vector3i windowsSize, final Vector3i origin, final Vector3i size) {
|
||||
this.windowsSize = windowsSize;
|
||||
this.origin = origin;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public DrawProperty withLimit(final Vector2f originIn, final Vector2f size) {
|
||||
Vector2i tmpSize = this.size.add(this.origin);
|
||||
Vector2i origin = this.origin.max((int) originIn.x(), (int) originIn.y());
|
||||
tmpSize = tmpSize.min((int) (originIn.x() + size.x()), (int) (originIn.y() + size.y()));
|
||||
public DrawProperty withLimit(final Vector3f originIn, final Vector3f size) {
|
||||
Vector3i tmpSize = this.size.add(this.origin);
|
||||
Vector3i origin = this.origin.max((int) originIn.x(), (int) originIn.y(), (int) originIn.z());
|
||||
tmpSize = tmpSize.min((int) (originIn.x() + size.x()), (int) (originIn.y() + size.y()), (int) (originIn.z() + size.z()));
|
||||
tmpSize = tmpSize.less(origin);
|
||||
return new DrawProperty(this.windowsSize, origin, tmpSize);
|
||||
}
|
||||
|
@ -5,45 +5,104 @@
|
||||
*/
|
||||
package org.atriasoft.ewol;
|
||||
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
|
||||
/**
|
||||
* Gravity of the widget property
|
||||
*/
|
||||
public enum Gravity {
|
||||
BUTTOM, // !< gravity is in center
|
||||
BUTTOM_LEFT, // !< gravity is in top
|
||||
BUTTOM_RIGHT, // !< gravity is in buttom
|
||||
CENTER, // !< gravity is in right
|
||||
LEFT, // !< gravity is in left
|
||||
RIGHT, // !< gravity is in top-right
|
||||
TOP, // !< gravity is in top-left
|
||||
TOP_LEFT, // !< gravity is in buttom-right
|
||||
TOP_RIGHT; // !< gravity is in buttom-left
|
||||
public record Gravity(
|
||||
GravityHorizontal x,
|
||||
GravityVertical y,
|
||||
GravityDepth z) {
|
||||
|
||||
public static Vector2f gravityGenerateDelta(final Gravity gravity, final Vector2f deltas) {
|
||||
public static final Gravity BOTTOM = new Gravity(GravityHorizontal.CENTER, GravityVertical.BOTTOM, GravityDepth.CENTER); // !< gravity is in center
|
||||
public static final Gravity BOTTOM_LEFT = new Gravity(GravityHorizontal.LEFT, GravityVertical.BOTTOM, GravityDepth.CENTER); // !< gravity is in top
|
||||
public static final Gravity BOTTOM_RIGHT = new Gravity(GravityHorizontal.RIGHT, GravityVertical.BOTTOM, GravityDepth.CENTER); // !< gravity is in bottom
|
||||
public static final Gravity CENTER = new Gravity(GravityHorizontal.CENTER, GravityVertical.CENTER, GravityDepth.CENTER); // !< gravity is in right
|
||||
public static final Gravity LEFT = new Gravity(GravityHorizontal.LEFT, GravityVertical.CENTER, GravityDepth.CENTER); // !< gravity is in left
|
||||
public static final Gravity RIGHT = new Gravity(GravityHorizontal.RIGHT, GravityVertical.CENTER, GravityDepth.CENTER); // !< gravity is in top-right
|
||||
public static final Gravity TOP = new Gravity(GravityHorizontal.CENTER, GravityVertical.TOP, GravityDepth.CENTER); // !< gravity is in top-left
|
||||
public static final Gravity TOP_LEFT = new Gravity(GravityHorizontal.LEFT, GravityVertical.TOP, GravityDepth.CENTER); // !< gravity is in bottom-right
|
||||
public static final Gravity TOP_RIGHT = new Gravity(GravityHorizontal.RIGHT, GravityVertical.TOP, GravityDepth.CENTER); // !< gravity is in bottom-left
|
||||
|
||||
public Vector3f gravityGenerateDelta(final Vector3f deltas) {
|
||||
float outX = 0;
|
||||
float outY = 0;
|
||||
float outZ = 0;
|
||||
if (deltas.x() > 0.0001f) {
|
||||
if (gravity == LEFT || gravity == BUTTOM_LEFT || gravity == TOP_LEFT) {
|
||||
if (this.x == GravityHorizontal.LEFT) {
|
||||
// nothing to do
|
||||
} else if (gravity == RIGHT || gravity == BUTTOM_RIGHT || gravity == TOP_RIGHT) {
|
||||
} else if (this.x == GravityHorizontal.RIGHT) {
|
||||
outX = (int) (deltas.x());
|
||||
} else {
|
||||
outX = (int) (deltas.x() * 0.5f);
|
||||
}
|
||||
}
|
||||
if (deltas.y() > 0.0001f) {
|
||||
if (gravity == BUTTOM || gravity == BUTTOM_LEFT || gravity == BUTTOM_RIGHT) {
|
||||
if (this.y == GravityVertical.BOTTOM) {
|
||||
// nothing to do
|
||||
} else if (gravity == TOP || gravity == TOP_RIGHT || gravity == TOP_LEFT) {
|
||||
} else if (this.y == GravityVertical.TOP) {
|
||||
outY = (int) (deltas.y());
|
||||
} else {
|
||||
outY = (int) (deltas.y() * 0.5f);
|
||||
}
|
||||
}
|
||||
return new Vector2f(outX, outY);
|
||||
if (deltas.z() > 0.0001f) {
|
||||
if (this.z == GravityDepth.BACK) {
|
||||
// nothing to do
|
||||
} else if (this.z == GravityDepth.FRONT) {
|
||||
outZ = (int) (deltas.z());
|
||||
} else {
|
||||
outZ = (int) (deltas.z() * 0.5f);
|
||||
}
|
||||
}
|
||||
return new Vector3f(outX, outY, outZ);
|
||||
}
|
||||
|
||||
public static Gravity valueOf(String value) {
|
||||
GravityHorizontal x = GravityHorizontal.CENTER;
|
||||
GravityVertical y = GravityVertical.CENTER;
|
||||
GravityDepth z = GravityDepth.CENTER;
|
||||
if (value.contains("LEFT")) {
|
||||
x = GravityHorizontal.LEFT;
|
||||
} else if (value.contains("RIGHT")) {
|
||||
x = GravityHorizontal.RIGHT;
|
||||
}
|
||||
if (value.contains("TOP")) {
|
||||
y = GravityVertical.TOP;
|
||||
} else if (value.contains("BOTTOM") || value.contains("BUTTOM")) {
|
||||
y = GravityVertical.BOTTOM;
|
||||
}
|
||||
if (value.contains("FRONT")) {
|
||||
z = GravityDepth.FRONT;
|
||||
} else if (value.contains("BACK")) {
|
||||
z = GravityDepth.BACK;
|
||||
}
|
||||
return new Gravity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (this.x == GravityHorizontal.CENTER && this.y == GravityVertical.CENTER && this.z == GravityDepth.CENTER) {
|
||||
return GravityHorizontal.CENTER.toString();
|
||||
}
|
||||
StringBuilder data = new StringBuilder();
|
||||
if (this.x != GravityHorizontal.CENTER) {
|
||||
data.append(this.x.toString());
|
||||
}
|
||||
if (this.y != GravityVertical.CENTER) {
|
||||
if (data.length() != 0) {
|
||||
data.append("_");
|
||||
}
|
||||
data.append(this.y.toString());
|
||||
}
|
||||
if (this.z != GravityDepth.CENTER) {
|
||||
if (data.length() != 0) {
|
||||
data.append("_");
|
||||
}
|
||||
data.append(this.z.toString());
|
||||
}
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
7
src/org/atriasoft/ewol/GravityDepth.java
Normal file
7
src/org/atriasoft/ewol/GravityDepth.java
Normal file
@ -0,0 +1,7 @@
|
||||
package org.atriasoft.ewol;
|
||||
|
||||
public enum GravityDepth {
|
||||
BACK, //!< gravity is in center
|
||||
CENTER, //!< gravity is in right
|
||||
FRONT, //
|
||||
}
|
7
src/org/atriasoft/ewol/GravityHorizontal.java
Normal file
7
src/org/atriasoft/ewol/GravityHorizontal.java
Normal file
@ -0,0 +1,7 @@
|
||||
package org.atriasoft.ewol;
|
||||
|
||||
public enum GravityHorizontal {
|
||||
CENTER, //!< gravity is in right
|
||||
LEFT, //!< gravity is in left
|
||||
RIGHT, //!< gravity is in top-right
|
||||
}
|
7
src/org/atriasoft/ewol/GravityVertical.java
Normal file
7
src/org/atriasoft/ewol/GravityVertical.java
Normal file
@ -0,0 +1,7 @@
|
||||
package org.atriasoft.ewol;
|
||||
|
||||
public enum GravityVertical {
|
||||
BOTTOM, //!< gravity is in bottom
|
||||
CENTER, //!< gravity is in right
|
||||
TOP, //!< gravity is in top-left
|
||||
}
|
@ -6,43 +6,53 @@
|
||||
package org.atriasoft.ewol;
|
||||
|
||||
/**
|
||||
* @breif Simple class to abstarct the padding porperty.
|
||||
* Simple class to abstract the padding property.
|
||||
*/
|
||||
@SuppressWarnings("preview")
|
||||
public record Padding(
|
||||
float left,
|
||||
float top,
|
||||
float right,
|
||||
float bottom // !< this represent the 4 padding value Left top right buttom (like css)
|
||||
) {
|
||||
float bottom, // !< this represent the 4 padding value Left top right buttom (like css)
|
||||
float front,
|
||||
float back) {
|
||||
|
||||
public static final Padding ZERO = new Padding(0, 0, 0, 0);
|
||||
public static final Padding ZERO = new Padding(0, 0, 0, 0, 0, 0);
|
||||
|
||||
public Padding() {
|
||||
this(0, 0, 0, 0);
|
||||
this(0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Padding(final float left) {
|
||||
this(left, 0, 0, 0);
|
||||
this(left, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Padding(final float left, final float top) {
|
||||
this(left, top, 0, 0);
|
||||
this(left, top, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Padding(final float left, final float top, final float right) {
|
||||
this(left, top, right, 0);
|
||||
this(left, top, right, 0, 0, 0);
|
||||
}
|
||||
|
||||
public Padding(final float left, final float top, final float right, final float bottom) {
|
||||
this(left, top, right, bottom, 0, 0);
|
||||
}
|
||||
|
||||
public Padding(final double left, final double top, final double right, final double bottom) {
|
||||
this((float) left, (float) top, (float) right, (float) bottom, 0, 0);
|
||||
}
|
||||
|
||||
public Padding(final float left, final float top, final float right, final float bottom, final float front) {
|
||||
this(left, top, right, bottom, front, 0);
|
||||
}
|
||||
|
||||
public Padding(final float left, final float top, final float right, final float bottom, final float front, final float back) {
|
||||
this.left = left;
|
||||
this.top = top;
|
||||
this.right = right;
|
||||
this.bottom = bottom;
|
||||
}
|
||||
|
||||
public Padding(final double left, final double top, final double right, final double bottom) {
|
||||
this((float) left, (float) top, (float) right, (float) bottom);
|
||||
this.front = front;
|
||||
this.back = back;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -50,28 +60,36 @@ public record Padding(
|
||||
* @param v The vector to add to this one
|
||||
*/
|
||||
public Padding add(final Padding v) {
|
||||
return new Padding(this.left + v.left, this.top + v.top, this.right + v.right, this.bottom + v.bottom);
|
||||
return new Padding(this.left + v.left, this.top + v.top, this.right + v.right, this.bottom + v.bottom, this.front + v.front, this.back + v.back);
|
||||
}
|
||||
|
||||
public Padding withLeft(final float left) {
|
||||
return new Padding(left, this.top, this.right, this.bottom);
|
||||
return new Padding(left, this.top, this.right, this.bottom, this.front, this.back);
|
||||
}
|
||||
|
||||
public Padding withRight(final float right) {
|
||||
return new Padding(this.left, this.top, right, this.bottom);
|
||||
return new Padding(this.left, this.top, right, this.bottom, this.front, this.back);
|
||||
}
|
||||
|
||||
public Padding withButtom(final float bottom) {
|
||||
return new Padding(this.left, this.top, this.right, bottom);
|
||||
public Padding withBottom(final float bottom) {
|
||||
return new Padding(this.left, this.top, this.right, bottom, this.front, this.back);
|
||||
}
|
||||
|
||||
public Padding withTop(final float top) {
|
||||
return new Padding(this.left, top, this.right, this.bottom);
|
||||
return new Padding(this.left, top, this.right, this.bottom, this.front, this.back);
|
||||
}
|
||||
|
||||
public Padding withFront(final float front) {
|
||||
return new Padding(this.left, this.top, this.right, this.bottom, front, this.back);
|
||||
}
|
||||
|
||||
public Padding withBack(final float back) {
|
||||
return new Padding(this.left, this.top, this.right, this.bottom, this.front, back);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "{" + left() + "," + top() + "," + right() + "," + bottom() + "}";
|
||||
return "{" + left() + "," + top() + "," + right() + "," + bottom() + "," + front() + "," + back() + "}";
|
||||
}
|
||||
|
||||
public float x() {
|
||||
@ -82,4 +100,8 @@ public record Padding(
|
||||
return this.top + this.bottom;
|
||||
}
|
||||
|
||||
public float z() {
|
||||
return this.front + this.back;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import java.time.Clock;
|
||||
import org.atriasoft.etk.Uri;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector2i;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.etranslate.ETranslate;
|
||||
import org.atriasoft.ewol.event.EntrySystem;
|
||||
import org.atriasoft.ewol.internal.Log;
|
||||
@ -76,7 +77,7 @@ public class EwolContext extends GaleApplication {
|
||||
return;
|
||||
}
|
||||
final Vector2f size = getSize();
|
||||
this.windowsCurrent.setSize(new Vector2f((int) size.x(), (int) size.y()));
|
||||
this.windowsCurrent.setSize(new Vector3f((int) size.x(), (int) size.y(), 0));
|
||||
this.windowsCurrent.onChangeSize();
|
||||
}
|
||||
|
||||
@ -291,6 +292,7 @@ public class EwolContext extends GaleApplication {
|
||||
appl.onPause(this);
|
||||
Log.info(" == > Ewol system pause (END)");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPeriod(final Clock clock, final long time) {
|
||||
this.objectManager.timeCall(clock, time);
|
||||
|
@ -9,6 +9,7 @@ import java.lang.ref.WeakReference;
|
||||
|
||||
import org.atriasoft.etk.math.FMath;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.event.InputSystem;
|
||||
import org.atriasoft.ewol.internal.Log;
|
||||
import org.atriasoft.ewol.widget.Widget;
|
||||
@ -174,7 +175,7 @@ class InputManager {
|
||||
// grab all events ...
|
||||
tmpWidget = this.grabWidget.get();
|
||||
} else if (tmpWindows != null) {
|
||||
tmpWidget = tmpWindows.getWidgetAtPos(pos);
|
||||
tmpWidget = tmpWindows.getWidgetAtPos(new Vector3f(pos.x(), pos.y(), 0));
|
||||
}
|
||||
if (eventTable[pointerID].curentWidgetEvent != null && tmpWidget != eventTable[pointerID].curentWidgetEvent.get()
|
||||
|| (eventTable[pointerID].isInside && (eventTable[pointerID].origin.x() > pos.x() || eventTable[pointerID].origin.y() > pos.y()
|
||||
@ -307,7 +308,7 @@ class InputManager {
|
||||
if (tmpWidget != null && type == KeyType.mouse) {
|
||||
eventTable[pointerID].curentWidgetEvent = new WeakReference<>(tmpWidget);
|
||||
} else {
|
||||
tmpWidget = tmpWindows.getWidgetAtPos(pos);
|
||||
tmpWidget = tmpWindows.getWidgetAtPos(new Vector3f(pos.x(), pos.y(), 0));
|
||||
eventTable[pointerID].curentWidgetEvent = new WeakReference<>(tmpWidget);
|
||||
/*
|
||||
if (tmpWidget != null) {
|
||||
@ -432,7 +433,7 @@ class InputManager {
|
||||
*/
|
||||
public void unGrabPointer() {
|
||||
this.grabWidget = null;
|
||||
// TODO this.context.grabPointerEvents(false, Vector2f(0,0));
|
||||
// TODO this.context.grabPointerEvents(false, Vector3f(0,0));
|
||||
}
|
||||
|
||||
}
|
||||
@ -449,17 +450,17 @@ class InputPoperty {
|
||||
public boolean isUsed = false;
|
||||
public long lastTimeEvent = 0; // in ns
|
||||
public int nbClickEvent = 0; // 0 .. 1 .. 2 .. 3
|
||||
public Vector2f origin = Vector2f.ZERO;
|
||||
public Vector3f origin = Vector3f.ZERO;
|
||||
public Vector2f posEvent = Vector2f.ZERO;
|
||||
public Vector2f size = Vector2f.MAX_VALUE;
|
||||
public Vector3f size = Vector3f.MAX_VALUE;
|
||||
|
||||
public void clear() {
|
||||
this.isUsed = false;
|
||||
this.destinationInputId = 0;
|
||||
this.lastTimeEvent = System.nanoTime();
|
||||
this.curentWidgetEvent = null;
|
||||
this.origin = Vector2f.ZERO;
|
||||
this.size = Vector2f.MAX_VALUE;
|
||||
this.origin = Vector3f.ZERO;
|
||||
this.size = Vector3f.MAX_VALUE;
|
||||
this.downStart = Vector2f.ZERO;
|
||||
this.isDown = false;
|
||||
this.isInside = false;
|
||||
|
@ -12,10 +12,10 @@ import org.atriasoft.gale.key.KeyType;
|
||||
*/
|
||||
|
||||
public record EventInput(
|
||||
KeyType type,
|
||||
KeyStatus status,
|
||||
int inputId,
|
||||
Vector2f pos,
|
||||
KeySpecial specialKey) {
|
||||
KeyType type,
|
||||
KeyStatus status,
|
||||
int inputId,
|
||||
Vector2f pos,
|
||||
KeySpecial specialKey) {
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import org.atriasoft.gale.key.KeySpecial;
|
||||
import org.atriasoft.gale.key.KeyStatus;
|
||||
import org.atriasoft.gale.key.KeyType;
|
||||
|
||||
@SuppressWarnings("preview")
|
||||
public record InputSystem(
|
||||
EventInput event,
|
||||
Widget dest,
|
||||
|
@ -1,18 +1,18 @@
|
||||
package org.atriasoft.ewol.widget;
|
||||
|
||||
import org.atriasoft.esignal.Connection;
|
||||
import org.atriasoft.esignal.Signal;
|
||||
import org.atriasoft.esignal.SignalEmpty;
|
||||
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.etk.math.Vector3b;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.Gravity;
|
||||
import org.atriasoft.ewol.Padding;
|
||||
import org.atriasoft.ewol.annotation.EwolDescription;
|
||||
import org.atriasoft.ewol.annotation.EwolSignal;
|
||||
import org.atriasoft.ewol.compositing.CompositingGraphicContext;
|
||||
import org.atriasoft.ewol.compositing.GuiShape;
|
||||
import org.atriasoft.ewol.compositing.GuiShapeMode;
|
||||
import org.atriasoft.ewol.event.EventEntry;
|
||||
import org.atriasoft.ewol.event.EventInput;
|
||||
import org.atriasoft.ewol.event.EventTime;
|
||||
import org.atriasoft.ewol.internal.Log;
|
||||
@ -20,6 +20,7 @@ import org.atriasoft.ewol.object.EwolObject;
|
||||
import org.atriasoft.exml.annotation.XmlAttribute;
|
||||
import org.atriasoft.exml.annotation.XmlManaged;
|
||||
import org.atriasoft.exml.annotation.XmlName;
|
||||
import org.atriasoft.gale.key.KeyKeyboard;
|
||||
import org.atriasoft.gale.key.KeyStatus;
|
||||
|
||||
/**
|
||||
@ -32,10 +33,28 @@ import org.atriasoft.gale.key.KeyStatus;
|
||||
* ----------------------------------------------
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
public class Button extends Widget {
|
||||
public class Button extends ContainerToggle {
|
||||
public enum ButtonLock {
|
||||
LOCK_NONE, //!< normal status of the button
|
||||
LOCK_WHEN_PRESSED, //!< When the state is set in pressed, the status stay in this one
|
||||
LOCK_WHEN_RELEASED, //!< When the state is set in not pressed, the status stay in this one
|
||||
LOCK_ACCESS, //!< all event are trashed == > acctivity of the button is disable
|
||||
}
|
||||
|
||||
public static Button createLabelButton(final String label) {
|
||||
final Button out = new Button();
|
||||
final Label labelWidget = new Label();
|
||||
labelWidget.setPropertyFill(Vector3b.FALSE);
|
||||
labelWidget.setPropertyExpand(Vector3b.FALSE);
|
||||
labelWidget.setPropertyGravity(Gravity.CENTER);
|
||||
labelWidget.setPropertyValue(label);
|
||||
out.setSubWidget(labelWidget, 0);
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
Log.verbose("Periodic call on Entry(" + event + ")");
|
||||
@ -45,37 +64,43 @@ public class Button extends Widget {
|
||||
self.markToRedraw();
|
||||
}
|
||||
|
||||
/// color property of the text foreground
|
||||
private int colorIdTextFg;
|
||||
/// text display this.text
|
||||
private final CompositingGraphicContext gc = new CompositingGraphicContext();
|
||||
/// Periodic call handle to remove it when needed
|
||||
protected Connection periodicConnectionHanble = new Connection();
|
||||
|
||||
private Uri propertyConfig = new Uri("THEME", "shape/Button.json", "ewol");
|
||||
private boolean propertyValue = false;
|
||||
private ButtonLock propertyLock = ButtonLock.LOCK_NONE;
|
||||
private boolean propertyToggleMode = false;
|
||||
private boolean propertyEnableSingle = false;
|
||||
|
||||
private String propertyValue = "Test Text..."; //!< string that must be displayed
|
||||
private GuiShape shape;
|
||||
|
||||
@EwolSignal(name = "down", description = "Button is Down")
|
||||
public SignalEmpty signalDown = new SignalEmpty();
|
||||
@EwolSignal(name = "up", description = "Button is Up")
|
||||
public SignalEmpty signalUp = new SignalEmpty();
|
||||
|
||||
@EwolSignal(name = "click", description = "Button is Clicked")
|
||||
public SignalEmpty signalClick = new SignalEmpty();
|
||||
// element over:
|
||||
Vector2f overPositionStart = Vector2f.ZERO;
|
||||
Vector2f overPositionStop = Vector2f.ZERO;
|
||||
@EwolSignal(name = "enter", description = "The cursor enter inside the button")
|
||||
public SignalEmpty signalEnter = new SignalEmpty();
|
||||
@EwolSignal(name = "leave", description = "The cursor leave the button")
|
||||
public SignalEmpty signalLeave = new SignalEmpty();
|
||||
@EwolSignal(name = "value", description = "The button value change")
|
||||
public Signal<Boolean> signalValue = new Signal<>();
|
||||
|
||||
private boolean isDown;
|
||||
// element over:
|
||||
Vector3f overPositionStart = Vector3f.ZERO;
|
||||
Vector3f overPositionStop = Vector3f.ZERO;
|
||||
|
||||
private boolean buttonPressed = false;
|
||||
private boolean mouseHover = false;
|
||||
|
||||
/**
|
||||
* Constuctor
|
||||
* Constructor
|
||||
*/
|
||||
public Button() {
|
||||
this.propertyCanFocus = true;
|
||||
onChangePropertyShaper();
|
||||
markToRedraw();
|
||||
// can not support multiple click...
|
||||
setMouseLimit(1);
|
||||
this.shape = new GuiShape(this.propertyConfig);
|
||||
@ -90,29 +115,40 @@ public class Button extends Widget {
|
||||
if (this.shape != null) {
|
||||
padding = this.shape.getPadding();
|
||||
}
|
||||
Vector2i minHeight = this.gc.calculateTextSize(this.propertyValue);
|
||||
|
||||
Vector2f minimumSizeBase = new Vector2f(minHeight.x(), minHeight.y());
|
||||
// add padding :
|
||||
minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y());
|
||||
this.minSize = Vector2f.max(this.minSize, minimumSizeBase);
|
||||
// verify the min max of the min size ...
|
||||
checkMinSize();
|
||||
Log.error("min size = " + this.minSize);
|
||||
calculateMinMaxSizePadded(padding);
|
||||
}
|
||||
|
||||
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, 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();
|
||||
private boolean checkIfOver(final Vector3f relPos) {
|
||||
return relPos.x() > this.overPositionStart.x() //
|
||||
&& relPos.y() > this.overPositionStart.y() //
|
||||
&& relPos.x() < this.overPositionStop.x() //
|
||||
&& relPos.y() < this.overPositionStop.y();
|
||||
}
|
||||
|
||||
void checkStatus() {
|
||||
if (this.buttonPressed) {
|
||||
changeStatusIn(GuiShapeMode.SELECT);
|
||||
return;
|
||||
}
|
||||
if (this.mouseHover) {
|
||||
changeStatusIn(GuiShapeMode.OVER);
|
||||
return;
|
||||
}
|
||||
if (this.propertyValue) {
|
||||
changeStatusIn(GuiShapeMode.NORMAL);
|
||||
}
|
||||
changeStatusIn(GuiShapeMode.NONE);
|
||||
}
|
||||
|
||||
@XmlManaged
|
||||
@ -123,51 +159,146 @@ public class Button extends Widget {
|
||||
return this.propertyConfig;
|
||||
}
|
||||
|
||||
@XmlManaged
|
||||
@XmlAttribute
|
||||
@XmlName(value = "lock")
|
||||
@EwolDescription(value = "Lock the button in a special state to permit changing state only by the coder")
|
||||
public ButtonLock getPropertyLock() {
|
||||
return this.propertyLock;
|
||||
}
|
||||
|
||||
@XmlManaged
|
||||
@XmlAttribute
|
||||
@XmlName(value = "value")
|
||||
@EwolDescription(value = "Value display in the entry (decorated text)")
|
||||
public String getPropertyValue() {
|
||||
public boolean getPropertyValue() {
|
||||
return this.propertyValue;
|
||||
}
|
||||
|
||||
@XmlManaged
|
||||
@XmlAttribute
|
||||
@XmlName(value = "enable-single")
|
||||
@EwolDescription(value = "If one element set in the Button ==> display only set")
|
||||
public boolean isPropertyEnableSingle() {
|
||||
return this.propertyEnableSingle;
|
||||
}
|
||||
|
||||
@XmlManaged
|
||||
@XmlAttribute
|
||||
@XmlName(value = "toggle")
|
||||
@EwolDescription(value = "The button can toggle")
|
||||
public boolean isPropertyToggleMode() {
|
||||
return this.propertyToggleMode;
|
||||
}
|
||||
|
||||
void onChangePropertyEnableSingle() {
|
||||
if (this.propertyEnableSingle) {
|
||||
if (this.idWidgetDisplayed == 0 && this.subWidget[0] == null && this.subWidget[1] != null) {
|
||||
this.idWidgetDisplayed = 1;
|
||||
} else if (this.idWidgetDisplayed == 1 && this.subWidget[1] == null && this.subWidget[0] != null) {
|
||||
this.idWidgetDisplayed = 0;
|
||||
} else if (this.subWidget[0] == null && this.subWidget[1] == null) {
|
||||
this.idWidgetDisplayed = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void onChangePropertyLock() {
|
||||
if (ButtonLock.LOCK_ACCESS == this.propertyLock) {
|
||||
this.buttonPressed = false;
|
||||
this.mouseHover = false;
|
||||
}
|
||||
checkStatus();
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
protected void onChangePropertyShaper() {
|
||||
if (this.shape == null) {
|
||||
this.shape = new GuiShape(this.propertyConfig);
|
||||
} else {
|
||||
this.shape.setSource(this.propertyConfig);
|
||||
}
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
protected void onChangePropertyTextWhenNothing() {
|
||||
void onChangePropertyToggleMode() {
|
||||
this.propertyValue = !this.propertyValue;
|
||||
if (!this.propertyToggleMode) {
|
||||
this.idWidgetDisplayed = 0;
|
||||
} else {
|
||||
if (!this.propertyValue) {
|
||||
this.idWidgetDisplayed = 0;
|
||||
} else {
|
||||
this.idWidgetDisplayed = 1;
|
||||
}
|
||||
}
|
||||
if (this.propertyEnableSingle) {
|
||||
if (this.idWidgetDisplayed == 0 && this.subWidget[0] == null && this.subWidget[1] != null) {
|
||||
this.idWidgetDisplayed = 1;
|
||||
} else if (this.idWidgetDisplayed == 1 && this.subWidget[1] == null && this.subWidget[0] != null) {
|
||||
this.idWidgetDisplayed = 0;
|
||||
}
|
||||
}
|
||||
checkStatus();
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
protected void onChangePropertyValue() {
|
||||
String newData = this.propertyValue;
|
||||
if (this.propertyToggleMode) {
|
||||
if (!this.propertyValue) {
|
||||
this.idWidgetDisplayed = 0;
|
||||
} else {
|
||||
this.idWidgetDisplayed = 1;
|
||||
}
|
||||
}
|
||||
if (this.propertyEnableSingle) {
|
||||
if (this.idWidgetDisplayed == 0 && this.subWidget[0] == null && this.subWidget[1] != null) {
|
||||
this.idWidgetDisplayed = 1;
|
||||
} else if (this.idWidgetDisplayed == 1 && this.subWidget[1] == null && this.subWidget[0] != null) {
|
||||
this.idWidgetDisplayed = 0;
|
||||
}
|
||||
}
|
||||
checkStatus();
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeSize() {
|
||||
final Padding padding = this.shape.getPadding();
|
||||
onChangeSizePadded(padding);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw() {
|
||||
if (this.shape != null) {
|
||||
this.shape.draw(this.gc.getResourceTexture(), true);
|
||||
this.shape.draw(true);
|
||||
}
|
||||
super.onDraw();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onEventEntry(final EventEntry event) {
|
||||
//Log.debug("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
||||
if (event.type() == KeyKeyboard.CHARACTER && event.status() == KeyStatus.down && event.getChar() == '\r') {
|
||||
this.signalEnter.emit();
|
||||
return true;
|
||||
}
|
||||
return super.onEventEntry(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEventInput(final EventInput event) {
|
||||
Vector2f relPos = relativePosition(event.pos());
|
||||
final Vector3f relPos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0));
|
||||
Log.warning("Event on Input ... " + event + " relPos = " + relPos);
|
||||
boolean over = checkIfOver(relPos);
|
||||
final boolean over = checkIfOver(relPos);
|
||||
//filter if outside the element...
|
||||
if (event.status() == KeyStatus.leave) {
|
||||
changeStatusIn(GuiShapeMode.NORMAL);
|
||||
this.isDown = false;
|
||||
this.buttonPressed = false;
|
||||
return true;
|
||||
}
|
||||
if (event.inputId() == 0) {
|
||||
if (!this.isDown) {
|
||||
if (!this.buttonPressed) {
|
||||
if (KeyStatus.leave == event.status()) {
|
||||
changeStatusIn(GuiShapeMode.NORMAL);
|
||||
} else {
|
||||
@ -191,7 +322,7 @@ public class Button extends Widget {
|
||||
}
|
||||
if (KeyStatus.down == event.status() && over) {
|
||||
keepFocus();
|
||||
this.isDown = true;
|
||||
this.buttonPressed = true;
|
||||
changeStatusIn(GuiShapeMode.SELECT);
|
||||
markToRedraw();
|
||||
this.signalDown.emit();
|
||||
@ -202,9 +333,9 @@ public class Button extends Widget {
|
||||
markToRedraw();
|
||||
return true;
|
||||
}
|
||||
if (KeyStatus.up == event.status() && this.isDown) {
|
||||
if (KeyStatus.up == event.status() && this.buttonPressed) {
|
||||
keepFocus();
|
||||
this.isDown = false;
|
||||
this.buttonPressed = false;
|
||||
this.signalUp.emit();
|
||||
changeStatusIn(GuiShapeMode.OVER);
|
||||
markToRedraw();
|
||||
@ -213,24 +344,25 @@ public class Button extends Widget {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onLostFocus() {
|
||||
this.buttonPressed = false;
|
||||
Log.verbose(this.name + " : Remove Focus ...");
|
||||
checkStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRegenerateDisplay() {
|
||||
super.onRegenerateDisplay();
|
||||
if (!needRedraw()) {
|
||||
//return;
|
||||
}
|
||||
//Log.verbose("Regenerate Display ==> is needed: '" + this.propertyValue + "'");
|
||||
this.shape.clear();
|
||||
this.gc.clear();
|
||||
if (this.colorIdTextFg >= 0) {
|
||||
//this.text.setDefaultColorFg(this.shape.getColor(this.colorIdTextFg));
|
||||
//this.text.setDefaultColorBg(this.shape.getColor(this.colorIdTextBg));
|
||||
//this.text.setCursorColor(this.shape.getColor(this.colorIdCursor));
|
||||
//this.text.setSelectionColor(this.shape.getColor(this.colorIdSelection));
|
||||
}
|
||||
Padding padding = this.shape.getPadding();
|
||||
final Padding padding = this.shape.getPadding();
|
||||
|
||||
Vector2f tmpSizeShaper = this.minSize;
|
||||
Vector2f delta = Gravity.gravityGenerateDelta(this.propertyGravity, this.size.less(this.minSize));
|
||||
Vector3f tmpSizeShaper = this.minSize;
|
||||
Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize));
|
||||
if (this.propertyFill.x()) {
|
||||
tmpSizeShaper = tmpSizeShaper.withX(this.size.x());
|
||||
delta = delta.withX(0.0f);
|
||||
@ -240,65 +372,23 @@ public class Button extends Widget {
|
||||
delta = delta.withY(0.0f);
|
||||
}
|
||||
|
||||
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());
|
||||
// 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();
|
||||
if (tmpSizeText.y() > minHeight) {
|
||||
tmpOriginText = tmpOriginText.add(0, (tmpSizeText.y() - minHeight) * 0.5f);
|
||||
}
|
||||
*/
|
||||
// fix all the position in the int class:
|
||||
tmpSizeShaper = Vector2f.clipInt(tmpSizeShaper);
|
||||
tmpOriginShaper = Vector2f.clipInt(tmpOriginShaper);
|
||||
tmpSizeText = Vector2f.clipInt(tmpSizeText);
|
||||
tmpOriginText = Vector2f.clipInt(tmpOriginText);
|
||||
Vector3f tmpOriginShaper = delta;
|
||||
Vector3f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y(), padding.z());
|
||||
//Vector3f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
|
||||
Vector3f tmpOriginText = new Vector3f(0, 0, 0);
|
||||
// not sure this is needed...
|
||||
tmpSizeShaper = Vector3f.clipInt(tmpSizeShaper);
|
||||
tmpOriginShaper = Vector3f.clipInt(tmpOriginShaper);
|
||||
tmpSizeText = Vector3f.clipInt(tmpSizeText);
|
||||
tmpOriginText = Vector3f.clipInt(tmpOriginText);
|
||||
|
||||
this.gc.clear();
|
||||
this.gc.setSize((int) tmpSizeText.x(), (int) tmpSizeText.y());
|
||||
|
||||
this.gc.setColorFill(Color.BLACK);
|
||||
this.gc.setColorStroke(Color.NONE);
|
||||
this.gc.setStrokeWidth(1);
|
||||
this.gc.text(tmpOriginText, this.propertyValue);
|
||||
this.overPositionStart = tmpOriginShaper;
|
||||
this.overPositionStop = tmpOriginShaper.add(tmpSizeShaper);
|
||||
this.shape.setShape(tmpOriginShaper, tmpSizeShaper, tmpOriginText, tmpSizeText);
|
||||
this.gc.flush();
|
||||
this.shape.flush();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* internal check the value with RegExp checking
|
||||
* @param newData The new string to display
|
||||
*/
|
||||
protected void setInternalValue(final String 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;
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
public void setPropertyConfig(final Uri propertyConfig) {
|
||||
if (this.propertyConfig.equals(propertyConfig)) {
|
||||
return;
|
||||
@ -307,8 +397,23 @@ public class Button extends Widget {
|
||||
onChangePropertyShaper();
|
||||
}
|
||||
|
||||
public void setPropertyValue(final String propertyValue) {
|
||||
if (this.propertyValue.equals(propertyValue)) {
|
||||
public void setPropertyEnableSingle(final boolean propertyEnableSingle) {
|
||||
this.propertyEnableSingle = propertyEnableSingle;
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
public void setPropertyLock(final ButtonLock propertyLock) {
|
||||
this.propertyLock = propertyLock;
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
public void setPropertyToggleMode(final boolean propertyToggleMode) {
|
||||
this.propertyToggleMode = propertyToggleMode;
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
public void setPropertyValue(final boolean propertyValue) {
|
||||
if (this.propertyValue == propertyValue) {
|
||||
return;
|
||||
}
|
||||
this.propertyValue = propertyValue;
|
||||
|
@ -4,9 +4,8 @@ import org.atriasoft.esignal.Connection;
|
||||
import org.atriasoft.esignal.Signal;
|
||||
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.etk.math.Vector3f;
|
||||
import org.atriasoft.etk.math.Vector3i;
|
||||
import org.atriasoft.ewol.Padding;
|
||||
import org.atriasoft.ewol.annotation.EwolDescription;
|
||||
import org.atriasoft.ewol.annotation.EwolSignal;
|
||||
@ -74,8 +73,8 @@ public class CheckBox extends Widget {
|
||||
@EwolSignal(name = "value", description = "CheckBox value change")
|
||||
public Signal<Boolean> signalValue;
|
||||
// element over:
|
||||
Vector2f overPositionStart = Vector2f.ZERO;
|
||||
Vector2f overPositionStop = Vector2f.ZERO;
|
||||
Vector3f overPositionStart = Vector3f.ZERO;
|
||||
Vector3f overPositionStop = Vector3f.ZERO;
|
||||
|
||||
private boolean isDown;
|
||||
|
||||
@ -100,12 +99,12 @@ public class CheckBox extends Widget {
|
||||
if (this.shape != null) {
|
||||
padding = this.shape.getPadding();
|
||||
}
|
||||
Vector2i minHeight = Vector2i.VALUE_16;
|
||||
Vector3i minHeight = Vector3i.VALUE_16;
|
||||
|
||||
Vector2f minimumSizeBase = new Vector2f(minHeight.x(), minHeight.y());
|
||||
Vector3f minimumSizeBase = new Vector3f(minHeight.x(), minHeight.y(), minHeight.z());
|
||||
// add padding :
|
||||
minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y());
|
||||
this.minSize = Vector2f.max(this.minSize, minimumSizeBase);
|
||||
minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y(), padding.z());
|
||||
this.minSize = Vector3f.max(this.minSize, minimumSizeBase);
|
||||
// verify the min max of the min size ...
|
||||
checkMinSize();
|
||||
Log.error("min size = " + this.minSize);
|
||||
@ -121,7 +120,7 @@ public class CheckBox extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkIfOver(Vector2f relPos) {
|
||||
private boolean checkIfOver(Vector3f relPos) {
|
||||
return relPos.x() > this.overPositionStart.x() && relPos.y() > this.overPositionStart.y() && relPos.x() < this.overPositionStop.x() && relPos.y() < this.overPositionStop.y();
|
||||
}
|
||||
|
||||
@ -167,7 +166,8 @@ public class CheckBox extends Widget {
|
||||
|
||||
@Override
|
||||
public boolean onEventInput(final EventInput event) {
|
||||
Vector2f relPos = relativePosition(event.pos());
|
||||
Vector3f positionAbsolute = new Vector3f(event.pos().x(), event.pos().y(), 0);
|
||||
Vector3f relPos = relativePosition(positionAbsolute);
|
||||
Log.warning("Event on Input ... " + event + " relPos = " + relPos);
|
||||
boolean over = checkIfOver(relPos);
|
||||
//filter if outside the element...
|
||||
@ -240,8 +240,8 @@ 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));
|
||||
Vector3f tmpSizeShaper = this.minSize;
|
||||
Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.minSize));
|
||||
if (this.propertyFill.x()) {
|
||||
tmpSizeShaper = tmpSizeShaper.withX(this.size.x());
|
||||
delta = delta.withX(0.0f);
|
||||
@ -251,10 +251,10 @@ public class CheckBox extends Widget {
|
||||
delta = delta.withY(0.0f);
|
||||
}
|
||||
|
||||
Vector2f tmpOriginShaper = delta;
|
||||
Vector2f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y());
|
||||
//Vector2f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
|
||||
Vector2f tmpOriginInside = new Vector2f(0, 0);//this.gc.getTextSize());
|
||||
Vector3f tmpOriginShaper = delta;
|
||||
Vector3f tmpSizeInside = tmpSizeShaper.less(padding.x(), padding.y(), padding.z());
|
||||
//Vector3f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
|
||||
Vector3f tmpOriginInside = Vector3f.ZERO;//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();
|
||||
@ -263,10 +263,10 @@ public class CheckBox extends Widget {
|
||||
}
|
||||
*/
|
||||
// fix all the position in the int class:
|
||||
tmpSizeShaper = Vector2f.clipInt(tmpSizeShaper);
|
||||
tmpOriginShaper = Vector2f.clipInt(tmpOriginShaper);
|
||||
tmpSizeInside = Vector2f.clipInt(tmpSizeInside);
|
||||
tmpOriginInside = Vector2f.clipInt(tmpOriginInside);
|
||||
tmpSizeShaper = Vector3f.clipInt(tmpSizeShaper);
|
||||
tmpOriginShaper = Vector3f.clipInt(tmpOriginShaper);
|
||||
tmpSizeInside = Vector3f.clipInt(tmpSizeInside);
|
||||
tmpOriginInside = Vector3f.clipInt(tmpOriginInside);
|
||||
|
||||
//this.gc.clear();
|
||||
//this.gc.setSize((int)tmpSizeText.x(), (int)tmpSizeText.y());
|
||||
|
@ -5,10 +5,9 @@
|
||||
*/
|
||||
package org.atriasoft.ewol.widget;
|
||||
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3b;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.DrawProperty;
|
||||
import org.atriasoft.ewol.Gravity;
|
||||
import org.atriasoft.ewol.internal.Log;
|
||||
import org.atriasoft.ewol.object.EwolObject;
|
||||
|
||||
@ -31,8 +30,8 @@ public class Container extends Widget {
|
||||
// call sub classes
|
||||
if (this.subWidget != null) {
|
||||
this.subWidget.calculateMinMaxSize();
|
||||
Vector2f min = this.subWidget.getCalculateMinSize();
|
||||
this.minSize = Vector2f.max(this.minSize, min);
|
||||
Vector3f min = this.subWidget.getCalculateMinSize();
|
||||
this.minSize = Vector3f.max(this.minSize, min);
|
||||
}
|
||||
//Log.error("[" + getId() + "] Result min size : " + this.minSize);
|
||||
}
|
||||
@ -67,7 +66,7 @@ public class Container extends Widget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getWidgetAtPos(final Vector2f pos) {
|
||||
public Widget getWidgetAtPos(final Vector3f pos) {
|
||||
if (!this.propertyHide) {
|
||||
if (this.subWidget != null) {
|
||||
return this.subWidget.getWidgetAtPos(pos);
|
||||
@ -130,10 +129,10 @@ public class Container extends Widget {
|
||||
if (this.subWidget == null) {
|
||||
return;
|
||||
}
|
||||
Vector2f origin = this.origin.add(this.offset);
|
||||
Vector2f minSize = this.subWidget.getCalculateMinSize();
|
||||
Vector2b expand = this.subWidget.getPropertyExpand();
|
||||
origin = origin.add(Gravity.gravityGenerateDelta(this.propertyGravity, minSize.less(this.size)));
|
||||
Vector3f origin = this.origin.add(this.offset);
|
||||
Vector3f minSize = this.subWidget.getCalculateMinSize();
|
||||
Vector3b expand = this.subWidget.getPropertyExpand();
|
||||
origin = origin.add(this.propertyGravity.gravityGenerateDelta(minSize.less(this.size)));
|
||||
this.subWidget.setOrigin(origin);
|
||||
this.subWidget.setSize(this.size);
|
||||
this.subWidget.onChangeSize();
|
||||
@ -160,7 +159,7 @@ public class Container extends Widget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOffset(final Vector2f newVal) {
|
||||
public void setOffset(final Vector3f newVal) {
|
||||
if (this.offset.equals(newVal)) {
|
||||
return;
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3b;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.DrawProperty;
|
||||
import org.atriasoft.ewol.annotation.EwolDescription;
|
||||
import org.atriasoft.ewol.internal.Log;
|
||||
@ -27,8 +27,8 @@ import org.atriasoft.exml.annotation.XmlName;
|
||||
*/
|
||||
public class ContainerN extends Widget {
|
||||
|
||||
protected Vector2b propertyLockExpand = new Vector2b(false, false); //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
|
||||
protected Vector2b subExpend = new Vector2b(false, false); //!< reference of the sub element expention requested.
|
||||
protected Vector3b propertyLockExpand = Vector3b.FALSE; //!< Lock the expend of the sub widget to this one == > this permit to limit bigger subWidget
|
||||
protected Vector3b subExpend = Vector3b.FALSE; //!< reference of the sub element expention requested.
|
||||
protected List<Widget> subWidget = new ArrayList<>();
|
||||
|
||||
/**
|
||||
@ -38,22 +38,22 @@ public class ContainerN extends Widget {
|
||||
|
||||
@Override
|
||||
public void calculateMinMaxSize() {
|
||||
this.subExpend = new Vector2b(false, false);
|
||||
this.minSize = Vector2f.ZERO;
|
||||
this.maxSize = Vector2f.MAX_VALUE;
|
||||
this.subExpend = Vector3b.FALSE;
|
||||
this.minSize = Vector3f.ZERO;
|
||||
this.maxSize = Vector3f.MAX_VALUE;
|
||||
//Log.error("[" + getId() + "] {" + getObjectType() + "} set min size : " + this.minSize);
|
||||
for (Widget it : this.subWidget) {
|
||||
if (it != null) {
|
||||
it.calculateMinMaxSize();
|
||||
Vector2b subExpendProp = it.canExpand();
|
||||
Vector3b subExpendProp = it.canExpand();
|
||||
if (subExpendProp.x()) {
|
||||
this.subExpend = this.subExpend.withX(true);
|
||||
}
|
||||
if (subExpendProp.y()) {
|
||||
this.subExpend = this.subExpend.withX(true);
|
||||
}
|
||||
Vector2f tmpSize = it.getCalculateMinSize();
|
||||
this.minSize = Vector2f.max(tmpSize, this.minSize);
|
||||
Vector3f tmpSize = it.getCalculateMinSize();
|
||||
this.minSize = Vector3f.max(tmpSize, this.minSize);
|
||||
}
|
||||
}
|
||||
//Log.error("[" + getId() + "] {" + getObjectType() + "} Result min size : " + this.minSize);
|
||||
@ -61,8 +61,8 @@ public class ContainerN extends Widget {
|
||||
|
||||
// herited function
|
||||
@Override
|
||||
public Vector2b canExpand() {
|
||||
Vector2b res = this.propertyExpand;
|
||||
public Vector3b canExpand() {
|
||||
Vector3b res = this.propertyExpand;
|
||||
if (!this.propertyLockExpand.x()) {
|
||||
if (this.subExpend.x()) {
|
||||
res = res.withX(true);
|
||||
@ -92,7 +92,7 @@ public class ContainerN extends Widget {
|
||||
@XmlAttribute
|
||||
@XmlName(value = "lock")
|
||||
@EwolDescription(value = "Lock the subwidget expand")
|
||||
public Vector2b getPropertyLockExpand() {
|
||||
public Vector3b getPropertyLockExpand() {
|
||||
return this.propertyLockExpand;
|
||||
}
|
||||
|
||||
@ -121,15 +121,15 @@ public class ContainerN extends Widget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getWidgetAtPos(final Vector2f pos) {
|
||||
public Widget getWidgetAtPos(final Vector3f pos) {
|
||||
if (this.propertyHide) {
|
||||
return null;
|
||||
}
|
||||
// for all element in the sizer ...
|
||||
for (Widget it : this.subWidget) {
|
||||
if (it != null) {
|
||||
Vector2f tmpSize = it.getSize();
|
||||
Vector2f tmpOrigin = it.getOrigin();
|
||||
Vector3f tmpSize = it.getSize();
|
||||
Vector3f tmpOrigin = it.getOrigin();
|
||||
if ((tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x()) && (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y())) {
|
||||
Widget tmpWidget = it.getWidgetAtPos(pos);
|
||||
if (tmpWidget != null) {
|
||||
@ -184,7 +184,7 @@ public class ContainerN extends Widget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOffset(final Vector2f newVal) {
|
||||
public void setOffset(final Vector3f newVal) {
|
||||
if (this.offset != newVal) {
|
||||
super.setOffset(newVal);
|
||||
// recalculate the new sise and position of sub widget ...
|
||||
@ -192,7 +192,7 @@ public class ContainerN extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
public void setPropertyLockExpand(final Vector2b propertyLockExpand) {
|
||||
public void setPropertyLockExpand(final Vector3b propertyLockExpand) {
|
||||
if (propertyLockExpand.equals(this.propertyLockExpand)) {
|
||||
return;
|
||||
}
|
||||
|
307
src/org/atriasoft/ewol/widget/ContainerToggle.java
Normal file
307
src/org/atriasoft/ewol/widget/ContainerToggle.java
Normal file
@ -0,0 +1,307 @@
|
||||
/*
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
* @license MPL v2.0 (see license file)
|
||||
*/
|
||||
package org.atriasoft.ewol.widget;
|
||||
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.DrawProperty;
|
||||
import org.atriasoft.ewol.Padding;
|
||||
import org.atriasoft.ewol.internal.Log;
|
||||
import org.atriasoft.ewol.object.EwolObject;
|
||||
|
||||
/*
|
||||
* @ingroup ewolWidgetGroup
|
||||
* the Cotainer widget is a widget that have an only one subWidget
|
||||
*/
|
||||
public class ContainerToggle extends Widget {
|
||||
protected Widget[] subWidget = new Widget[2];
|
||||
int idWidgetDisplayed = 0; //!< current widget displayed
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public ContainerToggle() {}
|
||||
|
||||
// @Override
|
||||
// public boolean loadXML(final XmlElement node) {
|
||||
// if (node == null) {
|
||||
// return false;
|
||||
// }
|
||||
// // parse generic properties:
|
||||
// super.loadXML(node);
|
||||
// // remove previous element:
|
||||
// subWidgetRemove();
|
||||
// // parse all the elements:
|
||||
// for (XmlNode it : node.getNodes()) {
|
||||
// if (!it.isElement()) {
|
||||
// // trash here all that is not element
|
||||
// continue;
|
||||
// }
|
||||
// XmlElement pNode = it.toElement();
|
||||
// String widgetName = pNode.getValue();
|
||||
// Log.verbose("[" + getId() + "] t=" + getClass().getCanonicalName() + " Load node name : '" + widgetName + "'");
|
||||
// if (!getWidgetManager().exist(widgetName)) {
|
||||
// Log.error("Unknown basic node='" + widgetName + "' not in : [" + getWidgetManager().list() + "]");
|
||||
// continue;
|
||||
// }
|
||||
// if (getSubWidget() != null) {
|
||||
// Log.error("Can only have one subWidget ??? node='" + widgetName + "'");
|
||||
// continue;
|
||||
// }
|
||||
// Log.debug("try to create subwidget : '" + widgetName + "'");
|
||||
// Widget tmpWidget = getWidgetManager().create(widgetName, pNode);
|
||||
// if (tmpWidget == null) {
|
||||
// Log.error("Can not create the widget : '" + widgetName + "'");
|
||||
// continue;
|
||||
// }
|
||||
// // add widget :
|
||||
// setSubWidget(tmpWidget);
|
||||
// if (!tmpWidget.loadXML(pNode)) {
|
||||
// Log.error("can not load widget properties : '" + widgetName + "'");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// if (node.getNodes().size() != 0 && this.subWidget == null) {
|
||||
// Log.warning("Load container with no data inside");
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
|
||||
void calculateMinMaxSizePadded(final Padding padding) {
|
||||
// call main class
|
||||
this.minSize = Vector3f.ZERO;
|
||||
// call sub classes
|
||||
for (int iii = 0; iii < 2; ++iii) {
|
||||
if (this.subWidget[iii] != null) {
|
||||
this.subWidget[iii].calculateMinMaxSize();
|
||||
final Vector3f min = this.subWidget[iii].getCalculateMinSize();
|
||||
this.minSize = this.minSize.max(min);
|
||||
}
|
||||
}
|
||||
// add padding :
|
||||
this.minSize = this.minSize.add(padding.x(), padding.y(), padding.z());
|
||||
// verify the min max of the min size ...
|
||||
checkMinSize();
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawWidgetTree(int level) {
|
||||
super.drawWidgetTree(level);
|
||||
level++;
|
||||
if (this.subWidget[0] != null) {
|
||||
this.subWidget[0].drawWidgetTree(level);
|
||||
}
|
||||
if (this.subWidget[1] != null) {
|
||||
this.subWidget[1].drawWidgetTree(level);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EwolObject getSubObjectNamed(final String widgetName) {
|
||||
EwolObject tmpObject = super.getSubObjectNamed(widgetName);
|
||||
if (tmpObject != null) {
|
||||
return tmpObject;
|
||||
}
|
||||
if (this.subWidget[0] != null) {
|
||||
tmpObject = this.subWidget[0].getSubObjectNamed(widgetName);
|
||||
if (tmpObject != null) {
|
||||
return tmpObject;
|
||||
}
|
||||
}
|
||||
if (this.subWidget[1] != null) {
|
||||
return this.subWidget[1].getSubObjectNamed(widgetName);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Padding onChangeSizePadded(final Padding padding) {
|
||||
super.onChangeSize();
|
||||
final Vector3f localAvaillable = this.size.less(padding.x(), padding.y(), padding.z());
|
||||
// Checking the filling properties == > for the subElements:
|
||||
Vector3f subElementSize = this.minSize;
|
||||
if (this.propertyFill.x()) {
|
||||
subElementSize = subElementSize.withX(this.size.x());
|
||||
}
|
||||
if (this.propertyFill.y()) {
|
||||
subElementSize = subElementSize.withY(this.size.y());
|
||||
}
|
||||
final Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(subElementSize));
|
||||
final Vector3f origin = delta.add(padding.left(), padding.bottom(), padding.back());
|
||||
subElementSize = subElementSize.less(padding.x(), padding.y(), padding.z());
|
||||
for (int iii = 0; iii < 2; ++iii) {
|
||||
if (this.subWidget[iii] != null) {
|
||||
Vector3f origin2 = origin.add(this.offset);
|
||||
final Vector3f minSize = this.subWidget[iii].getCalculateMinSize();
|
||||
//Vector2b expand = this.subWidget[iii].propertyExpand.get();
|
||||
origin2 = origin2.add(this.propertyGravity.gravityGenerateDelta(minSize.less(localAvaillable)));
|
||||
this.subWidget[iii].setOrigin(this.origin.add(origin));
|
||||
this.subWidget[iii].setSize(subElementSize);
|
||||
this.subWidget[iii].onChangeSize();
|
||||
}
|
||||
}
|
||||
final Vector3f selectableAreaPos = origin.less(padding.left(), padding.bottom(), padding.back());
|
||||
final Vector3f selectableAreaEndPos = this.size.less(selectableAreaPos.add(subElementSize.add(padding.x(), padding.y(), padding.z())));
|
||||
markToRedraw();
|
||||
return new Padding(selectableAreaPos.x(), selectableAreaEndPos.y(), selectableAreaEndPos.x(), selectableAreaPos.y());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRegenerateDisplay() {
|
||||
if (this.subWidget[this.idWidgetDisplayed] != null) {
|
||||
this.subWidget[this.idWidgetDisplayed].onRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
/*
|
||||
boolean loadXML( exml::Element _node) {
|
||||
if (_node.exist() == false) {
|
||||
return false;
|
||||
}
|
||||
// parse generic properties :
|
||||
Widget::loadXML(_node);
|
||||
// remove previous element :
|
||||
subWidgetRemove();
|
||||
Log.verbose("Create en element 2 ... with nodes.size()=" + _node.nodes.size());
|
||||
// parse all the elements:
|
||||
for( auto it : _node.nodes) {
|
||||
Log.verbose(" node: " + it);
|
||||
exml::Element pNode = it.toElement();
|
||||
if (pNode.exist() == false) {
|
||||
// trash here all that is not element
|
||||
continue;
|
||||
}
|
||||
String widgetName = pNode.getValue();
|
||||
if (getWidgetManager().exist(widgetName) == false) {
|
||||
Log.error("(l " + pNode.getPos() + ") Unknown basic node='" + widgetName + "' not in: [" + getWidgetManager().list() + "]" );
|
||||
continue;
|
||||
}
|
||||
boolean toogleMode=false;
|
||||
if (getSubWidget() != null) {
|
||||
toogleMode=true;
|
||||
if (getSubWidgetToggle() != null) {
|
||||
Log.error("(l " + pNode.getPos() + ") Can only have one subWidget ??? node='" + widgetName + "'" );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Log.debug("try to create subwidget : '" + widgetName + "'");
|
||||
Widget tmpWidget = getWidgetManager().create(widgetName, pNode);
|
||||
if (tmpWidget == null) {
|
||||
EWOL_ERROR ("(l " + pNode.getPos() + ") Can not create the widget: '" + widgetName + "'");
|
||||
continue;
|
||||
}
|
||||
// add widget :
|
||||
if (toogleMode == false) {
|
||||
setSubWidget(tmpWidget);
|
||||
} else {
|
||||
setSubWidgetToggle(tmpWidget);
|
||||
}
|
||||
if (tmpWidget.loadXML(pNode) == false) {
|
||||
EWOL_ERROR ("(l "+pNode.getPos()+") can not load widget properties: '" + widgetName + "'");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}*/
|
||||
|
||||
@Override
|
||||
public void requestDestroyFromChild(final EwolObject child) {
|
||||
if (this.subWidget[0] == child) {
|
||||
if (this.subWidget[0] == null) {
|
||||
return;
|
||||
}
|
||||
this.subWidget[0].removeParent();
|
||||
this.subWidget[0] = null;
|
||||
markToRedraw();
|
||||
}
|
||||
if (this.subWidget[1] == child) {
|
||||
if (this.subWidget[1] == null) {
|
||||
return;
|
||||
}
|
||||
this.subWidget[1].removeParent();
|
||||
this.subWidget[1] = null;
|
||||
markToRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOffset(final Vector3f newVal) {
|
||||
if (this.offset.equals(newVal)) {
|
||||
return;
|
||||
}
|
||||
super.setOffset(newVal);
|
||||
// recalculate the new size and position of sub widget ...
|
||||
onChangeSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* set the subWidget node widget.
|
||||
* @param newWidget The widget to add.
|
||||
*/
|
||||
public void setSubWidget(final Widget newWidget, final int idWidget) {
|
||||
subWidgetRemove(idWidget);
|
||||
this.subWidget[idWidget] = newWidget;
|
||||
if (this.subWidget[idWidget] != null) {
|
||||
Log.verbose("Add widget : " + idWidget);
|
||||
this.subWidget[idWidget].setParent(this);
|
||||
}
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
public void subWidgetRemove(final int idWidget) {
|
||||
if (this.subWidget[idWidget] != null) {
|
||||
Log.verbose("Remove widget : " + idWidget);
|
||||
this.subWidget[idWidget].removeParent();
|
||||
this.subWidget[idWidget] = null;
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
}
|
||||
|
||||
public void subWidgetReplace(final Widget oldWidget, final Widget newWidget) {
|
||||
boolean haveChange = false;
|
||||
for (int iii = 0; iii < 2; ++iii) {
|
||||
if (this.subWidget[iii] != oldWidget) {
|
||||
continue;
|
||||
}
|
||||
this.subWidget[iii].removeParent();
|
||||
this.subWidget[iii] = newWidget;
|
||||
if (this.subWidget[iii] != null) {
|
||||
this.subWidget[iii].setParent(this);
|
||||
}
|
||||
haveChange = true;
|
||||
}
|
||||
if (!haveChange) {
|
||||
Log.warning("Request replace with a wrong old widget");
|
||||
return;
|
||||
}
|
||||
markToRedraw();
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
public void subWidgetUnLink(final int idWidget) {
|
||||
if (this.subWidget[idWidget] != null) {
|
||||
this.subWidget[idWidget].removeParent();
|
||||
Log.verbose("Unlink widget : " + idWidget);
|
||||
}
|
||||
this.subWidget[idWidget] = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void systemDraw(final DrawProperty displayProp) {
|
||||
if (this.propertyHide) {
|
||||
// widget is hidden ...
|
||||
return;
|
||||
}
|
||||
super.systemDraw(displayProp);
|
||||
if (this.subWidget[this.idWidgetDisplayed] != null) {
|
||||
final DrawProperty prop = displayProp.withLimit(this.origin, this.size);
|
||||
//Log.info("Draw : [" + propertyName + "] t=" + getObjectType() + " o=" + this.origin + " s=" + this.size);
|
||||
this.subWidget[this.idWidgetDisplayed].systemDraw(prop);
|
||||
} else {
|
||||
Log.info("[" + getId() + "] ++++++ : [null]");
|
||||
}
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ import org.atriasoft.etk.Color;
|
||||
import org.atriasoft.etk.Uri;
|
||||
import org.atriasoft.etk.math.FMath;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.Padding;
|
||||
import org.atriasoft.ewol.annotation.EwolDescription;
|
||||
import org.atriasoft.ewol.annotation.EwolSignal;
|
||||
@ -93,9 +94,9 @@ public class Entry extends Widget {
|
||||
@EwolSignal(name = "modify", description = "Entry box value change")
|
||||
public Signal<String> signalModify = new Signal<>(); //!< data change
|
||||
// element over:
|
||||
Vector2f overPositionStart = Vector2f.ZERO;
|
||||
Vector3f overPositionStart = Vector3f.ZERO;
|
||||
|
||||
Vector2f overPositionStop = Vector2f.ZERO;
|
||||
Vector3f overPositionStop = Vector3f.ZERO;
|
||||
|
||||
/**
|
||||
* Contuctor
|
||||
@ -131,10 +132,10 @@ public class Entry extends Widget {
|
||||
}
|
||||
int minHeight = this.gc.getTextHeight();//calculateSize('A').y();
|
||||
|
||||
Vector2f minimumSizeBase = new Vector2f(20, minHeight);
|
||||
Vector3f minimumSizeBase = new Vector3f(20, minHeight, 10);
|
||||
// add padding :
|
||||
minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y());
|
||||
this.minSize = Vector2f.max(this.minSize, minimumSizeBase);
|
||||
minimumSizeBase = minimumSizeBase.add(padding.x(), padding.y(), padding.z());
|
||||
this.minSize = Vector3f.max(this.minSize, minimumSizeBase);
|
||||
// verify the min max of the min size ...
|
||||
checkMinSize();
|
||||
Log.error("min size = " + this.minSize);
|
||||
@ -409,7 +410,8 @@ public class Entry extends Widget {
|
||||
|
||||
@Override
|
||||
public boolean onEventInput(final EventInput event) {
|
||||
Vector2f relPos = relativePosition(event.pos());
|
||||
Vector3f absolutePosition = new Vector3f(event.pos().x(), event.pos().y(), 0);
|
||||
Vector3f relPos = relativePosition(absolutePosition);
|
||||
Log.verbose("Event on Input ... " + event + " relPos = " + relPos);
|
||||
if (event.inputId() == 0) {
|
||||
if (!isFocused()) {
|
||||
@ -469,15 +471,15 @@ public class Entry extends Widget {
|
||||
this.displayCursorPos = this.propertyValue.length();
|
||||
} else if (KeyStatus.down == event.status()) {
|
||||
keepFocus();
|
||||
updateCursorPosition(event.pos());
|
||||
updateCursorPosition(absolutePosition);
|
||||
markToRedraw();
|
||||
} else if (KeyStatus.move == event.status()) {
|
||||
keepFocus();
|
||||
updateCursorPosition(event.pos(), true);
|
||||
updateCursorPosition(absolutePosition, true);
|
||||
markToRedraw();
|
||||
} else if (KeyStatus.up == event.status()) {
|
||||
keepFocus();
|
||||
updateCursorPosition(event.pos(), true);
|
||||
updateCursorPosition(absolutePosition, true);
|
||||
// Copy to clipboard Middle ...
|
||||
copySelectionToClipBoard(ClipboardList.CLIPBOARD_SELECTION);
|
||||
markToRedraw();
|
||||
@ -486,7 +488,7 @@ public class Entry extends Widget {
|
||||
if (event.status() == KeyStatus.down || event.status() == KeyStatus.move || event.status() == KeyStatus.up) {
|
||||
keepFocus();
|
||||
// updatethe cursor position :
|
||||
updateCursorPosition(event.pos());
|
||||
updateCursorPosition(absolutePosition);
|
||||
}
|
||||
// Paste current selection only when up button
|
||||
if (event.status() == KeyStatus.up) {
|
||||
@ -531,7 +533,7 @@ public class Entry extends Widget {
|
||||
updateTextPosition();
|
||||
Padding padding = this.shape.getPadding();
|
||||
|
||||
Vector2f tmpSizeShaper = this.minSize;
|
||||
Vector3f tmpSizeShaper = this.minSize;
|
||||
if (this.propertyFill.x()) {
|
||||
tmpSizeShaper = tmpSizeShaper.withX(this.size.x());
|
||||
}
|
||||
@ -539,10 +541,10 @@ public class Entry extends Widget {
|
||||
tmpSizeShaper = tmpSizeShaper.withY(this.size.y());
|
||||
}
|
||||
|
||||
Vector2f tmpOriginShaper = this.size.less(tmpSizeShaper).multiply(0.5f);
|
||||
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());
|
||||
Vector3f tmpOriginShaper = this.size.less(tmpSizeShaper).multiply(0.5f);
|
||||
Vector3f tmpSizeText = tmpSizeShaper.less(padding.x(), padding.y(), padding.z());
|
||||
//Vector3f tmpOriginText = this.size.less(tmpSizeText).multiply(0.5f);
|
||||
Vector3f tmpOriginText = new Vector3f(0, this.gc.getTextSize(), 0);
|
||||
// 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();
|
||||
@ -551,10 +553,10 @@ public class Entry 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);
|
||||
tmpSizeShaper = Vector3f.clipInt(tmpSizeShaper);
|
||||
tmpOriginShaper = Vector3f.clipInt(tmpOriginShaper);
|
||||
tmpSizeText = Vector3f.clipInt(tmpSizeText);
|
||||
tmpOriginText = Vector3f.clipInt(tmpOriginText);
|
||||
|
||||
this.gc.clear();
|
||||
this.gc.setSize((int) tmpSizeText.x(), (int) tmpSizeText.y());
|
||||
@ -568,7 +570,7 @@ public class Entry extends Widget {
|
||||
this.gc.setColorFill(Color.RED);
|
||||
this.gc.setColorStroke(Color.GREEN);
|
||||
this.gc.setStrokeWidth(5);
|
||||
//this.gc.rectangleRounded(new Vector2f(20, 2), new Vector2f(55, 70), new Vector2f(15, 15));
|
||||
//this.gc.rectangleRounded(new Vector3f(20, 2), new Vector3f(55, 70), new Vector3f(15, 15));
|
||||
this.gc.line(new Vector2f(this.displayCursorPositionPixel, 2), new Vector2f(this.displayCursorPositionPixel, this.gc.getTextHeight() - 4));
|
||||
|
||||
this.gc.setColorFill(Color.BLACK);
|
||||
@ -579,10 +581,11 @@ public class Entry extends Widget {
|
||||
Arrays.fill(valueToDisplay, '*');
|
||||
}
|
||||
|
||||
Vector2f plop = new Vector2f(tmpOriginText.x() + this.displayStartPosition, tmpOriginText.y());
|
||||
if (valueToDisplay.length != 0) {
|
||||
this.gc.text(tmpOriginText.add(this.displayStartPosition, 0), new String(valueToDisplay));
|
||||
this.gc.text(plop, new String(valueToDisplay));
|
||||
} else if (this.propertyTextWhenNothing != null) {
|
||||
this.gc.text(tmpOriginText.add(this.displayStartPosition, 0), this.propertyTextWhenNothing);
|
||||
this.gc.text(plop, this.propertyTextWhenNothing);
|
||||
}
|
||||
this.overPositionStart = tmpOriginShaper;
|
||||
this.overPositionStop = tmpOriginShaper.add(tmpSizeShaper);
|
||||
@ -724,14 +727,14 @@ public class Entry extends Widget {
|
||||
* @param pos Absolute position of the event
|
||||
* @note The display is automaticly requested when change apear.
|
||||
*/
|
||||
protected void updateCursorPosition(final Vector2f pos) {
|
||||
protected void updateCursorPosition(final Vector3f pos) {
|
||||
updateCursorPosition(pos, false);
|
||||
}
|
||||
|
||||
protected void updateCursorPosition(final Vector2f pos, final boolean selection/*=false*/) {
|
||||
protected void updateCursorPosition(final Vector3f pos, final boolean selection/*=false*/) {
|
||||
Padding padding = this.shape.getPadding();
|
||||
|
||||
Vector2f relPos = relativePosition(pos);
|
||||
Vector3f relPos = relativePosition(pos);
|
||||
relPos = relPos.withX(relPos.x() - this.displayStartPosition - padding.left());
|
||||
// try to find the new cursor position :
|
||||
if (this.displayStartPosition > this.propertyValue.length()) {
|
||||
|
@ -7,11 +7,11 @@ package org.atriasoft.ewol.widget;
|
||||
|
||||
import org.atriasoft.egami.ImageByteRGBA;
|
||||
import org.atriasoft.esignal.SignalEmpty;
|
||||
import org.atriasoft.etk.Dimension;
|
||||
import org.atriasoft.etk.Dimension2f;
|
||||
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.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.annotation.EwolDescription;
|
||||
import org.atriasoft.ewol.annotation.EwolSignal;
|
||||
import org.atriasoft.ewol.compositing.CompositingImage;
|
||||
@ -29,11 +29,11 @@ public class ImageDisplay extends Widget {
|
||||
protected CompositingImage compositing = new CompositingImage(); //!< compositing element of the image.
|
||||
protected Vector2f imageRenderSize = Vector2f.ZERO; //!< size of the image when we render it
|
||||
|
||||
protected Dimension propertyBorder = Dimension.ZERO; //!< border to add at the image.
|
||||
protected Dimension propertyImageSize = Dimension.ZERO; //!< border to add at the image.
|
||||
protected boolean propertyKeepRatio = true; //!< keep the image ratio between width and hight
|
||||
protected Vector2f propertyPosStart = Vector2f.ZERO; //!< position in the image to start the sisplay (when we want not to display all the image)
|
||||
protected Vector2f propertyPosStop = Vector2f.ONE; //!< position in the image to start the sisplay (when we want not to display all the image)
|
||||
protected Dimension2f propertyBorder = Dimension2f.ZERO; //!< border to add at the image.
|
||||
protected Dimension2f propertyImageSize = Dimension2f.ZERO; //!< border to add at the image.
|
||||
protected boolean propertyKeepRatio = true; //!< keep the image ratio between width and height
|
||||
protected Vector2f propertyPosStart = Vector2f.ZERO; //!< position in the image to start the display (when we want not to display all the image)
|
||||
protected Vector2f propertyPosStop = Vector2f.ONE; //!< position in the image to start the display (when we want not to display all the image)
|
||||
|
||||
protected boolean propertySmooth = true; //!< display is done in the pixel approximation if false
|
||||
protected Uri propertySource = null; //!< file name of the image.
|
||||
@ -52,25 +52,26 @@ public class ImageDisplay extends Widget {
|
||||
Log.debug("calculate min size: border=" + this.propertyBorder + " size=" + this.propertyImageSize + " min-size=" + this.propertyMinSize);
|
||||
Vector2f imageBoder = this.propertyBorder.getPixel().multiply(2.0f);
|
||||
Vector2f imageSize = this.propertyImageSize.getPixel();
|
||||
Vector2f size = this.propertyMinSize.getPixel();
|
||||
Vector3f size = this.propertyMinSize.getPixel();
|
||||
Log.debug(" ==> border=" + imageBoder + " size=" + imageSize + " min-size=" + size);
|
||||
if (!imageSize.isZero()) {
|
||||
this.minSize = imageBoder.add(imageSize);
|
||||
Vector2f tmp = imageBoder.add(imageSize);
|
||||
this.minSize = new Vector3f(tmp.x(), tmp.y(), 0);
|
||||
this.maxSize = this.minSize;
|
||||
} else {
|
||||
Vector2i imageSizeReal = this.getPropertyMinSize().getPixeli();//.compositing.getRealSize();
|
||||
Log.verbose(" Real Size = " + imageSizeReal);
|
||||
Vector2f min1 = imageBoder.add(this.propertyMinSize.getPixel());
|
||||
this.minSize = imageBoder.add(imageSizeReal);
|
||||
Vector3f min1 = this.propertyMinSize.getPixel().add(imageBoder.x(), imageBoder.y(), 0);
|
||||
this.minSize = new Vector3f(imageBoder.x() + imageSizeReal.x(), imageBoder.y() + imageSizeReal.y(), 0);
|
||||
Log.verbose(" set max : " + this.minSize + " min1=" + min1);
|
||||
this.minSize = Vector2f.max(this.minSize, min1);
|
||||
this.minSize = Vector3f.max(this.minSize, min1);
|
||||
Log.verbose(" result : " + this.minSize);
|
||||
this.maxSize = imageBoder.add(this.propertyMaxSize.getPixel());
|
||||
this.minSize = Vector2f.min(this.minSize, this.maxSize);
|
||||
this.maxSize = this.propertyMaxSize.getPixel().add(imageBoder.x(), imageBoder.y(), 0);
|
||||
this.minSize = Vector3f.min(this.minSize, this.maxSize);
|
||||
}
|
||||
this.imageRenderSize = this.minSize;
|
||||
this.minSize = Vector2f.max(this.minSize, size);
|
||||
this.maxSize = Vector2f.max(this.maxSize, this.minSize);
|
||||
this.imageRenderSize = new Vector2f(this.minSize.x(), this.minSize.y());
|
||||
this.minSize = Vector3f.max(this.minSize, size);
|
||||
this.maxSize = Vector3f.max(this.maxSize, this.minSize);
|
||||
Log.debug("set widget min=" + this.minSize + " max=" + this.maxSize + " with real Image size=" + this.imageRenderSize + " img size=" + imageSize + " " + this.propertyImageSize);
|
||||
markToRedraw();
|
||||
}
|
||||
@ -79,7 +80,7 @@ public class ImageDisplay extends Widget {
|
||||
@XmlAttribute
|
||||
@XmlName(value = "border")
|
||||
@EwolDescription(value = "Border of the image")
|
||||
public Dimension getPropertyBorder() {
|
||||
public Dimension2f getPropertyBorder() {
|
||||
return this.propertyBorder;
|
||||
}
|
||||
|
||||
@ -87,7 +88,7 @@ public class ImageDisplay extends Widget {
|
||||
@XmlAttribute
|
||||
@XmlName(value = "size")
|
||||
@EwolDescription(value = "Basic display size of the image")
|
||||
public Dimension getPropertyImageSize() {
|
||||
public Dimension2f getPropertyImageSize() {
|
||||
return this.propertyImageSize;
|
||||
}
|
||||
|
||||
@ -168,15 +169,15 @@ public class ImageDisplay extends Widget {
|
||||
}
|
||||
// Calculate the new position and size:
|
||||
Vector2f imageBoder = this.propertyBorder.getPixel();
|
||||
Vector2f origin = imageBoder;
|
||||
Vector3f origin = new Vector3f(imageBoder.x(), imageBoder.y(), 0);
|
||||
imageBoder = imageBoder.multiply(2.0f);
|
||||
Vector2f imageRealSize = this.imageRenderSize.less(imageBoder);
|
||||
Vector2f imageRealSizeMax = this.size.less(imageBoder);
|
||||
Vector3f imageRealSizeMax = this.size.less(imageBoder.x(), imageBoder.y(), 0);
|
||||
|
||||
Vector2f ratioSizeDisplayRequested = this.propertyPosStop.less(this.propertyPosStart);
|
||||
//imageRealSizeMax *= ratioSizeDisplayRequested;
|
||||
|
||||
Vector2f delta = Gravity.gravityGenerateDelta(this.propertyGravity, this.size.less(this.imageRenderSize));
|
||||
Vector3f delta = this.propertyGravity.gravityGenerateDelta(this.size.less(this.imageRenderSize.x(), this.imageRenderSize.y(), 0));
|
||||
if (this.propertyFill.x()) {
|
||||
imageRealSize = imageRealSize.withX(imageRealSizeMax.x());
|
||||
delta = delta.withX(0.0f);
|
||||
@ -198,11 +199,11 @@ public class ImageDisplay extends Widget {
|
||||
} else if (ratio < ratioCurrent) {
|
||||
float oldX = imageRealSize.x();
|
||||
imageRealSize = imageRealSize.withX(imageRealSize.y() * ratio);
|
||||
origin = origin.add((oldX - imageRealSize.x()) * 0.5f, 0);
|
||||
origin = origin.add((oldX - imageRealSize.x()) * 0.5f, 0, 0);
|
||||
} else {
|
||||
float oldY = imageRealSize.y();
|
||||
imageRealSize = imageRealSize.withY(imageRealSize.x() / ratio);
|
||||
origin = origin.add(0, (oldY - imageRealSize.y()) * 0.5f);
|
||||
origin = origin.add(0, (oldY - imageRealSize.y()) * 0.5f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,7 +211,7 @@ public class ImageDisplay extends Widget {
|
||||
if (this.propertySmooth) {
|
||||
this.compositing.setPos(origin);
|
||||
} else {
|
||||
this.compositing.setPos(Vector2f.clipInt(origin));
|
||||
this.compositing.setPos(Vector3f.clipInt(origin));
|
||||
}
|
||||
this.compositing.printPart(imageRealSize, this.propertyPosStart, this.propertyPosStop);
|
||||
Log.debug("Paint Image at : " + origin + " size=" + imageRealSize);
|
||||
@ -224,7 +225,7 @@ public class ImageDisplay extends Widget {
|
||||
* @param uri URI of the new image
|
||||
* @param border New border size to set
|
||||
*/
|
||||
public void set(final Uri uri, final Dimension border) {
|
||||
public void set(final Uri uri, final Dimension2f border) {
|
||||
Log.verbose("Set Image : " + uri + " border=" + border);
|
||||
setPropertyBorder(border);
|
||||
setPropertySource(uri);
|
||||
@ -241,7 +242,7 @@ public class ImageDisplay extends Widget {
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
public void setPropertyBorder(final Dimension propertyBorder) {
|
||||
public void setPropertyBorder(final Dimension2f propertyBorder) {
|
||||
if (this.propertyBorder.equals(propertyBorder)) {
|
||||
return;
|
||||
}
|
||||
@ -250,7 +251,7 @@ public class ImageDisplay extends Widget {
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
public void setPropertyImageSize(final Dimension propertyImageSize) {
|
||||
public void setPropertyImageSize(final Dimension2f propertyImageSize) {
|
||||
if (this.propertyImageSize.equals(propertyImageSize)) {
|
||||
return;
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ package org.atriasoft.ewol.widget;
|
||||
import org.atriasoft.esignal.SignalEmpty;
|
||||
import org.atriasoft.etk.Uri;
|
||||
import org.atriasoft.etk.math.FMath;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector2i;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.etranslate.ETranslate;
|
||||
@ -65,8 +64,8 @@ public class Label extends Widget {
|
||||
|
||||
@Override
|
||||
public void calculateMinMaxSize() {
|
||||
Vector2f tmpMax = this.propertyMaxSize.getPixel();
|
||||
Vector2f tmpMin = this.propertyMinSize.getPixel();
|
||||
Vector3f tmpMax = this.propertyMaxSize.getPixel();
|
||||
Vector3f tmpMin = this.propertyMinSize.getPixel();
|
||||
Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} tmpMax : " + tmpMax);
|
||||
if (tmpMax.x() <= 999999) {
|
||||
this.text.setTextAlignment(0, tmpMax.x() - 4, AlignMode.LEFT);
|
||||
@ -75,7 +74,7 @@ public class Label extends Widget {
|
||||
Vector3f minSize = this.text.calculateSizeDecorated(this.value);
|
||||
Log.debug("[" + getId() + "] {" + getClass().getCanonicalName() + "} minSize : " + minSize);
|
||||
|
||||
this.minSize = new Vector2f(FMath.avg(tmpMin.x(), 4 + minSize.x(), tmpMax.x()), FMath.avg(tmpMin.y(), 4 + minSize.y(), tmpMax.y()));
|
||||
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()));
|
||||
Log.verbose("[" + getId() + "] {" + getClass().getCanonicalName() + "} Result min size : " + tmpMin + " < " + this.minSize + " < " + tmpMax);
|
||||
}
|
||||
|
||||
@ -117,7 +116,7 @@ public class Label extends Widget {
|
||||
this.text.clear();
|
||||
int paddingSize = 2;
|
||||
|
||||
Vector2f tmpMax = this.propertyMaxSize.getPixel();
|
||||
Vector3f tmpMax = this.propertyMaxSize.getPixel();
|
||||
// to know the size of one line :
|
||||
Vector3f minSize = this.text.calculateSize('A');
|
||||
|
||||
@ -146,7 +145,7 @@ public class Label extends Widget {
|
||||
|
||||
tmpTextOrigin = tmpTextOrigin.withY(tmpTextOrigin.y() + (this.minSize.y() - 2 * paddingSize) - minSize.y());
|
||||
|
||||
Vector2f textPos = new Vector2f(tmpTextOrigin.x(), tmpTextOrigin.y());
|
||||
Vector3f textPos = new Vector3f(tmpTextOrigin.x(), tmpTextOrigin.y(), 0);
|
||||
|
||||
Vector3f drawClippingPos = new Vector3f(paddingSize, paddingSize, -0.5f);
|
||||
Vector3f drawClippingSize = new Vector3f((this.size.x() - paddingSize), (this.size.y() - paddingSize), 1);
|
||||
|
@ -6,7 +6,6 @@
|
||||
package org.atriasoft.ewol.widget;
|
||||
|
||||
import org.atriasoft.etk.Color;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.annotation.EwolDescription;
|
||||
import org.atriasoft.ewol.compositing.CompositingDrawing;
|
||||
@ -29,8 +28,8 @@ class ProgressBar extends Widget {
|
||||
|
||||
@Override
|
||||
public void calculateMinMaxSize() {
|
||||
Vector2f tmpMin = this.propertyMinSize.getPixel();
|
||||
this.minSize = new Vector2f(Math.max(tmpMin.x(), 40.0f), Math.max(tmpMin.y(), ProgressBar.DOT_RADIUS * 2.0f));
|
||||
Vector3f tmpMin = this.propertyMinSize.getPixel();
|
||||
this.minSize = new Vector3f(Math.max(tmpMin.x(), 40.0f), Math.max(tmpMin.y(), ProgressBar.DOT_RADIUS * 2.0f), 10);
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
|
@ -5,13 +5,11 @@
|
||||
*/
|
||||
package org.atriasoft.ewol.widget;
|
||||
|
||||
import org.atriasoft.etk.Dimension;
|
||||
import org.atriasoft.etk.Distance;
|
||||
import org.atriasoft.etk.Dimension3f;
|
||||
import org.atriasoft.etk.math.FMath;
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector2i;
|
||||
import org.atriasoft.ewol.Gravity;
|
||||
import org.atriasoft.etk.math.Vector3b;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.etk.math.Vector3i;
|
||||
import org.atriasoft.ewol.annotation.EwolDescription;
|
||||
import org.atriasoft.ewol.annotation.EwolObjectProperty;
|
||||
import org.atriasoft.ewol.internal.Log;
|
||||
@ -25,7 +23,7 @@ public class Sizer extends ContainerN {
|
||||
modeVert; //!< Horizontal mode
|
||||
}
|
||||
|
||||
protected Dimension propertyBorderSize = new Dimension(Vector2f.ZERO, Distance.PIXEL); //!< Border size needed for all the display
|
||||
protected Dimension3f propertyBorderSize = Dimension3f.ZERO; //!< Border size needed for all the display
|
||||
|
||||
protected DisplayMode propertyMode = DisplayMode.modeHori; //!< Methode to display the widget list (vert/hory ...)
|
||||
|
||||
@ -47,9 +45,9 @@ public class Sizer extends ContainerN {
|
||||
@Override
|
||||
public void calculateMinMaxSize() {
|
||||
Log.verbose("[" + getId() + "] update minimum size");
|
||||
this.subExpend = Vector2b.FALSE;
|
||||
this.subExpend = Vector3b.FALSE;
|
||||
this.minSize = this.propertyMinSize.getPixel();
|
||||
Vector2f tmpBorderSize = this.propertyBorderSize.getPixel();
|
||||
Vector3f tmpBorderSize = this.propertyBorderSize.getPixel();
|
||||
Log.verbose("[" + getId() + "] {" + getClass().getCanonicalName() + "} set min size : " + this.minSize);
|
||||
for (Widget it : this.subWidget) {
|
||||
if (it == null) {
|
||||
@ -62,7 +60,7 @@ public class Sizer extends ContainerN {
|
||||
if (it.canExpand().y()) {
|
||||
this.subExpend = this.subExpend.withY(true);
|
||||
}
|
||||
Vector2f tmpSize = it.getCalculateMinSize();
|
||||
Vector3f tmpSize = it.getCalculateMinSize();
|
||||
Log.verbose("[" + getId() + "] NewMinSize=" + tmpSize);
|
||||
Log.verbose("[" + getId() + "] {" + getClass().getCanonicalName() + "} Get minSize=" + tmpSize);
|
||||
if (this.propertyMode == DisplayMode.modeVert) {
|
||||
@ -86,7 +84,7 @@ public class Sizer extends ContainerN {
|
||||
@XmlName("border")
|
||||
@EwolObjectProperty
|
||||
@EwolDescription("The sizer border size")
|
||||
public Dimension getPropertyBorderSize() {
|
||||
public Dimension3f getPropertyBorderSize() {
|
||||
return this.propertyBorderSize;
|
||||
}
|
||||
|
||||
@ -102,28 +100,28 @@ public class Sizer extends ContainerN {
|
||||
@Override
|
||||
public void onChangeSize() {
|
||||
super.onChangeSize();
|
||||
Vector2f tmpBorderSize = this.propertyBorderSize.getPixel();
|
||||
Vector3f tmpBorderSize = this.propertyBorderSize.getPixel();
|
||||
Log.verbose("[" + getId() + "] update size : " + this.size + " nbElement : " + this.subWidget.size() + " borderSize=" + tmpBorderSize + " from border=" + this.propertyBorderSize);
|
||||
Vector2f localWidgetSize = this.size.less(tmpBorderSize.multiply(2.0f));
|
||||
Vector3f localWidgetSize = this.size.less(tmpBorderSize.multiply(2.0f));
|
||||
// -1- calculate min-size and expand requested:
|
||||
Vector2f minSize = Vector2f.ZERO;
|
||||
Vector2i nbWidgetExpand = Vector2i.ZERO;
|
||||
Vector3f minSize = Vector3f.ZERO;
|
||||
Vector3i nbWidgetExpand = Vector3i.ZERO;
|
||||
for (Widget it : this.subWidget) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
Vector2f tmpSize = it.getCalculateMinSize();
|
||||
Vector3f tmpSize = it.getCalculateMinSize();
|
||||
if (this.propertyMode == DisplayMode.modeVert) {
|
||||
minSize = new Vector2f(Math.max(minSize.x(), tmpSize.x()), minSize.y() + tmpSize.y());
|
||||
minSize = new Vector3f(Math.max(minSize.x(), tmpSize.x()), minSize.y() + tmpSize.y(), Math.max(minSize.z(), tmpSize.z()));
|
||||
} else {
|
||||
minSize = new Vector2f(minSize.x() + tmpSize.x(), Math.max(minSize.y(), tmpSize.y()));
|
||||
minSize = new Vector3f(minSize.x() + tmpSize.x(), Math.max(minSize.y(), tmpSize.y()), Math.max(minSize.z(), tmpSize.z()));
|
||||
}
|
||||
Vector2b expand = it.canExpand();
|
||||
nbWidgetExpand = nbWidgetExpand.add(expand.x() ? 1 : 0, expand.y() ? 1 : 0);
|
||||
Vector3b expand = it.canExpand();
|
||||
nbWidgetExpand = nbWidgetExpand.add(expand.x() ? 1 : 0, expand.y() ? 1 : 0, 0);
|
||||
}
|
||||
// -2- Calculate the size to add at every elements...
|
||||
float deltaExpandSize = 0.0f;
|
||||
if (!nbWidgetExpand.isEqual(Vector2i.ZERO)) {
|
||||
if (!nbWidgetExpand.isEqual(Vector3i.ZERO)) {
|
||||
if (this.propertyMode == DisplayMode.modeVert) {
|
||||
deltaExpandSize = (localWidgetSize.y() - minSize.y()) / (nbWidgetExpand.y());
|
||||
} else {
|
||||
@ -157,8 +155,8 @@ public class Sizer extends ContainerN {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
Vector2f tmpSizeMin = it.getSize();
|
||||
Vector2f tmpSizeMax = it.getCalculateMaxSize();
|
||||
Vector3f tmpSizeMin = it.getSize();
|
||||
Vector3f tmpSizeMax = it.getCalculateMaxSize();
|
||||
// Now update his size his size in X and the current sizer size in Y:
|
||||
if (this.propertyMode == DisplayMode.modeVert) {
|
||||
if (it.canExpand().y() || (it == lastWidget && it.canExpandIfFree().y())) {
|
||||
@ -212,14 +210,14 @@ public class Sizer extends ContainerN {
|
||||
if (!it.canExpand().x() && !it.canExpandIfFree().x()) {
|
||||
continue;
|
||||
}
|
||||
Vector2f tmpSizeMin = it.getSize();
|
||||
Vector3f tmpSizeMin = it.getSize();
|
||||
tmpSizeMin = tmpSizeMin.withX(FMath.avg(tmpSizeMin.x(), localWidgetSize.x(), it.getCalculateMaxSize().x()));
|
||||
it.setSize(tmpSizeMin);
|
||||
} else {
|
||||
if (!it.canExpand().y() && !it.canExpandIfFree().y()) {
|
||||
continue;
|
||||
}
|
||||
Vector2f tmpSizeMin = it.getSize();
|
||||
Vector3f tmpSizeMin = it.getSize();
|
||||
tmpSizeMin = tmpSizeMin.withY(FMath.avg(tmpSizeMin.y(), localWidgetSize.y(), it.getCalculateMaxSize().y()));
|
||||
it.setSize(tmpSizeMin);
|
||||
}
|
||||
@ -229,36 +227,36 @@ public class Sizer extends ContainerN {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
it.setSize(Vector2f.clipInt(it.getSize()));
|
||||
it.setSize(Vector3f.clipInt(it.getSize()));
|
||||
}
|
||||
// -7- get under Size
|
||||
Vector2f underSize = Vector2f.ZERO;
|
||||
Vector3f underSize = Vector3f.ZERO;
|
||||
for (Widget it : this.subWidget) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
Vector2f size = it.getSize();
|
||||
Vector3f size = it.getSize();
|
||||
if (this.propertyMode == DisplayMode.modeVert) {
|
||||
underSize = new Vector2f(Math.max(underSize.x(), size.x()), underSize.y() + size.y());
|
||||
underSize = new Vector3f(Math.max(underSize.x(), size.x()), underSize.y() + size.y(), Math.max(underSize.z(), size.z()));
|
||||
} else {
|
||||
underSize = new Vector2f(underSize.x() + size.x(), Math.max(underSize.y(), size.y()));
|
||||
underSize = new Vector3f(underSize.x() + size.x(), Math.max(underSize.y(), size.y()), Math.max(underSize.z(), size.z()));
|
||||
}
|
||||
}
|
||||
Vector2f deltas = localWidgetSize.less(underSize);
|
||||
Vector3f deltas = localWidgetSize.less(underSize);
|
||||
|
||||
// -8- Calculate the local origin, depending of the gravity:
|
||||
Vector2f tmpOrigin = this.origin.add(tmpBorderSize).add(Gravity.gravityGenerateDelta(this.propertyGravity, deltas));
|
||||
Vector3f tmpOrigin = this.origin.add(tmpBorderSize).add(this.propertyGravity.gravityGenerateDelta(deltas));
|
||||
// -9- Set sub widget origin:
|
||||
for (Widget it : this.subWidget) {
|
||||
if (it == null) {
|
||||
continue;
|
||||
}
|
||||
Vector2f origin;
|
||||
Vector2f size = it.getSize();
|
||||
Vector3f origin;
|
||||
Vector3f size = it.getSize();
|
||||
if (this.propertyMode == DisplayMode.modeVert) {
|
||||
origin = Vector2f.clipInt(tmpOrigin.add(this.offset).add(Gravity.gravityGenerateDelta(this.propertyGravity, new Vector2f(underSize.x() - size.x(), 0.0f))));
|
||||
origin = Vector3f.clipInt(tmpOrigin.add(this.offset).add(this.propertyGravity.gravityGenerateDelta(new Vector3f(underSize.x() - size.x(), 0.0f, 0.0f))));
|
||||
} else {
|
||||
origin = Vector2f.clipInt(tmpOrigin.add(this.offset).add(Gravity.gravityGenerateDelta(this.propertyGravity, new Vector2f(0.0f, underSize.y() - size.y()))));
|
||||
origin = Vector3f.clipInt(tmpOrigin.add(this.offset).add(this.propertyGravity.gravityGenerateDelta(new Vector3f(0.0f, underSize.y() - size.y(), 0.0f))));
|
||||
}
|
||||
it.setOrigin(origin);
|
||||
if (this.propertyMode == DisplayMode.modeVert) {
|
||||
@ -277,7 +275,7 @@ public class Sizer extends ContainerN {
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
public void setPropertyBorderSize(final Dimension propertyBorderSize) {
|
||||
public void setPropertyBorderSize(final Dimension3f propertyBorderSize) {
|
||||
if (this.propertyBorderSize.equals(propertyBorderSize)) {
|
||||
return;
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ package org.atriasoft.ewol.widget;
|
||||
*/
|
||||
|
||||
import org.atriasoft.etk.Color;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.ewol.annotation.EwolDescription;
|
||||
import org.atriasoft.ewol.compositing.CompositingDrawing;
|
||||
@ -35,7 +34,7 @@ public class Spacer extends Widget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getWidgetAtPos(final Vector2f pos) {
|
||||
public Widget getWidgetAtPos(final Vector3f pos) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -11,13 +11,12 @@ import java.util.List;
|
||||
|
||||
import org.atriasoft.esignal.Signal;
|
||||
import org.atriasoft.etk.Color;
|
||||
import org.atriasoft.etk.Dimension;
|
||||
import org.atriasoft.etk.Dimension3f;
|
||||
import org.atriasoft.etk.Distance;
|
||||
import org.atriasoft.etk.math.FMath;
|
||||
import org.atriasoft.etk.math.Matrix4f;
|
||||
import org.atriasoft.etk.math.Vector2b;
|
||||
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.DrawProperty;
|
||||
import org.atriasoft.ewol.Gravity;
|
||||
@ -73,25 +72,25 @@ public class Widget extends EwolObject {
|
||||
|
||||
private final List<EventShortCut> localShortcut = new ArrayList<>(); //!< list of all shortcut in the widget
|
||||
|
||||
protected Vector2f maxSize = new Vector2f(999999, 999999); //!< internal: maximum size of the widget
|
||||
protected Vector3f maxSize = Vector3f.MAX_VALUE; //!< internal: maximum size of the widget
|
||||
|
||||
protected Vector2f minSize = new Vector2f(0, 0); //!< 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...
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
protected boolean needRegenerateDisplay = true; //!< the display might be done the next regeneration
|
||||
protected Vector2f offset = new Vector2f(0, 0); //!< Offset of the display in the view-port
|
||||
protected Vector3f offset = Vector3f.ZERO; //!< Offset of the display in the view-port
|
||||
|
||||
protected Vector2f origin = new Vector2f(0, 0); //!< internal ... I do not really known how if can use it ...
|
||||
protected Vector3f origin = Vector3f.ZERO; //!< internal ... I do not really known how if can use it ...
|
||||
|
||||
protected boolean propertyCanFocus = false; //!< the focus can be done on this widget
|
||||
protected Vector2b propertyExpand = new Vector2b(false, false); //!< the widget will expand if possible
|
||||
protected Vector2b propertyExpandIfFree = new Vector2b(false, false); //!< the widget will expand if possible
|
||||
protected Vector2b propertyFill = new Vector2b(true, true); //!< the widget will fill all the space provided by the parent.
|
||||
protected Gravity propertyGravity = Gravity.BUTTOM_LEFT; //!< Gravity of the widget
|
||||
protected Vector3b propertyExpand = Vector3b.FALSE; //!< the widget will expand if possible
|
||||
protected Vector3b propertyExpandIfFree = Vector3b.FALSE; //!< the widget will expand if possible
|
||||
protected Vector3b propertyFill = Vector3b.TRUE; //!< the widget will fill all the space provided by the parent.
|
||||
protected Gravity propertyGravity = Gravity.BOTTOM_LEFT; //!< Gravity of the widget
|
||||
protected boolean propertyHide = false; //!< hide a widget on the display
|
||||
protected Dimension propertyMaxSize = new Dimension(new Vector2f(999999, 999999), Distance.PIXEL); //!< user define the maximum size of the widget
|
||||
protected Dimension propertyMinSize = new Dimension(new Vector2f(0, 0), Distance.PIXEL); //!< user define the minimum 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
|
||||
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
// -- Shortcut : management of the shortcut
|
||||
@ -102,7 +101,7 @@ public class Widget extends EwolObject {
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
// -- Widget size:
|
||||
// ----------------------------------------------------------------------------------------------------------------
|
||||
protected Vector2f size = new Vector2f(10, 10); //!< internal: current size of the widget
|
||||
protected Vector3f size = Vector3f.VALUE_16; //!< internal: current size of the widget
|
||||
|
||||
// internal element calculated by the system
|
||||
protected float zoom = 1.0f; //!< generic widget zoom
|
||||
@ -131,11 +130,11 @@ public class Widget extends EwolObject {
|
||||
* @return 2D boolean represents the capacity to expend
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
public Vector2b canExpand() {
|
||||
public Vector3b canExpand() {
|
||||
if (!this.propertyHide) {
|
||||
return this.propertyExpand;
|
||||
}
|
||||
return new Vector2b(false, false);
|
||||
return Vector3b.FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -143,19 +142,19 @@ public class Widget extends EwolObject {
|
||||
* @return 2D boolean represents the capacity to expend (if some free space is available)
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
public Vector2b canExpandIfFree() {
|
||||
public Vector3b canExpandIfFree() {
|
||||
if (!this.propertyHide) {
|
||||
return this.propertyExpandIfFree;
|
||||
}
|
||||
return new Vector2b(false, false);
|
||||
return Vector3b.FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* get the filling capabilities xy
|
||||
* @return Vector2b repensent the capacity to xy filling
|
||||
* @return Vector3b repensent the capacity to xy filling
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
public Vector2b canFill() {
|
||||
public Vector3b canFill() {
|
||||
return this.propertyFill;
|
||||
}
|
||||
|
||||
@ -173,8 +172,8 @@ public class Widget extends EwolObject {
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
public void checkMaxSize() {
|
||||
final Vector2f pixelSize = this.propertyMaxSize.getPixel();
|
||||
this.maxSize = Vector2f.min(this.maxSize, pixelSize);
|
||||
final Vector3f pixelSize = this.propertyMaxSize.getPixel();
|
||||
this.maxSize = Vector3f.min(this.maxSize, pixelSize);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -183,8 +182,8 @@ public class Widget extends EwolObject {
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
public void checkMinSize() {
|
||||
final Vector2f pixelSize = this.propertyMinSize.getPixel();
|
||||
this.minSize = Vector2f.max(this.minSize, pixelSize);
|
||||
final Vector3f pixelSize = this.propertyMinSize.getPixel();
|
||||
this.minSize = Vector3f.max(this.minSize, pixelSize);
|
||||
}
|
||||
|
||||
public void drawWidgetTree(final int level) {
|
||||
@ -201,11 +200,11 @@ public class Widget extends EwolObject {
|
||||
* @return Requested size
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
public Vector2f getCalculateMaxSize() {
|
||||
public Vector3f getCalculateMaxSize() {
|
||||
if (!this.propertyHide) {
|
||||
return this.maxSize;
|
||||
}
|
||||
return new Vector2f(999999, 999999);
|
||||
return Vector3f.MAX_VALUE;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -213,11 +212,11 @@ public class Widget extends EwolObject {
|
||||
* @return Requested size
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
public Vector2f getCalculateMinSize() {
|
||||
public Vector3f getCalculateMinSize() {
|
||||
if (!this.propertyHide) {
|
||||
return this.minSize;
|
||||
}
|
||||
return new Vector2f(0, 0);
|
||||
return Vector3f.ZERO;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -257,7 +256,7 @@ public class Widget extends EwolObject {
|
||||
* get the offset property of the widget.
|
||||
* @return The current offset value.
|
||||
*/
|
||||
Vector2f getOffset() {
|
||||
Vector3f getOffset() {
|
||||
return this.offset;
|
||||
}
|
||||
|
||||
@ -265,7 +264,7 @@ public class Widget extends EwolObject {
|
||||
* Get the origin (absolute position in the windows).
|
||||
* @return Coordinate of the origin requested.
|
||||
*/
|
||||
public Vector2f getOrigin() {
|
||||
public Vector3f getOrigin() {
|
||||
return this.origin;
|
||||
}
|
||||
|
||||
@ -281,7 +280,7 @@ public class Widget extends EwolObject {
|
||||
@XmlAttribute
|
||||
@XmlName(value = "expand")
|
||||
@EwolDescription(value = "Request the widget Expand size while space is available")
|
||||
public Vector2b getPropertyExpand() {
|
||||
public Vector3b getPropertyExpand() {
|
||||
return this.propertyExpand;
|
||||
}
|
||||
|
||||
@ -289,7 +288,7 @@ public class Widget extends EwolObject {
|
||||
@XmlAttribute
|
||||
@XmlName(value = "expand-free")
|
||||
@EwolDescription(value = "Request the widget Expand size while free space is detected (does not generate expand in upper wideget)")
|
||||
public Vector2b getPropertyExpandIfFree() {
|
||||
public Vector3b getPropertyExpandIfFree() {
|
||||
return this.propertyExpandIfFree;
|
||||
}
|
||||
|
||||
@ -297,7 +296,7 @@ public class Widget extends EwolObject {
|
||||
@XmlAttribute
|
||||
@XmlName(value = "fill")
|
||||
@EwolDescription(value = "Fill the widget available size")
|
||||
public Vector2b getPropertyFill() {
|
||||
public Vector3b getPropertyFill() {
|
||||
return this.propertyFill;
|
||||
}
|
||||
|
||||
@ -321,7 +320,7 @@ public class Widget extends EwolObject {
|
||||
@XmlAttribute
|
||||
@XmlName(value = "max-size")
|
||||
@EwolDescription(value = "User maximum size")
|
||||
public Dimension getPropertyMaxSize() {
|
||||
public Dimension3f getPropertyMaxSize() {
|
||||
return this.propertyMaxSize;
|
||||
}
|
||||
|
||||
@ -329,7 +328,7 @@ public class Widget extends EwolObject {
|
||||
@XmlAttribute
|
||||
@XmlName(value = "min-size")
|
||||
@EwolDescription(value = "User minimum size")
|
||||
public Dimension getPropertyMinSize() {
|
||||
public Dimension3f getPropertyMinSize() {
|
||||
return this.propertyMinSize;
|
||||
}
|
||||
|
||||
@ -338,11 +337,11 @@ public class Widget extends EwolObject {
|
||||
* @return Requested size
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
public Vector2f getSize() {
|
||||
public Vector3f getSize() {
|
||||
if (!this.propertyHide) {
|
||||
return this.size;
|
||||
}
|
||||
return new Vector2f(0, 0);
|
||||
return Vector3f.ZERO;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -352,7 +351,7 @@ public class Widget extends EwolObject {
|
||||
* @return pointer on the widget found
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
public Widget getWidgetAtPos(final Vector2f pos) {
|
||||
public Widget getWidgetAtPos(final Vector3f pos) {
|
||||
if (!this.propertyHide) {
|
||||
return this;
|
||||
}
|
||||
@ -539,12 +538,12 @@ public class Widget extends EwolObject {
|
||||
protected void onRegenerateDisplay() {}
|
||||
|
||||
protected void onUpdateMinMaxSize() {
|
||||
final Vector2f pixelMin = this.propertyMinSize.getPixel();
|
||||
final Vector2f pixelMax = this.propertyMaxSize.getPixel();
|
||||
final Vector3f pixelMin = this.propertyMinSize.getPixel();
|
||||
final Vector3f pixelMax = this.propertyMaxSize.getPixel();
|
||||
// check minimum maximum compatibility :
|
||||
if (pixelMin.x() > pixelMax.x() || pixelMin.y() > pixelMax.y()) {
|
||||
Log.error("Can not set a 'min size' > 'max size' reset to maximum ...");
|
||||
this.propertyMaxSize = new Dimension(new Vector2f(999999, 999999), Distance.PIXEL);
|
||||
this.propertyMaxSize = new Dimension3f(Vector3f.MAX_VALUE, Distance.PIXEL);
|
||||
}
|
||||
requestUpdateSize();
|
||||
}
|
||||
@ -554,7 +553,7 @@ public class Widget extends EwolObject {
|
||||
* @param pos Absolute position that you request conversion.
|
||||
* @return The relative position.
|
||||
*/
|
||||
public Vector2f relativePosition(final Vector2f pos) {
|
||||
public Vector3f relativePosition(final Vector3f pos) {
|
||||
return pos.less(this.origin);
|
||||
}
|
||||
|
||||
@ -628,21 +627,21 @@ public class Widget extends EwolObject {
|
||||
* User set No maximum size.
|
||||
*/
|
||||
public void setNoMaxSize() {
|
||||
setPropertyMaxSize(new Dimension(new Vector2f(999999, 999999), Distance.PIXEL));
|
||||
setPropertyMaxSize(new Dimension3f(Vector3f.MAX_VALUE, Distance.PIXEL));
|
||||
}
|
||||
|
||||
/**
|
||||
* User set No minimum size.
|
||||
*/
|
||||
public void setNoMinSize() {
|
||||
setPropertyMinSize(new Dimension(new Vector2f(0, 0), Distance.PIXEL));
|
||||
setPropertyMinSize(new Dimension3f(Vector3f.ZERO, Distance.PIXEL));
|
||||
}
|
||||
|
||||
/**
|
||||
* set the zoom property of the widget.
|
||||
* @param newVal offset value.
|
||||
*/
|
||||
public void setOffset(final Vector2f newVal) {
|
||||
public void setOffset(final Vector3f newVal) {
|
||||
Log.info("Set offset: " + newVal);
|
||||
if (this.offset != newVal) {
|
||||
this.offset = newVal;
|
||||
@ -656,7 +655,7 @@ public class Widget extends EwolObject {
|
||||
* @param pos Position of the origin.
|
||||
* @note : INTERNAL EWOL SYSTEM
|
||||
*/
|
||||
public void setOrigin(final Vector2f pos) {
|
||||
public void setOrigin(final Vector3f pos) {
|
||||
this.origin = pos;
|
||||
}
|
||||
|
||||
@ -673,7 +672,7 @@ public class Widget extends EwolObject {
|
||||
}
|
||||
}
|
||||
|
||||
public void setPropertyExpand(final Vector2b value) {
|
||||
public void setPropertyExpand(final Vector3b value) {
|
||||
if (this.propertyExpand.equals(value)) {
|
||||
return;
|
||||
}
|
||||
@ -682,7 +681,7 @@ public class Widget extends EwolObject {
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
public void setPropertyExpandIfFree(final Vector2b value) {
|
||||
public void setPropertyExpandIfFree(final Vector3b value) {
|
||||
if (this.propertyExpandIfFree.equals(value)) {
|
||||
return;
|
||||
}
|
||||
@ -691,7 +690,7 @@ public class Widget extends EwolObject {
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
public void setPropertyFill(final Vector2b value) {
|
||||
public void setPropertyFill(final Vector3b value) {
|
||||
if (this.propertyFill.equals(value)) {
|
||||
return;
|
||||
}
|
||||
@ -718,7 +717,7 @@ public class Widget extends EwolObject {
|
||||
requestUpdateSize();
|
||||
}
|
||||
|
||||
public void setPropertyMaxSize(final Dimension value) {
|
||||
public void setPropertyMaxSize(final Dimension3f value) {
|
||||
if (this.propertyMaxSize.equals(value)) {
|
||||
return;
|
||||
}
|
||||
@ -726,7 +725,7 @@ public class Widget extends EwolObject {
|
||||
onUpdateMinMaxSize();
|
||||
}
|
||||
|
||||
public void setPropertyMinSize(final Dimension value) {
|
||||
public void setPropertyMinSize(final Dimension3f value) {
|
||||
if (this.propertyMinSize.equals(value)) {
|
||||
return;
|
||||
}
|
||||
@ -739,7 +738,7 @@ public class Widget extends EwolObject {
|
||||
* @return Requested size
|
||||
* @note : INTERNAL EWOL SYSTEM Do not modify the size yourself: calculation is complex and need knowledge of around widget
|
||||
*/
|
||||
public void setSize(final Vector2f value) {
|
||||
public void setSize(final Vector3f value) {
|
||||
this.size = value;
|
||||
}
|
||||
|
||||
@ -917,7 +916,7 @@ public class Widget extends EwolObject {
|
||||
// widget is hidden ...
|
||||
return;
|
||||
}
|
||||
final Vector2f displayOrigin = this.origin.add(this.offset);
|
||||
final Vector3f displayOrigin = this.origin.add(this.offset);
|
||||
|
||||
// check if the element is displayable in the windows :
|
||||
if (displayProp.windowsSize().x() < this.origin.x() || displayProp.windowsSize().y() < this.origin.y()) {
|
||||
|
@ -12,8 +12,8 @@ import java.util.ListIterator;
|
||||
import org.atriasoft.etk.Color;
|
||||
import org.atriasoft.etk.Uri;
|
||||
import org.atriasoft.etk.math.Matrix4f;
|
||||
import org.atriasoft.etk.math.Vector2f;
|
||||
import org.atriasoft.etk.math.Vector2i;
|
||||
import org.atriasoft.etk.math.Vector3f;
|
||||
import org.atriasoft.etk.math.Vector3i;
|
||||
import org.atriasoft.ewol.DrawProperty;
|
||||
import org.atriasoft.ewol.annotation.EwolDescription;
|
||||
import org.atriasoft.ewol.compositing.CompositingDrawing;
|
||||
@ -33,7 +33,7 @@ public class Windows extends Widget {
|
||||
|
||||
protected int colorBg = -1; //!< Default background color of the windows
|
||||
|
||||
protected List<Widget> popUpWidgetList = new ArrayList<Widget>();
|
||||
protected List<Widget> popUpWidgetList = new ArrayList<>();
|
||||
|
||||
@XmlManaged
|
||||
@XmlAttribute
|
||||
@ -109,10 +109,10 @@ public class Windows extends Widget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getWidgetAtPos(final Vector2f pos) {
|
||||
public Widget getWidgetAtPos(final Vector3f pos) {
|
||||
Log.verbose("Get widget at pos : " + pos);
|
||||
// calculate relative position
|
||||
Vector2f relativePos = relativePosition(pos);
|
||||
Vector3f relativePos = relativePosition(pos);
|
||||
// event go directly on the pop-up
|
||||
if (this.popUpWidgetList.size() != 0) {
|
||||
return this.popUpWidgetList.get(this.popUpWidgetList.size() - 1).getWidgetAtPos(pos);
|
||||
@ -141,14 +141,14 @@ public class Windows extends Widget {
|
||||
this.subWidget.calculateMinMaxSize();
|
||||
// TODO : do it better ... and manage gravity ...
|
||||
this.subWidget.setSize(this.size);
|
||||
this.subWidget.setOrigin(Vector2f.ZERO);
|
||||
this.subWidget.setOrigin(Vector3f.ZERO);
|
||||
this.subWidget.onChangeSize();
|
||||
}
|
||||
for (Widget it : this.popUpWidgetList) {
|
||||
if (it != null) {
|
||||
it.calculateMinMaxSize();
|
||||
it.setSize(this.size);
|
||||
it.setOrigin(Vector2f.ZERO);
|
||||
it.setOrigin(Vector3f.ZERO);
|
||||
it.onChangeSize();
|
||||
}
|
||||
}
|
||||
@ -274,7 +274,7 @@ public class Windows extends Widget {
|
||||
public void sysDraw() {
|
||||
//Log.verbose("Draw on " + this.size);
|
||||
// set the size of the open GL system
|
||||
OpenGL.setViewPort(Vector2f.ZERO, this.size);
|
||||
OpenGL.setViewPort(Vector3f.ZERO, this.size);
|
||||
OpenGL.disable(OpenGL.Flag.flag_dither);
|
||||
//OpenGL.disable(OpenGL.Flag.flagblend);
|
||||
OpenGL.disable(OpenGL.Flag.flag_stencilTest);
|
||||
@ -290,8 +290,8 @@ public class Windows extends Widget {
|
||||
|
||||
// clear the matrix system :
|
||||
OpenGL.setBasicMatrix(Matrix4f.IDENTITY);
|
||||
Vector2i tmpSize = new Vector2i((int) this.size.x(), (int) this.size.y());
|
||||
DrawProperty displayProp = new DrawProperty(tmpSize, Vector2i.ZERO, tmpSize);
|
||||
Vector3i tmpSize = new Vector3i((int) this.size.x(), (int) this.size.y(), (int) this.size.z());
|
||||
DrawProperty displayProp = new DrawProperty(tmpSize, Vector3i.ZERO, tmpSize);
|
||||
systemDraw(displayProp);
|
||||
OpenGL.disable(OpenGL.Flag.flag_blend);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user