[DEV] tree view start to be funny ==> now I can thing to to a browser
This commit is contained in:
parent
0d0cb02b85
commit
6ea7014244
66
data/theme/default/ChevronLeft.svg
Normal file
66
data/theme/default/ChevronLeft.svg
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64"
|
||||||
|
enable-background="new 0 0 24 24"
|
||||||
|
xml:space="preserve"
|
||||||
|
id="svg8"
|
||||||
|
sodipodi:docname="ChevronLeft.svg"
|
||||||
|
inkscape:version="0.92.2 2405546, 2018-03-11"><metadata
|
||||||
|
id="metadata14"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs12" /><sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1918"
|
||||||
|
inkscape:window-height="1038"
|
||||||
|
id="namedview10"
|
||||||
|
showgrid="true"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:zoom="27.812867"
|
||||||
|
inkscape:cx="35.880854"
|
||||||
|
inkscape:cy="43.550446"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="20"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg8"><inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid821" /></sodipodi:namedview>
|
||||||
|
<g
|
||||||
|
id="Bounding_Boxes"
|
||||||
|
transform="translate(0,40)">
|
||||||
|
<path
|
||||||
|
d="M 0,0 H 24 V 24 H 0 Z"
|
||||||
|
id="path2"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:none" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="Outline_1_"
|
||||||
|
transform="matrix(4.1679329,0,0,4.1679329,-16.912008,-18.015195)">
|
||||||
|
<path
|
||||||
|
d="M 15.41,7.41 14,6 8,12 14,18 15.41,16.59 10.83,12 Z"
|
||||||
|
id="path5"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
66
data/theme/default/ChevronLess.svg
Normal file
66
data/theme/default/ChevronLess.svg
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64"
|
||||||
|
enable-background="new 0 0 24 24"
|
||||||
|
xml:space="preserve"
|
||||||
|
id="svg8"
|
||||||
|
sodipodi:docname="ChevronLess.svg"
|
||||||
|
inkscape:version="0.92.2 2405546, 2018-03-11"><metadata
|
||||||
|
id="metadata14"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs12" /><sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1918"
|
||||||
|
inkscape:window-height="1038"
|
||||||
|
id="namedview10"
|
||||||
|
showgrid="true"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:zoom="13.906433"
|
||||||
|
inkscape:cx="45.005732"
|
||||||
|
inkscape:cy="37.911807"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="20"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg8"><inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid821" /></sodipodi:namedview>
|
||||||
|
<g
|
||||||
|
id="Bounding_Boxes"
|
||||||
|
transform="translate(0,40)">
|
||||||
|
<path
|
||||||
|
d="M 0,0 H 24 V 24 H 0 Z"
|
||||||
|
id="path2"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:none" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="Outline_1_"
|
||||||
|
transform="matrix(0,4.1679329,-4.1679329,0,81.888841,-16.785655)">
|
||||||
|
<path
|
||||||
|
d="M 15.41,7.41 14,6 8,12 14,18 15.41,16.59 10.83,12 Z"
|
||||||
|
id="path5"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
66
data/theme/default/ChevronMore.svg
Normal file
66
data/theme/default/ChevronMore.svg
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64"
|
||||||
|
enable-background="new 0 0 24 24"
|
||||||
|
xml:space="preserve"
|
||||||
|
id="svg8"
|
||||||
|
sodipodi:docname="ChevronMore.svg"
|
||||||
|
inkscape:version="0.92.2 2405546, 2018-03-11"><metadata
|
||||||
|
id="metadata14"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs12" /><sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1918"
|
||||||
|
inkscape:window-height="1038"
|
||||||
|
id="namedview10"
|
||||||
|
showgrid="true"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:zoom="13.906433"
|
||||||
|
inkscape:cx="45.005732"
|
||||||
|
inkscape:cy="37.911807"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="20"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg8"><inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid821" /></sodipodi:namedview>
|
||||||
|
<g
|
||||||
|
id="Bounding_Boxes"
|
||||||
|
transform="translate(0,40)">
|
||||||
|
<path
|
||||||
|
d="M 0,0 H 24 V 24 H 0 Z"
|
||||||
|
id="path2"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:none" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="Outline_1_"
|
||||||
|
transform="matrix(0,-4.1679329,-4.1679329,0,81.888841,80.785654)">
|
||||||
|
<path
|
||||||
|
d="M 15.41,7.41 14,6 8,12 14,18 15.41,16.59 10.83,12 Z"
|
||||||
|
id="path5"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
66
data/theme/default/ChevronRight.svg
Normal file
66
data/theme/default/ChevronRight.svg
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Generator: Adobe Illustrator 19.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
version="1.1"
|
||||||
|
x="0px"
|
||||||
|
y="0px"
|
||||||
|
width="64"
|
||||||
|
height="64"
|
||||||
|
viewBox="0 0 64 64"
|
||||||
|
enable-background="new 0 0 24 24"
|
||||||
|
xml:space="preserve"
|
||||||
|
id="svg8"
|
||||||
|
sodipodi:docname="ChevronRight.svg"
|
||||||
|
inkscape:version="0.92.2 2405546, 2018-03-11"><metadata
|
||||||
|
id="metadata14"><rdf:RDF><cc:Work
|
||||||
|
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||||
|
id="defs12" /><sodipodi:namedview
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1"
|
||||||
|
objecttolerance="10"
|
||||||
|
gridtolerance="10"
|
||||||
|
guidetolerance="10"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:window-width="1918"
|
||||||
|
inkscape:window-height="1038"
|
||||||
|
id="namedview10"
|
||||||
|
showgrid="true"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:zoom="27.812867"
|
||||||
|
inkscape:cx="35.880854"
|
||||||
|
inkscape:cy="43.550446"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="20"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg8"><inkscape:grid
|
||||||
|
type="xygrid"
|
||||||
|
id="grid821" /></sodipodi:namedview>
|
||||||
|
<g
|
||||||
|
id="Bounding_Boxes"
|
||||||
|
transform="translate(0,40)">
|
||||||
|
<path
|
||||||
|
d="M 0,0 H 24 V 24 H 0 Z"
|
||||||
|
id="path2"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
style="fill:none" />
|
||||||
|
</g>
|
||||||
|
<g
|
||||||
|
id="Outline_1_"
|
||||||
|
transform="matrix(-4.1679329,0,0,4.1679329,80.659301,-18.015195)">
|
||||||
|
<path
|
||||||
|
d="M 15.41,7.41 14,6 8,12 14,18 15.41,16.59 10.83,12 Z"
|
||||||
|
id="path5"
|
||||||
|
inkscape:connector-curvature="0" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.0 KiB |
@ -26,6 +26,12 @@ ewol::widget::List::List() {
|
|||||||
m_limitScrolling = vec2(1, 0.5);
|
m_limitScrolling = vec2(1, 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::widget::List::init() {
|
||||||
|
ewol::widget::WidgetScrolled::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::widget::List::~List() {
|
ewol::widget::List::~List() {
|
||||||
//clean all the object
|
//clean all the object
|
||||||
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
|
for (size_t iii=0; iii<m_listOObject.size(); iii++) {
|
||||||
@ -145,6 +151,7 @@ void ewol::widget::List::onRegenerateDisplay() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if (propertyFill->y() == true) {
|
if (propertyFill->y() == true) {
|
||||||
int32_t fullSize = 0;
|
int32_t fullSize = 0;
|
||||||
for (auto &size: m_listSizeY) {
|
for (auto &size: m_listSizeY) {
|
||||||
@ -160,6 +167,7 @@ void ewol::widget::List::onRegenerateDisplay() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
// -- Calculate the start position size of each element
|
// -- Calculate the start position size of each element
|
||||||
// -------------------------------------------------------
|
// -------------------------------------------------------
|
||||||
@ -277,30 +285,46 @@ bool ewol::widget::List::onEventInput(const ewol::event::Input& _event) {
|
|||||||
// nothing to do ... done on upper widet ...
|
// nothing to do ... done on upper widet ...
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (m_listSizeY.size() == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
relativePos = vec2(relativePos.x(),m_size.y() - relativePos.y()) + m_originScrooled;
|
relativePos = vec2(relativePos.x(),m_size.y() - relativePos.y()) + m_originScrooled;
|
||||||
// Find the colomn and the row
|
// Find the colomn and the row
|
||||||
ivec2 pos{-1,-1};
|
ivec2 pos{0,0};
|
||||||
int32_t offset = 0;
|
float_t offsetY = 0;
|
||||||
for (size_t iii=0; iii<m_listSizeY.size()-1; iii++) {
|
for (size_t iii=0; iii<m_listSizeY.size()-1; iii++) {
|
||||||
int32_t previous = offset;
|
int32_t previous = offsetY;
|
||||||
offset += m_listSizeY[iii];
|
offsetY += m_listSizeY[iii];
|
||||||
if( relativePos.y() < offset
|
if ( relativePos.y() < offsetY
|
||||||
&& relativePos.y() >= previous ) {
|
&& relativePos.y() >= previous ) {
|
||||||
pos.setY(iii);
|
pos.setY(iii);
|
||||||
|
offsetY = previous;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( iii == m_listSizeY.size()-2
|
||||||
|
&& relativePos.y() >= offsetY ) {
|
||||||
|
pos.setY(iii+1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
offset = 0;
|
float_t offsetX = 0;
|
||||||
for (size_t iii=0; iii<m_listSizeX.size()-1; iii++) {
|
for (size_t iii=0; iii<m_listSizeX.size()-1; iii++) {
|
||||||
int32_t previous = offset;
|
int32_t previous = offsetX;
|
||||||
offset += m_listSizeX[iii];
|
offsetX += m_listSizeX[iii];
|
||||||
if( relativePos.x() < offset
|
if ( relativePos.x() < offsetX
|
||||||
&& relativePos.x() >= previous ) {
|
&& relativePos.x() >= previous ) {
|
||||||
pos.setX(iii);
|
pos.setX(iii);
|
||||||
|
offsetX = previous;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ( iii == m_listSizeX.size()-2
|
||||||
|
&& relativePos.x() >= offsetX ) {
|
||||||
|
pos.setX(iii+1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool isUsed = onItemEvent(_event.getId(), _event.getStatus(), pos, _event.getPos());
|
vec2 posInternalMouse = relativePos - vec2(offsetX, offsetY);
|
||||||
|
bool isUsed = onItemEvent(_event, pos, posInternalMouse);
|
||||||
if (isUsed == true) {
|
if (isUsed == true) {
|
||||||
// TODO : this generate bugs ... I did not understand why ..
|
// TODO : this generate bugs ... I did not understand why ..
|
||||||
//ewol::WidgetSharedManager::focusKeep(this);
|
//ewol::WidgetSharedManager::focusKeep(this);
|
||||||
|
@ -39,6 +39,7 @@ namespace ewol {
|
|||||||
class List : public ewol::widget::WidgetScrolled {
|
class List : public ewol::widget::WidgetScrolled {
|
||||||
protected:
|
protected:
|
||||||
List();
|
List();
|
||||||
|
void init() override;
|
||||||
public:
|
public:
|
||||||
virtual ~List();
|
virtual ~List();
|
||||||
void calculateMinMaxSize() override;
|
void calculateMinMaxSize() override;
|
||||||
@ -103,7 +104,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
virtual void drawBackground();
|
virtual void drawBackground();
|
||||||
|
|
||||||
virtual bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, const ivec2& _pos, const vec2& _mousePosition) {
|
virtual bool onItemEvent(const ewol::event::Input& _event, const ivec2& _pos, const vec2& _mousePosition) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -164,8 +164,7 @@ fluorine::Variant ewol::widget::ListFileSystem::getData(int32_t _role, const ive
|
|||||||
return fluorine::Variant();
|
return fluorine::Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::widget::ListFileSystem::onItemEvent(int32_t _IdInput,
|
bool ewol::widget::ListFileSystem::onItemEvent(const ewol::event::Input& _event,
|
||||||
enum gale::key::status _typeEvent,
|
|
||||||
const ivec2& _pos,
|
const ivec2& _pos,
|
||||||
const vec2& _mousePosition) {
|
const vec2& _mousePosition) {
|
||||||
int32_t offset = 0;
|
int32_t offset = 0;
|
||||||
@ -176,9 +175,9 @@ bool ewol::widget::ListFileSystem::onItemEvent(int32_t _IdInput,
|
|||||||
offset = 2;
|
offset = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (_typeEvent == gale::key::status::pressSingle) {
|
if (_event.getStatus() == gale::key::status::pressSingle) {
|
||||||
EWOL_VERBOSE("Event on List : IdInput=" << _IdInput << " _pos=" << _pos );
|
EWOL_VERBOSE("Event on List : IdInput=" << _event.getId() << " _pos=" << _pos );
|
||||||
if (1 == _IdInput) {
|
if (1 == _event.getId()) {
|
||||||
int32_t previousRaw = m_selectedLine;
|
int32_t previousRaw = m_selectedLine;
|
||||||
if (_pos.y() > (int32_t)m_list.size()+offset ) {
|
if (_pos.y() > (int32_t)m_list.size()+offset ) {
|
||||||
m_selectedLine = -1;
|
m_selectedLine = -1;
|
||||||
|
@ -46,7 +46,7 @@ namespace ewol {
|
|||||||
etk::Color<> getBasicBG() override;
|
etk::Color<> getBasicBG() override;
|
||||||
ivec2 getMatrixSize() const override;
|
ivec2 getMatrixSize() const override;
|
||||||
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override;
|
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override;
|
||||||
bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, const ivec2& _pos, const vec2& _mousePosition) override;
|
bool onItemEvent(const ewol::event::Input& _event, const ivec2& _pos, const vec2& _mousePosition) override;
|
||||||
protected:
|
protected:
|
||||||
// TODO: use shred_ptr
|
// TODO: use shred_ptr
|
||||||
etk::Vector<etk::FSNode *> m_list; //!< List of all element in the path. (they are filtered)
|
etk::Vector<etk::FSNode *> m_list; //!< List of all element in the path. (they are filtered)
|
||||||
|
@ -27,6 +27,11 @@ ewol::widget::TreeView::TreeView():
|
|||||||
addObjectType("ewol::widget::TreeView");
|
addObjectType("ewol::widget::TreeView");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::widget::TreeView::init() {
|
||||||
|
ewol::widget::List::init();
|
||||||
|
propertyFill.set(bvec2(true,false));
|
||||||
|
}
|
||||||
|
|
||||||
ewol::widget::TreeView::~TreeView() {
|
ewol::widget::TreeView::~TreeView() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -37,6 +42,14 @@ vec2 ewol::widget::TreeView::calculateElementSize(const ivec2& _pos) {
|
|||||||
float_t treeOffset = 0;
|
float_t treeOffset = 0;
|
||||||
if (_pos.x() == 0) {
|
if (_pos.x() == 0) {
|
||||||
treeOffset += getData(ListRole::DistanceToRoot, _pos).getSafeNumber() * propertyOffsetTreeView.get();
|
treeOffset += getData(ListRole::DistanceToRoot, _pos).getSafeNumber() * propertyOffsetTreeView.get();
|
||||||
|
#if 0
|
||||||
|
bool haveChild = getData(ListRole::HaveChild, _pos).getSafeBoolean();
|
||||||
|
if (haveChild == true) {
|
||||||
|
treeOffset += propertyOffsetTreeView.get();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
treeOffset += propertyOffsetTreeView.get();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
etk::String iconName;
|
etk::String iconName;
|
||||||
float_t iconSize = 0;
|
float_t iconSize = 0;
|
||||||
@ -46,7 +59,7 @@ vec2 ewol::widget::TreeView::calculateElementSize(const ivec2& _pos) {
|
|||||||
iconSize += propertyIconTreeViewSize.get();
|
iconSize += propertyIconTreeViewSize.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vec3 textSize = tmpText.calculateSize(myTextToWrite);
|
vec3 textSize = tmpText.calculateSizeDecorated(myTextToWrite);
|
||||||
ivec2 count = getMatrixSize();
|
ivec2 count = getMatrixSize();
|
||||||
return vec2(textSize.x() + treeOffset + iconSize,
|
return vec2(textSize.x() + treeOffset + iconSize,
|
||||||
etk::max(textSize.y(), iconSize) + m_paddingSizeY*3
|
etk::max(textSize.y(), iconSize) + m_paddingSizeY*3
|
||||||
@ -56,16 +69,33 @@ vec2 ewol::widget::TreeView::calculateElementSize(const ivec2& _pos) {
|
|||||||
void ewol::widget::TreeView::drawElement(const ivec2& _pos, const vec2& _start, const vec2& _size) {
|
void ewol::widget::TreeView::drawElement(const ivec2& _pos, const vec2& _start, const vec2& _size) {
|
||||||
vec2 posStart = _start;
|
vec2 posStart = _start;
|
||||||
etk::String iconName;
|
etk::String iconName;
|
||||||
|
etk::Color<> fg = getData(ListRole::FgColor, _pos).getSafeColor();
|
||||||
if (_pos.x() == 0) {
|
if (_pos.x() == 0) {
|
||||||
auto value = getData(ListRole::DistanceToRoot, _pos);
|
auto value = getData(ListRole::DistanceToRoot, _pos);
|
||||||
if (value.isNumber() == true) {
|
if (value.isNumber() == true) {
|
||||||
posStart.setX(posStart.x() + value.getSafeNumber() * propertyOffsetTreeView.get());
|
posStart.setX(posStart.x() + value.getSafeNumber() * propertyOffsetTreeView.get());
|
||||||
}
|
}
|
||||||
iconName = getData(ListRole::Icon, _pos).getSafeString();
|
iconName = getData(ListRole::Icon, _pos).getSafeString();
|
||||||
|
bool haveChild = getData(ListRole::HaveChild, _pos).getSafeBoolean();
|
||||||
|
if (haveChild == true) {
|
||||||
|
ewol::compositing::Image * tmpImage = null;
|
||||||
|
if ( getData(ListRole::IsExpand, _pos).getSafeBoolean() == false) {
|
||||||
|
tmpImage = ETK_NEW(ewol::compositing::Image, "{ewol}THEME:GUI:ChevronRight.svg");
|
||||||
|
} else {
|
||||||
|
tmpImage = ETK_NEW(ewol::compositing::Image, "{ewol}THEME:GUI:ChevronMore.svg");
|
||||||
|
}
|
||||||
|
if (tmpImage != null) {
|
||||||
|
addOObject(tmpImage);
|
||||||
|
tmpImage->setColor(fg);
|
||||||
|
tmpImage->setPos(posStart);
|
||||||
|
tmpImage->print(vec2(propertyIconTreeViewSize.get(), propertyIconTreeViewSize.get()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// move right
|
||||||
|
posStart.setX(posStart.x() + propertyIconTreeViewSize.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString();
|
etk::String myTextToWrite = getData(ListRole::Text, _pos).getSafeString();
|
||||||
etk::Color<> fg = getData(ListRole::FgColor, _pos).getSafeColor();
|
|
||||||
auto backgroundVariant = getData(ListRole::BgColor, _pos);
|
auto backgroundVariant = getData(ListRole::BgColor, _pos);
|
||||||
if (backgroundVariant.isColor() == true) {
|
if (backgroundVariant.isColor() == true) {
|
||||||
etk::Color<> bg = backgroundVariant.getColor();
|
etk::Color<> bg = backgroundVariant.getColor();
|
||||||
@ -95,7 +125,7 @@ void ewol::widget::TreeView::drawElement(const ivec2& _pos, const vec2& _start,
|
|||||||
addOObject(tmpText);
|
addOObject(tmpText);
|
||||||
tmpText->setColor(fg);
|
tmpText->setColor(fg);
|
||||||
tmpText->setPos(posStart);
|
tmpText->setPos(posStart);
|
||||||
tmpText->print(myTextToWrite);;
|
tmpText->printDecorated(myTextToWrite);;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,3 +134,36 @@ void ewol::widget::TreeView::onChangePropertyOffsetTreeView() {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ewol::widget::TreeView::onItemEvent(const ewol::event::Input& _event, const ivec2& _pos, const vec2& _mousePosition) {
|
||||||
|
if (_event.getStatus() != gale::key::status::pressSingle) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_event.getId() != 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (_pos.x() != 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//EWOL_INFO("event: " << _event);
|
||||||
|
vec2 posStart = vec2(0,0);
|
||||||
|
bool haveChild = getData(ListRole::HaveChild, _pos).getSafeBoolean();
|
||||||
|
if (haveChild == false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
auto value = getData(ListRole::DistanceToRoot, _pos);
|
||||||
|
if (value.isNumber() == true) {
|
||||||
|
posStart.setX(posStart.x() + value.getSafeNumber() * propertyOffsetTreeView.get());
|
||||||
|
}
|
||||||
|
// Inverse the display of Y
|
||||||
|
EWOL_VERBOSE("check: " << vec2(_mousePosition.x(), m_listSizeY[_pos.y()] - _mousePosition.y())
|
||||||
|
<< " in " << posStart
|
||||||
|
<< " -> " << (posStart+vec2(propertyIconTreeViewSize.get(),propertyIconTreeViewSize.get())));
|
||||||
|
if ( _mousePosition.x() >= posStart.x()
|
||||||
|
&& _mousePosition.x() <= posStart.x()+propertyIconTreeViewSize.get()
|
||||||
|
&& m_listSizeY[_pos.y()] - _mousePosition.y() >= posStart.y()
|
||||||
|
&& m_listSizeY[_pos.y()] - _mousePosition.y() <= propertyIconTreeViewSize.get() ) {
|
||||||
|
onItemExpandEvent(_pos);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
@ -28,6 +28,7 @@ namespace ewol {
|
|||||||
eproperty::Value<float> propertyIconTreeViewSize; //!< Size of the icon.
|
eproperty::Value<float> propertyIconTreeViewSize; //!< Size of the icon.
|
||||||
protected:
|
protected:
|
||||||
TreeView();
|
TreeView();
|
||||||
|
void init() override;
|
||||||
public:
|
public:
|
||||||
virtual ~TreeView();
|
virtual ~TreeView();
|
||||||
protected:
|
protected:
|
||||||
@ -48,6 +49,9 @@ namespace ewol {
|
|||||||
void drawElement(const ivec2& _pos, const vec2& _start, const vec2& _size) override;
|
void drawElement(const ivec2& _pos, const vec2& _start, const vec2& _size) override;
|
||||||
protected:
|
protected:
|
||||||
virtual void onChangePropertyOffsetTreeView();
|
virtual void onChangePropertyOffsetTreeView();
|
||||||
|
|
||||||
|
bool onItemEvent(const ewol::event::Input& _event, const ivec2& _pos, const vec2& _mousePosition) override;
|
||||||
|
virtual void onItemExpandEvent(const ivec2& _pos) { };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -7,31 +7,48 @@
|
|||||||
#include "BasicTree.hpp"
|
#include "BasicTree.hpp"
|
||||||
#include <etk/tool.hpp>
|
#include <etk/tool.hpp>
|
||||||
#include <etk/os/FSNode.hpp>
|
#include <etk/os/FSNode.hpp>
|
||||||
|
#include <test-debug/debug.hpp>
|
||||||
|
|
||||||
#include <etk/typeInfo.hpp>
|
#include <etk/typeInfo.hpp>
|
||||||
ETK_DECLARE_TYPE(appl::widget::BasicTree);
|
ETK_DECLARE_TYPE(appl::widget::BasicTree);
|
||||||
|
|
||||||
appl::widget::BasicTree::BasicTree() {
|
appl::widget::BasicTree::BasicTree() {
|
||||||
addObjectType("appl::widget::BasicTree");
|
addObjectType("appl::widget::BasicTree");
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::widget::BasicTree::init() {
|
||||||
|
ewol::widget::TreeView::init();
|
||||||
setMouseLimit(1);
|
setMouseLimit(1);
|
||||||
m_tree = NodeElement::create(TreeElement("root", false, true));
|
m_tree = etk::TreeNode<TreeElement>::create(TreeElement("root", false, true));
|
||||||
for (size_t iii=0; iii<10; ++iii) {
|
for (size_t iii=0; iii<10; ++iii) {
|
||||||
auto elem_iii = NodeElement::create(TreeElement("elem_" + etk::toString(iii)));
|
auto elem_iii = etk::TreeNode<TreeElement>::create(TreeElement("elem_" + etk::toString(iii), false, false));
|
||||||
m_tree->addChild(elem_iii);
|
m_tree->addChild(elem_iii);
|
||||||
for (size_t jjj=0; jjj<iii; ++jjj) {
|
for (size_t jjj=0; jjj<iii; ++jjj) {
|
||||||
auto elem_iii_jjj = NodeElement::create(TreeElement("elem_" + etk::toString(iii) + "____" + etk::toString(jjj)));
|
if (jjj%3 == 0) {
|
||||||
|
auto elem_iii_jjj = etk::TreeNode<TreeElement>::create(TreeElement("elem_" + etk::toString(iii) + "____" + etk::toString(jjj) + "<br/> an other line ...", false, false));
|
||||||
|
elem_iii->addChild(elem_iii_jjj);
|
||||||
|
} else {
|
||||||
|
auto elem_iii_jjj = etk::TreeNode<TreeElement>::create(TreeElement("elem_" + etk::toString(iii) + "____" + etk::toString(jjj), false, false));
|
||||||
elem_iii->addChild(elem_iii_jjj);
|
elem_iii->addChild(elem_iii_jjj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
updateFlatTree();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void appl::widget::BasicTree::updateFlatTree() {
|
||||||
m_flatTree.setRoot(m_tree,
|
m_flatTree.setRoot(m_tree,
|
||||||
[&](TreeElement* _value){
|
[&](const TreeElement& _value){
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
[&](TreeElement* _value){
|
[&](const TreeElement& _value){
|
||||||
return _value.m_isExpand;
|
return _value.m_isExpand;
|
||||||
});
|
});
|
||||||
|
markToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
appl::widget::BasicTree::~BasicTree() {
|
appl::widget::BasicTree::~BasicTree() {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -59,6 +76,10 @@ fluorine::Variant appl::widget::BasicTree::getData(int32_t _role, const ivec2& _
|
|||||||
return "value: " + etk::toString(_pos);
|
return "value: " + etk::toString(_pos);
|
||||||
case ewol::widget::ListRole::DistanceToRoot:
|
case ewol::widget::ListRole::DistanceToRoot:
|
||||||
return uint_t(elem->countToRoot());
|
return uint_t(elem->countToRoot());
|
||||||
|
case ewol::widget::ListRole::HaveChild:
|
||||||
|
return elem->haveChild();
|
||||||
|
case ewol::widget::ListRole::IsExpand:
|
||||||
|
return value.m_isExpand;
|
||||||
case ewol::widget::ListRole::Icon:
|
case ewol::widget::ListRole::Icon:
|
||||||
if (elem->countToRoot() == 0) {
|
if (elem->countToRoot() == 0) {
|
||||||
return "{ewol}THEME:GUI:Home.svg";
|
return "{ewol}THEME:GUI:Home.svg";
|
||||||
@ -73,88 +94,16 @@ fluorine::Variant appl::widget::BasicTree::getData(int32_t _role, const ivec2& _
|
|||||||
case ewol::widget::ListRole::FgColor:
|
case ewol::widget::ListRole::FgColor:
|
||||||
return etk::Color<>(0,0,0,0xFF);
|
return etk::Color<>(0,0,0,0xFF);
|
||||||
case ewol::widget::ListRole::BgColor:
|
case ewol::widget::ListRole::BgColor:
|
||||||
|
if ((_pos.y()%2) == 0) {
|
||||||
|
return etk::Color<>(0,0,0,0x15);
|
||||||
|
}
|
||||||
return fluorine::Variant();
|
return fluorine::Variant();
|
||||||
}
|
}
|
||||||
return fluorine::Variant();
|
return fluorine::Variant();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool appl::widget::BasicTree::onItemEvent(int32_t _IdInput,
|
void appl::widget::BasicTree::onItemExpandEvent(const ivec2& _pos) {
|
||||||
enum gale::key::status _typeEvent,
|
TEST_WARNING("Event on expand on " << _pos);
|
||||||
const ivec2& _pos,
|
m_flatTree[_pos.y()]->getData().m_isExpand = m_flatTree[_pos.y()]->getData().m_isExpand?false:true;
|
||||||
const vec2& _mousePosition) {
|
updateFlatTree();
|
||||||
/*
|
|
||||||
int32_t offset = 0;
|
|
||||||
if (*propertyShowFolder == true) {
|
|
||||||
if (*propertyPath == "/") {
|
|
||||||
offset = 1;
|
|
||||||
} else {
|
|
||||||
offset = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (_typeEvent == gale::key::status::pressSingle) {
|
|
||||||
EWOL_VERBOSE("Event on List : IdInput=" << _IdInput << " _pos=" << _pos );
|
|
||||||
if (1 == _IdInput) {
|
|
||||||
int32_t previousRaw = m_selectedLine;
|
|
||||||
if (_pos.y() > (int32_t)m_list.size()+offset ) {
|
|
||||||
m_selectedLine = -1;
|
|
||||||
} else {
|
|
||||||
m_selectedLine = _pos.y();
|
|
||||||
}
|
|
||||||
if (previousRaw != m_selectedLine) {
|
|
||||||
if( *propertyShowFolder == true
|
|
||||||
&& m_selectedLine == 0) {
|
|
||||||
// "." folder
|
|
||||||
signalFolderSelect.emit(".");
|
|
||||||
} else if ( *propertyShowFolder == true
|
|
||||||
&& m_selectedLine == 1) {
|
|
||||||
// ".." folder
|
|
||||||
signalFolderSelect.emit("..");
|
|
||||||
} else if( m_selectedLine-offset >= 0
|
|
||||||
&& m_selectedLine-offset < (int32_t)m_list.size()
|
|
||||||
&& null != m_list[m_selectedLine-offset] ) {
|
|
||||||
// generate event extern :
|
|
||||||
switch(m_list[m_selectedLine-offset]->getNodeType()) {
|
|
||||||
case etk::typeNode_file :
|
|
||||||
signalFileSelect.emit(m_list[m_selectedLine-offset]->getNameFile());
|
|
||||||
break;
|
|
||||||
case etk::typeNode_folder :
|
|
||||||
signalFolderSelect.emit(m_list[m_selectedLine-offset]->getNameFile());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
EWOL_ERROR("Can not generate event on an unknow type");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if( *propertyShowFolder == true
|
|
||||||
&& m_selectedLine == 0) {
|
|
||||||
// "." folder
|
|
||||||
signalFolderValidate.emit(".");
|
|
||||||
} else if ( *propertyShowFolder == true
|
|
||||||
&& m_selectedLine == 1) {
|
|
||||||
// ".." folder
|
|
||||||
signalFolderValidate.emit("..");
|
|
||||||
} else if( m_selectedLine-offset >= 0
|
|
||||||
&& m_selectedLine-offset < (int32_t)m_list.size()
|
|
||||||
&& null != m_list[m_selectedLine-offset] ) {
|
|
||||||
switch(m_list[m_selectedLine-offset]->getNodeType()) {
|
|
||||||
case etk::typeNode_file :
|
|
||||||
signalFileValidate.emit(m_list[m_selectedLine-offset]->getNameFile());
|
|
||||||
break;
|
|
||||||
case etk::typeNode_folder :
|
|
||||||
signalFolderValidate.emit(m_list[m_selectedLine-offset]->getNameFile());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
EWOL_ERROR("Can not generate event on an unknow type");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// need to regenerate the display of the list :
|
|
||||||
markToRedraw();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ namespace appl {
|
|||||||
using BasicTreeWeak = ememory::WeakPtr<appl::widget::BasicTree>;
|
using BasicTreeWeak = ememory::WeakPtr<appl::widget::BasicTree>;
|
||||||
class TreeElement {
|
class TreeElement {
|
||||||
public:
|
public:
|
||||||
TreeElement(const etk::String& _display="", bool _isSelected = false, bool m_isExpand=false):
|
TreeElement(const etk::String& _display="", bool _isSelected = false, bool _isExpand=false):
|
||||||
m_display(_display),
|
m_display(_display),
|
||||||
m_isSelected(_isSelected),
|
m_isSelected(_isSelected),
|
||||||
m_isExpand(_isExpand) {
|
m_isExpand(_isExpand) {
|
||||||
@ -27,23 +27,25 @@ namespace appl {
|
|||||||
etk::String m_display;
|
etk::String m_display;
|
||||||
bool m_isSelected = false;
|
bool m_isSelected = false;
|
||||||
bool m_isExpand = false;
|
bool m_isExpand = false;
|
||||||
}
|
};
|
||||||
/**
|
/**
|
||||||
* @brief Generic display folder class. This widget display the content of a single folder :
|
* @brief Generic display folder class. This widget display the content of a single folder :
|
||||||
*/
|
*/
|
||||||
class BasicTree : public ewol::widget::TreeView {
|
class BasicTree : public ewol::widget::TreeView {
|
||||||
protected:
|
protected:
|
||||||
BasicTree();
|
BasicTree();
|
||||||
|
void init() override;
|
||||||
public:
|
public:
|
||||||
DECLARE_WIDGET_FACTORY(BasicTree, "BasicTree");
|
DECLARE_WIDGET_FACTORY(BasicTree, "BasicTree");
|
||||||
virtual ~BasicTree();
|
virtual ~BasicTree();
|
||||||
protected:
|
protected:
|
||||||
|
void updateFlatTree();
|
||||||
etk::Color<> getBasicBG() override;
|
etk::Color<> getBasicBG() override;
|
||||||
ivec2 getMatrixSize() const override;
|
ivec2 getMatrixSize() const override;
|
||||||
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override;
|
fluorine::Variant getData(int32_t _role, const ivec2& _pos) override;
|
||||||
bool onItemEvent(int32_t _IdInput, enum gale::key::status _typeEvent, const ivec2& _pos, const vec2& _mousePosition) override;
|
//bool onItemEvent(const ewol::event::Input& _event, const ivec2& _pos, const vec2& _mousePosition) override;
|
||||||
|
void onItemExpandEvent(const ivec2& _pos) override;
|
||||||
ememory::SharedPtr<etk::TreeNode<NodeElement>> m_tree;
|
ememory::SharedPtr<etk::TreeNode<TreeElement>> m_tree;
|
||||||
etk::FlatTree<TreeElement> m_flatTree;
|
etk::FlatTree<TreeElement> m_flatTree;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,8 @@ def configure(target, my_module):
|
|||||||
'appl/widget/BasicTree.cpp',
|
'appl/widget/BasicTree.cpp',
|
||||||
])
|
])
|
||||||
my_module.add_depend([
|
my_module.add_depend([
|
||||||
'ewol'
|
'ewol',
|
||||||
|
'test-debug',
|
||||||
])
|
])
|
||||||
my_module.add_flag('c++', [
|
my_module.add_flag('c++', [
|
||||||
"-DPROJECT_NAME=\"\\\""+my_module.get_name()+"\\\"\"",
|
"-DPROJECT_NAME=\"\\\""+my_module.get_name()+"\\\"\"",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user