[DEV] back working of ButtonColor and colorBar
This commit is contained in:
parent
dc6e4eeb49
commit
426cbbfa78
2
external/agg
vendored
2
external/agg
vendored
@ -1 +1 @@
|
||||
Subproject commit b166e92b447201ef12236cd498a06664c7aec52f
|
||||
Subproject commit 4a997e47d5b724d994403f499f2258fc86e764b3
|
@ -531,6 +531,67 @@ void ewol::Drawing::Cube(etk::Vector3D<float> dest)
|
||||
|
||||
void ewol::Drawing::Circle(float radius, float angleStart, float angleStop)
|
||||
{
|
||||
ResetCount();
|
||||
|
||||
if (radius<0) {
|
||||
radius *= -1;
|
||||
}
|
||||
angleStop = angleStop-angleStart;
|
||||
|
||||
|
||||
int32_t nbOcurence = radius;
|
||||
if (nbOcurence < 10)
|
||||
{
|
||||
nbOcurence = 10;
|
||||
}
|
||||
|
||||
// display background :
|
||||
if (m_colorBg.a!=0) {
|
||||
InternalSetColor(m_colorBg);
|
||||
for (int32_t iii=0; iii<nbOcurence; iii++) {
|
||||
SetPoint(etk::Vector3D<float>(m_position.x, m_position.y) );
|
||||
|
||||
float angleOne = angleStart + (angleStop* iii / nbOcurence) ;
|
||||
float offsety = sin(angleOne) * radius;
|
||||
float offsetx = cos(angleOne) * radius;
|
||||
|
||||
SetPoint(etk::Vector3D<float>(m_position.x + offsetx, m_position.y + offsety) );
|
||||
|
||||
float angleTwo = angleStart + (angleStop* (iii+1) / nbOcurence) ;
|
||||
offsety = sin(angleTwo) * radius;
|
||||
offsetx = cos(angleTwo) * radius;
|
||||
|
||||
SetPoint(etk::Vector3D<float>(m_position.x + offsetx, m_position.y + offsety) );
|
||||
}
|
||||
}
|
||||
|
||||
// show if we have a border :
|
||||
if( m_thickness==0
|
||||
|| m_color.a==0) {
|
||||
return;
|
||||
}
|
||||
InternalSetColor(m_color);
|
||||
for (int32_t iii=0; iii<nbOcurence; iii++) {
|
||||
|
||||
float angleOne = angleStart + (angleStop* iii / nbOcurence) ;
|
||||
float offsetExty = sin(angleOne) * (radius+m_thickness/2);
|
||||
float offsetExtx = cos(angleOne) * (radius+m_thickness/2);
|
||||
float offsetInty = sin(angleOne) * (radius-m_thickness/2);
|
||||
float offsetIntx = cos(angleOne) * (radius-m_thickness/2);
|
||||
|
||||
float angleTwo = angleStart + (angleStop* (iii+1) / nbOcurence );
|
||||
float offsetExt2y = sin(angleTwo) * (radius+m_thickness/2);
|
||||
float offsetExt2x = cos(angleTwo) * (radius+m_thickness/2);
|
||||
float offsetInt2y = sin(angleTwo) * (radius-m_thickness/2);
|
||||
float offsetInt2x = cos(angleTwo) * (radius-m_thickness/2);
|
||||
|
||||
SetPoint(etk::Vector3D<float>(m_position.x + offsetIntx, m_position.y + offsetInty));
|
||||
SetPoint(etk::Vector3D<float>(m_position.x + offsetExtx, m_position.y + offsetExty));
|
||||
SetPoint(etk::Vector3D<float>(m_position.x + offsetExt2x, m_position.y + offsetExt2y));
|
||||
|
||||
SetPoint(etk::Vector3D<float>(m_position.x + offsetExt2x, m_position.y + offsetExt2y));
|
||||
SetPoint(etk::Vector3D<float>(m_position.x + offsetInt2x, m_position.y + offsetInt2y));
|
||||
SetPoint(etk::Vector3D<float>(m_position.x + offsetIntx, m_position.y + offsetInty));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ namespace ewol
|
||||
* @param[in] angleStart start angle of this circle ([0..2PI] otherwithe ==> disable)
|
||||
* @param[in] angleStop stop angle of this circle ([0..2PI] otherwithe ==> disable)
|
||||
*/
|
||||
void Circle(float radius, float angleStart = -1, float angleStop = -1);
|
||||
void Circle(float radius, float angleStart = 0, float angleStop = 2*M_PI);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -335,7 +335,7 @@ bool widget::Button::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput,
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return m_mouseHover;
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,9 +36,9 @@ namespace widget {
|
||||
etk::UString m_labelToggle; //!< Label to display when toggle mode is set ("" whenit is the same).
|
||||
bool m_toggleMode; //!< The button is able to toggle.
|
||||
bool m_value; //!< Current state of the button.
|
||||
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)
|
||||
bool m_buttonPressed; //!< Flag to know if the button is curently pressed
|
||||
int32_t m_imageDisplaySize; //!< Display size of the Image
|
||||
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
|
||||
bool m_buttonPressed; //!< Flag to know if the button is curently pressed.
|
||||
int32_t m_imageDisplaySize; //!< Display size of the Image.
|
||||
// hover area :
|
||||
etk::Vector2D<float> m_selectableAreaPos; //!< Start position of the events
|
||||
etk::Vector2D<float> m_selectableAreaSize; //!< Size of the event positions
|
||||
@ -118,6 +118,10 @@ namespace widget {
|
||||
// Derived function
|
||||
virtual bool OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData);
|
||||
private:
|
||||
/**
|
||||
* @brief Internal system to Change the property of the current status
|
||||
* @param[in] new state
|
||||
*/
|
||||
void ChangeStatusIn(int32_t newStatusId);
|
||||
// Derived function
|
||||
virtual void PeriodicCall(int64_t localTime);
|
||||
|
@ -18,6 +18,13 @@
|
||||
extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Change";
|
||||
|
||||
|
||||
// DEFINE for the shader display system :
|
||||
#define STATUS_UP (0)
|
||||
#define STATUS_HOVER (2)
|
||||
#define STATUS_PRESSED (1)
|
||||
#define STATUS_DOWN (3)
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ButtonColor"
|
||||
|
||||
@ -27,7 +34,7 @@ widget::ButtonColor::ButtonColor(draw::Color baseColor) :
|
||||
m_widgetContextMenu(NULL)
|
||||
{
|
||||
AddEventId(ewolEventButtonColorChange);
|
||||
|
||||
ChangeStatusIn(STATUS_UP);
|
||||
SetCanHaveFocus(true);
|
||||
// Limit event at 1:
|
||||
SetMouseLimit(1);
|
||||
@ -44,10 +51,9 @@ widget::ButtonColor::~ButtonColor(void)
|
||||
bool widget::ButtonColor::CalculateMinSize(void)
|
||||
{
|
||||
etk::Vector2D<float> padding = m_shaper.GetPadding();
|
||||
char colorText[256];
|
||||
sprintf(colorText, "#%08X", m_textColorFg.Get());
|
||||
etk::Vector3D<int32_t> minSize = m_text.CalculateSize(colorText);
|
||||
m_minSize.x = padding.x*2 + minSize.x;
|
||||
etk::UString label = draw::GetString(m_textColorFg);
|
||||
etk::Vector3D<int32_t> minSize = m_text.CalculateSize(label);
|
||||
m_minSize.x = padding.x*2 + minSize.x + 7;
|
||||
m_minSize.y = padding.y*2 + minSize.y;
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
@ -67,100 +73,143 @@ void widget::ButtonColor::OnRegenerateDisplay(void)
|
||||
if (true == NeedRedraw()) {
|
||||
m_text.Clear();
|
||||
m_shaper.Clear();
|
||||
/*
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
int32_t tmpSizeY = m_minSize.y;
|
||||
int32_t tmpOriginX = (m_size.x - m_minSize.x) / 2;
|
||||
int32_t tmpOriginY = (m_size.y - m_minSize.y) / 2;
|
||||
|
||||
etk::Vector2D<float> padding = m_shaper.GetPadding();
|
||||
|
||||
etk::UString label = draw::GetString(m_textColorFg);
|
||||
|
||||
etk::Vector2D<int32_t> localSize = m_minSize;
|
||||
|
||||
etk::Vector3D<float> tmpOrigin((m_size.x - m_minSize.x) / 2.0,
|
||||
(m_size.y - m_minSize.y) / 2.0,
|
||||
0.0);
|
||||
|
||||
// no change for the text orogin :
|
||||
int32_t tmpTextOriginX = (m_size.x - m_minSize.x) / 2 + m_padding.x;
|
||||
int32_t tmpTextOriginY = (m_size.y - m_minSize.y) / 2 + m_padding.y;
|
||||
etk::Vector3D<float> tmpTextOrigin((m_size.x - m_minSize.x) / 2.0,
|
||||
(m_size.y - m_minSize.y) / 2.0,
|
||||
0.0);
|
||||
|
||||
if (true==m_userFill.x) {
|
||||
tmpSizeX = m_size.x;
|
||||
tmpOriginX = 0;
|
||||
localSize.x = m_size.x;
|
||||
tmpOrigin.x = 0.0;
|
||||
tmpTextOrigin.x = 0.0;
|
||||
}
|
||||
if (true==m_userFill.y) {
|
||||
tmpSizeY = m_size.y;
|
||||
tmpOriginY = 0;
|
||||
localSize.y = m_size.y;
|
||||
}
|
||||
tmpOriginX += m_padding.x;
|
||||
tmpOriginY += m_padding.y;
|
||||
tmpSizeX -= 2*m_padding.x;
|
||||
tmpSizeY -= 2*m_padding.y;
|
||||
tmpOrigin.x += padding.x;
|
||||
tmpOrigin.y += padding.y;
|
||||
tmpTextOrigin.x += padding.x;
|
||||
tmpTextOrigin.y += padding.y;
|
||||
localSize.x -= 2*padding.x;
|
||||
localSize.y -= 2*padding.y;
|
||||
|
||||
if ((m_textColorBg.r>0.5) || (m_textColorBg.g>0.5) || (m_textColorBg.b > 0.8) ) {
|
||||
m_textColorFg = draw::color::black;
|
||||
// clean the element
|
||||
m_text.Reset();
|
||||
if( m_textColorFg.r < 100
|
||||
|| m_textColorFg.g < 100
|
||||
|| m_textColorFg.b < 100) {
|
||||
m_text.SetColor(draw::color::white);
|
||||
} else {
|
||||
m_textColorFg = draw::color::white;
|
||||
m_text.SetColor(draw::color::black);
|
||||
}
|
||||
etk::Vector3D<float> textPos;
|
||||
textPos.x = tmpTextOriginX;
|
||||
textPos.y = tmpTextOriginY;
|
||||
textPos.z = 0;
|
||||
m_oObjectText.SetPos(textPos);
|
||||
m_oObjectText.Print(m_label);
|
||||
m_text.SetPos(tmpTextOrigin);
|
||||
m_text.SetColorBg(m_textColorFg);
|
||||
m_text.SetTextAlignement(tmpTextOrigin.x, tmpTextOrigin.x+localSize.x, ewol::Text::alignCenter);
|
||||
m_text.Print(label);
|
||||
|
||||
m_oObjectDecoration.SetColor(m_textColorBg);
|
||||
tmpOriginX -= m_padding.x/2;
|
||||
tmpOriginY -= m_padding.y/2;
|
||||
tmpSizeX += m_padding.x/1;
|
||||
tmpSizeY += m_padding.y/1;
|
||||
m_oObjectDecoration.SetPos(etk::Vector3D<float>(tmpOriginX, tmpOriginY, 0) );
|
||||
m_oObjectDecoration.RectangleWidth(etk::Vector3D<float>(tmpSizeX, tmpSizeY, 0) );
|
||||
*/
|
||||
|
||||
if (true==m_userFill.y) {
|
||||
tmpOrigin.y = padding.y;
|
||||
}
|
||||
|
||||
// selection area :
|
||||
m_selectableAreaPos = etk::Vector2D<float>(tmpOrigin.x-padding.x, tmpOrigin.y-padding.y);
|
||||
m_selectableAreaSize = localSize + etk::Vector2D<float>(2,2)*padding;
|
||||
m_shaper.SetOrigin(m_selectableAreaPos );
|
||||
m_shaper.SetSize(m_selectableAreaSize);
|
||||
m_shaper.SetInsidePos(etk::Vector2D<float>(tmpTextOrigin.x, tmpTextOrigin.y) );
|
||||
etk::Vector3D<float> tmpp = m_text.CalculateSize(label);
|
||||
etk::Vector2D<float> tmpp2(tmpp.x, tmpp.y);
|
||||
m_shaper.SetInsideSize(tmpp2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool widget::ButtonColor::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
/*
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
if( ewol::keyEvent::statusSingle == typeEvent) {
|
||||
// nothing to do ...
|
||||
//GenerateEventId(ewolEventButtonPressed);
|
||||
// Display the pop-up menu ...
|
||||
|
||||
// create a context menu :
|
||||
m_widgetContextMenu = new widget::ContextMenu();
|
||||
if (NULL == m_widgetContextMenu) {
|
||||
EWOL_ERROR("Allocation Error");
|
||||
return true;
|
||||
}
|
||||
// Get the button widget :
|
||||
etk::Vector2D<float> newPosition;
|
||||
newPosition.x = m_origin.x + m_size.x/2;
|
||||
newPosition.y = m_origin.y;
|
||||
|
||||
m_widgetContextMenu->SetPositionMark(widget::CONTEXT_MENU_MARK_BOTTOM, newPosition );
|
||||
|
||||
widget::ColorChooser * myColorChooser = new widget::ColorChooser();
|
||||
myColorChooser->SetColor(m_textColorBg);
|
||||
// set it in the pop-up-system :
|
||||
m_widgetContextMenu->SubWidgetSet(myColorChooser);
|
||||
myColorChooser->RegisterOnEvent(this, ewolEventColorChooserChange, ewolEventColorChooserChange);
|
||||
ewol::WindowsPopUpAdd(m_widgetContextMenu);
|
||||
MarkToRedraw();
|
||||
|
||||
return true;
|
||||
bool previousHoverState = m_mouseHover;
|
||||
if(ewol::keyEvent::statusLeave == typeEvent) {
|
||||
m_mouseHover = false;
|
||||
m_buttonPressed = false;
|
||||
} else {
|
||||
etk::Vector2D<float> relativePos = RelativePosition(pos);
|
||||
// prevent error from ouside the button
|
||||
if( relativePos.x < m_selectableAreaPos.x
|
||||
|| relativePos.y < m_selectableAreaPos.y
|
||||
|| relativePos.x > m_selectableAreaPos.x + m_selectableAreaSize.x
|
||||
|| relativePos.y > m_selectableAreaPos.y + m_selectableAreaSize.y ) {
|
||||
m_mouseHover = false;
|
||||
m_buttonPressed = false;
|
||||
} else {
|
||||
m_mouseHover = true;
|
||||
}
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
bool previousPressed = m_buttonPressed;
|
||||
//EWOL_DEBUG("Event on BT ... mouse position : " << m_mouseHover);
|
||||
if (true == m_mouseHover) {
|
||||
if (1 == IdInput) {
|
||||
if(ewol::keyEvent::statusDown == typeEvent) {
|
||||
m_buttonPressed = true;
|
||||
MarkToRedraw();
|
||||
}
|
||||
if(ewol::keyEvent::statusUp == typeEvent) {
|
||||
m_buttonPressed = false;
|
||||
MarkToRedraw();
|
||||
}
|
||||
if(ewol::keyEvent::statusSingle == typeEvent) {
|
||||
m_buttonPressed = false;
|
||||
m_mouseHover = false;
|
||||
// create a context menu :
|
||||
m_widgetContextMenu = new widget::ContextMenu();
|
||||
if (NULL == m_widgetContextMenu) {
|
||||
EWOL_ERROR("Allocation Error");
|
||||
return true;
|
||||
}
|
||||
etk::Vector2D<float> tmpPos = m_origin + m_selectableAreaPos + m_selectableAreaSize;
|
||||
tmpPos.x -= m_minSize.x/2.0;
|
||||
m_widgetContextMenu->SetPositionMark(widget::CONTEXT_MENU_MARK_BOTTOM, tmpPos );
|
||||
|
||||
widget::ColorChooser * myColorChooser = new widget::ColorChooser();
|
||||
myColorChooser->SetColor(m_textColorFg);
|
||||
// set it in the pop-up-system :
|
||||
m_widgetContextMenu->SubWidgetSet(myColorChooser);
|
||||
myColorChooser->RegisterOnEvent(this, ewolEventColorChooserChange, ewolEventColorChooserChange);
|
||||
ewol::WindowsPopUpAdd(m_widgetContextMenu);
|
||||
MarkToRedraw();
|
||||
}
|
||||
}
|
||||
}
|
||||
if( m_mouseHover != previousHoverState
|
||||
|| m_buttonPressed != previousPressed) {
|
||||
if (true==m_buttonPressed) {
|
||||
ChangeStatusIn(STATUS_PRESSED);
|
||||
} else {
|
||||
if (true==m_mouseHover) {
|
||||
ChangeStatusIn(STATUS_HOVER);
|
||||
} else {
|
||||
ChangeStatusIn(STATUS_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
return m_mouseHover;
|
||||
}
|
||||
|
||||
|
||||
void widget::ButtonColor::SetValue(draw::Color color)
|
||||
{
|
||||
m_textColorFg = color;
|
||||
/*
|
||||
char colorText[256];
|
||||
sprintf(colorText, "#%08X", color.Get());
|
||||
//set the new label ...
|
||||
SetLabel(colorText);
|
||||
*/
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
draw::Color widget::ButtonColor::GetValue(void)
|
||||
@ -171,18 +220,29 @@ draw::Color widget::ButtonColor::GetValue(void)
|
||||
|
||||
void widget::ButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
EWOL_INFO("Receive MSG : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (eventId == ewolEventColorChooserChange) {
|
||||
/*
|
||||
// TODO : Parse the input color ...
|
||||
//draw::Color tmpColor(data);
|
||||
draw::Color tmpColor;
|
||||
m_selectedColor = tmpColor;
|
||||
m_textColorBg = m_selectedColor;
|
||||
char colorText[256];
|
||||
sprintf(colorText, "#%08X", tmpColor.Get());
|
||||
//set the new label ...
|
||||
SetLabel(colorText);
|
||||
GenerateEventId(ewolEventButtonColorChange);
|
||||
*/
|
||||
draw::ParseColor(data.c_str(), m_textColorFg);
|
||||
GenerateEventId(ewolEventButtonColorChange, data);
|
||||
MarkToRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void widget::ButtonColor::ChangeStatusIn(int32_t newStatusId)
|
||||
{
|
||||
if (true == m_shaper.ChangeStatusIn(newStatusId) ) {
|
||||
PeriodicCallSet(true);
|
||||
MarkToRedraw();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void widget::ButtonColor::PeriodicCall(int64_t localTime)
|
||||
{
|
||||
if (false == m_shaper.PeriodicCall(localTime) ) {
|
||||
PeriodicCallSet(false);
|
||||
}
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
@ -23,13 +23,24 @@ namespace widget {
|
||||
class ButtonColor : public ewol::Widget
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @brief Main constructor
|
||||
*/
|
||||
ButtonColor(draw::Color baseColor=draw::color::black);
|
||||
/**
|
||||
* @brief Main destructor
|
||||
*/
|
||||
virtual ~ButtonColor(void);
|
||||
private:
|
||||
ewol::Shaper m_shaper; //!< Compositing theme.
|
||||
ewol::Text m_text;
|
||||
draw::Color m_textColorFg; //!< Text color && user selected color
|
||||
widget::ContextMenu* m_widgetContextMenu;
|
||||
ewol::Shaper m_shaper; //!< Compositing theme.
|
||||
ewol::Text m_text; //!< Compositing Test display.
|
||||
draw::Color m_textColorFg; //!< Current color.
|
||||
widget::ContextMenu* m_widgetContextMenu; //!< Specific context menu.
|
||||
bool m_mouseHover; //!< Flag to know where the mouse is (inside the displayed widget (if not fill)).
|
||||
bool m_buttonPressed; //!< Flag to know if the button is curently pressed.
|
||||
// hover area :
|
||||
etk::Vector2D<float> m_selectableAreaPos; //!< Start position of the events
|
||||
etk::Vector2D<float> m_selectableAreaSize; //!< Size of the event positions
|
||||
public:
|
||||
/**
|
||||
* @brief Get the current color of the color selection widget
|
||||
@ -54,6 +65,14 @@ namespace widget {
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos);
|
||||
// Derived function
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
private:
|
||||
/**
|
||||
* @brief Internal system to Change the property of the current status
|
||||
* @param[in] new state
|
||||
*/
|
||||
void ChangeStatusIn(int32_t newStatusId);
|
||||
// Derived function
|
||||
virtual void PeriodicCall(int64_t localTime);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -23,14 +23,6 @@ extern const char * const ewolEventColorBarChange = "ewol-color-bar-change";
|
||||
widget::ColorBar::ColorBar(void)
|
||||
{
|
||||
AddEventId(ewolEventColorBarChange);
|
||||
|
||||
#ifdef __TARGET_OS__Android
|
||||
m_padding.y = 12;
|
||||
m_padding.x = 12;
|
||||
#else
|
||||
m_padding.y = 4;
|
||||
m_padding.x = 4;
|
||||
#endif
|
||||
m_currentUserPos.x=0;
|
||||
m_currentUserPos.y=0;
|
||||
m_currentColor = draw::color::black;
|
||||
@ -46,7 +38,7 @@ widget::ColorBar::~ColorBar(void)
|
||||
|
||||
bool widget::ColorBar::CalculateMinSize(void)
|
||||
{
|
||||
m_minSize.x = 80;
|
||||
m_minSize.x = 160;
|
||||
m_minSize.y = 80;
|
||||
MarkToRedraw();
|
||||
return true;
|
||||
@ -76,11 +68,17 @@ void widget::ColorBar::SetCurrentColor(draw::Color newOne)
|
||||
// TODO : Later when really needed ...
|
||||
}
|
||||
|
||||
void widget::ColorBar::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
m_draw.Draw();
|
||||
}
|
||||
|
||||
|
||||
void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (true == NeedRedraw()) {
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
m_draw.Clear();
|
||||
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
int32_t tmpSizeY = m_minSize.y;
|
||||
@ -95,21 +93,8 @@ void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
tmpSizeY = m_size.y;
|
||||
tmpOriginY = 0;
|
||||
}
|
||||
tmpOriginX += m_padding.x;
|
||||
tmpOriginY += m_padding.y;
|
||||
tmpSizeX -= 2*m_padding.x;
|
||||
tmpSizeY -= 2*m_padding.y;
|
||||
|
||||
ewol::Drawing * tmpOObjects = new ewol::Drawing;
|
||||
|
||||
tmpOriginX -= m_padding.x/2;
|
||||
tmpOriginY -= m_padding.y/2;
|
||||
tmpSizeX += m_padding.x;
|
||||
tmpSizeY += m_padding.y;
|
||||
|
||||
for(int32_t iii=0; iii<NB_BAND_COLOR ; iii++) {
|
||||
// TODO : ...
|
||||
#if 0
|
||||
/* Step 1 :
|
||||
*
|
||||
* **
|
||||
@ -117,13 +102,15 @@ void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
* ******
|
||||
* ********
|
||||
*/
|
||||
tmpOObjects->SetColor(s_listColorWhite);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY);
|
||||
tmpOObjects->SetColor(s_listColor[iii+1]);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2);
|
||||
tmpOObjects->SetColor(s_listColor[iii]);
|
||||
tmpOObjects->SetPoint(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2);
|
||||
|
||||
m_draw.SetColor(s_listColorWhite);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + (iii)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY) );
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColor[iii+1]);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2) );
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColor[iii]);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2) );
|
||||
m_draw.AddVertex();
|
||||
/* Step 2 :
|
||||
* ********
|
||||
* ******
|
||||
@ -131,12 +118,15 @@ void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
* **
|
||||
*
|
||||
*/
|
||||
tmpOObjects->SetColor(s_listColorWhite);
|
||||
tmpOObjects->SetPoint(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY);
|
||||
tmpOObjects->SetColor(s_listColorWhite);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY);
|
||||
tmpOObjects->SetColor(s_listColor[iii+1]);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2);
|
||||
m_draw.SetColor(s_listColorWhite);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY) );
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColorWhite);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY) );
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColor[iii+1]);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2) );
|
||||
m_draw.AddVertex();
|
||||
/* Step 3 :
|
||||
*
|
||||
* **
|
||||
@ -144,12 +134,15 @@ void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
* ******
|
||||
* ********
|
||||
*/
|
||||
tmpOObjects->SetColor(s_listColor[iii]);
|
||||
tmpOObjects->SetPoint(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2);
|
||||
tmpOObjects->SetColor(s_listColorBlack);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY);
|
||||
tmpOObjects->SetColor(s_listColorBlack);
|
||||
tmpOObjects->SetPoint(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY);
|
||||
m_draw.SetColor(s_listColor[iii]);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2));
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColorBlack);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY));
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColorBlack);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY));
|
||||
m_draw.AddVertex();
|
||||
/* Step 4 :
|
||||
* ********
|
||||
* ******
|
||||
@ -157,40 +150,25 @@ void widget::ColorBar::OnRegenerateDisplay(void)
|
||||
* **
|
||||
*
|
||||
*/
|
||||
tmpOObjects->SetColor(s_listColor[iii]);
|
||||
tmpOObjects->SetPoint(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2);
|
||||
tmpOObjects->SetColor(s_listColor[iii+1]);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2);
|
||||
tmpOObjects->SetColor(s_listColorBlack);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY);
|
||||
/*
|
||||
tmpOObjects->SetColor(s_listColorWhite);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii+0.5)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY);
|
||||
tmpOObjects->SetColor(s_listColor[iii+1]);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2);
|
||||
tmpOObjects->SetColor(s_listColor[iii]);
|
||||
tmpOObjects->SetPoint(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2);
|
||||
|
||||
tmpOObjects->SetColor(s_listColor[iii]);
|
||||
tmpOObjects->SetPoint(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2);
|
||||
tmpOObjects->SetColor(s_listColor[iii+1]);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2);
|
||||
tmpOObjects->SetColor(s_listColorBlack);
|
||||
tmpOObjects->SetPoint(tmpOriginX + (iii+0.5)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY);
|
||||
*/
|
||||
#endif
|
||||
m_draw.SetColor(s_listColor[iii]);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + iii*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2));
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColor[iii+1]);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY/2));
|
||||
m_draw.AddVertex();
|
||||
m_draw.SetColor(s_listColorBlack);
|
||||
m_draw.SetPos(etk::Vector3D<float>(tmpOriginX + (iii+1)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY));
|
||||
m_draw.AddVertex();
|
||||
}
|
||||
draw::Color tmpColor;
|
||||
if (m_currentUserPos.y > 0.5) {
|
||||
tmpColor = draw::color::white;
|
||||
m_draw.SetColor(draw::color::white);
|
||||
} else {
|
||||
tmpColor = draw::color::black;
|
||||
m_draw.SetColor(draw::color::black);
|
||||
}
|
||||
tmpOObjects->SetColor(tmpColor);
|
||||
// TODO : ...
|
||||
//tmpOObjects->Circle(m_currentUserPos.x*m_size.x, m_currentUserPos.y*m_size.y, 3.0, 1.0);
|
||||
m_draw.SetPos(etk::Vector3D<float>(m_currentUserPos.x*m_size.x, m_currentUserPos.y*m_size.y) );
|
||||
m_draw.SetThickness(1);
|
||||
m_draw.Circle(3.0);
|
||||
|
||||
AddOObject(tmpOObjects);
|
||||
}
|
||||
}
|
||||
|
||||
@ -237,29 +215,20 @@ bool widget::ColorBar::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInpu
|
||||
estimateColor.b = s_listColor[bandID+1].b + (s_listColor[bandID].b-s_listColor[bandID+1].b)*(1-poroportionnalPos);
|
||||
}
|
||||
// step 2 generate the white and black ...
|
||||
if (relativePos.y == (m_size.y/2)) {
|
||||
if (m_currentUserPos.y == 0.5) {
|
||||
// nothing to do ... just get the current color ...
|
||||
} else if (relativePos.y < (m_size.y/2)) {
|
||||
float poroportionnalWhite = 1.0-relativePos.y/(m_size.y/2);
|
||||
estimateColor.r = estimateColor.r + (1.0 - estimateColor.r)*poroportionnalWhite;
|
||||
estimateColor.g = estimateColor.g + (1.0 - estimateColor.g)*poroportionnalWhite;
|
||||
estimateColor.b = estimateColor.b + (1.0 - estimateColor.b)*poroportionnalWhite;
|
||||
} else if (m_currentUserPos.y < 0.5) {
|
||||
float poroportionnalWhite = (0.5-m_currentUserPos.y)*2.0;
|
||||
estimateColor.r = estimateColor.r + (0xFF-estimateColor.r)*poroportionnalWhite;
|
||||
estimateColor.g = estimateColor.g + (0xFF-estimateColor.g)*poroportionnalWhite;
|
||||
estimateColor.b = estimateColor.b + (0xFF-estimateColor.b)*poroportionnalWhite;
|
||||
} else {
|
||||
float poroportionnalBlack = (relativePos.y-(m_size.y/2))/(m_size.y/2);
|
||||
estimateColor.r = estimateColor.r - (estimateColor.r)*poroportionnalBlack;
|
||||
estimateColor.g = estimateColor.g - (estimateColor.g)*poroportionnalBlack;
|
||||
estimateColor.b = estimateColor.b - (estimateColor.b)*poroportionnalBlack;
|
||||
float poroportionnalBlack = (m_currentUserPos.y-0.5)*2.0;
|
||||
estimateColor.r = estimateColor.r - estimateColor.r*poroportionnalBlack;
|
||||
estimateColor.g = estimateColor.g - estimateColor.g*poroportionnalBlack;
|
||||
estimateColor.b = estimateColor.b - estimateColor.b*poroportionnalBlack;
|
||||
}
|
||||
/*
|
||||
char colorText[256];
|
||||
sprintf(colorText, "#%02X%02X%02X%02X",
|
||||
(uint8_t)(estimateColor.r * 0xFF),
|
||||
(uint8_t)(estimateColor.g * 0xFF),
|
||||
(uint8_t)(estimateColor.b * 0xFF),
|
||||
(uint8_t)(estimateColor.a * 0xFF));
|
||||
EWOL_DEBUG("new color : " << colorText);
|
||||
*/
|
||||
if( m_currentColor != estimateColor) {
|
||||
if(m_currentColor != estimateColor) {
|
||||
m_currentColor = estimateColor;
|
||||
GenerateEventId(ewolEventColorBarChange);
|
||||
}
|
||||
|
@ -12,29 +12,32 @@
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <draw/Color.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
|
||||
extern const char * const ewolEventColorBarChange;
|
||||
|
||||
namespace widget {
|
||||
class ColorBar :public widget::Drawable
|
||||
class ColorBar :public ewol::Widget
|
||||
{
|
||||
public:
|
||||
ColorBar(void);
|
||||
virtual ~ColorBar(void);
|
||||
draw::Color GetCurrentColor(void);
|
||||
void SetCurrentColor(draw::Color newOne);
|
||||
private:
|
||||
ewol::Drawing m_draw; //!< Compositing drawing element
|
||||
draw::Color m_currentColor;
|
||||
etk::Vector2D<float> m_currentUserPos;
|
||||
public:
|
||||
// Derived function
|
||||
virtual const char * const GetObjectType(void) { return "EwolColorBar"; };
|
||||
// Derived function
|
||||
virtual bool CalculateMinSize(void);
|
||||
draw::Color GetCurrentColor(void);
|
||||
void SetCurrentColor(draw::Color newOne);
|
||||
private:
|
||||
draw::Color m_currentColor;
|
||||
etk::Vector2D<float> m_currentUserPos;
|
||||
etk::Vector2D<float> m_padding;
|
||||
public:
|
||||
// Derived function
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
// Derived function
|
||||
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
||||
// Derived function
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos);
|
||||
};
|
||||
|
@ -100,9 +100,9 @@ void widget::Slider::OnRegenerateDisplay(void)
|
||||
draw::Color borderDot = m_textColorFg;
|
||||
borderDot.a /= 2;
|
||||
tmpDraw->SetPos(etk::Vector3D<float>(4+((float)(m_value-m_min)/(float)(m_max-m_min))*(float)(m_size.x-2*dotRadius), m_size.y/2) );
|
||||
tmpDraw->SetColor(borderDot);
|
||||
tmpDraw->SetColorBg(borderDot);
|
||||
tmpDraw->Circle(dotRadius);
|
||||
tmpDraw->SetColor(m_textColorFg);
|
||||
tmpDraw->SetColorBg(m_textColorFg);
|
||||
tmpDraw->Circle(dotRadius/1.6);
|
||||
AddOObject(tmpDraw);
|
||||
}
|
||||
|
@ -156,8 +156,7 @@ void widget::ColorChooser::OnReceiveMessage(ewol::EObject * CallerObject, const
|
||||
if (NULL != m_widgetAlpha) {
|
||||
m_widgetAlpha->SetValue(m_currentColor.a);
|
||||
}
|
||||
// TODO : send the real color ...
|
||||
GenerateEventId(ewolEventColorChooserChange, "0x51452563");
|
||||
GenerateEventId(ewolEventColorChooserChange, draw::GetString(m_currentColor));
|
||||
} else if (eventColorSpecificHasChange == eventId) {
|
||||
// Slider has changes his color ==> get the one change ...
|
||||
if (CallerObject == m_widgetRed) {
|
||||
@ -175,8 +174,7 @@ void widget::ColorChooser::OnReceiveMessage(ewol::EObject * CallerObject, const
|
||||
if (NULL != m_widgetColorBar) {
|
||||
m_widgetColorBar->SetCurrentColor(m_currentColor);
|
||||
}
|
||||
// TODO : send the real color ...
|
||||
GenerateEventId(ewolEventColorChooserChange, "0x51452563");
|
||||
GenerateEventId(ewolEventColorChooserChange, draw::GetString(m_currentColor));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -38,7 +38,8 @@ static const char * l_basicLabel = "<center>Test software for EWOL</center>";
|
||||
#undef __class__
|
||||
#define __class__ "MainWindows"
|
||||
|
||||
MainWindows::MainWindows(void)
|
||||
MainWindows::MainWindows(void) :
|
||||
m_idWidget(0)
|
||||
{
|
||||
APPL_DEBUG("CREATE WINDOWS ... ");
|
||||
widget::SizerHori* mySizerHori = NULL;
|
||||
|
@ -30,11 +30,6 @@ static const char * l_eventChangeExpendX = "event-change-expend-X";
|
||||
static const char * l_eventChangeExpendY = "event-change-expend-Y";
|
||||
static const char * l_eventChangeFillX = "event-change-fill-X";
|
||||
static const char * l_eventChangeFillY = "event-change-fill-Y";
|
||||
static const char * l_eventChangeToggle = "event-change-toggle-mode";
|
||||
static const char * l_eventChangeText = "event-change-text";
|
||||
static const char * l_eventChangeTextToggle = "event-change-text-toggle";
|
||||
static const char * l_eventChangeImage = "event-change-image";
|
||||
static const char * l_eventChangeImageToggle = "event-change-image-toggle";
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestButton"
|
||||
@ -45,41 +40,6 @@ TestButtonColor::TestButtonColor(void)
|
||||
widget::SizerVert* mySizerVert2 = NULL;
|
||||
widget::SizerHori* mySizerHori = NULL;
|
||||
widget::Button* myButton = NULL;
|
||||
/*
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
myButton = new widget::Button("Expend X <br/> (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Expend X <br/> (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeExpendX);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Expend Y <br/> (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Expend Y <br/> (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeExpendY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Toggle<br/>(false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Toggle<br/><b>(true)</b>");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeToggle);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Text On toggle state<br/>(false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Text On toggle state<br/><b>(true)</b>");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeTextToggle);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
@ -87,6 +47,20 @@ TestButtonColor::TestButtonColor(void)
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
myButton = new widget::Button("Expend X (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Expend X (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeExpendX);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Expend Y (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Expend Y (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeExpendY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Fill X (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
@ -101,26 +75,7 @@ TestButtonColor::TestButtonColor(void)
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeFillY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Image (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Image (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeImage);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Image Toggle (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Image Toggle (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeImageToggle);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Change Text");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeText);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
*/
|
||||
|
||||
int32_t idSpacer=0;
|
||||
m_spacer[idSpacer] = new widget::Spacer();
|
||||
if (NULL != m_spacer[idSpacer]) {
|
||||
@ -154,8 +109,8 @@ TestButtonColor::TestButtonColor(void)
|
||||
|
||||
m_button = new widget::ButtonColor(draw::color::olive);
|
||||
if (NULL != m_button) {
|
||||
m_button->SetExpendX(true);
|
||||
m_button->SetExpendY(true);
|
||||
m_button->SetExpendX(false);
|
||||
m_button->SetExpendY(false);
|
||||
m_button->SetFillX(false);
|
||||
m_button->SetFillY(false);
|
||||
m_button->RegisterOnEvent(this, ewolEventButtonColorChange);
|
||||
@ -202,7 +157,6 @@ void TestButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const char
|
||||
if (m_button == CallerObject) {
|
||||
APPL_WARNING("Receive Event from tested Button ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
}
|
||||
/*
|
||||
if (eventId == l_eventChangeExpendX) {
|
||||
if (NULL!=m_button) {
|
||||
if (data=="1") {
|
||||
@ -235,78 +189,7 @@ void TestButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const char
|
||||
m_button->SetFillY(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeToggle) {
|
||||
if (NULL!=m_button) {
|
||||
if (data=="1") {
|
||||
m_button->SetToggleMode(true);
|
||||
} else {
|
||||
m_button->SetToggleMode(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeTextToggle) {
|
||||
if (NULL!=m_button) {
|
||||
if (data=="1") {
|
||||
m_button->SetLabelToggle("A stupid very long text on toggle <br/><br/> and on multiple lines");
|
||||
} else {
|
||||
m_button->SetLabelToggle("");
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeImage) {
|
||||
if (NULL!=m_button) {
|
||||
if (data=="1") {
|
||||
m_button->SetImage("THEME:GUI:icon.png");
|
||||
m_button->SetImageSize(50);
|
||||
} else {
|
||||
m_button->SetImage("");
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeImageToggle) {
|
||||
if (NULL!=m_button) {
|
||||
if (data=="1") {
|
||||
m_button->SetImageToggle("THEME:GUI:icon.png");
|
||||
} else {
|
||||
m_button->SetImageToggle("");
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeText) {
|
||||
if (NULL!=m_button) {
|
||||
static int32_t countTextID = 1;
|
||||
switch (countTextID%10)
|
||||
{
|
||||
case 0:
|
||||
m_button->SetLabel("simple Text");
|
||||
break;
|
||||
case 1:
|
||||
m_button->SetLabel("<left>Align Left</left>");
|
||||
break;
|
||||
case 2:
|
||||
m_button->SetLabel("<right>Align right</right>");
|
||||
break;
|
||||
case 3:
|
||||
m_button->SetLabel("simple Text<br/> With Some Other Lines<br/> and more if you want ...<br/> plop");
|
||||
break;
|
||||
case 4:
|
||||
m_button->SetLabel("simple <bold>Text</bold> with bold");
|
||||
break;
|
||||
case 5:
|
||||
m_button->SetLabel("simple <italic>Text</italic> with italic");
|
||||
break;
|
||||
case 6:
|
||||
m_button->SetLabel("simple <italic><bold>Text</bold></italic> with italic bold");
|
||||
break;
|
||||
case 7:
|
||||
m_button->SetLabel("");
|
||||
break;
|
||||
case 8:
|
||||
m_button->SetLabel("simple <font color=\"#FFFF0088\">Text</font> with colored text");
|
||||
break;
|
||||
default:
|
||||
m_button->SetLabel("My <font color=\"#FF0000\">Button</font> <br/> And Some under line<br/> plop <br/> and an other super long line ...");
|
||||
break;
|
||||
}
|
||||
countTextID++;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user