diff --git a/external/etk b/external/etk index 6ceb992e..03c1459c 160000 --- a/external/etk +++ b/external/etk @@ -1 +1 @@ -Subproject commit 6ceb992e455f2cd02e7fa3ff071e835cedaf436f +Subproject commit 03c1459c66ee3f4da2c6140612949e99f8d7248c diff --git a/sources/ewol/compositing/Drawing.h b/sources/ewol/compositing/Drawing.h index 8656ffec..d6eda023 100644 --- a/sources/ewol/compositing/Drawing.h +++ b/sources/ewol/compositing/Drawing.h @@ -6,8 +6,8 @@ * @license BSD v3 (see license file) */ -#ifndef __EWOL_DRAWING_H__ -#define __EWOL_DRAWING_H__ +#ifndef __EWOL_COMPOSITING_DRAWING_H__ +#define __EWOL_COMPOSITING_DRAWING_H__ #include diff --git a/sources/ewol/compositing/Image.h b/sources/ewol/compositing/Image.h index f9c685d2..b1f94837 100644 --- a/sources/ewol/compositing/Image.h +++ b/sources/ewol/compositing/Image.h @@ -6,8 +6,8 @@ * @license BSD v3 (see license file) */ -#ifndef __EWOL_IMAGE_H__ -#define __EWOL_IMAGE_H__ +#ifndef __EWOL_COMPOSITING_IMAGE_H__ +#define __EWOL_COMPOSITING_IMAGE_H__ #include #include diff --git a/sources/ewol/compositing/Mesh.h b/sources/ewol/compositing/Mesh.h index f6caa7be..52c4c374 100644 --- a/sources/ewol/compositing/Mesh.h +++ b/sources/ewol/compositing/Mesh.h @@ -6,8 +6,8 @@ * @license BSD v3 (see license file) */ -#ifndef __EWOL_MESH_H__ -#define __EWOL_MESH_H__ +#ifndef __EWOL_COMPOSITING_MESH_H__ +#define __EWOL_COMPOSITING_MESH_H__ #include #include diff --git a/sources/ewol/compositing/Sprite.h b/sources/ewol/compositing/Sprite.h index 207c7e51..fd44191b 100644 --- a/sources/ewol/compositing/Sprite.h +++ b/sources/ewol/compositing/Sprite.h @@ -6,8 +6,8 @@ * @license BSD v3 (see license file) */ -#ifndef __EWOL_SPRITE_H__ -#define __EWOL_SPRITE_H__ +#ifndef __EWOL_COMPOSITING_SPRITE_H__ +#define __EWOL_COMPOSITING_SPRITE_H__ #include #include diff --git a/sources/ewol/compositing/Text.h b/sources/ewol/compositing/Text.h index 38b4fc42..6556a2d8 100644 --- a/sources/ewol/compositing/Text.h +++ b/sources/ewol/compositing/Text.h @@ -6,8 +6,8 @@ * @license BSD v3 (see license file) */ -#ifndef __EWOL_TEXT_H__ -#define __EWOL_TEXT_H__ +#ifndef __EWOL_COMPOSITING_TEXT_H__ +#define __EWOL_COMPOSITING_TEXT_H__ #include @@ -164,6 +164,7 @@ namespace ewol * @brief Enable/Disable the clipping (without lose the current clipping position) * @brief newMode The new status of the clipping */ + // TODO : Rename SetClippingActivity void SetClippingMode(bool newMode); /** * @brief Specify the font size (this reset the internal element of the current text (system requirement) diff --git a/sources/ewol/renderer/audio/audio.cpp b/sources/ewol/renderer/audio/audio.cpp index 7bcc426b..659e5d44 100644 --- a/sources/ewol/renderer/audio/audio.cpp +++ b/sources/ewol/renderer/audio/audio.cpp @@ -7,10 +7,10 @@ */ -#include -#include -#include -#include +#include +#include +#include +#include #include static int64_t currentTimePlaying = 0; @@ -27,7 +27,7 @@ static int32_t effectsVolumeApply = 1<<16; static bool isInit = false; #ifdef __TARGET_OS__Linux -# include +# include #endif void ewol::audio::Init(void) diff --git a/sources/ewol/renderer/audio/audio.h b/sources/ewol/renderer/audio/audio.h index b4d74a37..d995a776 100644 --- a/sources/ewol/renderer/audio/audio.h +++ b/sources/ewol/renderer/audio/audio.h @@ -10,7 +10,7 @@ #ifndef __EWOL_AUDIO_H__ #define __EWOL_AUDIO_H__ -#include +#include #include namespace ewol { diff --git a/sources/ewol/renderer/audio/decWav.cpp b/sources/ewol/renderer/audio/decWav.cpp index ab0587a8..098e0963 100644 --- a/sources/ewol/renderer/audio/decWav.cpp +++ b/sources/ewol/renderer/audio/decWav.cpp @@ -6,11 +6,11 @@ * @license BSD v3 (see license file) */ -#include +#include #include #include -#include -#include +#include +#include typedef struct { diff --git a/sources/ewol/renderer/audio/decWav.h b/sources/ewol/renderer/audio/decWav.h index c9187bb7..220d1a31 100644 --- a/sources/ewol/renderer/audio/decWav.h +++ b/sources/ewol/renderer/audio/decWav.h @@ -9,7 +9,7 @@ #ifndef __EWOL_AUDIO_DEC_WAV_H__ #define __EWOL_AUDIO_DEC_WAV_H__ -#include +#include #include namespace ewol { diff --git a/sources/ewol/renderer/audio/interfacePortAudio.cpp b/sources/ewol/renderer/audio/interfacePortAudio.cpp index 03c082e7..2ce680cc 100644 --- a/sources/ewol/renderer/audio/interfacePortAudio.cpp +++ b/sources/ewol/renderer/audio/interfacePortAudio.cpp @@ -6,9 +6,9 @@ * @license BSD v3 (see license file) */ -#include +#include #include -#include +#include #include #include #include diff --git a/sources/ewol/renderer/audio/interfacePortAudio.h b/sources/ewol/renderer/audio/interfacePortAudio.h index cd0865e2..c8bfe9cc 100644 --- a/sources/ewol/renderer/audio/interfacePortAudio.h +++ b/sources/ewol/renderer/audio/interfacePortAudio.h @@ -9,7 +9,7 @@ #ifndef __EWOL_PORT_AUDIO_H__ #define __EWOL_PORT_AUDIO_H__ -#include +#include namespace ewol { namespace portAudio { diff --git a/sources/ewol/widget/Button.cpp b/sources/ewol/widget/Button.cpp index 9ed0f45c..b2b77be8 100644 --- a/sources/ewol/widget/Button.cpp +++ b/sources/ewol/widget/Button.cpp @@ -8,8 +8,6 @@ #include - -#include #include @@ -19,17 +17,11 @@ extern const char * const ewolEventButtonUp = "ewol-button-up"; extern const char * const ewolEventButtonEnter = "ewol-button-enter"; extern const char * const ewolEventButtonLeave = "ewol-button-leave"; - -void ewol::WIDGET_ButtonInit(void) -{ - -} - #undef __class__ #define __class__ "Button" -void ewol::Button::Init(void) +void widget::Button::Init(void) { m_oObjectImage=NULL; AddEventId(ewolEventButtonPressed); @@ -38,7 +30,7 @@ void ewol::Button::Init(void) AddEventId(ewolEventButtonEnter); AddEventId(ewolEventButtonLeave); m_hasAnImage = false; - m_alignement = ewol::TEXT_ALIGN_CENTER; + m_alignement = widget::TEXT_ALIGN_CENTER; m_status.m_stateOld = 0; m_status.m_stateNew = 0; @@ -78,27 +70,29 @@ void ewol::Button::Init(void) m_GLstatus.m_stateNew = m_GLprogram->GetUniform("EW_status.stateNew"); m_GLstatus.m_transition = m_GLprogram->GetUniform("EW_status.transition"); } + // Limit event at 1: + SetMouseLimit(1); } -ewol::Button::Button(void) +widget::Button::Button(void) { m_label = "No Label"; Init(); } -ewol::Button::Button(etk::UString newLabel) +widget::Button::Button(etk::UString newLabel) { m_label = newLabel; Init(); } -ewol::Button::~Button(void) +widget::Button::~Button(void) { } -void ewol::Button::SetImage(etk::UString imageName) +void widget::Button::SetImage(etk::UString imageName) { if (imageName == "") { m_hasAnImage = false; @@ -109,7 +103,7 @@ void ewol::Button::SetImage(etk::UString imageName) MarkToRedraw(); } -bool ewol::Button::CalculateMinSize(void) +bool widget::Button::CalculateMinSize(void) { etk::Vector2D padding; padding.x = m_config->GetInteger(m_confIdPaddingX); @@ -130,37 +124,37 @@ bool ewol::Button::CalculateMinSize(void) } -void ewol::Button::SetLabel(etk::UString newLabel) +void widget::Button::SetLabel(etk::UString newLabel) { m_label = newLabel; MarkToRedraw(); } -void ewol::Button::SetValue(bool val) +void widget::Button::SetValue(bool val) { } -void ewol::Button::SetAlignement(textAlignement_te typeAlign) +void widget::Button::SetAlignement(textAlignement_te typeAlign) { m_alignement = typeAlign; MarkToRedraw(); } -bool ewol::Button::GetValue(void) +bool widget::Button::GetValue(void) { return false; } -void ewol::Button::SetPoint(float x, float y) +void widget::Button::SetPoint(float x, float y) { etk::Vector2D triangle(x, y); m_coord.PushBack(triangle); } -void ewol::Button::Rectangle(float x, float y, float w, float h) +void widget::Button::Rectangle(float x, float y, float w, float h) { m_coord.Clear(); /* Bitmap position @@ -184,7 +178,7 @@ void ewol::Button::Rectangle(float x, float y, float w, float h) } -void ewol::Button::OnDraw(DrawProperty& displayProp) +void widget::Button::OnDraw(ewol::DrawProperty& displayProp) { if (m_GLprogram==NULL) { EWOL_ERROR("No shader ..."); @@ -219,7 +213,7 @@ void ewol::Button::OnDraw(DrawProperty& displayProp) m_displayText.Draw(); } -void ewol::Button::OnRegenerateDisplay(void) +void widget::Button::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { @@ -243,7 +237,7 @@ void ewol::Button::OnRegenerateDisplay(void) if (true==m_userFill.x) { tmpSizeX = m_size.x; tmpOrigin.x = 0.0; - if (m_alignement == ewol::TEXT_ALIGN_LEFT) { + if (m_alignement == widget::TEXT_ALIGN_LEFT) { tmpTextOrigin.x = padding.x; } } @@ -290,28 +284,26 @@ void ewol::Button::OnRegenerateDisplay(void) } -bool ewol::Button::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::Button::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on BT ..."); - if(ewol::EVENT_INPUT_TYPE_ENTER == typeEvent) { + if(ewol::keyEvent::statusEnter == typeEvent) { ChangeStatusIn(2); - }else if(ewol::EVENT_INPUT_TYPE_LEAVE == typeEvent) { + }else if(ewol::keyEvent::statusLeave == typeEvent) { ChangeStatusIn(0); } if (1 == IdInput) { - if(ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) { + if(ewol::keyEvent::statusDown == typeEvent) { GenerateEventId(ewolEventButtonDown); ChangeStatusIn(1); MarkToRedraw(); } - if(ewol::EVENT_INPUT_TYPE_UP == typeEvent) { + if(ewol::keyEvent::statusUp == typeEvent) { GenerateEventId(ewolEventButtonUp); ChangeStatusIn(0); MarkToRedraw(); } - if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent - || ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent - || ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) { + if(ewol::keyEvent::statusSingle == typeEvent) { GenerateEventId(ewolEventButtonPressed); MarkToRedraw(); return true; @@ -321,10 +313,10 @@ bool ewol::Button::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventI } -bool ewol::Button::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData) +bool widget::Button::OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData) { //EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data)); - if( typeEvent == ewol::EVENT_KB_TYPE_DOWN + if( typeEvent == ewol::keyEvent::statusDown && unicodeData == '\r') { GenerateEventId(ewolEventButtonEnter); } @@ -333,7 +325,7 @@ bool ewol::Button::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeDa -void ewol::Button::ChangeStatusIn(int32_t newStatusId) +void widget::Button::ChangeStatusIn(int32_t newStatusId) { m_nextStatusRequested = newStatusId; PeriodicCallSet(true); @@ -341,7 +333,7 @@ void ewol::Button::ChangeStatusIn(int32_t newStatusId) } -void ewol::Button::PeriodicCall(int64_t localTime) +void widget::Button::PeriodicCall(int64_t localTime) { // start : if (m_time == -1) { diff --git a/sources/ewol/widget/Button.h b/sources/ewol/widget/Button.h index f8900ac8..4ddb7413 100644 --- a/sources/ewol/widget/Button.h +++ b/sources/ewol/widget/Button.h @@ -12,9 +12,9 @@ #include #include -#include #include #include +#include extern const char * const ewolEventButtonPressed; extern const char * const ewolEventButtonDown; @@ -58,7 +58,7 @@ namespace ewol { -namespace ewol { +namespace widget { typedef enum { TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, @@ -67,7 +67,7 @@ namespace ewol { { private: // External theme config: - ewol::SimpleConfigFile* m_config; + ewol::ConfigFile* m_config; int32_t m_confIdPaddingX; int32_t m_confIdPaddingY; int32_t m_confIdChangeTime; @@ -86,13 +86,13 @@ namespace ewol { void SetPoint(float x, float y); void Rectangle(float x, float y, float w, float h); private: - ewol::Text m_displayText; - ewol::OObject2DTextured* m_oObjectImage; - bool m_hasAnImage; - etk::UString m_imageSelected; - textAlignement_te m_alignement; - etk::UString m_label; - draw::Color m_textColorFg; //!< Text color + ewol::Text m_displayText; + ewol::Image* m_oObjectImage; + bool m_hasAnImage; + etk::UString m_imageSelected; + textAlignement_te m_alignement; + etk::UString m_label; + draw::Color m_textColorFg; //!< Text color public: Button(void); Button(etk::UString newLabel); @@ -115,7 +115,7 @@ namespace ewol { void SetColorFg(draw::Color newColor) { m_textColorFg = newColor; }; public: virtual void OnRegenerateDisplay(void); - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); /** * @brief Event on an input of this Widget * @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...) @@ -125,8 +125,8 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); - virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); + virtual bool OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData); private: int32_t m_nextStatusRequested; void ChangeStatusIn(int32_t newStatusId); @@ -138,15 +138,6 @@ namespace ewol { */ virtual void PeriodicCall(int64_t localTime); }; - - /** - * @brief Initilise the basic widget property ==> due to the android system - * @note all widget that have template might have this initializer ... - * @param --- - * @return --- - */ - void WIDGET_ButtonInit(void); - }; #endif diff --git a/sources/ewol/widget/ButtonColor.cpp b/sources/ewol/widget/ButtonColor.cpp index c6bdb86a..ba7d79af 100644 --- a/sources/ewol/widget/ButtonColor.cpp +++ b/sources/ewol/widget/ButtonColor.cpp @@ -9,7 +9,7 @@ #include -#include +#include #include #include #include @@ -18,20 +18,15 @@ extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Change"; -void ewol::WIDGET_ButtonColorInit(void) -{ - -} - #undef __class__ #define __class__ "ButtonColor" -void ewol::ButtonColor::Init(void) +void widget::ButtonColor::Init(void) { AddEventId(ewolEventButtonColorChange); - m_alignement = ewol::TEXT_ALIGN_CENTER; + m_alignement = widget::TEXT_ALIGN_CENTER; #ifdef __TARGET_OS__Android m_padding.y = 12; @@ -46,35 +41,37 @@ void ewol::ButtonColor::Init(void) m_textColorBg.a = 0x3F; m_widgetContextMenu = NULL; SetCanHaveFocus(true); + // Limit event at 1: + SetMouseLimit(1); } -ewol::ButtonColor::ButtonColor(void) +widget::ButtonColor::ButtonColor(void) { m_label = "No Label"; Init(); } -ewol::ButtonColor::ButtonColor(etk::UString newLabel) +widget::ButtonColor::ButtonColor(etk::UString newLabel) { m_label = newLabel; Init(); } -ewol::ButtonColor::~ButtonColor(void) +widget::ButtonColor::~ButtonColor(void) { } -void ewol::ButtonColor::SetPadding(etk::Vector2D newPadding) +void widget::ButtonColor::SetPadding(etk::Vector2D newPadding) { m_padding = newPadding; } -bool ewol::ButtonColor::CalculateMinSize(void) +bool widget::ButtonColor::CalculateMinSize(void) { - etk::Vector2D minSize = m_oObjectText.GetSize(m_label); + etk::Vector3D minSize = m_oObjectText.CalculateSize(m_label); m_minSize.x = m_padding.x*2 + minSize.x; m_minSize.y = m_padding.y*2 + minSize.y; MarkToRedraw(); @@ -82,37 +79,37 @@ bool ewol::ButtonColor::CalculateMinSize(void) } -void ewol::ButtonColor::SetLabel(etk::UString newLabel) +void widget::ButtonColor::SetLabel(etk::UString newLabel) { m_label = newLabel; MarkToRedraw(); } -void ewol::ButtonColor::SetValue(bool val) +void widget::ButtonColor::SetValue(bool val) { } -void ewol::ButtonColor::SetAlignement(textAlignement_te typeAlign) +void widget::ButtonColor::SetAlignement(textAlignement_te typeAlign) { m_alignement = typeAlign; MarkToRedraw(); } -bool ewol::ButtonColor::GetValue(void) +bool widget::ButtonColor::GetValue(void) { return false; } -void ewol::ButtonColor::OnDraw(DrawProperty& displayProp) +void widget::ButtonColor::OnDraw(ewol::DrawProperty& displayProp) { m_oObjectDecoration.Draw(); m_oObjectText.Draw(); } -void ewol::ButtonColor::OnRegenerateDisplay(void) +void widget::ButtonColor::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { m_oObjectDecoration.Clear(); @@ -128,7 +125,7 @@ void ewol::ButtonColor::OnRegenerateDisplay(void) if (true==m_userFill.x) { tmpSizeX = m_size.x; tmpOriginX = 0; - if (m_alignement == ewol::TEXT_ALIGN_LEFT) { + if (m_alignement == widget::TEXT_ALIGN_LEFT) { tmpTextOriginX = m_padding.x; } } @@ -146,39 +143,35 @@ void ewol::ButtonColor::OnRegenerateDisplay(void) } else { m_textColorFg = draw::color::white; } - etk::Vector2D textPos; + etk::Vector3D textPos; textPos.x = tmpTextOriginX; textPos.y = tmpTextOriginY; - clipping_ts drawClipping; - drawClipping.x = m_padding.x; - drawClipping.y = m_padding.y; - drawClipping.w = m_size.x - 2*m_padding.x; - drawClipping.h = m_size.y - 2*m_padding.y; - m_oObjectText.Text(textPos/*, drawClipping*/, m_label); + textPos.z = 0; + m_oObjectText.SetPos(textPos); + m_oObjectText.Print(m_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.Rectangle( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY); + m_oObjectDecoration.SetPos(etk::Vector3D(tmpOriginX, tmpOriginY, 0) ); + m_oObjectDecoration.RectangleWidth(etk::Vector3D(tmpSizeX, tmpSizeY, 0) ); } } -bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::ButtonColor::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { - if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent - || ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent - || ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) { + if( ewol::keyEvent::statusSingle == typeEvent) { // nothing to do ... //GenerateEventId(ewolEventButtonPressed); // Display the pop-up menu ... // create a context menu : - m_widgetContextMenu = new ewol::ContextMenu(); + m_widgetContextMenu = new widget::ContextMenu(); if (NULL == m_widgetContextMenu) { EWOL_ERROR("Allocation Error"); return true; @@ -188,14 +181,14 @@ bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, e newPosition.x = m_origin.x + m_size.x/2; newPosition.y = m_origin.y; - m_widgetContextMenu->SetPositionMark(ewol::CONTEXT_MENU_MARK_BOTTOM, newPosition ); + m_widgetContextMenu->SetPositionMark(widget::CONTEXT_MENU_MARK_BOTTOM, newPosition ); ewol::ColorChooser * myColorChooser = new ewol::ColorChooser(); myColorChooser->SetColor(m_textColorBg); // set it in the pop-up-system : m_widgetContextMenu->SubWidgetSet(myColorChooser); myColorChooser->RegisterOnEvent(this, ewolEventColorChooserChange, ewolEventColorChooserChange); - ewol::PopUpWidgetPush(m_widgetContextMenu); + ewol::WindowsPopUpAdd(m_widgetContextMenu); MarkToRedraw(); return true; @@ -205,7 +198,7 @@ bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, e } -void ewol::ButtonColor::SetCurrentColor(draw::Color color) +void widget::ButtonColor::SetCurrentColor(draw::Color color) { m_selectedColor = color; m_textColorBg = m_selectedColor; @@ -216,7 +209,7 @@ void ewol::ButtonColor::SetCurrentColor(draw::Color color) } -void ewol::ButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) +void widget::ButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) { if (eventId == ewolEventColorChooserChange) { // TODO : Parse the input color ... diff --git a/sources/ewol/widget/ButtonColor.h b/sources/ewol/widget/ButtonColor.h index 6caddaaa..3b6b355d 100644 --- a/sources/ewol/widget/ButtonColor.h +++ b/sources/ewol/widget/ButtonColor.h @@ -13,12 +13,13 @@ #include #include #include -#include +#include +#include #include extern const char * const ewolEventButtonColorChange; -namespace ewol { +namespace widget { class ButtonColor : public ewol::Widget { public: @@ -41,18 +42,18 @@ namespace ewol { void SetAlignement(textAlignement_te typeAlign); void SetPadding(etk::Vector2D newPadding); private: - ewol::OObject2DTextColored m_oObjectText; - ewol::OObject2DColored m_oObjectDecoration; + ewol::Text m_oObjectText; + ewol::Drawing m_oObjectDecoration; textAlignement_te m_alignement; - etk::Vector2D m_padding; + etk::Vector2D m_padding; etk::UString m_label; draw::Color m_textColorFg; //!< Text color draw::Color m_textColorBg; //!< Background color draw::Color m_selectedColor; //!< user current selected Color - ewol::ContextMenu* m_widgetContextMenu; + widget::ContextMenu* m_widgetContextMenu; public: virtual void OnRegenerateDisplay(void); - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); public: /** * @brief Event on an input of this Widget @@ -63,7 +64,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); draw::Color GetCurrentColor(void) { return m_selectedColor; }; void SetCurrentColor(draw::Color color); /** @@ -75,15 +76,6 @@ namespace ewol { */ virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data); }; - - /** - * @brief Initilise the basic widget property ==> due to the android system - * @note all widget that have template might have this initializer ... - * @param --- - * @return --- - */ - void WIDGET_ButtonColorInit(void); - }; #endif diff --git a/sources/ewol/widget/ButtonImage.cpp b/sources/ewol/widget/ButtonImage.cpp deleted file mode 100644 index 48b70474..00000000 --- a/sources/ewol/widget/ButtonImage.cpp +++ /dev/null @@ -1,293 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - - -#include - -#include -#include - -void ewol::WIDGET_ButtonImageInit(void) -{ - -} - -#undef __class__ -#define __class__ "ButtonImage" - -ewol::ButtonImage::ButtonImage(etk::UString imageName, draw::Color col) -{ - AddEventId(ewolEventButtonPressed); - AddEventId(ewolEventButtonDown); - AddEventId(ewolEventButtonUp); - AddEventId(ewolEventButtonEnter); - AddEventId(ewolEventButtonLeave); - SetMinSize(10,10); - SetCanHaveFocus(true); - m_over = false; - m_down = false; - m_value = false; - m_image = imageName; - m_color = col; - m_OOImage = NULL; - m_OOImageBg1 = NULL; - m_OOImageBG2 = NULL; - m_resetNeeded = false; - m_toggleMode = false; -} - - -ewol::ButtonImage::~ButtonImage(void) -{ - -} - -void ewol::ButtonImage::SetImage(etk::UString imageName, draw::Color col) -{ - m_image = imageName; - m_color = col; - m_resetNeeded = true; - MarkToRedraw(); -} - -void ewol::ButtonImage::SetImageBG(etk::UString imageName, draw::Color col) -{ - m_imageBg1 = imageName; - m_colorBg1 = col; - m_resetNeeded = true; - MarkToRedraw(); -} - -void ewol::ButtonImage::SetImageSelected(etk::UString imageName, draw::Color col) -{ - m_imageBg2 = imageName; - m_colorBg2 = col; - m_resetNeeded = true; - MarkToRedraw(); -} - - -void ewol::ButtonImage::SetValue(bool val) -{ - if (true == m_toggleMode) { - m_value = val; - MarkToRedraw(); - } -} - -bool ewol::ButtonImage::GetValue(void) -{ - return m_value; -} - -void ewol::ButtonImage::SetToggleMode(bool val) -{ - m_toggleMode = val; - if (m_toggleMode == false) { - m_value = false; - } - MarkToRedraw(); -} - -bool ewol::ButtonImage::GetToggleMode(void) -{ - return m_toggleMode; -} - - -void ewol::ButtonImage::OnRegenerateDisplay(void) -{ - if (true == NeedRedraw()) { - - 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; - - if (true==m_userFill.x) { - tmpSizeX = m_size.x; - tmpOriginX = 0; - } - if (true==m_userFill.y) { - tmpSizeY = m_size.y; - tmpOriginY = 0; - } - - if (NULL == m_OOImageBG2) { - if(m_imageBg2 != "") { - m_OOImageBG2 = new ewol::OObject2DTextured(m_imageBg2, tmpSizeX, tmpSizeY); - } - } - if (NULL == m_OOImageBg1) { - if(m_imageBg1 != "") { - m_OOImageBg1 = new ewol::OObject2DTextured(m_imageBg1, tmpSizeX, tmpSizeY); - } - } - if (NULL == m_OOImage) { - if(m_image != "") { - m_OOImage = new ewol::OObject2DTextured(m_image, tmpSizeX, tmpSizeY); - } - } - if (false == m_toggleMode) { - float tmpval = 0.0; - if (NULL != m_OOImageBG2) { - m_OOImageBG2->Clear(); - if( m_down == true - || m_over == true ) { - m_OOImageBG2->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY); - } - tmpval = tmpSizeX * 0.2; - tmpSizeX -= tmpval; - tmpOriginX += tmpval/2; - tmpval = tmpSizeY * 0.2; - tmpSizeY -= tmpval; - tmpOriginY += tmpval/2; - } - if (NULL != m_OOImageBg1) { - m_OOImageBg1->Clear(); - m_OOImageBg1->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY); - tmpval = tmpSizeX * 0.2; - tmpSizeX -= tmpval; - tmpOriginX += tmpval/2; - tmpval = tmpSizeY * 0.2; - tmpSizeY -= tmpval; - tmpOriginY += tmpval/2; - } - if (NULL != m_OOImage) { - m_OOImage->Clear(); - m_OOImage->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY); - } - } else { - if (NULL != m_OOImage) { - m_OOImage->Clear(); - } - if (NULL != m_OOImageBG2) { - m_OOImageBG2->Clear(); - } - if(m_value == true) { - if (NULL != m_OOImage) { - m_OOImage->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_color); - } - } else { - if (NULL != m_OOImageBG2) { - m_OOImageBG2->Rectangle(tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_colorBg2); - } - } - } - } -} - - -bool ewol::ButtonImage::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) -{ - //EWOL_DEBUG("Event on BT ..."); - if (1 == IdInput) { - if(ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) { - m_down = true; - if (false == m_toggleMode) { - m_value = true; - } - - GenerateEventId(ewolEventButtonDown, (m_value)?"true":"false"); - MarkToRedraw(); - } - if(ewol::EVENT_INPUT_TYPE_UP == typeEvent) { - m_down = false; - if (false == m_toggleMode) { - m_value = false; - } - GenerateEventId(ewolEventButtonUp, (m_value)?"true":"false"); - MarkToRedraw(); - } - if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent - || ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent - || ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) { - if (true == m_toggleMode) { - m_value = (true==m_value) ? false : true; - } - GenerateEventId(ewolEventButtonPressed, (m_value)?"true":"false"); - MarkToRedraw(); - return true; - } - } else if (0 == IdInput) { - if( ewol::EVENT_INPUT_TYPE_ENTER == typeEvent - || ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { - etk::Vector2D relPos = RelativePosition(pos); - - // check if over : - 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; - - if (true==m_userFill.x) { - tmpSizeX = m_size.x; - tmpOriginX = 0; - } - if (true==m_userFill.y) { - tmpSizeY = m_size.y; - tmpOriginY = 0; - } - if( relPos.x > tmpOriginX - && relPos.x < tmpOriginX+tmpSizeX - && relPos.y > tmpOriginY - && relPos.y < tmpOriginY+tmpSizeY ) { - if (m_over != true) { - m_over = true; - MarkToRedraw(); - } - } - } else if(ewol::EVENT_INPUT_TYPE_LEAVE == typeEvent) { - if(m_over != false) { - m_over = false; - MarkToRedraw(); - } - } - } - return false; -} - - -bool ewol::ButtonImage::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData) -{ - //EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data)); - if (unicodeData == '\r') { - if(typeEvent == ewol::EVENT_KB_TYPE_DOWN) { - m_down = true; - if (false == m_toggleMode) { - m_value = true; - GenerateEventId(ewolEventButtonEnter, (m_value)?"true":"false"); - } - } else if(typeEvent == ewol::EVENT_KB_TYPE_UP) { - m_down = false; - if (false == m_toggleMode) { - m_value = false; - GenerateEventId(ewolEventButtonEnter, (m_value)?"true":"false"); - } else { - m_value = (true==m_value) ? false : true; - GenerateEventId(ewolEventButtonEnter, (m_value)?"true":"false"); - } - } - } - return false; -} - - -void ewol::ButtonImage::OnDraw(DrawProperty& displayProp) -{ - if (NULL != m_OOImageBG2) { - m_OOImageBG2->Draw(); - } - if (NULL != m_OOImageBg1) { - m_OOImageBg1->Draw(); - } - if (NULL != m_OOImage) { - m_OOImage->Draw(); - } -} - diff --git a/sources/ewol/widget/ButtonImage.h b/sources/ewol/widget/ButtonImage.h deleted file mode 100644 index a581a916..00000000 --- a/sources/ewol/widget/ButtonImage.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - * @author Edouard DUPIN - * - * @copyright 2011, Edouard DUPIN, all right reserved - * - * @license BSD v3 (see license file) - */ - - -#ifndef __EWOL_BUTTON_IMAGE_H__ -#define __EWOL_BUTTON_IMAGE_H__ - -#include -#include -#include -#include - -namespace ewol { - class ButtonImage :public ewol::Widget - { - public: - ButtonImage(etk::UString image, draw::Color col=0xFFFFFFFF); - /** - * @brief Get the current Object type of the EObject - * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it - * @param[in] objectType type description - * @return true if the object is compatible, otherwise false - */ - virtual const char * const GetObjectType(void) { return "EwolButtonImage"; }; - void Init(void); - virtual ~ButtonImage(void); - void SetImage(etk::UString imageName, draw::Color col=0xFFFFFFFF); - void SetImageBG(etk::UString imageName, draw::Color col=0xFFFFFFFF); - void SetImageSelected(etk::UString imageName, draw::Color col=0xFFFFFFFF); - void SetValue(bool val); - bool GetValue(void); - void SetToggleMode(bool val); - bool GetToggleMode(void); - private: - etk::UString m_image; - bool m_resetNeeded; - ewol::OObject2DTextured* m_OOImage; - draw::Color m_color; - - etk::UString m_imageBg1; - ewol::OObject2DTextured* m_OOImageBg1; - draw::Color m_colorBg1; - - etk::UString m_imageBg2; - ewol::OObject2DTextured* m_OOImageBG2; - draw::Color m_colorBg2; - - bool m_over; - bool m_down; - bool m_value; - bool m_toggleMode; - public: - virtual void OnRegenerateDisplay(void); - public: - /** - * @brief Event on an input of this Widget - * @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...) - * @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger)) - * @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/... - * @param[in] pos Absolute position of the event - * @return true the event is used - * @return false the event is not used - */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); - virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData); - virtual void OnDraw(DrawProperty& displayProp); - }; - - /** - * @brief Initilise the basic widget property ==> due to the android system - * @note all widget that have template might have this initializer ... - * @param --- - * @return --- - */ - void WIDGET_ButtonImageInit(void); - -}; - -#endif diff --git a/sources/ewol/widget/CheckBox.cpp b/sources/ewol/widget/CheckBox.cpp index 80613c8b..e13fc2df 100644 --- a/sources/ewol/widget/CheckBox.cpp +++ b/sources/ewol/widget/CheckBox.cpp @@ -7,8 +7,6 @@ */ #include - -#include #include @@ -18,7 +16,7 @@ extern const char * const ewolEventCheckBoxClicked = "ewol CheckBox Clicked"; #define __class__ "CheckBox" -void ewol::CheckBox::Init(void) +void widget::CheckBox::Init(void) { AddEventId(ewolEventCheckBoxClicked); m_textColorFg = draw::color::black; @@ -28,28 +26,28 @@ void ewol::CheckBox::Init(void) SetMouseLimit(1); } -ewol::CheckBox::CheckBox(void) +widget::CheckBox::CheckBox(void) { m_label = "No Label"; Init(); } -ewol::CheckBox::CheckBox(etk::UString newLabel) +widget::CheckBox::CheckBox(etk::UString newLabel) { m_label = newLabel; Init(); } -ewol::CheckBox::~CheckBox(void) +widget::CheckBox::~CheckBox(void) { } -bool ewol::CheckBox::CalculateMinSize(void) +bool widget::CheckBox::CalculateMinSize(void) { - etk::Vector2D minSize = m_oObjectText.GetSize(m_label); + etk::Vector3D minSize = m_oObjectText.CalculateSize(m_label); float boxSize = etk_max(20, minSize.y) + 5; m_minSize.x = boxSize+minSize.x; m_minSize.y = etk_max(boxSize, minSize.y)+3; @@ -58,13 +56,13 @@ bool ewol::CheckBox::CalculateMinSize(void) } -void ewol::CheckBox::SetLabel(etk::UString newLabel) +void widget::CheckBox::SetLabel(etk::UString newLabel) { m_label = newLabel; MarkToRedraw(); } -void ewol::CheckBox::SetValue(bool val) +void widget::CheckBox::SetValue(bool val) { if (m_value == val) { return; @@ -73,62 +71,55 @@ void ewol::CheckBox::SetValue(bool val) MarkToRedraw(); } -bool ewol::CheckBox::GetValue(void) +bool widget::CheckBox::GetValue(void) { return m_value; } -void ewol::CheckBox::OnDraw(DrawProperty& displayProp) +void widget::CheckBox::OnDraw(ewol::DrawProperty& displayProp) { m_oObjectDecoration.Draw(); m_oObjectText.Draw(); } -void ewol::CheckBox::OnRegenerateDisplay(void) +void widget::CheckBox::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { m_oObjectDecoration.Clear(); m_oObjectText.Clear(); - int32_t borderWidth = 2; - - etk::Vector2D minSize = m_oObjectText.GetSize(m_label); + etk::Vector3D minSize = m_oObjectText.CalculateSize(m_label); float boxSize = etk_max(20, minSize.y) + 5; //int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str()); int32_t posy = (m_size.y - minSize.y - 6)/2 + 3; //int32_t posx = (m_size.x - fontWidth - 6)/2 + 25; - etk::Vector2D textPos; + etk::Vector3D textPos; textPos.x = boxSize+5; textPos.y = posy; - clipping_ts drawClipping; - drawClipping.x = 0; - drawClipping.y = 0; - // note : pb on the clipping properties ... - drawClipping.w = m_size.x;// - (boxSize+5); - drawClipping.h = m_size.y; - m_oObjectText.Text(textPos/*, drawClipping*/, m_label); - - + textPos.z = 0; + m_oObjectText.SetPos(textPos); + m_oObjectText.Print(m_label); m_oObjectDecoration.SetColor(m_textColorBg); - m_oObjectDecoration.Rectangle( 2.5, 2.5, boxSize, boxSize); - m_oObjectDecoration.SetColor(m_textColorFg); - m_oObjectDecoration.RectangleBorder( 2.5, 2.5, boxSize, boxSize, borderWidth); + m_oObjectDecoration.SetPos(etk::Vector3D(2.5f, 2.5f, 0.0f) ); + m_oObjectDecoration.RectangleWidth(etk::Vector3D(boxSize, boxSize, 0.0f) ); if (m_value) { - m_oObjectDecoration.Line( 2.5, 2.5, boxSize+2.5, boxSize+2.5, borderWidth); - m_oObjectDecoration.Line( 2.5, boxSize+2.5, boxSize+2.5, 2.5, borderWidth); + m_oObjectDecoration.SetColor(m_textColorFg); + m_oObjectDecoration.SetPos(etk::Vector3D(2.5f, 2.5f, 0.0f) ); + m_oObjectDecoration.SetThickness(3); + m_oObjectDecoration.LineRel(etk::Vector3D(boxSize, boxSize, 0.0f) ); } } } -bool ewol::CheckBox::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::CheckBox::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on checkbox ..."); if (1 == IdInput) { - if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) { + if (ewol::keyEvent::statusSingle == typeEvent) { if(true == m_value) { m_value = false; GenerateEventId(ewolEventCheckBoxClicked, "false"); @@ -145,10 +136,10 @@ bool ewol::CheckBox::OnEventInput(ewol::inputType_te type, int32_t IdInput, even } -bool ewol::CheckBox::OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData) +bool widget::CheckBox::OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData) { //EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data)); - if( typeEvent == ewol::EVENT_KB_TYPE_DOWN + if( typeEvent == ewol::keyEvent::statusDown && ( unicodeData == '\r' || unicodeData == ' ') ) { diff --git a/sources/ewol/widget/CheckBox.h b/sources/ewol/widget/CheckBox.h index 44fa8c31..e5c93f39 100644 --- a/sources/ewol/widget/CheckBox.h +++ b/sources/ewol/widget/CheckBox.h @@ -11,12 +11,13 @@ #include #include -#include +#include +#include #include extern const char* const ewolEventCheckBoxClicked; -namespace ewol { +namespace widget { class CheckBox : public ewol::Widget { public: @@ -36,15 +37,15 @@ namespace ewol { void SetValue(bool val); bool GetValue(void); private: - ewol::OObject2DTextColored m_oObjectText; - ewol::OObject2DColored m_oObjectDecoration; + ewol::Text m_oObjectText; + ewol::Drawing m_oObjectDecoration; etk::UString m_label; bool m_value; - draw::Color m_textColorFg; //!< Text color - draw::Color m_textColorBg; //!< Background color + draw::Color m_textColorFg; //!< Text color + draw::Color m_textColorBg; //!< Background color public: virtual void OnRegenerateDisplay(void); - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); public: /** * @brief Event on an input of this Widget @@ -55,8 +56,8 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); - virtual bool OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); + virtual bool OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData); }; }; diff --git a/sources/ewol/widget/ColorBar.cpp b/sources/ewol/widget/ColorBar.cpp index 0f27cec5..bf5dfd5f 100644 --- a/sources/ewol/widget/ColorBar.cpp +++ b/sources/ewol/widget/ColorBar.cpp @@ -8,7 +8,7 @@ #include -#include +#include #include #include @@ -20,7 +20,7 @@ extern const char * const ewolEventColorBarChange = "ewol-color-bar-change"; #undef __class__ #define __class__ "ColorBar" -ewol::ColorBar::ColorBar(void) +widget::ColorBar::ColorBar(void) { AddEventId(ewolEventColorBarChange); @@ -35,15 +35,16 @@ ewol::ColorBar::ColorBar(void) m_currentUserPos.y=0; m_currentColor = draw::color::black; SetCanHaveFocus(true); + SetMouseLimit(1); } -ewol::ColorBar::~ColorBar(void) +widget::ColorBar::~ColorBar(void) { } -bool ewol::ColorBar::CalculateMinSize(void) +bool widget::ColorBar::CalculateMinSize(void) { m_minSize.x = 80; m_minSize.y = 80; @@ -63,11 +64,11 @@ static draw::Color s_listColor[NB_BAND_COLOR+1] = { 0xFF0000FF }; -draw::Color ewol::ColorBar::GetCurrentColor(void) +draw::Color widget::ColorBar::GetCurrentColor(void) { return m_currentColor; } -void ewol::ColorBar::SetCurrentColor(draw::Color newOne) +void widget::ColorBar::SetCurrentColor(draw::Color newOne) { m_currentColor = newOne; m_currentColor.a = 0xFF; @@ -75,7 +76,7 @@ void ewol::ColorBar::SetCurrentColor(draw::Color newOne) // TODO : Later when really needed ... } -void ewol::ColorBar::OnRegenerateDisplay(void) +void widget::ColorBar::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { // clean the object list ... @@ -99,7 +100,7 @@ void ewol::ColorBar::OnRegenerateDisplay(void) tmpSizeX -= 2*m_padding.x; tmpSizeY -= 2*m_padding.y; - ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored; + ewol::Drawing * tmpOObjects = new ewol::Drawing; tmpOriginX -= m_padding.x/2; tmpOriginY -= m_padding.y/2; @@ -107,7 +108,8 @@ void ewol::ColorBar::OnRegenerateDisplay(void) tmpSizeY += m_padding.y; for(int32_t iii=0; iiiSetColor(s_listColorBlack); tmpOObjects->SetPoint(tmpOriginX + (iii+0.5)*(tmpSizeX/NB_BAND_COLOR), tmpOriginY+tmpSizeY); */ + #endif } draw::Color tmpColor; if (m_currentUserPos.y > 0.5) { @@ -184,24 +187,23 @@ void ewol::ColorBar::OnRegenerateDisplay(void) tmpColor = draw::color::black; } tmpOObjects->SetColor(tmpColor); - tmpOObjects->Circle(m_currentUserPos.x*m_size.x, m_currentUserPos.y*m_size.y, 3.0, 1.0); + // TODO : ... + //tmpOObjects->Circle(m_currentUserPos.x*m_size.x, m_currentUserPos.y*m_size.y, 3.0, 1.0); AddOObject(tmpOObjects); } } -bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::ColorBar::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { etk::Vector2D relativePos = RelativePosition(pos); //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { relativePos.x = etk_max(etk_min(relativePos.x, m_size.x),0); relativePos.y = etk_max(etk_min(relativePos.y, m_size.y),0); - if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent - || ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent - || ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent - || ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { + if( ewol::keyEvent::statusSingle == typeEvent + || ewol::keyEvent::statusMove == typeEvent) { // nothing to do ... m_currentUserPos.x=relativePos.x/m_size.x; m_currentUserPos.y=relativePos.y/m_size.y; diff --git a/sources/ewol/widget/ColorBar.h b/sources/ewol/widget/ColorBar.h index c77aa60d..91763dd7 100644 --- a/sources/ewol/widget/ColorBar.h +++ b/sources/ewol/widget/ColorBar.h @@ -11,12 +11,13 @@ #include #include +#include #include extern const char * const ewolEventColorBarChange; -namespace ewol { - class ColorBar :public ewol::Drawable +namespace widget { + class ColorBar :public widget::Drawable { public: ColorBar(void); @@ -28,9 +29,9 @@ namespace ewol { * @return true if the object is compatible, otherwise false */ virtual const char * const GetObjectType(void) { return "EwolColorBar"; }; - virtual bool CalculateMinSize(void); + virtual bool CalculateMinSize(void); draw::Color GetCurrentColor(void); - void SetCurrentColor(draw::Color newOne); + void SetCurrentColor(draw::Color newOne); private: draw::Color m_currentColor; etk::Vector2D m_currentUserPos; @@ -47,7 +48,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); }; }; diff --git a/sources/ewol/widget/ContextMenu.cpp b/sources/ewol/widget/ContextMenu.cpp index cb5abf04..5d2680b6 100644 --- a/sources/ewol/widget/ContextMenu.cpp +++ b/sources/ewol/widget/ContextMenu.cpp @@ -9,11 +9,12 @@ #include #include #include +#include #undef __class__ #define __class__ "ContextMenu" -ewol::ContextMenu::ContextMenu(void) +widget::ContextMenu::ContextMenu(void) { m_userExpend.x = true; m_userExpend.y = true; @@ -29,16 +30,17 @@ ewol::ContextMenu::ContextMenu(void) m_arrowPos.x = 0; m_arrowPos.y = 0; - m_arrawBorder = ewol::CONTEXT_MENU_MARK_TOP; + m_arrawBorder = widget::CONTEXT_MENU_MARK_TOP; + SetMouseLimit(1); } -ewol::ContextMenu::~ContextMenu(void) +widget::ContextMenu::~ContextMenu(void) { SubWidgetRemove(); } -bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY) +bool widget::ContextMenu::CalculateSize(float availlableX, float availlableY) { EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")"); // pop-up fill all the display : @@ -64,16 +66,16 @@ bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY) // set config to the Sub-widget switch (m_arrawBorder) { - case ewol::CONTEXT_MENU_MARK_TOP: + case widget::CONTEXT_MENU_MARK_TOP: subWidgetOrigin.x = (int32_t)(m_arrowPos.x - subWidgetSize.x/2); subWidgetOrigin.y = (int32_t)(m_arrowPos.y - m_offset - subWidgetSize.y); break; - case ewol::CONTEXT_MENU_MARK_BOTTOM: + case widget::CONTEXT_MENU_MARK_BOTTOM: subWidgetOrigin.x = (int32_t)(m_arrowPos.x - subWidgetSize.x/2); subWidgetOrigin.y = (int32_t)(m_arrowPos.y + m_offset); break; - case ewol::CONTEXT_MENU_MARK_RIGHT: - case ewol::CONTEXT_MENU_MARK_LEFT: + case widget::CONTEXT_MENU_MARK_RIGHT: + case widget::CONTEXT_MENU_MARK_LEFT: default: subWidgetOrigin.x = (int32_t)(m_size.x - m_origin.x - subWidgetSize.x)/2 + m_origin.x; subWidgetOrigin.y = (int32_t)(m_size.y - m_origin.y - subWidgetSize.y)/2 + m_origin.y; @@ -92,14 +94,14 @@ bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY) switch (m_arrawBorder) { default: - case ewol::CONTEXT_MENU_MARK_TOP: - case ewol::CONTEXT_MENU_MARK_BOTTOM: + case widget::CONTEXT_MENU_MARK_TOP: + case widget::CONTEXT_MENU_MARK_BOTTOM: if (m_arrowPos.x <= m_offset ) { subWidgetOrigin.x = m_arrowPos.x+m_padding.x; } break; - case ewol::CONTEXT_MENU_MARK_RIGHT: - case ewol::CONTEXT_MENU_MARK_LEFT: + case widget::CONTEXT_MENU_MARK_RIGHT: + case widget::CONTEXT_MENU_MARK_LEFT: if (m_arrowPos.y <= m_offset ) { subWidgetOrigin.y = m_arrowPos.y+m_padding.y; } @@ -113,7 +115,7 @@ bool ewol::ContextMenu::CalculateSize(float availlableX, float availlableY) } -bool ewol::ContextMenu::CalculateMinSize(void) +bool widget::ContextMenu::CalculateMinSize(void) { EWOL_DEBUG("CalculateMinSize"); m_userExpend.x=false; @@ -131,23 +133,23 @@ bool ewol::ContextMenu::CalculateMinSize(void) return true; } -void ewol::ContextMenu::SetMinSise(float x, float y) +void widget::ContextMenu::SetMinSise(float x, float y) { EWOL_ERROR("Pop-up can not have a user Minimum size (herited from under elements)"); } -void ewol::ContextMenu::SetExpendX(bool newExpend) +void widget::ContextMenu::SetExpendX(bool newExpend) { EWOL_ERROR("Pop-up can not have a user expend settings X (herited from under elements)"); } -void ewol::ContextMenu::SetExpendY(bool newExpend) +void widget::ContextMenu::SetExpendY(bool newExpend) { EWOL_ERROR("Pop-up can not have a user expend settings Y (herited from under elements)"); } -void ewol::ContextMenu::SubWidgetSet(ewol::Widget* newWidget) +void widget::ContextMenu::SubWidgetSet(ewol::Widget* newWidget) { if (NULL == newWidget) { return; @@ -156,7 +158,7 @@ void ewol::ContextMenu::SubWidgetSet(ewol::Widget* newWidget) } -void ewol::ContextMenu::SubWidgetRemove(void) +void widget::ContextMenu::SubWidgetRemove(void) { if (NULL != m_subWidget) { delete(m_subWidget); @@ -164,23 +166,23 @@ void ewol::ContextMenu::SubWidgetRemove(void) } } -void ewol::ContextMenu::OnDraw(DrawProperty& displayProp) +void widget::ContextMenu::OnDraw(ewol::DrawProperty& displayProp) { //EWOL_DEBUG("On Draw " << m_currentDrawId); - ewol::Drawable::OnDraw(displayProp); + widget::Drawable::OnDraw(displayProp); if (NULL != m_subWidget) { m_subWidget->GenDraw(displayProp); } } -void ewol::ContextMenu::OnRegenerateDisplay(void) +void widget::ContextMenu::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { } // generate a white background and take gray on other surfaces ClearOObjectList(); - ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); + ewol::Drawing * BGOObjects = new ewol::Drawing(); AddOObject(BGOObjects); if (NULL != m_subWidget) { @@ -191,41 +193,52 @@ void ewol::ContextMenu::OnRegenerateDisplay(void) BGOObjects->SetColor(m_colorBorder); switch (m_arrawBorder) { - case ewol::CONTEXT_MENU_MARK_TOP: - BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y); + case widget::CONTEXT_MENU_MARK_TOP: + BGOObjects->SetPos(etk::Vector3D(m_arrowPos.x, m_arrowPos.y, 0.0f) ); + BGOObjects->AddVertex(); if (m_arrowPos.x <= tmpOrigin.x ) { - int32_t laking = m_offset - m_padding.y; - BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y-laking); - BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y-laking); + float laking = m_offset - m_padding.y; + BGOObjects->SetPos(etk::Vector3D(m_arrowPos.x+laking, m_arrowPos.y-laking, 0.0f) ); + BGOObjects->AddVertex(); + BGOObjects->SetPos(etk::Vector3D(m_arrowPos.x, m_arrowPos.y-laking, 0.0f) ); + BGOObjects->AddVertex(); } else { - int32_t laking = m_offset - m_padding.y; - BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y-laking); - BGOObjects->SetPoint(m_arrowPos.x-laking, m_arrowPos.y-laking); + float laking = m_offset - m_padding.y; + BGOObjects->SetPos(etk::Vector3D(m_arrowPos.x+laking, m_arrowPos.y-laking, 0.0f) ); + BGOObjects->AddVertex(); + BGOObjects->SetPos(etk::Vector3D(m_arrowPos.x-laking, m_arrowPos.y-laking, 0.0f) ); + BGOObjects->AddVertex(); } break; - case ewol::CONTEXT_MENU_MARK_BOTTOM: - BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y); + case widget::CONTEXT_MENU_MARK_BOTTOM: + BGOObjects->SetPos(etk::Vector3D(m_arrowPos.x, m_arrowPos.y, 0.0f) ); + BGOObjects->AddVertex(); if (m_arrowPos.x <= tmpOrigin.x ) { int32_t laking = m_offset - m_padding.y; - BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y+laking); - BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y+laking); + BGOObjects->SetPos(etk::Vector3D(m_arrowPos.x+laking, m_arrowPos.y+laking, 0.0f) ); + BGOObjects->AddVertex(); + BGOObjects->SetPos(etk::Vector3D(m_arrowPos.x, m_arrowPos.y+laking, 0.0f) ); + BGOObjects->AddVertex(); } else { int32_t laking = m_offset - m_padding.y; - BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y+laking); - BGOObjects->SetPoint(m_arrowPos.x-laking, m_arrowPos.y+laking); + BGOObjects->SetPos(etk::Vector3D(m_arrowPos.x+laking, m_arrowPos.y+laking, 0.0f) ); + BGOObjects->AddVertex(); + BGOObjects->SetPos(etk::Vector3D(m_arrowPos.x-laking, m_arrowPos.y+laking, 0.0f) ); + BGOObjects->AddVertex(); } break; default: - case ewol::CONTEXT_MENU_MARK_RIGHT: - case ewol::CONTEXT_MENU_MARK_LEFT: + case widget::CONTEXT_MENU_MARK_RIGHT: + case widget::CONTEXT_MENU_MARK_LEFT: EWOL_TODO("later"); break; } - - BGOObjects->Rectangle(tmpOrigin.x-m_padding.x, tmpOrigin.y - m_padding.y, tmpSize.x + m_padding.x*2, tmpSize.y + m_padding.y*2); + BGOObjects->SetPos(etk::Vector3D(tmpOrigin.x-m_padding.x, tmpOrigin.y - m_padding.y, 0.0f) ); + BGOObjects->RectangleWidth(etk::Vector3D(tmpSize.x + m_padding.x*2, tmpSize.y + m_padding.y*2, 0.0f) ); // set the area in white ... BGOObjects->SetColor(m_colorBackGroung); - BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y); + BGOObjects->SetPos(etk::Vector3D(tmpOrigin.x, tmpOrigin.y, 0.0f) ); + BGOObjects->RectangleWidth(etk::Vector3D(tmpSize.x, tmpSize.y, 0.0f) ); } if (NULL != m_subWidget) { m_subWidget->OnRegenerateDisplay(); @@ -233,7 +246,7 @@ void ewol::ContextMenu::OnRegenerateDisplay(void) } -ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(etk::Vector2D pos) +ewol::Widget * widget::ContextMenu::GetWidgetAtPos(etk::Vector2D pos) { // calculate relative position etk::Vector2D relativePos = RelativePosition(pos); @@ -251,18 +264,16 @@ ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(etk::Vector2D pos) } -bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::ContextMenu::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { //EWOL_INFO("Event ouside the context menu"); if (IdInput > 0) { - if( typeEvent == ewol::EVENT_INPUT_TYPE_DOWN - || typeEvent == ewol::EVENT_INPUT_TYPE_MOVE - || typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE - || typeEvent == ewol::EVENT_INPUT_TYPE_DOUBLE - || typeEvent == ewol::EVENT_INPUT_TYPE_TRIPLE - || typeEvent == ewol::EVENT_INPUT_TYPE_UP - || typeEvent == ewol::EVENT_INPUT_TYPE_ENTER - || typeEvent == ewol::EVENT_INPUT_TYPE_LEAVE ) { + if( typeEvent == ewol::keyEvent::statusDown + || typeEvent == ewol::keyEvent::statusMove + || typeEvent == ewol::keyEvent::statusSingle + || typeEvent == ewol::keyEvent::statusUp + || typeEvent == ewol::keyEvent::statusEnter + || typeEvent == ewol::keyEvent::statusLeave ) { // Auto-remove ... AutoDestroy(); return true; @@ -272,7 +283,7 @@ bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, e } -void ewol::ContextMenu::SetPositionMark(markPosition_te position, etk::Vector2D arrowPos) +void widget::ContextMenu::SetPositionMark(markPosition_te position, etk::Vector2D arrowPos) { EWOL_DEBUG("set context menu at the position : (" << arrowPos.x << "," << arrowPos.y << ")"); m_arrawBorder = position; diff --git a/sources/ewol/widget/ContextMenu.h b/sources/ewol/widget/ContextMenu.h index 18e6281b..7cc7b942 100644 --- a/sources/ewol/widget/ContextMenu.h +++ b/sources/ewol/widget/ContextMenu.h @@ -10,11 +10,12 @@ #define __EWOL_CONTEXT_MENU_H__ #include +#include #include #include #include -namespace ewol { +namespace widget { typedef enum { CONTEXT_MENU_MARK_TOP, CONTEXT_MENU_MARK_RIGHT, @@ -22,7 +23,7 @@ namespace ewol { CONTEXT_MENU_MARK_LEFT, CONTEXT_MENU_MARK_NONE }markPosition_te; - class ContextMenu : public ewol::Drawable + class ContextMenu : public widget::Drawable { public: ContextMenu(void); @@ -53,7 +54,7 @@ namespace ewol { void SubWidgetRemove(void); void SetPositionMark(markPosition_te position, etk::Vector2D arrowPos); protected: - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); public: virtual void OnRegenerateDisplay(void); public: @@ -73,7 +74,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); }; }; diff --git a/sources/ewol/widget/Drawable.cpp b/sources/ewol/widget/Drawable.cpp index c9141b1a..77343074 100644 --- a/sources/ewol/widget/Drawable.cpp +++ b/sources/ewol/widget/Drawable.cpp @@ -9,12 +9,12 @@ #include -ewol::Drawable::Drawable(void) +widget::Drawable::Drawable(void) { // nothing to do ... } -ewol::Drawable::~Drawable(void) +widget::Drawable::~Drawable(void) { //clean all the object for (int32_t iii=0; iii +#include -namespace ewol { +namespace widget { class Drawable : public ewol::Widget { public: @@ -28,12 +29,12 @@ namespace ewol { virtual const char * const GetObjectType(void) { return "EwolDrawable"; }; private: - etk::Vector m_listOObject; //!< generic element to display... + etk::Vector m_listOObject; //!< generic element to display... public: - void AddOObject(ewol::OObject* newObject, int32_t pos=-1); + void AddOObject(ewol::Compositing* newObject, int32_t pos=-1); void ClearOObjectList(void); protected: - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); }; }; diff --git a/sources/ewol/widget/Entry.cpp b/sources/ewol/widget/Entry.cpp index fe53ddd1..24ec2dca 100644 --- a/sources/ewol/widget/Entry.cpp +++ b/sources/ewol/widget/Entry.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include @@ -28,7 +27,7 @@ const char * const ewolEventEntrySelect = "ewol-Entry-Select"; #define __class__ "Entry" -void ewol::Entry::Init(void) +void widget::Entry::Init(void) { AddEventId(ewolEventEntryClick); AddEventId(ewolEventEntryEnter); @@ -65,7 +64,7 @@ void ewol::Entry::Init(void) } } -ewol::Entry::Entry(void) +widget::Entry::Entry(void) { Init(); m_data = ""; @@ -73,7 +72,7 @@ ewol::Entry::Entry(void) MarkToRedraw(); } -ewol::Entry::Entry(etk::UString newData) +widget::Entry::Entry(etk::UString newData) { Init(); SetValue(newData); @@ -82,15 +81,15 @@ ewol::Entry::Entry(etk::UString newData) } -ewol::Entry::~Entry(void) +widget::Entry::~Entry(void) { } -bool ewol::Entry::CalculateMinSize(void) +bool widget::Entry::CalculateMinSize(void) { - int32_t minHeight = m_oObjectText.GetHeight(); + int32_t minHeight = m_oObjectText.CalculateSize('A').y; m_minSize.x = m_userSize; m_minSize.y = minHeight + 2*(m_borderSize + 2*m_paddingSize); UpdateTextPosition(); @@ -99,7 +98,7 @@ bool ewol::Entry::CalculateMinSize(void) } -void ewol::Entry::SetValue(etk::UString newData) +void widget::Entry::SetValue(etk::UString newData) { m_data = newData; m_displayCursorPos = m_data.Size(); @@ -108,20 +107,20 @@ void ewol::Entry::SetValue(etk::UString newData) MarkToRedraw(); } -etk::UString ewol::Entry::GetValue(void) +etk::UString widget::Entry::GetValue(void) { return m_data; } -void ewol::Entry::SetPoint(float x, float y) +void widget::Entry::SetPoint(float x, float y) { etk::Vector2D triangle(x, y); m_coord.PushBack(triangle); } -void ewol::Entry::Rectangle(float x, float y, float w, float h) +void widget::Entry::Rectangle(float x, float y, float w, float h) { m_coord.Clear(); /* Bitmap position @@ -145,7 +144,7 @@ void ewol::Entry::Rectangle(float x, float y, float w, float h) } -void ewol::Entry::OnDraw(DrawProperty& displayProp) +void widget::Entry::OnDraw(ewol::DrawProperty& displayProp) { if (m_GLprogram==NULL) { EWOL_ERROR("No shader ..."); @@ -172,7 +171,7 @@ void ewol::Entry::OnDraw(DrawProperty& displayProp) } -void ewol::Entry::OnRegenerateDisplay(void) +void widget::Entry::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { m_oObjectDecoration.Clear(); @@ -201,23 +200,28 @@ void ewol::Entry::OnRegenerateDisplay(void) tmpSizeY -= 2*m_paddingSize; - etk::Vector2D textPos; - textPos.x = tmpTextOriginX + m_displayStartPosition; - textPos.y = tmpTextOriginY; - clipping_ts drawClipping; - drawClipping.x = 2*m_paddingSize + m_borderSize; - drawClipping.y = 2*m_paddingSize + m_borderSize; - drawClipping.w = m_size.x - 2*drawClipping.x; - drawClipping.h = m_size.y - 2*drawClipping.y; - m_oObjectText.clippingSet(drawClipping); - m_oObjectText.Text(textPos, m_data); - m_oObjectText.clippingDisable(); - + etk::Vector3D textPos( tmpTextOriginX + m_displayStartPosition, + tmpTextOriginY, + 0 ); + etk::Vector3D drawClippingPos( 2*m_paddingSize + m_borderSize, + 2*m_paddingSize + m_borderSize, + -1 ); + etk::Vector3D drawClippingSize( m_size.x - 2*drawClippingPos.x, + m_size.y - 2*drawClippingPos.y, + 1 ); + m_oObjectText.SetClipping(drawClippingPos, drawClippingSize); + m_oObjectText.SetPos(textPos); + m_oObjectText.Print(m_data); + m_oObjectText.SetClippingMode(false); + /* m_pos[0] = m_borderSize+2*drawClipping.x; m_pos[1] = m_borderSize+2*drawClipping.y; m_pos[2] = m_size.x - 2*(m_borderSize+2*drawClipping.x); m_pos[3] = m_size.y - 2*(m_borderSize+2*drawClipping.y); Rectangle(0, 0, m_size.x, m_size.y); + */ + /* + Must be rework corectly ==> selection and Cursor are integrated at the system ... int32_t pos1 = m_displayCursorPosSelection; int32_t pos2 = m_displayCursorPos; if(m_displayCursorPosSelection>m_displayCursorPos) { @@ -249,23 +253,24 @@ void ewol::Entry::OnRegenerateDisplay(void) m_oObjectDecoration.Line(XCursorPos, tmpTextOriginY, XCursorPos, tmpTextOriginY + minSize.y, 1); } } + */ } } -void ewol::Entry::UpdateCursorPosition(etk::Vector2D& pos, bool selection) +void widget::Entry::UpdateCursorPosition(etk::Vector2D& pos, bool selection) { etk::Vector2D relPos = RelativePosition(pos); relPos.x += -m_displayStartPosition - 2*m_paddingSize - m_borderSize; // try to find the new cursor position : etk::UString tmpDisplay = m_data.Extract(0, m_displayStartPosition); - int32_t displayHidenSize = m_oObjectText.GetSize(tmpDisplay).x; + int32_t displayHidenSize = m_oObjectText.CalculateSize(tmpDisplay).x; //EWOL_DEBUG("hidenSize : " << displayHidenSize); int32_t newCursorPosition = -1; int32_t tmpTextOriginX = m_borderSize + 2*m_paddingSize; for (int32_t iii=0; iii=relPos.x-tmpTextOriginX) { newCursorPosition = iii; break; @@ -289,7 +294,7 @@ void ewol::Entry::UpdateCursorPosition(etk::Vector2D& pos, bool selection } -void ewol::Entry::RemoveSelected(void) +void widget::Entry::RemoveSelected(void) { if (m_displayCursorPosSelection==m_displayCursorPos) { // nothing to cut ... @@ -309,7 +314,7 @@ void ewol::Entry::RemoveSelected(void) } -void ewol::Entry::CopySelectionToClipBoard(ewol::clipBoard::clipboardListe_te clipboardID) +void widget::Entry::CopySelectionToClipBoard(ewol::clipBoard::clipboardListe_te clipboardID) { if (m_displayCursorPosSelection==m_displayCursorPos) { // nothing to cut ... @@ -327,16 +332,16 @@ void ewol::Entry::CopySelectionToClipBoard(ewol::clipBoard::clipboardListe_te cl } -bool ewol::Entry::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::Entry::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on Entry ... type=" << (int32_t)type << " id=" << IdInput); if (1 == IdInput) { - if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) { + if (ewol::keyEvent::statusSingle == typeEvent) { KeepFocus(); GenerateEventId(ewolEventEntryClick); //nothing to do ... return true; - } else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) { + } else if (ewol::keyEvent::statusDouble == typeEvent) { KeepFocus(); // select word m_displayCursorPosSelection = m_displayCursorPos-1; @@ -379,51 +384,51 @@ bool ewol::Entry::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventIn } } // Copy to clipboard Middle ... - CopySelectionToClipBoard(ewol::clipBoard::CLIPBOARD_SELECTION); + CopySelectionToClipBoard(ewol::clipBoard::clipboardSelection); MarkToRedraw(); - } else if (ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) { + } else if (ewol::keyEvent::statusTriple == typeEvent) { KeepFocus(); m_displayCursorPosSelection = 0; m_displayCursorPos = m_data.Size(); - } else if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) { + } else if (ewol::keyEvent::statusDown == typeEvent) { KeepFocus(); UpdateCursorPosition(pos); MarkToRedraw(); - } else if (ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { + } else if (ewol::keyEvent::statusMove == typeEvent) { KeepFocus(); UpdateCursorPosition(pos, true); MarkToRedraw(); - } else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) { + } else if (ewol::keyEvent::statusUp == typeEvent) { KeepFocus(); UpdateCursorPosition(pos, true); // Copy to clipboard Middle ... - CopySelectionToClipBoard(ewol::clipBoard::CLIPBOARD_SELECTION); + CopySelectionToClipBoard(ewol::clipBoard::clipboardSelection); MarkToRedraw(); } } - else if( ewol::INPUT_TYPE_MOUSE == type + else if( ewol::keyEvent::typeMouse == type && 2 == IdInput) { - if( typeEvent == ewol::EVENT_INPUT_TYPE_DOWN - || typeEvent == ewol::EVENT_INPUT_TYPE_MOVE - || typeEvent == ewol::EVENT_INPUT_TYPE_UP) { + if( typeEvent == ewol::keyEvent::statusDown + || typeEvent == ewol::keyEvent::statusMove + || typeEvent == ewol::keyEvent::statusUp) { KeepFocus(); // updatethe cursor position : UpdateCursorPosition(pos); } // Paste current selection only when up button - if (typeEvent == ewol::EVENT_INPUT_TYPE_UP) { + if (typeEvent == ewol::keyEvent::statusUp) { KeepFocus(); // middle button => past data... - ewol::clipBoard::Request(ewol::clipBoard::CLIPBOARD_SELECTION); + ewol::clipBoard::Request(ewol::clipBoard::clipboardSelection); } } return false; } -bool ewol::Entry::OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData) +bool widget::Entry::OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData) { - if( typeEvent == ewol::EVENT_KB_TYPE_DOWN) { + if( typeEvent == ewol::keyEvent::statusDown) { //EWOL_DEBUG("Entry input data ... : \"" << unicodeData << "\" " ); //return GenEventInputExternal(ewolEventEntryEnter, -1, -1); // remove curent selected data ... @@ -460,21 +465,21 @@ bool ewol::Entry::OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData) } -bool ewol::Entry::OnEventKbMove(eventKbType_te typeEvent, eventKbMoveType_te moveTypeEvent) +bool widget::Entry::OnEventKbMove(ewol::keyEvent::status_te typeEvent, ewol::keyEvent::keyboard_te moveTypeEvent) { - if(typeEvent == ewol::EVENT_KB_TYPE_DOWN) { + if(typeEvent == ewol::keyEvent::statusDown) { switch (moveTypeEvent) { - case EVENT_KB_MOVE_TYPE_LEFT: + case ewol::keyEvent::keyboardLeft: m_displayCursorPos--; break; - case EVENT_KB_MOVE_TYPE_RIGHT: + case ewol::keyEvent::keyboardRight: m_displayCursorPos++; break; - case EVENT_KB_MOVE_TYPE_START: + case ewol::keyEvent::keyboardStart: m_displayCursorPos = 0; break; - case EVENT_KB_MOVE_TYPE_END: + case ewol::keyEvent::keyboardEnd: m_displayCursorPos = m_data.Size(); break; default: @@ -489,7 +494,7 @@ bool ewol::Entry::OnEventKbMove(eventKbType_te typeEvent, eventKbMoveType_te mov } -void ewol::Entry::OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID) +void widget::Entry::OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardID) { // remove curent selected data ... RemoveSelected(); @@ -510,7 +515,7 @@ void ewol::Entry::OnEventClipboard(ewol::clipBoard::clipboardListe_te clipboardI } -void ewol::Entry::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) +void widget::Entry::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) { ewol::Widget::OnReceiveMessage(CallerObject, eventId, data); if(eventId == ewolEventEntryClean) { @@ -520,13 +525,13 @@ void ewol::Entry::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev m_displayCursorPosSelection = m_displayCursorPos; MarkToRedraw(); } else if(eventId == ewolEventEntryCut) { - CopySelectionToClipBoard(ewol::clipBoard::CLIPBOARD_STD); + CopySelectionToClipBoard(ewol::clipBoard::clipboardStd); RemoveSelected(); GenerateEventId(ewolEventEntryModify, m_data); } else if(eventId == ewolEventEntryCopy) { - CopySelectionToClipBoard(ewol::clipBoard::CLIPBOARD_STD); + CopySelectionToClipBoard(ewol::clipBoard::clipboardStd); } else if(eventId == ewolEventEntryPaste) { - ewol::clipBoard::Request(ewol::clipBoard::CLIPBOARD_STD); + ewol::clipBoard::Request(ewol::clipBoard::clipboardStd); } else if(eventId == ewolEventEntrySelect) { if(data == "ALL") { m_displayCursorPosSelection = 0; @@ -539,14 +544,14 @@ void ewol::Entry::OnReceiveMessage(ewol::EObject * CallerObject, const char * ev } -void ewol::Entry::UpdateTextPosition(void) +void widget::Entry::UpdateTextPosition(void) { int32_t tmpSizeX = m_minSize.x; if (true==m_userFill.x) { tmpSizeX = m_size.x; } int32_t tmpUserSize = tmpSizeX - 2*(m_borderSize + 2*m_paddingSize); - int32_t totalWidth = m_oObjectText.GetSize(m_data).x; + int32_t totalWidth = m_oObjectText.CalculateSize(m_data).x; // Check if the data inside the display can be contain in the entry box if (totalWidth < tmpUserSize) { // all can be display : @@ -554,7 +559,7 @@ void ewol::Entry::UpdateTextPosition(void) } else { // all can not be set : etk::UString tmpDisplay = m_data.Extract(0, m_displayCursorPos); - int32_t pixelCursorPos = m_oObjectText.GetSize(tmpDisplay).x; + int32_t pixelCursorPos = m_oObjectText.CalculateSize(tmpDisplay).x; // check if the Cussor is visible at 10px nearest the border : int32_t tmp1 = pixelCursorPos+m_displayStartPosition; EWOL_DEBUG("cursorPos=" << pixelCursorPos << "px maxSize=" << tmpUserSize << "px tmp1=" << tmp1); @@ -571,17 +576,17 @@ void ewol::Entry::UpdateTextPosition(void) } -void ewol::Entry::OnGetFocus(void) +void widget::Entry::OnGetFocus(void) { m_displayCursor = true; - ewol::KeyboardShow(); + ewol::Keyboard(true); MarkToRedraw(); } -void ewol::Entry::OnLostFocus(void) +void widget::Entry::OnLostFocus(void) { m_displayCursor = false; - ewol::KeyboardHide(); + ewol::Keyboard(false); MarkToRedraw(); } diff --git a/sources/ewol/widget/Entry.h b/sources/ewol/widget/Entry.h index 44922296..de0747fa 100644 --- a/sources/ewol/widget/Entry.h +++ b/sources/ewol/widget/Entry.h @@ -11,7 +11,8 @@ #include #include -#include +#include +#include #include #include @@ -19,7 +20,7 @@ extern const char * const ewolEventEntryClick; extern const char * const ewolEventEntryEnter; extern const char * const ewolEventEntryModify; // return in the data the new string inside it ... -namespace ewol { +namespace widget { /** * @brief Entry box display : * @@ -46,8 +47,8 @@ namespace ewol { void SetPoint(float x, float y); void Rectangle(float x, float y, float w, float h); private: - ewol::OObject2DTextColored m_oObjectText; //!< text display - ewol::OObject2DColored m_oObjectDecoration; //!< background display + ewol::Text m_oObjectText; //!< text display + ewol::Drawing m_oObjectDecoration; //!< background display etk::UString m_data; //!< sting that must be displayed draw::Color m_textColorFg; //!< Text color draw::Color m_textColorBg; //!< Background color @@ -103,7 +104,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); /** * @brief Event on the keybord (if no shortcut has been detected before). * @param[in] type of the event (ewol::EVENT_KB_TYPE_DOWN or ewol::EVENT_KB_TYPE_UP) @@ -111,13 +112,13 @@ namespace ewol { * @return true if the event has been used * @return false if the event has not been used */ - virtual bool OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData); + virtual bool OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData); /** * @brief Event on the keyboard that is not a printable key (if no shortcut has been detected before). * @return true if the event has been used * @return false if the event has not been used */ - virtual bool OnEventKbMove(eventKbType_te typeEvent, eventKbMoveType_te moveTypeEvent); + virtual bool OnEventKbMove(ewol::keyEvent::status_te typeEvent, ewol::keyEvent::keyboard_te moveTypeEvent); /** * @brief Receive a message from an other EObject with a specific eventId and data * @param[in] CallerObject Pointer on the EObject that information came from @@ -139,7 +140,7 @@ namespace ewol { * @param[in] displayProp properties of the current display * @return --- */ - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); /** * @brief Change the cursor position with the curent position requested on the display * @param[in] pos Absolute position of the event diff --git a/sources/ewol/widget/Image.cpp b/sources/ewol/widget/Image.cpp index db3ac67c..85c54b5e 100644 --- a/sources/ewol/widget/Image.cpp +++ b/sources/ewol/widget/Image.cpp @@ -7,23 +7,18 @@ */ #include -#include +#include +#include #include extern const char * const ewolEventImagePressed = "ewol-image-Pressed"; - -void ewol::WIDGET_ImageInit(void) -{ - -} - #undef __class__ #define __class__ "Image" -void ewol::Image::Init(void) +void widget::Image::Init(void) { AddEventId(ewolEventImagePressed); @@ -38,10 +33,12 @@ void ewol::Image::Init(void) m_textColorBg = draw::color::black; m_textColorBg.a = 0x00; m_imageSize = 32; + // Limit event at 1: + SetMouseLimit(1); } -ewol::Image::Image(etk::UString dataFile, int32_t size) +widget::Image::Image(etk::UString dataFile, int32_t size) { m_imageSelected = dataFile; Init(); @@ -51,18 +48,18 @@ ewol::Image::Image(etk::UString dataFile, int32_t size) } -ewol::Image::~Image(void) +widget::Image::~Image(void) { } -void ewol::Image::SetPadding(etk::Vector2D newPadding) +void widget::Image::SetPadding(etk::Vector2D newPadding) { m_padding = newPadding; } -bool ewol::Image::CalculateMinSize(void) +bool widget::Image::CalculateMinSize(void) { m_minSize.x = m_padding.x*2 + m_imageSize; m_minSize.y = m_padding.y*2 + m_imageSize; @@ -71,14 +68,14 @@ bool ewol::Image::CalculateMinSize(void) } -void ewol::Image::SetFile(etk::UString newFile) +void widget::Image::SetFile(etk::UString newFile) { m_imageSelected = newFile; MarkToRedraw(); } -void ewol::Image::OnRegenerateDisplay(void) +void widget::Image::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { // clean the object list ... @@ -103,17 +100,19 @@ void ewol::Image::OnRegenerateDisplay(void) tmpSizeY -= 2*m_padding.y; - ewol::OObject2DTextured * tmpImage = NULL; - tmpImage = new ewol::OObject2DTextured(m_imageSelected, m_imageSize, m_imageSize); - tmpImage->Rectangle(tmpOriginX, tmpOriginY, m_imageSize, m_imageSize); + ewol::Image * tmpImage = NULL; + tmpImage = new ewol::Image(m_imageSelected); // TODO : Check if it was possible later : , m_imageSize, m_imageSize); + tmpImage->SetPos(etk::Vector3D(tmpOriginX, tmpOriginY, 0) ); + tmpImage->Print(etk::Vector2D(m_imageSize, m_imageSize)); - ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored; - tmpOObjects->SetColor(m_textColorBg); - tmpOObjects->Rectangle( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY); + ewol::Drawing * tmpDraw = new ewol::Drawing(); + tmpDraw->SetColor(m_textColorBg); + tmpDraw->SetPos(etk::Vector3D(tmpOriginX, tmpOriginY, 0) ); + tmpDraw->RectangleWidth(etk::Vector3D(tmpSizeX, tmpSizeY, 0) ); // add all needed objects ... - if (NULL != tmpOObjects) { - AddOObject(tmpOObjects); + if (NULL != tmpDraw) { + AddOObject(tmpDraw); } if (NULL != tmpImage) { AddOObject(tmpImage); @@ -121,13 +120,11 @@ void ewol::Image::OnRegenerateDisplay(void) } } -bool ewol::Image::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::Image::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { - if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent - || ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent - || ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) { + if( ewol::keyEvent::statusSingle == typeEvent) { GenerateEventId(ewolEventImagePressed); return true; } diff --git a/sources/ewol/widget/Image.h b/sources/ewol/widget/Image.h index 2f3e0317..55bbc078 100644 --- a/sources/ewol/widget/Image.h +++ b/sources/ewol/widget/Image.h @@ -11,12 +11,13 @@ #include #include +#include #include extern const char * const ewolEventImagePressed; -namespace ewol { - class Image :public ewol::Drawable +namespace widget { + class Image :public widget::Drawable { public: Image(etk::UString dataFile, int32_t size=-1); // automatic considering in the appl Data older @@ -49,17 +50,9 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); }; - - /** - * @brief Initilise the basic widget property ==> due to the android system - * @note all widget that have template might have this initializer ... - * @param --- - * @return --- - */ - void WIDGET_ImageInit(void); - }; + #endif diff --git a/sources/ewol/widget/Joystick.cpp b/sources/ewol/widget/Joystick.cpp index 6d5bfc80..435b235a 100644 --- a/sources/ewol/widget/Joystick.cpp +++ b/sources/ewol/widget/Joystick.cpp @@ -9,7 +9,7 @@ #include #include -#include +#include #include extern const char * const ewolEventJoystickEnable = "ewol-joystick-enable"; @@ -21,50 +21,18 @@ static etk::UString l_background(""); static etk::UString l_foreground(""); static float l_ratio(1.0/7.0); -void ewol::WIDGET_JoystickInit(void) -{ - l_displayBackground = true; - l_background = ""; - l_foreground = ""; - l_ratio = 1.0/7.0; -} - -void ewol::WIDGET_JoystickDefaultRatio(float newRatio) -{ - if (newRatio > 1) { - newRatio = 1; - } - l_ratio = newRatio; - EWOL_INFO("Set default Joystick ratio at " << l_ratio); -} - -void ewol::WIDGET_JoystickDefaultBackground(etk::UString imageNameInData, bool display) -{ - // TODO : check if it existed - l_background = imageNameInData; - l_displayBackground = display; - EWOL_INFO("Set default Joystick background at " << l_background << " Display it=" << l_displayBackground); -} - -void ewol::WIDGET_JoystickDefaultForeground(etk::UString imageNameInData) -{ - // TODO : check if it existed - l_foreground = imageNameInData; - EWOL_INFO("Set default Joystick Foreground at " << l_foreground); -} - #undef __class__ #define __class__ "Joystick" -ewol::Joystick::Joystick(void) +widget::Joystick::Joystick(void) { AddEventId(ewolEventJoystickEnable); AddEventId(ewolEventJoystickDisable); AddEventId(ewolEventJoystickMove); // by default the joy does not lock when free out m_lock = false; - m_displayMode = ewol::JOYSTICK_NORMAL_MODE; + m_displayMode = widget::JOYSTICK_NORMAL_MODE; m_colorFg = draw::color::blue; @@ -85,13 +53,13 @@ ewol::Joystick::Joystick(void) } -ewol::Joystick::~Joystick(void) +widget::Joystick::~Joystick(void) { } -bool ewol::Joystick::CalculateSize(float availlableX, float availlableY) +bool widget::Joystick::CalculateSize(float availlableX, float availlableY) { float minimumSize = etk_min(availlableX, availlableY); m_size.x = minimumSize; @@ -100,12 +68,12 @@ bool ewol::Joystick::CalculateSize(float availlableX, float availlableY) return true; } -void ewol::Joystick::OnRegenerateDisplay(void) +void widget::Joystick::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { // clean the object list ... ClearOObjectList(); - + /* ewol::OObject2DColored * tmpOObjects = NULL; ewol::OObject2DTextured * tmpOOtexBg = NULL; ewol::OObject2DTextured * tmpOOtexFg = NULL; @@ -144,6 +112,7 @@ void ewol::Joystick::OnRegenerateDisplay(void) if (NULL != tmpOOtexFg) { AddOObject(tmpOOtexFg); } + */ } } @@ -152,11 +121,11 @@ Sine Function: sin(teta) = Opposite / Hypotenuse Cosine Function: cos(teta) = Adjacent / Hypotenuse Tangent Function: tan(teta) = Opposite / Adjacent */ -bool ewol::Joystick::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::Joystick::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { if (1 == IdInput) { - if( ewol::EVENT_INPUT_TYPE_DOWN == typeEvent - || ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { + if( ewol::keyEvent::statusDown == typeEvent + || ewol::keyEvent::statusMove == typeEvent) { // get local relative position etk::Vector2D relativePos = RelativePosition(pos); float sizeElement = m_size.x*m_ratio; @@ -181,7 +150,7 @@ bool ewol::Joystick::OnEventInput(ewol::inputType_te type, int32_t IdInput, even m_displayPos.y = sin(m_angle)*m_distance; } MarkToRedraw(); - if(ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) { + if(ewol::keyEvent::statusDown == typeEvent) { GenerateEventId(ewolEventJoystickEnable); } else { etk::UString tmp = etk::UString("distance=") + etk::UString(m_distance) + etk::UString("angle=") + etk::UString(m_angle+M_PI/2); @@ -190,7 +159,7 @@ bool ewol::Joystick::OnEventInput(ewol::inputType_te type, int32_t IdInput, even //teta += M_PI/2; //EWOL_DEBUG("TETA = " << (m_angle*180/M_PI) << " deg distance = " << m_distance); return true; - } else if( ewol::EVENT_INPUT_TYPE_UP == typeEvent) { + } else if( ewol::keyEvent::statusUp == typeEvent) { if( true == m_lock && m_distance == 1) { // nothing to do ... @@ -210,7 +179,7 @@ bool ewol::Joystick::OnEventInput(ewol::inputType_te type, int32_t IdInput, even } -void ewol::Joystick::Ratio(float newRatio) +void widget::Joystick::Ratio(float newRatio) { if (newRatio > 1) { newRatio = 1; @@ -220,7 +189,7 @@ void ewol::Joystick::Ratio(float newRatio) } -void ewol::Joystick::Background(etk::UString imageNameInData, bool display) +void widget::Joystick::Background(etk::UString imageNameInData, bool display) { // TODO : check if it existed m_background = imageNameInData; @@ -229,7 +198,7 @@ void ewol::Joystick::Background(etk::UString imageNameInData, bool display) } -void ewol::Joystick::Foreground(etk::UString imageNameInData) +void widget::Joystick::Foreground(etk::UString imageNameInData) { // TODO : check if it existed m_foreground = imageNameInData; @@ -237,7 +206,7 @@ void ewol::Joystick::Foreground(etk::UString imageNameInData) } -void ewol::Joystick::GetProperty(float& distance, float& angle) +void widget::Joystick::GetProperty(float& distance, float& angle) { distance = m_distance; angle = m_angle+M_PI/2; diff --git a/sources/ewol/widget/Joystick.h b/sources/ewol/widget/Joystick.h index c525d34d..8103db8e 100644 --- a/sources/ewol/widget/Joystick.h +++ b/sources/ewol/widget/Joystick.h @@ -12,32 +12,33 @@ #include #include #include +#include extern const char * const ewolEventJoystickEnable; extern const char * const ewolEventJoystickDisable; extern const char * const ewolEventJoystickMove; -namespace ewol { +namespace widget { typedef enum { JOYSTICK_NORMAL_MODE, JOYSTICK_ARROW_MODE, } joystickMode_te; - class Joystick :public ewol::Drawable + class Joystick :public widget::Drawable { private: draw::Color m_colorFg; //!< Forground color draw::Color m_colorBg; //!< Background color - etk::Vector2D m_displayPos; //!< direction of the cursor ... - float m_distance; //!< dintance from the center - float m_angle; //!< angle of the arraw (if < 0 : No arraw...) 0 is the TOP ... - bool m_lock; //!< flag to mark the lock when the cursor is free when we are outside the circle - joystickMode_te m_displayMode; //!< Type of fonctionnal mode of the joystick + etk::Vector2D m_displayPos; //!< direction of the cursor ... + float m_distance; //!< dintance from the center + float m_angle; //!< angle of the arraw (if < 0 : No arraw...) 0 is the TOP ... + bool m_lock; //!< flag to mark the lock when the cursor is free when we are outside the circle + joystickMode_te m_displayMode; //!< Type of fonctionnal mode of the joystick private: // generic property of the joystick: bool m_displayBackground; etk::UString m_background; etk::UString m_foreground; - float m_ratio; + float m_ratio; public: Joystick(void); virtual ~Joystick(void); @@ -66,7 +67,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); void SetLockMode(bool lockWhenOut) { m_lock = lockWhenOut; }; void SetDisplayMode(joystickMode_te newMode) { m_displayMode = newMode; }; /** @@ -99,33 +100,6 @@ namespace ewol { void GetProperty(float& distance, float& angle); }; - - /** - * @brief Initilise the basic widget property ==> due to the android system - * @note all widget that have template might have this initializer ... - * @param --- - * @return --- - */ - void WIDGET_JoystickInit(void); - /** - * @brief Set the default ratio of the widget joystick - * @param[in] newRatio the new ratio that might be set - * @return --- - */ - void WIDGET_JoystickDefaultRatio(float newRatio); - /** - * @brief Set the default Background of the widget joystick - * @param[in] imageNameInData the new rbackground that might be set - * @return --- - */ - void WIDGET_JoystickDefaultBackground(etk::UString imageNameInData, bool display); - /** - * @brief Set the default Foreground of the widget joystick - * @param[in] imageNameInData the new Foreground that might be set - * @return --- - */ - void WIDGET_JoystickDefaultForeground(etk::UString imageNameInData); - }; #endif diff --git a/sources/ewol/widget/Label.cpp b/sources/ewol/widget/Label.cpp index 21162632..79f7810d 100644 --- a/sources/ewol/widget/Label.cpp +++ b/sources/ewol/widget/Label.cpp @@ -8,7 +8,7 @@ #include -#include +#include #include @@ -20,54 +20,54 @@ extern const char * const ewolEventLabelPressed = "ewol Label Pressed"; #define __class__ "Label" -void ewol::Label::Init(void) +void widget::Label::Init(void) { AddEventId(ewolEventLabelPressed); m_textColorFg = draw::color::black; SetCanHaveFocus(false); } -ewol::Label::Label(void) +widget::Label::Label(void) { m_label = "---"; Init(); } -ewol::Label::Label(etk::UString newLabel) +widget::Label::Label(etk::UString newLabel) { m_label = newLabel; Init(); } -ewol::Label::~Label(void) +widget::Label::~Label(void) { } -bool ewol::Label::CalculateMinSize(void) +bool widget::Label::CalculateMinSize(void) { - etk::Vector2D minSize = m_oObjectText.GetSize(m_label); + etk::Vector3D minSize = m_oObjectText.CalculateSize(m_label); m_minSize.x = 3 + minSize.x; m_minSize.y = 3 + minSize.y; return true; } -void ewol::Label::SetLabel(etk::UString newLabel) +void widget::Label::SetLabel(etk::UString newLabel) { m_label = newLabel; MarkToRedraw(); } -void ewol::Label::OnDraw(DrawProperty& displayProp) +void widget::Label::OnDraw(ewol::DrawProperty& displayProp) { m_oObjectText.Draw(); } -void ewol::Label::OnRegenerateDisplay(void) +void widget::Label::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { m_oObjectText.Clear(); @@ -86,21 +86,18 @@ void ewol::Label::OnRegenerateDisplay(void) tmpOriginY += paddingSize; - etk::Vector2D textPos(tmpOriginX, tmpOriginY); - clipping_ts drawClipping; - drawClipping.x = paddingSize; - drawClipping.y = paddingSize; - drawClipping.w = m_size.x - 2*paddingSize; - drawClipping.h = m_size.y - 2*paddingSize; - m_oObjectText.Text(textPos/*, drawClipping*/, m_label); + etk::Vector3D textPos(tmpOriginX, tmpOriginY, 0); + m_oObjectText.SetPos(textPos); + m_oObjectText.Print(m_label); + } } -bool ewol::Label::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::Label::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { //EWOL_DEBUG("Event on Label ..."); if (1 == IdInput) { - if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) { + if (ewol::keyEvent::statusSingle == typeEvent) { // nothing to do ... GenerateEventId(ewolEventLabelPressed); return true; diff --git a/sources/ewol/widget/Label.h b/sources/ewol/widget/Label.h index bd6e0ad4..3bef5d18 100644 --- a/sources/ewol/widget/Label.h +++ b/sources/ewol/widget/Label.h @@ -11,12 +11,12 @@ #include #include -#include +#include #include extern const char * const ewolEventLabelPressed; -namespace ewol { +namespace widget { class Label : public ewol::Widget { public: @@ -34,12 +34,12 @@ namespace ewol { virtual bool CalculateMinSize(void); void SetLabel(etk::UString newLabel); private: - ewol::OObject2DTextColored m_oObjectText; + ewol::Text m_oObjectText; etk::UString m_label; - draw::Color m_textColorFg; //!< Text color + draw::Color m_textColorFg; //!< Text color public: virtual void OnRegenerateDisplay(void); - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); public: /** * @brief Event on an input of this Widget @@ -50,7 +50,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); }; }; diff --git a/sources/ewol/widget/Layer.cpp b/sources/ewol/widget/Layer.cpp index 4a8d1ce1..31d126c7 100644 --- a/sources/ewol/widget/Layer.cpp +++ b/sources/ewol/widget/Layer.cpp @@ -14,19 +14,19 @@ #define __class__ "Layer" -ewol::Layer::Layer(void) +widget::Layer::Layer(void) { // set contamination enable LockExpendContamination(); } -ewol::Layer::~Layer(void) +widget::Layer::~Layer(void) { SubWidgetRemoveAll(); } -bool ewol::Layer::CalculateSize(float availlableX, float availlableY) +bool widget::Layer::CalculateSize(float availlableX, float availlableY) { //EWOL_DEBUG("Update Size"); m_size.x = availlableX; @@ -42,7 +42,7 @@ bool ewol::Layer::CalculateSize(float availlableX, float availlableY) } -bool ewol::Layer::CalculateMinSize(void) +bool widget::Layer::CalculateMinSize(void) { m_userExpend.x=false; m_userExpend.y=false; @@ -65,17 +65,17 @@ bool ewol::Layer::CalculateMinSize(void) return true; } -void ewol::Layer::SetMinSise(float x, float y) +void widget::Layer::SetMinSise(float x, float y) { EWOL_ERROR("Layer can not have a user Minimum size (herited from under elements)"); } -void ewol::Layer::SetExpendX(bool newExpend) +void widget::Layer::SetExpendX(bool newExpend) { EWOL_ERROR("Layer can not have a user expend settings X (herited from under elements)"); } -bool ewol::Layer::CanExpentX(void) +bool widget::Layer::CanExpentX(void) { if (true == m_lockExpendContamination) { return false; @@ -83,12 +83,12 @@ bool ewol::Layer::CanExpentX(void) return m_userExpend.x; } -void ewol::Layer::SetExpendY(bool newExpend) +void widget::Layer::SetExpendY(bool newExpend) { EWOL_ERROR("Sizer can not have a user expend settings Y (herited from under elements)"); } -bool ewol::Layer::CanExpentY(void) +bool widget::Layer::CanExpentY(void) { if (true == m_lockExpendContamination) { return false; @@ -96,14 +96,14 @@ bool ewol::Layer::CanExpentY(void) return m_userExpend.y; } -void ewol::Layer::LockExpendContamination(bool lockExpend) +void widget::Layer::LockExpendContamination(bool lockExpend) { m_lockExpendContamination = lockExpend; } //etk::Vector m_SubWidget; -void ewol::Layer::SubWidgetRemoveAll(void) +void widget::Layer::SubWidgetRemoveAll(void) { for (int32_t iii=0; iii=0; iii--) { @@ -164,7 +164,7 @@ void ewol::Layer::OnDraw(DrawProperty& displayProp) -void ewol::Layer::OnRegenerateDisplay(void) +void widget::Layer::OnRegenerateDisplay(void) { for (int32_t iii=0; iii pos) +ewol::Widget * widget::Layer::GetWidgetAtPos(etk::Vector2D pos) { // for all element in the sizer ... for (int32_t iii=0; iii pos) } -void ewol::Layer::OnObjectRemove(ewol::EObject * removeObject) +void widget::Layer::OnObjectRemove(ewol::EObject * removeObject) { // First step call parrent : ewol::Widget::OnObjectRemove(removeObject); diff --git a/sources/ewol/widget/Layer.h b/sources/ewol/widget/Layer.h index 842284af..b81cc9bb 100644 --- a/sources/ewol/widget/Layer.h +++ b/sources/ewol/widget/Layer.h @@ -13,7 +13,7 @@ #include #include -namespace ewol { +namespace widget { class Layer :public ewol::Widget { public: @@ -36,7 +36,7 @@ namespace ewol { virtual bool CanExpentY(void); void LockExpendContamination(bool lockExpend=false); private: - bool m_lockExpendContamination; + bool m_lockExpendContamination; etk::Vector m_subWidget; public: virtual void SubWidgetRemoveAll(void); @@ -44,7 +44,7 @@ namespace ewol { virtual void SubWidgetRemove(ewol::Widget* newWidget); virtual void SubWidgetUnLink(ewol::Widget* newWidget); protected: - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); public: virtual void OnRegenerateDisplay(void); public: diff --git a/sources/ewol/widget/List.cpp b/sources/ewol/widget/List.cpp index 0b8df149..33da5329 100644 --- a/sources/ewol/widget/List.cpp +++ b/sources/ewol/widget/List.cpp @@ -8,14 +8,15 @@ #include -#include +#include +#include #include #undef __class__ #define __class__ "List" -void ewol::List::Init(void) +void widget::List::Init(void) { m_paddingSizeX = 2; #ifdef __TARGET_OS__Android @@ -26,12 +27,12 @@ void ewol::List::Init(void) SetCanHaveFocus(true); } -ewol::List::List(void) +widget::List::List(void) { Init(); } -ewol::List::~List(void) +widget::List::~List(void) { //clean all the object for (int32_t iii=0; iii listSizeColomn; - ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); + ewol::Drawing * BGOObjects = new ewol::Drawing(); draw::Color basicBG = GetBasicBG(); BGOObjects->SetColor(basicBG); - BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); + BGOObjects->SetPos(etk::Vector3D(0, 0, 0) ); + BGOObjects->RectangleWidth(etk::Vector3D(m_size.x, m_size.y, 0) ); int32_t startRaw = m_originScrooled.y / (minHeight + 2*m_paddingSizeY); @@ -138,11 +140,12 @@ void ewol::List::OnRegenerateDisplay(void) // We display only compleate lines ... //EWOL_DEBUG("Request drawing list : " << startRaw << "-->" << (startRaw+displayableRaw) << " in " << nbRaw << "raws ; start display : " << m_originScrooled.y << " ==> " << tmpOriginY << " line size=" << minHeight + 2*m_paddingSizeY ); - clipping_ts drawClipping; + /*clipping_ts drawClipping; drawClipping.x = 0; drawClipping.y = 0; drawClipping.w = m_size.x - (2*m_paddingSizeX); drawClipping.h = m_size.y; + */ // remove all the positions : m_lineSize.Clear(); int32_t displayPositionY = m_size.y; @@ -160,24 +163,23 @@ void ewol::List::OnRegenerateDisplay(void) draw::Color bg; GetElement(jjj, iii, myTextToWrite, fg, bg); - ewol::OObject2DTextColored * tmpText = new ewol::OObject2DTextColored(); + ewol::Text * tmpText = new ewol::Text(); if (NULL != tmpText) { // get font size : - int32_t tmpFontHeight = tmpText->GetHeight(); + int32_t tmpFontHeight = tmpText->CalculateSize('A').y; displayPositionY-=(tmpFontHeight+m_paddingSizeY); BGOObjects->SetColor(bg); - BGOObjects->Rectangle(displayPositionX, displayPositionY, m_size.x-displayPositionX, tmpFontHeight+2*m_paddingSizeY); + BGOObjects->SetPos(etk::Vector3D(displayPositionX, displayPositionY, 0) ); + BGOObjects->RectangleWidth(etk::Vector3D(m_size.x-displayPositionX, tmpFontHeight+2*m_paddingSizeY, 0)); // get the maximum size of the colomn : - etk::Vector2D textSize = tmpText->GetSize(myTextToWrite); + etk::Vector3D textSize = tmpText->CalculateSize(myTextToWrite); sizeColom = etk_max(sizeColom, textSize.x); - etk::Vector2D textPos; - textPos.x = tmpOriginX + displayPositionX; - textPos.y = displayPositionY; tmpText->SetColor(fg); - tmpText->Text(textPos/*, drawClipping*/, myTextToWrite); + tmpText->SetPos(etk::Vector3D(tmpOriginX + displayPositionX, displayPositionY, 0) ); + tmpText->Print(myTextToWrite); AddOObject(tmpText); // madding move ... displayPositionY -= m_paddingSizeY; @@ -200,7 +202,7 @@ void ewol::List::OnRegenerateDisplay(void) } } -bool ewol::List::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::List::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { etk::Vector2D relativePos = RelativePosition(pos); @@ -231,12 +233,12 @@ bool ewol::List::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInp -void ewol::List::OnGetFocus(void) +void widget::List::OnGetFocus(void) { EWOL_DEBUG("Ewol::List Get Focus"); } -void ewol::List::OnLostFocus(void) +void widget::List::OnLostFocus(void) { EWOL_DEBUG("Ewol::List Lost Focus"); } diff --git a/sources/ewol/widget/List.h b/sources/ewol/widget/List.h index 5fb5b37a..abb1b757 100644 --- a/sources/ewol/widget/List.h +++ b/sources/ewol/widget/List.h @@ -10,12 +10,13 @@ #define __EWOL_LIST_H__ #include +#include #include #include -#include +#include -namespace ewol { - class List :public ewol::WidgetScrooled +namespace widget { + class List :public widget::WidgetScrooled { public: List(void); @@ -32,13 +33,13 @@ namespace ewol { void SetLabel(etk::UString newLabel); // Drawing capabilities .... private: - etk::Vector m_listOObject; //!< generic element to display... + etk::Vector m_listOObject; //!< generic element to display... etk::Vector > m_lineSize; public: - void AddOObject(ewol::OObject* newObject, int32_t pos=-1); + void AddOObject(ewol::Compositing* newObject, int32_t pos=-1); void ClearOObjectList(void); protected: - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); // list properties ... private: int32_t m_paddingSizeX; @@ -56,7 +57,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); protected: // function call to display the list : virtual draw::Color GetBasicBG(void) { @@ -84,7 +85,7 @@ namespace ewol { } return false; }; - virtual bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y) { + virtual bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y) { return false; } protected: diff --git a/sources/ewol/widget/ListFileSystem.cpp b/sources/ewol/widget/ListFileSystem.cpp index 1ca2b1e9..1122e31c 100644 --- a/sources/ewol/widget/ListFileSystem.cpp +++ b/sources/ewol/widget/ListFileSystem.cpp @@ -9,6 +9,8 @@ #include #include +#include + #undef __class__ #define __class__ "ListFileSystem" @@ -19,7 +21,7 @@ extern const char * const ewolEventFSFolderSelect = "ewol-event-file-system-fo extern const char * const ewolEventFSFolderValidate = "ewol-event-file-system-folder-validate"; -ewol::ListFileSystem::ListFileSystem(void) +widget::ListFileSystem::ListFileSystem(void) { m_selectedLine = -1; m_showFile = true; @@ -38,7 +40,7 @@ ewol::ListFileSystem::ListFileSystem(void) SetMouseLimit(1); }; -ewol::ListFileSystem::~ListFileSystem(void) +widget::ListFileSystem::~ListFileSystem(void) { for (int32_t iii=0; iii= 0) { @@ -125,7 +127,7 @@ etk::UString ewol::ListFileSystem::GetSelect(void) } // select the specific file -void ewol::ListFileSystem::SetSelect( etk::UString data) { +void widget::ListFileSystem::SetSelect( etk::UString data) { // remove selected line m_selectedLine = -1; // search the coresponding file : @@ -141,14 +143,14 @@ void ewol::ListFileSystem::SetSelect( etk::UString data) { MarkToRedraw(); } -uint32_t ewol::ListFileSystem::GetNuberOfColomn(void) { +uint32_t widget::ListFileSystem::GetNuberOfColomn(void) { return 1; }; -bool ewol::ListFileSystem::GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg) { +bool widget::ListFileSystem::GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg) { myTitle = "title"; return true; }; -uint32_t ewol::ListFileSystem::GetNuberOfRaw(void) +uint32_t widget::ListFileSystem::GetNuberOfRaw(void) { int32_t offset = 0; if (true == m_showFolder) { @@ -156,7 +158,7 @@ uint32_t ewol::ListFileSystem::GetNuberOfRaw(void) } return m_list.Size() + offset; }; -bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg) +bool widget::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg) { int32_t offset = 0; if (true == m_showFolder) { @@ -191,13 +193,13 @@ bool ewol::ListFileSystem::GetElement(int32_t colomn, int32_t raw, etk::UString }; -bool ewol::ListFileSystem::OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y) +bool widget::ListFileSystem::OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y) { int32_t offset = 0; if (true == m_showFolder) { offset = 2; } - if (typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) { + if (typeEvent == ewol::keyEvent::statusSingle) { EWOL_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw ); if (1 == IdInput) { int32_t previousRaw = m_selectedLine; diff --git a/sources/ewol/widget/ListFileSystem.h b/sources/ewol/widget/ListFileSystem.h index 0fc2b70c..4606a843 100644 --- a/sources/ewol/widget/ListFileSystem.h +++ b/sources/ewol/widget/ListFileSystem.h @@ -17,8 +17,8 @@ extern const char * const ewolEventFSFileValidate; extern const char * const ewolEventFSFolderSelect; extern const char * const ewolEventFSFolderValidate; -namespace ewol { - class ListFileSystem : public ewol::List +namespace widget { + class ListFileSystem : public widget::List { private: etk::Vector m_list; @@ -37,7 +37,7 @@ namespace ewol { bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg); uint32_t GetNuberOfRaw(void); bool GetElement(int32_t colomn, int32_t raw, etk::UString &myTextToWrite, draw::Color &fg, draw::Color &bg); - bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, float x, float y); + bool OnItemEvent(int32_t IdInput, ewol::keyEvent::status_te typeEvent, int32_t colomn, int32_t raw, float x, float y); /** * @brief Get the current Object type of the EObject * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it diff --git a/sources/ewol/widget/Menu.cpp b/sources/ewol/widget/Menu.cpp index b418e507..2776acb8 100644 --- a/sources/ewol/widget/Menu.cpp +++ b/sources/ewol/widget/Menu.cpp @@ -17,40 +17,40 @@ #undef __class__ #define __class__ "Menu" -ewol::Menu::Menu(void) +widget::Menu::Menu(void) { m_staticId = 0; m_widgetContextMenu = NULL; } -ewol::Menu::~Menu(void) +widget::Menu::~Menu(void) { Clear(); } -void ewol::Menu::SubWidgetRemoveAll(void) +void widget::Menu::SubWidgetRemoveAll(void) { Clear(); - ewol::SizerHori::SubWidgetRemoveAll(); + widget::SizerHori::SubWidgetRemoveAll(); } -void ewol::Menu::SubWidgetAdd(ewol::Widget* newWidget) +void widget::Menu::SubWidgetAdd(ewol::Widget* newWidget) { EWOL_ERROR("Not availlable"); } -void ewol::Menu::SubWidgetRemove(ewol::Widget* newWidget) +void widget::Menu::SubWidgetRemove(ewol::Widget* newWidget) { EWOL_ERROR("Not availlable"); } -void ewol::Menu::SubWidgetUnLink(ewol::Widget* newWidget) +void widget::Menu::SubWidgetUnLink(ewol::Widget* newWidget) { EWOL_ERROR("Not availlable"); } -void ewol::Menu::Clear(void) +void widget::Menu::Clear(void) { for( int32_t iii=0; iii < m_listElement.Size(); iii++) { if (m_listElement[iii] != NULL) { @@ -61,14 +61,14 @@ void ewol::Menu::Clear(void) m_listElement.Clear(); } -int32_t ewol::Menu::AddTitle(etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message) +int32_t widget::Menu::AddTitle(etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message) { return Add(-1, label, image, generateEvent, message); } -int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message) +int32_t widget::Menu::Add(int32_t parent, etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message) { - ewol::MenuElement * tmpObject = new ewol::MenuElement(); + widget::MenuElement * tmpObject = new widget::MenuElement(); if (NULL == tmpObject) { EWOL_ERROR("Allocation problem"); return -1; @@ -82,8 +82,8 @@ int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image, tmpObject->m_message = message; m_listElement.PushBack(tmpObject); if (-1 == tmpObject->m_parentId) { - ewol::Button * myButton = NULL; - myButton = new ewol::Button(label); + widget::Button * myButton = NULL; + myButton = new widget::Button(label); if (NULL == myButton) { EWOL_ERROR("Allocation button error"); return tmpObject->m_localId; @@ -91,7 +91,7 @@ int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image, // set the image if one is present ... myButton->SetImage(tmpObject->m_image); // add it in the widget list - ewol::SizerHori::SubWidgetAdd(myButton); + widget::SizerHori::SubWidgetAdd(myButton); // keep the specific event ... myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed); tmpObject->m_widgetPointer = myButton; @@ -99,13 +99,13 @@ int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image, return tmpObject->m_localId; } -void ewol::Menu::AddSpacer(void) +void widget::Menu::AddSpacer(void) { EWOL_TODO("NOT now..."); } -void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) +void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) { /* if (true == ewol::SizerHori::OnReceiveMessage(CallerObject, eventId, data)) { @@ -140,7 +140,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve return; } // create a context menu : - m_widgetContextMenu = new ewol::ContextMenu(); + m_widgetContextMenu = new widget::ContextMenu(); if (NULL == m_widgetContextMenu) { EWOL_ERROR("Allocation Error"); return; @@ -156,12 +156,12 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve newPosition.y = tmpOri.y; } - m_widgetContextMenu->SetPositionMark(ewol::CONTEXT_MENU_MARK_TOP, newPosition ); + m_widgetContextMenu->SetPositionMark(widget::CONTEXT_MENU_MARK_TOP, newPosition ); - ewol::SizerVert * mySizerVert = NULL; - ewol::Button * myButton = NULL; + widget::SizerVert * mySizerVert = NULL; + widget::Button * myButton = NULL; - mySizerVert = new ewol::SizerVert(); + mySizerVert = new widget::SizerVert(); mySizerVert->LockExpendContamination(true); // set it in the pop-up-system : m_widgetContextMenu->SubWidgetSet(mySizerVert); @@ -169,7 +169,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve for(int32_t jjj=m_listElement.Size()-1; jjj>=0; jjj--) { if (m_listElement[iii]!=NULL) { if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) { - myButton = new ewol::Button(m_listElement[jjj]->m_label); + myButton = new widget::Button(m_listElement[jjj]->m_label); if (NULL == myButton) { EWOL_ERROR("Allocation Error"); } else { @@ -178,7 +178,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed); myButton->SetExpendX(true); myButton->SetFillX(true); - myButton->SetAlignement(ewol::TEXT_ALIGN_LEFT); + myButton->SetAlignement(widget::TEXT_ALIGN_LEFT); // add it in the widget list mySizerVert->SubWidgetAdd(myButton); m_listElement[jjj]->m_widgetPointer = myButton; @@ -186,7 +186,7 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve } } } - ewol::PopUpWidgetPush(m_widgetContextMenu); + ewol::WindowsPopUpAdd(m_widgetContextMenu); } return; } @@ -195,9 +195,9 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve } -void ewol::Menu::OnObjectRemove(ewol::EObject * removeObject) +void widget::Menu::OnObjectRemove(ewol::EObject * removeObject) { - ewol::SizerHori::OnObjectRemove(removeObject); + widget::SizerHori::OnObjectRemove(removeObject); if (m_widgetContextMenu == removeObject) { m_widgetContextMenu = NULL; } diff --git a/sources/ewol/widget/Menu.h b/sources/ewol/widget/Menu.h index 7f645071..0f96edac 100644 --- a/sources/ewol/widget/Menu.h +++ b/sources/ewol/widget/Menu.h @@ -16,7 +16,7 @@ #include #include -namespace ewol { +namespace widget { class MenuElement { public : @@ -29,7 +29,7 @@ namespace ewol { const char * m_generateEvent; etk::UString m_message; }; - class Menu :public ewol::SizerHori + class Menu :public widget::SizerHori { public: Menu(void); @@ -48,9 +48,9 @@ namespace ewol { virtual void SubWidgetRemove(ewol::Widget* newWidget); virtual void SubWidgetUnLink(ewol::Widget* newWidget); private: - etk::Vector m_listElement; - int32_t m_staticId; // unique ID for every element of the menu ... - ewol::ContextMenu* m_widgetContextMenu; + etk::Vector m_listElement; + int32_t m_staticId; // unique ID for every element of the menu ... + widget::ContextMenu* m_widgetContextMenu; public: void Clear(void); int32_t AddTitle(etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = ""); diff --git a/sources/ewol/widget/PopUp.cpp b/sources/ewol/widget/PopUp.cpp index 3ffc1582..1c509edb 100644 --- a/sources/ewol/widget/PopUp.cpp +++ b/sources/ewol/widget/PopUp.cpp @@ -8,11 +8,12 @@ #include #include +#include #undef __class__ #define __class__ "PopUp" -ewol::PopUp::PopUp(void) : +widget::PopUp::PopUp(void) : m_subWidgetNext(NULL) { m_userExpend.x = true; @@ -29,13 +30,13 @@ ewol::PopUp::PopUp(void) : m_subWidget = 0; } -ewol::PopUp::~PopUp(void) +widget::PopUp::~PopUp(void) { SubWidgetRemove(); } -bool ewol::PopUp::CalculateSize(float availlableX, float availlableY) +bool widget::PopUp::CalculateSize(float availlableX, float availlableY) { //EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")"); // pop-up fill all the display : @@ -71,7 +72,7 @@ bool ewol::PopUp::CalculateSize(float availlableX, float availlableY) } -bool ewol::PopUp::CalculateMinSize(void) +bool widget::PopUp::CalculateMinSize(void) { //EWOL_DEBUG("CalculateMinSize"); m_userExpend.x=false; @@ -89,23 +90,23 @@ bool ewol::PopUp::CalculateMinSize(void) return true; } -void ewol::PopUp::SetMinSise(float x, float y) +void widget::PopUp::SetMinSise(float x, float y) { EWOL_ERROR("Pop-up can not have a user Minimum size (herited from under elements)"); } -void ewol::PopUp::SetExpendX(bool newExpend) +void widget::PopUp::SetExpendX(bool newExpend) { EWOL_ERROR("Pop-up can not have a user expend settings X (herited from under elements)"); } -void ewol::PopUp::SetExpendY(bool newExpend) +void widget::PopUp::SetExpendY(bool newExpend) { EWOL_ERROR("Pop-up can not have a user expend settings Y (herited from under elements)"); } -void ewol::PopUp::SubWidgetSet(ewol::Widget* newWidget) +void widget::PopUp::SubWidgetSet(ewol::Widget* newWidget) { if (NULL == newWidget) { EWOL_ERROR("Try to set a sub wiget with NULL pointer ..."); @@ -118,7 +119,7 @@ void ewol::PopUp::SubWidgetSet(ewol::Widget* newWidget) } -void ewol::PopUp::SubWidgetRemove(void) +void widget::PopUp::SubWidgetRemove(void) { if (NULL != m_subWidget) { delete(m_subWidget); @@ -128,35 +129,38 @@ void ewol::PopUp::SubWidgetRemove(void) } -void ewol::PopUp::OnDraw(DrawProperty& displayProp) +void widget::PopUp::OnDraw(ewol::DrawProperty& displayProp) { // draw upper classes - ewol::Drawable::OnDraw(displayProp); + widget::Drawable::OnDraw(displayProp); if (NULL != m_subWidget) { m_subWidget->GenDraw(displayProp); } } #define BORDER_SIZE_TMP (4) -void ewol::PopUp::OnRegenerateDisplay(void) +void widget::PopUp::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { } // generate a white background and take gray on other surfaces ClearOObjectList(); - ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); + ewol::Drawing * BGOObjects = new ewol::Drawing(); AddOObject(BGOObjects); BGOObjects->SetColor(m_colorEmptyArea); - BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); + BGOObjects->SetPos(etk::Vector3D(0,0,0)); + BGOObjects->RectangleWidth(etk::Vector3D(m_size.x, m_size.y, 0)); // set the area in white ... if (NULL != m_subWidget) { etk::Vector2D tmpSize = m_subWidget->GetSize(); etk::Vector2D tmpOrigin = m_subWidget->GetOrigin(); BGOObjects->SetColor(m_colorBorder); - BGOObjects->Rectangle(tmpOrigin.x-BORDER_SIZE_TMP, tmpOrigin.y-BORDER_SIZE_TMP, tmpSize.x+2*BORDER_SIZE_TMP, tmpSize.y+2*BORDER_SIZE_TMP); + BGOObjects->SetPos(etk::Vector3D(tmpOrigin.x-BORDER_SIZE_TMP, tmpOrigin.y-BORDER_SIZE_TMP,0) ); + BGOObjects->Rectangle(etk::Vector3D(tmpSize.x+2*BORDER_SIZE_TMP, tmpSize.y+2*BORDER_SIZE_TMP, 0) ); BGOObjects->SetColor(m_colorBackGroung); - BGOObjects->Rectangle(tmpOrigin.x, tmpOrigin.y, tmpSize.x, tmpSize.y); + BGOObjects->SetPos(etk::Vector3D(tmpOrigin.x, tmpOrigin.y,0) ); + BGOObjects->RectangleWidth(etk::Vector3D(tmpSize.x, tmpSize.y, 0) ); } if (NULL != m_subWidget) { m_subWidget->OnRegenerateDisplay(); @@ -164,7 +168,7 @@ void ewol::PopUp::OnRegenerateDisplay(void) } -ewol::Widget * ewol::PopUp::GetWidgetAtPos(etk::Vector2D pos) +ewol::Widget * widget::PopUp::GetWidgetAtPos(etk::Vector2D pos) { // calculate relative position etk::Vector2D relativePos = RelativePosition(pos); @@ -185,17 +189,17 @@ ewol::Widget * ewol::PopUp::GetWidgetAtPos(etk::Vector2D pos) } -void ewol::PopUp::SetDisplayRatio(float ratio) +void widget::PopUp::SetDisplayRatio(float ratio) { m_displayRatio = ratio; MarkToRedraw(); } -void ewol::PopUp::OnObjectRemove(ewol::EObject * removeObject) +void widget::PopUp::OnObjectRemove(ewol::EObject * removeObject) { // First step call parrent : - ewol::Drawable::OnObjectRemove(removeObject); + widget::Drawable::OnObjectRemove(removeObject); // second step find if in all the elements ... if(m_subWidget == removeObject) { EWOL_DEBUG("Remove pop-up sub Element ==> destroyed object"); diff --git a/sources/ewol/widget/PopUp.h b/sources/ewol/widget/PopUp.h index e5454d78..7bec1a2c 100644 --- a/sources/ewol/widget/PopUp.h +++ b/sources/ewol/widget/PopUp.h @@ -10,12 +10,13 @@ #define __EWOL_POP_UP_H__ #include +#include #include #include #include -namespace ewol { - class PopUp : public ewol::Drawable +namespace widget { + class PopUp : public widget::Drawable { public: PopUp(void); diff --git a/sources/ewol/widget/ProgressBar.cpp b/sources/ewol/widget/ProgressBar.cpp index 75aff72e..5c6c77f6 100644 --- a/sources/ewol/widget/ProgressBar.cpp +++ b/sources/ewol/widget/ProgressBar.cpp @@ -8,7 +8,7 @@ #include -#include +#include #include #undef __class__ @@ -16,7 +16,7 @@ const int32_t dotRadius = 6; -ewol::ProgressBar::ProgressBar(void) +widget::ProgressBar::ProgressBar(void) { m_value = 0.0; @@ -29,13 +29,13 @@ ewol::ProgressBar::ProgressBar(void) SetCanHaveFocus(true); } -ewol::ProgressBar::~ProgressBar(void) +widget::ProgressBar::~ProgressBar(void) { } -bool ewol::ProgressBar::CalculateMinSize(void) +bool widget::ProgressBar::CalculateMinSize(void) { m_minSize.x = etk_max(m_userMinSize.x, 40); m_minSize.y = etk_max(m_userMinSize.y, dotRadius*2); @@ -44,42 +44,45 @@ bool ewol::ProgressBar::CalculateMinSize(void) } -void ewol::ProgressBar::ValueSet(float val) +void widget::ProgressBar::ValueSet(float val) { m_value = etk_avg(0.0, val, 1.0); MarkToRedraw(); } -float ewol::ProgressBar::ValueGet(void) +float widget::ProgressBar::ValueGet(void) { return m_value; } -void ewol::ProgressBar::OnRegenerateDisplay(void) +void widget::ProgressBar::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { // clean the object list ... ClearOObjectList(); - ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored; + ewol::Drawing * tmpDraw = new ewol::Drawing; - tmpOObjects->SetColor(m_textColorFg); + tmpDraw->SetColor(m_textColorFg); int32_t tmpSizeX = m_size.x - 10; int32_t tmpSizeY = m_size.y - 10; int32_t tmpOriginX = 5; int32_t tmpOriginY = 5; - tmpOObjects->SetColor(m_textColorBgOn); - tmpOObjects->Rectangle( tmpOriginX, tmpOriginY, tmpSizeX*m_value, tmpSizeY); - tmpOObjects->SetColor(m_textColorBgOff); - tmpOObjects->Rectangle( tmpOriginX+tmpSizeX*m_value, tmpOriginY, tmpSizeX*(1.0-m_value), tmpSizeY); + tmpDraw->SetColor(m_textColorBgOn); + tmpDraw->SetPos(etk::Vector3D(tmpOriginX, tmpOriginY, 0) ); + tmpDraw->RectangleWidth(etk::Vector3D(tmpSizeX*m_value, tmpSizeY, 0) ); + tmpDraw->SetColor(m_textColorBgOff); + tmpDraw->SetPos(etk::Vector3D(tmpOriginX+tmpSizeX*m_value, tmpOriginY, 0) ); + tmpDraw->RectangleWidth(etk::Vector3D(tmpSizeX*(1.0-m_value), tmpSizeY, 0) ); - tmpOObjects->SetColor(m_textColorFg); - tmpOObjects->RectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, 1); + // TODO : Create a better progress Bar ... + //tmpDraw->SetColor(m_textColorFg); + //tmpDraw->RectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, 1); - AddOObject(tmpOObjects); + AddOObject(tmpDraw); } } diff --git a/sources/ewol/widget/ProgressBar.h b/sources/ewol/widget/ProgressBar.h index b71a120c..d4d4c9a6 100644 --- a/sources/ewol/widget/ProgressBar.h +++ b/sources/ewol/widget/ProgressBar.h @@ -10,12 +10,13 @@ #define __EWOL_PROGRESS_BAR_H__ #include +#include #include #include -namespace ewol { - class ProgressBar :public ewol::Drawable +namespace widget { + class ProgressBar :public widget::Drawable { public: ProgressBar(void); @@ -29,10 +30,10 @@ namespace ewol { virtual const char * const GetObjectType(void) { return "EwolProgressBar"; }; virtual bool CalculateMinSize(void); void ValueSet(float val); - float ValueGet(void); + float ValueGet(void); void SetColor(draw::Color newColor) { m_textColorFg = newColor; }; private: - float m_value; //!< % used + float m_value; //!< % used draw::Color m_textColorFg; //!< forder bar color draw::Color m_textColorBgOn; //!< bar color enable draw::Color m_textColorBgOff; //!< bar color disable diff --git a/sources/ewol/widget/Scene.cpp b/sources/ewol/widget/Scene.cpp index 669e4b66..3862c498 100644 --- a/sources/ewol/widget/Scene.cpp +++ b/sources/ewol/widget/Scene.cpp @@ -13,21 +13,10 @@ #include #include -/** - * @brief Initilise the basic widget property ==> due to the android system - * @note all widget that have template might have this initializer ... - * @param --- - * @return --- - */ -void ewol::WIDGET_SceneInit(void) -{ - -} - #undef __class__ #define __class__ "Scene" -ewol::Scene::Scene(void) +widget::Scene::Scene(void) { m_isRunning = true; SetCanHaveFocus(true); @@ -37,13 +26,13 @@ ewol::Scene::Scene(void) } -ewol::Scene::~Scene(void) +widget::Scene::~Scene(void) { } -void ewol::Scene::OnRegenerateDisplay(void) +void widget::Scene::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { // clean elements @@ -69,7 +58,7 @@ void ewol::Scene::OnRegenerateDisplay(void) * @return --- */ //TODO : Il y a un bug : seg fault ... je ne sais pas trop ou ... -void ewol::Scene::OnDraw(DrawProperty& displayProp) +void widget::Scene::OnDraw(ewol::DrawProperty& displayProp) { //EWOL_ERROR(" On draw : " << m_currentDrawId); // draw background : @@ -87,7 +76,7 @@ void ewol::Scene::OnDraw(DrawProperty& displayProp) } -void ewol::Scene::PeriodicCall(int64_t localTime) +void widget::Scene::PeriodicCall(int64_t localTime) { // First time : if (-1 == m_lastCallTime) { @@ -125,7 +114,7 @@ void ewol::Scene::PeriodicCall(int64_t localTime) } -void ewol::Scene::GenDraw(DrawProperty displayProp) +void widget::Scene::GenDraw(DrawProperty displayProp) { ewol::openGL::Push(); @@ -159,7 +148,7 @@ void ewol::Scene::GenDraw(DrawProperty displayProp) } -etk::Vector2D ewol::Scene::RelativePosition(etk::Vector2D pos) +etk::Vector2D widget::Scene::RelativePosition(etk::Vector2D pos) { // Remove origin of the widget pos.x -= m_origin.x; diff --git a/sources/ewol/widget/Scene.h b/sources/ewol/widget/Scene.h index 5958d41a..f395269e 100644 --- a/sources/ewol/widget/Scene.h +++ b/sources/ewol/widget/Scene.h @@ -16,7 +16,7 @@ #include -namespace ewol { +namespace widget { class Scene :public ewol::Widget { // TODO : Set it in private ... @@ -47,7 +47,7 @@ namespace ewol { * @param --- * @return --- */ - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); /** * @brief Set the scene in pause for a while * @param --- diff --git a/sources/ewol/widget/SizerHori.cpp b/sources/ewol/widget/SizerHori.cpp index 8612a569..78809946 100644 --- a/sources/ewol/widget/SizerHori.cpp +++ b/sources/ewol/widget/SizerHori.cpp @@ -12,19 +12,19 @@ #undef __class__ #define __class__ "SizerHori" -ewol::SizerHori::SizerHori(void) +widget::SizerHori::SizerHori(void) { // set contamination enable LockExpendContamination(); } -ewol::SizerHori::~SizerHori(void) +widget::SizerHori::~SizerHori(void) { SubWidgetRemoveAll(); } -bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY) +bool widget::SizerHori::CalculateSize(float availlableX, float availlableY) { //EWOL_DEBUG("Update Size"); m_size.x = availlableX; @@ -76,7 +76,7 @@ bool ewol::SizerHori::CalculateSize(float availlableX, float availlableY) } -bool ewol::SizerHori::CalculateMinSize(void) +bool widget::SizerHori::CalculateMinSize(void) { //EWOL_DEBUG("Update minimum Size"); m_userExpend.x=false; @@ -104,17 +104,17 @@ bool ewol::SizerHori::CalculateMinSize(void) return true; } -void ewol::SizerHori::SetMinSize(float x, float y) +void widget::SizerHori::SetMinSize(float x, float y) { EWOL_ERROR("Sizer can not have a user Minimum size (herited from under elements)"); } -void ewol::SizerHori::SetExpendX(bool newExpend) +void widget::SizerHori::SetExpendX(bool newExpend) { EWOL_ERROR("Sizer can not have a user expend settings X (herited from under elements)"); } -bool ewol::SizerHori::CanExpentX(void) +bool widget::SizerHori::CanExpentX(void) { if (true == m_lockExpendContamination) { return false; @@ -122,12 +122,12 @@ bool ewol::SizerHori::CanExpentX(void) return m_userExpend.x; } -void ewol::SizerHori::SetExpendY(bool newExpend) +void widget::SizerHori::SetExpendY(bool newExpend) { EWOL_ERROR("Sizer can not have a user expend settings Y (herited from under elements)"); } -bool ewol::SizerHori::CanExpentY(void) +bool widget::SizerHori::CanExpentY(void) { if (true == m_lockExpendContamination) { return false; @@ -135,14 +135,14 @@ bool ewol::SizerHori::CanExpentY(void) return m_userExpend.y; } -void ewol::SizerHori::LockExpendContamination(bool lockExpend) +void widget::SizerHori::LockExpendContamination(bool lockExpend) { m_lockExpendContamination = lockExpend; } //etk::Vector m_subWidget[m_currentCreateId]; -void ewol::SizerHori::SubWidgetRemoveAll(void) +void widget::SizerHori::SubWidgetRemoveAll(void) { for (int32_t iii=0; iii pos) +ewol::Widget * widget::SizerHori::GetWidgetAtPos(etk::Vector2D pos) { if (true == IsHide()) { return NULL; @@ -243,7 +243,7 @@ ewol::Widget * ewol::SizerHori::GetWidgetAtPos(etk::Vector2D pos) } -void ewol::SizerHori::OnObjectRemove(ewol::EObject * removeObject) +void widget::SizerHori::OnObjectRemove(ewol::EObject * removeObject) { // First step call parrent : ewol::Widget::OnObjectRemove(removeObject); diff --git a/sources/ewol/widget/SizerHori.h b/sources/ewol/widget/SizerHori.h index b9759d84..7637db55 100644 --- a/sources/ewol/widget/SizerHori.h +++ b/sources/ewol/widget/SizerHori.h @@ -13,7 +13,7 @@ #include #include -namespace ewol { +namespace widget { class SizerHori :public ewol::Widget { public: @@ -45,7 +45,7 @@ namespace ewol { virtual void SubWidgetRemove(ewol::Widget* newWidget); virtual void SubWidgetUnLink(ewol::Widget* newWidget); protected: - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); public: virtual void OnRegenerateDisplay(void); /** diff --git a/sources/ewol/widget/SizerVert.cpp b/sources/ewol/widget/SizerVert.cpp index 728c622a..2cbc6ec6 100644 --- a/sources/ewol/widget/SizerVert.cpp +++ b/sources/ewol/widget/SizerVert.cpp @@ -14,19 +14,19 @@ #define __class__ "SizerVert" -ewol::SizerVert::SizerVert(void) +widget::SizerVert::SizerVert(void) { // set contamination enable LockExpendContamination(); } -ewol::SizerVert::~SizerVert(void) +widget::SizerVert::~SizerVert(void) { SubWidgetRemoveAll(); } -bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY) +bool widget::SizerVert::CalculateSize(float availlableX, float availlableY) { //EWOL_DEBUG("Update Size"); m_size.x = availlableX; @@ -79,7 +79,7 @@ bool ewol::SizerVert::CalculateSize(float availlableX, float availlableY) } -bool ewol::SizerVert::CalculateMinSize(void) +bool widget::SizerVert::CalculateMinSize(void) { //EWOL_DEBUG("Update minimum Size"); m_userExpend.x=false; @@ -108,17 +108,17 @@ bool ewol::SizerVert::CalculateMinSize(void) return true; } -void ewol::SizerVert::SetMinSize(float x, float y) +void widget::SizerVert::SetMinSize(float x, float y) { EWOL_ERROR("Sizer can not have a user Minimum size (herited from under elements)"); } -void ewol::SizerVert::SetExpendX(bool newExpend) +void widget::SizerVert::SetExpendX(bool newExpend) { EWOL_ERROR("Sizer can not have a user expend settings X (herited from under elements)"); } -bool ewol::SizerVert::CanExpentX(void) +bool widget::SizerVert::CanExpentX(void) { if (true == m_lockExpendContamination) { return false; @@ -126,12 +126,12 @@ bool ewol::SizerVert::CanExpentX(void) return m_userExpend.x; } -void ewol::SizerVert::SetExpendY(bool newExpend) +void widget::SizerVert::SetExpendY(bool newExpend) { EWOL_ERROR("Sizer can not have a user expend settings Y (herited from under elements)"); } -bool ewol::SizerVert::CanExpentY(void) +bool widget::SizerVert::CanExpentY(void) { if (true == m_lockExpendContamination) { return false; @@ -139,14 +139,14 @@ bool ewol::SizerVert::CanExpentY(void) return m_userExpend.y; } -void ewol::SizerVert::LockExpendContamination(bool lockExpend) +void widget::SizerVert::LockExpendContamination(bool lockExpend) { m_lockExpendContamination = lockExpend; } //etk::Vector m_SubWidget; -void ewol::SizerVert::SubWidgetRemoveAll(void) +void widget::SizerVert::SubWidgetRemoveAll(void) { for (int32_t iii=0; iii pos) +ewol::Widget * widget::SizerVert::GetWidgetAtPos(etk::Vector2D pos) { if (true == IsHide()) { return NULL; @@ -244,7 +244,7 @@ ewol::Widget * ewol::SizerVert::GetWidgetAtPos(etk::Vector2D pos) } -void ewol::SizerVert::OnObjectRemove(ewol::EObject * removeObject) +void widget::SizerVert::OnObjectRemove(ewol::EObject * removeObject) { // First step call parrent : ewol::Widget::OnObjectRemove(removeObject); diff --git a/sources/ewol/widget/SizerVert.h b/sources/ewol/widget/SizerVert.h index 508b081f..179c7668 100644 --- a/sources/ewol/widget/SizerVert.h +++ b/sources/ewol/widget/SizerVert.h @@ -13,7 +13,7 @@ #include #include -namespace ewol { +namespace widget { class SizerVert :public ewol::Widget { public: @@ -44,7 +44,7 @@ namespace ewol { virtual void SubWidgetRemove(ewol::Widget* newWidget); virtual void SubWidgetUnLink(ewol::Widget* newWidget); protected: - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); public: virtual void OnRegenerateDisplay(void); public: diff --git a/sources/ewol/widget/Slider.cpp b/sources/ewol/widget/Slider.cpp index 1a39bfe3..bb484951 100644 --- a/sources/ewol/widget/Slider.cpp +++ b/sources/ewol/widget/Slider.cpp @@ -8,7 +8,7 @@ #include -#include +#include #include @@ -21,7 +21,7 @@ extern const char * const ewolEventSliderChange = "ewol-event-slider-change"; const int32_t dotRadius = 6; -ewol::Slider::Slider(void) +widget::Slider::Slider(void) { AddEventId(ewolEventSliderChange); @@ -34,15 +34,17 @@ ewol::Slider::Slider(void) m_textColorBg = draw::color::black; m_textColorBg.a = 0x3F; SetCanHaveFocus(true); + // Limit event at 1: + SetMouseLimit(1); } -ewol::Slider::~Slider(void) +widget::Slider::~Slider(void) { } -bool ewol::Slider::CalculateMinSize(void) +bool widget::Slider::CalculateMinSize(void) { m_minSize.x = etk_max(m_userMinSize.x, 40); m_minSize.y = etk_max(m_userMinSize.y, dotRadius*2); @@ -51,20 +53,20 @@ bool ewol::Slider::CalculateMinSize(void) } -void ewol::Slider::SetValue(int32_t val) +void widget::Slider::SetValue(int32_t val) { m_value = etk_max(etk_min(val, m_max), m_min); MarkToRedraw(); } -int32_t ewol::Slider::GetValue(void) +int32_t widget::Slider::GetValue(void) { return m_value; } -void ewol::Slider::SetMin(int32_t val) +void widget::Slider::SetMin(int32_t val) { m_min = val; m_value = etk_max(etk_min(m_value, m_max), m_min); @@ -72,7 +74,7 @@ void ewol::Slider::SetMin(int32_t val) } -void ewol::Slider::SetMax(int32_t val) +void widget::Slider::SetMax(int32_t val) { m_max = val; m_value = etk_max(etk_min(m_value, m_max), m_min); @@ -80,39 +82,40 @@ void ewol::Slider::SetMax(int32_t val) } -void ewol::Slider::OnRegenerateDisplay(void) +void widget::Slider::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { // clean the object list ... ClearOObjectList(); - ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored; + ewol::Drawing * tmpDraw = new ewol::Drawing; - tmpOObjects->SetColor(m_textColorFg); + tmpDraw->SetColor(m_textColorFg); // draw a line : - tmpOObjects->Line(dotRadius, m_size.y/2, m_size.x-dotRadius, m_size.y/2, 1); + tmpDraw->SetThickness(1); + tmpDraw->SetPos(etk::Vector3D(dotRadius, m_size.y/2) ); + tmpDraw->LineTo(etk::Vector3D(m_size.x-dotRadius, m_size.y/2) ); + tmpDraw->SetThickness(0); + draw::Color borderDot = m_textColorFg; borderDot.a /= 2; - tmpOObjects->SetColor(borderDot); - tmpOObjects->Disc(4+((float)(m_value-m_min)/(float)(m_max-m_min))*(float)(m_size.x-2*dotRadius), m_size.y/2, dotRadius); - - tmpOObjects->SetColor(m_textColorFg); - tmpOObjects->Disc(4+((float)(m_value-m_min)/(float)(m_max-m_min))*(float)(m_size.x-2*dotRadius), m_size.y/2, dotRadius/1.6); - - AddOObject(tmpOObjects); + tmpDraw->SetPos(etk::Vector3D(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->Circle(dotRadius); + tmpDraw->SetColor(m_textColorFg); + tmpDraw->Circle(dotRadius/1.6); + AddOObject(tmpDraw); } } -bool ewol::Slider::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::Slider::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { etk::Vector2D relativePos = RelativePosition(pos); //EWOL_DEBUG("Event on Slider ..."); if (1 == IdInput) { - if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent - || ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent - || ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent - || ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { + if( ewol::keyEvent::statusSingle == typeEvent + || ewol::keyEvent::statusMove == typeEvent) { // get the new position : EWOL_VERBOSE("Event on Slider (" << relativePos.x << "," << relativePos.y << ")"); int32_t oldValue = m_value; diff --git a/sources/ewol/widget/Slider.h b/sources/ewol/widget/Slider.h index 8075d200..db01b134 100644 --- a/sources/ewol/widget/Slider.h +++ b/sources/ewol/widget/Slider.h @@ -10,13 +10,14 @@ #define __EWOL_SLIDER_H__ #include +#include #include #include extern const char * const ewolEventSliderChange; -namespace ewol { - class Slider :public ewol::Drawable +namespace widget { + class Slider :public widget::Drawable { public: Slider(void); @@ -38,8 +39,8 @@ namespace ewol { int32_t m_value; int32_t m_min; int32_t m_max; - draw::Color m_textColorFg; //!< Text color - draw::Color m_textColorBg; //!< Background color + draw::Color m_textColorFg; //!< Text color + draw::Color m_textColorBg; //!< Background color public: virtual void OnRegenerateDisplay(void); public: @@ -52,7 +53,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); }; }; diff --git a/sources/ewol/widget/Spacer.cpp b/sources/ewol/widget/Spacer.cpp index 693344e6..7e452acc 100644 --- a/sources/ewol/widget/Spacer.cpp +++ b/sources/ewol/widget/Spacer.cpp @@ -8,7 +8,7 @@ #include -#include +#include #include @@ -16,7 +16,7 @@ #define __class__ "Spacer" -ewol::Spacer::Spacer(void) +widget::Spacer::Spacer(void) { m_localSize = 10; SetCanHaveFocus(false); @@ -24,13 +24,13 @@ ewol::Spacer::Spacer(void) m_color.a = 0; } -ewol::Spacer::~Spacer(void) +widget::Spacer::~Spacer(void) { } -bool ewol::Spacer::CalculateMinSize(void) +bool widget::Spacer::CalculateMinSize(void) { m_minSize.x = m_localSize; m_minSize.y = m_localSize; @@ -38,14 +38,14 @@ bool ewol::Spacer::CalculateMinSize(void) } -void ewol::Spacer::SetSize(float size) +void widget::Spacer::SetSize(float size) { m_localSize = size; MarkToRedraw(); } #define BORDER_SIZE_TMP (4) -void ewol::Spacer::OnRegenerateDisplay(void) +void widget::Spacer::OnRegenerateDisplay(void) { if (false == NeedRedraw()) { return; @@ -55,13 +55,14 @@ void ewol::Spacer::OnRegenerateDisplay(void) if (m_color.a == 0) { return; } - ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); - if (NULL == BGOObjects) { + ewol::Drawing * tmpDraw = new ewol::Drawing(); + if (NULL == tmpDraw) { return; } - AddOObject(BGOObjects); + AddOObject(tmpDraw); - BGOObjects->SetColor(m_color); - BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); + tmpDraw->SetColor(m_color); + tmpDraw->SetPos(etk::Vector3D(0, 0, 0) ); + tmpDraw->RectangleWidth(etk::Vector3D(m_size.x, m_size.y) ); } diff --git a/sources/ewol/widget/Spacer.h b/sources/ewol/widget/Spacer.h index 91a4bb89..de445bbe 100644 --- a/sources/ewol/widget/Spacer.h +++ b/sources/ewol/widget/Spacer.h @@ -10,11 +10,12 @@ #define __EWOL_SPACER_H__ #include +#include #include #include -namespace ewol { - class Spacer :public ewol::Drawable +namespace widget { + class Spacer :public widget::Drawable { public: Spacer(void); @@ -39,7 +40,7 @@ namespace ewol { virtual void OnRegenerateDisplay(void); void SetColor(draw::Color newColor) { m_color = newColor; MarkToRedraw(); }; private: - float m_localSize; + float m_localSize; draw::Color m_color; }; diff --git a/sources/ewol/widget/WSlider.cpp b/sources/ewol/widget/WSlider.cpp index 47a6e1b9..b2585085 100644 --- a/sources/ewol/widget/WSlider.cpp +++ b/sources/ewol/widget/WSlider.cpp @@ -15,7 +15,7 @@ #define __class__ "WSlider" -ewol::WSlider::WSlider(void) +widget::WSlider::WSlider(void) { // set contamination enable LockExpendContamination(); @@ -26,13 +26,13 @@ ewol::WSlider::WSlider(void) m_underExpend.y = false; } -ewol::WSlider::~WSlider(void) +widget::WSlider::~WSlider(void) { SubWidgetRemoveAll(); } -bool ewol::WSlider::CalculateSize(float availlableX, float availlableY) +bool widget::WSlider::CalculateSize(float availlableX, float availlableY) { //EWOL_DEBUG("Update Size"); m_size.x = availlableX; @@ -67,7 +67,7 @@ bool ewol::WSlider::CalculateSize(float availlableX, float availlableY) } -bool ewol::WSlider::CalculateMinSize(void) +bool widget::WSlider::CalculateMinSize(void) { EWOL_DEBUG("Calculate MinSize"); m_underExpend.x=false; @@ -91,12 +91,12 @@ bool ewol::WSlider::CalculateMinSize(void) return true; } -void ewol::WSlider::SetMinSise(float x, float y) +void widget::WSlider::SetMinSise(float x, float y) { EWOL_ERROR("Layer can not have a user Minimum size (herited from under elements)"); } -bool ewol::WSlider::CanExpentX(void) +bool widget::WSlider::CanExpentX(void) { if (m_userExpend.x == true) { return true; @@ -107,7 +107,7 @@ bool ewol::WSlider::CanExpentX(void) return m_underExpend.x; } -bool ewol::WSlider::CanExpentY(void) +bool widget::WSlider::CanExpentY(void) { if (m_userExpend.y == true) { return true; @@ -118,14 +118,14 @@ bool ewol::WSlider::CanExpentY(void) return m_underExpend.y; } -void ewol::WSlider::LockExpendContamination(bool lockExpend) +void widget::WSlider::LockExpendContamination(bool lockExpend) { m_lockExpendContamination = lockExpend; } //etk::Vector m_SubWidget; -void ewol::WSlider::SubWidgetRemoveAll(void) +void widget::WSlider::SubWidgetRemoveAll(void) { for (int32_t iii=0; iii m_subWidget.Size()) { EWOL_ERROR("Can not change to a widget not present"); @@ -191,7 +191,7 @@ void ewol::WSlider::SubWidgetSelectSet(int32_t id) } -void ewol::WSlider::PeriodicCall(int64_t localTime) +void widget::WSlider::PeriodicCall(int64_t localTime) { if (m_slidingProgress >= 1000) { // end of periodic : @@ -206,7 +206,7 @@ void ewol::WSlider::PeriodicCall(int64_t localTime) } -void ewol::WSlider::OnDraw(DrawProperty& displayProp) +void widget::WSlider::OnDraw(ewol::DrawProperty& displayProp) { if (m_windowsDestination == m_windowsSources) { //EWOL_DEBUG("Draw : " << m_windowsDestination); @@ -239,7 +239,7 @@ void ewol::WSlider::OnDraw(DrawProperty& displayProp) } -void ewol::WSlider::OnRegenerateDisplay(void) +void widget::WSlider::OnRegenerateDisplay(void) { if (m_windowsDestination == m_windowsSources) { int32_t iii = m_windowsDestination; @@ -268,7 +268,7 @@ void ewol::WSlider::OnRegenerateDisplay(void) } -ewol::Widget * ewol::WSlider::GetWidgetAtPos(etk::Vector2D pos) +ewol::Widget * widget::WSlider::GetWidgetAtPos(etk::Vector2D pos) { // TODO : Review this ... if (m_windowsDestination<0 || m_windowsDestination > m_subWidget.Size()) { @@ -294,7 +294,7 @@ ewol::Widget * ewol::WSlider::GetWidgetAtPos(etk::Vector2D pos) } -void ewol::WSlider::OnObjectRemove(ewol::EObject * removeObject) +void widget::WSlider::OnObjectRemove(ewol::EObject * removeObject) { // First step call parrent : ewol::Widget::OnObjectRemove(removeObject); diff --git a/sources/ewol/widget/WSlider.h b/sources/ewol/widget/WSlider.h index 09d2f451..1c356456 100644 --- a/sources/ewol/widget/WSlider.h +++ b/sources/ewol/widget/WSlider.h @@ -13,7 +13,7 @@ #include #include -namespace ewol { +namespace widget { class WSlider :public ewol::Widget { public: @@ -37,7 +37,7 @@ namespace ewol { void LockExpendContamination(bool lockExpend=false); private: bool m_lockExpendContamination; - etk::Vector m_subWidget; + etk::Vector m_subWidget; int32_t m_windowsSources; // widget source viewed int32_t m_windowsDestination; // widget destinated viewed int32_t m_slidingProgress; // ratio progression of a sliding @@ -50,7 +50,7 @@ namespace ewol { int32_t SubWidgetSelectGet(void) { return (int32_t)m_slidingProgress; }; int32_t SubWidgetNumber(void) { return m_subWidget.Size(); }; protected: - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); public: virtual void OnRegenerateDisplay(void); public: diff --git a/sources/ewol/widget/Widget.h b/sources/ewol/widget/Widget.h index b4e695c8..2310dece 100644 --- a/sources/ewol/widget/Widget.h +++ b/sources/ewol/widget/Widget.h @@ -341,7 +341,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { return false; }; + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { return false; }; /** * @brief Event on the keybord (if no shortcut has been detected before). * @param[in] type of the event (ewol::EVENT_KB_TYPE_DOWN or ewol::EVENT_KB_TYPE_UP) diff --git a/sources/ewol/widget/WidgetManager.cpp b/sources/ewol/widget/WidgetManager.cpp index cf8284ef..538c7b2d 100644 --- a/sources/ewol/widget/WidgetManager.cpp +++ b/sources/ewol/widget/WidgetManager.cpp @@ -35,10 +35,6 @@ void ewol::widgetManager::Init(void) l_listOfPeriodicWidget.Clear(); l_havePeriodic = false; l_haveRedraw = true; - // init all the widget global parameters : - ewol::WIDGET_JoystickInit(); - ewol::WIDGET_ButtonInit(); - ewol::WIDGET_ButtonColorInit(); //ewol::WIDGET_SceneInit(); IsInit = true; } diff --git a/sources/ewol/widget/WidgetScrolled.cpp b/sources/ewol/widget/WidgetScrolled.cpp index 04224284..ba8ebc0e 100644 --- a/sources/ewol/widget/WidgetScrolled.cpp +++ b/sources/ewol/widget/WidgetScrolled.cpp @@ -8,26 +8,26 @@ #include -#include +#include #include -#include +#include #include -ewol::WidgetScrooled::WidgetScrooled(void) +widget::WidgetScrooled::WidgetScrooled(void) { m_originScrooled.x = 0; m_originScrooled.y = 0; m_pixelScrolling = 20; m_highSpeedMode = SCROLL_DISABLE; m_scroollingMode = SCROLL_MODE_NORMAL; - m_highSpeedType = ewol::INPUT_TYPE_UNKNOW; + m_highSpeedType = ewol::keyEvent::typeUnknow; m_highSpeedButton = -1; m_limitScrolling = 0.5; } -ewol::WidgetScrooled::~WidgetScrooled(void) +widget::WidgetScrooled::~WidgetScrooled(void) { } @@ -35,57 +35,61 @@ ewol::WidgetScrooled::~WidgetScrooled(void) #define SCROLL_BAR_SPACE (15) -void ewol::WidgetScrooled::OnRegenerateDisplay(void) +void widget::WidgetScrooled::OnRegenerateDisplay(void) { ClearOObjectList(); if (SCROLL_MODE_GAME == m_scroollingMode) { } else { - ewol::OObject2DColored* myOObjectsColored = NULL; + ewol::Drawing* tmpDraw = NULL; if(m_size.y < m_maxSize.y || m_size.x < m_maxSize.x) { - myOObjectsColored = new ewol::OObject2DColored(); - myOObjectsColored->SetColor(0xFF00007F); + tmpDraw = new ewol::Drawing(); + tmpDraw->SetColor(0xFF00007F); } + if (NULL!=tmpDraw) { + return; + } + tmpDraw->SetThickness(1); if(m_size.y < m_maxSize.y) { - //myOObjectsColored->Line(m_size.x-SCROLL_BAR_SPACE, SCROLL_BAR_SPACE, m_size.x-SCROLL_BAR_SPACE, m_size.y-SCROLL_BAR_SPACE, 1); - myOObjectsColored->Line(m_size.x-(SCROLL_BAR_SPACE/2), SCROLL_BAR_SPACE, m_size.x-(SCROLL_BAR_SPACE/2), m_size.y, 1); + tmpDraw->SetPos(etk::Vector3D(m_size.x-(SCROLL_BAR_SPACE/2), 0) ); + tmpDraw->LineTo(etk::Vector3D(SCROLL_BAR_SPACE, m_size.x-(SCROLL_BAR_SPACE/2), m_size.y ) ); float lenScrollBar = m_size.y*(m_size.y-SCROLL_BAR_SPACE) / m_maxSize.y; lenScrollBar = etk_avg(10, lenScrollBar, (m_size.y-SCROLL_BAR_SPACE)); float originScrollBar = m_originScrooled.y / (m_maxSize.y-m_size.y*m_limitScrolling); originScrollBar = etk_avg(0.0, originScrollBar, 1.0); originScrollBar *= (m_size.y-SCROLL_BAR_SPACE-lenScrollBar); - myOObjectsColored->Rectangle(m_size.x-SCROLL_BAR_SPACE, m_size.y - originScrollBar - lenScrollBar, SCROLL_BAR_SPACE, lenScrollBar); + tmpDraw->SetPos(etk::Vector3D(m_size.x-SCROLL_BAR_SPACE, m_size.y - originScrollBar - lenScrollBar) ); + tmpDraw->RectangleWidth(etk::Vector3D(SCROLL_BAR_SPACE, lenScrollBar)); } if(m_size.x < m_maxSize.x) { - //myOObjectsColored->Line(SCROLL_BAR_SPACE, m_size.y-SCROLL_BAR_SPACE, m_size.x-SCROLL_BAR_SPACE, m_size.y-SCROLL_BAR_SPACE, 1); - myOObjectsColored->Line(0, (SCROLL_BAR_SPACE/2), m_size.x-SCROLL_BAR_SPACE, (SCROLL_BAR_SPACE/2), 1); + tmpDraw->SetPos(etk::Vector3D(0, (SCROLL_BAR_SPACE/2), 0) ); + tmpDraw->LineTo(etk::Vector3D(m_size.x-SCROLL_BAR_SPACE, (SCROLL_BAR_SPACE/2) ) ); float lenScrollBar = m_size.x*(m_size.x-SCROLL_BAR_SPACE) / m_maxSize.x; lenScrollBar = etk_avg(10, lenScrollBar, (m_size.x-SCROLL_BAR_SPACE)); float originScrollBar = m_originScrooled.x / (m_maxSize.x-m_size.x*m_limitScrolling); originScrollBar = etk_avg(0.0, originScrollBar, 1.0); originScrollBar *= (m_size.x-SCROLL_BAR_SPACE-lenScrollBar); - myOObjectsColored->Rectangle(originScrollBar, 0, lenScrollBar, SCROLL_BAR_SPACE); - } - if (NULL!=myOObjectsColored) { - AddOObject(myOObjectsColored); + tmpDraw->SetPos(etk::Vector3D(originScrollBar, 0, 0) ); + tmpDraw->Rectangle(etk::Vector3D(lenScrollBar, SCROLL_BAR_SPACE) ); } + AddOObject(tmpDraw); } } -bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { etk::Vector2D relativePos = RelativePosition(pos); // corection due to the open Gl invertion ... relativePos.y = m_size.y - relativePos.y; if (SCROLL_MODE_NORMAL == m_scroollingMode) { - if (ewol::INPUT_TYPE_MOUSE==type && ( ewol::INPUT_TYPE_UNKNOW==m_highSpeedType || ewol::INPUT_TYPE_MOUSE==m_highSpeedType )) { - if (1 == IdInput && ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) { + if (ewol::keyEvent::typeMouse==type && ( ewol::keyEvent::typeUnknow==m_highSpeedType || ewol::keyEvent::typeMouse==m_highSpeedType )) { + if (1 == IdInput && ewol::keyEvent::statusDown == typeEvent) { // check if selected the scrolling position whth the scrolling bar ... if (relativePos.x >= (m_size.x-SCROLL_BAR_SPACE)) { if(m_size.y < m_maxSize.y) { - m_highSpeedMode = ewol::SCROLL_ENABLE_VERTICAL; - m_highSpeedType = ewol::INPUT_TYPE_MOUSE; + m_highSpeedMode = widget::SCROLL_ENABLE_VERTICAL; + m_highSpeedType = ewol::keyEvent::typeMouse; m_highSpeedStartPos.x = relativePos.x; m_highSpeedStartPos.y = m_originScrooled.y / m_maxSize.y * (m_size.y-SCROLL_BAR_SPACE*2); m_highSpeedButton = 1; @@ -97,8 +101,8 @@ bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput } } else if (relativePos.y >= (m_size.y-SCROLL_BAR_SPACE)) { if(m_size.x < m_maxSize.x) { - m_highSpeedMode = ewol::SCROLL_ENABLE_HORIZONTAL; - m_highSpeedType = ewol::INPUT_TYPE_MOUSE; + m_highSpeedMode = widget::SCROLL_ENABLE_HORIZONTAL; + m_highSpeedType = ewol::keyEvent::typeMouse; m_highSpeedStartPos.x = m_originScrooled.x / m_maxSize.x * (m_size.x-SCROLL_BAR_SPACE*2); m_highSpeedStartPos.y = relativePos.y; m_highSpeedButton = 1; @@ -110,12 +114,13 @@ bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput } } return false; - } else if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) { + } else if (4 == IdInput && ewol::keyEvent::statusUp == typeEvent) { + /* if (true == ewol::IsSetCtrl()) { float zoom = GetZoom()*1.1; zoom = etk_avg(0.1, zoom, 5000); SetZoom(zoom); - } else { + } else */{ if(m_size.y < m_maxSize.y) { m_originScrooled.y -= m_pixelScrolling; m_originScrooled.y = etk_avg(0, m_originScrooled.y, (m_maxSize.y - m_size.y*m_limitScrolling)); @@ -123,12 +128,13 @@ bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput return true; } } - } else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) { + } else if (5 == IdInput && ewol::keyEvent::statusUp == typeEvent) { + /* if (true == ewol::IsSetCtrl()) { float zoom = GetZoom()*0.9; zoom = etk_avg(0.1, zoom, 5000); SetZoom(zoom); - } else { + } else */{ if(m_size.y < m_maxSize.y) { m_originScrooled.y += m_pixelScrolling; m_originScrooled.y = etk_avg(0, m_originScrooled.y, (m_maxSize.y - m_size.y*m_limitScrolling)); @@ -137,66 +143,67 @@ bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput } } }else if (2 == IdInput) { + /* if (true == ewol::IsSetCtrl()) { - if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) { + if (ewol::keyEvent::statusDown == typeEvent) { float zoom = 1.0; SetZoom(zoom); } - } else { - if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) { - m_highSpeedMode = ewol::SCROLL_INIT; - m_highSpeedType = ewol::INPUT_TYPE_MOUSE; + } else */{ + if (ewol::keyEvent::statusDown == typeEvent) { + m_highSpeedMode = widget::SCROLL_INIT; + m_highSpeedType = ewol::keyEvent::typeMouse; m_highSpeedStartPos.x = relativePos.x; m_highSpeedStartPos.y = relativePos.y; m_highSpeedButton = 2; return true; } } - } else if (ewol::SCROLL_DISABLE!=m_highSpeedMode && ewol::EVENT_INPUT_TYPE_LEAVE == typeEvent) { - m_highSpeedMode = ewol::SCROLL_DISABLE; - m_highSpeedType = ewol::INPUT_TYPE_UNKNOW; + } else if (widget::SCROLL_DISABLE!=m_highSpeedMode && ewol::keyEvent::statusLeave == typeEvent) { + m_highSpeedMode = widget::SCROLL_DISABLE; + m_highSpeedType = ewol::keyEvent::typeUnknow; MarkToRedraw(); return true; } - if (IdInput==m_highSpeedButton && ewol::SCROLL_DISABLE!=m_highSpeedMode) { - if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) { - if (ewol::SCROLL_INIT==m_highSpeedMode) { + if (IdInput==m_highSpeedButton && widget::SCROLL_DISABLE!=m_highSpeedMode) { + if (ewol::keyEvent::statusUp == typeEvent) { + if (widget::SCROLL_INIT==m_highSpeedMode) { // TODO : Generate back the down event ... - m_highSpeedMode = ewol::SCROLL_DISABLE; - m_highSpeedType = ewol::INPUT_TYPE_UNKNOW; + m_highSpeedMode = widget::SCROLL_DISABLE; + m_highSpeedType = ewol::keyEvent::typeUnknow; return false; } else { - m_highSpeedMode = ewol::SCROLL_GREP_END_EVENT; + m_highSpeedMode = widget::SCROLL_GREP_END_EVENT; MarkToRedraw(); return true; } - } else if (ewol::SCROLL_GREP_END_EVENT == m_highSpeedMode) { - if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) { - m_highSpeedMode = ewol::SCROLL_DISABLE; - m_highSpeedType = ewol::INPUT_TYPE_UNKNOW; + } else if (widget::SCROLL_GREP_END_EVENT == m_highSpeedMode) { + if (ewol::keyEvent::statusSingle == typeEvent) { + m_highSpeedMode = widget::SCROLL_DISABLE; + m_highSpeedType = ewol::keyEvent::typeUnknow; m_highSpeedButton = -1; MarkToRedraw(); } return true; - } else if (ewol::SCROLL_INIT==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { + } else if (widget::SCROLL_INIT==m_highSpeedMode && ewol::keyEvent::statusMove == typeEvent) { // wait that the cursor move more than 10 px to enable it : if( abs(relativePos.x - m_highSpeedStartPos.x) > 10 || abs(relativePos.y - m_highSpeedStartPos.y) > 10 ) { // the scrooling can start : // select the direction : if (relativePos.x == m_highSpeedStartPos.x) { - m_highSpeedMode = ewol::SCROLL_ENABLE_VERTICAL; + m_highSpeedMode = widget::SCROLL_ENABLE_VERTICAL; } else if (relativePos.y == m_highSpeedStartPos.y) { - m_highSpeedMode = ewol::SCROLL_ENABLE_HORIZONTAL; + m_highSpeedMode = widget::SCROLL_ENABLE_HORIZONTAL; } else { float coef = (relativePos.y - m_highSpeedStartPos.y) / (relativePos.x - m_highSpeedStartPos.x); if (abs(coef) <= 1 ) { - m_highSpeedMode = ewol::SCROLL_ENABLE_HORIZONTAL; + m_highSpeedMode = widget::SCROLL_ENABLE_HORIZONTAL; } else { - m_highSpeedMode = ewol::SCROLL_ENABLE_VERTICAL; + m_highSpeedMode = widget::SCROLL_ENABLE_VERTICAL; } } - if (m_highSpeedMode == ewol::SCROLL_ENABLE_HORIZONTAL) { + if (m_highSpeedMode == widget::SCROLL_ENABLE_HORIZONTAL) { m_highSpeedStartPos.x = m_originScrooled.x / m_maxSize.x * (m_size.x-SCROLL_BAR_SPACE*2); } else { m_highSpeedStartPos.y = m_originScrooled.y / m_maxSize.y * (m_size.y-SCROLL_BAR_SPACE*2); @@ -205,46 +212,46 @@ bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput } m_originScrooled.y = etk_avg(0, m_originScrooled.y, (m_maxSize.y - m_size.y*m_limitScrolling)); return true; - } if (ewol::SCROLL_ENABLE_HORIZONTAL==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { + } if (widget::SCROLL_ENABLE_HORIZONTAL==m_highSpeedMode && ewol::keyEvent::statusMove == typeEvent) { m_originScrooled.x = (int32_t)(m_maxSize.x * (relativePos.x-SCROLL_BAR_SPACE) / (m_size.x-SCROLL_BAR_SPACE*2)); m_originScrooled.x = etk_avg(0, m_originScrooled.x, (m_maxSize.x - m_size.x*m_limitScrolling)); MarkToRedraw(); return true; - } if (ewol::SCROLL_ENABLE_VERTICAL==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { + } if (widget::SCROLL_ENABLE_VERTICAL==m_highSpeedMode && ewol::keyEvent::statusMove == typeEvent) { m_originScrooled.y = (int32_t)(m_maxSize.y * (relativePos.y-SCROLL_BAR_SPACE) / (m_size.y-SCROLL_BAR_SPACE*2)); m_originScrooled.y = etk_avg(0, m_originScrooled.y, (m_maxSize.y - m_size.y*m_limitScrolling)); MarkToRedraw(); return true; } } - } else if (ewol::INPUT_TYPE_FINGER==type && ( ewol::INPUT_TYPE_UNKNOW==m_highSpeedType || ewol::INPUT_TYPE_FINGER==m_highSpeedType )) { + } else if (ewol::keyEvent::typeFinger==type && ( ewol::keyEvent::typeUnknow==m_highSpeedType || ewol::keyEvent::typeFinger==m_highSpeedType )) { if (1 == IdInput) { EWOL_VERBOSE("event 1 << " << (int32_t)typeEvent << "(" << x << "," << y << ")"); - if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) { - m_highSpeedMode = ewol::SCROLL_INIT; - m_highSpeedType = ewol::INPUT_TYPE_FINGER; + if (ewol::keyEvent::statusDown == typeEvent) { + m_highSpeedMode = widget::SCROLL_INIT; + m_highSpeedType = ewol::keyEvent::typeFinger; m_highSpeedStartPos.x = relativePos.x; m_highSpeedStartPos.y = relativePos.y; EWOL_VERBOSE("SCROOL ==> INIT"); return true; - } else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) { - m_highSpeedMode = ewol::SCROLL_DISABLE; - m_highSpeedType = ewol::INPUT_TYPE_UNKNOW; + } else if (ewol::keyEvent::statusUp == typeEvent) { + m_highSpeedMode = widget::SCROLL_DISABLE; + m_highSpeedType = ewol::keyEvent::typeUnknow; EWOL_VERBOSE("SCROOL ==> DISABLE"); MarkToRedraw(); return true; - } else if (ewol::SCROLL_INIT==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { + } else if (widget::SCROLL_INIT==m_highSpeedMode && ewol::keyEvent::statusMove == typeEvent) { // wait that the cursor move more than 10 px to enable it : if( abs(relativePos.x - m_highSpeedStartPos.x) > 10 || abs(relativePos.y - m_highSpeedStartPos.y) > 10 ) { // the scrooling can start : // select the direction : - m_highSpeedMode = ewol::SCROLL_ENABLE_FINGER; + m_highSpeedMode = widget::SCROLL_ENABLE_FINGER; EWOL_VERBOSE("SCROOL ==> ENABLE"); MarkToRedraw(); } return true; - } if (ewol::SCROLL_ENABLE_FINGER==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) { + } if (widget::SCROLL_ENABLE_FINGER==m_highSpeedMode && ewol::keyEvent::statusMove == typeEvent) { //m_originScrooled.x = (int32_t)(m_maxSize.x * x / m_size.x); m_originScrooled.x -= relativePos.x - m_highSpeedStartPos.x; m_originScrooled.y -= relativePos.y - m_highSpeedStartPos.y; @@ -256,21 +263,21 @@ bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput MarkToRedraw(); return true; } - } else if (ewol::SCROLL_DISABLE!=m_highSpeedMode && ewol::EVENT_INPUT_TYPE_LEAVE == typeEvent) { - m_highSpeedMode = ewol::SCROLL_DISABLE; - m_highSpeedType = ewol::INPUT_TYPE_UNKNOW; + } else if (widget::SCROLL_DISABLE!=m_highSpeedMode && ewol::keyEvent::statusLeave == typeEvent) { + m_highSpeedMode = widget::SCROLL_DISABLE; + m_highSpeedType = ewol::keyEvent::typeUnknow; EWOL_VERBOSE("SCROOL ==> DISABLE"); MarkToRedraw(); return true; } } } else if (SCROLL_MODE_CENTER == m_scroollingMode) { - if (ewol::INPUT_TYPE_MOUSE==type) { - float tmp1=ewol::GetCurrentHeight() / m_maxSize.y; - float tmp2=ewol::GetCurrentWidth() / m_maxSize.x; + if (ewol::keyEvent::typeMouse==type) { + float tmp1=m_size.x / m_maxSize.y; + float tmp2=m_size.y / m_maxSize.x; //EWOL_INFO(" elements Zoom : " << tmp1 << " " << tmp2); tmp1 = etk_min(tmp1, tmp2); - if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) { + if (4 == IdInput && ewol::keyEvent::statusUp == typeEvent) { m_zoom -= 0.1; if (tmp1 < 1.0) { m_zoom = etk_max(tmp1, m_zoom); @@ -279,7 +286,7 @@ bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput } MarkToRedraw(); return true; - } else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) { + } else if (5 == IdInput && ewol::keyEvent::statusUp == typeEvent) { m_zoom += 0.1; if (tmp1 > 1.0) { m_zoom = etk_min(tmp1, m_zoom); @@ -298,7 +305,7 @@ bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput return false; } -void ewol::WidgetScrooled::AddOObject(ewol::OObject* newObject, int32_t pos) +void widget::WidgetScrooled::AddOObject(ewol::Compositing* newObject, int32_t pos) { if (NULL == newObject) { EWOL_ERROR("Try to add an empty object in the Widget generic display system"); @@ -312,7 +319,7 @@ void ewol::WidgetScrooled::AddOObject(ewol::OObject* newObject, int32_t pos) } -void ewol::WidgetScrooled::ClearOObjectList(void) +void widget::WidgetScrooled::ClearOObjectList(void) { for (int32_t iii=0; iii(m_zoom, m_zoom, 1.0) ); + etk::Matrix4 tmpTranslate = etk::Matrix4::Translate(etk::Vector3D(-m_maxSize.x/2, -m_maxSize.y/2, -1.0) ); etk::Matrix4 tmpMat = tmpProjection * tmpScale * tmpTranslate; // set internal matrix system : ewol::openGL::SetMatrix(tmpMat); @@ -355,8 +362,8 @@ void ewol::WidgetScrooled::GenDraw(DrawProperty displayProp) m_size.x, m_size.y); - etk::Matrix4 tmpProjection = etk::matrix::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1); - etk::Matrix4 tmpTranslate = etk::matrix::Translate(-m_maxSize.x/2, -m_maxSize.y/2, -1.0); + etk::Matrix4 tmpProjection = etk::Matrix4::Perspective(-m_size.x/2, m_size.x/2, -m_size.y/2, m_size.y/2, -1, 1); + etk::Matrix4 tmpTranslate = etk::Matrix4::Translate(etk::Vector3D( -m_maxSize.x/2, -m_maxSize.y/2, -1.0) ); etk::Matrix4 tmpMat = tmpProjection * tmpTranslate; // set internal matrix system : ewol::openGL::SetMatrix(tmpMat); @@ -369,7 +376,7 @@ void ewol::WidgetScrooled::GenDraw(DrawProperty displayProp) } -void ewol::WidgetScrooled::SetScrollingPositionDynamic(etk::Vector2D borderWidth, etk::Vector2D currentPosition, bool center) +void widget::WidgetScrooled::SetScrollingPositionDynamic(etk::Vector2D borderWidth, etk::Vector2D currentPosition, bool center) { if (true == center) { borderWidth.x = m_size.x / 2 - borderWidth.x; @@ -394,12 +401,12 @@ void ewol::WidgetScrooled::SetScrollingPositionDynamic(etk::Vector2D bord } -void ewol::WidgetScrooled::ScroolingMode(scrollingMode_te newMode) +void widget::WidgetScrooled::ScroolingMode(scrollingMode_te newMode) { m_scroollingMode = newMode; if (SCROLL_MODE_GAME == m_scroollingMode) { // set the scene maximum size : - m_maxSize.x = etk_max(ewol::GetCurrentHeight(), ewol::GetCurrentWidth()); + m_maxSize.x = etk_max(m_size.x, m_size.y); m_maxSize.y = m_maxSize.x; m_zoom = 1; } diff --git a/sources/ewol/widget/WidgetScrolled.h b/sources/ewol/widget/WidgetScrolled.h index 72cc4b40..c628d571 100644 --- a/sources/ewol/widget/WidgetScrolled.h +++ b/sources/ewol/widget/WidgetScrolled.h @@ -12,8 +12,9 @@ #include #include #include +#include -namespace ewol { +namespace widget { typedef enum { SCROLL_DISABLE, SCROLL_INIT, @@ -31,20 +32,20 @@ namespace ewol { class WidgetScrooled : public ewol::Widget { private: - etk::Vector m_listOObject; //!< generic element to display... - void AddOObject(ewol::OObject* newObject, int32_t pos=-1); + etk::Vector m_listOObject; //!< generic element to display... + void AddOObject(ewol::Compositing* newObject, int32_t pos=-1); void ClearOObjectList(void); protected: - etk::Vector2D m_originScrooled; - etk::Vector2D m_maxSize; - float m_limitScrolling; + etk::Vector2D m_originScrooled; + etk::Vector2D m_maxSize; + float m_limitScrolling; private: - scrollingMode_te m_scroollingMode; //!< mode of management of the scrooling - float m_pixelScrolling; + scrollingMode_te m_scroollingMode; //!< mode of management of the scrooling + float m_pixelScrolling; etk::Vector2D m_highSpeedStartPos; - highSpeedMode_te m_highSpeedMode; - int32_t m_highSpeedButton; - ewol::inputType_te m_highSpeedType; + highSpeedMode_te m_highSpeedMode; + int32_t m_highSpeedButton; + ewol::keyEvent::type_te m_highSpeedType; public: WidgetScrooled(void); virtual ~WidgetScrooled(void); @@ -56,7 +57,7 @@ namespace ewol { */ virtual const char * const GetObjectType(void) { return "EwolWidgetScrooled"; }; virtual void OnRegenerateDisplay(void); - virtual void OnDraw(DrawProperty& displayProp); + virtual void OnDraw(ewol::DrawProperty& displayProp); /** * @brief Event on an input of this Widget * @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...) @@ -66,7 +67,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D pos); + virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); /** * @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...]) * This function generate a clipping with the viewport openGL system. Like this a widget draw can not draw over an other widget @@ -74,7 +75,7 @@ namespace ewol { * @param --- * @return --- */ - virtual void GenDraw(DrawProperty displayProp); + virtual void GenDraw(ewol::DrawProperty displayProp); protected: /** * @brief For mouse event when we have a scrolling UP and dows, specify the number of pixel that we scrooled diff --git a/sources/ewol/widget/Windows.cpp b/sources/ewol/widget/Windows.cpp index 0c79d906..167c7883 100644 --- a/sources/ewol/widget/Windows.cpp +++ b/sources/ewol/widget/Windows.cpp @@ -6,18 +6,14 @@ * @license BSD v3 (see license file) */ -#include +#include #include +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include #include -#include diff --git a/sources/ewol/widget/meta/ColorChooser.cpp b/sources/ewol/widget/meta/ColorChooser.cpp index f4853a94..8320777a 100644 --- a/sources/ewol/widget/meta/ColorChooser.cpp +++ b/sources/ewol/widget/meta/ColorChooser.cpp @@ -45,7 +45,7 @@ ewol::ColorChooser::ColorChooser(void) m_widgetAlpha = NULL; LockExpendContamination(true); - m_widgetColorBar = new ewol::ColorBar(); + m_widgetColorBar = new widget::ColorBar(); m_widgetColorBar->RegisterOnEvent(this, ewolEventColorBarChange, eventColorBarHasChange); m_widgetColorBar->SetFillY(true); m_widgetColorBar->SetFillX(true); @@ -58,7 +58,7 @@ ewol::ColorChooser::ColorChooser(void) draw::Color sliderColor; sliderColor = draw::color::black; - m_widgetRed = new ewol::Slider(); + m_widgetRed = new widget::Slider(); m_widgetRed->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetRed->SetExpendX(true); m_widgetRed->SetFillX(true); @@ -67,7 +67,7 @@ ewol::ColorChooser::ColorChooser(void) sliderColor = 0xFF0000FF; m_widgetRed->SetColor(sliderColor); SubWidgetAdd(m_widgetRed); - m_widgetGreen = new ewol::Slider(); + m_widgetGreen = new widget::Slider(); m_widgetGreen->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetGreen->SetExpendX(true); m_widgetGreen->SetFillX(true); @@ -76,7 +76,7 @@ ewol::ColorChooser::ColorChooser(void) m_widgetGreen->SetColor(sliderColor); m_widgetGreen->SetMax(255); SubWidgetAdd(m_widgetGreen); - m_widgetBlue = new ewol::Slider(); + m_widgetBlue = new widget::Slider(); m_widgetBlue->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetBlue->SetExpendX(true); m_widgetBlue->SetFillX(true); @@ -85,7 +85,7 @@ ewol::ColorChooser::ColorChooser(void) m_widgetBlue->SetColor(sliderColor); m_widgetBlue->SetMax(255); SubWidgetAdd(m_widgetBlue); - m_widgetAlpha = new ewol::Slider(); + m_widgetAlpha = new widget::Slider(); m_widgetAlpha->RegisterOnEvent(this, ewolEventSliderChange, eventColorSpecificHasChange); m_widgetAlpha->SetExpendX(true); m_widgetAlpha->SetFillX(true); @@ -184,7 +184,7 @@ void ewol::ColorChooser::OnReceiveMessage(ewol::EObject * CallerObject, const ch void ewol::ColorChooser::OnObjectRemove(ewol::EObject * removeObject) { // First step call parrent : - ewol::SizerVert::OnObjectRemove(removeObject); + widget::SizerVert::OnObjectRemove(removeObject); // second step find if in all the elements ... if(removeObject == m_widgetRed) { m_widgetRed = NULL; diff --git a/sources/ewol/widget/meta/ColorChooser.h b/sources/ewol/widget/meta/ColorChooser.h index 0a27ea93..5767d254 100644 --- a/sources/ewol/widget/meta/ColorChooser.h +++ b/sources/ewol/widget/meta/ColorChooser.h @@ -9,8 +9,8 @@ #ifndef __EWOL_COLOR_CHOOSER_H__ #define __EWOL_COLOR_CHOOSER_H__ -#include -#include +#include +#include #include #include #include @@ -22,7 +22,7 @@ extern const char * const ewolEventColorChooserChange; namespace ewol { - class ColorChooser : public ewol::SizerVert + class ColorChooser : public widget::SizerVert { public: ColorChooser(void); @@ -53,12 +53,12 @@ namespace ewol { void SetColor(draw::Color newColor); draw::Color GetColor(void); private:; - ewol::ColorBar* m_widgetColorBar; - ewol::Slider* m_widgetRed; - ewol::Slider* m_widgetGreen; - ewol::Slider* m_widgetBlue; - ewol::Slider* m_widgetAlpha; - draw::Color m_currentColor; + widget::ColorBar* m_widgetColorBar; + widget::Slider* m_widgetRed; + widget::Slider* m_widgetGreen; + widget::Slider* m_widgetBlue; + widget::Slider* m_widgetAlpha; + draw::Color m_currentColor; }; }; diff --git a/sources/ewol/widget/meta/FileChooser.cpp b/sources/ewol/widget/meta/FileChooser.cpp index c8606abc..56e6ec85 100644 --- a/sources/ewol/widget/meta/FileChooser.cpp +++ b/sources/ewol/widget/meta/FileChooser.cpp @@ -78,11 +78,11 @@ ewol::FileChooser::FileChooser(void) m_widgetListFile = NULL; m_widgetCheckBox = NULL; - ewol::SizerVert * mySizerVert = NULL; - ewol::SizerHori * mySizerHori = NULL; - ewol::Spacer * mySpacer = NULL; - //ewol::Label * myLabel = NULL; - ewol::Image * myImage = NULL; + widget::SizerVert * mySizerVert = NULL; + widget::SizerHori * mySizerHori = NULL; + widget::Spacer * mySpacer = NULL; + //widget::Label * myLabel = NULL; + widget::Image * myImage = NULL; #if defined(__TARGET_OS__Android) m_folder = "/mnt/sdcard/"; SetDisplayRatio(0.90); @@ -95,7 +95,7 @@ ewol::FileChooser::FileChooser(void) #endif m_file = ""; - mySizerVert = new ewol::SizerVert(); + mySizerVert = new widget::SizerVert(); if (NULL == mySizerVert) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -103,12 +103,12 @@ ewol::FileChooser::FileChooser(void) // set it in the pop-up-system : SubWidgetSet(mySizerVert); - mySizerHori = new ewol::SizerHori(); + mySizerHori = new widget::SizerHori(); if (NULL == mySizerHori) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { mySizerVert->SubWidgetAdd(mySizerHori); - m_widgetCheckBox = new ewol::CheckBox("Show hiden files"); + m_widgetCheckBox = new widget::CheckBox("Show hiden files"); if (NULL == m_widgetCheckBox) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -116,14 +116,14 @@ ewol::FileChooser::FileChooser(void) m_widgetCheckBox->SetValue(false); mySizerHori->SubWidgetAdd(m_widgetCheckBox); } - mySpacer = new ewol::Spacer(); + mySpacer = new widget::Spacer(); if (NULL == mySpacer) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { mySpacer->SetExpendX(true); mySizerHori->SubWidgetAdd(mySpacer); } - m_widgetValidate = new ewol::Button("Validate"); + m_widgetValidate = new widget::Button("Validate"); if (NULL == m_widgetValidate) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -131,7 +131,7 @@ ewol::FileChooser::FileChooser(void) m_widgetValidate->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventFileChooserValidate); mySizerHori->SubWidgetAdd(m_widgetValidate); } - m_widgetCancel = new ewol::Button("Cancel"); + m_widgetCancel = new widget::Button("Cancel"); if (NULL == m_widgetCancel) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -140,19 +140,19 @@ ewol::FileChooser::FileChooser(void) mySizerHori->SubWidgetAdd(m_widgetCancel); } } - mySizerHori = new ewol::SizerHori(); + mySizerHori = new widget::SizerHori(); if (NULL == mySizerHori) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { mySizerVert->SubWidgetAdd(mySizerHori); - mySpacer = new ewol::Spacer(); + mySpacer = new widget::Spacer(); if (NULL == mySpacer) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { mySpacer->SetSize(2); mySizerHori->SubWidgetAdd(mySpacer); } - m_widgetListFolder = new ListFileSystem(); + m_widgetListFolder = new widget::ListFileSystem(); if (NULL == m_widgetListFolder) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -164,14 +164,14 @@ ewol::FileChooser::FileChooser(void) m_widgetListFolder->SetFillY(true); mySizerHori->SubWidgetAdd(m_widgetListFolder); } - mySpacer = new ewol::Spacer(); + mySpacer = new widget::Spacer(); if (NULL == mySpacer) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { mySpacer->SetSize(2); mySizerHori->SubWidgetAdd(mySpacer); } - m_widgetListFile = new ListFileSystem(); + m_widgetListFile = new widget::ListFileSystem(); if (NULL == m_widgetListFile) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -186,7 +186,7 @@ ewol::FileChooser::FileChooser(void) m_widgetListFile->SetFillY(true); mySizerHori->SubWidgetAdd(m_widgetListFile); } - mySpacer = new ewol::Spacer(); + mySpacer = new widget::Spacer(); if (NULL == mySpacer) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -194,19 +194,19 @@ ewol::FileChooser::FileChooser(void) mySizerHori->SubWidgetAdd(mySpacer); } } - mySizerHori = new ewol::SizerHori(); + mySizerHori = new widget::SizerHori(); if (NULL == mySizerHori) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { mySizerVert->SubWidgetAdd(mySizerHori); - myImage = new ewol::Image("THEME:GUI:File.svg"); + myImage = new widget::Image("THEME:GUI:File.svg"); if (NULL == myImage) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { myImage->SetFillY(true); mySizerHori->SubWidgetAdd(myImage); } - m_widgetCurrentFileName = new ewol::Entry(m_file); + m_widgetCurrentFileName = new widget::Entry(m_file); if (NULL == m_widgetCurrentFileName) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -218,12 +218,12 @@ ewol::FileChooser::FileChooser(void) mySizerHori->SubWidgetAdd(m_widgetCurrentFileName); } } - mySizerHori = new ewol::SizerHori(); + mySizerHori = new widget::SizerHori(); if (NULL == mySizerHori) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { mySizerVert->SubWidgetAdd(mySizerHori); - myImage = new ewol::Image("THEME:GUI:Folder.svg"); + myImage = new widget::Image("THEME:GUI:Folder.svg"); if (NULL == myImage) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -231,7 +231,7 @@ ewol::FileChooser::FileChooser(void) mySizerHori->SubWidgetAdd(myImage); } - m_widgetCurrentFolder = new ewol::Entry(m_folder); + m_widgetCurrentFolder = new widget::Entry(m_folder); if (NULL == m_widgetCurrentFolder) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -242,7 +242,7 @@ ewol::FileChooser::FileChooser(void) m_widgetCurrentFolder->SetWidth(200); mySizerHori->SubWidgetAdd(m_widgetCurrentFolder); } - myImage = new ewol::Image("THEME:GUI:Home.svg"); + myImage = new widget::Image("THEME:GUI:Home.svg"); if (NULL == myImage) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -252,7 +252,7 @@ ewol::FileChooser::FileChooser(void) } } - m_widgetTitle = new ewol::Label("File chooser ..."); + m_widgetTitle = new widget::Label("File chooser ..."); if (NULL == m_widgetTitle) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -427,7 +427,7 @@ etk::UString ewol::FileChooser::GetCompleateFileName(void) void ewol::FileChooser::OnObjectRemove(ewol::EObject * removeObject) { // First step call parrent : - ewol::PopUp::OnObjectRemove(removeObject); + widget::PopUp::OnObjectRemove(removeObject); // second step find if in all the elements ... if(removeObject == m_widgetTitle) { m_widgetTitle = NULL; diff --git a/sources/ewol/widget/meta/FileChooser.h b/sources/ewol/widget/meta/FileChooser.h index 3e8ef637..ec899f09 100644 --- a/sources/ewol/widget/meta/FileChooser.h +++ b/sources/ewol/widget/meta/FileChooser.h @@ -9,8 +9,8 @@ #ifndef __EWOL_FILE_CHOOSER_H__ #define __EWOL_FILE_CHOOSER_H__ -#include -#include +#include +#include #include #include #include @@ -22,7 +22,7 @@ extern const char * const ewolEventFileChooserCancel; extern const char * const ewolEventFileChooserValidate; namespace ewol { - class FileChooser : public ewol::PopUp + class FileChooser : public widget::PopUp { public: FileChooser(void); @@ -57,14 +57,14 @@ namespace ewol { etk::UString GetCompleateFileName(void); void UpdateCurrentFolder(void); private: - ewol::Label* m_widgetTitle; - ewol::Button* m_widgetValidate; - ewol::Button* m_widgetCancel; - ewol::Entry* m_widgetCurrentFolder; - ewol::Entry* m_widgetCurrentFileName; - ewol::ListFileSystem* m_widgetListFolder; - ewol::ListFileSystem* m_widgetListFile; - ewol::CheckBox* m_widgetCheckBox; + widget::Label* m_widgetTitle; + widget::Button* m_widgetValidate; + widget::Button* m_widgetCancel; + widget::Entry* m_widgetCurrentFolder; + widget::Entry* m_widgetCurrentFileName; + widget::ListFileSystem* m_widgetListFolder; + widget::ListFileSystem* m_widgetListFile; + widget::CheckBox* m_widgetCheckBox; etk::UString m_folder; etk::UString m_file; }; diff --git a/sources/ewol/widget/meta/Parameter.cpp b/sources/ewol/widget/meta/Parameter.cpp index cdd88026..3c49ebba 100644 --- a/sources/ewol/widget/meta/Parameter.cpp +++ b/sources/ewol/widget/meta/Parameter.cpp @@ -27,7 +27,7 @@ extern const char * const ewolEventParameterClose = "ewol-event-pa static const char * const l_eventMenuSelected = "local-event-menu-selected"; -ewol::Parameter::Parameter(void) : +widget::Parameter::Parameter(void) : m_currentIdList(0), m_widgetTitle(NULL), m_widgetCancel(NULL), @@ -35,16 +35,16 @@ ewol::Parameter::Parameter(void) : { AddEventId(ewolEventParameterClose); - ewol::SizerVert * mySizerVert = NULL; - ewol::SizerHori * mySizerHori = NULL; - ewol::Spacer * mySpacer = NULL; + widget::SizerVert * mySizerVert = NULL; + widget::SizerHori * mySizerHori = NULL; + widget::Spacer * mySpacer = NULL; #ifdef __TARGET_OS__Android SetDisplayRatio(0.90); #else SetDisplayRatio(0.80); #endif - mySizerVert = new ewol::SizerVert(); + mySizerVert = new widget::SizerVert(); if (NULL == mySizerVert) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -53,13 +53,13 @@ ewol::Parameter::Parameter(void) : // set it in the pop-up-system : SubWidgetSet(mySizerVert); - mySizerHori = new ewol::SizerHori(); + mySizerHori = new widget::SizerHori(); if (NULL == mySizerHori) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { mySizerVert->SubWidgetAdd(mySizerHori); - mySpacer = new ewol::Spacer(); + mySpacer = new widget::Spacer(); if (NULL == mySpacer) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -67,7 +67,7 @@ ewol::Parameter::Parameter(void) : mySizerHori->SubWidgetAdd(mySpacer); } - m_widgetCancel = new ewol::Button("Close"); + m_widgetCancel = new widget::Button("Close"); if (NULL == m_widgetCancel) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -77,13 +77,13 @@ ewol::Parameter::Parameter(void) : } } - mySizerHori = new ewol::SizerHori(); + mySizerHori = new widget::SizerHori(); if (NULL == mySizerHori) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { mySizerVert->SubWidgetAdd(mySizerHori); - m_paramList = new ewol::ParameterList(); + m_paramList = new widget::ParameterList(); if (NULL == m_paramList) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -93,7 +93,7 @@ ewol::Parameter::Parameter(void) : m_paramList->SetExpendY(true); mySizerHori->SubWidgetAdd(m_paramList); } - mySpacer = new ewol::Spacer(); + mySpacer = new widget::Spacer(); if (NULL == mySpacer) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -103,13 +103,13 @@ ewol::Parameter::Parameter(void) : mySizerHori->SubWidgetAdd(mySpacer); } - ewol::SizerVert * mySizerVert2 = new ewol::SizerVert(); + widget::SizerVert * mySizerVert2 = new widget::SizerVert(); if (NULL == mySizerVert2) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { mySizerHori->SubWidgetAdd(mySizerVert2); - mySpacer = new ewol::Spacer(); + mySpacer = new widget::Spacer(); if (NULL == mySpacer) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -119,7 +119,7 @@ ewol::Parameter::Parameter(void) : mySizerVert2->SubWidgetAdd(mySpacer); } - m_wSlider = new ewol::WSlider(); + m_wSlider = new widget::WSlider(); if (NULL == m_wSlider) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -130,7 +130,7 @@ ewol::Parameter::Parameter(void) : } } - mySpacer = new ewol::Spacer(); + mySpacer = new widget::Spacer(); if (NULL == mySpacer) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -140,7 +140,7 @@ ewol::Parameter::Parameter(void) : mySizerVert->SubWidgetAdd(mySpacer); } - m_widgetTitle = new ewol::Label("File chooser ..."); + m_widgetTitle = new widget::Label("File chooser ..."); if (NULL == m_widgetTitle) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -153,13 +153,13 @@ ewol::Parameter::Parameter(void) : } -ewol::Parameter::~Parameter(void) +widget::Parameter::~Parameter(void) { } -void ewol::Parameter::SetTitle(etk::UString label) +void widget::Parameter::SetTitle(etk::UString label) { if (NULL == m_widgetTitle) { return; @@ -168,9 +168,9 @@ void ewol::Parameter::SetTitle(etk::UString label) } -void ewol::Parameter::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) +void widget::Parameter::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data) { - ewol::PopUp::OnReceiveMessage(CallerObject, eventId, data); + widget::PopUp::OnReceiveMessage(CallerObject, eventId, data); EWOL_DEBUG("event on the parameter : " << eventId << " data=\"" << data << "\""); if (eventId == ewolEventParameterClose) { // inform that the parameter windows is closed @@ -190,10 +190,10 @@ void ewol::Parameter::OnReceiveMessage(ewol::EObject * CallerObject, const char }; -void ewol::Parameter::OnObjectRemove(ewol::EObject * removeObject) +void widget::Parameter::OnObjectRemove(ewol::EObject * removeObject) { // First step call parrent : - ewol::PopUp::OnObjectRemove(removeObject); + widget::PopUp::OnObjectRemove(removeObject); // second step find if in all the elements ... if(removeObject == m_widgetTitle) { m_widgetTitle = NULL; @@ -210,7 +210,7 @@ void ewol::Parameter::OnObjectRemove(ewol::EObject * removeObject) } -void ewol::Parameter::MenuAdd(etk::UString label, etk::UString image, ewol::Widget* associateWidget) +void widget::Parameter::MenuAdd(etk::UString label, etk::UString image, ewol::Widget* associateWidget) { if (NULL != m_paramList) { m_paramList->MenuAdd(label, m_currentIdList, image); @@ -219,7 +219,7 @@ void ewol::Parameter::MenuAdd(etk::UString label, etk::UString image, ewol::Widg m_wSlider->SubWidgetAdd(associateWidget); } else { EWOL_DEBUG("Associate an empty widget on it ..."); - ewol::Label * myLabel = new ewol::Label((etk::UString("No widget for : ") + label)); + widget::Label * myLabel = new widget::Label((etk::UString("No widget for : ") + label)); if (NULL == myLabel) { EWOL_ERROR("Can not allocate widget ==> display might be in error"); } else { @@ -235,7 +235,7 @@ void ewol::Parameter::MenuAdd(etk::UString label, etk::UString image, ewol::Widg m_currentIdList++; } } -void ewol::Parameter::MenuAddGroup(etk::UString label) +void widget::Parameter::MenuAddGroup(etk::UString label) { if (NULL != m_paramList) { m_paramList->MenuSeparator(); @@ -243,7 +243,7 @@ void ewol::Parameter::MenuAddGroup(etk::UString label) } } -void ewol::Parameter::MenuClear(void) +void widget::Parameter::MenuClear(void) { if (NULL != m_paramList) { m_paramList->MenuClear(); @@ -251,7 +251,7 @@ void ewol::Parameter::MenuClear(void) } } -void ewol::Parameter::MenuSeparator(void) +void widget::Parameter::MenuSeparator(void) { if (NULL != m_paramList) { m_paramList->MenuSeparator(); diff --git a/sources/ewol/widget/meta/Parameter.h b/sources/ewol/widget/meta/Parameter.h index e80174f9..0bdac3ef 100644 --- a/sources/ewol/widget/meta/Parameter.h +++ b/sources/ewol/widget/meta/Parameter.h @@ -9,9 +9,9 @@ #ifndef __EWOL_WIDGET_PARAMETER_H__ #define __EWOL_WIDGET_PARAMETER_H__ -#include +#include #include -#include +#include #include #include #include @@ -22,8 +22,8 @@ extern const char * const ewolEventParameterClose; -namespace ewol { - class Parameter : public ewol::PopUp +namespace widget { + class Parameter : public widget::PopUp { public: Parameter(void); @@ -57,11 +57,11 @@ namespace ewol { void MenuClear(void); void MenuSeparator(void); private: - int32_t m_currentIdList; - ewol::Label* m_widgetTitle; - ewol::Button* m_widgetCancel; - ewol::ParameterList* m_paramList; - ewol::WSlider* m_wSlider; + int32_t m_currentIdList; + widget::Label* m_widgetTitle; + widget::Button* m_widgetCancel; + widget::ParameterList* m_paramList; + widget::WSlider* m_wSlider; }; }; diff --git a/sources/ewol/widget/meta/ParameterList.cpp b/sources/ewol/widget/meta/ParameterList.cpp index a4198038..451989aa 100644 --- a/sources/ewol/widget/meta/ParameterList.cpp +++ b/sources/ewol/widget/meta/ParameterList.cpp @@ -9,22 +9,23 @@ #include #include +#include + +#include +#include +#include #undef __class__ #define __class__ "ParameterList" extern const char * const ewolEventParameterListSelect = "ewol-event-parameter-list-select"; -#include - -#include -#include #undef __class__ #define __class__ "List" -ewol::ParameterList::ParameterList(void) +widget::ParameterList::ParameterList(void) { AddEventId(ewolEventParameterListSelect); @@ -38,7 +39,7 @@ ewol::ParameterList::ParameterList(void) SetCanHaveFocus(true); } -ewol::ParameterList::~ParameterList(void) +widget::ParameterList::~ParameterList(void) { //clean all the object for (int32_t iii=0; iii listSizeColomn; // set background color : - ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); - BGOObjects->SetColor(0xFFFFFFFF); - BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); + ewol::Drawing * tmpDraw = new ewol::Drawing(); + tmpDraw->SetColor(0xFFFFFFFF); + tmpDraw->SetPos(etk::Vector3D(0,0,0) ); + tmpDraw->RectangleWidth(etk::Vector3D(m_size.x, m_size.y) ); uint32_t displayableRaw = m_size.y / (minHeight + 2*m_paddingSizeY) +2; @@ -155,12 +157,6 @@ void ewol::ParameterList::OnRegenerateDisplay(void) // Calculate the real position ... tmpOriginY = m_size.y - (-m_originScrooled.y + (startRaw+1)*(minHeight + 2*m_paddingSizeY)); - clipping_ts drawClipping; - drawClipping.x = 0; - drawClipping.y = 0; - drawClipping.w = m_size.x - (2*m_paddingSizeX); - drawClipping.h = m_size.y; - for(int32_t iii=startRaw; iiim_label; } - ewol::OObject2DTextColored * tmpText = new ewol::OObject2DTextColored(); + ewol::Text * tmpText = new ewol::Text(); - etk::Vector2D textPos; + etk::Vector3D textPos; textPos.x = (int32_t)tmpOriginX; if (m_list[iii]->m_group == false) { textPos.x += minHeight; } textPos.y = (int32_t)(tmpOriginY + m_paddingSizeY); - tmpText->Text(textPos/*, drawClipping*/, myTextToWrite); + tmpText->SetPos(textPos); + tmpText->Print(myTextToWrite); AddOObject(tmpText); tmpOriginY -= minHeight + 2* m_paddingSizeY; } - AddOObject(BGOObjects, 0); + AddOObject(tmpDraw, 0); // call the herited class... - WidgetScrooled::OnRegenerateDisplay(); + widget::WidgetScrooled::OnRegenerateDisplay(); } } -bool ewol::ParameterList::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos) +bool widget::ParameterList::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos) { if (true == WidgetScrooled::OnEventInput(type, IdInput, typeEvent, pos)) { ewol::widgetManager::FocusKeep(this); // nothing to do ... done on upper widet ... return true; } - if (IdInput == 1 && typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) { + if (IdInput == 1 && typeEvent == ewol::keyEvent::statusSingle) { etk::Vector2D relativePos = RelativePosition(pos); // corection for the openGl abstraction relativePos.y = m_size.y - relativePos.y; @@ -225,19 +222,19 @@ bool ewol::ParameterList::OnEventInput(ewol::inputType_te type, int32_t IdInput, -void ewol::ParameterList::OnGetFocus(void) +void widget::ParameterList::OnGetFocus(void) { EWOL_DEBUG("Ewol::List Get Focus"); } -void ewol::ParameterList::OnLostFocus(void) +void widget::ParameterList::OnLostFocus(void) { EWOL_DEBUG("Ewol::List Lost Focus"); } -void ewol::ParameterList::MenuAdd(etk::UString& label, int32_t refId, etk::UString& image) +void widget::ParameterList::MenuAdd(etk::UString& label, int32_t refId, etk::UString& image) { - ewol::elementPL* tmpEmement = new ewol::elementPL(label, refId, image, false); + widget::elementPL* tmpEmement = new widget::elementPL(label, refId, image, false); if (NULL != tmpEmement) { m_list.PushBack(tmpEmement); if (m_idSelected == -1 && label != "---" && refId>0) { @@ -248,10 +245,10 @@ void ewol::ParameterList::MenuAdd(etk::UString& label, int32_t refId, etk::UStri } -void ewol::ParameterList::MenuAddGroup(etk::UString& label) +void widget::ParameterList::MenuAddGroup(etk::UString& label) { etk::UString image = ""; - ewol::elementPL* tmpEmement = new ewol::elementPL(label, -1, image, true); + widget::elementPL* tmpEmement = new widget::elementPL(label, -1, image, true); if (NULL != tmpEmement) { m_list.PushBack(tmpEmement); MarkToRedraw(); @@ -259,7 +256,7 @@ void ewol::ParameterList::MenuAddGroup(etk::UString& label) } -void ewol::ParameterList::MenuClear(void) +void widget::ParameterList::MenuClear(void) { m_idSelected = -1; for (int32_t iii=0; iii0) { etk::UString label = ""; diff --git a/sources/ewol/widget/meta/ParameterList.h b/sources/ewol/widget/meta/ParameterList.h index 3bd2ae0b..73f34c17 100644 --- a/sources/ewol/widget/meta/ParameterList.h +++ b/sources/ewol/widget/meta/ParameterList.h @@ -9,15 +9,15 @@ #ifndef __EWOL_WIDGET_PARAMETER_LIST_H__ #define __EWOL_WIDGET_PARAMETER_LIST_H__ -#include -#include +#include +#include #include #include extern const char * const ewolEventParameterListSelect; -namespace ewol { +namespace widget { class elementPL { @@ -35,11 +35,11 @@ namespace ewol { ~elementPL(void) {}; }; - class ParameterList :public ewol::WidgetScrooled + class ParameterList :public widget::WidgetScrooled { private: - int32_t m_idSelected; - etk::Vector m_list; + int32_t m_idSelected; + etk::Vector m_list; public: ParameterList(void); /** @@ -54,12 +54,12 @@ namespace ewol { void SetLabel(etk::UString newLabel); // Drawing capabilities .... private: - etk::Vector m_listOObject; //!< generic element to display... + etk::Vector m_listOObject; //!< generic element to display... public: - void AddOObject(ewol::OObject* newObject, int32_t pos=-1); + void AddOObject(ewol::Compositing* newObject, int32_t pos=-1); void ClearOObjectList(void); protected: - void OnDraw(DrawProperty& displayProp); + void OnDraw(ewol::DrawProperty& displayProp); // list properties ... private: int32_t m_paddingSizeX; @@ -77,7 +77,7 @@ namespace ewol { * @return true the event is used * @return false the event is not used */ - bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D pos); + bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D pos); protected: void OnGetFocus(void); void OnLostFocus(void); diff --git a/sources/ewol/widget/meta/StdPopUp.h b/sources/ewol/widget/meta/StdPopUp.h index ea0f21da..56c11f4a 100644 --- a/sources/ewol/widget/meta/StdPopUp.h +++ b/sources/ewol/widget/meta/StdPopUp.h @@ -23,7 +23,7 @@ extern const char * const ewolEventFileStdPopUpButton5; extern const char * const ewolEventFileStdPopUpButton6; namespace ewol { - class StdPopUp : public ewol::PopUp + class StdPopUp : public widget::PopUp { public: StdPopUp(void); diff --git a/sources/file.mk b/sources/file.mk index 8f29b5c2..3eebbb2d 100644 --- a/sources/file.mk +++ b/sources/file.mk @@ -33,6 +33,9 @@ FILE_LIST+= ewol/renderer/resources/Shader.cpp \ ewol/renderer/resources/image/ImagePNG.cpp \ ewol/renderer/ResourceManager.cpp +# Audio system +FILE_LIST+= ewol/renderer/audio/audio.cpp \ + ewol/renderer/audio/decWav.cpp # Compositing FILE_LIST+= ewol/compositing/Compositing.cpp \ @@ -48,7 +51,6 @@ FILE_LIST+= ewol/widget/Widget.cpp \ ewol/widget/WidgetManager.cpp \ ewol/widget/Windows.cpp \ ewol/widget/Button.cpp \ - ewol/widget/ButtonImage.cpp \ ewol/widget/Image.cpp \ ewol/widget/ButtonColor.cpp \ ewol/widget/CheckBox.cpp \ @@ -64,7 +66,6 @@ FILE_LIST+= ewol/widget/Widget.cpp \ ewol/widget/Menu.cpp \ ewol/widget/PopUp.cpp \ ewol/widget/ProgressBar.cpp \ - ewol/widget/Scene.cpp \ ewol/widget/SizerHori.cpp \ ewol/widget/SizerVert.cpp \ ewol/widget/Slider.cpp \ @@ -76,10 +77,9 @@ FILE_LIST+= ewol/widget/Widget.cpp \ ewol/widget/meta/Parameter.cpp \ ewol/widget/meta/ParameterList.cpp -# Audio system -#FILE_LIST+= ewol/audio/audio.cpp \ - ewol/audio/decWav.cpp +OLD_WIDGET = \ + ewol/widget/Scene.cpp \ LOCAL_COPY_FILES := ../data/textured3D.prog:textured3D.prog \ ../data/textured3D.frag:textured3D.frag \