Rework of EWOL (Step 1)
This commit is contained in:
parent
a35b65f4c1
commit
87f4cb08e6
@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/EObject.h>
|
#include <ewol/EObject.h>
|
||||||
|
#include <ewol/EObjectManager.h>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -34,6 +35,7 @@ ewol::EObject::EObject(void)
|
|||||||
// note this is nearly atomic ... (but it is enough)
|
// note this is nearly atomic ... (but it is enough)
|
||||||
m_uniqueId = ss_globalUniqueId++;
|
m_uniqueId = ss_globalUniqueId++;
|
||||||
EWOL_DEBUG("new EObject : [" << m_uniqueId << "]");
|
EWOL_DEBUG("new EObject : [" << m_uniqueId << "]");
|
||||||
|
ewol::EObjectManager::Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -41,6 +43,7 @@ ewol::EObject::EObject(void)
|
|||||||
*/
|
*/
|
||||||
ewol::EObject::~EObject(void)
|
ewol::EObject::~EObject(void)
|
||||||
{
|
{
|
||||||
|
ewol::EObjectManager::Rm(this);
|
||||||
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]");
|
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]");
|
||||||
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) {
|
for (int32_t iii=0; iii<m_externEvent.Size(); iii++) {
|
||||||
if (NULL!=m_externEvent[iii]) {
|
if (NULL!=m_externEvent[iii]) {
|
||||||
|
@ -65,7 +65,6 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
~EObject(void);
|
~EObject(void);
|
||||||
|
|
||||||
protected:
|
|
||||||
/**
|
/**
|
||||||
* @brief Get the UniqueId of the EObject
|
* @brief Get the UniqueId of the EObject
|
||||||
* @param ---
|
* @param ---
|
||||||
@ -73,6 +72,7 @@ namespace ewol {
|
|||||||
*/
|
*/
|
||||||
int32_t GetId(void);
|
int32_t GetId(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Add a specific event Id in the list to prevent wrong link on a EObject
|
* @brief Add a specific event Id in the list to prevent wrong link on a EObject
|
||||||
* @param[in] generateEventId event Id to add
|
* @param[in] generateEventId event Id to add
|
||||||
|
150
Sources/libewol/ewol/EObjectManager.cpp
Normal file
150
Sources/libewol/ewol/EObjectManager.cpp
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
/**
|
||||||
|
*******************************************************************************
|
||||||
|
* @file ewol/EObjectManager.cpp
|
||||||
|
* @brief basic ewol Object Manager (Sources)
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @date 27/02/2012
|
||||||
|
* @par Project
|
||||||
|
* ewol
|
||||||
|
*
|
||||||
|
* @par Copyright
|
||||||
|
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY.
|
||||||
|
*
|
||||||
|
* Licence summary :
|
||||||
|
* You can modify and redistribute the sources code and binaries.
|
||||||
|
* You can send me the bug-fix
|
||||||
|
*
|
||||||
|
* Term of the licence in in the file licence.txt.
|
||||||
|
*
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ewol/EObjectManager.h>
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "ewol::EObjectManager"
|
||||||
|
|
||||||
|
static bool IsInit = false;
|
||||||
|
|
||||||
|
// internal element of the widget manager :
|
||||||
|
static etk::VectorType<ewol::EObject*> m_eObjectList; // all widget allocated ==> all time increment ... never removed ...
|
||||||
|
static etk::VectorType<ewol::EObject*> m_eObjectDeletedList; // all widget allocated
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::EObjectManager::Init(void)
|
||||||
|
{
|
||||||
|
EWOL_DEBUG("==> Init EObject-Manager");
|
||||||
|
// Can create mlemory leak ... ==> but not predictable comportement otherwise ...
|
||||||
|
// TODO : Check if we can do sotthing better
|
||||||
|
m_eObjectDeletedList.Clear();
|
||||||
|
m_eObjectList.Clear();
|
||||||
|
IsInit = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::EObjectManager::UnInit(void)
|
||||||
|
{
|
||||||
|
EWOL_DEBUG("==> Un-Init EObject-Manager");
|
||||||
|
|
||||||
|
ewol::EObjectManager::RemoveAllMark();
|
||||||
|
|
||||||
|
EWOL_INFO(" Remove missing user widget");
|
||||||
|
while(0<m_eObjectList.Size()) {
|
||||||
|
if (m_eObjectList[0]!=NULL) {
|
||||||
|
MarkToRemoved(m_eObjectList[0]);
|
||||||
|
} else {
|
||||||
|
m_eObjectList.Erase(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// local acces ==> this control the mutex Lock
|
||||||
|
ewol::EObjectManager::RemoveAllMark();
|
||||||
|
|
||||||
|
IsInit = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::EObjectManager::Add(ewol::EObject* object)
|
||||||
|
{
|
||||||
|
// TODO : Chek if not existed before ...
|
||||||
|
if (NULL != object) {
|
||||||
|
m_eObjectList.PushBack(object);
|
||||||
|
} else {
|
||||||
|
EWOL_ERROR("try to add an inexistant EObject in manager");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::EObjectManager::Rm(ewol::EObject* object)
|
||||||
|
{
|
||||||
|
if (NULL == object) {
|
||||||
|
EWOL_ERROR("Try to remove (NULL) EObject");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
|
||||||
|
if (m_eObjectList[iii] == object) {
|
||||||
|
// Remove Element
|
||||||
|
m_eObjectList.Erase(iii);
|
||||||
|
EWOL_CRITICAL("EObject direct remove is really DANGEROUS due to the multithreading ...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int32_t iii=0; iii<m_eObjectDeletedList.Size(); iii++) {
|
||||||
|
if (m_eObjectDeletedList[iii] == object) {
|
||||||
|
// Remove Element
|
||||||
|
m_eObjectDeletedList.Erase(iii);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EWOL_ERROR("EObject already removed ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void informOneObjectIsRemoved(ewol::EObject* object)
|
||||||
|
{
|
||||||
|
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
|
||||||
|
if (m_eObjectList[iii] != NULL) {
|
||||||
|
m_eObjectList[iii]->OnObjectRemove(object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::EObjectManager::MarkToRemoved(ewol::EObject* object)
|
||||||
|
{
|
||||||
|
if (object == NULL) {
|
||||||
|
EWOL_WARNING("try to remove a NULL Pointer on the EObject manager");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int32_t findId = -1;
|
||||||
|
// check if the widget is not destroy :
|
||||||
|
for(int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
|
||||||
|
if (m_eObjectList[iii] == object) {
|
||||||
|
findId = iii;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (-1 == findId) {
|
||||||
|
EWOL_CRITICAL("Try to mark remove an object already removed (or not registerd [imposible case])");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_eObjectList.Erase(findId);
|
||||||
|
m_eObjectDeletedList.PushBack(object);
|
||||||
|
// Informe all EObject to remove reference of this one ...
|
||||||
|
informOneObjectIsRemoved(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::EObjectManager::RemoveAllMark(void)
|
||||||
|
{
|
||||||
|
etk::VectorType<ewol::EObject*> m_tmpList = m_eObjectDeletedList;
|
||||||
|
// direct delete of the current list ...
|
||||||
|
for(int32_t iii=0; iii<m_tmpList.Size(); iii++) {
|
||||||
|
if (NULL != m_tmpList[iii]) {
|
||||||
|
delete(m_tmpList[iii]);
|
||||||
|
m_tmpList[iii] = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
44
Sources/libewol/ewol/EObjectManager.h
Normal file
44
Sources/libewol/ewol/EObjectManager.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/**
|
||||||
|
*******************************************************************************
|
||||||
|
* @file ewol/EObjectManager.h
|
||||||
|
* @brief basic ewol Object Manager (Header)
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @date 27/02/2012
|
||||||
|
* @par Project
|
||||||
|
* ewol
|
||||||
|
*
|
||||||
|
* @par Copyright
|
||||||
|
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY.
|
||||||
|
*
|
||||||
|
* Licence summary :
|
||||||
|
* You can modify and redistribute the sources code and binaries.
|
||||||
|
* You can send me the bug-fix
|
||||||
|
*
|
||||||
|
* Term of the licence in in the file licence.txt.
|
||||||
|
*
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EWOL_E_OBJECT_MANAGER_H__
|
||||||
|
#define __EWOL_E_OBJECT_MANAGER_H__
|
||||||
|
|
||||||
|
#include <etk/Types.h>
|
||||||
|
#include <ewol/Debug.h>
|
||||||
|
#include <ewol/EObject.h>
|
||||||
|
|
||||||
|
namespace ewol {
|
||||||
|
namespace EObjectManager {
|
||||||
|
void Init( void);
|
||||||
|
void UnInit( void);
|
||||||
|
void Add( ewol::EObject* object);
|
||||||
|
void Rm( ewol::EObject* object);
|
||||||
|
void MarkToRemoved(ewol::EObject* object);
|
||||||
|
void RemoveAllMark(void);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
116
Sources/libewol/ewol/EObjectMessageMulticast.cpp
Normal file
116
Sources/libewol/ewol/EObjectMessageMulticast.cpp
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
/**
|
||||||
|
*******************************************************************************
|
||||||
|
* @file ewol/WidgetMessageMultiCast.cpp
|
||||||
|
* @brief basic ewol Widget Message Multi-cast (Sources)
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
* @date 31/01/2012
|
||||||
|
* @par Project
|
||||||
|
* ewol
|
||||||
|
*
|
||||||
|
* @par Copyright
|
||||||
|
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY.
|
||||||
|
*
|
||||||
|
* Licence summary :
|
||||||
|
* You can modify and redistribute the sources code and binaries.
|
||||||
|
* You can send me the bug-fix
|
||||||
|
*
|
||||||
|
* Term of the licence in in the file licence.txt.
|
||||||
|
*
|
||||||
|
*******************************************************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ewol/EObjectMessageMulticast.h>
|
||||||
|
#include <ewol/EObjectManager.h>
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "ewol::EObjectMessageMultiCast"
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
typedef struct {
|
||||||
|
const char* message;
|
||||||
|
ewol::EObject* object;
|
||||||
|
} messageList_ts;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// internal element of the widget manager :
|
||||||
|
static etk::VectorType<messageList_ts> m_messageList; // all widget allocated ==> all time increment ... never removed ...
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::EObjectMessageMultiCast::Init(void)
|
||||||
|
{
|
||||||
|
EWOL_INFO("EObject message Multi-Cast");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::EObjectMessageMultiCast::UnInit(void)
|
||||||
|
{
|
||||||
|
EWOL_INFO("EObject message Multi-Cast");
|
||||||
|
m_messageList.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::EObjectMessageMultiCast::Add(ewol::EObject* object, const char* const message)
|
||||||
|
{
|
||||||
|
if (NULL == object) {
|
||||||
|
EWOL_ERROR("Add with NULL object");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (NULL == message) {
|
||||||
|
EWOL_ERROR("Add with NULL Message");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
messageList_ts tmpMessage;
|
||||||
|
tmpMessage.object = object;
|
||||||
|
tmpMessage.message = message;
|
||||||
|
m_messageList.PushBack(tmpMessage);
|
||||||
|
EWOL_DEBUG("SendMulticast ADD listener :" << object->GetId() << " on \"" << message << "\"" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::EObjectMessageMultiCast::Rm(ewol::EObject* object)
|
||||||
|
{
|
||||||
|
if (NULL == object) {
|
||||||
|
EWOL_ERROR("Rm with NULL object");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// send the message at all registered widget ...
|
||||||
|
for (int32_t iii=m_messageList.Size(); iii>=0; iii--) {
|
||||||
|
if(m_messageList[iii].object == object) {
|
||||||
|
EWOL_DEBUG("SendMulticast RM listener :" << object->GetId());
|
||||||
|
m_messageList[iii].message = NULL;
|
||||||
|
m_messageList[iii].object = NULL;
|
||||||
|
m_messageList.Erase(iii);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::EObjectMessageMultiCast::Send(ewol::EObject* object, const char* const message, int32_t data)
|
||||||
|
{
|
||||||
|
etk::UString tmpData(data);
|
||||||
|
Send(object, message, tmpData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::EObjectMessageMultiCast::Send(ewol::EObject* object, const char* const message, etk::UString& data)
|
||||||
|
{
|
||||||
|
EWOL_DEBUG("SendMulticast message \"" << message << "\" data=\"" << data << "\" to :");
|
||||||
|
|
||||||
|
// send the message at all registered widget ...
|
||||||
|
for (int32_t iii=0; iii<m_messageList.Size(); iii++) {
|
||||||
|
if( m_messageList[iii].message == message
|
||||||
|
&& m_messageList[iii].object != object)
|
||||||
|
{
|
||||||
|
if (NULL != m_messageList[iii].object) {
|
||||||
|
EWOL_DEBUG(" id = " << m_messageList[iii].object->GetId());
|
||||||
|
// generate event ...
|
||||||
|
m_messageList[iii].object->OnReceiveMessage(object, m_messageList[iii].message, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -22,26 +22,24 @@
|
|||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __EWOL_WIDGET_MESSAGE_MULTIICAST_H__
|
#ifndef __EWOL_E_OBJECT_MESSAGE_MULTIICAST_H__
|
||||||
#define __EWOL_WIDGET_MESSAGE_MULTIICAST_H__
|
#define __EWOL_E_OBJECT_MESSAGE_MULTIICAST_H__
|
||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/OObject.h>
|
#include <ewol/OObject.h>
|
||||||
#include <etk/VectorType.h>
|
#include <etk/VectorType.h>
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/EObject.h>
|
||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
namespace widgetMessageMultiCast {
|
namespace EObjectMessageMultiCast {
|
||||||
void Init( void);
|
void Init( void);
|
||||||
void UnInit(void);
|
void UnInit(void);
|
||||||
void Add( int32_t widgetId, const char* const message);
|
void Add( ewol::EObject* object, const char* const message);
|
||||||
void Rm( int32_t widgetId);
|
void Rm( ewol::EObject* object);
|
||||||
void Send(int32_t widgetId, const char* const message, int32_t data);
|
void Send(ewol::EObject* object, const char* const message, int32_t data);
|
||||||
// TODO : Mus be deprecated ....
|
void Send(ewol::EObject* object, const char* const message, etk::UString& data);
|
||||||
void Send(int32_t widgetId, const char* const message, const char * data = NULL);
|
|
||||||
void Send(int32_t widgetId, const char* const message, etk::UString& data);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <ewol/ShortCutManager.h>
|
#include <ewol/ShortCutManager.h>
|
||||||
#include <ewol/WidgetMessageMultiCast.h>
|
#include <ewol/EObjectMessageMulticast.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ bool ewol::shortCut::Process(bool shift, bool control, bool alt, bool meta, uniC
|
|||||||
&& l_inputShortCutEvent[iii]->UnicodeValue == unicodeValue)
|
&& l_inputShortCutEvent[iii]->UnicodeValue == unicodeValue)
|
||||||
{
|
{
|
||||||
if (isDown) {
|
if (isDown) {
|
||||||
ewol::widgetMessageMultiCast::Send(-1, l_inputShortCutEvent[iii]->generateEventId, l_inputShortCutEvent[iii]->eventData);
|
ewol::EObjectMessageMultiCast::Send(NULL, l_inputShortCutEvent[iii]->generateEventId, l_inputShortCutEvent[iii]->eventData);
|
||||||
} // no else
|
} // no else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
|
#include <ewol/EObjectManager.h>
|
||||||
#include <ewol/WidgetManager.h>
|
#include <ewol/WidgetManager.h>
|
||||||
#include <ewol/WidgetMessageMultiCast.h>
|
#include <ewol/EObjectMessageMulticast.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/importgl.h>
|
#include <ewol/importgl.h>
|
||||||
|
|
||||||
@ -94,34 +95,22 @@ ewol::Widget::Widget(void)
|
|||||||
SetExpendY();
|
SetExpendY();
|
||||||
SetFillX();
|
SetFillX();
|
||||||
SetFillY();
|
SetFillY();
|
||||||
ewol::widgetManager::Add(this);
|
|
||||||
m_canFocus = false;
|
m_canFocus = false;
|
||||||
m_hasFocus = false;
|
m_hasFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget::~Widget(void)
|
ewol::Widget::~Widget(void)
|
||||||
{
|
{
|
||||||
ewol::widgetMessageMultiCast::Rm(GetWidgetId());
|
//ewol::widgetMessageMultiCast::Rm(GetWidgetId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::Widget::MarkToRemove(void)
|
||||||
|
{
|
||||||
|
// Remove his own focus...
|
||||||
ewol::widgetManager::Rm(this);
|
ewol::widgetManager::Rm(this);
|
||||||
}
|
// merk to remova at the next cycle
|
||||||
|
ewol::EObjectManager::MarkToRemoved(this);
|
||||||
int32_t ewol::Widget::GetWidgetId(void)
|
|
||||||
{
|
|
||||||
return ewol::widgetManager::Get(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
coord2D_ts ewol::Widget::GetRealOrigin(void)
|
|
||||||
{
|
|
||||||
coord2D_ts parentCoord;
|
|
||||||
if( NULL != m_parrent) {
|
|
||||||
parentCoord = m_parrent->GetRealOrigin();
|
|
||||||
parentCoord.x += m_origin.x;
|
|
||||||
parentCoord.y += m_origin.y;
|
|
||||||
} else {
|
|
||||||
parentCoord.x = m_origin.x;
|
|
||||||
parentCoord.y = m_origin.y;
|
|
||||||
}
|
|
||||||
return parentCoord;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -144,59 +133,13 @@ bool ewol::Widget::GenEventInput(int32_t IdInput, eventInputType_te typeEvent, c
|
|||||||
return OnEventInput(IdInput, typeEvent, eventPos);
|
return OnEventInput(IdInput, typeEvent, eventPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::Widget::GenEventInputExternal(const char * generateEventId, etkFloat_t x, etkFloat_t y)
|
|
||||||
{
|
|
||||||
bool ended = false;
|
|
||||||
// For all external Event Requested :
|
|
||||||
for( int32_t jjj=0; jjj<m_externEvent.Size(); jjj++) {
|
|
||||||
// Check if it is the same ID :
|
|
||||||
if (m_externEvent[jjj].generateEventId == generateEventId) {
|
|
||||||
// get the widget Pointer:
|
|
||||||
|
|
||||||
ewol::Widget * tmpWidget = ewol::widgetManager::Get(m_externEvent[jjj].widgetCall);
|
|
||||||
if (NULL == tmpWidget) {
|
|
||||||
EWOL_ERROR("Try to call an NULL Widget, it might be removed ... id=" << m_externEvent[jjj].widgetCall);
|
|
||||||
} else {
|
|
||||||
ended = tmpWidget->OnEventAreaExternal(GetWidgetId(), m_externEvent[jjj].generateEventIdExtern, NULL, x, y);
|
|
||||||
}
|
|
||||||
if (true == ended) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ended;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ewol::Widget::GenEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue)
|
bool ewol::Widget::GenEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::Widget::ExternLinkOnEvent(const char * eventName, int32_t widgetId, const char * eventExternId)
|
void ewol::Widget::OnFlipFlopEvent(void)
|
||||||
{
|
|
||||||
if(NULL == eventName || 0 > widgetId) {
|
|
||||||
EWOL_ERROR("Try to add extern event with wrong input ..");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
eventExtern_ts tmpEvent;
|
|
||||||
// search the ID ...
|
|
||||||
for(int32_t iii=0; iii < m_ListEventAvaillable.Size(); iii++) {
|
|
||||||
if (strcmp(m_ListEventAvaillable[iii], eventName) == 0) {
|
|
||||||
tmpEvent.generateEventId = m_ListEventAvaillable[iii];
|
|
||||||
tmpEvent.widgetCall = widgetId;
|
|
||||||
tmpEvent.generateEventIdExtern = eventExternId;
|
|
||||||
m_externEvent.PushBack(tmpEvent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EWOL_ERROR("Try to add extern event with Unknow EventID : \"" << eventName << "\"" );
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::Widget::DoubleBufferFlipFlop(void)
|
|
||||||
{
|
{
|
||||||
if (true == m_needFlipFlop) {
|
if (true == m_needFlipFlop) {
|
||||||
m_currentDrawId++;
|
m_currentDrawId++;
|
||||||
@ -208,7 +151,6 @@ void ewol::Widget::DoubleBufferFlipFlop(void)
|
|||||||
m_currentCreateId = 0;
|
m_currentCreateId = 0;
|
||||||
}
|
}
|
||||||
m_needFlipFlop = false;
|
m_needFlipFlop = false;
|
||||||
OnFlipFlopEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#ifndef __EWOL_WIDGET_H__
|
#ifndef __EWOL_WIDGET_H__
|
||||||
#define __EWOL_WIDGET_H__
|
#define __EWOL_WIDGET_H__
|
||||||
|
|
||||||
|
#include <ewol/EObject.h>
|
||||||
|
|
||||||
#define NB_BOUBLE_BUFFER (2)
|
#define NB_BOUBLE_BUFFER (2)
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
@ -46,6 +48,7 @@ namespace ewol {
|
|||||||
EVENT_INPUT_TYPE_UP,
|
EVENT_INPUT_TYPE_UP,
|
||||||
EVENT_INPUT_TYPE_ENTER,
|
EVENT_INPUT_TYPE_ENTER,
|
||||||
EVENT_INPUT_TYPE_LEAVE,
|
EVENT_INPUT_TYPE_LEAVE,
|
||||||
|
EVENT_INPUT_TYPE_ABORT, // SPecial event generate when an upper classes get an event ... (TBD)
|
||||||
} eventInputType_te;
|
} eventInputType_te;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -93,13 +96,6 @@ namespace ewol {
|
|||||||
|
|
||||||
char* GetCharTypeMoveEvent(eventKbMoveType_te type);
|
char* GetCharTypeMoveEvent(eventKbMoveType_te type);
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const char * generateEventId; //!< event generate ID (to be unique it was pointer on the string name)
|
|
||||||
int32_t widgetCall; //!< unique ID of the widget
|
|
||||||
const char * generateEventIdExtern; //!< External generated event ID (to be unique it was pointer on the string name)
|
|
||||||
} eventExtern_ts;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
coord2D_ts abs;
|
coord2D_ts abs;
|
||||||
coord2D_ts local;
|
coord2D_ts local;
|
||||||
@ -109,19 +105,12 @@ namespace ewol {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Widget {
|
class Widget : public EObject {
|
||||||
public:
|
public:
|
||||||
Widget(void);
|
Widget(void);
|
||||||
|
// TODO : Set this in private if possible ...
|
||||||
virtual ~Widget(void);
|
virtual ~Widget(void);
|
||||||
int32_t GetWidgetId(void);
|
void MarkToRemove(void);
|
||||||
private:
|
|
||||||
ewol::Widget * m_parrent; //!< parrent of the current widget (if NULL ==> this is the main node(root))
|
|
||||||
public:
|
|
||||||
void SetParrent(ewol::Widget * newParrent) { m_parrent = newParrent; };
|
|
||||||
void UnlinkParrent(void) { if (NULL != m_parrent) { m_parrent->removedChild(this); m_parrent=NULL; } };
|
|
||||||
virtual void removedChild(ewol::Widget * removedChild) { };
|
|
||||||
coord2D_ts GetRealOrigin(void); // this fnction call all the parrent to get his real position ...
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------------
|
||||||
// -- Widget Size:
|
// -- Widget Size:
|
||||||
// ----------------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------------
|
||||||
@ -172,30 +161,12 @@ namespace ewol {
|
|||||||
virtual void OnGetFocus(void) {};
|
virtual void OnGetFocus(void) {};
|
||||||
virtual void OnLostFocus(void) {};
|
virtual void OnLostFocus(void) {};
|
||||||
|
|
||||||
private:
|
|
||||||
etk::VectorType<eventExtern_ts> m_externEvent; //!< Generic list of event generation for output link
|
|
||||||
etk::VectorType<const char*> m_ListEventAvaillable; //!< List of all event availlable for this widget
|
|
||||||
public:
|
public:
|
||||||
// external acces to set an input event on this widget.
|
// external acces to set an input event on this widget.
|
||||||
bool GenEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos); // call when input event arrive and call OnEventInput, if no event detected
|
bool GenEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos); // call when input event arrive and call OnEventInput, if no event detected
|
||||||
bool GenEventInputExternal(const char * generateEventId, etkFloat_t x, etkFloat_t y);
|
|
||||||
virtual bool GenEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue);
|
virtual bool GenEventShortCut(bool shift, bool control, bool alt, bool meta, uint32_t unicodeValue);
|
||||||
protected:
|
|
||||||
void AddEventId(const char * generateEventId) {
|
|
||||||
if (NULL != generateEventId) {
|
|
||||||
m_ListEventAvaillable.PushBack(generateEventId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public:
|
|
||||||
// to link an extern widget at the internal event of this one it will access by here :
|
|
||||||
bool ExternLinkOnEvent(const char * eventName, int32_t widgetId, const char * eventExternId = NULL);
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos) { return false; };
|
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos) { return false; };
|
||||||
public:
|
|
||||||
// when an event arrive from an other widget, it will arrive here:
|
|
||||||
// TODO : change name ...
|
|
||||||
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y) { return false; };
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------------
|
||||||
// -- Keboard event (when one is present or when a graphical is present
|
// -- Keboard event (when one is present or when a graphical is present
|
||||||
// ----------------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------------
|
||||||
@ -211,15 +182,16 @@ namespace ewol {
|
|||||||
int8_t m_currentCreateId; //!< Id of the element might be modify
|
int8_t m_currentCreateId; //!< Id of the element might be modify
|
||||||
bool m_needFlipFlop; //!< A flip flop need to be done
|
bool m_needFlipFlop; //!< A flip flop need to be done
|
||||||
bool m_needRegenerateDisplay; //!< the display might be done the next regeneration
|
bool m_needRegenerateDisplay; //!< the display might be done the next regeneration
|
||||||
virtual bool OnDraw(void) { return true; };
|
void MarkToReedraw(void) { m_needRegenerateDisplay = true; };
|
||||||
protected:
|
bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; };
|
||||||
void MarkToReedraw(void) { m_needRegenerateDisplay = true; };
|
public:
|
||||||
bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; };
|
virtual void OnFlipFlopEvent(void);
|
||||||
|
public:
|
||||||
|
bool GenDraw(void);
|
||||||
|
protected:
|
||||||
|
virtual bool OnDraw(void) { return true; };
|
||||||
public:
|
public:
|
||||||
void DoubleBufferFlipFlop(void);
|
|
||||||
virtual void OnFlipFlopEvent(void) { /* nothing to do */ };
|
|
||||||
virtual void OnRegenerateDisplay(void) { /* nothing to do */ };
|
virtual void OnRegenerateDisplay(void) { /* nothing to do */ };
|
||||||
bool GenDraw(void);
|
|
||||||
|
|
||||||
}; // end of the class Widget declaration
|
}; // end of the class Widget declaration
|
||||||
};// end of nameSpace
|
};// end of nameSpace
|
||||||
|
@ -27,19 +27,9 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::WidgetManager"
|
#define __class__ "ewol::WidgetManager"
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
typedef struct {
|
|
||||||
int32_t widgetId;
|
|
||||||
ewol::Widget* widgetPointer;
|
|
||||||
} widgetList_ts;
|
|
||||||
};
|
|
||||||
|
|
||||||
static pthread_mutex_t localMutex;
|
static pthread_mutex_t localMutex;
|
||||||
static bool IsInit = false;
|
static bool IsInit = false;
|
||||||
|
|
||||||
// internal element of the widget manager :
|
|
||||||
static etk::VectorType<widgetList_ts> m_widgetList; // all widget allocated ==> all time increment ... never removed ...
|
|
||||||
static etk::VectorType<widgetList_ts> m_widgetDeletedList; // all widget allocated
|
|
||||||
// For the focus Management
|
// For the focus Management
|
||||||
static ewol::Widget * m_focusWidgetDefault = NULL;
|
static ewol::Widget * m_focusWidgetDefault = NULL;
|
||||||
static ewol::Widget * m_focusWidgetCurrent = NULL;
|
static ewol::Widget * m_focusWidgetCurrent = NULL;
|
||||||
@ -51,7 +41,6 @@ void ewol::widgetManager::Init(void)
|
|||||||
int ret = pthread_mutex_init(&localMutex, NULL);
|
int ret = pthread_mutex_init(&localMutex, NULL);
|
||||||
EWOL_ASSERT(ret == 0, "Error creating Mutex ...");
|
EWOL_ASSERT(ret == 0, "Error creating Mutex ...");
|
||||||
// prevent android error ==> can create memory leak but I prefer
|
// prevent android error ==> can create memory leak but I prefer
|
||||||
m_widgetList.Clear();
|
|
||||||
m_focusWidgetDefault = NULL;
|
m_focusWidgetDefault = NULL;
|
||||||
m_focusWidgetCurrent = NULL;
|
m_focusWidgetCurrent = NULL;
|
||||||
IsInit = true;
|
IsInit = true;
|
||||||
@ -64,91 +53,15 @@ void ewol::widgetManager::UnInit(void)
|
|||||||
ewol::widgetManager::FocusSetDefault(NULL);
|
ewol::widgetManager::FocusSetDefault(NULL);
|
||||||
ewol::widgetManager::FocusRelease();
|
ewol::widgetManager::FocusRelease();
|
||||||
|
|
||||||
ewol::widgetManager::RemoveAllMarkWidget();
|
|
||||||
|
|
||||||
EWOL_INFO(" Remove missing user widget");
|
|
||||||
while(0<m_widgetList.Size()) {
|
|
||||||
if (m_widgetList[0].widgetPointer!=NULL) {
|
|
||||||
MarkWidgetToBeRemoved(m_widgetList[0].widgetPointer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// local acces ==> this control the mutex Lock
|
|
||||||
ewol::widgetManager::RemoveAllMarkWidget();
|
|
||||||
|
|
||||||
IsInit = false;
|
IsInit = false;
|
||||||
|
|
||||||
int ret = pthread_mutex_destroy(&localMutex);
|
int ret = pthread_mutex_destroy(&localMutex);
|
||||||
EWOL_ASSERT(ret == 0, "Error destroying Mutex ...");
|
EWOL_ASSERT(ret == 0, "Error destroying Mutex ...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widgetManager::Add(ewol::Widget * newWidget)
|
|
||||||
{
|
|
||||||
static int32_t UniqueWidgetId = 0;
|
|
||||||
// Check existance
|
|
||||||
int32_t tmpID = ewol::widgetManager::Get(newWidget);
|
|
||||||
if (0 > tmpID) {
|
|
||||||
widgetList_ts tmpElement;
|
|
||||||
tmpElement.widgetId = UniqueWidgetId++;
|
|
||||||
tmpElement.widgetPointer = newWidget;
|
|
||||||
m_widgetList.PushBack(tmpElement);
|
|
||||||
} else {
|
|
||||||
EWOL_WARNING("Widget Already added to the widget manager, id=" << tmpID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::widgetManager::Rm(ewol::Widget * newWidget)
|
void ewol::widgetManager::Rm(ewol::Widget * newWidget)
|
||||||
{
|
{
|
||||||
if (NULL == newWidget) {
|
FocusRemoveIfRemove(newWidget);
|
||||||
EWOL_ERROR("Try to remove (NULL) Widget");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<m_widgetList.Size(); iii++) {
|
|
||||||
if (m_widgetList[iii].widgetPointer == newWidget) {
|
|
||||||
FocusRemoveIfRemove(newWidget);
|
|
||||||
// Remove Element
|
|
||||||
m_widgetList.Erase(iii);
|
|
||||||
EWOL_CRITICAL("Widget direct remove is really DANGEROUS due to the multithreading ...");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<m_widgetDeletedList.Size(); iii++) {
|
|
||||||
if (m_widgetDeletedList[iii].widgetPointer == newWidget) {
|
|
||||||
// Remove focus here is an impossible case ...
|
|
||||||
FocusRemoveIfRemove(newWidget);
|
|
||||||
// Remove Element
|
|
||||||
m_widgetDeletedList.Erase(iii);
|
|
||||||
//Normal remove of the widget ...
|
|
||||||
//EWOL_DEBUG("Remove element " << iii);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EWOL_ERROR("Widget already removed ...");
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t ewol::widgetManager::Get(ewol::Widget * newWidget)
|
|
||||||
{
|
|
||||||
if (NULL == newWidget) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
for(int32_t iii=0; iii<m_widgetList.Size(); iii++) {
|
|
||||||
if (m_widgetList[iii].widgetPointer == newWidget) {
|
|
||||||
return m_widgetList[iii].widgetId;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ewol::Widget * ewol::widgetManager::Get(int32_t widgetId)
|
|
||||||
{
|
|
||||||
if (0 > widgetId) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
for(int32_t iii=0; iii<m_widgetList.Size(); iii++) {
|
|
||||||
if (m_widgetList[iii].widgetId == widgetId) {
|
|
||||||
return m_widgetList[iii].widgetPointer;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *************************************************************************
|
/* *************************************************************************
|
||||||
@ -170,12 +83,12 @@ void ewol::widgetManager::FocusKeep(ewol::Widget * newWidget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NULL != m_focusWidgetCurrent) {
|
if (NULL != m_focusWidgetCurrent) {
|
||||||
EWOL_DEBUG("Rm Focus on WidgetID=" << ewol::widgetManager::Get(m_focusWidgetCurrent));
|
EWOL_DEBUG("Rm Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
|
||||||
m_focusWidgetCurrent->RmFocus();
|
m_focusWidgetCurrent->RmFocus();
|
||||||
}
|
}
|
||||||
m_focusWidgetCurrent = newWidget;
|
m_focusWidgetCurrent = newWidget;
|
||||||
if (NULL != m_focusWidgetCurrent) {
|
if (NULL != m_focusWidgetCurrent) {
|
||||||
EWOL_DEBUG("Set Focus on WidgetID=" << ewol::widgetManager::Get(m_focusWidgetCurrent));
|
EWOL_DEBUG("Set Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
|
||||||
m_focusWidgetCurrent->SetFocus();
|
m_focusWidgetCurrent->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,17 +97,17 @@ void ewol::widgetManager::FocusKeep(ewol::Widget * newWidget)
|
|||||||
void ewol::widgetManager::FocusSetDefault(ewol::Widget * newWidget)
|
void ewol::widgetManager::FocusSetDefault(ewol::Widget * newWidget)
|
||||||
{
|
{
|
||||||
if (NULL != newWidget && false == newWidget->CanHaveFocus()) {
|
if (NULL != newWidget && false == newWidget->CanHaveFocus()) {
|
||||||
EWOL_VERBOSE("Widget can not have Focus, id=" << ewol::widgetManager::Get(newWidget));
|
EWOL_VERBOSE("Widget can not have Focus, id=" << newWidget->GetId() );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_focusWidgetDefault == m_focusWidgetCurrent) {
|
if (m_focusWidgetDefault == m_focusWidgetCurrent) {
|
||||||
if (NULL != m_focusWidgetCurrent) {
|
if (NULL != m_focusWidgetCurrent) {
|
||||||
EWOL_DEBUG("Rm Focus on WidgetID=" << ewol::widgetManager::Get(m_focusWidgetCurrent));
|
EWOL_DEBUG("Rm Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
|
||||||
m_focusWidgetCurrent->RmFocus();
|
m_focusWidgetCurrent->RmFocus();
|
||||||
}
|
}
|
||||||
m_focusWidgetCurrent = newWidget;
|
m_focusWidgetCurrent = newWidget;
|
||||||
if (NULL != m_focusWidgetCurrent) {
|
if (NULL != m_focusWidgetCurrent) {
|
||||||
EWOL_DEBUG("Set Focus on WidgetID=" << ewol::widgetManager::Get(m_focusWidgetCurrent));
|
EWOL_DEBUG("Set Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
|
||||||
m_focusWidgetCurrent->SetFocus();
|
m_focusWidgetCurrent->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,12 +122,12 @@ void ewol::widgetManager::FocusRelease(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (NULL != m_focusWidgetCurrent) {
|
if (NULL != m_focusWidgetCurrent) {
|
||||||
EWOL_DEBUG("Rm Focus on WidgetID=" << ewol::widgetManager::Get(m_focusWidgetCurrent));
|
EWOL_DEBUG("Rm Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
|
||||||
m_focusWidgetCurrent->RmFocus();
|
m_focusWidgetCurrent->RmFocus();
|
||||||
}
|
}
|
||||||
m_focusWidgetCurrent = m_focusWidgetDefault;
|
m_focusWidgetCurrent = m_focusWidgetDefault;
|
||||||
if (NULL != m_focusWidgetCurrent) {
|
if (NULL != m_focusWidgetCurrent) {
|
||||||
EWOL_DEBUG("Set Focus on WidgetID=" << ewol::widgetManager::Get(m_focusWidgetCurrent));
|
EWOL_DEBUG("Set Focus on WidgetID=" << m_focusWidgetCurrent->GetId() );
|
||||||
m_focusWidgetCurrent->SetFocus();
|
m_focusWidgetCurrent->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,29 +153,18 @@ void ewol::widgetManager::FocusRemoveIfRemove(ewol::Widget * newWidget)
|
|||||||
|
|
||||||
static bool needRedraw = true;
|
static bool needRedraw = true;
|
||||||
|
|
||||||
void ewol::widgetManager::GetDoubleBufferFlipFlop(void)
|
void ewol::widgetManager::DoubleBufferLock(void)
|
||||||
{
|
|
||||||
ewol::widgetManager::RemoveAllMarkWidget();
|
|
||||||
pthread_mutex_lock(&localMutex);
|
|
||||||
// flip/Flop all the widget registered :
|
|
||||||
for(int32_t iii=0; iii<m_widgetList.Size(); iii++) {
|
|
||||||
if (NULL != m_widgetList[iii].widgetPointer) {
|
|
||||||
m_widgetList[iii].widgetPointer->DoubleBufferFlipFlop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
needRedraw = true;
|
|
||||||
// Remove the deprecated flipFlop elements ...
|
|
||||||
|
|
||||||
pthread_mutex_unlock(&localMutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::widgetManager::GetDoubleBufferStartDraw(void)
|
|
||||||
{
|
{
|
||||||
if (IsInit) {
|
if (IsInit) {
|
||||||
pthread_mutex_lock(&localMutex);
|
pthread_mutex_lock(&localMutex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::widgetManager::SetDoubleBufferNeedDraw(void)
|
||||||
|
{
|
||||||
|
needRedraw = true;
|
||||||
|
}
|
||||||
|
|
||||||
bool ewol::widgetManager::GetDoubleBufferNeedDraw(void)
|
bool ewol::widgetManager::GetDoubleBufferNeedDraw(void)
|
||||||
{
|
{
|
||||||
if (true == needRedraw) {
|
if (true == needRedraw) {
|
||||||
@ -272,7 +174,7 @@ bool ewol::widgetManager::GetDoubleBufferNeedDraw(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widgetManager::GetDoubleBufferStopDraw(void)
|
void ewol::widgetManager::DoubleBufferUnLock(void)
|
||||||
{
|
{
|
||||||
if (IsInit) {
|
if (IsInit) {
|
||||||
pthread_mutex_unlock(&localMutex);
|
pthread_mutex_unlock(&localMutex);
|
||||||
@ -280,66 +182,3 @@ void ewol::widgetManager::GetDoubleBufferStopDraw(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::widgetManager::MarkWidgetToBeRemoved(int32_t widgetId)
|
|
||||||
{
|
|
||||||
MarkWidgetToBeRemoved(ewol::widgetManager::Get(widgetId));
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::widgetManager::MarkWidgetToBeRemoved(ewol::Widget * expectedWidget)
|
|
||||||
{
|
|
||||||
if (expectedWidget == NULL) {
|
|
||||||
EWOL_WARNING("try to remove a NULL Pointer on the widget");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int32_t findId = -1;
|
|
||||||
// check if the widget is not destroy :
|
|
||||||
for(int32_t iii=0; iii<m_widgetList.Size(); iii++) {
|
|
||||||
if (m_widgetList[iii].widgetPointer == expectedWidget) {
|
|
||||||
findId = iii;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (-1 == findId) {
|
|
||||||
EWOL_CRITICAL("Try to connect a wiget that is already removed or not registerd (imposible case)");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Remove the focus ..
|
|
||||||
FocusRemoveIfRemove(expectedWidget);
|
|
||||||
// move the widget from the basic list and set it in the remove list
|
|
||||||
widgetList_ts tmpWidgetProperty = m_widgetList[findId];
|
|
||||||
m_widgetList.Erase(findId);
|
|
||||||
// Unlink from the parrent ...
|
|
||||||
// TODO : Set it again ....
|
|
||||||
//tmpWidgetProperty.widgetPointer->UnlinkParrent();
|
|
||||||
// add ...
|
|
||||||
m_widgetDeletedList.PushBack(tmpWidgetProperty);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::widgetManager::RemoveAllMarkWidget(void)
|
|
||||||
{
|
|
||||||
etk::VectorType<widgetList_ts> m_widgetDeletedList_tmp = m_widgetDeletedList;
|
|
||||||
/*
|
|
||||||
if (m_widgetDeletedList.Size() > 0 ) {
|
|
||||||
EWOL_DEBUG("NB element to remove : " << m_widgetDeletedList.Size());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// flip/Flop all the widget registered :
|
|
||||||
for(int32_t iii=0; iii<m_widgetDeletedList_tmp.Size(); iii++) {
|
|
||||||
if (NULL != m_widgetDeletedList_tmp[iii].widgetPointer) {
|
|
||||||
delete(m_widgetDeletedList_tmp[iii].widgetPointer);
|
|
||||||
m_widgetDeletedList_tmp[iii].widgetPointer = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
if (m_widgetDeletedList.Size() > 0 ) {
|
|
||||||
EWOL_CRITICAL("Memory leak ==> not all the widget are auto-removed nb = " << m_widgetDeletedList.Size());
|
|
||||||
// in every case clean the list ...
|
|
||||||
m_widgetDeletedList.Clear();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -35,10 +35,8 @@ namespace ewol {
|
|||||||
namespace widgetManager {
|
namespace widgetManager {
|
||||||
void Init( void);
|
void Init( void);
|
||||||
void UnInit(void);
|
void UnInit(void);
|
||||||
void Add( ewol::Widget * newWidget);
|
// need to call when remove a widget to clear all dependency of the focus system
|
||||||
void Rm( ewol::Widget * newWidget);
|
void Rm( ewol::Widget * newWidget);
|
||||||
int32_t Get( ewol::Widget * newWidget);
|
|
||||||
ewol::Widget * Get( int32_t widgetId);
|
|
||||||
|
|
||||||
void FocusKeep( ewol::Widget * newWidget); // set the focus at the specific widget
|
void FocusKeep( ewol::Widget * newWidget); // set the focus at the specific widget
|
||||||
void FocusSetDefault(ewol::Widget * newWidget); // select the default focus getter
|
void FocusSetDefault(ewol::Widget * newWidget); // select the default focus getter
|
||||||
@ -46,18 +44,13 @@ namespace ewol {
|
|||||||
ewol::Widget * FocusGet( void);
|
ewol::Widget * FocusGet( void);
|
||||||
void FocusRemoveIfRemove(ewol::Widget * newWidget);
|
void FocusRemoveIfRemove(ewol::Widget * newWidget);
|
||||||
|
|
||||||
|
// TODO : Remove this from here ...
|
||||||
int32_t GetDoubleBufferCreate(void);
|
int32_t GetDoubleBufferCreate(void);
|
||||||
int32_t GetDoubleBufferDraw(void);
|
int32_t GetDoubleBufferDraw(void);
|
||||||
void GetDoubleBufferFlipFlop(void);
|
|
||||||
bool GetDoubleBufferNeedDraw(void);
|
bool GetDoubleBufferNeedDraw(void);
|
||||||
void GetDoubleBufferStartDraw(void);
|
void SetDoubleBufferNeedDraw(void);
|
||||||
void GetDoubleBufferStopDraw(void);
|
void DoubleBufferLock(void);
|
||||||
|
void DoubleBufferUnLock(void);
|
||||||
// For the multithreaded context the widget mus not de removed by the user ==> he might mark if to be remove later with a mutex protection...
|
|
||||||
void MarkWidgetToBeRemoved(int32_t widgetId);
|
|
||||||
void MarkWidgetToBeRemoved(ewol::Widget * expectedWidget);
|
|
||||||
void RemoveAllMarkWidget(void);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,110 +0,0 @@
|
|||||||
/**
|
|
||||||
*******************************************************************************
|
|
||||||
* @file ewol/WidgetMessageMultiCast.cpp
|
|
||||||
* @brief basic ewol Widget Message Multi-cast (Sources)
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
* @date 31/01/2012
|
|
||||||
* @par Project
|
|
||||||
* ewol
|
|
||||||
*
|
|
||||||
* @par Copyright
|
|
||||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY.
|
|
||||||
*
|
|
||||||
* Licence summary :
|
|
||||||
* You can modify and redistribute the sources code and binaries.
|
|
||||||
* You can send me the bug-fix
|
|
||||||
*
|
|
||||||
* Term of the licence in in the file licence.txt.
|
|
||||||
*
|
|
||||||
*******************************************************************************
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ewol/WidgetMessageMultiCast.h>
|
|
||||||
#include <ewol/WidgetManager.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "ewol::WidgetMessageMultiCast"
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
typedef struct {
|
|
||||||
int32_t widgetId;
|
|
||||||
const char* message;
|
|
||||||
} messageList_ts;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// internal element of the widget manager :
|
|
||||||
static etk::VectorType<messageList_ts> m_messageList; // all widget allocated ==> all time increment ... never removed ...
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::widgetMessageMultiCast::Init(void)
|
|
||||||
{
|
|
||||||
EWOL_INFO("user widget message Multi-Cast");
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::widgetMessageMultiCast::UnInit(void)
|
|
||||||
{
|
|
||||||
EWOL_INFO("user widget message Multi-Cast");
|
|
||||||
m_messageList.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::widgetMessageMultiCast::Add(int32_t widgetId, const char* const message)
|
|
||||||
{
|
|
||||||
// TODO : Check if the message exist before ...
|
|
||||||
messageList_ts tmpMessage;
|
|
||||||
tmpMessage.widgetId = widgetId;
|
|
||||||
tmpMessage.message = message;
|
|
||||||
m_messageList.PushBack(tmpMessage);
|
|
||||||
EWOL_DEBUG("SendMulticast ADD listener :" << widgetId << " on \"" << message << "\"" );
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO : Do this better ...
|
|
||||||
void ewol::widgetMessageMultiCast::Rm(int32_t widgetId)
|
|
||||||
{
|
|
||||||
// send the message at all registered widget ...
|
|
||||||
for (int32_t iii=0; iii<m_messageList.Size(); iii++) {
|
|
||||||
if(m_messageList[iii].widgetId == widgetId) {
|
|
||||||
EWOL_DEBUG("SendMulticast RM listener :" << widgetId);
|
|
||||||
m_messageList[iii].message = NULL;
|
|
||||||
m_messageList[iii].widgetId = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::widgetMessageMultiCast::Send(int32_t widgetId, const char* const message, int32_t data)
|
|
||||||
{
|
|
||||||
char tmpData[50];
|
|
||||||
sprintf(tmpData, "%d", data);
|
|
||||||
Send(widgetId, message, tmpData);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::widgetMessageMultiCast::Send(int32_t widgetId, const char* const message, const char * data)
|
|
||||||
{
|
|
||||||
if (data!=NULL) {
|
|
||||||
EWOL_DEBUG("SendMulticast message \"" << message << "\" data=\"" << data << "\" to :");
|
|
||||||
} else {
|
|
||||||
EWOL_DEBUG("SendMulticast message \"" << message << "\" data=NULL to :");
|
|
||||||
}
|
|
||||||
// send the message at all registered widget ...
|
|
||||||
for (int32_t iii=0; iii<m_messageList.Size(); iii++) {
|
|
||||||
if( m_messageList[iii].message == message
|
|
||||||
&& m_messageList[iii].widgetId != widgetId)
|
|
||||||
{
|
|
||||||
ewol::Widget * tmpWidget = ewol::widgetManager::Get(m_messageList[iii].widgetId);
|
|
||||||
if (NULL != tmpWidget) {
|
|
||||||
EWOL_DEBUG(" id = " << m_messageList[iii].widgetId);
|
|
||||||
// generate event ...
|
|
||||||
(void)tmpWidget->OnEventAreaExternal(widgetId, m_messageList[iii].message, data, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::widgetMessageMultiCast::Send(int32_t widgetId, const char* const message, etk::UString& data)
|
|
||||||
{
|
|
||||||
Send(widgetId, message, data.Utf8Data());
|
|
||||||
}
|
|
||||||
|
|
@ -57,20 +57,20 @@ ewol::Windows::Windows(void)
|
|||||||
ewol::Windows::~Windows(void)
|
ewol::Windows::~Windows(void)
|
||||||
{
|
{
|
||||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId]);
|
m_subWidget[m_currentCreateId]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId]=NULL;
|
m_subWidget[m_currentCreateId]=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) {
|
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) {
|
||||||
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_popUpWidgetList[m_currentCreateId][iii]);
|
m_popUpWidgetList[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_popUpWidgetList[m_currentCreateId][iii]=NULL;
|
m_popUpWidgetList[m_currentCreateId][iii]=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_popUpWidgetList[m_currentCreateId].Clear();
|
m_popUpWidgetList[m_currentCreateId].Clear();
|
||||||
|
|
||||||
if (NULL != m_keyBoardwidget) {
|
if (NULL != m_keyBoardwidget) {
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_keyBoardwidget);
|
m_keyBoardwidget->MarkToRemove();
|
||||||
m_keyBoardwidget=NULL;
|
m_keyBoardwidget=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ void ewol::Windows::SetSubWidget(ewol::Widget * widget)
|
|||||||
{
|
{
|
||||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||||
EWOL_INFO("Remove current main windows Widget...");
|
EWOL_INFO("Remove current main windows Widget...");
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId]);
|
m_subWidget[m_currentCreateId]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId] = NULL;
|
m_subWidget[m_currentCreateId] = NULL;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId] = widget;
|
m_subWidget[m_currentCreateId] = widget;
|
||||||
@ -226,23 +226,6 @@ void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
|
|||||||
m_needFlipFlop = true;
|
m_needFlipFlop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Windows::PopUpWidgetPop(int32_t popUpId)
|
|
||||||
{
|
|
||||||
if(popUpId >= 0) {
|
|
||||||
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentCreateId].Size(); iii++) {
|
|
||||||
if (NULL != m_popUpWidgetList[m_currentCreateId][iii]) {
|
|
||||||
if (m_popUpWidgetList[m_currentCreateId][iii]->GetWidgetId() == popUpId) {
|
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_popUpWidgetList[m_currentCreateId][iii]);
|
|
||||||
m_popUpWidgetList[m_currentCreateId][iii] = NULL;
|
|
||||||
m_popUpWidgetList[m_currentCreateId].Erase(iii);
|
|
||||||
m_needFlipFlop = true;
|
|
||||||
CalculateSize(m_size.x, m_size.y);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ewol::Windows::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
bool ewol::Windows::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
@ -288,8 +271,21 @@ void ewol::Windows::KeyboardHide(void)
|
|||||||
|
|
||||||
void ewol::Windows::OnFlipFlopEvent(void)
|
void ewol::Windows::OnFlipFlopEvent(void)
|
||||||
{
|
{
|
||||||
//EWOL_CRITICAL("FlipFlop on windows draw("<<m_currentDrawId<<") create("<<m_currentCreateId<<")");
|
bool needFlipFlop = m_needFlipFlop;
|
||||||
// keep in the current element all the modification done ...
|
// call herited classes
|
||||||
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
ewol::Widget::OnFlipFlopEvent();
|
||||||
m_popUpWidgetList[m_currentCreateId] = m_popUpWidgetList[m_currentDrawId];
|
// internal saving
|
||||||
}
|
if (true == needFlipFlop) {
|
||||||
|
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
||||||
|
m_popUpWidgetList[m_currentCreateId] = m_popUpWidgetList[m_currentDrawId];
|
||||||
|
}
|
||||||
|
// in every case, we propagate the flip-flop EVENT
|
||||||
|
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||||
|
m_subWidget[m_currentDrawId]->OnFlipFlopEvent();
|
||||||
|
}
|
||||||
|
for(int32_t iii=0; iii<m_popUpWidgetList[m_currentDrawId].Size(); iii++) {
|
||||||
|
if(NULL != m_popUpWidgetList[m_currentDrawId][iii]) {
|
||||||
|
m_popUpWidgetList[m_currentDrawId][iii]->OnFlipFlopEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -73,7 +73,6 @@ namespace ewol {
|
|||||||
public:
|
public:
|
||||||
void SetSubWidget(ewol::Widget * widget);
|
void SetSubWidget(ewol::Widget * widget);
|
||||||
void PopUpWidgetPush(ewol::Widget * widget);
|
void PopUpWidgetPush(ewol::Widget * widget);
|
||||||
void PopUpWidgetPop(int32_t popUpId);
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool OnDraw(void);
|
virtual bool OnDraw(void);
|
||||||
public:
|
public:
|
||||||
|
@ -180,8 +180,6 @@ static void* BaseAppEntry(void* param)
|
|||||||
if (0 == ewol::threadMsg::WaitingMessage(androidJniMsg)) {
|
if (0 == ewol::threadMsg::WaitingMessage(androidJniMsg)) {
|
||||||
if (countNbEvent > 0) {
|
if (countNbEvent > 0) {
|
||||||
EWOL_NativeRegenerateDisplay();
|
EWOL_NativeRegenerateDisplay();
|
||||||
// TODO : Generate the display here ... Instead of every time we call the sub-Widget ...
|
|
||||||
ewol::widgetManager::GetDoubleBufferFlipFlop();
|
|
||||||
countNbEvent = 0;
|
countNbEvent = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,12 +48,6 @@ int32_t ewol::GetCurrentHeight(void)
|
|||||||
return gui_height;
|
return gui_height;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::RmPopUp(int32_t widgetID)
|
|
||||||
{
|
|
||||||
if (NULL != gui_uniqueWindows) {
|
|
||||||
gui_uniqueWindows->PopUpWidgetPop(widgetID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::PopUpWidgetPush(ewol::Widget * tmpWidget)
|
void ewol::PopUpWidgetPush(ewol::Widget * tmpWidget)
|
||||||
{
|
{
|
||||||
@ -78,6 +72,9 @@ void EWOL_NativeRegenerateDisplay(void)
|
|||||||
//EWOL_INFO("Resize w=" << w << " h=" << h);
|
//EWOL_INFO("Resize w=" << w << " h=" << h);
|
||||||
if (NULL != gui_uniqueWindows) {
|
if (NULL != gui_uniqueWindows) {
|
||||||
gui_uniqueWindows->OnRegenerateDisplay();
|
gui_uniqueWindows->OnRegenerateDisplay();
|
||||||
|
ewol::widgetManager::DoubleBufferLock();
|
||||||
|
gui_uniqueWindows->OnFlipFlopEvent();
|
||||||
|
ewol::widgetManager::DoubleBufferUnLock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -323,7 +320,7 @@ void EWOL_GenericDraw(bool everyTime)
|
|||||||
if ( (currentTime - startTime) > DISPLAY_PERIODE_MS) {
|
if ( (currentTime - startTime) > DISPLAY_PERIODE_MS) {
|
||||||
display = true;
|
display = true;
|
||||||
}
|
}
|
||||||
ewol::widgetManager::GetDoubleBufferStartDraw();
|
ewol::widgetManager::DoubleBufferLock();
|
||||||
if( true == ewol::widgetManager::GetDoubleBufferNeedDraw()
|
if( true == ewol::widgetManager::GetDoubleBufferNeedDraw()
|
||||||
|| true == everyTime)
|
|| true == everyTime)
|
||||||
{
|
{
|
||||||
@ -331,7 +328,7 @@ void EWOL_GenericDraw(bool everyTime)
|
|||||||
gui_uniqueWindows->SysDraw();
|
gui_uniqueWindows->SysDraw();
|
||||||
//EWOL_WARNING("DRAW...");
|
//EWOL_WARNING("DRAW...");
|
||||||
}
|
}
|
||||||
ewol::widgetManager::GetDoubleBufferStopDraw();
|
ewol::widgetManager::DoubleBufferUnLock();
|
||||||
// send Message that we just finished a display ...
|
// send Message that we just finished a display ...
|
||||||
EWOL_ThreadEventHasJustDisplay();
|
EWOL_ThreadEventHasJustDisplay();
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ namespace ewol {
|
|||||||
void KeyboardHide(void);
|
void KeyboardHide(void);
|
||||||
void ForceRedrawAll(void);
|
void ForceRedrawAll(void);
|
||||||
void PopUpWidgetPush(ewol::Widget * tmpWidget);
|
void PopUpWidgetPush(ewol::Widget * tmpWidget);
|
||||||
void RmPopUp(int32_t widgetID);
|
|
||||||
|
|
||||||
int32_t CmdLineNb(void);
|
int32_t CmdLineNb(void);
|
||||||
etk::UString CmdLineGet(int32_t id);
|
etk::UString CmdLineGet(int32_t id);
|
||||||
|
@ -192,7 +192,7 @@ bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, ev
|
|||||||
|| ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent
|
|| ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent
|
||||||
|| ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
|
|| ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
GenEventInputExternal(ewolEventButtonPressed, pos.abs.x, pos.abs.y);
|
GenerateEventId(ewolEventButtonPressed);
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -206,7 +206,7 @@ bool ewol::Button::OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeDa
|
|||||||
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
||||||
if( typeEvent == ewol::EVENT_KB_TYPE_DOWN
|
if( typeEvent == ewol::EVENT_KB_TYPE_DOWN
|
||||||
&& unicodeData == '\r') {
|
&& unicodeData == '\r') {
|
||||||
GenEventInputExternal(ewolEventButtonEnter, -1, -1);
|
GenerateEventId(ewolEventButtonEnter);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ bool ewol::CheckBox::OnEventInput(int32_t IdInput, eventInputType_te typeEvent,
|
|||||||
} else {
|
} else {
|
||||||
m_value = true;
|
m_value = true;
|
||||||
}
|
}
|
||||||
GenEventInputExternal(ewolEventCheckBoxClicked, pos.abs.x, pos.abs.y);
|
GenerateEventId(ewolEventCheckBoxClicked);
|
||||||
ewol::widgetManager::FocusKeep(this);
|
ewol::widgetManager::FocusKeep(this);
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
return true;
|
return true;
|
||||||
@ -181,7 +181,8 @@ bool ewol::CheckBox::OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData)
|
|||||||
m_value = true;
|
m_value = true;
|
||||||
}
|
}
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
return GenEventInputExternal(ewolEventCheckBoxClicked, -1,-1);
|
GenerateEventId(ewolEventCheckBoxClicked);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -57,12 +57,15 @@ ewol::ContextMenu::ContextMenu(void)
|
|||||||
|
|
||||||
ewol::ContextMenu::~ContextMenu(void)
|
ewol::ContextMenu::~ContextMenu(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
SubWidgetRemove();
|
SubWidgetRemove();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::ContextMenu::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
bool ewol::ContextMenu::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
||||||
// pop-up fill all the display :
|
// pop-up fill all the display :
|
||||||
m_size.x = availlableX;
|
m_size.x = availlableX;
|
||||||
@ -129,12 +132,14 @@ bool ewol::ContextMenu::CalculateSize(etkFloat_t availlableX, etkFloat_t availla
|
|||||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||||
}
|
}
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::ContextMenu::CalculateMinSize(void)
|
bool ewol::ContextMenu::CalculateMinSize(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
EWOL_DEBUG("CalculateMinSize");
|
EWOL_DEBUG("CalculateMinSize");
|
||||||
m_userExpendX=false;
|
m_userExpendX=false;
|
||||||
m_userExpendY=false;
|
m_userExpendY=false;
|
||||||
@ -148,6 +153,7 @@ bool ewol::ContextMenu::CalculateMinSize(void)
|
|||||||
}
|
}
|
||||||
EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,34 +175,41 @@ void ewol::ContextMenu::SetExpendY(bool newExpend)
|
|||||||
|
|
||||||
void ewol::ContextMenu::SubWidgetSet(ewol::Widget* newWidget)
|
void ewol::ContextMenu::SubWidgetSet(ewol::Widget* newWidget)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_subWidget = newWidget;
|
m_subWidget = newWidget;
|
||||||
newWidget->SetParrent(this);
|
newWidget->SetParrent(this);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::ContextMenu::SubWidgetRemove(void)
|
void ewol::ContextMenu::SubWidgetRemove(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget);
|
||||||
m_subWidget = NULL;
|
m_subWidget = NULL;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::ContextMenu::OnDraw(void)
|
bool ewol::ContextMenu::OnDraw(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
ewol::Drawable::OnDraw();
|
ewol::Drawable::OnDraw();
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
m_subWidget->GenDraw();
|
m_subWidget->GenDraw();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::ContextMenu::OnRegenerateDisplay(void)
|
void ewol::ContextMenu::OnRegenerateDisplay(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (true == NeedRedraw()) {
|
if (true == NeedRedraw()) {
|
||||||
}
|
}
|
||||||
// generate a white background and take gray on other surfaces
|
// generate a white background and take gray on other surfaces
|
||||||
@ -240,11 +253,13 @@ void ewol::ContextMenu::OnRegenerateDisplay(void)
|
|||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
m_subWidget->OnRegenerateDisplay();
|
m_subWidget->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::ContextMenu::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos)
|
bool ewol::ContextMenu::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
coord2D_ts tmpSize = m_subWidget->GetSize();
|
coord2D_ts tmpSize = m_subWidget->GetSize();
|
||||||
coord2D_ts tmpOrigin = m_subWidget->GetOrigin();
|
coord2D_ts tmpOrigin = m_subWidget->GetOrigin();
|
||||||
@ -269,14 +284,17 @@ bool ewol::ContextMenu::OnEventInput(int32_t IdInput, eventInputType_te typeEven
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::ContextMenu::SetPositionMark(markPosition_te position, coord2D_ts arrowPos)
|
void ewol::ContextMenu::SetPositionMark(markPosition_te position, coord2D_ts arrowPos)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
EWOL_DEBUG("set context menu at the position : (" << arrowPos.x << "," << arrowPos.y << ")");
|
EWOL_DEBUG("set context menu at the position : (" << arrowPos.x << "," << arrowPos.y << ")");
|
||||||
m_arrawBorder = position;
|
m_arrawBorder = position;
|
||||||
m_arrowPos = arrowPos;
|
m_arrowPos = arrowPos;
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ bool ewol::Entry::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eve
|
|||||||
if (1 == IdInput) {
|
if (1 == IdInput) {
|
||||||
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
GenEventInputExternal(ewolEventEntryClick, pos.abs.x, pos.abs.y);
|
GenerateEventId(ewolEventEntryClick);
|
||||||
ewol::widgetManager::FocusKeep(this);
|
ewol::widgetManager::FocusKeep(this);
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
return true;
|
return true;
|
||||||
@ -202,7 +202,7 @@ bool ewol::Entry::OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData)
|
|||||||
unicode::convertUnicodeToUtf8(unicodeData, UTF8_data);
|
unicode::convertUnicodeToUtf8(unicodeData, UTF8_data);
|
||||||
m_data += UTF8_data;
|
m_data += UTF8_data;
|
||||||
}
|
}
|
||||||
GenEventInputExternal(ewolEventEntryModify, -1, -1);
|
GenerateEventId(ewolEventEntryModify);
|
||||||
UpdateTextPosition();
|
UpdateTextPosition();
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
return true;
|
return true;
|
||||||
|
@ -126,7 +126,7 @@ bool ewol::Label::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eve
|
|||||||
if (1 == IdInput) {
|
if (1 == IdInput) {
|
||||||
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
GenEventInputExternal(ewolEventLabelPressed, pos.abs.x, pos.abs.y);
|
GenerateEventId(ewolEventLabelPressed);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/WidgetMessageMultiCast.h>
|
#include <ewol/EObjectMessageMulticast.h>
|
||||||
#include <ewol/WidgetManager.h>
|
#include <ewol/WidgetManager.h>
|
||||||
#include <ewol/widget/Menu.h>
|
#include <ewol/widget/Menu.h>
|
||||||
#include <ewol/widget/Button.h>
|
#include <ewol/widget/Button.h>
|
||||||
@ -37,8 +37,8 @@
|
|||||||
|
|
||||||
ewol::Menu::Menu(void)
|
ewol::Menu::Menu(void)
|
||||||
{
|
{
|
||||||
m_staticId = 0;
|
m_staticPointer = NULL;
|
||||||
m_popUpId = -1;
|
m_widgetPopUp = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Menu::~Menu(void)
|
ewol::Menu::~Menu(void)
|
||||||
@ -68,6 +68,7 @@ void ewol::Menu::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
|
|
||||||
void ewol::Menu::Clear(void)
|
void ewol::Menu::Clear(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
for( int32_t iii=0; iii < m_listElement.Size(); iii++) {
|
for( int32_t iii=0; iii < m_listElement.Size(); iii++) {
|
||||||
if (m_listElement[iii] != NULL) {
|
if (m_listElement[iii] != NULL) {
|
||||||
delete(m_listElement[iii]);
|
delete(m_listElement[iii]);
|
||||||
@ -75,6 +76,7 @@ void ewol::Menu::Clear(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_listElement.Clear();
|
m_listElement.Clear();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t ewol::Menu::AddTitle(etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message)
|
int32_t ewol::Menu::AddTitle(etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message)
|
||||||
@ -84,6 +86,7 @@ int32_t ewol::Menu::AddTitle(etk::UString label, etk::UString image, const char
|
|||||||
|
|
||||||
int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message)
|
int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image, const char * generateEvent, const etk::UString message)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
ewol::MenuElement * tmpObject = new ewol::MenuElement();
|
ewol::MenuElement * tmpObject = new ewol::MenuElement();
|
||||||
if (NULL == tmpObject) {
|
if (NULL == tmpObject) {
|
||||||
EWOL_ERROR("Allocation problem");
|
EWOL_ERROR("Allocation problem");
|
||||||
@ -109,6 +112,8 @@ int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image,
|
|||||||
tmpObject->m_widgetId = myButton->GetWidgetId();
|
tmpObject->m_widgetId = myButton->GetWidgetId();
|
||||||
}
|
}
|
||||||
return tmpObject->m_localId;
|
return tmpObject->m_localId;
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Menu::AddSpacer(void)
|
void ewol::Menu::AddSpacer(void)
|
||||||
@ -119,17 +124,21 @@ void ewol::Menu::AddSpacer(void)
|
|||||||
|
|
||||||
bool ewol::Menu::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
bool ewol::Menu::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (true == ewol::SizerHori::OnEventAreaExternal(widgetID, generateEventId, data, x, y)) {
|
if (true == ewol::SizerHori::OnEventAreaExternal(widgetID, generateEventId, data, x, y)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
/*
|
||||||
if (NULL==data && generateEventId==ewolEventButtonPressed) {
|
if (NULL==data && generateEventId==ewolEventButtonPressed) {
|
||||||
for(int32_t iii=0; iii<m_listElement.Size(); iii++) {
|
for(int32_t iii=0; iii<m_listElement.Size(); iii++) {
|
||||||
if (widgetID == m_listElement[iii]->m_widgetId) {
|
if (widgetID == m_listElement[iii]->m_widgetId) {
|
||||||
// 2 posible case
|
// 2 posible case
|
||||||
if (m_listElement[iii]->m_generateEvent != NULL) {
|
if (m_listElement[iii]->m_generateEvent != NULL) {
|
||||||
ewol::widgetMessageMultiCast::Send(GetWidgetId(), m_listElement[iii]->m_generateEvent, m_listElement[iii]->m_message);
|
// TODO : Later ...
|
||||||
ewol::RmPopUp(m_popUpId);
|
//ewol::widgetMessageMultiCast::Send(GetWidgetId(), m_listElement[iii]->m_generateEvent, m_listElement[iii]->m_message);
|
||||||
m_popUpId = -1;
|
m_widgetPopUp->MarkToRemove();
|
||||||
|
m_widgetPopUp = NULL;
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
bool findChild = false;
|
bool findChild = false;
|
||||||
@ -178,20 +187,21 @@ bool ewol::Menu::OnEventAreaExternal(int32_t widgetID, const char * generateEven
|
|||||||
if (NULL == myButton) {
|
if (NULL == myButton) {
|
||||||
EWOL_ERROR("Allocation Error");
|
EWOL_ERROR("Allocation Error");
|
||||||
}
|
}
|
||||||
m_listElement[jjj]->m_widgetId = myButton->GetWidgetId();
|
m_listElement[jjj]->m_widgetPointer = myButton;
|
||||||
myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ewolEventButtonPressed);
|
myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed, "");
|
||||||
myButton->SetExpendX(true);
|
myButton->SetExpendX(true);
|
||||||
myButton->SetFillX(true);
|
myButton->SetFillX(true);
|
||||||
myButton->SetAlignement(ewol::TEXT_ALIGN_LEFT);
|
myButton->SetAlignement(ewol::TEXT_ALIGN_LEFT);
|
||||||
mySizerVert->SubWidgetAdd(myButton);
|
mySizerVert->SubWidgetAdd(myButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_popUpId = tmpWidget->GetWidgetId();
|
m_staticPointer = tmpWidget;
|
||||||
ewol::PopUpWidgetPush(tmpWidget);
|
ewol::PopUpWidgetPush(m_staticPointer);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ namespace ewol {
|
|||||||
public :
|
public :
|
||||||
int32_t m_localId;
|
int32_t m_localId;
|
||||||
int32_t m_parentId;
|
int32_t m_parentId;
|
||||||
int32_t m_widgetId;
|
ewol::EObject* m_widgetPointer;
|
||||||
etk::UString m_label;
|
etk::UString m_label;
|
||||||
etk::UString m_image;
|
etk::UString m_image;
|
||||||
const char * m_generateEvent;
|
const char * m_generateEvent;
|
||||||
@ -55,8 +55,8 @@ namespace ewol {
|
|||||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
||||||
private:
|
private:
|
||||||
etk::VectorType<MenuElement*> m_listElement;
|
etk::VectorType<MenuElement*> m_listElement;
|
||||||
int32_t m_staticId;
|
ewol::EObject* m_staticPointer;
|
||||||
int32_t m_popUpId;
|
ewol::EObject* m_widgetPopUp;
|
||||||
public:
|
public:
|
||||||
void Clear(void);
|
void Clear(void);
|
||||||
int32_t AddTitle(etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = "");
|
int32_t AddTitle(etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = "");
|
||||||
|
@ -54,6 +54,7 @@ ewol::PopUp::~PopUp(void)
|
|||||||
|
|
||||||
bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
//EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
//EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
||||||
// pop-up fill all the display :
|
// pop-up fill all the display :
|
||||||
m_size.x = availlableX;
|
m_size.x = availlableX;
|
||||||
@ -84,12 +85,14 @@ bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
|||||||
m_subWidget[m_currentCreateId]->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
m_subWidget[m_currentCreateId]->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||||
}
|
}
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::PopUp::CalculateMinSize(void)
|
bool ewol::PopUp::CalculateMinSize(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
//EWOL_DEBUG("CalculateMinSize");
|
//EWOL_DEBUG("CalculateMinSize");
|
||||||
m_userExpendX=false;
|
m_userExpendX=false;
|
||||||
m_userExpendY=false;
|
m_userExpendY=false;
|
||||||
@ -103,6 +106,7 @@ bool ewol::PopUp::CalculateMinSize(void)
|
|||||||
}
|
}
|
||||||
//EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
//EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,35 +128,42 @@ void ewol::PopUp::SetExpendY(bool newExpend)
|
|||||||
|
|
||||||
void ewol::PopUp::SubWidgetSet(ewol::Widget* newWidget)
|
void ewol::PopUp::SubWidgetSet(ewol::Widget* newWidget)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId] = newWidget;
|
m_subWidget[m_currentCreateId] = newWidget;
|
||||||
newWidget->SetParrent(this);
|
newWidget->SetParrent(this);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::PopUp::SubWidgetRemove(void)
|
void ewol::PopUp::SubWidgetRemove(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId]);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId]);
|
||||||
m_subWidget[m_currentCreateId] = NULL;
|
m_subWidget[m_currentCreateId] = NULL;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::PopUp::OnDraw(void)
|
bool ewol::PopUp::OnDraw(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
// draw upper classes
|
// draw upper classes
|
||||||
ewol::Drawable::OnDraw();
|
ewol::Drawable::OnDraw();
|
||||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||||
m_subWidget[m_currentDrawId]->GenDraw();
|
m_subWidget[m_currentDrawId]->GenDraw();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::PopUp::OnRegenerateDisplay(void)
|
void ewol::PopUp::OnRegenerateDisplay(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (true == NeedRedraw()) {
|
if (true == NeedRedraw()) {
|
||||||
}
|
}
|
||||||
// generate a white background and take gray on other surfaces
|
// generate a white background and take gray on other surfaces
|
||||||
@ -172,11 +183,13 @@ void ewol::PopUp::OnRegenerateDisplay(void)
|
|||||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||||
m_subWidget[m_currentCreateId]->OnRegenerateDisplay();
|
m_subWidget[m_currentCreateId]->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::PopUp::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos)
|
bool ewol::PopUp::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||||
coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize();
|
coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize();
|
||||||
coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin();
|
coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin();
|
||||||
@ -189,19 +202,29 @@ bool ewol::PopUp::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eve
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::PopUp::SetDisplayRatio(etkFloat_t ratio)
|
void ewol::PopUp::SetDisplayRatio(etkFloat_t ratio)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
m_displayRatio = ratio;
|
m_displayRatio = ratio;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::PopUp::OnFlipFlopEvent(void)
|
void ewol::PopUp::OnFlipFlopEvent(void)
|
||||||
{
|
{
|
||||||
// keep in the current element all the modification done ...
|
bool needFlipFlop = m_needFlipFlop;
|
||||||
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
// call herited classes
|
||||||
|
ewol::Widget::OnFlipFlopEvent();
|
||||||
|
// internal saving
|
||||||
|
if (true == needFlipFlop) {
|
||||||
|
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
||||||
|
}
|
||||||
|
// in every case, we propagate the flip-flop EVENT
|
||||||
|
if(NULL != m_subWidget[m_currentDrawId]) {
|
||||||
|
m_subWidget[m_currentDrawId]->OnFlipFlopEvent();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ void ewol::SizerHori::SubWidgetRemoveAll(void)
|
|||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId][iii]);
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -178,7 +178,6 @@ void ewol::SizerHori::SubWidgetAdd(ewol::Widget* newWidget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].PushBack(newWidget);
|
m_subWidget[m_currentCreateId].PushBack(newWidget);
|
||||||
newWidget->SetParrent(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -190,7 +189,7 @@ void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget)
|
|||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||||
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
if (NULL != m_subWidget[m_currentCreateId][iii]) {
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId][iii]);
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].Erase(iii);
|
||||||
@ -254,8 +253,18 @@ bool ewol::SizerHori::OnEventInput(int32_t IdInput, eventInputType_te typeEvent,
|
|||||||
|
|
||||||
void ewol::SizerHori::OnFlipFlopEvent(void)
|
void ewol::SizerHori::OnFlipFlopEvent(void)
|
||||||
{
|
{
|
||||||
// keep in the current element all the modification done ...
|
bool needFlipFlop = m_needFlipFlop;
|
||||||
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
// call herited classes
|
||||||
|
ewol::Widget::OnFlipFlopEvent();
|
||||||
|
// internal saving
|
||||||
|
if (true == needFlipFlop) {
|
||||||
|
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
||||||
|
}
|
||||||
|
// in every case, we propagate the flip-flop EVENT
|
||||||
|
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
||||||
|
if(NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
|
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ void ewol::SizerVert::LockExpendContamination(bool lockExpend)
|
|||||||
void ewol::SizerVert::SubWidgetRemoveAll(void)
|
void ewol::SizerVert::SubWidgetRemoveAll(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId][iii]);
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].Clear();
|
m_subWidget[m_currentCreateId].Clear();
|
||||||
@ -179,7 +179,6 @@ void ewol::SizerVert::SubWidgetAdd(ewol::Widget* newWidget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_subWidget[m_currentCreateId].PushBack(newWidget);
|
m_subWidget[m_currentCreateId].PushBack(newWidget);
|
||||||
newWidget->SetParrent(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -190,7 +189,7 @@ void ewol::SizerVert::SubWidgetRemove(ewol::Widget* newWidget)
|
|||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget[m_currentCreateId].Size(); iii++) {
|
||||||
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
if (newWidget == m_subWidget[m_currentCreateId][iii]) {
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId][iii]);
|
m_subWidget[m_currentCreateId][iii]->MarkToRemove();
|
||||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||||
m_subWidget[m_currentCreateId].Erase(iii);
|
m_subWidget[m_currentCreateId].Erase(iii);
|
||||||
return;
|
return;
|
||||||
@ -253,7 +252,18 @@ bool ewol::SizerVert::OnEventInput(int32_t IdInput, eventInputType_te typeEvent,
|
|||||||
|
|
||||||
void ewol::SizerVert::OnFlipFlopEvent(void)
|
void ewol::SizerVert::OnFlipFlopEvent(void)
|
||||||
{
|
{
|
||||||
// keep in the current element all the modification done ...
|
bool needFlipFlop = m_needFlipFlop;
|
||||||
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
// call herited classes
|
||||||
|
ewol::Widget::OnFlipFlopEvent();
|
||||||
|
// internal saving
|
||||||
|
if (true == needFlipFlop) {
|
||||||
|
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
||||||
|
}
|
||||||
|
// in every case, we propagate the flip-flop EVENT
|
||||||
|
for(int32_t iii=0; iii<m_subWidget[m_currentDrawId].Size(); iii++) {
|
||||||
|
if(NULL != m_subWidget[m_currentDrawId][iii]) {
|
||||||
|
m_subWidget[m_currentDrawId][iii]->OnFlipFlopEvent();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,8 @@ class FileChooserFolderList : public ewol::List
|
|||||||
if (1 == IdInput) {
|
if (1 == IdInput) {
|
||||||
if (m_selectedLine >=0 ) {
|
if (m_selectedLine >=0 ) {
|
||||||
// generate event extern :
|
// generate event extern :
|
||||||
return GenEventInputExternal(ewolEventFileChooserSelectFolder, x, y);
|
GenerateEventId(ewolEventFileChooserSelectFolder);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,7 +308,8 @@ class FileChooserFileList : public ewol::List
|
|||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
if (m_selectedLine >=0 ) {
|
if (m_selectedLine >=0 ) {
|
||||||
// generate event extern :
|
// generate event extern :
|
||||||
return GenEventInputExternal(ewolEventFileChooserSelectFile, x, y);
|
GenerateEventId(ewolEventFileChooserSelectFile);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -317,7 +319,8 @@ class FileChooserFileList : public ewol::List
|
|||||||
if (1 == IdInput) {
|
if (1 == IdInput) {
|
||||||
if (m_selectedLine >=0 ) {
|
if (m_selectedLine >=0 ) {
|
||||||
// generate event extern :
|
// generate event extern :
|
||||||
return GenEventInputExternal(ewolEventFileChooserValidateFile, x, y);
|
GenerateEventId(ewolEventFileChooserValidateFile);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -341,6 +344,7 @@ extern const char * const ewolEventFileChooserEntryFile = "ewol-event-file
|
|||||||
|
|
||||||
ewol::FileChooser::FileChooser(void)
|
ewol::FileChooser::FileChooser(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
AddEventId(ewolEventFileChooserCancel);
|
AddEventId(ewolEventFileChooserCancel);
|
||||||
AddEventId(ewolEventFileChooserValidate);
|
AddEventId(ewolEventFileChooserValidate);
|
||||||
|
|
||||||
@ -455,6 +459,7 @@ ewol::FileChooser::FileChooser(void)
|
|||||||
|
|
||||||
// set the default Folder properties:
|
// set the default Folder properties:
|
||||||
UpdateCurrentFolder();
|
UpdateCurrentFolder();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -466,51 +471,62 @@ ewol::FileChooser::~FileChooser(void)
|
|||||||
|
|
||||||
void ewol::FileChooser::SetTitle(etk::UString label)
|
void ewol::FileChooser::SetTitle(etk::UString label)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
ewol::Label * tmpWidget = dynamic_cast<ewol::Label*>(ewol::widgetManager::Get(m_widgetTitleId));
|
ewol::Label * tmpWidget = dynamic_cast<ewol::Label*>(ewol::widgetManager::Get(m_widgetTitleId));
|
||||||
if (NULL == tmpWidget) {
|
if (NULL == tmpWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpWidget->SetLabel(label);
|
tmpWidget->SetLabel(label);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::FileChooser::SetValidateLabel(etk::UString label)
|
void ewol::FileChooser::SetValidateLabel(etk::UString label)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
ewol::Button * tmpWidget = dynamic_cast<ewol::Button*>(ewol::widgetManager::Get(m_widgetValidateId));
|
ewol::Button * tmpWidget = dynamic_cast<ewol::Button*>(ewol::widgetManager::Get(m_widgetValidateId));
|
||||||
if (NULL == tmpWidget) {
|
if (NULL == tmpWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpWidget->SetLabel(label);
|
tmpWidget->SetLabel(label);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::FileChooser::SetCancelLabel(etk::UString label)
|
void ewol::FileChooser::SetCancelLabel(etk::UString label)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
ewol::Button * tmpWidget = dynamic_cast<ewol::Button*>(ewol::widgetManager::Get(m_widgetCancelId));
|
ewol::Button * tmpWidget = dynamic_cast<ewol::Button*>(ewol::widgetManager::Get(m_widgetCancelId));
|
||||||
if (NULL == tmpWidget) {
|
if (NULL == tmpWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpWidget->SetLabel(label);
|
tmpWidget->SetLabel(label);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::FileChooser::SetFolder(etk::UString folder)
|
void ewol::FileChooser::SetFolder(etk::UString folder)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
m_folder = folder;
|
m_folder = folder;
|
||||||
UpdateCurrentFolder();
|
UpdateCurrentFolder();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::FileChooser::SetFileName(etk::UString filename)
|
void ewol::FileChooser::SetFileName(etk::UString filename)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
m_file = filename;
|
m_file = filename;
|
||||||
ewol::Entry * tmpWidget = dynamic_cast<ewol::Entry*>(ewol::widgetManager::Get(m_widgetCurrentFileNameId));
|
ewol::Entry * tmpWidget = dynamic_cast<ewol::Entry*>(ewol::widgetManager::Get(m_widgetCurrentFileNameId));
|
||||||
if (NULL == tmpWidget) {
|
if (NULL == tmpWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
tmpWidget->SetValue(filename);
|
tmpWidget->SetValue(filename);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
EWOL_INFO("Receive Event from the LIST ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> data=\"" << data << "\"" );
|
EWOL_INFO("Receive Event from the LIST ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> data=\"" << data << "\"" );
|
||||||
if (ewolEventFileChooserEntryFolder == generateEventId) {
|
if (ewolEventFileChooserEntryFolder == generateEventId) {
|
||||||
//==> change the folder name
|
//==> change the folder name
|
||||||
@ -571,6 +587,7 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
|
|||||||
ewol::RmPopUp(GetWidgetId());
|
ewol::RmPopUp(GetWidgetId());
|
||||||
return tmppp;
|
return tmppp;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -578,6 +595,7 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
|
|||||||
|
|
||||||
void ewol::FileChooser::UpdateCurrentFolder(void)
|
void ewol::FileChooser::UpdateCurrentFolder(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
FileChooserFileList * myListFile = dynamic_cast<FileChooserFileList *>(ewol::widgetManager::Get(m_widgetListFileId));
|
FileChooserFileList * myListFile = dynamic_cast<FileChooserFileList *>(ewol::widgetManager::Get(m_widgetListFileId));
|
||||||
FileChooserFolderList * myListFolder = dynamic_cast<FileChooserFolderList *>(ewol::widgetManager::Get(m_widgetListFolderId));
|
FileChooserFolderList * myListFolder = dynamic_cast<FileChooserFolderList *>(ewol::widgetManager::Get(m_widgetListFolderId));
|
||||||
ewol::Entry * myEntry = dynamic_cast<ewol::Entry *>(ewol::widgetManager::Get(m_widgetCurrentFolderId));
|
ewol::Entry * myEntry = dynamic_cast<ewol::Entry *>(ewol::widgetManager::Get(m_widgetCurrentFolderId));
|
||||||
@ -625,16 +643,19 @@ void ewol::FileChooser::UpdateCurrentFolder(void)
|
|||||||
myListFile->EndGenerating();
|
myListFile->EndGenerating();
|
||||||
myListFolder->EndGenerating();
|
myListFolder->EndGenerating();
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
etk::UString ewol::FileChooser::GetCompleateFileName(void)
|
etk::UString ewol::FileChooser::GetCompleateFileName(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
|
||||||
etk::UString tmpString = m_folder;
|
etk::UString tmpString = m_folder;
|
||||||
tmpString += "/";
|
tmpString += "/";
|
||||||
tmpString += m_file;
|
tmpString += m_file;
|
||||||
return tmpString;
|
return tmpString;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,21 +51,25 @@ extern const char * const ewolEventKeyEvent = "ewol event internal key event";
|
|||||||
|
|
||||||
ewol::Keyboard::Keyboard(void)
|
ewol::Keyboard::Keyboard(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
// set event that can propagate outside ....
|
// set event that can propagate outside ....
|
||||||
AddEventId(ewolEventKeyboardHide);
|
AddEventId(ewolEventKeyboardHide);
|
||||||
|
|
||||||
m_mode = KEYBOARD_MODE_TEXT;
|
m_mode = KEYBOARD_MODE_TEXT;
|
||||||
m_isHide = true;
|
m_isHide = true;
|
||||||
SetMode(m_mode);
|
SetMode(m_mode);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::Keyboard::~Keyboard(void)
|
ewol::Keyboard::~Keyboard(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget);
|
||||||
m_subWidget = NULL;
|
m_subWidget = NULL;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#define ADD_BUTTON(upperWidget,widget,text,event) do { \
|
#define ADD_BUTTON(upperWidget,widget,text,event) do { \
|
||||||
@ -82,6 +86,7 @@ ewol::Keyboard::~Keyboard(void)
|
|||||||
|
|
||||||
void ewol::Keyboard::SetMode(keyboardMode_te mode)
|
void ewol::Keyboard::SetMode(keyboardMode_te mode)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
|
||||||
ewol::SizerVert * mySizerVert = NULL;
|
ewol::SizerVert * mySizerVert = NULL;
|
||||||
ewol::SizerHori * mySizerHori = NULL;
|
ewol::SizerHori * mySizerHori = NULL;
|
||||||
@ -177,12 +182,13 @@ void ewol::Keyboard::SetMode(keyboardMode_te mode)
|
|||||||
myButton->SetExpendX(false);
|
myButton->SetExpendX(false);
|
||||||
ADD_BUTTON(mySizerHori,myButton,"Ctrl",ewolEventKeyEvent);
|
ADD_BUTTON(mySizerHori,myButton,"Ctrl",ewolEventKeyEvent);
|
||||||
myButton->SetExpendX(false);
|
myButton->SetExpendX(false);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
EWOL_INFO("Receive Event from the Keyboard ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << data << "\"" );
|
EWOL_INFO("Receive Event from the Keyboard ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << data << "\"" );
|
||||||
if (ewolEventKeyEvent == generateEventId) {
|
if (ewolEventKeyEvent == generateEventId) {
|
||||||
ewol::Button * bt = dynamic_cast<ewol::Button *>(ewol::widgetManager::Get(widgetID));
|
ewol::Button * bt = dynamic_cast<ewol::Button *>(ewol::widgetManager::Get(widgetID));
|
||||||
@ -207,6 +213,7 @@ bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generate
|
|||||||
}
|
}
|
||||||
//return GenEventInputExternal(eventExternId, x, y);
|
//return GenEventInputExternal(eventExternId, x, y);
|
||||||
return true;
|
return true;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -228,6 +235,7 @@ void ewol::Keyboard::SetExpendY(bool newExpend)
|
|||||||
|
|
||||||
bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
//EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
//EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
||||||
// pop-up fill all the display :
|
// pop-up fill all the display :
|
||||||
m_size.x = availlableX;
|
m_size.x = availlableX;
|
||||||
@ -250,12 +258,14 @@ bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlable
|
|||||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||||
}
|
}
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::Keyboard::CalculateMinSize(void)
|
bool ewol::Keyboard::CalculateMinSize(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
m_userExpendX=false;
|
m_userExpendX=false;
|
||||||
m_userExpendY=false;
|
m_userExpendY=false;
|
||||||
m_minSize.x = 50.0;
|
m_minSize.x = 50.0;
|
||||||
@ -267,6 +277,7 @@ bool ewol::Keyboard::CalculateMinSize(void)
|
|||||||
m_minSize.y = tmpSize.y;
|
m_minSize.y = tmpSize.y;
|
||||||
}
|
}
|
||||||
//EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
//EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,15 +285,18 @@ bool ewol::Keyboard::CalculateMinSize(void)
|
|||||||
|
|
||||||
bool ewol::Keyboard::OnDraw(void)
|
bool ewol::Keyboard::OnDraw(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
m_subWidget->GenDraw();
|
m_subWidget->GenDraw();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::Keyboard::OnRegenerateDisplay(void)
|
void ewol::Keyboard::OnRegenerateDisplay(void)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (true == NeedRedraw()) {
|
if (true == NeedRedraw()) {
|
||||||
color_ts mycolor;
|
color_ts mycolor;
|
||||||
mycolor.red = 1.0;
|
mycolor.red = 1.0;
|
||||||
@ -299,13 +313,16 @@ void ewol::Keyboard::OnRegenerateDisplay(void)
|
|||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
m_subWidget->OnRegenerateDisplay();
|
m_subWidget->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::Keyboard::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos)
|
bool ewol::Keyboard::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
return m_subWidget->GenEventInput(IdInput, typeEvent, pos.abs);
|
return m_subWidget->GenEventInput(IdInput, typeEvent, pos.abs);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,13 +28,15 @@
|
|||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/widget/PopUp.h>
|
#include <ewol/widget/PopUp.h>
|
||||||
|
#include <ewol/widget/Label.h>
|
||||||
|
#include <ewol/widget/Button.h>
|
||||||
|
|
||||||
extern const char * const ewolEventFileStdPopUpCancel;
|
|
||||||
extern const char * const ewolEventFileStdPopUpValidate;
|
|
||||||
extern const char * const ewolEventFileStdPopUpButton1;
|
extern const char * const ewolEventFileStdPopUpButton1;
|
||||||
extern const char * const ewolEventFileStdPopUpButton2;
|
extern const char * const ewolEventFileStdPopUpButton2;
|
||||||
extern const char * const ewolEventFileStdPopUpButton3;
|
extern const char * const ewolEventFileStdPopUpButton3;
|
||||||
extern const char * const ewolEventFileStdPopUpButton4;
|
extern const char * const ewolEventFileStdPopUpButton4;
|
||||||
|
extern const char * const ewolEventFileStdPopUpButton5;
|
||||||
|
extern const char * const ewolEventFileStdPopUpButton6;
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class StdPopUp : public ewol::PopUp
|
class StdPopUp : public ewol::PopUp
|
||||||
@ -43,18 +45,13 @@ namespace ewol {
|
|||||||
StdPopUp(void);
|
StdPopUp(void);
|
||||||
~StdPopUp(void);
|
~StdPopUp(void);
|
||||||
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
||||||
void SetTitle(etk::UString label);
|
void SetTitle(etk::UString text);
|
||||||
void SetValidateLabel(etk::UString label);
|
void SetComment(etk::UString text);
|
||||||
void SetCancelLabel(etk::UString label);
|
void SetButtonLabel(int32_t btId, etk::UString text); // note : if no label no bt...
|
||||||
void SetFolder(etk::UString folder);
|
|
||||||
private:
|
private:
|
||||||
int32_t m_widgetTitleId;
|
ewol::widget::Label* m_title;
|
||||||
int32_t m_widgetValidateId;
|
ewol::widget::Label* m_comment;
|
||||||
int32_t m_widgetCancelId;
|
ewol::widget::Button* m_button[6];
|
||||||
int32_t m_widgetCurrentFolderId;
|
|
||||||
int32_t m_widgetListFolderId;
|
|
||||||
int32_t m_widgetListFileId;
|
|
||||||
etk::UString m_folder;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@ FILE_LIST = ewol/ewol.cpp \
|
|||||||
ewol/base/gui.cpp \
|
ewol/base/gui.cpp \
|
||||||
ewol/Debug.cpp \
|
ewol/Debug.cpp \
|
||||||
ewol/EObject.cpp \
|
ewol/EObject.cpp \
|
||||||
|
ewol/EObjectManager.cpp \
|
||||||
|
ewol/EObjectMessageMulticast.cpp \
|
||||||
ewol/OObject.cpp \
|
ewol/OObject.cpp \
|
||||||
ewol/OObject/2DText.cpp \
|
ewol/OObject/2DText.cpp \
|
||||||
ewol/OObject/2DTextColored.cpp \
|
ewol/OObject/2DTextColored.cpp \
|
||||||
@ -16,7 +18,6 @@ FILE_LIST = ewol/ewol.cpp \
|
|||||||
ewol/FontFreeType.cpp \
|
ewol/FontFreeType.cpp \
|
||||||
ewol/Widget.cpp \
|
ewol/Widget.cpp \
|
||||||
ewol/WidgetManager.cpp \
|
ewol/WidgetManager.cpp \
|
||||||
ewol/WidgetMessageMultiCast.cpp \
|
|
||||||
ewol/Windows.cpp \
|
ewol/Windows.cpp \
|
||||||
ewol/ShortCutManager.cpp \
|
ewol/ShortCutManager.cpp \
|
||||||
ewol/widget/WidgetScrolled.cpp \
|
ewol/widget/WidgetScrolled.cpp \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user