[DEBUG] add missing declaration and corect segfault
This commit is contained in:
parent
e6e817bfcd
commit
1bbc8c08cc
@ -159,6 +159,7 @@ std::shared_ptr<ewol::Object> ewol::Object::getObjectNamed(const std::string& _o
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<ewol::Object> ewol::Object::getSubObjectNamed(const std::string& _objectName) {
|
std::shared_ptr<ewol::Object> ewol::Object::getSubObjectNamed(const std::string& _objectName) {
|
||||||
|
EWOL_VERBOSE("check if name : " << _objectName << " ?= " << propertyName.get());
|
||||||
if (_objectName == propertyName.get()) {
|
if (_objectName == propertyName.get()) {
|
||||||
return shared_from_this();
|
return shared_from_this();
|
||||||
}
|
}
|
||||||
@ -166,7 +167,7 @@ std::shared_ptr<ewol::Object> ewol::Object::getSubObjectNamed(const std::string&
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool epropertySetOnObjectNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) {
|
bool ewol::propertySetOnObjectNamed(const std::string& _objectName, const std::string& _config, const std::string& _value) {
|
||||||
std::shared_ptr<ewol::Object> object = ewol::getContext().getEObjectManager().get(_objectName);
|
std::shared_ptr<ewol::Object> object = ewol::getContext().getEObjectManager().get(_objectName);
|
||||||
if (object == nullptr) {
|
if (object == nullptr) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <ewol/resource/Colored3DObject.h>
|
#include <ewol/resource/Colored3DObject.h>
|
||||||
#include <gale/resource/Manager.h>
|
#include <gale/resource/Manager.h>
|
||||||
#include <gale/renderer/openGL/openGL-include.h>
|
#include <gale/renderer/openGL/openGL-include.h>
|
||||||
|
#include <esignal/details/Signal.hxx>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "resource::Colored3DObject"
|
#define __class__ "resource::Colored3DObject"
|
||||||
@ -229,4 +230,11 @@ void ewol::resource::Colored3DObject::drawSquare(const vec3& _size,
|
|||||||
}
|
}
|
||||||
draw(tmpVertices, _tmpColor, _transformationMatrix);
|
draw(tmpVertices, _tmpColor, _transformationMatrix);
|
||||||
}
|
}
|
||||||
|
template<> std::string etk::to_string(ewol::resource::Colored3DObject const&) {
|
||||||
|
return "!!ewol::resource::Colored3DObject!ERROR!CAN_NOT_BE_CONVERT!!";
|
||||||
|
}
|
||||||
|
|
||||||
|
// declare for signal event
|
||||||
|
template class esignal::Signal<ewol::resource::Colored3DObject>;
|
||||||
|
template class esignal::Signal<std::shared_ptr<ewol::resource::Colored3DObject>>;
|
||||||
|
|
||||||
|
@ -171,16 +171,13 @@ void ewol::widget::CheckBox::CheckStatus() {
|
|||||||
markToRedraw();
|
markToRedraw();
|
||||||
}
|
}
|
||||||
if (m_buttonPressed == true) {
|
if (m_buttonPressed == true) {
|
||||||
EWOL_WARNING("SET state : PRESSED");
|
|
||||||
changeStatusIn(STATUS_PRESSED);
|
changeStatusIn(STATUS_PRESSED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (true == m_mouseHover) {
|
if (true == m_mouseHover) {
|
||||||
EWOL_WARNING("SET state : HOVER");
|
|
||||||
changeStatusIn(STATUS_HOVER);
|
changeStatusIn(STATUS_HOVER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EWOL_WARNING("SET state : UP");
|
|
||||||
changeStatusIn(STATUS_UP);
|
changeStatusIn(STATUS_UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,10 +82,10 @@ void ewol::widget::Container::subWidgetUnLink() {
|
|||||||
|
|
||||||
std::shared_ptr<ewol::Object> ewol::widget::Container::getSubObjectNamed(const std::string& _objectName) {
|
std::shared_ptr<ewol::Object> ewol::widget::Container::getSubObjectNamed(const std::string& _objectName) {
|
||||||
std::shared_ptr<ewol::Object> tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
|
std::shared_ptr<ewol::Object> tmpObject = ewol::Widget::getSubObjectNamed(_objectName);
|
||||||
if (nullptr!=tmpObject) {
|
if (tmpObject != nullptr) {
|
||||||
return tmpObject;
|
return tmpObject;
|
||||||
}
|
}
|
||||||
if (nullptr != m_subWidget) {
|
if (m_subWidget != nullptr) {
|
||||||
return m_subWidget->getSubObjectNamed(_objectName);
|
return m_subWidget->getSubObjectNamed(_objectName);
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -62,12 +62,9 @@ void ewol::widget::ContainerN::subWidgetReplace(const std::shared_ptr<ewol::Widg
|
|||||||
if (it != _oldWidget) {
|
if (it != _oldWidget) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EWOL_WARNING("Remove old");
|
|
||||||
it->removeParent();
|
it->removeParent();
|
||||||
it.reset();
|
it.reset();
|
||||||
EWOL_WARNING("Set New");
|
|
||||||
if (_newWidget != nullptr) {
|
if (_newWidget != nullptr) {
|
||||||
EWOL_WARNING("set parrent");
|
|
||||||
_newWidget->setParent(shared_from_this());
|
_newWidget->setParent(shared_from_this());
|
||||||
}
|
}
|
||||||
it = _newWidget;
|
it = _newWidget;
|
||||||
|
@ -69,7 +69,6 @@ void ewol::widget::SpinBase::onPropertyChangeValue(const eproperty::Ref& _paramP
|
|||||||
|
|
||||||
|
|
||||||
void ewol::widget::SpinBase::updateGui() {
|
void ewol::widget::SpinBase::updateGui() {
|
||||||
EWOL_WARNING("updateGui [START]");
|
|
||||||
subWidgetRemoveAll();
|
subWidgetRemoveAll();
|
||||||
markToRedraw();
|
markToRedraw();
|
||||||
requestUpdateSize();
|
requestUpdateSize();
|
||||||
@ -77,7 +76,7 @@ void ewol::widget::SpinBase::updateGui() {
|
|||||||
std::string shaper;
|
std::string shaper;
|
||||||
if (m_config != nullptr) {
|
if (m_config != nullptr) {
|
||||||
shaper = m_config->getString(m_confIdEntryShaper);
|
shaper = m_config->getString(m_confIdEntryShaper);
|
||||||
EWOL_INFO("shaper entry : " << shaper);
|
EWOL_VERBOSE("shaper entry : " << shaper);
|
||||||
}
|
}
|
||||||
m_widgetEntry = ewol::widget::Entry::create("", shaper);
|
m_widgetEntry = ewol::widget::Entry::create("", shaper);
|
||||||
if (m_widgetEntry != nullptr) {
|
if (m_widgetEntry != nullptr) {
|
||||||
@ -89,7 +88,7 @@ void ewol::widget::SpinBase::updateGui() {
|
|||||||
std::string shaper;
|
std::string shaper;
|
||||||
if (m_config != nullptr) {
|
if (m_config != nullptr) {
|
||||||
shaper = m_config->getString(m_confIdDownShaper);
|
shaper = m_config->getString(m_confIdDownShaper);
|
||||||
EWOL_INFO("shaper button DOWN : " << shaper);
|
EWOL_VERBOSE("shaper button DOWN : " << shaper);
|
||||||
}
|
}
|
||||||
m_widgetButtonDown = ewol::widget::Button::create(shaper);
|
m_widgetButtonDown = ewol::widget::Button::create(shaper);
|
||||||
if (m_widgetButtonDown != nullptr) {
|
if (m_widgetButtonDown != nullptr) {
|
||||||
@ -104,7 +103,7 @@ void ewol::widget::SpinBase::updateGui() {
|
|||||||
std::string shaper;
|
std::string shaper;
|
||||||
if (m_config != nullptr) {
|
if (m_config != nullptr) {
|
||||||
shaper = m_config->getString(m_confIdUpShaper);
|
shaper = m_config->getString(m_confIdUpShaper);
|
||||||
EWOL_INFO("shaper button UP : " << shaper);
|
EWOL_VERBOSE("shaper button UP : " << shaper);
|
||||||
}
|
}
|
||||||
m_widgetButtonUp = ewol::widget::Button::create(shaper);
|
m_widgetButtonUp = ewol::widget::Button::create(shaper);
|
||||||
if (m_widgetButtonUp != nullptr) {
|
if (m_widgetButtonUp != nullptr) {
|
||||||
@ -115,50 +114,34 @@ void ewol::widget::SpinBase::updateGui() {
|
|||||||
m_widgetButtonUp->setSubWidget(widget);
|
m_widgetButtonUp->setSubWidget(widget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EWOL_INFO("add ....");
|
|
||||||
switch (propertySpinMode) {
|
switch (propertySpinMode) {
|
||||||
case ewol::widget::spinPosition_noneNone:
|
case ewol::widget::spinPosition_noneNone:
|
||||||
EWOL_INFO("add Entry");
|
|
||||||
subWidgetAdd(m_widgetEntry);
|
subWidgetAdd(m_widgetEntry);
|
||||||
break;
|
break;
|
||||||
case ewol::widget::spinPosition_noneRight:
|
case ewol::widget::spinPosition_noneRight:
|
||||||
EWOL_INFO("add Entry");
|
|
||||||
subWidgetAdd(m_widgetEntry);
|
subWidgetAdd(m_widgetEntry);
|
||||||
EWOL_INFO("add Up");
|
|
||||||
subWidgetAdd(m_widgetButtonUp);
|
subWidgetAdd(m_widgetButtonUp);
|
||||||
break;
|
break;
|
||||||
case ewol::widget::spinPosition_leftNone:
|
case ewol::widget::spinPosition_leftNone:
|
||||||
EWOL_INFO("add Down");
|
|
||||||
subWidgetAdd(m_widgetButtonDown);
|
subWidgetAdd(m_widgetButtonDown);
|
||||||
EWOL_INFO("add Entry");
|
|
||||||
subWidgetAdd(m_widgetEntry);
|
subWidgetAdd(m_widgetEntry);
|
||||||
break;
|
break;
|
||||||
case ewol::widget::spinPosition_leftRight:
|
case ewol::widget::spinPosition_leftRight:
|
||||||
EWOL_INFO("add Down");
|
|
||||||
subWidgetAdd(m_widgetButtonDown);
|
subWidgetAdd(m_widgetButtonDown);
|
||||||
EWOL_INFO("add Entry");
|
|
||||||
subWidgetAdd(m_widgetEntry);
|
subWidgetAdd(m_widgetEntry);
|
||||||
EWOL_INFO("add Up");
|
|
||||||
subWidgetAdd(m_widgetButtonUp);
|
subWidgetAdd(m_widgetButtonUp);
|
||||||
break;
|
break;
|
||||||
case ewol::widget::spinPosition_leftLeft:
|
case ewol::widget::spinPosition_leftLeft:
|
||||||
EWOL_INFO("add Down");
|
|
||||||
subWidgetAdd(m_widgetButtonDown);
|
subWidgetAdd(m_widgetButtonDown);
|
||||||
EWOL_INFO("add Up");
|
|
||||||
subWidgetAdd(m_widgetButtonUp);
|
subWidgetAdd(m_widgetButtonUp);
|
||||||
EWOL_INFO("add Entry");
|
|
||||||
subWidgetAdd(m_widgetEntry);
|
subWidgetAdd(m_widgetEntry);
|
||||||
break;
|
break;
|
||||||
case ewol::widget::spinPosition_RightRight:
|
case ewol::widget::spinPosition_RightRight:
|
||||||
EWOL_INFO("add Entry");
|
|
||||||
subWidgetAdd(m_widgetEntry);
|
subWidgetAdd(m_widgetEntry);
|
||||||
EWOL_INFO("add Down");
|
|
||||||
subWidgetAdd(m_widgetButtonDown);
|
subWidgetAdd(m_widgetButtonDown);
|
||||||
EWOL_INFO("add Up");
|
|
||||||
subWidgetAdd(m_widgetButtonUp);
|
subWidgetAdd(m_widgetButtonUp);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
EWOL_WARNING("updateGui [STOP]");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::widget::SpinBase::loadXML(const std::shared_ptr<const exml::Element>& _node) {
|
bool ewol::widget::SpinBase::loadXML(const std::shared_ptr<const exml::Element>& _node) {
|
||||||
|
@ -31,7 +31,8 @@ def create(target, module_name):
|
|||||||
'tools/visual_test/appl/debug.cpp',
|
'tools/visual_test/appl/debug.cpp',
|
||||||
'tools/visual_test/appl/init.cpp',
|
'tools/visual_test/appl/init.cpp',
|
||||||
'tools/visual_test/appl/MainWindows.cpp',
|
'tools/visual_test/appl/MainWindows.cpp',
|
||||||
'tools/visual_test/appl/TestDistanceField.cpp'
|
'tools/visual_test/appl/TestDistanceField.cpp',
|
||||||
|
'tools/visual_test/appl/widget/SizerColor.cpp'
|
||||||
])
|
])
|
||||||
|
|
||||||
my_module.add_module_depend(['ewol'])
|
my_module.add_module_depend(['ewol'])
|
||||||
|
@ -56,8 +56,17 @@ void appl::MainWindows::init() {
|
|||||||
externSubBind(m_composer, ewol::widget::Button, "appl-next-gravity", signalPressed, shared_from_this(), &appl::MainWindows::onCallbackGravityChange);
|
externSubBind(m_composer, ewol::widget::Button, "appl-next-gravity", signalPressed, shared_from_this(), &appl::MainWindows::onCallbackGravityChange);
|
||||||
|
|
||||||
m_sizerVert = std::dynamic_pointer_cast<ewol::widget::Sizer>(m_composer->getSubObjectNamed("appl-upper-test-widget"));
|
m_sizerVert = std::dynamic_pointer_cast<ewol::widget::Sizer>(m_composer->getSubObjectNamed("appl-upper-test-widget"));
|
||||||
|
if (m_sizerVert == nullptr) {
|
||||||
|
APPL_CRITICAL("Can not get vertical pointer");
|
||||||
|
}
|
||||||
m_sizerDynamic = std::dynamic_pointer_cast<ewol::widget::Sizer>(m_composer->getSubObjectNamed("appl-dynamic-config"));
|
m_sizerDynamic = std::dynamic_pointer_cast<ewol::widget::Sizer>(m_composer->getSubObjectNamed("appl-dynamic-config"));
|
||||||
|
if (m_sizerDynamic == nullptr) {
|
||||||
|
APPL_CRITICAL("Can not get dynamic pointer");
|
||||||
|
}
|
||||||
m_subWidget = std::dynamic_pointer_cast<ewol::Widget>(m_composer->getSubObjectNamed("[TEST]TO-TEST"));
|
m_subWidget = std::dynamic_pointer_cast<ewol::Widget>(m_composer->getSubObjectNamed("[TEST]TO-TEST"));
|
||||||
|
if (m_subWidget == nullptr) {
|
||||||
|
APPL_CRITICAL("Can not get subWidget pointer");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void appl::MainWindows::onCallbackThemeChange(const bool& _value) {
|
void appl::MainWindows::onCallbackThemeChange(const bool& _value) {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <appl/debug.h>
|
#include <appl/debug.h>
|
||||||
#include <appl/MainWindows.h>
|
#include <appl/MainWindows.h>
|
||||||
|
#include <appl/widget/SizerColor.h>
|
||||||
|
|
||||||
class MainApplication : public ewol::context::Application {
|
class MainApplication : public ewol::context::Application {
|
||||||
public:
|
public:
|
||||||
@ -48,6 +49,8 @@ class MainApplication : public ewol::context::Application {
|
|||||||
// set the application icon ...
|
// set the application icon ...
|
||||||
_context.setIcon("DATA:icon.png");
|
_context.setIcon("DATA:icon.png");
|
||||||
|
|
||||||
|
appl::widget::SizerColor::createManagerWidget(_context.getWidgetManager());
|
||||||
|
|
||||||
APPL_INFO("==> CREATE ... (END)");
|
APPL_INFO("==> CREATE ... (END)");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
149
tools/visual_test/appl/widget/SizerColor.cpp
Normal file
149
tools/visual_test/appl/widget/SizerColor.cpp
Normal file
@ -0,0 +1,149 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <appl/debug.h>
|
||||||
|
#include <appl/widget/SizerColor.h>
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "SizerColor"
|
||||||
|
|
||||||
|
appl::widget::SizerColor::SizerColor() :
|
||||||
|
m_borderColor(*this, "border-color", etk::color::none, "Color of the border"),
|
||||||
|
m_leftColor(*this, "color-left", etk::color::purple),
|
||||||
|
m_rightColor(*this, "color-right", etk::color::orange),
|
||||||
|
m_topColor(*this, "color-top", etk::color::cyan),
|
||||||
|
m_buttomColor(*this, "color-buttom", etk::color::brown) {
|
||||||
|
addObjectType("appl::widget::SizerColor");
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::widget::SizerColor::init(enum displayMode _mode) {
|
||||||
|
ewol::widget::Sizer::init();
|
||||||
|
}
|
||||||
|
|
||||||
|
appl::widget::SizerColor::~SizerColor() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void appl::widget::SizerColor::onRegenerateDisplay() {
|
||||||
|
ewol::widget::Sizer::onRegenerateDisplay();
|
||||||
|
m_draw.clear();
|
||||||
|
vec2 tmpBorderSize = propertyBorderSize->getPixel();
|
||||||
|
if (tmpBorderSize == vec2(0.0f, 0.0f)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (m_borderColor->a() == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_draw.setColor(m_borderColor);
|
||||||
|
m_draw.setPos(vec3(0, 0, 0) );
|
||||||
|
m_draw.rectangleWidth(vec3(tmpBorderSize.x(), m_size.y(),0) );
|
||||||
|
m_draw.setPos(vec3(m_size.x() - tmpBorderSize.x(), 0, 0) );
|
||||||
|
m_draw.rectangleWidth(vec3(tmpBorderSize.x(), m_size.y(),0) );
|
||||||
|
m_draw.setPos(vec3(tmpBorderSize.x(), 0, 0) );
|
||||||
|
m_draw.rectangleWidth(vec3(m_size.x()-tmpBorderSize.x()*2.0f, tmpBorderSize.y(),0) );
|
||||||
|
m_draw.setPos(vec3(tmpBorderSize.x(), m_size.y()-tmpBorderSize.y(), 0) );
|
||||||
|
m_draw.rectangleWidth(vec3(m_size.x()-tmpBorderSize.x()*2.0f, tmpBorderSize.y(),0) );
|
||||||
|
vec2 underSize(0,0);
|
||||||
|
vec2 underOrigin(999999999999.0,999999999999.0);
|
||||||
|
for (auto &it : m_subWidget) {
|
||||||
|
if (it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
vec2 size = it->getSize();
|
||||||
|
if (propertyMode == ewol::widget::Sizer::modeVert) {
|
||||||
|
underSize += vec2(0.0f, size.y());
|
||||||
|
underSize.setX(std::max(underSize.x(), size.x()));
|
||||||
|
} else {
|
||||||
|
underSize += vec2(size.x(), 0.0f);
|
||||||
|
underSize.setY(std::max(underSize.y(), size.y()));
|
||||||
|
}
|
||||||
|
underOrigin.setX(std::min(it->getOrigin().x(), underOrigin.x()));
|
||||||
|
underOrigin.setY(std::min(it->getOrigin().y(), underOrigin.y()));
|
||||||
|
}
|
||||||
|
vec2 localWidgetSize = m_size - tmpBorderSize*2.0f;
|
||||||
|
vec2 localWidgetOrigin = m_origin + tmpBorderSize;
|
||||||
|
for (auto &it : m_subWidget) {
|
||||||
|
if (it == nullptr) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
vec2 origin = it->getOrigin();
|
||||||
|
vec2 size = it->getSize();
|
||||||
|
// now we display around the widget every element needed
|
||||||
|
if (propertyMode == ewol::widget::Sizer::modeHori) {
|
||||||
|
if (size.y() < localWidgetSize.y()) {
|
||||||
|
// under
|
||||||
|
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_buttom)) == 0) {
|
||||||
|
m_draw.setColor(m_buttomColor);
|
||||||
|
m_draw.setPos(vec2(origin.x(), localWidgetOrigin.y()) - m_origin);
|
||||||
|
m_draw.rectangleWidth(vec2(it->getSize().x(), origin.y()-localWidgetOrigin.y()) );
|
||||||
|
}
|
||||||
|
// upper
|
||||||
|
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_top)) == 0) {
|
||||||
|
m_draw.setColor(m_topColor);
|
||||||
|
float startDraw = origin.y()+it->getSize().y() - m_origin.y();
|
||||||
|
m_draw.setPos(vec2(origin.x()-m_origin.x(), startDraw));
|
||||||
|
m_draw.rectangleWidth(vec2(it->getSize().x(), localWidgetSize.y()-startDraw+tmpBorderSize.y()) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (size.x() < localWidgetSize.x()) {
|
||||||
|
// left
|
||||||
|
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_left)) == 0) {
|
||||||
|
m_draw.setColor(m_leftColor);
|
||||||
|
m_draw.setPos(vec2(localWidgetOrigin.x(), origin.y()) - m_origin);
|
||||||
|
m_draw.rectangleWidth(vec2(origin.x()-localWidgetOrigin.x(), it->getSize().y()) );
|
||||||
|
}
|
||||||
|
// right
|
||||||
|
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_right)) == 0) {
|
||||||
|
m_draw.setColor(m_rightColor);
|
||||||
|
float startDraw = origin.x()+it->getSize().x() - m_origin.x();
|
||||||
|
m_draw.setPos(vec2(startDraw, origin.y()-m_origin.y()));
|
||||||
|
m_draw.rectangleWidth(vec2(localWidgetSize.x()-startDraw+tmpBorderSize.x(), it->getSize().y()) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// now we do the rest of the sizer:
|
||||||
|
if (propertyMode == ewol::widget::Sizer::modeHori) {
|
||||||
|
if (underSize.x() < localWidgetSize.x()) {
|
||||||
|
// left
|
||||||
|
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_left)) == 0) {
|
||||||
|
m_draw.setColor(m_leftColor);
|
||||||
|
m_draw.setPos(localWidgetOrigin - m_origin);
|
||||||
|
m_draw.rectangleWidth(vec2(underOrigin.x()-localWidgetOrigin.x(), localWidgetSize.y()) );
|
||||||
|
}
|
||||||
|
// right
|
||||||
|
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_right)) == 0) {
|
||||||
|
m_draw.setColor(m_rightColor);
|
||||||
|
float startDraw = underOrigin.x() + underSize.x() - m_origin.x();
|
||||||
|
m_draw.setPos(vec2(startDraw, localWidgetOrigin.y()-m_origin.y()));
|
||||||
|
m_draw.rectangleWidth(vec2(localWidgetSize.x()-startDraw+tmpBorderSize.x(), localWidgetSize.y()) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (underSize.y() < localWidgetSize.y()) {
|
||||||
|
// under
|
||||||
|
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_buttom)) == 0) {
|
||||||
|
m_draw.setColor(m_buttomColor);
|
||||||
|
m_draw.setPos(localWidgetOrigin - m_origin);
|
||||||
|
m_draw.rectangleWidth(vec2(localWidgetSize.x(), underOrigin.y()-localWidgetOrigin.y()) );
|
||||||
|
}
|
||||||
|
// upper
|
||||||
|
if ((uint32_t(propertyGravity) & uint32_t(ewol::gravity_top)) == 0) {
|
||||||
|
m_draw.setColor(m_topColor);
|
||||||
|
float startDraw = underOrigin.y() + underSize.y() - m_origin.y();
|
||||||
|
m_draw.setPos(vec2(localWidgetOrigin.x()-m_origin.x(), startDraw));
|
||||||
|
m_draw.rectangleWidth(vec2(localWidgetSize.x(), localWidgetSize.y()-startDraw+tmpBorderSize.y()) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void appl::widget::SizerColor::onDraw() {
|
||||||
|
m_draw.draw();
|
||||||
|
ewol::widget::Sizer::onDraw();
|
||||||
|
}
|
50
tools/visual_test/appl/widget/SizerColor.h
Normal file
50
tools/visual_test/appl/widget/SizerColor.h
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license APACHE v2.0 (see license file)
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <ewol/widget/Sizer.h>
|
||||||
|
#include <etk/Color.h>
|
||||||
|
#include <ewol/compositing/Drawing.h>
|
||||||
|
|
||||||
|
namespace appl {
|
||||||
|
namespace widget {
|
||||||
|
class SizerColor : public ewol::widget::Sizer {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Main call of recording the widget on the List of "widget named creator"
|
||||||
|
*/
|
||||||
|
static void init(ewol::widget::Manager& _widgetManager);
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
* @param[in] _mode The mode to display the elements
|
||||||
|
*/
|
||||||
|
SizerColor();
|
||||||
|
void init(enum displayMode _mode=ewol::widget::Sizer::modeHori);
|
||||||
|
public:
|
||||||
|
DECLARE_WIDGET_FACTORY(SizerColor, "SizerColor");
|
||||||
|
/**
|
||||||
|
* @brief Desstructor
|
||||||
|
*/
|
||||||
|
virtual ~SizerColor();
|
||||||
|
private:
|
||||||
|
eproperty::Value<etk::Color<>> m_borderColor; //!< Border color.
|
||||||
|
eproperty::Value<etk::Color<>> m_leftColor; //!< Left color.
|
||||||
|
eproperty::Value<etk::Color<>> m_rightColor; //!< Right color.
|
||||||
|
eproperty::Value<etk::Color<>> m_topColor; //!< Top color.
|
||||||
|
eproperty::Value<etk::Color<>> m_buttomColor; //!< Buttom color.
|
||||||
|
private:
|
||||||
|
ewol::compositing::Drawing m_draw; //!< Compositing drawing element for display the border.
|
||||||
|
public:
|
||||||
|
virtual void onRegenerateDisplay();
|
||||||
|
virtual void onDraw();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user