[DEV] add sizer color for border (for debugging it is cool)
This commit is contained in:
parent
b595794a0d
commit
990894af6f
@ -16,6 +16,7 @@
|
||||
ewol::widget::Sizer::Sizer() :
|
||||
m_mode(*this, "mode", modeHori, "The display mode"),
|
||||
m_borderSize(*this, "border", vec2(0,0), "The sizer border size"),
|
||||
m_borderColor(*this, "border-color", etk::color::none, "Color of the border"),
|
||||
m_animation(animationNone),
|
||||
m_animationTime(0) {
|
||||
addObjectType("ewol::widget::Sizer");
|
||||
@ -147,6 +148,31 @@ void ewol::widget::Sizer::calculateMinMaxSize() {
|
||||
//EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} Result min size : " << m_minSize);
|
||||
}
|
||||
|
||||
void ewol::widget::Sizer::onRegenerateDisplay() {
|
||||
ewol::widget::ContainerN::onRegenerateDisplay();
|
||||
m_draw.clear();
|
||||
vec2 tmpBorderSize = m_borderSize->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) );
|
||||
}
|
||||
void ewol::widget::Sizer::onDraw() {
|
||||
m_draw.draw();
|
||||
ewol::widget::ContainerN::onDraw();
|
||||
}
|
||||
|
||||
int32_t ewol::widget::Sizer::subWidgetAdd(std::shared_ptr<ewol::Widget> _newWidget) {
|
||||
if (m_animation == animationNone) {
|
||||
return ewol::widget::ContainerN::subWidgetAdd(_newWidget);
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/ContainerN.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
#include <etk/Color.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
@ -76,6 +78,23 @@ namespace ewol {
|
||||
const gale::Dimension& getBorderSize() const {
|
||||
return m_borderSize;
|
||||
};
|
||||
private:
|
||||
ewol::parameter::Value<etk::Color<>> m_borderColor; //!< Border color.
|
||||
public:
|
||||
/**
|
||||
* @brief Set the current border color:
|
||||
* @param[in] _value The border color to set @ref etk::color::none : no color
|
||||
*/
|
||||
void setBorderColor(const etk::Color<>& _value) {
|
||||
m_borderColor.set(_value);
|
||||
}
|
||||
/**
|
||||
* @brief get the current border size of the current element:
|
||||
* @return the border size (0 if not used)
|
||||
*/
|
||||
const etk::Color<>& getBorderColor() const {
|
||||
return m_borderColor;
|
||||
};
|
||||
public:
|
||||
enum animation {
|
||||
animationNone, //!< No annimation
|
||||
@ -119,6 +138,8 @@ namespace ewol {
|
||||
float getAnimationTime() {
|
||||
return m_animationTime;
|
||||
};
|
||||
private:
|
||||
ewol::compositing::Drawing m_draw; //!< Compositing drawing element for display the border.
|
||||
public: // Derived function
|
||||
virtual void calculateSize(const vec2& _availlable);
|
||||
virtual void calculateMinMaxSize();
|
||||
@ -128,6 +149,8 @@ namespace ewol {
|
||||
virtual void subWidgetRemove(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
virtual void subWidgetUnLink(std::shared_ptr<ewol::Widget> _newWidget);
|
||||
virtual void onParameterChangeValue(const ewol::parameter::Ref& _paramPointer);
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual void onDraw();
|
||||
};
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user