[DEV] Compilation of ewol is back ==> not working
This commit is contained in:
parent
7cb9eb91d6
commit
d045b4bd14
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
||||
Subproject commit 6ceb992e455f2cd02e7fa3ff071e835cedaf436f
|
||||
Subproject commit 03c1459c66ee3f4da2c6140612949e99f8d7248c
|
@ -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 <draw/Color.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 <ewol/debug.h>
|
||||
#include <ewol/compositing/Compositing.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 <ewol/debug.h>
|
||||
#include <ewol/compositing/Compositing.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 <ewol/debug.h>
|
||||
#include <ewol/compositing/Compositing.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 <draw/Color.h>
|
||||
|
||||
@ -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)
|
||||
|
@ -7,10 +7,10 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/audio/audio.h>
|
||||
#include <ewol/audio/decWav.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <etk/types.h>
|
||||
#include <ewol/renderer/audio/audio.h>
|
||||
#include <ewol/renderer/audio/decWav.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <math.h>
|
||||
|
||||
static int64_t currentTimePlaying = 0;
|
||||
@ -27,7 +27,7 @@ static int32_t effectsVolumeApply = 1<<16;
|
||||
static bool isInit = false;
|
||||
|
||||
#ifdef __TARGET_OS__Linux
|
||||
# include <ewol/audio/interfacePortAudio.h>
|
||||
# include <ewol/renderer/audio/interfacePortAudio.h>
|
||||
#endif
|
||||
|
||||
void ewol::audio::Init(void)
|
||||
|
@ -10,7 +10,7 @@
|
||||
#ifndef __EWOL_AUDIO_H__
|
||||
#define __EWOL_AUDIO_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
|
||||
namespace ewol {
|
||||
|
@ -6,11 +6,11 @@
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <ewol/audio/decWav.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/renderer/audio/decWav.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef __EWOL_AUDIO_DEC_WAV_H__
|
||||
#define __EWOL_AUDIO_DEC_WAV_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
|
||||
namespace ewol {
|
||||
|
@ -6,9 +6,9 @@
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/audio/interfacePortAudio.h>
|
||||
#include <ewol/audio/audio.h>
|
||||
#include <stdio.h>
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef __EWOL_PORT_AUDIO_H__
|
||||
#define __EWOL_PORT_AUDIO_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/types.h>
|
||||
|
||||
namespace ewol {
|
||||
namespace portAudio {
|
||||
|
@ -8,8 +8,6 @@
|
||||
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
|
||||
@ -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<int32_t> 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<float> 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<float> pos)
|
||||
bool widget::Button::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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) {
|
||||
|
@ -12,9 +12,9 @@
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/compositing/Image.h>
|
||||
|
||||
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<float> 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<float> 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
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include <ewol/widget/ButtonColor.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <ewol/widget/meta/ColorChooser.h>
|
||||
#include <ewol/ewol.h>
|
||||
@ -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<float> newPadding)
|
||||
void widget::ButtonColor::SetPadding(etk::Vector2D<float> newPadding)
|
||||
{
|
||||
m_padding = newPadding;
|
||||
}
|
||||
|
||||
bool ewol::ButtonColor::CalculateMinSize(void)
|
||||
bool widget::ButtonColor::CalculateMinSize(void)
|
||||
{
|
||||
etk::Vector2D<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
etk::Vector3D<int32_t> 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<float> textPos;
|
||||
etk::Vector3D<float> 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<float>(tmpOriginX, tmpOriginY, 0) );
|
||||
m_oObjectDecoration.RectangleWidth(etk::Vector3D<float>(tmpSizeX, tmpSizeY, 0) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
bool widget::ButtonColor::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
if( ewol::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 ...
|
||||
|
@ -13,12 +13,13 @@
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
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<float> newPadding);
|
||||
private:
|
||||
ewol::OObject2DTextColored m_oObjectText;
|
||||
ewol::OObject2DColored m_oObjectDecoration;
|
||||
ewol::Text m_oObjectText;
|
||||
ewol::Drawing m_oObjectDecoration;
|
||||
textAlignement_te m_alignement;
|
||||
etk::Vector2D<float> m_padding;
|
||||
etk::Vector2D<float> 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<float> pos);
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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
|
||||
|
@ -1,293 +0,0 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <ewol/widget/ButtonImage.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
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<float> 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<float> 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();
|
||||
}
|
||||
}
|
||||
|
@ -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 <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
|
||||
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<float> 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
|
@ -7,8 +7,6 @@
|
||||
*/
|
||||
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
|
||||
@ -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<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
etk::Vector3D<int32_t> 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<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
etk::Vector3D<int32_t> 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<float> textPos;
|
||||
etk::Vector3D<float> 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<float>(2.5f, 2.5f, 0.0f) );
|
||||
m_oObjectDecoration.RectangleWidth(etk::Vector3D<float>(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<float>(2.5f, 2.5f, 0.0f) );
|
||||
m_oObjectDecoration.SetThickness(3);
|
||||
m_oObjectDecoration.LineRel(etk::Vector3D<float>(boxSize, boxSize, 0.0f) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ewol::CheckBox::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
bool widget::CheckBox::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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 == ' ')
|
||||
) {
|
||||
|
@ -11,12 +11,13 @@
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
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<float> 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<float> pos);
|
||||
virtual bool OnEventKb(ewol::keyEvent::status_te typeEvent, uniChar_t unicodeData);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <ewol/widget/ColorBar.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
#include <draw/Color.h>
|
||||
@ -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; iii<NB_BAND_COLOR ; iii++) {
|
||||
|
||||
// TODO : ...
|
||||
#if 0
|
||||
/* Step 1 :
|
||||
*
|
||||
* **
|
||||
@ -176,6 +178,7 @@ void ewol::ColorBar::OnRegenerateDisplay(void)
|
||||
tmpOObjects->SetColor(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<float> pos)
|
||||
bool widget::ColorBar::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
etk::Vector2D<float> 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;
|
||||
|
@ -11,12 +11,13 @@
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <draw/Color.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
|
||||
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<float> 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<float> pos);
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -9,11 +9,12 @@
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
|
||||
#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<float>(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<float>(m_arrowPos.x+laking, m_arrowPos.y-laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
BGOObjects->SetPos(etk::Vector3D<float>(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<float>(m_arrowPos.x+laking, m_arrowPos.y-laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
BGOObjects->SetPos(etk::Vector3D<float>(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<float>(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<float>(m_arrowPos.x+laking, m_arrowPos.y+laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
BGOObjects->SetPos(etk::Vector3D<float>(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<float>(m_arrowPos.x+laking, m_arrowPos.y+laking, 0.0f) );
|
||||
BGOObjects->AddVertex();
|
||||
BGOObjects->SetPos(etk::Vector3D<float>(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<float>(tmpOrigin.x-m_padding.x, tmpOrigin.y - m_padding.y, 0.0f) );
|
||||
BGOObjects->RectangleWidth(etk::Vector3D<float>(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<float>(tmpOrigin.x, tmpOrigin.y, 0.0f) );
|
||||
BGOObjects->RectangleWidth(etk::Vector3D<float>(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<float> pos)
|
||||
ewol::Widget * widget::ContextMenu::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
{
|
||||
// calculate relative position
|
||||
etk::Vector2D<float> relativePos = RelativePosition(pos);
|
||||
@ -251,18 +264,16 @@ ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
}
|
||||
|
||||
|
||||
bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
bool widget::ContextMenu::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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<float> arrowPos)
|
||||
void widget::ContextMenu::SetPositionMark(markPosition_te position, etk::Vector2D<float> arrowPos)
|
||||
{
|
||||
EWOL_DEBUG("set context menu at the position : (" << arrowPos.x << "," << arrowPos.y << ")");
|
||||
m_arrawBorder = position;
|
||||
|
@ -10,11 +10,12 @@
|
||||
#define __EWOL_CONTEXT_MENU_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <draw/Color.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
|
||||
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<float> 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<float> pos);
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -9,12 +9,12 @@
|
||||
#include <ewol/widget/Drawable.h>
|
||||
|
||||
|
||||
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<m_listOObject.Size(); iii++) {
|
||||
@ -27,7 +27,7 @@ ewol::Drawable::~Drawable(void)
|
||||
|
||||
|
||||
|
||||
void ewol::Drawable::AddOObject(ewol::OObject* newObject, int32_t pos)
|
||||
void widget::Drawable::AddOObject(ewol::Compositing* newObject, int32_t pos)
|
||||
{
|
||||
if (NULL == newObject) {
|
||||
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
||||
@ -41,7 +41,7 @@ void ewol::Drawable::AddOObject(ewol::OObject* newObject, int32_t pos)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Drawable::ClearOObjectList(void)
|
||||
void widget::Drawable::ClearOObjectList(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
@ -50,7 +50,7 @@ void ewol::Drawable::ClearOObjectList(void)
|
||||
m_listOObject.Clear();
|
||||
}
|
||||
|
||||
void ewol::Drawable::OnDraw(DrawProperty& displayProp)
|
||||
void widget::Drawable::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
if (NULL != m_listOObject[iii]) {
|
||||
|
@ -10,9 +10,10 @@
|
||||
#define __EWOL_WIDGET_DRAWABLE_H__
|
||||
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/compositing/Compositing.h>
|
||||
|
||||
|
||||
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<ewol::OObject*> m_listOObject; //!< generic element to display...
|
||||
etk::Vector<ewol::Compositing*> 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);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
#include <etk/unicode.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <ewol/ewol.h>
|
||||
|
||||
@ -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<float> 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<float> 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<float> textPos( tmpTextOriginX + m_displayStartPosition,
|
||||
tmpTextOriginY,
|
||||
0 );
|
||||
etk::Vector3D<float> drawClippingPos( 2*m_paddingSize + m_borderSize,
|
||||
2*m_paddingSize + m_borderSize,
|
||||
-1 );
|
||||
etk::Vector3D<float> 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<float>& pos, bool selection)
|
||||
void widget::Entry::UpdateCursorPosition(etk::Vector2D<float>& pos, bool selection)
|
||||
{
|
||||
etk::Vector2D<float> 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<m_data.Size(); iii++) {
|
||||
tmpDisplay = m_data.Extract(0, iii);
|
||||
int32_t tmpWidth = m_oObjectText.GetSize(tmpDisplay).x - displayHidenSize;
|
||||
int32_t tmpWidth = m_oObjectText.CalculateSize(tmpDisplay).x - displayHidenSize;
|
||||
if (tmpWidth>=relPos.x-tmpTextOriginX) {
|
||||
newCursorPosition = iii;
|
||||
break;
|
||||
@ -289,7 +294,7 @@ void ewol::Entry::UpdateCursorPosition(etk::Vector2D<float>& 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<float> pos)
|
||||
bool widget::Entry::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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();
|
||||
}
|
||||
|
@ -11,7 +11,8 @@
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <draw/Color.h>
|
||||
|
||||
@ -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<float> pos);
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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
|
||||
|
@ -7,23 +7,18 @@
|
||||
*/
|
||||
|
||||
#include <ewol/widget/Image.h>
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Image.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
|
||||
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<float> newPadding)
|
||||
void widget::Image::SetPadding(etk::Vector2D<float> 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<float>(tmpOriginX, tmpOriginY, 0) );
|
||||
tmpImage->Print(etk::Vector2D<float>(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<float>(tmpOriginX, tmpOriginY, 0) );
|
||||
tmpDraw->RectangleWidth(etk::Vector3D<float>(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<float> pos)
|
||||
bool widget::Image::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
if( ewol::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;
|
||||
}
|
||||
|
@ -11,12 +11,13 @@
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <draw/Color.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
|
||||
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<float> pos);
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <ewol/widget/Joystick.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Image.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
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<float> pos)
|
||||
bool widget::Joystick::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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<float> 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;
|
||||
|
@ -12,32 +12,33 @@
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
#include <draw/Color.h>
|
||||
|
||||
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<float> 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<float> 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<float> pos);
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <ewol/widget/Label.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
|
||||
@ -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<int32_t> minSize = m_oObjectText.GetSize(m_label);
|
||||
etk::Vector3D<int32_t> 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<float> 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<float> 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<float> pos)
|
||||
bool widget::Label::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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;
|
||||
|
@ -11,12 +11,12 @@
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
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<float> pos);
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -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<ewol::Widget*> m_SubWidget;
|
||||
|
||||
void ewol::Layer::SubWidgetRemoveAll(void)
|
||||
void widget::Layer::SubWidgetRemoveAll(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
delete(m_subWidget[iii]);
|
||||
@ -113,7 +113,7 @@ void ewol::Layer::SubWidgetRemoveAll(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Layer::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
void widget::Layer::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -122,7 +122,7 @@ void ewol::Layer::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Layer::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
void widget::Layer::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -137,7 +137,7 @@ void ewol::Layer::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::Layer::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
void widget::Layer::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -152,7 +152,7 @@ void ewol::Layer::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Layer::OnDraw(DrawProperty& displayProp)
|
||||
void widget::Layer::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
// draw is done in the invert sense of inserting ... the first element inserted is on the top and the last is on the buttom
|
||||
for (int32_t iii=m_subWidget.Size()-1; 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<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
@ -174,7 +174,7 @@ void ewol::Layer::OnRegenerateDisplay(void)
|
||||
}
|
||||
|
||||
|
||||
ewol::Widget * ewol::Layer::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
ewol::Widget * widget::Layer::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
{
|
||||
// for all element in the sizer ...
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
@ -196,7 +196,7 @@ ewol::Widget * ewol::Layer::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
}
|
||||
|
||||
|
||||
void ewol::Layer::OnObjectRemove(ewol::EObject * removeObject)
|
||||
void widget::Layer::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
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<ewol::Widget*> 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:
|
||||
|
@ -8,14 +8,15 @@
|
||||
|
||||
#include <ewol/widget/List.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
#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<m_listOObject.Size(); iii++) {
|
||||
@ -42,7 +43,7 @@ ewol::List::~List(void)
|
||||
}
|
||||
|
||||
|
||||
bool ewol::List::CalculateMinSize(void)
|
||||
bool widget::List::CalculateMinSize(void)
|
||||
{
|
||||
/*int32_t fontId = GetDefaultFontId();
|
||||
int32_t minWidth = ewol::GetWidth(fontId, m_label);
|
||||
@ -56,7 +57,7 @@ bool ewol::List::CalculateMinSize(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::List::AddOObject(ewol::OObject* newObject, int32_t pos)
|
||||
void widget::List::AddOObject(ewol::Compositing* newObject, int32_t pos)
|
||||
{
|
||||
if (NULL == newObject) {
|
||||
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
||||
@ -70,7 +71,7 @@ void ewol::List::AddOObject(ewol::OObject* newObject, int32_t pos)
|
||||
}
|
||||
|
||||
|
||||
void ewol::List::ClearOObjectList(void)
|
||||
void widget::List::ClearOObjectList(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
@ -79,7 +80,7 @@ void ewol::List::ClearOObjectList(void)
|
||||
m_listOObject.Clear();
|
||||
}
|
||||
|
||||
void ewol::List::OnDraw(DrawProperty& displayProp)
|
||||
void widget::List::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
if (NULL != m_listOObject[iii]) {
|
||||
@ -92,7 +93,7 @@ void ewol::List::OnDraw(DrawProperty& displayProp)
|
||||
|
||||
|
||||
|
||||
void ewol::List::OnRegenerateDisplay(void)
|
||||
void widget::List::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (true == NeedRedraw()) {
|
||||
|
||||
@ -122,10 +123,11 @@ void ewol::List::OnRegenerateDisplay(void)
|
||||
|
||||
etk::Vector<int32_t> 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<float>(0, 0, 0) );
|
||||
BGOObjects->RectangleWidth(etk::Vector3D<float>(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<float>(displayPositionX, displayPositionY, 0) );
|
||||
BGOObjects->RectangleWidth(etk::Vector3D<float>(m_size.x-displayPositionX, tmpFontHeight+2*m_paddingSizeY, 0));
|
||||
|
||||
// get the maximum size of the colomn :
|
||||
etk::Vector2D<float> textSize = tmpText->GetSize(myTextToWrite);
|
||||
etk::Vector3D<float> textSize = tmpText->CalculateSize(myTextToWrite);
|
||||
sizeColom = etk_max(sizeColom, textSize.x);
|
||||
|
||||
etk::Vector2D<float> textPos;
|
||||
textPos.x = tmpOriginX + displayPositionX;
|
||||
textPos.y = displayPositionY;
|
||||
tmpText->SetColor(fg);
|
||||
tmpText->Text(textPos/*, drawClipping*/, myTextToWrite);
|
||||
tmpText->SetPos(etk::Vector3D<float>(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<float> pos)
|
||||
bool widget::List::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
etk::Vector2D<float> 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");
|
||||
}
|
||||
|
@ -10,12 +10,13 @@
|
||||
#define __EWOL_LIST_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <draw/Color.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/WidgetScrolled.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
#include <ewol/compositing/Compositing.h>
|
||||
|
||||
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<ewol::OObject*> m_listOObject; //!< generic element to display...
|
||||
etk::Vector<ewol::Compositing*> m_listOObject; //!< generic element to display...
|
||||
etk::Vector<etk::Vector2D<int32_t> > 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<float> pos);
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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:
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include <ewol/widget/ListFileSystem.h>
|
||||
#include <etk/tool.h>
|
||||
|
||||
#include <etk/os/FSNode.h>
|
||||
|
||||
|
||||
#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<m_list.Size(); iii++) {
|
||||
if (NULL != m_list[iii]) {
|
||||
@ -48,13 +50,13 @@ ewol::ListFileSystem::~ListFileSystem(void)
|
||||
}
|
||||
};
|
||||
|
||||
draw::Color ewol::ListFileSystem::GetBasicBG(void) {
|
||||
draw::Color widget::ListFileSystem::GetBasicBG(void) {
|
||||
draw::Color bg(0x00000010);
|
||||
return bg;
|
||||
}
|
||||
|
||||
|
||||
void ewol::ListFileSystem::RegenerateView(void)
|
||||
void widget::ListFileSystem::RegenerateView(void)
|
||||
{
|
||||
// clean the list of files :
|
||||
for (int32_t iii=0; iii<m_list.Size(); iii++) {
|
||||
@ -75,45 +77,45 @@ void ewol::ListFileSystem::RegenerateView(void)
|
||||
MarkToRedraw();
|
||||
}
|
||||
|
||||
void ewol::ListFileSystem::SetShowHiddenFiles(bool state)
|
||||
void widget::ListFileSystem::SetShowHiddenFiles(bool state)
|
||||
{
|
||||
m_showHidden = state;
|
||||
RegenerateView();
|
||||
}
|
||||
|
||||
void ewol::ListFileSystem::SetShowTemporaryFiles(bool state)
|
||||
void widget::ListFileSystem::SetShowTemporaryFiles(bool state)
|
||||
{
|
||||
m_showTemporaryFile = state;
|
||||
RegenerateView();
|
||||
}
|
||||
|
||||
void ewol::ListFileSystem::SetShowFiles(bool state)
|
||||
void widget::ListFileSystem::SetShowFiles(bool state)
|
||||
{
|
||||
m_showFile = state;
|
||||
RegenerateView();
|
||||
}
|
||||
|
||||
void ewol::ListFileSystem::SetShowFolder(bool state)
|
||||
void widget::ListFileSystem::SetShowFolder(bool state)
|
||||
{
|
||||
m_showFolder = state;
|
||||
RegenerateView();
|
||||
}
|
||||
|
||||
|
||||
void ewol::ListFileSystem::SetFolder(etk::UString newFolder)
|
||||
void widget::ListFileSystem::SetFolder(etk::UString newFolder)
|
||||
{
|
||||
m_folder = newFolder;
|
||||
RegenerateView();
|
||||
}
|
||||
|
||||
|
||||
etk::UString ewol::ListFileSystem::GetFolder(void)
|
||||
etk::UString widget::ListFileSystem::GetFolder(void)
|
||||
{
|
||||
return m_folder;
|
||||
}
|
||||
|
||||
|
||||
etk::UString ewol::ListFileSystem::GetSelect(void)
|
||||
etk::UString widget::ListFileSystem::GetSelect(void)
|
||||
{
|
||||
etk::UString tmpVal = "";
|
||||
if (m_selectedLine >= 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;
|
||||
|
@ -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<etk::FSNode *> 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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
|
||||
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<MenuElement*> m_listElement;
|
||||
int32_t m_staticId; // unique ID for every element of the menu ...
|
||||
ewol::ContextMenu* m_widgetContextMenu;
|
||||
etk::Vector<widget::MenuElement*> 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 = "");
|
||||
|
@ -8,11 +8,12 @@
|
||||
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
|
||||
#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<float>(0,0,0));
|
||||
BGOObjects->RectangleWidth(etk::Vector3D<float>(m_size.x, m_size.y, 0));
|
||||
// set the area in white ...
|
||||
if (NULL != m_subWidget) {
|
||||
etk::Vector2D<float> tmpSize = m_subWidget->GetSize();
|
||||
etk::Vector2D<float> 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<float>(tmpOrigin.x-BORDER_SIZE_TMP, tmpOrigin.y-BORDER_SIZE_TMP,0) );
|
||||
BGOObjects->Rectangle(etk::Vector3D<float>(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<float>(tmpOrigin.x, tmpOrigin.y,0) );
|
||||
BGOObjects->RectangleWidth(etk::Vector3D<float>(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<float> pos)
|
||||
ewol::Widget * widget::PopUp::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
{
|
||||
// calculate relative position
|
||||
etk::Vector2D<float> relativePos = RelativePosition(pos);
|
||||
@ -185,17 +189,17 @@ ewol::Widget * ewol::PopUp::GetWidgetAtPos(etk::Vector2D<float> 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");
|
||||
|
@ -10,12 +10,13 @@
|
||||
#define __EWOL_POP_UP_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <draw/Color.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
|
||||
namespace ewol {
|
||||
class PopUp : public ewol::Drawable
|
||||
namespace widget {
|
||||
class PopUp : public widget::Drawable
|
||||
{
|
||||
public:
|
||||
PopUp(void);
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <ewol/widget/ProgressBar.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
#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<float>(tmpOriginX, tmpOriginY, 0) );
|
||||
tmpDraw->RectangleWidth(etk::Vector3D<float>(tmpSizeX*m_value, tmpSizeY, 0) );
|
||||
tmpDraw->SetColor(m_textColorBgOff);
|
||||
tmpDraw->SetPos(etk::Vector3D<float>(tmpOriginX+tmpSizeX*m_value, tmpOriginY, 0) );
|
||||
tmpDraw->RectangleWidth(etk::Vector3D<float>(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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,12 +10,13 @@
|
||||
#define __EWOL_PROGRESS_BAR_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <draw/Color.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
|
||||
|
||||
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
|
||||
|
@ -13,21 +13,10 @@
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <ewol/openGL/openGL.h>
|
||||
|
||||
/**
|
||||
* @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<float> ewol::Scene::RelativePosition(etk::Vector2D<float> pos)
|
||||
etk::Vector2D<float> widget::Scene::RelativePosition(etk::Vector2D<float> pos)
|
||||
{
|
||||
// Remove origin of the widget
|
||||
pos.x -= m_origin.x;
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <ewol/game/GameElement.h>
|
||||
|
||||
|
||||
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 ---
|
||||
|
@ -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<ewol::Widget*> m_subWidget[m_currentCreateId];
|
||||
|
||||
void ewol::SizerHori::SubWidgetRemoveAll(void)
|
||||
void widget::SizerHori::SubWidgetRemoveAll(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
@ -154,7 +154,7 @@ void ewol::SizerHori::SubWidgetRemoveAll(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerHori::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
void widget::SizerHori::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -163,7 +163,7 @@ void ewol::SizerHori::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
void widget::SizerHori::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -180,7 +180,7 @@ void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
void widget::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -195,7 +195,7 @@ void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerHori::OnDraw(DrawProperty& displayProp)
|
||||
void widget::SizerHori::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
@ -205,7 +205,7 @@ void ewol::SizerHori::OnDraw(DrawProperty& displayProp)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerHori::OnRegenerateDisplay(void)
|
||||
void widget::SizerHori::OnRegenerateDisplay(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
@ -215,7 +215,7 @@ void ewol::SizerHori::OnRegenerateDisplay(void)
|
||||
}
|
||||
|
||||
|
||||
ewol::Widget * ewol::SizerHori::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
ewol::Widget * widget::SizerHori::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
{
|
||||
if (true == IsHide()) {
|
||||
return NULL;
|
||||
@ -243,7 +243,7 @@ ewol::Widget * ewol::SizerHori::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerHori::OnObjectRemove(ewol::EObject * removeObject)
|
||||
void widget::SizerHori::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
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);
|
||||
/**
|
||||
|
@ -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<ewol::Widget*> m_SubWidget;
|
||||
|
||||
void ewol::SizerVert::SubWidgetRemoveAll(void)
|
||||
void widget::SizerVert::SubWidgetRemoveAll(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
delete(m_subWidget[iii]);
|
||||
@ -156,7 +156,7 @@ void ewol::SizerVert::SubWidgetRemoveAll(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerVert::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
void widget::SizerVert::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -165,7 +165,7 @@ void ewol::SizerVert::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerVert::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
void widget::SizerVert::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -180,7 +180,7 @@ void ewol::SizerVert::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
void widget::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -195,7 +195,7 @@ void ewol::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerVert::OnDraw(DrawProperty& displayProp)
|
||||
void widget::SizerVert::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
@ -206,7 +206,7 @@ void ewol::SizerVert::OnDraw(DrawProperty& displayProp)
|
||||
|
||||
|
||||
|
||||
void ewol::SizerVert::OnRegenerateDisplay(void)
|
||||
void widget::SizerVert::OnRegenerateDisplay(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
if (NULL != m_subWidget[iii]) {
|
||||
@ -216,7 +216,7 @@ void ewol::SizerVert::OnRegenerateDisplay(void)
|
||||
}
|
||||
|
||||
|
||||
ewol::Widget * ewol::SizerVert::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
ewol::Widget * widget::SizerVert::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
{
|
||||
if (true == IsHide()) {
|
||||
return NULL;
|
||||
@ -244,7 +244,7 @@ ewol::Widget * ewol::SizerVert::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
}
|
||||
|
||||
|
||||
void ewol::SizerVert::OnObjectRemove(ewol::EObject * removeObject)
|
||||
void widget::SizerVert::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
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:
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <ewol/widget/Slider.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
|
||||
@ -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<float>(dotRadius, m_size.y/2) );
|
||||
tmpDraw->LineTo(etk::Vector3D<float>(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<float>(4+((float)(m_value-m_min)/(float)(m_max-m_min))*(float)(m_size.x-2*dotRadius), m_size.y/2) );
|
||||
tmpDraw->SetColor(borderDot);
|
||||
tmpDraw->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<float> pos)
|
||||
bool widget::Slider::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
etk::Vector2D<float> 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;
|
||||
|
@ -10,13 +10,14 @@
|
||||
#define __EWOL_SLIDER_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <draw/Color.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
|
||||
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<float> pos);
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos);
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include <ewol/widget/Spacer.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
|
||||
@ -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<float>(0, 0, 0) );
|
||||
tmpDraw->RectangleWidth(etk::Vector3D<float>(m_size.x, m_size.y) );
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,12 @@
|
||||
#define __EWOL_SPACER_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <draw/Color.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
@ -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<ewol::Widget*> m_SubWidget;
|
||||
|
||||
void ewol::WSlider::SubWidgetRemoveAll(void)
|
||||
void widget::WSlider::SubWidgetRemoveAll(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||
delete(m_subWidget[iii]);
|
||||
@ -135,7 +135,7 @@ void ewol::WSlider::SubWidgetRemoveAll(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::WSlider::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
void widget::WSlider::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -146,7 +146,7 @@ void ewol::WSlider::SubWidgetAdd(ewol::Widget* newWidget)
|
||||
}
|
||||
|
||||
|
||||
void ewol::WSlider::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
void widget::WSlider::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -163,7 +163,7 @@ void ewol::WSlider::SubWidgetRemove(ewol::Widget* newWidget)
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::WSlider::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
void widget::WSlider::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
{
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
@ -179,7 +179,7 @@ void ewol::WSlider::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||
}
|
||||
}
|
||||
|
||||
void ewol::WSlider::SubWidgetSelectSet(int32_t id)
|
||||
void widget::WSlider::SubWidgetSelectSet(int32_t id)
|
||||
{
|
||||
if (id<0 || id > 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<float> pos)
|
||||
ewol::Widget * widget::WSlider::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
{
|
||||
// TODO : Review this ...
|
||||
if (m_windowsDestination<0 || m_windowsDestination > m_subWidget.Size()) {
|
||||
@ -294,7 +294,7 @@ ewol::Widget * ewol::WSlider::GetWidgetAtPos(etk::Vector2D<float> pos)
|
||||
}
|
||||
|
||||
|
||||
void ewol::WSlider::OnObjectRemove(ewol::EObject * removeObject)
|
||||
void widget::WSlider::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
|
||||
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<ewol::Widget*> m_subWidget;
|
||||
etk::Vector<ewol::Widget*> 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:
|
||||
|
@ -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<float> pos) { return false; };
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -8,26 +8,26 @@
|
||||
|
||||
#include <ewol/widget/WidgetScrolled.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <ewol/openGL/openGL.h>
|
||||
#include <ewol/renderer/openGL.h>
|
||||
#include <ewol/ewol.h>
|
||||
|
||||
|
||||
|
||||
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<float>(m_size.x-(SCROLL_BAR_SPACE/2), 0) );
|
||||
tmpDraw->LineTo(etk::Vector3D<float>(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<float>(m_size.x-SCROLL_BAR_SPACE, m_size.y - originScrollBar - lenScrollBar) );
|
||||
tmpDraw->RectangleWidth(etk::Vector3D<float>(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<float>(0, (SCROLL_BAR_SPACE/2), 0) );
|
||||
tmpDraw->LineTo(etk::Vector3D<float>(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<float>(originScrollBar, 0, 0) );
|
||||
tmpDraw->Rectangle(etk::Vector3D<float>(lenScrollBar, SCROLL_BAR_SPACE) );
|
||||
}
|
||||
AddOObject(tmpDraw);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, etk::Vector2D<float> pos)
|
||||
bool widget::WidgetScrooled::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos)
|
||||
{
|
||||
etk::Vector2D<float> 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_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
@ -321,7 +328,7 @@ void ewol::WidgetScrooled::ClearOObjectList(void)
|
||||
m_listOObject.Clear();
|
||||
}
|
||||
|
||||
void ewol::WidgetScrooled::OnDraw(DrawProperty& displayProp)
|
||||
void widget::WidgetScrooled::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
if (NULL != m_listOObject[iii]) {
|
||||
@ -331,7 +338,7 @@ void ewol::WidgetScrooled::OnDraw(DrawProperty& displayProp)
|
||||
}
|
||||
|
||||
|
||||
void ewol::WidgetScrooled::GenDraw(DrawProperty displayProp)
|
||||
void widget::WidgetScrooled::GenDraw(ewol::DrawProperty displayProp)
|
||||
{
|
||||
ewol::openGL::Push();
|
||||
if (SCROLL_MODE_CENTER == m_scroollingMode) {
|
||||
@ -340,9 +347,9 @@ void ewol::WidgetScrooled::GenDraw(DrawProperty displayProp)
|
||||
m_origin.y,
|
||||
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 tmpScale = etk::matrix::Scale(m_zoom, m_zoom, 1.0);
|
||||
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 tmpScale = etk::Matrix4::Scale(etk::Vector3D<float>(m_zoom, m_zoom, 1.0) );
|
||||
etk::Matrix4 tmpTranslate = etk::Matrix4::Translate(etk::Vector3D<float>(-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<float>( -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<float> borderWidth, etk::Vector2D<float> currentPosition, bool center)
|
||||
void widget::WidgetScrooled::SetScrollingPositionDynamic(etk::Vector2D<float> borderWidth, etk::Vector2D<float> currentPosition, bool center)
|
||||
{
|
||||
if (true == center) {
|
||||
borderWidth.x = m_size.x / 2 - borderWidth.x;
|
||||
@ -394,12 +401,12 @@ void ewol::WidgetScrooled::SetScrollingPositionDynamic(etk::Vector2D<float> 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;
|
||||
}
|
||||
|
@ -12,8 +12,9 @@
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/compositing/Compositing.h>
|
||||
|
||||
namespace ewol {
|
||||
namespace widget {
|
||||
typedef enum {
|
||||
SCROLL_DISABLE,
|
||||
SCROLL_INIT,
|
||||
@ -31,20 +32,20 @@ namespace ewol {
|
||||
class WidgetScrooled : public ewol::Widget
|
||||
{
|
||||
private:
|
||||
etk::Vector<ewol::OObject*> m_listOObject; //!< generic element to display...
|
||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||
etk::Vector<ewol::Compositing*> m_listOObject; //!< generic element to display...
|
||||
void AddOObject(ewol::Compositing* newObject, int32_t pos=-1);
|
||||
void ClearOObjectList(void);
|
||||
protected:
|
||||
etk::Vector2D<float> m_originScrooled;
|
||||
etk::Vector2D<float> m_maxSize;
|
||||
float m_limitScrolling;
|
||||
etk::Vector2D<float> m_originScrooled;
|
||||
etk::Vector2D<float> 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<float> 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<float> pos);
|
||||
virtual bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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
|
||||
|
@ -6,18 +6,14 @@
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/renderer/openGL.h>
|
||||
#include <ewol/renderer/os/eSystem.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Windows.h>
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/openGL/openGL.h>
|
||||
#include <ewol/texture/Texture.h>
|
||||
#include <ewol/font/Font.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/openGL/openGL.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <ewol/os/eSystem.h>
|
||||
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -9,8 +9,8 @@
|
||||
#ifndef __EWOL_COLOR_CHOOSER_H__
|
||||
#define __EWOL_COLOR_CHOOSER_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
@ -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;
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -9,8 +9,8 @@
|
||||
#ifndef __EWOL_FILE_CHOOSER_H__
|
||||
#define __EWOL_FILE_CHOOSER_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
@ -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;
|
||||
};
|
||||
|
@ -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();
|
||||
|
@ -9,9 +9,9 @@
|
||||
#ifndef __EWOL_WIDGET_PARAMETER_H__
|
||||
#define __EWOL_WIDGET_PARAMETER_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
@ -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;
|
||||
};
|
||||
|
||||
};
|
||||
|
@ -9,22 +9,23 @@
|
||||
#include <ewol/widget/meta/ParameterList.h>
|
||||
#include <etk/tool.h>
|
||||
|
||||
#include <ewol/widget/List.h>
|
||||
|
||||
#include <ewol/compositing/Drawing.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ParameterList"
|
||||
|
||||
extern const char * const ewolEventParameterListSelect = "ewol-event-parameter-list-select";
|
||||
|
||||
#include <ewol/widget/List.h>
|
||||
|
||||
#include <ewol/oObject/OObject.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
#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<m_listOObject.Size(); iii++) {
|
||||
@ -50,7 +51,7 @@ ewol::ParameterList::~ParameterList(void)
|
||||
}
|
||||
|
||||
|
||||
bool ewol::ParameterList::CalculateMinSize(void)
|
||||
bool widget::ParameterList::CalculateMinSize(void)
|
||||
{
|
||||
/*int32_t fontId = GetDefaultFontId();
|
||||
int32_t minWidth = ewol::GetWidth(fontId, m_label);
|
||||
@ -64,7 +65,7 @@ bool ewol::ParameterList::CalculateMinSize(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::ParameterList::AddOObject(ewol::OObject* newObject, int32_t pos)
|
||||
void widget::ParameterList::AddOObject(ewol::Compositing* newObject, int32_t pos)
|
||||
{
|
||||
if (NULL == newObject) {
|
||||
EWOL_ERROR("Try to add an empty object in the Widget generic display system");
|
||||
@ -78,7 +79,7 @@ void ewol::ParameterList::AddOObject(ewol::OObject* newObject, int32_t pos)
|
||||
}
|
||||
|
||||
|
||||
void ewol::ParameterList::ClearOObjectList(void)
|
||||
void widget::ParameterList::ClearOObjectList(void)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
delete(m_listOObject[iii]);
|
||||
@ -87,7 +88,7 @@ void ewol::ParameterList::ClearOObjectList(void)
|
||||
m_listOObject.Clear();
|
||||
}
|
||||
|
||||
void ewol::ParameterList::OnDraw(DrawProperty& displayProp)
|
||||
void widget::ParameterList::OnDraw(ewol::DrawProperty& displayProp)
|
||||
{
|
||||
for (int32_t iii=0; iii<m_listOObject.Size(); iii++) {
|
||||
if (NULL != m_listOObject[iii]) {
|
||||
@ -100,7 +101,7 @@ void ewol::ParameterList::OnDraw(DrawProperty& displayProp)
|
||||
|
||||
|
||||
|
||||
void ewol::ParameterList::OnRegenerateDisplay(void)
|
||||
void widget::ParameterList::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (true == NeedRedraw()) {
|
||||
|
||||
@ -138,9 +139,10 @@ void ewol::ParameterList::OnRegenerateDisplay(void)
|
||||
etk::Vector<int32_t> 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<float>(0,0,0) );
|
||||
tmpDraw->RectangleWidth(etk::Vector3D<float>(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; iii<nbRaw && iii<(startRaw+displayableRaw); iii++) {
|
||||
etk::UString myTextToWrite = "???";
|
||||
draw::Color fg(0x000000FF);
|
||||
@ -168,35 +164,36 @@ void ewol::ParameterList::OnRegenerateDisplay(void)
|
||||
myTextToWrite = m_list[iii]->m_label;
|
||||
}
|
||||
|
||||
ewol::OObject2DTextColored * tmpText = new ewol::OObject2DTextColored();
|
||||
ewol::Text * tmpText = new ewol::Text();
|
||||
|
||||
etk::Vector2D<float> textPos;
|
||||
etk::Vector3D<float> 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<float> pos)
|
||||
bool widget::ParameterList::OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> 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<float> 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; iii<m_list.Size(); iii++) {
|
||||
@ -272,7 +269,7 @@ void ewol::ParameterList::MenuClear(void)
|
||||
}
|
||||
|
||||
|
||||
void ewol::ParameterList::MenuSeparator(void)
|
||||
void widget::ParameterList::MenuSeparator(void)
|
||||
{
|
||||
if (m_list.Size()>0) {
|
||||
etk::UString label = "";
|
||||
|
@ -9,15 +9,15 @@
|
||||
#ifndef __EWOL_WIDGET_PARAMETER_LIST_H__
|
||||
#define __EWOL_WIDGET_PARAMETER_LIST_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <etk/types.h>
|
||||
#include <ewol/debug.h>
|
||||
#include <ewol/widget/WidgetScrolled.h>
|
||||
#include <ewol/widget/Drawable.h>
|
||||
|
||||
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<ewol::elementPL *> m_list;
|
||||
int32_t m_idSelected;
|
||||
etk::Vector<widget::elementPL *> m_list;
|
||||
public:
|
||||
ParameterList(void);
|
||||
/**
|
||||
@ -54,12 +54,12 @@ namespace ewol {
|
||||
void SetLabel(etk::UString newLabel);
|
||||
// Drawing capabilities ....
|
||||
private:
|
||||
etk::Vector<ewol::OObject*> m_listOObject; //!< generic element to display...
|
||||
etk::Vector<ewol::Compositing*> 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<float> pos);
|
||||
bool OnEventInput(ewol::keyEvent::type_te type, int32_t IdInput, ewol::keyEvent::status_te typeEvent, etk::Vector2D<float> pos);
|
||||
protected:
|
||||
void OnGetFocus(void);
|
||||
void OnLostFocus(void);
|
||||
|
@ -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);
|
||||
|
@ -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 \
|
||||
|
Loading…
x
Reference in New Issue
Block a user