diff --git a/.project b/.project
index 1f8938a..99f1734 100644
--- a/.project
+++ b/.project
@@ -6,6 +6,11 @@
atriasoft-ewol
+
+ org.python.pydev.PyDevBuilder
+
+
+
org.eclipse.jdt.core.javabuilder
@@ -20,6 +25,7 @@
org.eclipse.jdt.core.javanature
net.sf.eclipsecs.core.CheckstyleNature
+ org.python.pydev.pythonNature
diff --git a/blender_files/exportEmf.py b/blender_files/exportEmf.py
index dfabb20..2683c54 100644
--- a/blender_files/exportEmf.py
+++ b/blender_files/exportEmf.py
@@ -7,7 +7,8 @@ import bpy
list_elem = [
"Entry",
- "CheckBox"
+ "CheckBox",
+ "ScrollBar"
]
for elem in list_elem:
diff --git a/old_widget/Composer.cpp b/old_widget/Composer.cpp
deleted file mode 100644
index 2b4a66f..0000000
--- a/old_widget/Composer.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-
-#include
-#include
-#include
-#include
-#include
-#include
-ETK_DECLARE_TYPE(ewol::widget::Composer);
-
-ewol::widget::Composer::Composer() :
- propertyRemoveIfUnderRemove(this, "remove-if-under-remove", true, "Demand the remove iof the widget if the subObject demand a remove"),
- propertySubFile(this, "sub-file", "", "compose with a subXML file", ewol::widget::Composer::onChangePropertySubFile) {
- addObjectType("ewol::widget::Composer");
- // nothing to do ...
-}
-
-Widget ewol::widget::composerGenerateFile( etk::Uri _uri, ulong _id) {
- String tmpData;
- if (etk::uri::readAll(_uri, tmpData) == false) {
- Log.error("Can not read the file: " + _uri);
- return null;
- }
- return ewol::widget::composerGenerateString(tmpData, _id);
-}
-
-Widget ewol::widget::composerGenerateString( String _data, ulong _id) {
- ewol::widget::Manager widgetManager = ewol::getContext().getWidgetManager();
- if (_data == "") {
- return null;
- }
- exml::Document doc;
- String tmpData = _data;
- // replace all elements:
- if (_id != 0) {
- tmpData.replace("{ID}", etk::toString(_id));
- }
- if (doc.parse(tmpData) == false) {
- Log.error(" can not load file XML string...");
- return null;
- }
- exml::Element root = doc.toElement();
- if (root.nodes.size() == 0) {
- Log.error(" (l ?) No node in the XML file/string.");
- return null;
- }
- if (root.nodes.size() > 1) {
- Log.warning(" (l ?) More than 1 node in the XML file/string. (JUST parse the first)");
- }
- exml::Element pNode = root.nodes[0].toElement();
- if (pNode.exist() == false) {
- Log.error(" (l ?) No node in the XML file/string. {2}");
- return null;
- }
- String widgetName = pNode.getValue();
- if (widgetManager.exist(widgetName) == false) {
- Log.error("(l " + pNode.getPos() + ") Unknown basic node='" + widgetName + "' not in : [" + widgetManager.list() + "]" );
- return null;
- }
- Log.debug("try to create subwidget : '" + widgetName + "'");
- Widget tmpWidget = widgetManager.create(widgetName);
- if (tmpWidget == null) {
- EWOL_ERROR ("(l " + pNode.getPos() + ") Can not create the widget : '" + widgetName + "'");
- return null;
- }
- if (tmpWidget.loadXML(pNode) == false) {
- EWOL_ERROR ("(l " + pNode.getPos() + ") can not load widget properties : '" + widgetName + "'");
- }
- return tmpWidget;
-}
-
-ewol::widget::Composer::~Composer() {
-
-}
-
-boolean ewol::widget::Composer::loadFromFile( etk::Uri _uri, ulong _id) {
- String tmpData;
- if (etk::uri::readAll(_uri, tmpData) == false) {
- Log.error("Can not read the file: " + _uri);
- return false;
- }
- return loadFromString(tmpData, _id);
-}
-
-boolean ewol::widget::Composer::loadFromString( String _composerXmlString, ulong _id) {
- exml::Document doc;
- String tmpData = _composerXmlString;
- // replace all elements:
- if (_id != 0) {
- tmpData.replace("{ID}", etk::toString(_id));
- }
- if (doc.parse(tmpData) == false) {
- Log.error(" can not load file XML string...");
- return false;
- }
- exml::Element root = doc.nodes["composer"];
- if (root.exist() == false) {
- // Maybe a multiple node XML for internal config:
- root = doc.toElement();
- if (root.exist() == false) {
- Log.error("[" + getId() + "] {" + getObjectType() + "} (l ?) main node not find: 'composer' ...");
- return false;
- }
- if (root.nodes.size() == 0) {
- Log.error("[" + getId() + "] {" + getObjectType() + "} (l ?) no node in the Container XML element.");
- return false;
- }
- }
- // call upper class to parse his elements ...
- ewol::widget::Container::loadXML(root);
- if (this.subWidget == null) {
- Log.warning("Load data from composer and have no under Widget after loading");
- if (_composerXmlString.size() != 0) {
- Log.error("Error Loading XML data : " + _composerXmlString);
- return false;
- }
- }
- requestUpdateSize();
- return true;
-}
-
-void ewol::widget::Composer::requestDestroyFromChild( EwolObject _child) {
- ewol::widget::Container::requestDestroyFromChild(_child);
- if (*propertyRemoveIfUnderRemove == true) {
- Log.debug("Child widget remove ==> auto-remove");
- autoDestroy();
- }
-}
-
-void ewol::widget::Composer::onChangePropertySubFile() {
- Log.info("Load compositing form external file : " + propertySubFile);
- if (*propertySubFile == "") {
- // remove all elements:
- subWidgetRemove();
- return;
- }
- if (loadFromFile(*propertySubFile, getId()) == false) {
- Log.error("Can not load Player GUI from file ... " + propertySubFile);
- return;
- }
-}
-
-boolean ewol::widget::Composer::loadXML( exml::Element _node) {
- //Log.verbose("[" + getId() + "] t=" + getObjectType() + " Load XML (start)");
- if (_node.exist() == false) {
- return false;
- }
- // parse generic properties:
- Widget::loadXML(_node);
- // parse all the elements:
- if (_node.nodes.size() != 0) {
- Log.error("a composer Node Can not have Sub-element in XML ==> must be done in an external file and load it with attribute: 'sub-file'");
- }
- //drawWidgetTree();
- //Log.verbose("[" + getId() + "] t=" + getObjectType() + " Load XML (stop)");
- return true;
-}
\ No newline at end of file
diff --git a/old_widget/List.cpp b/old_widget/List.cpp
deleted file mode 100644
index a45f521..0000000
--- a/old_widget/List.cpp
+++ /dev/null
@@ -1,332 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-
-#include
-#include
-#include
-
-#include
-ETK_DECLARE_TYPE(ewol::widget::List);
-
-ewol::widget::List::List() {
- addObjectType("ewol::widget::List");
- this.paddingSizeX = 2;
- #ifdef __TARGET_OS__Android
- this.paddingSizeY = 10;
- #else
- this.paddingSizeY = 2;
- #endif
- this.nbVisibleRaw = 0;
- propertyCanFocus.setDirectCheck(true);
- this.limitScrolling = Vector2f(1, 0.5);
-}
-
-
-void ewol::widget::List::init() {
- ewol::widget::WidgetScrolled::init();
- addComposeElemnent("drawing", ememory::make());
- addComposeElemnent("text", ememory::make());
-}
-
-
-ewol::widget::List::~List() {
-}
-
-void ewol::widget::List::addComposeElemnent( String _name, ememory::Ptr _element) {
- this.compositingElements.set(_name, _element);
- this.listOObject.pushBack(_element);
-}
-
-void ewol::widget::List::clearComposeElemnent() {
- for (auto it: this.compositingElements) {
- it.second.clear();
- }
-}
-
-void ewol::widget::List::removeComposeElemnent() {
- this.compositingElements.clear();
-}
-
-ememory::Ptr ewol::widget::List::getComposeElemnent( String _name) {
- return this.compositingElements[_name];
-}
-/*
-void ewol::widget::List::setRawVisible(int _id) {
- Log.debug("Set Raw visible : " + _id);
- if (_id<0) {
- return;
- }
- if (_id == this.displayStartRaw) {
- // nothing to do ...
- return;
- }
- if (_id < this.displayStartRaw) {
- this.displayStartRaw = _id-2;
- } else {
- if (this.displayStartRaw + this.nbVisibleRaw < _id) {
- this.displayStartRaw = _id - this.nbVisibleRaw + 2;
- }
- }
- Vector2i matrixSize = getMatrixSize();
- if (this.displayStartRaw > matrixSize.y()) {
- this.displayStartRaw = matrixSize.y()-2;
- }
- if (this.displayStartRaw<0) {
- this.displayStartRaw = 0;
- }
- Log.debug("Set start raw : " + this.displayStartRaw);
- markToRedraw();
-}
-*/
-
-void ewol::widget::List::calculateMinMaxSize() {
- /*int fontId = getDefaultFontId();
- int minWidth = ewol::getWidth(fontId, this.label);
- int minHeight = ewol::getHeight(fontId);
- this.minSize.x = 3+minWidth;
- this.minSize.y = 3+minHeight;
- */
- this.minSize.setValue(200, 150);
-}
-
-void ewol::widget::List::onDraw() {
- for (int iii=0; iii this.listSizeX[xxx]) {
- this.listSizeX[xxx] = elementSize.x();
- }
- if (elementSize.y() > this.listSizeY[yyy]) {
- this.listSizeY[yyy] = elementSize.y();
- }
- }
- }
- // -------------------------------------------------------
- // -- Fill property applyence
- // -------------------------------------------------------
- if (propertyFill.x() == true) {
- int fullSize = 0;
- for (auto size: this.listSizeX) {
- fullSize += size;
- }
- if (fullSize < this.size.x() ) {
- // need to expand all elements:
- int residualAdd = (this.size.x() - fullSize) / matrixSize.x();
- if (residualAdd != 0) {
- for (auto size: this.listSizeX) {
- size += residualAdd;
- }
- }
- }
- }
- /*
- if (propertyFill.y() == true) {
- int fullSize = 0;
- for (auto size: this.listSizeY) {
- fullSize += size;
- }
- if (fullSize < this.size.y() ) {
- // need to expand all elements:
- int residualAdd = (this.size.y() - fullSize) / matrixSize.y();
- if (residualAdd != 0) {
- for (auto size: this.listSizeY) {
- size += residualAdd;
- }
- }
- }
- }
- */
- // -------------------------------------------------------
- // -- Calculate the start position size of each element
- // -------------------------------------------------------
- List listStartPosX;
- List listStartPosY;
- int lastPositionX = 0;
- for (auto size: this.listSizeX) {
- listStartPosX.pushBack(lastPositionX);
- lastPositionX += size;
- }
- int lastPositionY = 0;
- for (auto size: this.listSizeY) {
- lastPositionY += size;
- listStartPosY.pushBack(lastPositionY);
- }
- // -------------------------------------------------------
- // -- Update the scroolBar
- // -------------------------------------------------------
- this.maxSize = Vector2i(lastPositionX, lastPositionY);
- // -------------------------------------------------------
- // -- Clean the background
- // -------------------------------------------------------
- drawBackground();
- // -------------------------------------------------------
- // -- Draw each element
- // -------------------------------------------------------
- for (int_t yyy=0; yyy element out of range ==> nothing to display
- break;
- }
- if (startYposition > this.size.y()) {
- // ==> element out of range ==> nothing to display
- continue;
- }
- for (int_t xxx=0; xxx element out of range ==> nothing to display
- continue;
- }
- if (startXposition > this.size.x()) {
- // ==> element out of range ==> nothing to display
- break;
- }
- drawElement(Vector2i(xxx, yyy),
- Vector2f(startXposition, startYposition),
- Vector2f(this.listSizeX[xxx], this.listSizeY[yyy]));
- }
- }
- // -------------------------------------------------------
- // -- Draw Scrooling widget
- // -------------------------------------------------------
- WidgetScrolled::onRegenerateDisplay();
- }
-}
-
-Vector2i ewol::widget::List::getMatrixSize() {
- return Vector2i(1,0);
-}
-
-Vector2f ewol::widget::List::calculateElementSize( Vector2i _pos) {
- auto tmpText = ememory::staticPointerCast(getComposeElemnent("text"));
- String myTextToWrite = getData(ListRole::Text, _pos).getSafeString();
- Vector3f textSize = tmpText.calculateSize(myTextToWrite);
- Vector2i count = getMatrixSize();
- return Vector2f(textSize.x(),
- textSize.y() + this.paddingSizeY*3
- );
-}
-
-void ewol::widget::List::drawBackground() {
- auto BGOObjects = ememory::staticPointerCast(getComposeElemnent("drawing"));
- if (BGOObjects != null) {
- etk::Color<> basicBG = getBasicBG();
- BGOObjects.setColor(basicBG);
- BGOObjects.setPos(Vector3f(0, 0, 0) );
- BGOObjects.rectangleWidth(this.size);
- }
-}
-
-void ewol::widget::List::drawElement( Vector2i _pos, Vector2f _start, Vector2f _size) {
- String myTextToWrite = getData(ListRole::Text, _pos).getSafeString();
- etk::Color<> fg = getData(ListRole::FgColor, _pos).getSafeColor();
- auto backgroundVariant = getData(ListRole::BgColor, _pos);
- if (backgroundVariant.isColor() == true) {
- etk::Color<> bg = backgroundVariant.getColor();
- auto BGOObjects = ememory::staticPointerCast(getComposeElemnent("drawing"));
- if (BGOObjects != null) {
- BGOObjects.setColor(bg);
- BGOObjects.setPos(Vector3f(_start.x(), _start.y(), 0) );
- BGOObjects.rectangleWidth(_size);
- }
- }
- if (myTextToWrite != "") {
- auto tmpText = ememory::staticPointerCast(getComposeElemnent("text"));
- if (tmpText != null) {
- int displayPositionY = _start.y() + this.paddingSizeY;
- tmpText.setColor(fg);
- tmpText.setPos(Vector3f(_start.x() + this.paddingSizeX, displayPositionY, 0) );
- tmpText.print(myTextToWrite);;
- }
- }
-}
-
-boolean ewol::widget::List::onEventInput( ewol::event::Input _event) {
- Vector2f relativePos = relativePosition(_event.getPos());
- if (WidgetScrolled::onEventInput(_event) == true) {
- keepFocus();
- // nothing to do ... done on upper widet ...
- return true;
- }
- if (this.listSizeY.size() == 0) {
- return false;
- }
- relativePos = Vector2f(relativePos.x(),this.size.y() - relativePos.y()) + this.originScrooled;
- // Find the colomn and the row
- Vector2i pos{0,0};
- float_t offsetY = 0;
- for (int iii=0; iii= previous ) {
- pos.setY(iii);
- offsetY = previous;
- break;
- }
- if ( iii == this.listSizeY.size()-2
- && relativePos.y() >= offsetY ) {
- pos.setY(iii+1);
- break;
- }
- }
- float_t offsetX = 0;
- for (int iii=0; iii= previous ) {
- pos.setX(iii);
- offsetX = previous;
- break;
- }
- if ( iii == this.listSizeX.size()-2
- && relativePos.x() >= offsetX ) {
- pos.setX(iii+1);
- break;
- }
- }
- Vector2f posInternalMouse = relativePos - Vector2f(offsetX, offsetY);
- boolean isUsed = onItemEvent(_event, pos, posInternalMouse);
- if (isUsed == true) {
- // TODO : this generate bugs ... I did not understand why ..
- //WidgetManager::focusKeep(this);
- }
- return isUsed;
-}
-
-void ewol::widget::List::onGetFocus() {
- Log.debug("Ewol::List get focus");
-}
-
-void ewol::widget::List::onLostFocus() {
- Log.debug("Ewol::List Lost focus");
-}
diff --git a/old_widget/List.java b/old_widget/List.java
deleted file mode 100644
index 24d5d4a..0000000
--- a/old_widget/List.java
+++ /dev/null
@@ -1,94 +0,0 @@
-
-enum ListRole {
- Text = 11234, // string
- IsSelected, // bool
- IsExpand, // bool
- Icon, // string
- ChildCount, // uint_t
- HaveChild, // bool
- ParentId, // uint_t
- BgColor, // color
- FgColor, // color
- DistanceToRoot, // uint_t
- // Every other role must be set here:
- EndOfEwolRole
-};
-class List extends WidgetScrolled {
- public List();
- public void calculateMinMaxSize() ;
- // drawing capabilities ....
- protected List> listOObject; //!< generic element to display...
- protected List listSizeX; //!< size of every colomns
- protected List listSizeY; //!< size of every rows
- protected etk::Map> compositingElements;
- protected void addComposeElemnent( String _name, ememory::Ptr _element);
- protected void clearComposeElemnent();
- protected void removeComposeElemnent();
- protected ememory::Ptr getComposeElemnent( String _name);
- public void clearOObjectList();
- // list properties ...
- protected int paddingSizeX;
- protected int paddingSizeY;
- protected int displayStartRaw; //!< Current starting diaplayed raw
- protected int displayCurrentNbLine; //!< Number of line in the display
- protected int nbVisibleRaw; // set the number of visible raw (calculate don display)
- // function call to display the list :
- protected etk::Color<> getBasicBG() {
- return etk::Color<>(0xFF, 0xFF, 0xFF, 0xFF);
- }
-
- /**
- * Get the number of colomn and row availlable in the list
- * @return Number of colomn and row
- */
- protected Vector2i getMatrixSize() ;
-
- protected fluorine::Variant getData(int _role, Vector2i _pos) {
- switch (_role) {
- case ListRole::Text:
- return "";
- case ListRole::FgColor:
- return etk::Color<>(0x00, 0x00, 0x00, 0xFF);
- case ListRole::BgColor:
- if (_pos.y() % 2 == 0) {
- return etk::Color<>(0xFF, 0xFF, 0xFF, 0xFF);
- }
- return etk::Color<>(0x7F, 0x7F, 0x7F, 0xFF);
- }
- return fluorine::Variant();
- };
- /**
- * Calculate an element size to extimate the render size.
- * @note Does not generate the with the same size.
- * @param _pos Position of colomn and Raw of the element.
- * @return The estimate size of the element.
- */
- protected Vector2f calculateElementSize( Vector2i _pos);
- /**
- * Draw an element in the specific size and position.
- * @param _pos Position of colomn and Raw of the element.
- * @param _start Start display position.
- * @param _size Render raw size
- * @return The estimate size of the element.
- */
- protected void drawElement( Vector2i _pos, Vector2f _start, Vector2f _size);
- /**
- * Draw the background
- */
- protected void drawBackground();
-
- protected boolean onItemEvent( ewol::event::Input _event, Vector2i _pos, Vector2f _mousePosition) {
- return false;
- }
- /**
- * set a raw visible in the main display
- * @param _id Id of the raw that might be visible.
- */
- //void setRawVisible(int _id);
- protected void onGetFocus() ;
- protected void onLostFocus() ;
- protected void onDraw() ;
- public void onRegenerateDisplay() ;
- public boolean onEventInput( ewol::event::Input _event) ;
-}
-
diff --git a/old_widget/ListFileSystem.cpp b/old_widget/ListFileSystem.cpp
index 23447c2..e69de29 100644
--- a/old_widget/ListFileSystem.cpp
+++ b/old_widget/ListFileSystem.cpp
@@ -1,256 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-
-#include
-#include
-#include
-#include
-#include
-ETK_DECLARE_TYPE(ewol::widget::ListFileSystem);
-
-ewol::widget::ListFileSystem::ListFileSystem() :
- signalFileSelect(this, "file-select", ""),
- signalFileValidate(this, "file-validate", ""),
- signalFolderSelect(this, "folder-select", ""),
- signalFolderValidate(this, "folder-validate", ""),
- propertyPath(this, "path",
- etk::Path("/"),
- "Path to display",
- ewol::widget::ListFileSystem::onChangePropertyPath),
- propertyFile(this, "select",
- etk::Path(),
- "selection af a specific file",
- ewol::widget::ListFileSystem::onChangePropertyFile),
- propertyShowFile(this, "show-file",
- true,
- "display files",
- ewol::widget::ListFileSystem::onChangePropertyShowFile),
- propertyShowFolder(this, "show-folder",
- true,
- "display folders",
- ewol::widget::ListFileSystem::onChangePropertyShowFolder),
- propertyShowHidden(this, "show-hidden",
- true,
- "Show the hidden element (file, folder, ...)",
- ewol::widget::ListFileSystem::onChangePropertyShowHidden),
- propertyFilter(this, "filter",
- "",
- "regex to filter files ...",
- ewol::widget::ListFileSystem::onChangePropertyFilter),
- this.selectedLine(-1) {
- addObjectType("ewol::widget::ListFileSystem");
- #if defined(__TARGET_OS__Windows)
- propertyPath.setDirectCheck("c:/");
- #endif
- this.colorProperty = ewol::resource::ColorFile::create("THEME_COLOR:///ListFileSystem.json?lib=ewol");
- if (this.colorProperty != null) {
- this.colorIdText = this.colorProperty.request("text");
- this.colorIdBackground1 = this.colorProperty.request("background1");
- this.colorIdBackground2 = this.colorProperty.request("background2");
- this.colorIdBackgroundSelected = this.colorProperty.request("selected");
- }
- setMouseLimit(2);
-}
-
-ewol::widget::ListFileSystem::~ListFileSystem() {
- clearList();
-}
-
-void ewol::widget::ListFileSystem::clearList() {
- this.list.clear();
-}
-
-etk::Color<> ewol::widget::ListFileSystem::getBasicBG() {
- return this.colorProperty.get(this.colorIdBackground1);
-}
-
-static boolean localSort( etk::Path _left, etk::Path _right) {
- return _left.getString().toUpper() <= _right.getString().toUpper();
-}
-
-void ewol::widget::ListFileSystem::regenerateView() {
- clearList();
- this.selectedLine = -1;
- this.list.clear();
- this.originScrooled.setValue(0,0);
- uint flags = 0;
- if (*propertyShowHidden == true) {
- flags |= etk::path::LIST_HIDDEN;
- }
- if (*propertyShowFolder == true) {
- flags |= etk::path::LIST_FOLDER;
- }
- if (*propertyShowFile == true) {
- flags |= etk::path::LIST_FILE;
- }
- this.list = etk::path::list(*propertyPath, flags);
- Log.error("Lsit of element: " + this.list.size() );
- // Sort the list:
- etk::algorithm::quickSort(this.list, localSort);
- // request a redraw ...
- markToRedraw();
-}
-
-etk::Path ewol::widget::ListFileSystem::getSelect() {
- String tmpVal = "";
- if (this.selectedLine >= 0) {
- tmpVal = this.list[this.selectedLine].getFileName();
- }
- return tmpVal;
-}
-
-// select the specific file
-void ewol::widget::ListFileSystem::setSelect( etk::Path _data) {
- // remove selected line
- this.selectedLine = -1;
- // search the coresponding file :
- for (int iii=0; iii= 0
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM _pos.y()-offset < (int)this.list.size()) {
- Log.verbose("get filename for : '" + this.list[_pos.y()-offset] + ":'" + this.list[_pos.y()-offset].getFileName() + "'");
- return this.list[_pos.y()-offset].getFileName();
- }
- }
- return "+>>";
- case ListRole::FgColor:
- return this.colorProperty.get(this.colorIdText);
- case ListRole::BgColor:
- if (this.selectedLine == _pos.y()) {
- return this.colorProperty.get(this.colorIdBackgroundSelected);
- }
- if (_pos.y() % 2) {
- return this.colorProperty.get(this.colorIdBackground1);
- }
- return this.colorProperty.get(this.colorIdBackground2);
- }
- return fluorine::Variant();
-}
-
-boolean ewol::widget::ListFileSystem::onItemEvent( ewol::event::Input _event,
- Vector2i _pos,
- Vector2f _mousePosition) {
- int offset = 0;
- if (*propertyShowFolder == true) {
- if (*propertyPath == "/") {
- offset = 1;
- } else {
- offset = 2;
- }
- }
- if ( _event.getStatus() == KeyStatus::pressSingle
- || _event.getStatus() == KeyStatus::pressDouble) {
- Log.verbose("Event on List : IdInput=" + _event.getId() + " _pos=" + _pos );
- if (1 == _event.getId()) {
- if (_pos.y() > (int)this.list.size()+offset ) {
- this.selectedLine = -1;
- } else {
- this.selectedLine = _pos.y();
- }
- if( *propertyShowFolder == true
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.selectedLine == 0) {
- // "." folder
- if (_event.getStatus() == KeyStatus::pressSingle) {
- signalFolderSelect.emit(*propertyPath);
- } else {
- signalFolderValidate.emit(*propertyPath);
- }
- } else if ( *propertyShowFolder == true
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.selectedLine == 1) {
- // ".." folder
- if (_event.getStatus() == KeyStatus::pressSingle) {
- signalFolderSelect.emit(propertyPath.getParent());
- } else {
- signalFolderValidate.emit(propertyPath.getParent());
- }
- } else if( this.selectedLine-offset >= 0
- LOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOMLOM this.selectedLine-offset < (int)this.list.size() ) {
- // generate event extern:
- if(etk::path::isDirectory(this.list[this.selectedLine-offset])) {
- if (_event.getStatus() == KeyStatus::pressSingle) {
- signalFolderSelect.emit(this.list[this.selectedLine-offset]);
- } else {
- signalFolderValidate.emit(this.list[this.selectedLine-offset]);
- }
- } else {
- if (_event.getStatus() == KeyStatus::pressSingle) {
- signalFileSelect.emit(this.list[this.selectedLine-offset]);
- } else {
- signalFileValidate.emit(this.list[this.selectedLine-offset]);
- }
- }
- }
- // need to regenerate the display of the list :
- markToRedraw();
- return true;
- }
- }
- return false;
-}
-
-void ewol::widget::ListFileSystem::onChangePropertyPath() {
- Log.warning("Change Path: " + *propertyPath + " selected File=" + *propertyFile);;
- regenerateView();
-}
-
-void ewol::widget::ListFileSystem::onChangePropertyFile() {
- setSelect(propertyFile);
-}
-
-void ewol::widget::ListFileSystem::onChangePropertyShowFile() {
- regenerateView();
-}
-
-void ewol::widget::ListFileSystem::onChangePropertyShowFolder() {
- regenerateView();
-}
-
-void ewol::widget::ListFileSystem::onChangePropertyShowHidden() {
- regenerateView();
-}
-
-void ewol::widget::ListFileSystem::onChangePropertyFilter() {
- regenerateView();
-}
-
diff --git a/old_widget/ListFileSystem.java b/old_widget/ListFileSystem.java
deleted file mode 100644
index a94d5cc..0000000
--- a/old_widget/ListFileSystem.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-#pragma once
-
-#include
-#include
-#include
-
-namespace ewol {
- namespace widget {
- class ListFileSystem;
- using ListFileSystem = ememory::Ptr;
- using ListFileSystemWeak = ememory::WeakPtr;
- /**
- * Generic display folder class. This widget display the content of a single folder :
- */
- class ListFileSystem : public ewol::widget::List {
- public: // signals
- esignal::Signal signalFileSelect; //!< @event "file-select" Generated when a file is selected.
- esignal::Signal signalFileValidate; //!< @event "file-validate" Generate when the user validate (return) or double click on the element
- esignal::Signal signalFolderSelect;
- esignal::Signal signalFolderValidate;
- public: // properties
- eproperty::Value propertyPath; //!< Current folder that display point on.
- eproperty::Value propertyFile; //!< current selected file
- eproperty::Value propertyShowFile; //!< Show files elements
- eproperty::Value propertyShowFolder; //!< Display the folders elements
- eproperty::Value propertyShowHidden; //!< Display hidden elements
- eproperty::Value propertyFilter; //!< Regular expression to filter the view (for temporary file:".*(~|.bck|.pyc)\e")
- protected:
- ListFileSystem();
- public:
- DECLARE_WIDGET_FACTORY(ListFileSystem, "ListFileSystem");
- ~ListFileSystem();
- protected:
- ememory::Ptr this.colorProperty; //!< theme color property.
- int this.colorIdText; //!< Color of the text.
- int this.colorIdBackground1; //!< Color of the Background.
- int this.colorIdBackground2; //!< Color of the Background 2.
- int this.colorIdBackgroundSelected; //!< Color of line selected.
- protected:
- etk::Color<> getBasicBG() ;
- Vector2i getMatrixSize() ;
- fluorine::Variant getData(int _role, Vector2i _pos) ;
- boolean onItemEvent( ewol::event::Input _event, Vector2i _pos, Vector2f _mousePosition) ;
- protected:
- List this.list; //!< List of all element in the path. (they are filtered)
- /**
- * Clean the list of element.
- */
- void clearList();
- /**
- * Regenerate the content of the view. this is actually not automation on the system update.
- */
- void regenerateView();
- protected:
- int this.selectedLine; //!< Current Line ID that is selected
- public:
- /**
- * Select a specific file in the path
- * @param _data File to selested.
- */
- void setSelect( etk::Path _data);
- /**
- * Get the current selected file/folder/... in the list
- * @return the String of the element selected.
- */
- etk::Path getSelect() ;
- protected:
- void onChangePropertyPath();
- void onChangePropertyFile();
- void onChangePropertyShowFile();
- void onChangePropertyShowFolder();
- void onChangePropertyShowHidden();
- void onChangePropertyFilter();
- };
- };
-};
-
-
diff --git a/old_widget/Spin.java b/old_widget/Spin.java
index bd7db76..3817641 100644
--- a/old_widget/Spin.java
+++ b/old_widget/Spin.java
@@ -1,19 +1,4 @@
-/** @file
- * @author Edouard DUPIN
- * @copyright 2011, Edouard DUPIN, all right reserved
- * @license MPL v2.0 (see license file)
- */
-#pragma once
-#include
-#include
-#include
-
-namespace ewol {
- namespace widget {
- class Spin;
- using Spin = ememory::Ptr;
- using SpinWeak = ememory::WeakPtr;
/**
* a composed Spin is a Spin with an inside composed with the specify XML element
* ==> this permit to generate standard element simple
@@ -58,6 +43,4 @@ namespace ewol {
void onChangePropertyMax();
void onChangePropertyIncrement();
void onChangePropertyMantis();
- };
- };
-};
+}
diff --git a/resources/resources/ewol/data/ewol-gui-file-chooser.xml b/resources/resources/ewol/data/ewol-gui-file-chooser.xml
index 6dde4b3..832115c 100644
--- a/resources/resources/ewol/data/ewol-gui-file-chooser.xml
+++ b/resources/resources/ewol/data/ewol-gui-file-chooser.xml
@@ -1,50 +1,48 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+ show-folder="true"/>
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+ show-folder="false"/>
+
+
+
+ _T{ShowHiddenFiles}
+
+
+
+
+
+
\ No newline at end of file
diff --git a/resources/resources/ewol/theme/shape/ScrollBar.emf b/resources/resources/ewol/theme/shape/ScrollBar.emf
new file mode 100644
index 0000000..3a1df32
--- /dev/null
+++ b/resources/resources/ewol/theme/shape/ScrollBar.emf
@@ -0,0 +1,59 @@
+EMF(STRING)
+# Blender v3.1.2 EMF File: 'ScrollBar.blend'
+Mesh:ScrollBar_Cube
+ Vertex:24
+ 0.999633 0.939126 0.692412|0.999633 -1.060139 0.692306|-0.999632 0.939126 0.692412|-0.999633 -1.060139 0.692306|0.612843 1.917809 -0.016061|1.978234 0.460425 -0.016089|1.978234 -0.581316 -0.016244|0.612843 -2.038658 -0.016272|1.978234 0.460402 0.387109|0.612843 1.917744 0.387137|1.490144 1.429646 0.539397|0.612843 -2.038723 0.386926|1.978234 -0.581340 0.386954|1.490132 -1.550629 0.539242|-1.978234 0.460425 -0.016089|-0.612843 1.917809 -0.016061|-0.612843 -2.038658 -0.016272|-1.978234 -0.581316 -0.016244|-0.612843 1.917744 0.387137|-1.978234 0.460402 0.387109|-1.490144 1.429646 0.539397|-1.978234 -0.581340 0.386954|-0.612843 -2.038723 0.386926|-1.490132 -1.550629 0.539242|
+ UV-mapping:
+ 0.074219 0.944092|0.120606 0.943115|0.115281 0.993733|0.113157 0.949323|0.078476 0.953015|0.086126 0.983938|0.111696 0.944402|0.078245 0.948093|0.086991 0.991581|0.080720 0.975385|0.080974 0.959440|0.101935 0.962117|0.090904 0.956084|0.091524 0.958446|0.099259 0.991963|0.112358 0.970195|0.112313 0.968453|0.135323 0.928695|0.121095 0.968324|0.080520 0.995525|0.074219 0.986621|0.074219 0.970034|0.080326 0.968432|0.107967 0.984841|0.112540 0.967208|0.075778 0.969678|0.101857 0.966301|0.091271 0.973167|0.160017 0.949517|0.148891 0.991157|0.149273 0.949899|0.160391 0.947013|0.147828 0.992006|0.147360 0.946251|0.147234 0.948141|0.172935 0.987744|0.142967 0.985035|0.169571 0.949093|0.140506 0.992060|0.141409 0.949093|0.137534 0.984544|0.132842 0.945463|0.162384 0.992768|0.174912 0.947924|0.178598 0.993618|0.173214 0.991100|0.160398 0.991157|0.173590 0.945432|0.170474 0.990254|0.142456 0.948632|0.131613 0.991157|0.171985 0.949093|0.174065 0.974453|0.175519 0.961875|0.171541 0.947863|0.140670 0.947863|0.142179 0.988266|0.135923 0.961795|0.136685 0.974302|0.167802 0.988435|
+ Normal(face):44
+ -0.297799 -0.000051 0.954629|0.297888 -0.000051 0.954601|0.000000 -0.297895 0.954599|0.000000 0.297793 0.954631|0.324683 0.304215 -0.895564|0.324748 -0.304232 -0.895534|-0.324684 0.304215 -0.895563|-0.324748 -0.304232 -0.895534|-0.297814 -0.000018 0.954624|-0.297928 -0.000142 0.954588|-0.297873 -0.000018 0.954605|0.297873 -0.000018 0.954605|0.297759 -0.000142 0.954641|0.297814 -0.000018 0.954624|0.000000 -1.000000 -0.000160|0.000000 1.000000 0.000161|-1.000000 0.000000 0.000000|1.000000 -0.000000 -0.000000|-0.729754 -0.683710 -0.000039|0.729764 0.683700 0.000110|-0.729754 0.683710 0.000040|0.729764 -0.683700 -0.000110|-0.729764 -0.683700 -0.000109|0.729754 0.683710 0.000040|-0.729764 0.683700 0.000110|0.729754 -0.683710 -0.000039|0.000000 -0.000053 1.000000|0.000000 0.000019 -1.000000|0.000000 0.000149 -1.000000|
+ Face:44
+ palette:gui_border_1
+ 3/0/0 2/1/0 19/2/0| 0/3/1 1/4/1 12/5/1| 1/6/2 3/7/2 22/8/2| 2/9/3 0/10/3 9/11/3| 8/12/4 9/11/4 10/13/4| 11/14/5 12/15/5 13/16/5| 18/17/6 19/2/6 20/18/6| 21/19/7 22/20/7 23/21/7| 2/1/8 20/18/8 19/2/8| 19/2/9 21/19/9 3/0/9| 21/19/10 23/21/10 3/0/10| 1/4/11 13/22/11 12/5/11| 12/5/12 8/23/12 0/3/12| 8/23/13 10/24/13 0/3/13| 3/7/2 23/25/2 22/8/2| 22/8/2 11/14/2 1/6/2| 11/14/2 13/16/2 1/6/2| 0/10/3 10/13/3 9/11/3| 9/11/3 18/26/3 2/9/3| 18/26/3 20/27/3 2/9/3|
+ palette:gui_border_2
+ 7/28/14 22/29/14 16/30/14| 15/31/15 9/32/15 4/33/15| 21/34/16 14/35/16 17/36/16| 5/37/17 12/38/17 6/39/17| 16/40/18 21/34/18 17/36/18| 9/32/19 5/41/19 4/33/19| 18/42/20 14/43/20 19/44/20| 7/28/21 12/45/21 11/46/21| 7/28/14 11/46/14 22/29/14| 15/31/15 18/42/15 9/32/15| 21/34/16 19/47/16 14/35/16| 5/37/17 8/48/17 12/38/17| 16/40/22 22/49/22 21/34/22| 9/32/23 8/50/23 5/41/23| 18/42/24 15/31/24 14/43/24| 7/28/25 6/51/25 12/45/25|
+ palette:gui_center
+ 1/6/26 2/9/26 3/7/26| 1/6/26 0/3/26 2/9/26|
+ palette:gui_back
+ 15/52/27 4/53/27 5/54/27| 5/54/28 6/55/28 17/56/28| 6/55/27 7/57/27 17/56/27| 7/57/27 16/58/27 17/56/27| 17/56/28 14/59/28 5/54/28| 14/59/27 15/52/27 5/54/27|
+
+# Just for information:
+Palettes:gui_back
+ Ns 225.000000
+ Ka 1.000000 1.000000 1.000000
+ Kd 0.800000 0.000000 0.005632
+ Ks 0.500000 0.500000 0.500000
+ Ke 0.000000 0.000000 0.000000
+ vNi 1.450000
+ d 1.000000
+ illum 2
+# Just for information:
+Palettes:gui_border_1
+ Ns 225.000000
+ Ka 1.000000 1.000000 1.000000
+ Kd 0.000000 0.002615 0.800000
+ Ks 0.500000 0.500000 0.500000
+ Ke 0.000000 0.000000 0.000000
+ vNi 1.450000
+ d 1.000000
+ illum 2
+# Just for information:
+Palettes:gui_border_2
+ Ns 225.000000
+ Ka 1.000000 1.000000 1.000000
+ Kd 0.000000 0.800000 0.170495
+ Ks 0.500000 0.500000 0.500000
+ Ke 0.000000 0.000000 0.000000
+ vNi 1.450000
+ d 1.000000
+ illum 2
+# Just for information:
+Palettes:gui_center
+ Ns 225.000000
+ Ka 1.000000 1.000000 1.000000
+ Kd 0.438544 0.438544 0.438544
+ Ks 0.500000 0.500000 0.500000
+ Ke 0.000000 0.000000 0.000000
+ vNi 1.450000
+ d 1.000000
+ illum 2
diff --git a/resources/resources/ewol/theme/shape/WidgetScrolled.json b/resources/resources/ewol/theme/shape/WidgetScrolled.json
index 51b4ce9..e46af91 100644
--- a/resources/resources/ewol/theme/shape/WidgetScrolled.json
+++ b/resources/resources/ewol/theme/shape/WidgetScrolled.json
@@ -1,23 +1,24 @@
{
- mode:2,
- display-outside:true,
+ # padding "outside" the object in pixel ==> prevent bad display
+ "padding-out-left":0,
+ "padding-out-right":1,
+ "padding-out-top":1,
+ "padding-out-buttom":1,
- padding-out-left:1,
- padding-out-right:1,
- padding-out-top:1,
- padding-out-buttom:1,
+ # padding "inside" the object in pixel ==> prevent bad display
+ "padding-in-left":1,
+ "padding-in-right":1,
+ "padding-in-top":1,
+ "padding-in-buttom":1,
- border-left:1,
- border-right:1,
- border-top:1,
- border-buttom:1,
+ # render program:
+ "program-vert":"THEME:shape/aaRenderShape.vert?lib=ewol",
+ "program-frag":"THEME:shape/aaRenderShape.frag?lib=ewol",
- padding-in-left:3,
- padding-in-right:3,
- padding-in-top:3,
- padding-in-buttom:3,
+ # Object to render (with modification)
+ "object-file":"THEME:shape/ScrollBar.emf?lib=ewol",
- change-time:200,
- program:"THEME_GUI:///WidgetScrolled.prog?lib=ewol",
- color:"THEME_COLOR:///WidgetScrolled.json?lib=ewol"
-}
+ "palette":"THEME:shape/palette_gui.json?lib=ewol",
+
+ "change-time":0
+}
\ No newline at end of file
diff --git a/samples/src/sample/atriasoft/ewol/BasicWindows.java b/samples/src/sample/atriasoft/ewol/BasicWindows.java
index ee20706..a820d70 100644
--- a/samples/src/sample/atriasoft/ewol/BasicWindows.java
+++ b/samples/src/sample/atriasoft/ewol/BasicWindows.java
@@ -87,12 +87,12 @@ public class BasicWindows extends Windows {
//! [ewol_sample_HW_windows_title]
setPropertyTitle("No title set !!! for this test");
- final Sizer sizerVertMain = new Sizer(DisplayMode.modeVert);
+ final Sizer sizerVertMain = new Sizer(DisplayMode.VERTICAL);
sizerVertMain.setPropertyExpand(Vector3b.TRUE);
sizerVertMain.setPropertyFill(Vector3b.TRUE);
setSubWidget(sizerVertMain);
- this.sizerMenuHori = new Sizer(DisplayMode.modeHori);
+ this.sizerMenuHori = new Sizer(DisplayMode.HORIZONTAL);
this.sizerMenuHori.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE);
this.sizerMenuHori.setPropertyLockExpand(Vector3b.TRUE);
this.sizerMenuHori.setPropertyFill(Vector3b.TRUE);
@@ -109,7 +109,7 @@ public class BasicWindows extends Windows {
sizerVertMain.subWidgetAdd(simpleSpacer);
}
- this.sizerTestAreaHori = new Sizer(DisplayMode.modeHori);
+ this.sizerTestAreaHori = new Sizer(DisplayMode.HORIZONTAL);
this.sizerTestAreaHori.setPropertyExpand(Vector3b.TRUE_FALSE_FALSE);
this.sizerTestAreaHori.setPropertyExpandIfFree(Vector3b.TRUE);
this.sizerTestAreaHori.setPropertyFill(Vector3b.TRUE_FALSE_FALSE);
diff --git a/samples/src/sample/atriasoft/ewol/ComplexWindiows1/MainWindows.java b/samples/src/sample/atriasoft/ewol/ComplexWindiows1/MainWindows.java
index 95d86fe..8c01cf4 100644
--- a/samples/src/sample/atriasoft/ewol/ComplexWindiows1/MainWindows.java
+++ b/samples/src/sample/atriasoft/ewol/ComplexWindiows1/MainWindows.java
@@ -16,17 +16,17 @@ public class MainWindows extends Windows {
//! [ewol_sample_HW_windows_title]
setPropertyTitle("Simple sample test");
//EwolObject.getContext().getFontDefault().setName("FreeSans");
- Sizer sizerMain = new Sizer(DisplayMode.modeVert);
+ Sizer sizerMain = new Sizer(DisplayMode.VERTICAL);
sizerMain.setPropertyExpand(Vector3b.TRUE);
sizerMain.setPropertyFill(Vector3b.TRUE);
setSubWidget(sizerMain);
- Sizer sizerHori1 = new Sizer(DisplayMode.modeHori);
+ Sizer sizerHori1 = new Sizer(DisplayMode.HORIZONTAL);
sizerHori1.setPropertyExpand(Vector3b.TRUE);
sizerHori1.setPropertyFill(Vector3b.TRUE);
sizerMain.subWidgetAdd(sizerHori1);
- Sizer sizerHori2 = new Sizer(DisplayMode.modeHori);
+ Sizer sizerHori2 = new Sizer(DisplayMode.HORIZONTAL);
sizerHori2.setPropertyExpand(Vector3b.TRUE);
sizerHori2.setPropertyFill(Vector3b.TRUE);
sizerMain.subWidgetAdd(sizerHori2);
diff --git a/samples/src/sample/atriasoft/ewol/sampleButton/MainWindows.java b/samples/src/sample/atriasoft/ewol/sampleButton/MainWindows.java
index 9e8be58..a2fa9b6 100644
--- a/samples/src/sample/atriasoft/ewol/sampleButton/MainWindows.java
+++ b/samples/src/sample/atriasoft/ewol/sampleButton/MainWindows.java
@@ -1,5 +1,6 @@
package sample.atriasoft.ewol.sampleButton;
+import org.atriasoft.etk.Uri;
import org.atriasoft.ewol.widget.Composer;
import org.atriasoft.ewol.widget.Widget;
@@ -11,9 +12,14 @@ public class MainWindows extends BasicWindows {
setPropertyTitle("Simple Button test");
//final Widget data = Composer.composerGenerateString("");
//final Widget data = Composer.composerGenerateString("");
- final Widget data = Composer.composerGenerateString("");
+ /*
+ final Widget data = Composer.composerGenerateString("");
+ */
+
+ final Widget data = Composer.composerGenerateFile(new Uri("DATA", "ewol-gui-file-chooser.xml", "ewol"));
this.setTestWidget(data);
+
/*
final Button simpleButton = Button
.createLabelButton("1 - My button internal
2 - label
3 - an other text ...
4 - and an other line to be sure ...");
@@ -21,6 +27,12 @@ public class MainWindows extends BasicWindows {
simpleButton.setPropertyFill(Vector3b.FALSE);
this.setTestWidget(simpleButton);
*/
-
+ /*
+ final ListFileSystem widget = new ListFileSystem();
+ widget.setPropertyPath("/home/heero");
+ widget.setPropertyExpand(Vector3b.TRUE);
+ widget.setPropertyFill(Vector3b.FALSE);
+ this.setTestWidget(widget);
+ */
}
}
diff --git a/src/module-info.java b/src/module-info.java
index 4f1801c..df373e5 100644
--- a/src/module-info.java
+++ b/src/module-info.java
@@ -26,4 +26,5 @@ open module org.atriasoft.ewol {
requires transitive io.scenarium.logger;
requires org.atriasoft.loader3d;
requires org.atriasoft.egami;
+ requires java.base;
}
diff --git a/src/org/atriasoft/etranslate/ETranslate.java b/src/org/atriasoft/etranslate/ETranslate.java
index a96da81..1fecaa3 100644
--- a/src/org/atriasoft/etranslate/ETranslate.java
+++ b/src/org/atriasoft/etranslate/ETranslate.java
@@ -106,8 +106,8 @@ public class ETranslate {
ETranslate.loadTranslation();
Log.verbose("Request translate: '" + instance + "'");
// find all iterance of 'T{' ... '}'
- final String out = Pattern.compile("T\\{.*\\}").matcher(instance).replaceAll(mr -> {
- final String data = mr.group();
+ final String out = Pattern.compile("_T\\{(.*)\\}").matcher(instance).replaceAll(mr -> {
+ final String data = mr.group(1);
Log.info("translate : '" + data + "'");
final String itTranslate = ETranslate.globalTranslate.get(data);
if (itTranslate == null) {
diff --git a/src/org/atriasoft/ewol/context/EwolContext.java b/src/org/atriasoft/ewol/context/EwolContext.java
index eb8e45f..bbc3092 100644
--- a/src/org/atriasoft/ewol/context/EwolContext.java
+++ b/src/org/atriasoft/ewol/context/EwolContext.java
@@ -301,6 +301,8 @@ public class EwolContext extends GaleApplication {
@Override
public void onPointer(final KeySpecial special, final KeyType type, final int pointerID, final Vector2f pos, final KeyStatus state) {
+ // TODO: WTF !!!
+ this.input.setLastKeyboardSpecial(special);
switch (state) {
case move:
// Log.debug("Receive MSG : THREAD_INPUT_MOTION");
diff --git a/src/org/atriasoft/ewol/widget/Button.java b/src/org/atriasoft/ewol/widget/Button.java
index 7c9d52d..eaaab87 100644
--- a/src/org/atriasoft/ewol/widget/Button.java
+++ b/src/org/atriasoft/ewol/widget/Button.java
@@ -126,7 +126,6 @@ public class Button extends ContainerToggle {
onChangePropertyShaper();
// can not support multiple click...
setMouseLimit(1);
- this.shape = new GuiShape(this.propertyConfig);
}
@Override
diff --git a/src/org/atriasoft/ewol/widget/CheckBox.java b/src/org/atriasoft/ewol/widget/CheckBox.java
index e7ee581..4c025bd 100644
--- a/src/org/atriasoft/ewol/widget/CheckBox.java
+++ b/src/org/atriasoft/ewol/widget/CheckBox.java
@@ -10,6 +10,7 @@ import org.atriasoft.ewol.widget.Sizer.DisplayMode;
import org.atriasoft.exml.annotation.XmlAttribute;
import org.atriasoft.exml.annotation.XmlManaged;
import org.atriasoft.exml.annotation.XmlName;
+import org.atriasoft.exml.annotation.XmlText;
public class CheckBox extends Container {
@@ -50,7 +51,7 @@ public class CheckBox extends Container {
}
public CheckBox(final String basicLabel) {
- final Sizer subs = new Sizer(DisplayMode.modeHori);
+ final Sizer subs = new Sizer(DisplayMode.HORIZONTAL);
subs.setPropertyLockExpand(Vector3b.TRUE);
subs.setPropertyGravity(Gravity.CENTER);
setSubWidget(subs);
@@ -74,7 +75,7 @@ public class CheckBox extends Container {
}
@XmlManaged
- @XmlAttribute
+ @XmlText
@XmlName(value = "label")
@EwolDescription(value = "value of the label")
public String getPropertyLabel() {
diff --git a/src/org/atriasoft/ewol/widget/Composer.java b/src/org/atriasoft/ewol/widget/Composer.java
index b3584a1..6d42af2 100644
--- a/src/org/atriasoft/ewol/widget/Composer.java
+++ b/src/org/atriasoft/ewol/widget/Composer.java
@@ -19,7 +19,6 @@ import org.atriasoft.exml.annotation.XmlAttribute;
import org.atriasoft.exml.annotation.XmlManaged;
import org.atriasoft.exml.annotation.XmlName;
import org.atriasoft.exml.exception.ExmlException;
-import org.atriasoft.exml.model.XmlElement;
import org.atriasoft.gale.context.ClipboardList;
import org.atriasoft.gale.context.Cursor;
import org.atriasoft.gale.key.KeyKeyboard;
@@ -34,80 +33,44 @@ public class Composer extends Container {
}
public static Widget composerGenerateFile(final Uri uri, final long id) {
-
final byte[] elemData = Uri.getAllData(uri);
if (elemData == null) {
Log.error("Can not read the Stream : " + uri);
return null;
}
final String dataToParse = new String(elemData);
- return composerGenerateString(dataToParse, id);
- /*
- String tmpData;
- if (etk::uri::readAll(_uri, tmpData) == false) {
- Log.error("Can not read the file: " + _uri);
- return null;
+ final Widget tmp = composerGenerateString(dataToParse, id);
+ if (tmp == null) {
+ Log.error("Faiul to Load data: {}", uri);
}
- return ewol::widget::composerGenerateString(tmpData, _id);
- */
+ return tmp;
}
public static Widget composerGenerateString(final String data) {
return composerGenerateString(data, 0);
}
- public static Widget composerGenerateString(final String data, final long id) {
- Widget[] result = null;
+ public static Widget composerGenerateString(String data, final long id) {
+ boolean requestComposer = true;
+ if (!data.startsWith("")) {
+ data = "\n" + data + "\n";
+ requestComposer = false;
+ }
+ data = data.replace("{ID}", Long.toString(id));
+ Composer[] result = null;
try {
result = Exml.parse(data, Composer.class, "Composer");//new WidgetXmlFactory());
} catch (final ExmlException ex) {
+ Log.error("Fail to load Data !!! {}", ex.toString());
ex.printStackTrace();
}
- return result[0];
- /*
- ewol::widget::Manager widgetManager = ewol::getContext().getWidgetManager();
- if (_data == "") {
+ if (result == null) {
return null;
}
- exml::Document doc;
- String tmpData = _data;
- // replace all elements:
- if (_id != 0) {
- tmpData.replace("{ID}", etk::toString(_id));
+ if (requestComposer) {
+ return result[0];
}
- if (doc.parse(tmpData) == false) {
- Log.error(" can not load file XML string...");
- return null;
- }
- exml::Element root = doc.toElement();
- if (root.nodes.size() == 0) {
- Log.error(" (l ?) No node in the XML file/string.");
- return null;
- }
- if (root.nodes.size() > 1) {
- Log.warning(" (l ?) More than 1 node in the XML file/string. (JUST parse the first)");
- }
- exml::Element pNode = root.nodes[0].toElement();
- if (pNode.exist() == false) {
- Log.error(" (l ?) No node in the XML file/string. {2}");
- return null;
- }
- String widgetName = pNode.getValue();
- if (widgetManager.exist(widgetName) == false) {
- Log.error("(l " + pNode.getPos() + ") Unknown basic node='" + widgetName + "' not in : [" + widgetManager.list() + "]" );
- return null;
- }
- Log.debug("try to create subwidget : '" + widgetName + "'");
- Widget tmpWidget = widgetManager.create(widgetName);
- if (tmpWidget == null) {
- EWOL_ERROR ("(l " + pNode.getPos() + ") Can not create the widget : '" + widgetName + "'");
- return null;
- }
- if (tmpWidget.loadXML(pNode) == false) {
- EWOL_ERROR ("(l " + pNode.getPos() + ") can not load widget properties : '" + widgetName + "'");
- }
- return tmpWidget;
- */
+ return result[0].getSubWidget();
}
protected boolean propertyRemoveIfUnderRemove; //!< Remove the composer if sub element request a remove
@@ -406,26 +369,26 @@ public class Composer extends Container {
}
/**
- * load a composition with a file
- * @param _uri Name of the file
- * @param _id Unique ID that is used in replacing the balise "{ID}" inside the File (do nothing if == 0)
- * @return true == > all done OK
- * @return false == > some error occured
- */
+ * load a composition with a file
+ * @param _uri Name of the file
+ * @param _id Unique ID that is used in replacing the balise "{ID}" inside the File (do nothing if == 0)
+ * @return true == > all done OK
+ * @return false == > some error occured
+ */
public boolean loadFromFile(final Uri uri) {
- return loadFromFile(uri, 0);
- }
-
- public boolean loadFromFile(final Uri uri, final long id) {
- /*
- String tmpData;
- if (etk::uri::readAll(_uri, tmpData) == false) {
- Log.error("Can not read the file: " + _uri);
+ final Widget data = composerGenerateFile(uri, this.getId());
+ // check parse is well done.
+ if (data == null) {
return false;
}
- return loadFromString(tmpData, _id);
- */
- return false;
+ // keep the real Data (remove subComposer
+ if (data instanceof final Composer tmp) {
+ setSubWidget(tmp.getSubWidget());
+ } else {
+ setSubWidget(data);
+ }
+ // T O D O: Change this with a throw.a..a
+ return true;
}
/**
@@ -435,62 +398,19 @@ public class Composer extends Container {
* @return true == > all done OK
* @return false == > some error occured
*/
- public boolean loadFromString(final String composerXmlString, final long id) {
- return false;
- /*
- XmlElement doc;
- String tmpData = _composerXmlString;
- // replace all elements:
- if (_id != 0) {
- tmpData.replace("{ID}", Long.toString(_id));
- }
- if (doc.parse(tmpData) == false) {
- Log.error(" can not load file XML string...");
+ public boolean loadFromString(final String composerXmlString) {
+ final Widget data = composerGenerateString(composerXmlString, this.getId());
+ // check parse is well done.
+ if (data == null) {
return false;
}
- XmlElement root = doc.nodes["composer"];
- if (root.exist() == false) {
- // Maybe a multiple node XML for internal config:
- root = doc.toElement();
- if (root.exist() == false) {
- Log.error("[" + getId() + "] {" + getObjectType() + "} (l ?) main node not find: 'composer' ...");
- return false;
- }
- if (root.nodes.size() == 0) {
- Log.error("[" + getId() + "] {" + getObjectType() + "} (l ?) no node in the Container XML element.");
- return false;
- }
+ // keep the real Data (remove subComposer
+ if (data instanceof final Composer tmp) {
+ setSubWidget(tmp.getSubWidget());
+ } else {
+ setSubWidget(data);
}
- // call upper class to parse his elements ...
- super.loadXML(root);
- if (this.subWidget == null) {
- Log.warning("Load data from composer and have no under Widget after loading");
- if (_composerXmlString.size() != 0) {
- Log.error("Error Loading XML data : " + _composerXmlString);
- return false;
- }
- }
- requestUpdateSize();
- return true;
- */
- }
-
- public boolean loadXML(final XmlElement node) {
- /*
- //Log.verbose("[" + getId() + "] t=" + getObjectType() + " Load XML (start)");
- if (_node != null) {
- return false;
- }
- // parse generic properties:
- super.loadXML(_node);
- // parse all the elements:
- if (_node.nodes.size() != 0) {
- Log.error("a composer Node Can not have Sub-element in XML ==> must be done in an external file and load it with attribute: 'sub-file'");
- }
- //drawWidgetTree();
- //Log.verbose("[" + getId() + "] t=" + getObjectType() + " Load XML (stop)");
- *
- */
+ // T O D O: Change this with a throw.a..a
return true;
}
@@ -511,7 +431,7 @@ public class Composer extends Container {
subWidgetRemove();
return;
}
- if (!loadFromFile(this.propertySubFile, getId())) {
+ if (!loadFromFile(this.propertySubFile)) {
Log.error("Can not load Player GUI from file ... " + this.propertySubFile);
}
}
diff --git a/src/org/atriasoft/ewol/widget/Label.java b/src/org/atriasoft/ewol/widget/Label.java
index 25100b2..4505f68 100644
--- a/src/org/atriasoft/ewol/widget/Label.java
+++ b/src/org/atriasoft/ewol/widget/Label.java
@@ -212,7 +212,7 @@ public class Label extends Widget {
@XmlManaged
@XmlText
- @XmlName(value = "ZZZZZZZZZ-ploppppppp")
+ @XmlName(value = "value")
@EwolDescription(value = "Displayed value string")
public void setPropertyValue(final String propertyValue) {
if (this.propertyValue.equals(propertyValue)) {
diff --git a/src/org/atriasoft/ewol/widget/ListFileSystem.java b/src/org/atriasoft/ewol/widget/ListFileSystem.java
new file mode 100644
index 0000000..3799fd4
--- /dev/null
+++ b/src/org/atriasoft/ewol/widget/ListFileSystem.java
@@ -0,0 +1,368 @@
+/*
+ * @author Edouard DUPIN
+ * @copyright 2011, Edouard DUPIN, all right reserved
+ * @license MPL v2.0 (see license file)
+ */
+package org.atriasoft.ewol.widget;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.atriasoft.esignal.Signal;
+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.Vector3f;
+import org.atriasoft.etk.math.Vector3i;
+import org.atriasoft.ewol.annotation.EwolDescription;
+import org.atriasoft.ewol.annotation.EwolSignal;
+import org.atriasoft.ewol.event.EventInput;
+import org.atriasoft.ewol.internal.Log;
+import org.atriasoft.ewol.resource.ResourceColorFile;
+import org.atriasoft.ewol.widget.model.ListRole;
+import org.atriasoft.exml.annotation.XmlAttribute;
+import org.atriasoft.exml.annotation.XmlManaged;
+import org.atriasoft.exml.annotation.XmlName;
+import org.atriasoft.gale.key.KeyStatus;
+
+/**
+ * Generic display folder class. This widget display the content of a single folder :
+ */
+public class ListFileSystem extends WidgetList {
+ @EwolSignal(name = "file-select")
+ @EwolDescription(value = "A file has been selected in the List")
+ public Signal signalFileSelect = new Signal<>(); //!< @event "file-select" Generated when a file is selected.
+
+ @EwolSignal(name = "file-validate")
+ @EwolDescription(value = "A file has been validated on the list (double clicked or return pressed)")
+ public Signal signalFileValidate = new Signal<>(); //!< @event "file-validate" Generate when the user validate (return) or double click on the element
+
+ @EwolSignal(name = "folder-select")
+ @EwolDescription(value = "A folder has been selected in the List")
+ public Signal signalFolderSelect = new Signal<>();
+
+ @EwolSignal(name = "folder-validate")
+ @EwolDescription(value = "A folder has been validated on the list (double clicked or return pressed)")
+ public Signal signalFolderValidate = new Signal<>();
+ protected String propertyPath = "/"; //!< Current folder that display point on.
+ protected File propertyFile = null; //!< current selected file
+ protected boolean propertyShowFile = true; //!< Show files elements
+ protected boolean propertyShowFolder = true; //!< Display the folders elements
+ protected boolean propertyShowHidden = true; //!< Display hidden elements
+ protected String propertyFilter = "^.*$"; //!< Regular expression to filter the view (for temporary file:".*(~|.bck|.pyc)\e")
+
+ protected ResourceColorFile colorProperty; //!< theme color property.
+ protected int colorIdText = -1; //!< Color of the text.
+ protected int colorIdBackground1 = -1; //!< Color of the Background.
+ protected int colorIdBackground2 = -1; //!< Color of the Background 2.
+ protected int colorIdBackgroundSelected = -1; //!< Color of line selected.
+ protected List list = new ArrayList<>(); //!< List of all element in the File. (they are filtered)
+ protected int selectedLine; //!< Current Line ID that is selected
+
+ public ListFileSystem() {
+
+ this.colorProperty = new ResourceColorFile(new Uri("THEME", "/color/ListFileSystem.json", "ewol"));
+ if (this.colorProperty != null) {
+ this.colorIdText = this.colorProperty.request("text");
+ this.colorIdBackground1 = this.colorProperty.request("background1");
+ this.colorIdBackground2 = this.colorProperty.request("background2");
+ this.colorIdBackgroundSelected = this.colorProperty.request("selected");
+ }
+ setMouseLimit(2);
+ }
+
+ /**
+ * Clean the list of element.
+ */
+ protected void clearList() {
+ this.list.clear();
+ }
+
+ @Override
+ protected Color getBasicBG() {
+ return this.colorProperty.get(this.colorIdBackground1);
+ }
+
+ @Override
+ protected Object getData(final ListRole role, final Vector2i pos) {
+ switch (role) {
+ case Text: {
+ int offset = 0;
+ if (this.propertyShowFolder) {
+ if (this.propertyPath.equals("/")) {
+ offset = 1;
+ } else {
+ offset = 2;
+ }
+ if (pos.y() == 0) {
+ return ".";
+ } else if (pos.y() == 1 && !this.propertyPath.equals("/")) {
+ return "..";
+ }
+ }
+ if (pos.y() - offset >= 0 && pos.y() - offset < this.list.size()) {
+ Log.verbose("get filename for : {}:'{}'", this.list.get(pos.y() - offset), this.list.get(pos.y() - offset).getName());
+ return this.list.get(pos.y() - offset).getName();
+ }
+ }
+ return "+>>";
+ case FgColor:
+ return this.colorProperty.get(this.colorIdText);
+ case BgColor:
+ if (this.selectedLine == pos.y()) {
+ return this.colorProperty.get(this.colorIdBackgroundSelected);
+ }
+ if (pos.y() % 2 == 0) {
+ return this.colorProperty.get(this.colorIdBackground1);
+ }
+ return this.colorProperty.get(this.colorIdBackground2);
+ default:
+ break;
+ }
+ return null;
+ }
+
+ @Override
+ protected Vector2i getMatrixSize() {
+ int offset = 0;
+ if (this.propertyShowFolder) {
+ if (this.propertyPath.equals("/")) {
+ offset = 1;
+ } else {
+ offset = 2;
+ }
+ }
+ return new Vector2i(1, this.list.size() + offset);
+ }
+
+ @XmlManaged
+ @XmlAttribute
+ @XmlName(value = "select")
+ @EwolDescription(value = "selection af a specific file")
+ public File getPropertyFile() {
+ return this.propertyFile;
+ }
+
+ @XmlManaged
+ @XmlAttribute
+ @XmlName(value = "filter")
+ @EwolDescription(value = "regex to filter files ...")
+ public String getPropertyFilter() {
+ return this.propertyFilter;
+ }
+
+ @XmlManaged
+ @XmlAttribute
+ @XmlName(value = "Path")
+ @EwolDescription(value = "Path to display")
+ public String getPropertyPath() {
+ return this.propertyPath;
+ }
+
+ /**
+ * Get the current selected file/folder/... in the list
+ * @return the String of the element selected.
+ */
+ public File getSelect() {
+ if (this.selectedLine >= 0) {
+ return this.list.get(this.selectedLine);
+ }
+ return null;
+ }
+
+ @XmlManaged
+ @XmlAttribute
+ @XmlName(value = "show-file")
+ @EwolDescription(value = "Display files")
+ public boolean isPropertyShowFile() {
+ return this.propertyShowFile;
+ }
+
+ @XmlManaged
+ @XmlAttribute
+ @XmlName(value = "show-folder")
+ @EwolDescription(value = "display folders")
+ public boolean isPropertyShowFolder() {
+ return this.propertyShowFolder;
+ }
+
+ @XmlManaged
+ @XmlAttribute
+ @XmlName(value = "show-hidden")
+ @EwolDescription(value = "Show the hidden element (file, folder, ...)")
+ public boolean isPropertyShowHidden() {
+ return this.propertyShowHidden;
+ }
+
+ public List listSelectedFiles(final String dir, final boolean showFiles, final boolean showFolder, final boolean showHidden) throws IOException {
+ final List fileList = new ArrayList<>();
+ try (DirectoryStream stream = Files.newDirectoryStream(Paths.get(dir))) {
+ for (final Path path : stream) {
+ if (Files.isHidden(path) && !showHidden) {
+ continue;
+ }
+ if (Files.isDirectory(path) && showFolder) {
+ Log.error("Add Directory '{}'", path);
+ fileList.add(new File(path.toString()));
+ }
+ if (!Files.isDirectory(path) && showFiles) {
+ Log.error("Add File '{}'", path);
+ fileList.add(new File(path.toString()));
+ }
+ }
+ }
+ return fileList;
+ }
+
+ @Override
+ protected boolean onItemEvent(final EventInput event, final Vector3i pos, final Vector3f mousePosition) {
+ int offset = 0;
+ if (this.propertyShowFolder) {
+ if (this.propertyPath.equals("/")) {
+ offset = 1;
+ } else {
+ offset = 2;
+ }
+ }
+ if (event.status() == KeyStatus.pressSingle || event.status() == KeyStatus.pressDouble) {
+ Log.verbose("Event on List : IdInput=" + event.inputId() + " _pos=" + pos);
+ if (1 == event.inputId()) {
+ if (pos.y() > this.list.size() + offset) {
+ this.selectedLine = -1;
+ } else {
+ this.selectedLine = pos.y();
+ }
+ if (this.propertyShowFolder && this.selectedLine == 0) {
+ // "." folder
+ if (event.status() == KeyStatus.pressSingle) {
+ this.signalFolderSelect.emit(this.propertyPath);
+ } else {
+ this.signalFolderValidate.emit(this.propertyPath);
+ }
+ } else if (this.propertyShowFolder && this.selectedLine == 1) {
+ // ".." folder
+ if (event.status() == KeyStatus.pressSingle) {
+ this.signalFolderSelect.emit(new File(this.propertyPath).getParent());
+ } else {
+ this.signalFolderValidate.emit(new File(this.propertyPath).getParent());
+ }
+ } else if (this.selectedLine - offset >= 0 && this.selectedLine - offset < this.list.size()) {
+ // generate event extern:
+ if (this.list.get(this.selectedLine - offset).isDirectory()) {
+ if (event.status() == KeyStatus.pressSingle) {
+ this.signalFolderSelect.emit(this.list.get(this.selectedLine - offset).getPath());
+ } else {
+ this.signalFolderValidate.emit(this.list.get(this.selectedLine - offset).getPath());
+ }
+ } else {
+ if (event.status() == KeyStatus.pressSingle) {
+ this.signalFileSelect.emit(this.list.get(this.selectedLine - offset).getPath());
+ } else {
+ this.signalFileValidate.emit(this.list.get(this.selectedLine - offset).getPath());
+ }
+ }
+ }
+ // need to regenerate the display of the list :
+ markToRedraw();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Regenerate the content of the view. this is actually not automation on the system update.
+ */
+ protected void regenerateView() {
+ clearList();
+ this.selectedLine = -1;
+ this.list.clear();
+ this.originScrooled = new Vector2f(0, 0);
+ final int flags = 0;
+ try {
+ this.list = listSelectedFiles(this.propertyPath, this.propertyShowFile, this.propertyShowFolder, this.propertyShowHidden);
+ } catch (final IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ this.list = new ArrayList<>();
+ }
+ Collections.sort(this.list, Comparator.comparing(File::getName));//.reversed());
+ // request a redraw ...
+ markToRedraw();
+ }
+
+ public void setPropertyFile(final File propertyFile) {
+ if (this.propertyFile.equals(propertyFile)) {
+ return;
+ }
+ this.propertyFile = propertyFile;
+ regenerateView();
+ }
+
+ public void setPropertyFilter(final String propertyFilter) {
+ if (!this.propertyFilter.equals(propertyFilter)) {
+ return;
+ }
+ this.propertyFilter = propertyFilter;
+ regenerateView();
+ }
+
+ public void setPropertyPath(final String propertyPath) {
+ if (this.propertyPath.equals(propertyPath)) {
+ return;
+ }
+ this.propertyPath = propertyPath;
+ regenerateView();
+ }
+
+ public void setPropertyShowFile(final boolean propertyShowFile) {
+ if (this.propertyShowFile == propertyShowFile) {
+ return;
+ }
+ this.propertyShowFile = propertyShowFile;
+ regenerateView();
+ }
+
+ public void setPropertyShowFolder(final boolean propertyShowFolder) {
+ if (this.propertyShowFolder == propertyShowFolder) {
+ return;
+ }
+ this.propertyShowFolder = propertyShowFolder;
+ regenerateView();
+ }
+
+ public void setPropertyShowHidden(final boolean propertyShowHidden) {
+ if (this.propertyShowHidden == propertyShowHidden) {
+ return;
+ }
+ this.propertyShowHidden = propertyShowHidden;
+ regenerateView();
+ }
+
+ /**
+ * Select a specific file in the File
+ * @param data File to selected.
+ */
+ public void setSelect(final File data) {
+ // remove selected line
+ this.selectedLine = -1;
+ // search the coresponding file :
+ for (int iii = 0; iii < this.list.size(); ++iii) {
+ if (this.list.get(iii).equals(data)) {
+ // we find the line :
+ this.selectedLine = iii;
+ break;
+ }
+ }
+ markToRedraw();
+ }
+}
diff --git a/src/org/atriasoft/ewol/widget/Sizer.java b/src/org/atriasoft/ewol/widget/Sizer.java
index 3d39d3c..41c5583 100644
--- a/src/org/atriasoft/ewol/widget/Sizer.java
+++ b/src/org/atriasoft/ewol/widget/Sizer.java
@@ -14,18 +14,20 @@ import org.atriasoft.ewol.annotation.EwolDescription;
import org.atriasoft.ewol.annotation.EwolObjectProperty;
import org.atriasoft.ewol.internal.Log;
import org.atriasoft.exml.annotation.XmlAttribute;
+import org.atriasoft.exml.annotation.XmlCaseSensitive;
import org.atriasoft.exml.annotation.XmlManaged;
import org.atriasoft.exml.annotation.XmlName;
public class Sizer extends ContainerN {
+ @XmlCaseSensitive(value = false)
public enum DisplayMode {
- modeHori, //!< Vertical mode
- modeVert; //!< Horizontal mode
+ HORIZONTAL, //!< Horizontal mode
+ VERTICAL; //!< Vertical mode
}
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 ...)
+ protected DisplayMode propertyMode = DisplayMode.HORIZONTAL; //!< Methode to display the widget list (vert/hory ...)
/**
* Constructor
@@ -63,7 +65,7 @@ public class Sizer extends ContainerN {
final Vector3f tmpSize = it.getCalculateMinSize();
Log.verbose("[" + getId() + "] NewMinSize=" + tmpSize);
Log.verbose("[" + getId() + "] {" + getClass().getCanonicalName() + "} Get minSize=" + tmpSize);
- if (this.propertyMode == DisplayMode.modeVert) {
+ if (this.propertyMode == DisplayMode.VERTICAL) {
this.minSize = this.minSize.withY(this.minSize.y() + tmpSize.y());
if (tmpSize.x() > this.minSize.x()) {
this.minSize = this.minSize.withX(tmpSize.x());
@@ -111,7 +113,7 @@ public class Sizer extends ContainerN {
continue;
}
final Vector3f tmpSize = it.getCalculateMinSize();
- if (this.propertyMode == DisplayMode.modeVert) {
+ if (this.propertyMode == DisplayMode.VERTICAL) {
minSize = new Vector3f(Math.max(minSize.x(), tmpSize.x()), minSize.y() + tmpSize.y(), Math.max(minSize.z(), tmpSize.z()));
} else {
minSize = new Vector3f(minSize.x() + tmpSize.x(), Math.max(minSize.y(), tmpSize.y()), Math.max(minSize.z(), tmpSize.z()));
@@ -122,7 +124,7 @@ public class Sizer extends ContainerN {
// -2- Calculate the size to add at every elements...
float deltaExpandSize = 0.0f;
if (!nbWidgetExpand.isEqual(Vector3i.ZERO)) {
- if (this.propertyMode == DisplayMode.modeVert) {
+ if (this.propertyMode == DisplayMode.VERTICAL) {
deltaExpandSize = (localWidgetSize.y() - minSize.y()) / (nbWidgetExpand.y());
} else {
deltaExpandSize = (localWidgetSize.x() - minSize.x()) / (nbWidgetExpand.x());
@@ -143,7 +145,7 @@ public class Sizer extends ContainerN {
float residualNext = 0.0f;
// get the number of element that need to devide...
int countCalculation = nbWidgetExpand.x();
- if (this.propertyMode == DisplayMode.modeVert) {
+ if (this.propertyMode == DisplayMode.VERTICAL) {
countCalculation = nbWidgetExpand.y();
}
// -4.1- Update every subWidget size
@@ -158,7 +160,7 @@ public class Sizer extends ContainerN {
Vector3f tmpSizeMin = it.getSize();
final 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 (this.propertyMode == DisplayMode.VERTICAL) {
if (it.canExpand().y() || (it == lastWidget && it.canExpandIfFree().y())) {
float sizeExpand = tmpSizeMin.y() + deltaExpandSize;
if (sizeExpand > tmpSizeMax.y()) {
@@ -190,7 +192,7 @@ public class Sizer extends ContainerN {
if (countCalculation <= 0) {
break;
}
- if (this.propertyMode == DisplayMode.modeVert) {
+ if (this.propertyMode == DisplayMode.VERTICAL) {
deltaExpandSize = residualNext / (countCalculation);
} else {
deltaExpandSize = residualNext / (countCalculation);
@@ -206,7 +208,7 @@ public class Sizer extends ContainerN {
continue;
}
// Now update his size, his size in X and the current sizer size in Y:
- if (this.propertyMode == DisplayMode.modeVert) {
+ if (this.propertyMode == DisplayMode.VERTICAL) {
if (!it.canExpand().x() && !it.canExpandIfFree().x()) {
continue;
}
@@ -236,7 +238,7 @@ public class Sizer extends ContainerN {
continue;
}
final Vector3f size = it.getSize();
- if (this.propertyMode == DisplayMode.modeVert) {
+ if (this.propertyMode == DisplayMode.VERTICAL) {
underSize = new Vector3f(Math.max(underSize.x(), size.x()), underSize.y() + size.y(), Math.max(underSize.z(), size.z()));
} else {
underSize = new Vector3f(underSize.x() + size.x(), Math.max(underSize.y(), size.y()), Math.max(underSize.z(), size.z()));
@@ -253,13 +255,13 @@ public class Sizer extends ContainerN {
}
Vector3f origin;
final Vector3f size = it.getSize();
- if (this.propertyMode == DisplayMode.modeVert) {
+ if (this.propertyMode == DisplayMode.VERTICAL) {
origin = Vector3f.clipInt(tmpOrigin.add(this.offset).add(this.propertyGravity.gravityGenerateDelta(new Vector3f(underSize.x() - size.x(), 0.0f, 0.0f))));
} else {
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) {
+ if (this.propertyMode == DisplayMode.VERTICAL) {
tmpOrigin = tmpOrigin.withY(tmpOrigin.y() + size.y());
} else {
tmpOrigin = tmpOrigin.withX(tmpOrigin.x() + size.x());
diff --git a/src/org/atriasoft/ewol/widget/WidgetList.java b/src/org/atriasoft/ewol/widget/WidgetList.java
new file mode 100644
index 0000000..95fd6b7
--- /dev/null
+++ b/src/org/atriasoft/ewol/widget/WidgetList.java
@@ -0,0 +1,398 @@
+/*
+ * @author Edouard DUPIN
+ * @copyright 2011, Edouard DUPIN, all right reserved
+ * @license MPL v2.0 (see license file)
+ */
+package org.atriasoft.ewol.widget;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.atriasoft.etk.Color;
+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.compositing.Compositing;
+import org.atriasoft.ewol.compositing.CompositingDrawing;
+import org.atriasoft.ewol.compositing.CompositingText;
+import org.atriasoft.ewol.event.EventInput;
+import org.atriasoft.ewol.internal.Log;
+import org.atriasoft.ewol.widget.model.ListRole;
+
+class WidgetList extends WidgetScrolled {
+ // drawing capabilities ....
+ protected List listOObject = new ArrayList<>(); //!< generic element to display...
+
+ protected List listSizeX = new ArrayList<>(); //!< size of every colomns
+
+ protected List listSizeY = new ArrayList<>(); //!< size of every rows
+ protected Map compositingElements = new HashMap<>();
+ // list properties ...
+ protected int paddingSizeX = 0;
+ protected int paddingSizeY = 0;
+
+ protected int displayStartRaw = 0; //!< Current starting diaplayed raw
+
+ protected int displayCurrentNbLine = 0; //!< Number of line in the display
+
+ protected int nbVisibleRaw = 0; // set the number of visible raw (calculate don display)
+ // function call to display the list :
+
+ public WidgetList() {
+ this.paddingSizeX = 2;
+ this.paddingSizeY = 2;
+ this.nbVisibleRaw = 0;
+ this.propertyCanFocus = true;
+ this.limitScrolling = new Vector2f(1.0f, 0.5f);
+ addComposeElemnent("drawing", new CompositingDrawing());
+ addComposeElemnent("text", new CompositingText());
+ }
+
+ protected void addComposeElemnent(final String name, final Compositing element) {
+ this.compositingElements.put(name, element);
+ //this.listOObject.add(element);
+ }
+
+ /**
+ * Calculate an element size to estimate the render size.
+ * @note Does not generate the with the same size.
+ * @param pos Position of column and Raw of the element.
+ * @return The estimate size of the element.
+ */
+ protected Vector2f calculateElementSize(final Vector2i pos) {
+ if (getComposeElemnent("text") instanceof final CompositingText tmpText) {
+ if (getData(ListRole.Text, pos) instanceof final String myTextToWrite) {
+ final Vector3f textSize = tmpText.calculateSize(myTextToWrite);
+ //final Vector2i count = getMatrixSize();
+ return new Vector2f(textSize.x(), textSize.y() + this.paddingSizeY * 3);
+ }
+ }
+ return Vector2f.ZERO;
+ }
+
+ @Override
+ public void calculateMinMaxSize() {
+ /*int fontId = getDefaultFontId();
+ int minWidth = ewol::getWidth(fontId, this.label);
+ int minHeight = ewol::getHeight(fontId);
+ this.minSize.x = 3+minWidth;
+ this.minSize.y = 3+minHeight;
+ */
+ this.minSize = new Vector3f(200, 150, 10);
+ }
+
+ protected void clearComposeElemnent() {
+ for (final Entry it : this.compositingElements.entrySet()) {
+ //it.setValue(null);
+ it.getValue().clear();
+ }
+ }
+
+ public void clearOObjectList() {
+ //this.listOObject.clear();
+ }
+
+ /**
+ * Draw the background
+ */
+ protected void drawBackground() {
+ if (getComposeElemnent("drawing") instanceof final CompositingDrawing BGOObjects) {
+ final Color basicBG = getBasicBG();
+ BGOObjects.setColor(basicBG);
+ BGOObjects.setPos(Vector3f.ZERO);
+ BGOObjects.rectangleWidth(new Vector2f(this.size.x(), this.size.y()));
+ }
+ }
+
+ /**
+ * Draw an element in the specific size and position.
+ * @param pos Position of colomn and Raw of the element.
+ * @param start Start display position.
+ * @param size Render raw size
+ * @return The estimate size of the element.
+ */
+ protected void drawElement(final Vector2i pos, final Vector2f start, final Vector2f size) {
+ if (getData(ListRole.Text, pos) instanceof final String myTextToWrite) {
+ if (getData(ListRole.BgColor, pos) instanceof final Color bg) {
+ if (getComposeElemnent("drawing") instanceof final CompositingDrawing BGOObjects) {
+ BGOObjects.setColor(bg);
+ BGOObjects.setPos(new Vector3f(start.x(), start.y(), 0));
+ BGOObjects.rectangleWidth(size);
+ }
+ }
+ if (!myTextToWrite.isEmpty()) {
+ if (getData(ListRole.FgColor, pos) instanceof final Color fg) {
+ if (getComposeElemnent("text") instanceof final CompositingText tmpText) {
+ final int displayPositionY = (int) (start.y() + this.paddingSizeY);
+ tmpText.setColor(fg);
+ tmpText.setPos(new Vector3f(start.x() + this.paddingSizeX, displayPositionY, 0));
+ tmpText.print(myTextToWrite);
+ }
+ }
+ }
+ }
+ }
+
+ protected void flushElements() {
+ for (final Entry it : this.compositingElements.entrySet()) {
+ it.getValue().flush();
+ }
+ for (final Compositing elem : this.listOObject) {
+ if (elem != null) {
+ elem.flush();
+ }
+ }
+ }
+
+ protected Color getBasicBG() {
+ return new Color(0xFF, 0xFF, 0xFF, 0xFF);
+ }
+
+ protected Compositing getComposeElemnent(final String name) {
+ return this.compositingElements.get(name);
+ }
+
+ protected Object getData(final ListRole role, final Vector2i pos) {
+ switch (role) {
+ case Text:
+ return "";
+ case FgColor:
+ return new Color(0x00, 0x00, 0x00, 0xFF);
+ case BgColor:
+ if (pos.y() % 2 == 0) {
+ return new Color(0xFF, 0xFF, 0xFF, 0xFF);
+ }
+ return new Color(0x7F, 0x7F, 0x7F, 0xFF);
+ default:
+ break;
+ }
+ return null;
+ }
+
+ /**
+ * Get the number of colomn and row availlable in the list
+ * @return Number of colomn and row
+ */
+ protected Vector2i getMatrixSize() {
+ return new Vector2i(1, 0);
+ }
+
+ @Override
+ protected void onDraw() {
+ for (final Entry it : this.compositingElements.entrySet()) {
+ it.getValue().draw();
+ }
+ for (final Compositing elem : this.listOObject) {
+ if (elem != null) {
+ elem.draw();
+ }
+ }
+ super.onDraw();
+ }
+
+ @Override
+ public boolean onEventInput(final EventInput event) {
+ Vector3f relativePos = relativePosition(new Vector3f(event.pos().x(), event.pos().y(), 0));
+ if (super.onEventInput(event)) {
+ keepFocus();
+ // nothing to do ... done on upper widget ...
+ return true;
+ }
+ if (this.listSizeY.size() == 0) {
+ return false;
+ }
+ relativePos = new Vector3f(relativePos.x() + this.originScrooled.x(), this.size.y() - relativePos.y() + this.originScrooled.y(), 0);
+ // Find the colomn and the row
+ Vector3i pos = Vector3i.ZERO;
+ float offsetY = 0;
+ for (int iii = 0; iii < this.listSizeY.size() - 1; iii++) {
+ final int previous = (int) offsetY;
+ offsetY += this.listSizeY.get(iii);
+ if (relativePos.y() < offsetY && relativePos.y() >= previous) {
+ pos = pos.withY(iii);
+ offsetY = previous;
+ break;
+ }
+ if (iii == this.listSizeY.size() - 2 && relativePos.y() >= offsetY) {
+ pos = pos.withY(iii + 1);
+ break;
+ }
+ }
+ float offsetX = 0;
+ for (int iii = 0; iii < this.listSizeX.size() - 1; iii++) {
+ final int previous = (int) offsetX;
+ offsetX += this.listSizeX.get(iii);
+ if (relativePos.x() < offsetX && relativePos.x() >= previous) {
+ pos = pos.withX(iii);
+ offsetX = previous;
+ break;
+ }
+ if (iii == this.listSizeX.size() - 2 && relativePos.x() >= offsetX) {
+ pos = pos.withX(iii + 1);
+ break;
+ }
+ }
+ final Vector3f posInternalMouse = relativePos.less(offsetX, offsetY, 0);
+ final boolean isUsed = onItemEvent(event, pos, posInternalMouse);
+ if (isUsed) {
+ // TODO : this generate bugs ... I did not understand why ..
+ //WidgetManager::focusKeep(this);
+ }
+ return isUsed;
+ }
+
+ /**
+ * set a raw visible in the main display
+ * @param _id Id of the raw that might be visible.
+ */
+ //void setRawVisible(int _id);
+ @Override
+ protected void onGetFocus() {
+ Log.debug("WidgetList get focus");
+ }
+
+ protected boolean onItemEvent(final EventInput event, final Vector3i pos, final Vector3f mousePosition) {
+ return false;
+ }
+
+ @Override
+ protected void onLostFocus() {
+ Log.debug("WidgetList Lost focus");
+ }
+
+ @Override
+ public void onRegenerateDisplay() {
+ if (!needRedraw()) {
+ return;
+ }
+ // clean the object list ...
+ clearComposeElemnent();
+ // -------------------------------------------------------
+ // -- Calculate the size of each element
+ // -------------------------------------------------------
+ final Vector2i matrixSize = getMatrixSize();
+ // set the correct number of element in the List
+ this.listSizeX.clear();
+ for (int iii = 0; iii < matrixSize.x(); iii++) {
+ this.listSizeX.add(0);
+ }
+ // set the correct number of element in the List
+ this.listSizeY.clear();
+ for (int iii = 0; iii < matrixSize.y(); iii++) {
+ this.listSizeY.add(0);
+ }
+ // set real values
+ for (int yyy = 0; yyy < matrixSize.y(); ++yyy) {
+ for (int xxx = 0; xxx < matrixSize.x(); ++xxx) {
+ final Vector2i pos = new Vector2i(xxx, yyy);
+ final Vector2f elementSize = calculateElementSize(pos);
+ if (elementSize.x() > this.listSizeX.get(xxx)) {
+ this.listSizeX.set(xxx, (int) elementSize.x());
+ }
+ if (elementSize.y() > this.listSizeY.get(yyy)) {
+ this.listSizeY.set(yyy, (int) elementSize.y());
+ }
+ }
+ }
+ // -------------------------------------------------------
+ // -- Fill property appliance
+ // -------------------------------------------------------
+ if (this.propertyFill.x()) {
+ int fullSize = 0;
+ for (final int size : this.listSizeX) {
+ fullSize += size;
+ }
+ if (fullSize < this.size.x()) {
+ // need to expand all elements:
+ final int residualAdd = (int) ((this.size.x() - fullSize) / matrixSize.x());
+ if (residualAdd != 0) {
+ for (int iii = 0; iii < this.listSizeX.size(); iii++) {
+ this.listSizeX.set(iii, this.listSizeX.get(iii) + residualAdd);
+ }
+ }
+ }
+ }
+ /*
+ if (propertyFill.y() == true) {
+ int fullSize = 0;
+ for (auto size: this.listSizeY) {
+ fullSize += size;
+ }
+ if (fullSize < this.size.y() ) {
+ // need to expand all elements:
+ int residualAdd = (this.size.y() - fullSize) / matrixSize.y();
+ if (residualAdd != 0) {
+ for (auto size: this.listSizeY) {
+ size += residualAdd;
+ }
+ }
+ }
+ }
+ */
+ // -------------------------------------------------------
+ // -- Calculate the start position size of each element
+ // -------------------------------------------------------
+ final List listStartPosX = new ArrayList<>();
+ final List listStartPosY = new ArrayList<>();
+ int lastPositionX = 0;
+ for (final Integer size : this.listSizeX) {
+ listStartPosX.add(lastPositionX);
+ lastPositionX += size;
+ }
+ int lastPositionY = 0;
+ for (final Integer size : this.listSizeY) {
+ lastPositionY += size;
+ listStartPosY.add(lastPositionY);
+ }
+ // -------------------------------------------------------
+ // -- Update the scroolBar
+ // -------------------------------------------------------
+ this.maxSize = new Vector2f(lastPositionX, lastPositionY);
+ // -------------------------------------------------------
+ // -- Clean the background
+ // -------------------------------------------------------
+ drawBackground();
+ // -------------------------------------------------------
+ // -- Draw each element
+ // -------------------------------------------------------
+ for (int yyy = 0; yyy < matrixSize.y(); ++yyy) {
+ final float startYposition = this.size.y() + this.originScrooled.y() - listStartPosY.get(yyy);
+ if (startYposition + this.listSizeY.get(yyy) < 0) {
+ // ==> element out of range ==> nothing to display
+ break;
+ }
+ if (startYposition > this.size.y()) {
+ // ==> element out of range ==> nothing to display
+ continue;
+ }
+ for (int xxx = 0; xxx < matrixSize.x(); ++xxx) {
+ final float startXposition = -this.originScrooled.x() + listStartPosX.get(xxx);
+ //Log.error("display start: " + startXposition);
+ if (startXposition + this.listSizeX.get(xxx) < 0) {
+ // ==> element out of range ==> nothing to display
+ continue;
+ }
+ if (startXposition > this.size.x()) {
+ // ==> element out of range ==> nothing to display
+ break;
+ }
+ drawElement(new Vector2i(xxx, yyy), new Vector2f(startXposition, startYposition), new Vector2f(this.listSizeX.get(xxx), this.listSizeY.get(yyy)));
+ }
+ }
+ // -------------------------------------------------------
+ // -- Draw Scrolling widget
+ // -------------------------------------------------------
+ super.onRegenerateDisplay();
+ // flush all compositing drawing
+ flushElements();
+ }
+
+ protected void removeComposeElemnent() {
+ this.compositingElements.clear();
+ }
+
+}
diff --git a/src/org/atriasoft/ewol/widget/WidgetScrolled.java b/src/org/atriasoft/ewol/widget/WidgetScrolled.java
index 96efe4e..cc402bd 100644
--- a/src/org/atriasoft/ewol/widget/WidgetScrolled.java
+++ b/src/org/atriasoft/ewol/widget/WidgetScrolled.java
@@ -30,18 +30,12 @@ class WidgetScrolled extends Widget {
}
public static final int CALCULATE_SIMULTANEOUS_FINGER = 5;
- protected Uri propertyShapeVert = new Uri("THEME_GUI", "WidgetScrolled.json", "ewol"); //!< Vertical shaper name
-
- protected Uri propertyShapeHori = new Uri("THEME_GUI", "WidgetScrolled.json", "ewol"); //!< Horizontal shaper name
-
- private GuiShape shaperH; //!< Compositing theme Horizontal.
-
- private GuiShape shaperV; //!< Compositing theme Vertical.
-
+ protected Uri propertyShapeVert = new Uri("THEME", "shape/WidgetScrolled.json", "ewol"); //!< Vertical shaper name
+ protected Uri propertyShapeHori = new Uri("THEME", "shape/WidgetScrolled.json", "ewol"); //!< Horizontal shaper name
+ private GuiShape shaperH = null; //!< Compositing theme Horizontal.
+ private GuiShape shaperV = null; //!< Compositing theme Vertical.
protected Vector2f originScrooled = Vector2f.ZERO; //!< pixel distance from the origin of the display (Bottum left)
-
protected Vector2f maxSize; //!< Maximum size of the Widget ==> to display scrollbar
-
protected Vector2f limitScrolling = Vector2f.ZERO; //!< Mimit scrolling represent the propertion of the minimel scrolling activate (0.2 ==> 20% migt all time be visible)
// Mouse section :
private ScrollingMode scroollingMode = ScrollingMode.scroolModeNormal; //!< mode of management of the scrooling
@@ -57,7 +51,7 @@ class WidgetScrolled extends Widget {
private final Vector2f[] fingerMoveStartPos = new Vector2f[CALCULATE_SIMULTANEOUS_FINGER];
/**
- * Scroll Widget main ructor to be herited from an other widget (this is not a stand-alone widget)
+ * Scroll Widget main constructor to be inherited from an other widget (this is not a stand-alone widget)
* @param _shaperName Shaper name if the scrolled widget.
*/
public WidgetScrolled() {
@@ -91,12 +85,20 @@ class WidgetScrolled extends Widget {
}
protected void onChangePropertyShapeHori() {
- this.shaperH.setSource(this.propertyShapeHori);
+ if (this.shaperH == null) {
+ this.shaperH = new GuiShape(this.propertyShapeHori);
+ } else {
+ this.shaperH.setSource(this.propertyShapeHori);
+ }
markToRedraw();
}
protected void onChangePropertyShapeVert() {
- this.shaperV.setSource(this.propertyShapeVert);
+ if (this.shaperV == null) {
+ this.shaperV = new GuiShape(this.propertyShapeVert);
+ } else {
+ this.shaperV.setSource(this.propertyShapeVert);
+ }
markToRedraw();
}
diff --git a/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java b/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java
index eaea339..2907f57 100644
--- a/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java
+++ b/src/org/atriasoft/ewol/widget/WidgetXmlFactory.java
@@ -8,12 +8,15 @@ import org.atriasoft.exml.annotation.XmlFactory.InterfaceXmlFactoryAccess;
public class WidgetXmlFactory implements InterfaceXmlFactoryAccess {
private static Map> listWidgetAvaillable = new HashMap<>();
static {
- listWidgetAvaillable.put("Button", Button.class);
listWidgetAvaillable.put("Sizer", Sizer.class);
+ listWidgetAvaillable.put("Spacer", Spacer.class);
listWidgetAvaillable.put("Label", Label.class);
- listWidgetAvaillable.put("CheckBox", CheckBox.class);
- listWidgetAvaillable.put("Tick", Tick.class);
+ listWidgetAvaillable.put("Entry", Entry.class);
listWidgetAvaillable.put("Image", ImageDisplay.class);
+ listWidgetAvaillable.put("Button", Button.class);
+ listWidgetAvaillable.put("Tick", Tick.class);
+ listWidgetAvaillable.put("CheckBox", CheckBox.class);
+ listWidgetAvaillable.put("ListFileSystem", ListFileSystem.class);
}
@Override
diff --git a/src/org/atriasoft/ewol/widget/model/ListRole.java b/src/org/atriasoft/ewol/widget/model/ListRole.java
new file mode 100644
index 0000000..c351175
--- /dev/null
+++ b/src/org/atriasoft/ewol/widget/model/ListRole.java
@@ -0,0 +1,14 @@
+package org.atriasoft.ewol.widget.model;
+
+public enum ListRole {
+ Text, // string
+ IsSelected, // bool
+ IsExpand, // bool
+ Icon, // string
+ ChildCount, // uint_t
+ HaveChild, // bool
+ ParentId, // uint_t
+ BgColor, // color
+ FgColor, // color
+ DistanceToRoot, // uint_t
+}