[DEV] Rework the library to support multiple instance (step 2)
This commit is contained in:
parent
1fd451961e
commit
4a8aa9f7b0
2
external/ege
vendored
2
external/ege
vendored
@ -1 +1 @@
|
|||||||
Subproject commit c79473d01239d7192ae1b21287ba7e563cf4738f
|
Subproject commit c213ebb32b1379fc601ef8ee9adcecebb15ea04d
|
@ -8,94 +8,9 @@
|
|||||||
|
|
||||||
#include <ewol/eObject/EObject.h>
|
#include <ewol/eObject/EObject.h>
|
||||||
#include <ewol/eObject/EObjectManager.h>
|
#include <ewol/eObject/EObjectManager.h>
|
||||||
|
#include <ewol/eObject/EObjectMessageMultiCast.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
|
#include <ewol/renderer/os/eSystem.h>
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "EObjectMessageMultiCast"
|
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
typedef struct {
|
|
||||||
const char* message;
|
|
||||||
ewol::EObject* object;
|
|
||||||
} messageList_ts;
|
|
||||||
};
|
|
||||||
|
|
||||||
// internal element of the widget manager :
|
|
||||||
static etk::Vector<messageList_ts> m_messageList; // all widget allocated ==> all time increment ... never removed ...
|
|
||||||
|
|
||||||
void ewol::EObjectMessageMultiCast::Init(void)
|
|
||||||
{
|
|
||||||
EWOL_INFO("EObject message Multi-Cast");
|
|
||||||
m_messageList.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::EObjectMessageMultiCast::UnInit(void)
|
|
||||||
{
|
|
||||||
EWOL_INFO("EObject message Multi-Cast");
|
|
||||||
m_messageList.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void MultiCastAdd(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 << "\"" );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void MultiCastRm(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()-1; 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void MultiCastSend(ewol::EObject* _object, const char* const _message, const etk::UString& _data)
|
|
||||||
{
|
|
||||||
EWOL_VERBOSE("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_VERBOSE(" id = " << m_messageList[iii].object->GetId() << " type=" << m_messageList[iii].object->GetObjectType());
|
|
||||||
// generate event ... (create message before ...
|
|
||||||
ewol::EMessage tmpMsg(_object, m_messageList[iii].message, _data);
|
|
||||||
m_messageList[iii].object->OnReceiveMessage(tmpMsg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ewol::EObjectMessageMultiCast::AnonymousSend(const char* const _messageId, const etk::UString& _data)
|
|
||||||
{
|
|
||||||
MultiCastSend(NULL, _messageId, _data);
|
|
||||||
}
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::EObject"
|
#define __class__ "ewol::EObject"
|
||||||
@ -111,15 +26,15 @@ 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);
|
GetEObjectManager().Add(this);
|
||||||
RegisterConfig(ewol::EObject::configName, "string", NULL, "EObject name, might be a unique reference in all the program");
|
RegisterConfig(ewol::EObject::configName, "string", NULL, "EObject name, might be a unique reference in all the program");
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::EObject::~EObject(void)
|
ewol::EObject::~EObject(void)
|
||||||
{
|
{
|
||||||
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]");
|
EWOL_DEBUG("delete EObject : [" << m_uniqueId << "]");
|
||||||
ewol::EObjectManager::Rm(this);
|
GetEObjectManager().Rm(this);
|
||||||
MultiCastRm(this);
|
GetEObjectMessageMultiCast().Rm(this);
|
||||||
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]) {
|
||||||
delete(m_externEvent[iii]);
|
delete(m_externEvent[iii]);
|
||||||
@ -134,11 +49,11 @@ ewol::EObject::~EObject(void)
|
|||||||
|
|
||||||
void ewol::EObject::AutoDestroy(void)
|
void ewol::EObject::AutoDestroy(void)
|
||||||
{
|
{
|
||||||
ewol::EObjectManager::AutoRemove(this);
|
GetEObjectManager().AutoRemove(this);
|
||||||
}
|
}
|
||||||
void ewol::EObject::RemoveObject(void)
|
void ewol::EObject::RemoveObject(void)
|
||||||
{
|
{
|
||||||
ewol::EObjectManager::AutoRemove(this);
|
GetEObjectManager().AutoRemove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::EObject::AddEventId(const char * _generateEventId)
|
void ewol::EObject::AddEventId(const char * _generateEventId)
|
||||||
@ -150,7 +65,7 @@ void ewol::EObject::AddEventId(const char * _generateEventId)
|
|||||||
|
|
||||||
void ewol::EObject::GenerateEventId(const char * _generateEventId, const etk::UString& _data)
|
void ewol::EObject::GenerateEventId(const char * _generateEventId, const etk::UString& _data)
|
||||||
{
|
{
|
||||||
int32_t nbObject = ewol::EObjectManager::GetNumberObject();
|
int32_t nbObject = GetEObjectManager().GetNumberObject();
|
||||||
// for every element registered ...
|
// for every element registered ...
|
||||||
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]) {
|
||||||
@ -169,23 +84,23 @@ void ewol::EObject::GenerateEventId(const char * _generateEventId, const etk::US
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (nbObject > ewol::EObjectManager::GetNumberObject()) {
|
if (nbObject > GetEObjectManager().GetNumberObject()) {
|
||||||
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->RemoveObject() which is asynchronous");
|
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->RemoveObject() which is asynchronous");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::EObject::SendMultiCast(const char* const _messageId, const etk::UString& _data)
|
void ewol::EObject::SendMultiCast(const char* const _messageId, const etk::UString& _data)
|
||||||
{
|
{
|
||||||
int32_t nbObject = ewol::EObjectManager::GetNumberObject();
|
int32_t nbObject = GetEObjectManager().GetNumberObject();
|
||||||
MultiCastSend(this, _messageId, _data);
|
GetEObjectMessageMultiCast().Send(this, _messageId, _data);
|
||||||
if (nbObject > ewol::EObjectManager::GetNumberObject()) {
|
if (nbObject > GetEObjectManager().GetNumberObject()) {
|
||||||
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->RemoveObject() which is asynchronous");
|
EWOL_CRITICAL("It if really dangerous ro remove (delete) element inside a callback ... use ->RemoveObject() which is asynchronous");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::EObject::RegisterMultiCast(const char* const _messageId)
|
void ewol::EObject::RegisterMultiCast(const char* const _messageId)
|
||||||
{
|
{
|
||||||
MultiCastAdd(this, _messageId);
|
GetEObjectMessageMultiCast().Add(this, _messageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
|
void ewol::EObject::RegisterOnEvent(ewol::EObject * _destinationObject,
|
||||||
@ -375,7 +290,7 @@ etk::UString ewol::EObject::GetConfig(const etk::UString& _config) const
|
|||||||
|
|
||||||
bool ewol::EObject::SetConfigNamed(const etk::UString& _name, const ewol::EConfig& _conf)
|
bool ewol::EObject::SetConfigNamed(const etk::UString& _name, const ewol::EConfig& _conf)
|
||||||
{
|
{
|
||||||
ewol::EObject* object = ewol::EObjectManager::Get(_name);
|
ewol::EObject* object = GetEObjectManager().Get(_name);
|
||||||
if (object == NULL) {
|
if (object == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -384,7 +299,7 @@ bool ewol::EObject::SetConfigNamed(const etk::UString& _name, const ewol::EConfi
|
|||||||
|
|
||||||
bool ewol::EObject::SetConfigNamed(const etk::UString& _name, const etk::UString& _config, const etk::UString& _value)
|
bool ewol::EObject::SetConfigNamed(const etk::UString& _name, const etk::UString& _config, const etk::UString& _value)
|
||||||
{
|
{
|
||||||
ewol::EObject* object = ewol::EObjectManager::Get(_name);
|
ewol::EObject* object = GetEObjectManager().Get(_name);
|
||||||
if (object == NULL) {
|
if (object == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -392,3 +307,17 @@ bool ewol::EObject::SetConfigNamed(const etk::UString& _name, const etk::UString
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ewol::EObjectManager& ewol::EObject::GetEObjectManager(void)
|
||||||
|
{
|
||||||
|
return ewol::eSystem::GetSystem().GetEObjectManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
ewol::EObjectMessageMultiCast& ewol::EObject::GetEObjectMessageMultiCast(void)
|
||||||
|
{
|
||||||
|
return ewol::eSystem::GetSystem().GetEObjectMessageMultiCast();
|
||||||
|
}
|
||||||
|
|
||||||
|
ewol::eSystem& ewol::EObject::GetSystem(void)
|
||||||
|
{
|
||||||
|
return ewol::eSystem::GetSystem();
|
||||||
|
}
|
||||||
|
@ -16,17 +16,15 @@
|
|||||||
namespace ewol {
|
namespace ewol {
|
||||||
// some class need to define element befor other ...
|
// some class need to define element befor other ...
|
||||||
class EObject;
|
class EObject;
|
||||||
|
class EObjectManager;
|
||||||
|
class EObjectMessageMultiCast;
|
||||||
|
class eSystem;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <ewol/eObject/EConfig.h>
|
#include <ewol/eObject/EConfig.h>
|
||||||
#include <ewol/eObject/EMessage.h>
|
#include <ewol/eObject/EMessage.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
namespace EObjectMessageMultiCast {
|
|
||||||
void Init(void);
|
|
||||||
void UnInit(void);
|
|
||||||
void AnonymousSend(const char* const _messageId, const etk::UString& _data);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* local class for event generation
|
* local class for event generation
|
||||||
@ -220,9 +218,26 @@ namespace ewol {
|
|||||||
* @return false : An error occured.
|
* @return false : An error occured.
|
||||||
*/
|
*/
|
||||||
virtual bool StoreXML(exml::Element* _node) const;
|
virtual bool StoreXML(exml::Element* _node) const;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @breif Get the current EObject manager.
|
||||||
|
* @return the requested object manager.
|
||||||
|
*/
|
||||||
|
ewol::EObjectManager& GetEObjectManager(void);
|
||||||
|
/**
|
||||||
|
* @breif Get the current EObject Message Multicast manager.
|
||||||
|
* @return the requested object manager.
|
||||||
|
*/
|
||||||
|
ewol::EObjectMessageMultiCast& GetEObjectMessageMultiCast(void);
|
||||||
|
/**
|
||||||
|
* @brief Get the curent the system inteface.
|
||||||
|
* @return current reference on the instance.
|
||||||
|
*/
|
||||||
|
eSystem& GetSystem(void);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@ ewol::EObjectManager::EObjectManager(void)
|
|||||||
// Can create mlemory leak ... ==> but not predictable comportement otherwise ...
|
// Can create mlemory leak ... ==> but not predictable comportement otherwise ...
|
||||||
m_eObjectAutoRemoveList.Clear();
|
m_eObjectAutoRemoveList.Clear();
|
||||||
m_eObjectList.Clear();
|
m_eObjectList.Clear();
|
||||||
IsInit = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::EObjectManager::~EObjectManager(void)
|
ewol::EObjectManager::~EObjectManager(void)
|
||||||
@ -41,8 +40,6 @@ ewol::EObjectManager::~EObjectManager(void)
|
|||||||
m_eObjectList.Erase(iii);
|
m_eObjectList.Erase(iii);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IsInit = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::EObjectManager::Add(ewol::EObject* _object)
|
void ewol::EObjectManager::Add(ewol::EObject* _object)
|
||||||
@ -59,7 +56,7 @@ int32_t ewol::EObjectManager::GetNumberObject(void)
|
|||||||
return m_eObjectList.Size() + m_eObjectAutoRemoveList.Size();
|
return m_eObjectList.Size() + m_eObjectAutoRemoveList.Size();
|
||||||
}
|
}
|
||||||
|
|
||||||
void informOneObjectIsRemoved(ewol::EObject* _object)
|
void ewol::EObjectManager::informOneObjectIsRemoved(ewol::EObject* _object)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
|
for (int32_t iii=0; iii<m_eObjectList.Size(); iii++) {
|
||||||
if (m_eObjectList[iii] != NULL) {
|
if (m_eObjectList[iii] != NULL) {
|
||||||
@ -73,7 +70,7 @@ void informOneObjectIsRemoved(ewol::EObject* _object)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// call input event manager to remove linked widget ...
|
// call input event manager to remove linked widget ...
|
||||||
eSystem::OnObjectRemove(_object);
|
ewol::eSystem::GetSystem().OnObjectRemove(_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::EObjectManager::Rm(ewol::EObject* _object)
|
void ewol::EObjectManager::Rm(ewol::EObject* _object)
|
||||||
@ -116,7 +113,7 @@ void ewol::EObjectManager::AutoRemove(ewol::EObject* _object)
|
|||||||
EWOL_DEBUG("Auto-Remove EObject : [" << _object->GetId() << "] type=\"" << _object->GetObjectType() << "\"");
|
EWOL_DEBUG("Auto-Remove EObject : [" << _object->GetId() << "] type=\"" << _object->GetObjectType() << "\"");
|
||||||
informOneObjectIsRemoved(_object);
|
informOneObjectIsRemoved(_object);
|
||||||
m_eObjectAutoRemoveList.PushBack(_object);
|
m_eObjectAutoRemoveList.PushBack(_object);
|
||||||
ewol::ForceRedrawAll();
|
ewol::eSystem::GetSystem().ForceRedrawAll();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ namespace ewol
|
|||||||
void RemoveAllAutoRemove(void);
|
void RemoveAllAutoRemove(void);
|
||||||
|
|
||||||
ewol::EObject* Get(const etk::UString& _name);
|
ewol::EObject* Get(const etk::UString& _name);
|
||||||
|
private:
|
||||||
|
void informOneObjectIsRemoved(ewol::EObject* _object);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
79
sources/ewol/eObject/EObjectMessageMultiCast.cpp
Normal file
79
sources/ewol/eObject/EObjectMessageMultiCast.cpp
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ewol/debug.h>
|
||||||
|
#include <ewol/eObject/EObjectMessageMultiCast.h>
|
||||||
|
#include <ewol/renderer/os/eSystem.h>
|
||||||
|
|
||||||
|
#undef __class__
|
||||||
|
#define __class__ "EObjectMessageMultiCast"
|
||||||
|
|
||||||
|
ewol::EObjectMessageMultiCast::EObjectMessageMultiCast(void)
|
||||||
|
{
|
||||||
|
EWOL_INFO("EObject message Multi-Cast");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ewol::EObjectMessageMultiCast::~EObjectMessageMultiCast(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;
|
||||||
|
}
|
||||||
|
m_messageList.PushBack(MessageList(_message, _object));
|
||||||
|
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()-1; iii>=0; iii--) {
|
||||||
|
if(m_messageList[iii].m_object == _object) {
|
||||||
|
EWOL_DEBUG("SendMulticast RM listener :" << _object->GetId());
|
||||||
|
m_messageList[iii].m_message = NULL;
|
||||||
|
m_messageList[iii].m_object = NULL;
|
||||||
|
m_messageList.Erase(iii);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::EObjectMessageMultiCast::Send(ewol::EObject* _object, const char* const _message, const etk::UString& _data)
|
||||||
|
{
|
||||||
|
EWOL_VERBOSE("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].m_message == _message
|
||||||
|
&& m_messageList[iii].m_object != _object)
|
||||||
|
{
|
||||||
|
if (NULL != m_messageList[iii].m_object) {
|
||||||
|
EWOL_VERBOSE(" id = " << m_messageList[iii].m_object->GetId() << " type=" << m_messageList[iii].m_object->GetObjectType());
|
||||||
|
// generate event ... (create message before ...
|
||||||
|
ewol::EMessage tmpMsg(_object, m_messageList[iii].m_message, _data);
|
||||||
|
m_messageList[iii].m_object->OnReceiveMessage(tmpMsg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
40
sources/ewol/eObject/EObjectMessageMultiCast.h
Normal file
40
sources/ewol/eObject/EObjectMessageMultiCast.h
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EWOL_E_OBJECT_MESSAGE_MULTICAST_H__
|
||||||
|
#define __EWOL_E_OBJECT_MESSAGE_MULTICAST_H__
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <etk/UString.h>
|
||||||
|
#include <etk/Vector.h>
|
||||||
|
#include <exml/exml.h>
|
||||||
|
|
||||||
|
#include <ewol/eObject/EObject.h>
|
||||||
|
|
||||||
|
namespace ewol {
|
||||||
|
class EObjectMessageMultiCast
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
class MessageList {
|
||||||
|
public:
|
||||||
|
MessageList(const char* _message=NULL, ewol::EObject* _object=NULL) : m_message(_message), m_object(_object) { }
|
||||||
|
const char* m_message;
|
||||||
|
ewol::EObject* m_object;
|
||||||
|
};
|
||||||
|
etk::Vector<MessageList> m_messageList; //!< List of all message ...
|
||||||
|
public:
|
||||||
|
EObjectMessageMultiCast(void);
|
||||||
|
~EObjectMessageMultiCast(void);
|
||||||
|
void AnonymousSend(const char* const _messageId, const etk::UString& _data) { Send(NULL, _messageId, _data); };
|
||||||
|
void Send(ewol::EObject* _object, const char* const _message, const etk::UString& _data);
|
||||||
|
void Rm(ewol::EObject* _object);
|
||||||
|
void Add(ewol::EObject* _object, const char* const _message);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -67,12 +67,34 @@ int32_t ewol::Run(int32_t _argc, const char* _argv[])
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
etk::UString ewol::GetCompilationMode(void)
|
||||||
void ewol::Stop(void)
|
|
||||||
{
|
{
|
||||||
guiInterface::Stop();
|
#ifdef MODE_RELEASE
|
||||||
|
return "Release";
|
||||||
|
#else
|
||||||
|
return "Debug";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
etk::UString ewol::GetBoardType(void)
|
||||||
|
{
|
||||||
|
#ifdef __TARGET_OS__Linux
|
||||||
|
return "Linux";
|
||||||
|
#elif defined(__TARGET_OS__Android)
|
||||||
|
return "Android";
|
||||||
|
#elif defined(__TARGET_OS__Windows)
|
||||||
|
return "Windows";
|
||||||
|
#elif defined(__TARGET_OS__IOs)
|
||||||
|
return "IOs";
|
||||||
|
#elif defined(__TARGET_OS__MacOs)
|
||||||
|
return "MacOs";
|
||||||
|
#else
|
||||||
|
return "Unknown";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
|
||||||
void ewol::WindowsSet(ewol::Windows* _windows)
|
void ewol::WindowsSet(ewol::Windows* _windows)
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,17 @@ namespace ewol
|
|||||||
* @return The current time
|
* @return The current time
|
||||||
*/
|
*/
|
||||||
int64_t GetTime(void);
|
int64_t GetTime(void);
|
||||||
|
/**
|
||||||
|
* @brief Get compilation mode (release/debug)
|
||||||
|
* @return the string of the mode of commpilation
|
||||||
|
*/
|
||||||
|
etk::UString GetCompilationMode(void);
|
||||||
|
/**
|
||||||
|
* @brief Get the board type ()
|
||||||
|
* @return the string of the mode of commpilation
|
||||||
|
*/
|
||||||
|
etk::UString GetBoardType(void);
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SCREEN_ORIENTATION_AUTO = 0,
|
SCREEN_ORIENTATION_AUTO = 0,
|
||||||
SCREEN_ORIENTATION_LANDSCAPE,
|
SCREEN_ORIENTATION_LANDSCAPE,
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/game/Camera.h>
|
|
||||||
#include <ewol/debug.h>
|
|
||||||
|
|
||||||
|
|
||||||
void game::Camera::Update(void)
|
|
||||||
{
|
|
||||||
m_matrix.Identity();
|
|
||||||
m_matrix.Rotate(vec3(0,0,1), M_PI/2.0 );
|
|
||||||
m_matrix.Rotate(vec3(0,1,0), M_PI/2.0 );
|
|
||||||
m_matrix.Rotate(vec3(1,0,0), m_angles.x() );
|
|
||||||
m_matrix.Rotate(vec3(0,1,0), m_angles.y() );
|
|
||||||
m_matrix.Rotate(vec3(0,0,1), m_angles.z() );
|
|
||||||
vec3 tmpp = m_position * -1;
|
|
||||||
m_matrix.Translate(tmpp);
|
|
||||||
m_needUpdate = false;
|
|
||||||
//EWOL_DEBUG("camera: pos=" << m_position << " angle=" << m_angles);
|
|
||||||
}
|
|
||||||
|
|
||||||
game::Camera::Camera(vec3 pos, vec3 angles) :
|
|
||||||
m_position(pos),
|
|
||||||
m_angles(angles)
|
|
||||||
{
|
|
||||||
m_needUpdate = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void game::Camera::SetPosition(vec3 pos)
|
|
||||||
{
|
|
||||||
m_needUpdate = true;
|
|
||||||
m_position = pos;
|
|
||||||
}
|
|
||||||
|
|
||||||
void game::Camera::SetAngle(vec3 angles)
|
|
||||||
{
|
|
||||||
m_needUpdate = true;
|
|
||||||
m_angles = angles;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
mat4& game::Camera::GetMatrix(void)
|
|
||||||
{
|
|
||||||
if(m_needUpdate==true) {
|
|
||||||
Update();
|
|
||||||
}
|
|
||||||
return m_matrix;
|
|
||||||
};
|
|
@ -1,67 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __GAME_CAMERA_H__
|
|
||||||
#define __GAME_CAMERA_H__
|
|
||||||
|
|
||||||
|
|
||||||
#include <etk/types.h>
|
|
||||||
#include <etk/math/Vector3D.h>
|
|
||||||
#include <etk/math/Matrix4.h>
|
|
||||||
|
|
||||||
namespace game
|
|
||||||
{
|
|
||||||
class Camera
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
vec3 m_position; //!< position of the camera.
|
|
||||||
vec3 m_angles; //!< Angles to the camera is seing.
|
|
||||||
mat4 m_matrix; //!< transformation matrix.
|
|
||||||
bool m_needUpdate; //!< matrix is nor anymore correct...
|
|
||||||
/**
|
|
||||||
* @brief Update the matrix property
|
|
||||||
*/
|
|
||||||
void Update(void);
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Constructor.
|
|
||||||
* @param[in] pos Position of the camera.
|
|
||||||
* @param[in] angles Rotations angles of the camera
|
|
||||||
*/
|
|
||||||
Camera(vec3 pos=vec3(0,0,0), vec3 angles=vec3(0,0,0));
|
|
||||||
/**
|
|
||||||
* @brief Set the position of the camera.
|
|
||||||
* @param[in] pos Position of the camera.
|
|
||||||
*/
|
|
||||||
void SetPosition(vec3 pos);
|
|
||||||
/**
|
|
||||||
* @brief Get the curent Camera position.
|
|
||||||
* @return the current position.
|
|
||||||
*/
|
|
||||||
vec3& GetPosition(void) { return m_position; };
|
|
||||||
/**
|
|
||||||
* @brief Set the angle on the camera
|
|
||||||
* @param[in] angles Rotations angles of the camera
|
|
||||||
*/
|
|
||||||
void SetAngle(vec3 angles);
|
|
||||||
/**
|
|
||||||
* @brief Get the curent Camera angles.
|
|
||||||
* @return the current angles.
|
|
||||||
*/
|
|
||||||
vec3& GetAngle(void) { return m_angles; };
|
|
||||||
/**
|
|
||||||
* @brief Get the transformation matix for the camera.
|
|
||||||
* @return the current transformation matrix
|
|
||||||
*/
|
|
||||||
mat4& GetMatrix(void);
|
|
||||||
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
@ -83,7 +83,8 @@ void ewol::resource::ReLoadResources(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ewol::RequestUpdateSize();
|
// TODO : UNderstand why it is set here ...
|
||||||
|
//ewol::RequestUpdateSize();
|
||||||
EWOL_INFO("------------- Resources -------------");
|
EWOL_INFO("------------- Resources -------------");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,11 +28,62 @@
|
|||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
#include <etk/os/FSNode.h>
|
#include <etk/os/FSNode.h>
|
||||||
|
#include <etk/os/Mutex.h>
|
||||||
|
|
||||||
#include <date/date.h>
|
#include <date/date.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the main ewol mutex (event or periodic call mutex).
|
||||||
|
* @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time.
|
||||||
|
* @return the main inteface Mutex
|
||||||
|
*/
|
||||||
|
static etk::Mutex& MutexInterface(void)
|
||||||
|
{
|
||||||
|
static etk::Mutex s_interfaceMutex;
|
||||||
|
return s_interfaceMutex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the draw mutex (ewol render).
|
||||||
|
* @note due ti the fact that the system can be called for multiple instance, for naw we just limit the acces to one process at a time.
|
||||||
|
* @return the main inteface Mutex
|
||||||
|
*/
|
||||||
|
static etk::Mutex& MutexDraw(void)
|
||||||
|
{
|
||||||
|
static etk::Mutex s_drawMutex;
|
||||||
|
return s_drawMutex;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ewol::eSystem* l_curentInterface=NULL;
|
||||||
|
ewol::eSystem& ewol::eSystem::GetSystem(void)
|
||||||
|
{
|
||||||
|
#if DEBUG_LEVEL > 2
|
||||||
|
if(NULL == l_curentInterface){
|
||||||
|
EWOL_CRITICAL("[CRITICAL] try acces at an empty interface");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return *l_curentInterface;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the curent interface.
|
||||||
|
* @note this lock the main mutex
|
||||||
|
*/
|
||||||
|
void ewol::eSystem::SetSystem(void)
|
||||||
|
{
|
||||||
|
MutexInterface().Lock();
|
||||||
|
l_curentInterface = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set the curent interface at NULL.
|
||||||
|
* @note this un-lock the main mutex
|
||||||
|
*/
|
||||||
|
void ewol::eSystem::ReleaseSystem(void)
|
||||||
|
{
|
||||||
|
l_curentInterface = NULL;
|
||||||
|
MutexInterface().UnLock();
|
||||||
|
}
|
||||||
|
|
||||||
void ewol::eSystem::InputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination)
|
void ewol::eSystem::InputEventTransfertWidget(ewol::Widget* source, ewol::Widget* destination)
|
||||||
{
|
{
|
||||||
@ -63,7 +114,7 @@ void ewol::eSystem::ProcessEvents(void)
|
|||||||
switch (data.TypeMessage) {
|
switch (data.TypeMessage) {
|
||||||
case THREAD_INIT:
|
case THREAD_INIT:
|
||||||
// this is due to the openGL context
|
// this is due to the openGL context
|
||||||
APP_Init();
|
/*bool returnVal = */APP_Init(*this);
|
||||||
break;
|
break;
|
||||||
case THREAD_RECALCULATE_SIZE:
|
case THREAD_RECALCULATE_SIZE:
|
||||||
eSystem::ForceRedrawAll();
|
eSystem::ForceRedrawAll();
|
||||||
@ -96,7 +147,7 @@ void ewol::eSystem::ProcessEvents(void)
|
|||||||
data.keyboardMove,
|
data.keyboardMove,
|
||||||
data.stateIsDown) ) {
|
data.stateIsDown) ) {
|
||||||
// Get the current Focused Widget :
|
// Get the current Focused Widget :
|
||||||
ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet();
|
ewol::Widget * tmpWidget = m_widgetManager.FocusGet();
|
||||||
if (NULL != tmpWidget) {
|
if (NULL != tmpWidget) {
|
||||||
// check if the widget allow repeating key events.
|
// check if the widget allow repeating key events.
|
||||||
//EWOL_DEBUG("repeating test :" << data.repeateKey << " widget=" << tmpWidget->GetKeyboardRepeate() << " state=" << data.stateIsDown);
|
//EWOL_DEBUG("repeating test :" << data.repeateKey << " widget=" << tmpWidget->GetKeyboardRepeate() << " state=" << data.stateIsDown);
|
||||||
@ -133,7 +184,7 @@ void ewol::eSystem::ProcessEvents(void)
|
|||||||
break;
|
break;
|
||||||
case THREAD_CLIPBOARD_ARRIVE:
|
case THREAD_CLIPBOARD_ARRIVE:
|
||||||
{
|
{
|
||||||
ewol::Widget * tmpWidget = ewol::widgetManager::FocusGet();
|
ewol::Widget * tmpWidget = m_widgetManager.FocusGet();
|
||||||
if (tmpWidget != NULL) {
|
if (tmpWidget != NULL) {
|
||||||
tmpWidget->OnEventClipboard(data.clipboardID);
|
tmpWidget->OnEventClipboard(data.clipboardID);
|
||||||
}
|
}
|
||||||
@ -194,17 +245,15 @@ ewol::eSystem::eSystem(void) :
|
|||||||
m_windowsSize(320,480)
|
m_windowsSize(320,480)
|
||||||
{
|
{
|
||||||
EWOL_INFO("==> Ewol System Init (BEGIN)");
|
EWOL_INFO("==> Ewol System Init (BEGIN)");
|
||||||
|
// set the curent interface :
|
||||||
|
SetSystem();
|
||||||
EWOL_INFO("v:" << ewol::GetVersion());
|
EWOL_INFO("v:" << ewol::GetVersion());
|
||||||
EWOL_INFO("Build Date: " << date::GetYear() << "/" << date::GetMonth() << "/" << date::GetDay() << " " << date::GetHour() << "h" << date::GetMinute());
|
EWOL_INFO("Build Date: " << date::GetYear() << "/" << date::GetMonth() << "/" << date::GetDay() << " " << date::GetHour() << "h" << date::GetMinute());
|
||||||
// TODO : Remove this ...
|
// TODO : Remove this ...
|
||||||
etk::InitDefaultFolder("ewolApplNoName");
|
etk::InitDefaultFolder("ewolApplNoName");
|
||||||
// TODO : Remove all of this gloabals ...
|
// TODO : Remove all of this gloabals ...
|
||||||
ewol::openGL::Init();
|
ewol::openGL::Init();
|
||||||
ewol::EObjectManager::Init();
|
|
||||||
ewol::EObjectMessageMultiCast::Init();
|
|
||||||
m_managementInput.Reset();
|
|
||||||
ewol::resource::Init();
|
ewol::resource::Init();
|
||||||
ewol::widgetManager::Init();
|
|
||||||
ewol::config::Init();
|
ewol::config::Init();
|
||||||
// request the init of the application in the main context of openGL ...
|
// request the init of the application in the main context of openGL ...
|
||||||
{
|
{
|
||||||
@ -221,24 +270,26 @@ ewol::eSystem::eSystem(void) :
|
|||||||
#else
|
#else
|
||||||
ForceOrientation(ewol::SCREEN_ORIENTATION_AUTO);
|
ForceOrientation(ewol::SCREEN_ORIENTATION_AUTO);
|
||||||
#endif
|
#endif
|
||||||
|
// release the curent interface :
|
||||||
|
ReleaseSystem();
|
||||||
EWOL_INFO("==> Ewol System Init (END)");
|
EWOL_INFO("==> Ewol System Init (END)");
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::eSystem::~eSystem(void)
|
ewol::eSystem::~eSystem(void)
|
||||||
{
|
{
|
||||||
EWOL_INFO("==> Ewol System Un-Init (BEGIN)");
|
EWOL_INFO("==> Ewol System Un-Init (BEGIN)");
|
||||||
|
// set the curent interface :
|
||||||
|
SetSystem();
|
||||||
// call application to uninit
|
// call application to uninit
|
||||||
APP_UnInit();
|
APP_UnInit(*this);
|
||||||
// unset all windows
|
// unset all windows
|
||||||
SetCurrentWindows(NULL);
|
m_windowsCurrent = NULL;
|
||||||
ewol::widgetManager::UnInit();
|
|
||||||
ewol::config::UnInit();
|
ewol::config::UnInit();
|
||||||
ewol::EObjectMessageMultiCast::UnInit();
|
|
||||||
ewol::EObjectManager::UnInit();
|
|
||||||
ewol::resource::UnInit();
|
ewol::resource::UnInit();
|
||||||
ewol::openGL::UnInit();
|
ewol::openGL::UnInit();
|
||||||
m_managementInput.Reset();
|
|
||||||
m_msgSystem.Clean();
|
m_msgSystem.Clean();
|
||||||
|
// release the curent interface :
|
||||||
|
ReleaseSystem();
|
||||||
EWOL_INFO("==> Ewol System Un-Init (END)");
|
EWOL_INFO("==> Ewol System Un-Init (END)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,54 +433,68 @@ bool ewol::eSystem::OS_Draw(bool _displayEveryTime)
|
|||||||
|
|
||||||
// process the events
|
// process the events
|
||||||
m_FpsSystemEvent.Tic();
|
m_FpsSystemEvent.Tic();
|
||||||
ProcessEvents();
|
bool needRedraw = false;
|
||||||
// call all the widget that neded to do something periodicly
|
//! Event management section ...
|
||||||
ewol::widgetManager::PeriodicCall(currentTime);
|
{
|
||||||
// Remove all widget that they are no more usefull (these who decided to destroy themself)
|
// set the curent interface :
|
||||||
ewol::EObjectManager::RemoveAllAutoRemove();
|
SetSystem();
|
||||||
ewol::Windows* tmpWindows = eSystem::GetCurrentWindows();
|
ProcessEvents();
|
||||||
// check if the user selected a windows
|
// call all the widget that neded to do something periodicly
|
||||||
if (NULL != tmpWindows) {
|
//! ewol::widgetManager::PeriodicCall(currentTime);
|
||||||
// Redraw all needed elements
|
m_widgetManager.PeriodicCall(currentTime);
|
||||||
tmpWindows->OnRegenerateDisplay();
|
// Remove all widget that they are no more usefull (these who decided to destroy themself)
|
||||||
}
|
//! ewol::EObjectManager::RemoveAllAutoRemove();
|
||||||
m_FpsSystemEvent.IncrementCounter();
|
m_EObjectManager.RemoveAllAutoRemove();
|
||||||
m_FpsSystemEvent.Toc();
|
// check if the user selected a windows
|
||||||
bool needRedraw = ewol::widgetManager::IsDrawingNeeded();
|
if (NULL != m_windowsCurrent) {
|
||||||
|
// Redraw all needed elements
|
||||||
m_FpsSystemContext.Tic();
|
m_windowsCurrent->OnRegenerateDisplay();
|
||||||
if (NULL != tmpWindows) {
|
|
||||||
if( true == needRedraw
|
|
||||||
|| true == _displayEveryTime) {
|
|
||||||
ewol::resource::UpdateContext();
|
|
||||||
m_FpsSystemContext.IncrementCounter();
|
|
||||||
}
|
}
|
||||||
|
m_FpsSystemEvent.IncrementCounter();
|
||||||
|
m_FpsSystemEvent.Toc();
|
||||||
|
//! bool needRedraw = ewol::widgetManager::IsDrawingNeeded();
|
||||||
|
needRedraw = m_widgetManager.IsDrawingNeeded();
|
||||||
|
// release the curent interface :
|
||||||
|
ReleaseSystem();
|
||||||
}
|
}
|
||||||
m_FpsSystemContext.Toc();
|
|
||||||
bool hasDisplayDone = false;
|
bool hasDisplayDone = false;
|
||||||
m_FpsSystem.Tic();
|
//! Drawing section :
|
||||||
if (NULL != tmpWindows) {
|
{
|
||||||
if( true == needRedraw
|
// Lock OpenGl context:
|
||||||
|| true == _displayEveryTime) {
|
MutexDraw().Lock();
|
||||||
m_FpsSystem.IncrementCounter();
|
m_FpsSystemContext.Tic();
|
||||||
tmpWindows->SysDraw();
|
if (NULL != m_windowsCurrent) {
|
||||||
hasDisplayDone = true;
|
if( true == needRedraw
|
||||||
|
|| true == _displayEveryTime) {
|
||||||
|
ewol::resource::UpdateContext();
|
||||||
|
m_FpsSystemContext.IncrementCounter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
m_FpsSystemContext.Toc();
|
||||||
|
m_FpsSystem.Tic();
|
||||||
|
if (NULL != m_windowsCurrent) {
|
||||||
|
if( true == needRedraw
|
||||||
|
|| true == _displayEveryTime) {
|
||||||
|
m_FpsSystem.IncrementCounter();
|
||||||
|
m_windowsCurrent->SysDraw();
|
||||||
|
hasDisplayDone = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_FpsSystem.Toc();
|
||||||
|
|
||||||
|
m_FpsFlush.Tic();
|
||||||
|
m_FpsFlush.IncrementCounter();
|
||||||
|
glFlush();
|
||||||
|
//glFinish();
|
||||||
|
m_FpsFlush.Toc();
|
||||||
|
// Release Open GL Context
|
||||||
|
MutexDraw().UnLock();
|
||||||
}
|
}
|
||||||
m_FpsSystem.Toc();
|
|
||||||
|
|
||||||
m_FpsFlush.Tic();
|
|
||||||
m_FpsFlush.IncrementCounter();
|
|
||||||
glFlush();
|
|
||||||
//glFinish();
|
|
||||||
m_FpsFlush.Toc();
|
|
||||||
|
|
||||||
m_FpsSystemEvent.Draw();
|
m_FpsSystemEvent.Draw();
|
||||||
m_FpsSystemContext.Draw();
|
m_FpsSystemContext.Draw();
|
||||||
m_FpsSystem.Draw();
|
m_FpsSystem.Draw();
|
||||||
m_FpsFlush.Draw();
|
m_FpsFlush.Draw();
|
||||||
return hasDisplayDone;
|
return hasDisplayDone;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -451,7 +516,7 @@ void ewol::eSystem::OS_OpenGlContextDestroy(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::eSystem::SetCurrentWindows(ewol::Windows* _windows)
|
void ewol::eSystem::SetWindows(ewol::Windows* _windows)
|
||||||
{
|
{
|
||||||
// set the new pointer as windows system
|
// set the new pointer as windows system
|
||||||
m_windowsCurrent = _windows;
|
m_windowsCurrent = _windows;
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
#include <ewol/renderer/os/eSystemInput.h>
|
#include <ewol/renderer/os/eSystemInput.h>
|
||||||
#include <ewol/renderer/os/Fps.h>
|
#include <ewol/renderer/os/Fps.h>
|
||||||
#include <etk/MessageFifo.h>
|
#include <etk/MessageFifo.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
#include <ewol/eObject/EObjectManager.h>
|
||||||
|
#include <ewol/eObject/EObjectMessageMultiCast.h>
|
||||||
|
|
||||||
|
|
||||||
// TODO : Remove this from here ...
|
// TODO : Remove this from here ...
|
||||||
@ -74,9 +77,38 @@ namespace ewol
|
|||||||
{
|
{
|
||||||
class eSystem
|
class eSystem
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
ewol::WidgetManager m_widgetManager; //!< global widget manager
|
||||||
|
public:
|
||||||
|
ewol::WidgetManager& GetWidgetManager(void) { return m_widgetManager; };
|
||||||
|
private:
|
||||||
|
ewol::EObjectManager m_EObjectManager; //!< eObject Manager main instance
|
||||||
|
public:
|
||||||
|
ewol::EObjectManager& GetEObjectManager(void) { return m_EObjectManager; };
|
||||||
|
private:
|
||||||
|
ewol::EObjectMessageMultiCast m_MessageMulticast; //!< global message multicastiong system
|
||||||
|
public:
|
||||||
|
ewol::EObjectMessageMultiCast& GetEObjectMessageMultiCast(void) { return m_MessageMulticast; };
|
||||||
public:
|
public:
|
||||||
eSystem(void);
|
eSystem(void);
|
||||||
virtual ~eSystem(void);
|
virtual ~eSystem(void);
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief From everyware in the program, we can get the system inteface.
|
||||||
|
* @return curent pointer on the instance.
|
||||||
|
*/
|
||||||
|
static eSystem& GetSystem(void);
|
||||||
|
protected:
|
||||||
|
/**
|
||||||
|
* @brief Set the curent interface.
|
||||||
|
* @note this lock the main mutex
|
||||||
|
*/
|
||||||
|
void SetSystem(void);
|
||||||
|
/**
|
||||||
|
* @brief Set the curent interface at NULL.
|
||||||
|
* @note this un-lock the main mutex
|
||||||
|
*/
|
||||||
|
void ReleaseSystem(void);
|
||||||
private:
|
private:
|
||||||
int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
|
int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
|
||||||
ewol::eSystemInput m_managementInput;
|
ewol::eSystemInput m_managementInput;
|
||||||
@ -117,10 +149,12 @@ namespace ewol
|
|||||||
bool OS_Draw(bool _displayEveryTime);
|
bool OS_Draw(bool _displayEveryTime);
|
||||||
/**
|
/**
|
||||||
* @brief Inform object that an other object is removed ...
|
* @brief Inform object that an other object is removed ...
|
||||||
* @param[in] removeObject Pointer on the EObject remeved ==> the user must remove all reference on this EObject
|
* @param[in] removeObject Pointer on the EObject removed ==> the user must remove all reference on this EObject
|
||||||
* @note : Sub classes must call this class
|
* @note : Sub classes must call this class
|
||||||
*/
|
*/
|
||||||
void OnObjectRemove(ewol::EObject * removeObject);
|
void OnObjectRemove(ewol::EObject * removeObject) {
|
||||||
|
// TODO : I did not remember what I must do ...
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* @brief reset event management for the IO like Input ou Mouse or keyborad
|
* @brief reset event management for the IO like Input ou Mouse or keyborad
|
||||||
*/
|
*/
|
||||||
@ -136,7 +170,7 @@ namespace ewol
|
|||||||
/**
|
/**
|
||||||
* @brief The application request that the Window will be killed
|
* @brief The application request that the Window will be killed
|
||||||
*/
|
*/
|
||||||
virtual void Stop(void);
|
virtual void Stop(void) { };
|
||||||
private:
|
private:
|
||||||
ewol::Windows* m_windowsCurrent; //!< curent displayed windows
|
ewol::Windows* m_windowsCurrent; //!< curent displayed windows
|
||||||
public:
|
public:
|
||||||
@ -144,12 +178,12 @@ namespace ewol
|
|||||||
* @brief set the current windows to display :
|
* @brief set the current windows to display :
|
||||||
* @param _windows Windows that might be displayed
|
* @param _windows Windows that might be displayed
|
||||||
*/
|
*/
|
||||||
void SetCurrentWindows(ewol::Windows* _windows);
|
void SetWindows(ewol::Windows* _windows);
|
||||||
/**
|
/**
|
||||||
* @brief Get the current windows that is displayed
|
* @brief Get the current windows that is displayed
|
||||||
* @return the current handle on the windows (can be null)
|
* @return the current handle on the windows (can be null)
|
||||||
*/
|
*/
|
||||||
ewol::Windows* GetCurrentWindows(void) { return m_windowsCurrent; };
|
ewol::Windows* GetWindows(void) { return m_windowsCurrent; };
|
||||||
private:
|
private:
|
||||||
vec2 m_windowsSize; //!< current size of the system
|
vec2 m_windowsSize; //!< current size of the system
|
||||||
public:
|
public:
|
||||||
@ -219,11 +253,11 @@ namespace ewol
|
|||||||
/**
|
/**
|
||||||
* @brief Display the virtal keyboard (for touch system only)
|
* @brief Display the virtal keyboard (for touch system only)
|
||||||
*/
|
*/
|
||||||
void KeyboardShow(void);
|
void KeyboardShow(void) {};
|
||||||
/**
|
/**
|
||||||
* @brief Hide the virtal keyboard (for touch system only)
|
* @brief Hide the virtal keyboard (for touch system only)
|
||||||
*/
|
*/
|
||||||
void KeyboardHide(void);
|
void KeyboardHide(void) {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Inform the Gui that we want to have a copy of the clipboard
|
* @brief Inform the Gui that we want to have a copy of the clipboard
|
||||||
@ -293,9 +327,9 @@ namespace ewol
|
|||||||
};
|
};
|
||||||
|
|
||||||
//!< must be define in CPP by the application ... this are the main init and unInit of the Application
|
//!< must be define in CPP by the application ... this are the main init and unInit of the Application
|
||||||
|
// return false if an error occured
|
||||||
ewol::Windows* APP_Init(void);
|
bool APP_Init(ewol::eSystem& _system);
|
||||||
void APP_UnInit(void);
|
void APP_UnInit(ewol::eSystem& _system);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -170,29 +170,23 @@ void ewol::eSystemInput::NewLayerSet(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::eSystemInput::Reset(void)
|
|
||||||
{
|
|
||||||
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
|
||||||
// remove the property of this input ...
|
|
||||||
CleanElement(m_eventInputSaved, iii);
|
|
||||||
CleanElement(m_eventMouseSaved, iii);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ewol::eSystemInput::eSystemInput(ewol::eSystem& _system) :
|
ewol::eSystemInput::eSystemInput(ewol::eSystem& _system) :
|
||||||
m_grabWidget(NULL),
|
m_grabWidget(NULL),
|
||||||
m_system(_system)
|
m_system(_system)
|
||||||
{
|
{
|
||||||
SetDpi(200);
|
SetDpi(200);
|
||||||
EWOL_INFO("Init (start)");
|
EWOL_INFO("Init (start)");
|
||||||
Reset();
|
for(int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
|
||||||
|
// remove the property of this input ...
|
||||||
|
CleanElement(m_eventInputSaved, iii);
|
||||||
|
CleanElement(m_eventMouseSaved, iii);
|
||||||
|
}
|
||||||
EWOL_INFO("Init (end)");
|
EWOL_INFO("Init (end)");
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::eSystemInput::~eSystemInput(void)
|
ewol::eSystemInput::~eSystemInput(void)
|
||||||
{
|
{
|
||||||
EWOL_INFO("Un-Init (start)");
|
EWOL_INFO("Un-Init (start)");
|
||||||
Reset();
|
|
||||||
EWOL_INFO("Un-Init (end)");
|
EWOL_INFO("Un-Init (end)");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +231,7 @@ void ewol::eSystemInput::Motion(ewol::keyEvent::type_te type, int pointerID, vec
|
|||||||
// not manage input
|
// not manage input
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ewol::Windows* tmpWindows = m_system.GetCurrentWindows();
|
ewol::Windows* tmpWindows = m_system.GetWindows();
|
||||||
// special case for the mouse event 0 that represent the hover event of the system :
|
// special case for the mouse event 0 that represent the hover event of the system :
|
||||||
if (type == ewol::keyEvent::typeMouse && pointerID == 0) {
|
if (type == ewol::keyEvent::typeMouse && pointerID == 0) {
|
||||||
// this event is all time on the good widget ... and manage the enter and leave ...
|
// this event is all time on the good widget ... and manage the enter and leave ...
|
||||||
@ -337,7 +331,7 @@ void ewol::eSystemInput::State(ewol::keyEvent::type_te type, int pointerID, bool
|
|||||||
}
|
}
|
||||||
// get the curent time ...
|
// get the curent time ...
|
||||||
int64_t currentTime = ewol::GetTime();
|
int64_t currentTime = ewol::GetTime();
|
||||||
ewol::Windows* tmpWindows = m_system.GetCurrentWindows();
|
ewol::Windows* tmpWindows = m_system.GetWindows();
|
||||||
|
|
||||||
if (true == isDown) {
|
if (true == isDown) {
|
||||||
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
|
EWOL_VERBOSE("GUI : Input ID=" << pointerID << "==>" << eventTable[pointerID].destinationInputId << " [DOWN] " << pos);
|
||||||
|
@ -80,7 +80,6 @@ namespace ewol
|
|||||||
public:
|
public:
|
||||||
eSystemInput(ewol::eSystem& _system);
|
eSystemInput(ewol::eSystem& _system);
|
||||||
~eSystemInput(void);
|
~eSystemInput(void);
|
||||||
void Reset(void);
|
|
||||||
void SetDpi(int32_t newDPI);
|
void SetDpi(int32_t newDPI);
|
||||||
|
|
||||||
// note if id<0 ==> the it was finger event ...
|
// note if id<0 ==> the it was finger event ...
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/widget/Button.h>
|
#include <ewol/widget/Button.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/renderer/os/eSystem.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Button"
|
#define __class__ "Button"
|
||||||
@ -40,14 +40,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::Button();
|
return new widget::Button();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::Init(void)
|
void widget::Button::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::Button::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Button::Button(const etk::UString& _shaperName) :
|
widget::Button::Button(const etk::UString& _shaperName) :
|
||||||
@ -111,7 +106,7 @@ void widget::Button::SetSubWidget(ewol::Widget* _subWidget)
|
|||||||
EWOL_VERBOSE("Add button : " << idWidget << " element : " << (int64_t)_subWidget);
|
EWOL_VERBOSE("Add button : " << idWidget << " element : " << (int64_t)_subWidget);
|
||||||
m_subWidget[idWidget] = _subWidget;
|
m_subWidget[idWidget] = _subWidget;
|
||||||
// element change ... We need to recalculate all the subElments :
|
// element change ... We need to recalculate all the subElments :
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,7 +124,7 @@ void widget::Button::SetSubWidgetToggle(ewol::Widget* _subWidget)
|
|||||||
EWOL_VERBOSE("Add button : " << idWidget << " element : " << (int64_t)_subWidget);
|
EWOL_VERBOSE("Add button : " << idWidget << " element : " << (int64_t)_subWidget);
|
||||||
m_subWidget[idWidget] = _subWidget;
|
m_subWidget[idWidget] = _subWidget;
|
||||||
// element change ... We need to recalculate all the subElments :
|
// element change ... We need to recalculate all the subElments :
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Button::CalculateSize(const vec2& _availlable)
|
void widget::Button::CalculateSize(const vec2& _availlable)
|
||||||
@ -449,8 +444,8 @@ bool widget::Button::LoadXML(exml::Element* _element)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
etk::UString widgetName = pNode->GetValue();
|
etk::UString widgetName = pNode->GetValue();
|
||||||
if (ewol::widgetManager::Exist(widgetName) == false) {
|
if (GetWidgetManager().Exist(widgetName) == false) {
|
||||||
EWOL_ERROR("(l "<<pNode->GetPos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << ewol::widgetManager::List() << "]" );
|
EWOL_ERROR("(l "<<pNode->GetPos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << GetWidgetManager().List() << "]" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
bool toogleMode=false;
|
bool toogleMode=false;
|
||||||
@ -462,7 +457,7 @@ bool widget::Button::LoadXML(exml::Element* _element)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
||||||
ewol::Widget* tmpWidget = ewol::widgetManager::Create(widgetName);
|
ewol::Widget* tmpWidget = GetWidgetManager().Create(widgetName);
|
||||||
if (tmpWidget == NULL) {
|
if (tmpWidget == NULL) {
|
||||||
EWOL_ERROR ("(l "<<pNode->GetPos()<<") Can not create the widget : \"" << widgetName << "\"");
|
EWOL_ERROR ("(l "<<pNode->GetPos()<<") Can not create the widget : \"" << widgetName << "\"");
|
||||||
continue;
|
continue;
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <ewol/compositing/Text.h>
|
#include <ewol/compositing/Text.h>
|
||||||
#include <ewol/compositing/Image.h>
|
#include <ewol/compositing/Image.h>
|
||||||
#include <ewol/compositing/Shaper.h>
|
#include <ewol/compositing/Shaper.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
@ -25,8 +26,7 @@ namespace widget {
|
|||||||
class Button : public ewol::Widget
|
class Button : public ewol::Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
// Event list of properties
|
// Event list of properties
|
||||||
static const char* const eventPressed;
|
static const char* const eventPressed;
|
||||||
static const char* const eventDown;
|
static const char* const eventDown;
|
||||||
|
@ -12,8 +12,9 @@
|
|||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/widget/meta/ColorChooser.h>
|
#include <ewol/widget/meta/ColorChooser.h>
|
||||||
|
#include <ewol/widget/Windows.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
#include <ewol/renderer/os/eSystem.h>
|
||||||
|
|
||||||
extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Change";
|
extern const char * const ewolEventButtonColorChange = "ewol-Button-Color-Change";
|
||||||
|
|
||||||
@ -35,17 +36,11 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::ButtonColor();
|
return new widget::ButtonColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ButtonColor::Init(void)
|
void widget::ButtonColor::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ButtonColor::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
widget::ButtonColor::ButtonColor(etk::Color<> baseColor, etk::UString shaperName) :
|
widget::ButtonColor::ButtonColor(etk::Color<> baseColor, etk::UString shaperName) :
|
||||||
m_shaper(shaperName),
|
m_shaper(shaperName),
|
||||||
m_textColorFg(baseColor),
|
m_textColorFg(baseColor),
|
||||||
@ -203,7 +198,14 @@ bool widget::ButtonColor::OnEventInput(const ewol::EventInput& _event)
|
|||||||
// set it in the pop-up-system :
|
// set it in the pop-up-system :
|
||||||
m_widgetContextMenu->SetSubWidget(myColorChooser);
|
m_widgetContextMenu->SetSubWidget(myColorChooser);
|
||||||
myColorChooser->RegisterOnEvent(this, ewolEventColorChooserChange, ewolEventColorChooserChange);
|
myColorChooser->RegisterOnEvent(this, ewolEventColorChooserChange, ewolEventColorChooserChange);
|
||||||
ewol::WindowsPopUpAdd(m_widgetContextMenu);
|
ewol::Windows* currentWindows = GetWindows();
|
||||||
|
if (NULL == currentWindows) {
|
||||||
|
EWOL_ERROR("Can not get the curent Windows...");
|
||||||
|
delete(m_widgetContextMenu);
|
||||||
|
m_widgetContextMenu=NULL;
|
||||||
|
} else {
|
||||||
|
currentWindows->PopUpWidgetPush(m_widgetContextMenu);
|
||||||
|
}
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include <ewol/compositing/Text.h>
|
#include <ewol/compositing/Text.h>
|
||||||
#include <ewol/compositing/Shaper.h>
|
#include <ewol/compositing/Shaper.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
extern const char * const ewolEventButtonColorChange;
|
extern const char * const ewolEventButtonColorChange;
|
||||||
|
|
||||||
@ -23,8 +24,7 @@ namespace widget {
|
|||||||
class ButtonColor : public ewol::Widget
|
class ButtonColor : public ewol::Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
private:
|
private:
|
||||||
ewol::Shaper m_shaper; //!< Compositing theme.
|
ewol::Shaper m_shaper; //!< Compositing theme.
|
||||||
ewol::Text m_text; //!< Compositing Test display.
|
ewol::Text m_text; //!< Compositing Test display.
|
||||||
|
@ -20,17 +20,11 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::CheckBox();
|
return new widget::CheckBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::CheckBox::Init(void)
|
void widget::CheckBox::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::CheckBox::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
widget::CheckBox::CheckBox(const etk::UString& newLabel)
|
widget::CheckBox::CheckBox(const etk::UString& newLabel)
|
||||||
{
|
{
|
||||||
m_label = newLabel;
|
m_label = newLabel;
|
||||||
@ -127,7 +121,7 @@ bool widget::CheckBox::OnEventInput(const ewol::EventInput& _event)
|
|||||||
m_value = true;
|
m_value = true;
|
||||||
GenerateEventId(ewolEventCheckBoxClicked, "true");
|
GenerateEventId(ewolEventCheckBoxClicked, "true");
|
||||||
}
|
}
|
||||||
ewol::widgetManager::FocusKeep(this);
|
KeepFocus();
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <ewol/compositing/Text.h>
|
#include <ewol/compositing/Text.h>
|
||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
extern const char* const ewolEventCheckBoxClicked;
|
extern const char* const ewolEventCheckBoxClicked;
|
||||||
|
|
||||||
@ -21,8 +22,7 @@ namespace widget {
|
|||||||
class CheckBox : public ewol::Widget
|
class CheckBox : public ewol::Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
public:
|
public:
|
||||||
CheckBox(const etk::UString& newLabel = "No Label");
|
CheckBox(const etk::UString& newLabel = "No Label");
|
||||||
virtual ~CheckBox(void);
|
virtual ~CheckBox(void);
|
||||||
|
@ -43,7 +43,7 @@ void widget::Container::SetSubWidget(ewol::Widget* _newWidget)
|
|||||||
m_subWidget->SetUpperWidget(this);
|
m_subWidget->SetUpperWidget(this);
|
||||||
}
|
}
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ void widget::Container::SubWidgetRemove(void)
|
|||||||
EWOL_ERROR("Composer : An error Occured when removing main node");
|
EWOL_ERROR("Composer : An error Occured when removing main node");
|
||||||
}
|
}
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ void widget::Container::SubWidgetRemoveDelayed(void)
|
|||||||
m_subWidget->RemoveObject();
|
m_subWidget->RemoveObject();
|
||||||
m_subWidget=NULL;
|
m_subWidget=NULL;
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ void widget::Container::OnObjectRemove(ewol::EObject* _removeObject)
|
|||||||
if (m_subWidget==_removeObject) {
|
if (m_subWidget==_removeObject) {
|
||||||
m_subWidget=NULL;
|
m_subWidget=NULL;
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,8 +184,8 @@ bool widget::Container::LoadXML(exml::Element* _node)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
etk::UString widgetName = pNode->GetValue();
|
etk::UString widgetName = pNode->GetValue();
|
||||||
if (ewol::widgetManager::Exist(widgetName) == false) {
|
if (GetWidgetManager().Exist(widgetName) == false) {
|
||||||
EWOL_ERROR("(l "<<pNode->GetPos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << ewol::widgetManager::List() << "]" );
|
EWOL_ERROR("(l "<<pNode->GetPos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << GetWidgetManager().List() << "]" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (NULL != GetSubWidget()) {
|
if (NULL != GetSubWidget()) {
|
||||||
@ -193,7 +193,7 @@ bool widget::Container::LoadXML(exml::Element* _node)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
|
||||||
ewol::Widget* tmpWidget = ewol::widgetManager::Create(widgetName);
|
ewol::Widget* tmpWidget = GetWidgetManager().Create(widgetName);
|
||||||
if (tmpWidget == NULL) {
|
if (tmpWidget == NULL) {
|
||||||
EWOL_ERROR ("(l "<<pNode->GetPos()<<") Can not create the widget : \"" << widgetName << "\"");
|
EWOL_ERROR ("(l "<<pNode->GetPos()<<") Can not create the widget : \"" << widgetName << "\"");
|
||||||
continue;
|
continue;
|
||||||
|
@ -50,7 +50,7 @@ void widget::ContainerN::LockExpand(const bvec2& _lockExpand)
|
|||||||
if (_lockExpand != m_lockExpand) {
|
if (_lockExpand != m_lockExpand) {
|
||||||
m_lockExpand = _lockExpand;
|
m_lockExpand = _lockExpand;
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ int32_t widget::ContainerN::SubWidgetAdd(ewol::Widget* _newWidget)
|
|||||||
}
|
}
|
||||||
m_subWidget.PushBack(_newWidget);
|
m_subWidget.PushBack(_newWidget);
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
// added at the last eelement :
|
// added at the last eelement :
|
||||||
return _newWidget->GetId();
|
return _newWidget->GetId();
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ int32_t widget::ContainerN::SubWidgetAddStart(ewol::Widget* _newWidget)
|
|||||||
}
|
}
|
||||||
m_subWidget.PushFront(_newWidget);
|
m_subWidget.PushFront(_newWidget);
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
return _newWidget->GetId();
|
return _newWidget->GetId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +103,7 @@ void widget::ContainerN::SubWidgetRemove(ewol::Widget* _newWidget)
|
|||||||
m_subWidget.Erase(iii);
|
m_subWidget.Erase(iii);
|
||||||
}
|
}
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ void widget::ContainerN::SubWidgetUnLink(ewol::Widget* _newWidget)
|
|||||||
m_subWidget[iii] = NULL;
|
m_subWidget[iii] = NULL;
|
||||||
m_subWidget.Erase(iii);
|
m_subWidget.Erase(iii);
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -310,12 +310,12 @@ bool widget::ContainerN::LoadXML(exml::Element* _node)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
etk::UString widgetName = pNode->GetValue();
|
etk::UString widgetName = pNode->GetValue();
|
||||||
if (ewol::widgetManager::Exist(widgetName) == false) {
|
if (GetWidgetManager().Exist(widgetName) == false) {
|
||||||
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->GetPos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << ewol::widgetManager::List() << "]" );
|
EWOL_ERROR("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->GetPos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << GetWidgetManager().List() << "]" );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EWOL_DEBUG("[" << GetId() << "] {" << GetObjectType() << "} load new element : \"" << widgetName << "\"");
|
EWOL_DEBUG("[" << GetId() << "] {" << GetObjectType() << "} load new element : \"" << widgetName << "\"");
|
||||||
ewol::Widget *subWidget = ewol::widgetManager::Create(widgetName);
|
ewol::Widget *subWidget = GetWidgetManager().Create(widgetName);
|
||||||
if (subWidget == NULL) {
|
if (subWidget == NULL) {
|
||||||
EWOL_ERROR ("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->GetPos()<<") Can not create the widget : \"" << widgetName << "\"");
|
EWOL_ERROR ("[" << GetId() << "] {" << GetObjectType() << "} (l "<<pNode->GetPos()<<") Can not create the widget : \"" << widgetName << "\"");
|
||||||
continue;
|
continue;
|
||||||
|
@ -25,14 +25,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::ContextMenu();
|
return new widget::ContextMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ContextMenu::Init(void)
|
void widget::ContextMenu::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::ContextMenu::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
#include <ewol/widget/Container.h>
|
#include <ewol/widget/Container.h>
|
||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
#include <ewol/compositing/Shaper.h>
|
#include <ewol/compositing/Shaper.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -27,8 +28,7 @@ namespace widget {
|
|||||||
class ContextMenu : public widget::Container
|
class ContextMenu : public widget::Container
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
// Config list of properties
|
// Config list of properties
|
||||||
static const char* const configArrowPosition;
|
static const char* const configArrowPosition;
|
||||||
static const char* const configArrowMode;
|
static const char* const configArrowMode;
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <ewol/widget/Entry.h>
|
#include <ewol/widget/Entry.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
#include <ewol/renderer/os/eSystem.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -33,14 +34,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::Entry();
|
return new widget::Entry();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Entry::Init(void)
|
void widget::Entry::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::Entry::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * const widget::Entry::eventClick = "ewol-widget-entry-event-click";
|
const char * const widget::Entry::eventClick = "ewol-widget-entry-event-click";
|
||||||
@ -560,7 +556,7 @@ void widget::Entry::OnGetFocus(void)
|
|||||||
{
|
{
|
||||||
m_displayCursor = true;
|
m_displayCursor = true;
|
||||||
ChangeStatusIn(STATUS_SELECTED);
|
ChangeStatusIn(STATUS_SELECTED);
|
||||||
ewol::Keyboard(true);
|
GetSystem().KeyboardShow();
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,7 +565,7 @@ void widget::Entry::OnLostFocus(void)
|
|||||||
{
|
{
|
||||||
m_displayCursor = false;
|
m_displayCursor = false;
|
||||||
ChangeStatusIn(STATUS_NORMAL);
|
ChangeStatusIn(STATUS_NORMAL);
|
||||||
ewol::Keyboard(false);
|
GetSystem().KeyboardHide();
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
#include <ewol/compositing/Shaper.h>
|
#include <ewol/compositing/Shaper.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <etk/Color.h>
|
#include <etk/Color.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
/**
|
/**
|
||||||
@ -42,8 +43,7 @@ namespace widget {
|
|||||||
static const char* const configColorBg;
|
static const char* const configColorBg;
|
||||||
static const char* const configEmptyMessage;
|
static const char* const configEmptyMessage;
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
private:
|
private:
|
||||||
ewol::Shaper m_shaper;
|
ewol::Shaper m_shaper;
|
||||||
ewol::Text m_oObjectText; //!< text display m_text
|
ewol::Text m_oObjectText; //!< text display m_text
|
||||||
|
@ -20,14 +20,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::Gird();
|
return new widget::Gird();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::Init(void)
|
void widget::Gird::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::Gird::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +33,7 @@ widget::Gird::Gird(int32_t colNumber) :
|
|||||||
m_borderSize(0,0)
|
m_borderSize(0,0)
|
||||||
{
|
{
|
||||||
SetColNumber(colNumber);
|
SetColNumber(colNumber);
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Gird::~Gird(void)
|
widget::Gird::~Gird(void)
|
||||||
@ -59,7 +54,7 @@ void widget::Gird::SetBorderSize(const ivec2& newBorderSize)
|
|||||||
m_borderSize.setY(0);
|
m_borderSize.setY(0);
|
||||||
}
|
}
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Gird::CalculateSize(const vec2& availlable)
|
void widget::Gird::CalculateSize(const vec2& availlable)
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
#include <etk/Vector.h>
|
#include <etk/Vector.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
class Gird :public ewol::Widget
|
class Gird :public ewol::Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
private:
|
private:
|
||||||
class GirdProperties {
|
class GirdProperties {
|
||||||
public:
|
public:
|
||||||
|
@ -21,14 +21,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::Image();
|
return new widget::Image();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::Init(void)
|
void widget::Image::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::Image::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -73,7 +68,7 @@ void widget::Image::SetBorder(const ewol::Dimension& _border)
|
|||||||
// Force redraw all :
|
// Force redraw all :
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
// TODO : Change the size with no size requested ...
|
// TODO : Change the size with no size requested ...
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Image::SetKeepRatio(bool _keep)
|
void widget::Image::SetKeepRatio(bool _keep)
|
||||||
@ -83,7 +78,7 @@ void widget::Image::SetKeepRatio(bool _keep)
|
|||||||
m_keepRatio = _keep;
|
m_keepRatio = _keep;
|
||||||
// Force redraw all :
|
// Force redraw all :
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +88,7 @@ void widget::Image::SetImageSize(const ewol::Dimension& _size)
|
|||||||
if (_size != m_imageSize) {
|
if (_size != m_imageSize) {
|
||||||
m_imageSize = _size;
|
m_imageSize = _size;
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
EWOL_VERBOSE("Set sources : " << m_fileName << " size=" << m_imageSize);
|
EWOL_VERBOSE("Set sources : " << m_fileName << " size=" << m_imageSize);
|
||||||
m_compositing.SetSource(m_fileName, m_imageSize.GetPixel());
|
m_compositing.SetSource(m_fileName, m_imageSize.GetPixel());
|
||||||
}
|
}
|
||||||
@ -105,7 +100,7 @@ void widget::Image::Set(const etk::UString& _file, const ewol::Dimension& _borde
|
|||||||
// copy data :
|
// copy data :
|
||||||
if (m_border != _border) {
|
if (m_border != _border) {
|
||||||
m_border = _border;
|
m_border = _border;
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
SetFile(_file);
|
SetFile(_file);
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <draw/Color.h>
|
#include <draw/Color.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <ewol/compositing/Image.h>
|
#include <ewol/compositing/Image.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
extern const char * const ewolEventImagePressed;
|
extern const char * const ewolEventImagePressed;
|
||||||
|
|
||||||
@ -32,11 +33,7 @@ namespace widget {
|
|||||||
/**
|
/**
|
||||||
* @brief Main call of recording the widget on the List of "widget named creator"
|
* @brief Main call of recording the widget on the List of "widget named creator"
|
||||||
*/
|
*/
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
/**
|
|
||||||
* @brief Main call to unrecord the widget from the list of "widget named creator"
|
|
||||||
*/
|
|
||||||
static void UnInit(void);
|
|
||||||
protected:
|
protected:
|
||||||
ewol::Image m_compositing; //!< compositing element of the image.
|
ewol::Image m_compositing; //!< compositing element of the image.
|
||||||
public:
|
public:
|
||||||
|
@ -22,14 +22,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::Label();
|
return new widget::Label();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Label::Init(void)
|
void widget::Label::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::Label::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Label::Label(etk::UString _newLabel)
|
widget::Label::Label(etk::UString _newLabel)
|
||||||
@ -59,7 +54,7 @@ void widget::Label::SetLabel(const etk::UString& _newLabel)
|
|||||||
{
|
{
|
||||||
m_label = _newLabel;
|
m_label = _newLabel;
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::UString widget::Label::GetLabel(void)
|
etk::UString widget::Label::GetLabel(void)
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/compositing/Text.h>
|
#include <ewol/compositing/Text.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
class Label : public ewol::Widget
|
class Label : public ewol::Widget
|
||||||
@ -23,11 +24,7 @@ namespace widget {
|
|||||||
/**
|
/**
|
||||||
* @brief Main call of recording the widget on the List of "widget named creator"
|
* @brief Main call of recording the widget on the List of "widget named creator"
|
||||||
*/
|
*/
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
/**
|
|
||||||
* @brief Main call to unrecord the widget from the list of "widget named creator"
|
|
||||||
*/
|
|
||||||
static void UnInit(void);
|
|
||||||
private:
|
private:
|
||||||
ewol::Text m_text; //!< Compositing text element.
|
ewol::Text m_text; //!< Compositing text element.
|
||||||
etk::UString m_label; //!< decorated text to display.
|
etk::UString m_label; //!< decorated text to display.
|
||||||
|
@ -18,17 +18,11 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::Layer();
|
return new widget::Layer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Layer::Init(void)
|
void widget::Layer::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Layer::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
widget::Layer::Layer(void)
|
widget::Layer::Layer(void)
|
||||||
{
|
{
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/ContainerN.h>
|
#include <ewol/widget/ContainerN.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
class Layer : public widget::ContainerN
|
class Layer : public widget::ContainerN
|
||||||
@ -20,11 +21,7 @@ namespace widget {
|
|||||||
/**
|
/**
|
||||||
* @brief Main call of recording the widget on the List of "widget named creator"
|
* @brief Main call of recording the widget on the List of "widget named creator"
|
||||||
*/
|
*/
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
/**
|
|
||||||
* @brief Main call to unrecord the widget from the list of "widget named creator"
|
|
||||||
*/
|
|
||||||
static void UnInit(void);
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructor
|
* @brief Constructor
|
||||||
|
@ -228,7 +228,7 @@ bool widget::List::OnEventInput(const ewol::EventInput& _event)
|
|||||||
vec2 relativePos = RelativePosition(_event.GetPos());
|
vec2 relativePos = RelativePosition(_event.GetPos());
|
||||||
|
|
||||||
if (true == WidgetScrooled::OnEventInput(_event)) {
|
if (true == WidgetScrooled::OnEventInput(_event)) {
|
||||||
ewol::widgetManager::FocusKeep(this);
|
KeepFocus();
|
||||||
// nothing to do ... done on upper widet ...
|
// nothing to do ... done on upper widet ...
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <ewol/widget/ContextMenu.h>
|
#include <ewol/widget/ContextMenu.h>
|
||||||
#include <ewol/widget/Composer.h>
|
#include <ewol/widget/Composer.h>
|
||||||
#include <ewol/widget/Label.h>
|
#include <ewol/widget/Label.h>
|
||||||
|
#include <ewol/widget/Windows.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Menu"
|
#define __class__ "Menu"
|
||||||
@ -239,7 +240,14 @@ void widget::Menu::OnReceiveMessage(const ewol::EMessage& _msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ewol::WindowsPopUpAdd(m_widgetContextMenu);
|
ewol::Windows* currentWindows = GetWindows();
|
||||||
|
if (NULL == currentWindows) {
|
||||||
|
EWOL_ERROR("Can not get the curent Windows...");
|
||||||
|
delete(m_widgetContextMenu);
|
||||||
|
m_widgetContextMenu=NULL;
|
||||||
|
} else {
|
||||||
|
currentWindows->PopUpWidgetPush(m_widgetContextMenu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -27,14 +27,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::PopUp();
|
return new widget::PopUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::PopUp::Init(void)
|
void widget::PopUp::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::PopUp::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +58,7 @@ void widget::PopUp::LockExpand(const bvec2& _lockExpand)
|
|||||||
if (_lockExpand != m_lockExpand) {
|
if (_lockExpand != m_lockExpand) {
|
||||||
m_lockExpand = _lockExpand;
|
m_lockExpand = _lockExpand;
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,13 +15,13 @@
|
|||||||
#include <ewol/widget/Container.h>
|
#include <ewol/widget/Container.h>
|
||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
#include <ewol/compositing/Shaper.h>
|
#include <ewol/compositing/Shaper.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
class PopUp : public widget::Container
|
class PopUp : public widget::Container
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
// Config list of properties
|
// Config list of properties
|
||||||
static const char* const configShaper;
|
static const char* const configShaper;
|
||||||
static const char* const configRemoveOnExternClick;
|
static const char* const configRemoveOnExternClick;
|
||||||
|
@ -19,14 +19,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::ProgressBar();
|
return new widget::ProgressBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::ProgressBar::Init(void)
|
void widget::ProgressBar::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::ProgressBar::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,14 +14,13 @@
|
|||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
class ProgressBar : public ewol::Widget
|
class ProgressBar : public ewol::Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
private:
|
private:
|
||||||
ewol::Drawing m_draw; // basic drawing element
|
ewol::Drawing m_draw; // basic drawing element
|
||||||
public:
|
public:
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,123 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __EWOL_SCENE_H__
|
|
||||||
#define __EWOL_SCENE_H__
|
|
||||||
|
|
||||||
#ifdef BUILD_BULLET
|
|
||||||
|
|
||||||
#include <etk/types.h>
|
|
||||||
#include <etk/math/Vector3D.h>
|
|
||||||
#include <etk/math/Matrix4.h>
|
|
||||||
#include <etk/Vector.h>
|
|
||||||
#include <ewol/debug.h>
|
|
||||||
#include <ewol/game/Camera.h>
|
|
||||||
#include <ewol/widget/Widget.h>
|
|
||||||
#include <ewol/renderer/openGL.h>
|
|
||||||
#include <ewol/renderer/ResourceManager.h>
|
|
||||||
|
|
||||||
class btBroadphaseInterface;
|
|
||||||
class btCollisionShape;
|
|
||||||
class btOverlappingPairCache;
|
|
||||||
class btCollisionDispatcher;
|
|
||||||
class btConstraintSolver;
|
|
||||||
struct btCollisionAlgorithmCreateFunc;
|
|
||||||
class btDefaultCollisionConfiguration;
|
|
||||||
class btDynamicsWorld;
|
|
||||||
#include <LinearMath/btScalar.h>
|
|
||||||
class btVector3;
|
|
||||||
|
|
||||||
namespace widget {
|
|
||||||
class Scene :public ewol::Widget
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
///this is the most important class
|
|
||||||
btDefaultCollisionConfiguration* m_collisionConfiguration;
|
|
||||||
btCollisionDispatcher* m_dispatcher;
|
|
||||||
btBroadphaseInterface* m_broadphase;
|
|
||||||
btConstraintSolver* m_solver;
|
|
||||||
btDynamicsWorld* m_dynamicsWorld;
|
|
||||||
//keep the collision shapes, for deletion/cleanup
|
|
||||||
etk::Vector<btCollisionShape*> m_collisionShapes;
|
|
||||||
game::Camera m_camera; //!< Display point of view
|
|
||||||
bool m_isRunning; //!< the display is running (not in pause)
|
|
||||||
double m_lastCallTime; //!< previous call Time
|
|
||||||
float m_ratioTime; //!< Ratio time for the speed of the game ...
|
|
||||||
uint32_t m_walk; //!< Wolk properties
|
|
||||||
int32_t m_debugMode;
|
|
||||||
ewol::Colored3DObject* m_directDrawObject; // system to draw special object ...
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Main scene constructor
|
|
||||||
* @param[in] gameEngine Used game engine for the display (can be NULL).
|
|
||||||
*/
|
|
||||||
Scene(btDynamicsWorld* gameEngine=NULL);
|
|
||||||
/**
|
|
||||||
* @brief Destructor
|
|
||||||
* @note The engine is not destroy, it is the reponsability of the user
|
|
||||||
*/
|
|
||||||
virtual ~Scene(void);
|
|
||||||
/**
|
|
||||||
* @brief Set the scene in pause for a while
|
|
||||||
*/
|
|
||||||
void Pause(void);
|
|
||||||
/**
|
|
||||||
* @brief Resume the scene activity
|
|
||||||
*/
|
|
||||||
void Resume(void);
|
|
||||||
/**
|
|
||||||
* @brief Toggle between pause and running
|
|
||||||
*/
|
|
||||||
void PauseToggle(void);
|
|
||||||
// Derived function
|
|
||||||
virtual void SystemDraw(const ewol::DrawProperty& displayProp);
|
|
||||||
protected:
|
|
||||||
// Derived function
|
|
||||||
virtual void ScenePeriodicCall(int64_t localTime, int32_t deltaTime) { };
|
|
||||||
// camera properties :
|
|
||||||
private:
|
|
||||||
float m_zoom;
|
|
||||||
public:
|
|
||||||
/**
|
|
||||||
* @brief Get the current camera reference for the scene rendering
|
|
||||||
*/
|
|
||||||
game::Camera& GetCamera(void) { return m_camera; };
|
|
||||||
/**
|
|
||||||
* @brief Set the curent Time Ratio (default 1)
|
|
||||||
*/
|
|
||||||
void SetRatioTime(float newRatio) { m_ratioTime = newRatio; };
|
|
||||||
/**
|
|
||||||
* @brief Convert the absolute position in the local Position (Relative)
|
|
||||||
* @param[in] pos Absolute position that you request convertion
|
|
||||||
* @return the relative position
|
|
||||||
*/
|
|
||||||
virtual vec2 RelativePosition(vec2 pos);
|
|
||||||
protected: // Derived function
|
|
||||||
virtual void OnDraw(void);
|
|
||||||
public: // dericed function:
|
|
||||||
virtual const char * const GetObjectType(void) { return "Ewol::Scene"; };
|
|
||||||
virtual void OnRegenerateDisplay(void);
|
|
||||||
virtual void PeriodicCall(int64_t localTime);
|
|
||||||
virtual bool OnEventInput(const ewol::EventInput& _event);
|
|
||||||
virtual bool OnEventEntry(const ewol::EventEntry& _event);
|
|
||||||
virtual void OnGetFocus(void);
|
|
||||||
virtual void OnLostFocus(void);
|
|
||||||
void renderscene(int pass);
|
|
||||||
void DrawOpenGL(btScalar* m,
|
|
||||||
const btCollisionShape* shape,
|
|
||||||
const btVector3& color,
|
|
||||||
int32_t debugMode,
|
|
||||||
const btVector3& worldBoundsMin,
|
|
||||||
const btVector3& worldBoundsMax);
|
|
||||||
void DrawSphere(btScalar radius, int lats, int longs, mat4& transformationMatrix, draw::Colorf& tmpColor);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -19,14 +19,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::Scroll();
|
return new widget::Scroll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Scroll::Init(void)
|
void widget::Scroll::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::Scroll::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* const widget::Scroll::configLimit = "limit";
|
const char* const widget::Scroll::configLimit = "limit";
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <ewol/widget/Container.h>
|
#include <ewol/widget/Container.h>
|
||||||
#include <ewol/compositing/Compositing.h>
|
#include <ewol/compositing/Compositing.h>
|
||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
typedef enum {
|
typedef enum {
|
||||||
@ -31,8 +32,7 @@ namespace widget {
|
|||||||
// Cinfig parameter list:
|
// Cinfig parameter list:
|
||||||
static const char* const configLimit;
|
static const char* const configLimit;
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
private:
|
private:
|
||||||
ewol::Drawing m_draw; // TODO : Change in shaper ... ==> better for annimation and dynamic display ...
|
ewol::Drawing m_draw; // TODO : Change in shaper ... ==> better for annimation and dynamic display ...
|
||||||
protected:
|
protected:
|
||||||
|
@ -19,14 +19,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::Sizer();
|
return new widget::Sizer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Sizer::Init(void)
|
void widget::Sizer::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::Sizer::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -52,14 +47,14 @@ void widget::Sizer::SetBorderSize(const ewol::Dimension& _newBorderSize)
|
|||||||
{
|
{
|
||||||
m_borderSize = _newBorderSize;
|
m_borderSize = _newBorderSize;
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Sizer::SetMode(widget::Sizer::displayMode_te _mode)
|
void widget::Sizer::SetMode(widget::Sizer::displayMode_te _mode)
|
||||||
{
|
{
|
||||||
m_mode = _mode;
|
m_mode = _mode;
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::Sizer::displayMode_te widget::Sizer::GetMode(void)
|
widget::Sizer::displayMode_te widget::Sizer::GetMode(void)
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/ContainerN.h>
|
#include <ewol/widget/ContainerN.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
class Sizer : public widget::ContainerN
|
class Sizer : public widget::ContainerN
|
||||||
@ -20,11 +21,7 @@ namespace widget {
|
|||||||
/**
|
/**
|
||||||
* @brief Main call of recording the widget on the List of "widget named creator"
|
* @brief Main call of recording the widget on the List of "widget named creator"
|
||||||
*/
|
*/
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
/**
|
|
||||||
* @brief Main call to unrecord the widget from the list of "widget named creator"
|
|
||||||
*/
|
|
||||||
static void UnInit(void);
|
|
||||||
public:
|
public:
|
||||||
typedef enum {
|
typedef enum {
|
||||||
modeVert, //!< Vertical mode
|
modeVert, //!< Vertical mode
|
||||||
|
@ -25,17 +25,11 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::Slider();
|
return new widget::Slider();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Slider::Init(void)
|
void widget::Slider::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Slider::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const int32_t dotRadius = 6;
|
const int32_t dotRadius = 6;
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include <etk/Color.h>
|
#include <etk/Color.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/Drawable.h>
|
#include <ewol/widget/Drawable.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
extern const char * const ewolEventSliderChange;
|
extern const char * const ewolEventSliderChange;
|
||||||
|
|
||||||
@ -20,8 +21,7 @@ namespace widget {
|
|||||||
class Slider :public widget::Drawable
|
class Slider :public widget::Drawable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
public:
|
public:
|
||||||
Slider(void);
|
Slider(void);
|
||||||
virtual ~Slider(void);
|
virtual ~Slider(void);
|
||||||
|
@ -22,14 +22,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::Spacer();
|
return new widget::Spacer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Spacer::Init(void)
|
void widget::Spacer::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::Spacer::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,13 +14,13 @@
|
|||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <ewol/compositing/Drawing.h>
|
#include <ewol/compositing/Drawing.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
class Spacer :public ewol::Widget
|
class Spacer :public ewol::Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
// Config list of properties
|
// Config list of properties
|
||||||
static const char* const configColor;
|
static const char* const configColor;
|
||||||
private:
|
private:
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/widget/WSlider.h>
|
#include <ewol/widget/WSlider.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
|
||||||
|
|
||||||
@ -39,14 +38,9 @@ static ewol::Widget* Create(void)
|
|||||||
return new widget::WSlider();
|
return new widget::WSlider();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::WSlider::Init(void)
|
void widget::WSlider::Init(ewol::WidgetManager& _widgetManager)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,&Create);
|
_widgetManager.AddWidgetCreator(__class__,&Create);
|
||||||
}
|
|
||||||
|
|
||||||
void widget::WSlider::UnInit(void)
|
|
||||||
{
|
|
||||||
ewol::widgetManager::AddWidgetCreator(__class__,NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::WSlider::WSlider(void) :
|
widget::WSlider::WSlider(void) :
|
||||||
|
@ -12,14 +12,14 @@
|
|||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/ContainerN.h>
|
#include <ewol/widget/ContainerN.h>
|
||||||
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
class WSlider :public widget::ContainerN
|
class WSlider :public widget::ContainerN
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(ewol::WidgetManager& _widgetManager);
|
||||||
static void UnInit(void);
|
|
||||||
// Event list of properties
|
// Event list of properties
|
||||||
static const char* const eventStartSlide;
|
static const char* const eventStartSlide;
|
||||||
static const char* const eventStopSlide;
|
static const char* const eventStopSlide;
|
||||||
|
@ -139,7 +139,7 @@ ewol::Widget::Widget(void) :
|
|||||||
ewol::Widget::~Widget(void)
|
ewol::Widget::~Widget(void)
|
||||||
{
|
{
|
||||||
// Remove his own focus...
|
// Remove his own focus...
|
||||||
ewol::widgetManager::Rm(this);
|
GetWidgetManager().Rm(this);
|
||||||
// clean all the short-cut ...
|
// clean all the short-cut ...
|
||||||
ShortCutClean();
|
ShortCutClean();
|
||||||
}
|
}
|
||||||
@ -169,7 +169,7 @@ void ewol::Widget::Hide(void)
|
|||||||
{
|
{
|
||||||
m_hide = true;
|
m_hide = true;
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ void ewol::Widget::Show(void)
|
|||||||
{
|
{
|
||||||
m_hide = false;
|
m_hide = false;
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ void ewol::Widget::SetCanHaveFocus(bool _canFocusState)
|
|||||||
|
|
||||||
void ewol::Widget::KeepFocus(void)
|
void ewol::Widget::KeepFocus(void)
|
||||||
{
|
{
|
||||||
ewol::widgetManager::FocusKeep(this);
|
GetWidgetManager().FocusKeep(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Widget::SetOffset(const vec2& _newVal)
|
void ewol::Widget::SetOffset(const vec2& _newVal)
|
||||||
@ -361,7 +361,7 @@ void ewol::Widget::PeriodicCallDisable(void)
|
|||||||
{
|
{
|
||||||
m_periodicCallDeltaTime=0;
|
m_periodicCallDeltaTime=0;
|
||||||
m_periodicCallTime=-1;
|
m_periodicCallTime=-1;
|
||||||
ewol::widgetManager::PeriodicCallRm(this);
|
GetWidgetManager().PeriodicCallRm(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Widget::PeriodicCallEnable(float _callInSecond)
|
void ewol::Widget::PeriodicCallEnable(float _callInSecond)
|
||||||
@ -369,7 +369,7 @@ void ewol::Widget::PeriodicCallEnable(float _callInSecond)
|
|||||||
if (_callInSecond < 0) {
|
if (_callInSecond < 0) {
|
||||||
PeriodicCallDisable();
|
PeriodicCallDisable();
|
||||||
} else {
|
} else {
|
||||||
ewol::widgetManager::PeriodicCallAdd(this);
|
GetWidgetManager().PeriodicCallAdd(this);
|
||||||
m_periodicCallDeltaTime = _callInSecond*1000000.0;
|
m_periodicCallDeltaTime = _callInSecond*1000000.0;
|
||||||
m_periodicCallTime = ewol::GetTime();
|
m_periodicCallTime = ewol::GetTime();
|
||||||
}
|
}
|
||||||
@ -379,7 +379,7 @@ void ewol::Widget::PeriodicCallEnable(float _callInSecond)
|
|||||||
void ewol::Widget::MarkToRedraw(void)
|
void ewol::Widget::MarkToRedraw(void)
|
||||||
{
|
{
|
||||||
m_needRegenerateDisplay = true;
|
m_needRegenerateDisplay = true;
|
||||||
ewol::widgetManager::MarkDrawingIsNeeded();
|
GetWidgetManager().MarkDrawingIsNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -456,7 +456,7 @@ void ewol::Widget::SetMinSize(const ewol::Dimension& _size)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_userMinSize = _size;
|
m_userMinSize = _size;
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Widget::SetNoMinSize(void)
|
void ewol::Widget::SetNoMinSize(void)
|
||||||
@ -488,7 +488,7 @@ void ewol::Widget::SetMaxSize(const ewol::Dimension& _size)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_userMaxSize = _size;
|
m_userMaxSize = _size;
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::Widget::SetNoMaxSize(void)
|
void ewol::Widget::SetNoMaxSize(void)
|
||||||
@ -516,7 +516,7 @@ void ewol::Widget::SetExpand(const bvec2& _newExpand)
|
|||||||
if( m_userExpand.x() != _newExpand.x()
|
if( m_userExpand.x() != _newExpand.x()
|
||||||
|| m_userExpand.y() != _newExpand.y()) {
|
|| m_userExpand.y() != _newExpand.y()) {
|
||||||
m_userExpand = _newExpand;
|
m_userExpand = _newExpand;
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -535,7 +535,7 @@ void ewol::Widget::SetFill(const bvec2& _newFill)
|
|||||||
if( m_userFill.x() != _newFill.x()
|
if( m_userFill.x() != _newFill.x()
|
||||||
|| m_userFill.y() != _newFill.y()) {
|
|| m_userFill.y() != _newFill.y()) {
|
||||||
m_userFill = _newFill;
|
m_userFill = _newFill;
|
||||||
ewol::RequestUpdateSize();
|
RequestUpdateSize();
|
||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -696,7 +696,7 @@ bool ewol::Widget::OnEventShortCut(ewol::SpecialKey& _special, uniChar_t _unicod
|
|||||||
void ewol::Widget::GrabCursor(void)
|
void ewol::Widget::GrabCursor(void)
|
||||||
{
|
{
|
||||||
if (false == m_grabCursor) {
|
if (false == m_grabCursor) {
|
||||||
eSystem::InputEventGrabPointer(this);
|
GetSystem().InputEventGrabPointer(this);
|
||||||
m_grabCursor = true;
|
m_grabCursor = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -704,7 +704,7 @@ void ewol::Widget::GrabCursor(void)
|
|||||||
void ewol::Widget::UnGrabCursor(void)
|
void ewol::Widget::UnGrabCursor(void)
|
||||||
{
|
{
|
||||||
if (true==m_grabCursor) {
|
if (true==m_grabCursor) {
|
||||||
eSystem::InputEventUnGrabPointer();
|
GetSystem().InputEventUnGrabPointer();
|
||||||
m_grabCursor = false;
|
m_grabCursor = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -721,7 +721,7 @@ void ewol::Widget::SetCursor(ewol::cursorDisplay_te _newCursor)
|
|||||||
{
|
{
|
||||||
EWOL_DEBUG("Change Cursor in " << _newCursor);
|
EWOL_DEBUG("Change Cursor in " << _newCursor);
|
||||||
m_cursorDisplay = _newCursor;
|
m_cursorDisplay = _newCursor;
|
||||||
guiInterface::SetCursor(m_cursorDisplay);
|
GetSystem().SetCursor(m_cursorDisplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::cursorDisplay_te ewol::Widget::GetCursor(void)
|
ewol::cursorDisplay_te ewol::Widget::GetCursor(void)
|
||||||
@ -855,3 +855,20 @@ bool ewol::Widget::OnGetConfig(const char* _config, etk::UString& _result) const
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::Widget::RequestUpdateSize(void)
|
||||||
|
{
|
||||||
|
GetSystem().RequestUpdateSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ewol::WidgetManager& ewol::Widget::GetWidgetManager(void)
|
||||||
|
{
|
||||||
|
return GetSystem().GetWidgetManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ewol::Windows* ewol::Widget::GetWindows(void)
|
||||||
|
{
|
||||||
|
return GetSystem().GetWindows();
|
||||||
|
}
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class Widget;
|
class Widget;
|
||||||
|
class WidgetManager;
|
||||||
|
class Windows;
|
||||||
};
|
};
|
||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <etk/Vector.h>
|
#include <etk/Vector.h>
|
||||||
@ -34,7 +36,7 @@ namespace ewol {
|
|||||||
/*
|
/*
|
||||||
/--> m_windowsSize
|
/--> m_windowsSize
|
||||||
*--------------------------------------------------*
|
*--------------------------------------------------*
|
||||||
| |
|
| g |
|
||||||
| |
|
| |
|
||||||
| m_size |
|
| m_size |
|
||||||
| / |
|
| / |
|
||||||
@ -620,6 +622,19 @@ namespace ewol {
|
|||||||
protected: // Derived function
|
protected: // Derived function
|
||||||
virtual bool OnSetConfig(const ewol::EConfig& _conf);
|
virtual bool OnSetConfig(const ewol::EConfig& _conf);
|
||||||
virtual bool OnGetConfig(const char* _config, etk::UString& _result) const;
|
virtual bool OnGetConfig(const char* _config, etk::UString& _result) const;
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Need to be call When the size of the current widget have change ==> this force the system to recalculate all the widget positions
|
||||||
|
*/
|
||||||
|
void RequestUpdateSize(void);
|
||||||
|
/**
|
||||||
|
* @brief Get the current Widget Manager
|
||||||
|
*/
|
||||||
|
ewol::WidgetManager& GetWidgetManager(void);
|
||||||
|
/**
|
||||||
|
* @brief Get the curent Windows
|
||||||
|
*/
|
||||||
|
ewol::Windows* GetWindows(void);
|
||||||
}; // end of the class Widget declaration
|
}; // end of the class Widget declaration
|
||||||
|
|
||||||
};// end of namespace
|
};// end of namespace
|
||||||
|
@ -29,92 +29,48 @@
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "WidgetManager"
|
#define __class__ "WidgetManager"
|
||||||
|
|
||||||
static bool IsInit = false;
|
ewol::WidgetManager::WidgetManager(void) :
|
||||||
|
m_focusWidgetDefault(NULL),
|
||||||
// For the focus Management
|
m_focusWidgetCurrent(NULL),
|
||||||
static ewol::Widget * m_focusWidgetDefault = NULL;
|
m_havePeriodic(false),
|
||||||
static ewol::Widget * m_focusWidgetCurrent = NULL;
|
m_haveRedraw(true),
|
||||||
static etk::Vector<ewol::Widget*> l_listOfPeriodicWidget;
|
m_applWakeUpTime(0),
|
||||||
static bool l_havePeriodic = false;
|
m_lastPeriodicCallTime(0)
|
||||||
|
|
||||||
static bool l_haveRedraw = true;
|
|
||||||
|
|
||||||
|
|
||||||
class dataStructCreator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
etk::UString name;
|
|
||||||
ewol::widgetManager::creator_tf pointer;
|
|
||||||
};
|
|
||||||
|
|
||||||
static etk::Vector<dataStructCreator> l_creatorList;
|
|
||||||
|
|
||||||
int64_t l_applWakeUpTime = 0; //!< Time of the application initialize
|
|
||||||
int64_t l_lastPeriodicCallTime = 0; //!< last call time ...
|
|
||||||
|
|
||||||
void ewol::widgetManager::Init(void)
|
|
||||||
{
|
{
|
||||||
EWOL_DEBUG("==> Init Widget-Manager");
|
EWOL_DEBUG("==> Init Widget-Manager");
|
||||||
// set the basic time properties :
|
// set the basic time properties :
|
||||||
l_applWakeUpTime = ewol::GetTime();
|
m_applWakeUpTime = ewol::GetTime();
|
||||||
l_lastPeriodicCallTime = ewol::GetTime();
|
m_lastPeriodicCallTime = ewol::GetTime();
|
||||||
|
|
||||||
// prevent android error ==> can create memory leak but I prefer
|
widget::Button::Init(*this);
|
||||||
m_focusWidgetDefault = NULL;
|
widget::ButtonColor::Init(*this);
|
||||||
m_focusWidgetCurrent = NULL;
|
widget::Spacer::Init(*this);
|
||||||
l_creatorList.Clear();
|
widget::Slider::Init(*this);
|
||||||
l_listOfPeriodicWidget.Clear();
|
widget::Sizer::Init(*this);
|
||||||
l_havePeriodic = false;
|
widget::ProgressBar::Init(*this);
|
||||||
l_haveRedraw = true;
|
widget::Layer::Init(*this);
|
||||||
//ewol::WIDGET_SceneInit();
|
widget::Label::Init(*this);
|
||||||
widget::Button::Init();
|
widget::Image::Init(*this);
|
||||||
widget::ButtonColor::Init();
|
widget::Gird::Init(*this);
|
||||||
widget::Spacer::Init();
|
widget::Entry::Init(*this);
|
||||||
widget::Slider::Init();
|
widget::CheckBox::Init(*this);
|
||||||
widget::Sizer::Init();
|
widget::Scroll::Init(*this);
|
||||||
widget::ProgressBar::Init();
|
widget::ContextMenu::Init(*this);
|
||||||
widget::Layer::Init();
|
widget::PopUp::Init(*this);
|
||||||
widget::Label::Init();
|
|
||||||
widget::Image::Init();
|
|
||||||
widget::Gird::Init();
|
|
||||||
widget::Entry::Init();
|
|
||||||
widget::CheckBox::Init();
|
|
||||||
widget::Scroll::Init();
|
|
||||||
widget::ContextMenu::Init();
|
|
||||||
widget::PopUp::Init();
|
|
||||||
IsInit = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widgetManager::UnInit(void)
|
ewol::WidgetManager::~WidgetManager(void)
|
||||||
{
|
{
|
||||||
EWOL_DEBUG("==> Un-Init Widget-Manager");
|
EWOL_DEBUG("==> Un-Init Widget-Manager");
|
||||||
EWOL_INFO("Realease all FOCUS");
|
EWOL_INFO("Realease all FOCUS");
|
||||||
ewol::widgetManager::FocusSetDefault(NULL);
|
FocusSetDefault(NULL);
|
||||||
ewol::widgetManager::FocusRelease();
|
FocusRelease();
|
||||||
|
|
||||||
widget::PopUp::UnInit();
|
m_listOfPeriodicWidget.Clear();
|
||||||
widget::ContextMenu::UnInit();
|
m_creatorList.Clear();
|
||||||
widget::Scroll::UnInit();
|
|
||||||
widget::CheckBox::UnInit();
|
|
||||||
widget::Entry::UnInit();
|
|
||||||
widget::Gird::UnInit();
|
|
||||||
widget::Image::UnInit();
|
|
||||||
widget::Label::UnInit();
|
|
||||||
widget::Layer::UnInit();
|
|
||||||
widget::ProgressBar::UnInit();
|
|
||||||
widget::Sizer::UnInit();
|
|
||||||
widget::Slider::UnInit();
|
|
||||||
widget::Spacer::UnInit();
|
|
||||||
widget::ButtonColor::UnInit();
|
|
||||||
widget::Button::UnInit();
|
|
||||||
|
|
||||||
IsInit = false;
|
|
||||||
|
|
||||||
l_listOfPeriodicWidget.Clear();
|
|
||||||
l_creatorList.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widgetManager::Rm(ewol::Widget * newWidget)
|
void ewol::WidgetManager::Rm(ewol::Widget * newWidget)
|
||||||
{
|
{
|
||||||
PeriodicCallRm(newWidget);
|
PeriodicCallRm(newWidget);
|
||||||
FocusRemoveIfRemove(newWidget);
|
FocusRemoveIfRemove(newWidget);
|
||||||
@ -124,7 +80,7 @@ void ewol::widgetManager::Rm(ewol::Widget * newWidget)
|
|||||||
* Focus Area :
|
* Focus Area :
|
||||||
* *************************************************************************/
|
* *************************************************************************/
|
||||||
|
|
||||||
void ewol::widgetManager::FocusKeep(ewol::Widget * newWidget)
|
void ewol::WidgetManager::FocusKeep(ewol::Widget * newWidget)
|
||||||
{
|
{
|
||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
@ -150,7 +106,7 @@ 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=" << newWidget->GetId() );
|
EWOL_VERBOSE("Widget can not have Focus, id=" << newWidget->GetId() );
|
||||||
@ -171,7 +127,7 @@ void ewol::widgetManager::FocusSetDefault(ewol::Widget * newWidget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::widgetManager::FocusRelease(void)
|
void ewol::WidgetManager::FocusRelease(void)
|
||||||
{
|
{
|
||||||
if (m_focusWidgetDefault == m_focusWidgetCurrent) {
|
if (m_focusWidgetDefault == m_focusWidgetCurrent) {
|
||||||
// nothink to do ...
|
// nothink to do ...
|
||||||
@ -189,12 +145,12 @@ void ewol::widgetManager::FocusRelease(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::Widget * ewol::widgetManager::FocusGet(void)
|
ewol::Widget * ewol::WidgetManager::FocusGet(void)
|
||||||
{
|
{
|
||||||
return m_focusWidgetCurrent;
|
return m_focusWidgetCurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widgetManager::FocusRemoveIfRemove(ewol::Widget * newWidget)
|
void ewol::WidgetManager::FocusRemoveIfRemove(ewol::Widget * newWidget)
|
||||||
{
|
{
|
||||||
if (m_focusWidgetCurrent == newWidget) {
|
if (m_focusWidgetCurrent == newWidget) {
|
||||||
EWOL_WARNING("Release Focus when remove widget");
|
EWOL_WARNING("Release Focus when remove widget");
|
||||||
@ -208,60 +164,60 @@ void ewol::widgetManager::FocusRemoveIfRemove(ewol::Widget * newWidget)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ewol::widgetManager::PeriodicCallAdd(ewol::Widget * pWidget)
|
void ewol::WidgetManager::PeriodicCallAdd(ewol::Widget * pWidget)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) {
|
for (int32_t iii=0; iii < m_listOfPeriodicWidget.Size(); iii++) {
|
||||||
if (l_listOfPeriodicWidget[iii] == pWidget) {
|
if (m_listOfPeriodicWidget[iii] == pWidget) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int32_t iii=0; iii < l_listOfPeriodicWidget.Size(); iii++) {
|
for (int32_t iii=0; iii < m_listOfPeriodicWidget.Size(); iii++) {
|
||||||
if (NULL == l_listOfPeriodicWidget[iii]) {
|
if (NULL == m_listOfPeriodicWidget[iii]) {
|
||||||
l_listOfPeriodicWidget[iii] = pWidget;
|
m_listOfPeriodicWidget[iii] = pWidget;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
l_listOfPeriodicWidget.PushBack(pWidget);
|
m_listOfPeriodicWidget.PushBack(pWidget);
|
||||||
l_havePeriodic = true;
|
m_havePeriodic = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widgetManager::PeriodicCallRm(ewol::Widget * pWidget)
|
void ewol::WidgetManager::PeriodicCallRm(ewol::Widget * pWidget)
|
||||||
{
|
{
|
||||||
int32_t nbElement = 0;
|
int32_t nbElement = 0;
|
||||||
for (int32_t iii=l_listOfPeriodicWidget.Size()-1; iii>=0 ; iii--) {
|
for (int32_t iii=m_listOfPeriodicWidget.Size()-1; iii>=0 ; iii--) {
|
||||||
if (l_listOfPeriodicWidget[iii] == pWidget) {
|
if (m_listOfPeriodicWidget[iii] == pWidget) {
|
||||||
l_listOfPeriodicWidget[iii] = NULL;
|
m_listOfPeriodicWidget[iii] = NULL;
|
||||||
} else {
|
} else {
|
||||||
nbElement++;
|
nbElement++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (0 == nbElement) {
|
if (0 == nbElement) {
|
||||||
l_havePeriodic = false;
|
m_havePeriodic = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ewol::widgetManager::PeriodicCall(int64_t _localTime)
|
void ewol::WidgetManager::PeriodicCall(int64_t _localTime)
|
||||||
{
|
{
|
||||||
int64_t previousTime = l_lastPeriodicCallTime;
|
int64_t previousTime = m_lastPeriodicCallTime;
|
||||||
l_lastPeriodicCallTime = _localTime;
|
m_lastPeriodicCallTime = _localTime;
|
||||||
if (l_listOfPeriodicWidget.Size() <= 0) {
|
if (m_listOfPeriodicWidget.Size() <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float deltaTime = (float)(_localTime - previousTime)/1000000.0;
|
float deltaTime = (float)(_localTime - previousTime)/1000000.0;
|
||||||
|
|
||||||
EventTime myTime(_localTime, l_applWakeUpTime, deltaTime, deltaTime);
|
EventTime myTime(_localTime, m_applWakeUpTime, deltaTime, deltaTime);
|
||||||
|
|
||||||
EWOL_VERBOSE("periodic : " << _localTime);
|
EWOL_VERBOSE("periodic : " << _localTime);
|
||||||
for (int32_t iii=l_listOfPeriodicWidget.Size()-1; iii>=0 ; iii--) {
|
for (int32_t iii=m_listOfPeriodicWidget.Size()-1; iii>=0 ; iii--) {
|
||||||
if (NULL != l_listOfPeriodicWidget[iii]) {
|
if (NULL != m_listOfPeriodicWidget[iii]) {
|
||||||
int64_t deltaTimeCallUser = l_listOfPeriodicWidget[iii]->SystemGetCallDeltaTime();
|
int64_t deltaTimeCallUser = m_listOfPeriodicWidget[iii]->SystemGetCallDeltaTime();
|
||||||
if (deltaTimeCallUser<=0) {
|
if (deltaTimeCallUser<=0) {
|
||||||
myTime.SetDeltaCall(deltaTime);
|
myTime.SetDeltaCall(deltaTime);
|
||||||
EWOL_VERBOSE("[" << iii << "] periodic : " << myTime);
|
EWOL_VERBOSE("[" << iii << "] periodic : " << myTime);
|
||||||
l_listOfPeriodicWidget[iii]->SystemSetLastCallTime(_localTime);
|
m_listOfPeriodicWidget[iii]->SystemSetLastCallTime(_localTime);
|
||||||
l_listOfPeriodicWidget[iii]->PeriodicCall(myTime);
|
m_listOfPeriodicWidget[iii]->PeriodicCall(myTime);
|
||||||
} else {
|
} else {
|
||||||
int64_t lastCallTime = l_listOfPeriodicWidget[iii]->SystemGetLastCallTime();
|
int64_t lastCallTime = m_listOfPeriodicWidget[iii]->SystemGetLastCallTime();
|
||||||
if (lastCallTime == 0) {
|
if (lastCallTime == 0) {
|
||||||
lastCallTime = _localTime;
|
lastCallTime = _localTime;
|
||||||
}
|
}
|
||||||
@ -269,86 +225,71 @@ void ewol::widgetManager::PeriodicCall(int64_t _localTime)
|
|||||||
if (deltaLocalTime>= lastCallTime) {
|
if (deltaLocalTime>= lastCallTime) {
|
||||||
myTime.SetDeltaCall(deltaLocalTime);
|
myTime.SetDeltaCall(deltaLocalTime);
|
||||||
EWOL_VERBOSE("[" << iii << "] periodic : " << myTime);
|
EWOL_VERBOSE("[" << iii << "] periodic : " << myTime);
|
||||||
l_listOfPeriodicWidget[iii]->SystemSetLastCallTime(_localTime);
|
m_listOfPeriodicWidget[iii]->SystemSetLastCallTime(_localTime);
|
||||||
l_listOfPeriodicWidget[iii]->PeriodicCall(myTime);
|
m_listOfPeriodicWidget[iii]->PeriodicCall(myTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::widgetManager::PeriodicCallHave(void)
|
bool ewol::WidgetManager::PeriodicCallHave(void)
|
||||||
{
|
{
|
||||||
return l_havePeriodic;
|
return m_havePeriodic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ewol::widgetManager::MarkDrawingIsNeeded(void)
|
void ewol::WidgetManager::MarkDrawingIsNeeded(void)
|
||||||
{
|
{
|
||||||
l_haveRedraw = true;
|
m_haveRedraw = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::widgetManager::IsDrawingNeeded(void)
|
bool ewol::WidgetManager::IsDrawingNeeded(void)
|
||||||
{
|
{
|
||||||
bool tmp = l_haveRedraw;
|
bool tmp = m_haveRedraw;
|
||||||
l_haveRedraw = false;
|
m_haveRedraw = false;
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// element that generate the list of elements
|
// element that generate the list of elements
|
||||||
void ewol::widgetManager::AddWidgetCreator(const etk::UString& name, ewol::widgetManager::creator_tf pointer)
|
void ewol::WidgetManager::AddWidgetCreator(const etk::UString& _name, ewol::WidgetManager::creator_tf _pointer)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<l_creatorList.Size() ; iii++) {
|
if (NULL==_pointer) {
|
||||||
if (name.CompareNoCase(l_creatorList[iii].name)) {
|
|
||||||
if (NULL==pointer) {
|
|
||||||
EWOL_INFO("Remove Creator of a specify widget : " << name);
|
|
||||||
} else {
|
|
||||||
EWOL_WARNING("Replace Creator of a specify widget : " << name);
|
|
||||||
l_creatorList[iii].pointer = pointer;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (NULL==pointer) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
EWOL_INFO("Add Creator of a specify widget : " << name);
|
if (true==m_creatorList.Exist(_name)) {
|
||||||
dataStructCreator tmpStruct;
|
EWOL_WARNING("Replace Creator of a specify widget : " << _name);
|
||||||
tmpStruct.name = name;
|
m_creatorList[_name] = _pointer;
|
||||||
tmpStruct.pointer = pointer;
|
return;
|
||||||
l_creatorList.PushBack(tmpStruct);
|
}
|
||||||
|
EWOL_INFO("Add Creator of a specify widget : " << _name);
|
||||||
|
m_creatorList.Add(_name, _pointer);
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Widget* ewol::widgetManager::Create(const etk::UString& name)
|
ewol::Widget* ewol::WidgetManager::Create(const etk::UString& _name)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<l_creatorList.Size() ; iii++) {
|
if (true==m_creatorList.Exist(_name)) {
|
||||||
if (name.CompareNoCase(l_creatorList[iii].name)) {
|
ewol::WidgetManager::creator_tf pointerFunction = m_creatorList[_name];
|
||||||
if (NULL != l_creatorList[iii].pointer) {
|
if (NULL != pointerFunction) {
|
||||||
return (*l_creatorList[iii].pointer)();
|
return pointerFunction();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EWOL_WARNING("try to create an UnExistant widget : " << name);
|
EWOL_WARNING("try to create an UnExistant widget : " << _name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ewol::widgetManager::Exist(const etk::UString& name)
|
bool ewol::WidgetManager::Exist(const etk::UString& _name)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<l_creatorList.Size() ; iii++) {
|
return m_creatorList.Exist(_name);
|
||||||
if (name.CompareNoCase(l_creatorList[iii].name)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
etk::UString ewol::widgetManager::List(void)
|
etk::UString ewol::WidgetManager::List(void)
|
||||||
{
|
{
|
||||||
etk::UString tmpVal;
|
etk::UString tmpVal;
|
||||||
for (int32_t iii=0; iii<l_creatorList.Size() ; iii++) {
|
for (int32_t iii=0; iii<m_creatorList.Size() ; iii++) {
|
||||||
tmpVal += l_creatorList[iii].name;
|
tmpVal += m_creatorList.GetKey(iii);
|
||||||
tmpVal += ",";
|
tmpVal += ",";
|
||||||
}
|
}
|
||||||
return tmpVal;
|
return tmpVal;
|
||||||
|
@ -12,35 +12,50 @@
|
|||||||
#include <etk/types.h>
|
#include <etk/types.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <etk/Vector.h>
|
#include <etk/Vector.h>
|
||||||
|
#include <etk/Hach.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol
|
||||||
namespace widgetManager {
|
{
|
||||||
void Init(void);
|
class WidgetManager
|
||||||
void UnInit(void);
|
{
|
||||||
// need to call when remove a widget to clear all dependency of the focus system
|
public:
|
||||||
void Rm(ewol::Widget * newWidget);
|
typedef ewol::Widget* (*creator_tf)(void);
|
||||||
|
private:
|
||||||
void FocusKeep(ewol::Widget * newWidget); // set the focus at the specific widget
|
// For the focus Management
|
||||||
void FocusSetDefault(ewol::Widget * newWidget); // select the default focus getter
|
ewol::Widget * m_focusWidgetDefault;
|
||||||
void FocusRelease(void); // Release focus from the current widget to the default
|
ewol::Widget * m_focusWidgetCurrent;
|
||||||
ewol::Widget* FocusGet(void);
|
etk::Vector<ewol::Widget*> m_listOfPeriodicWidget;
|
||||||
void FocusRemoveIfRemove(ewol::Widget * newWidget);
|
bool m_havePeriodic;
|
||||||
|
bool m_haveRedraw;
|
||||||
void PeriodicCallAdd(ewol::Widget* pWidget);
|
etk::Hash<creator_tf> m_creatorList;
|
||||||
void PeriodicCallRm(ewol::Widget* pWidget);
|
int64_t m_applWakeUpTime; //!< Time of the application initialize
|
||||||
void PeriodicCall(int64_t localTime);
|
int64_t m_lastPeriodicCallTime; //!< last call time ...
|
||||||
bool PeriodicCallHave(void);
|
public:
|
||||||
|
WidgetManager(void);
|
||||||
void MarkDrawingIsNeeded(void);
|
~WidgetManager(void);
|
||||||
bool IsDrawingNeeded(void);
|
// need to call when remove a widget to clear all dependency of the focus system
|
||||||
|
void Rm(ewol::Widget * newWidget);
|
||||||
typedef ewol::Widget* (*creator_tf)(void);
|
|
||||||
// element that generate the list of elements
|
void FocusKeep(ewol::Widget * newWidget); // set the focus at the specific widget
|
||||||
void AddWidgetCreator(const etk::UString& name, creator_tf pointer);
|
void FocusSetDefault(ewol::Widget * newWidget); // select the default focus getter
|
||||||
ewol::Widget* Create(const etk::UString& name);
|
void FocusRelease(void); // Release focus from the current widget to the default
|
||||||
bool Exist(const etk::UString& name);
|
ewol::Widget* FocusGet(void);
|
||||||
etk::UString List(void);
|
void FocusRemoveIfRemove(ewol::Widget * newWidget);
|
||||||
|
|
||||||
|
void PeriodicCallAdd(ewol::Widget* pWidget);
|
||||||
|
void PeriodicCallRm(ewol::Widget* pWidget);
|
||||||
|
void PeriodicCall(int64_t localTime);
|
||||||
|
bool PeriodicCallHave(void);
|
||||||
|
|
||||||
|
void MarkDrawingIsNeeded(void);
|
||||||
|
bool IsDrawingNeeded(void);
|
||||||
|
|
||||||
|
// element that generate the list of elements
|
||||||
|
void AddWidgetCreator(const etk::UString& _name, creator_tf _pointer);
|
||||||
|
ewol::Widget* Create(const etk::UString& _name);
|
||||||
|
bool Exist(const etk::UString& _name);
|
||||||
|
etk::UString List(void);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
|
|||||||
// Regenerate the size calculation :
|
// Regenerate the size calculation :
|
||||||
CalculateSize(m_size);
|
CalculateSize(m_size);
|
||||||
// TODO : it is dansgerous to access directly to the system ...
|
// TODO : it is dansgerous to access directly to the system ...
|
||||||
eSystem::ResetIOEvent();
|
GetSystem().ResetIOEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -236,3 +236,10 @@ void ewol::Windows::SetBackgroundColor(const etk::Color<float>& _color)
|
|||||||
MarkToRedraw();
|
MarkToRedraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::Windows::SetTitle(const etk::UString& _title)
|
||||||
|
{
|
||||||
|
// TODO : Remove this ...
|
||||||
|
etk::UString title = _title;
|
||||||
|
GetSystem().SetTitle(title);
|
||||||
|
}
|
||||||
|
@ -72,6 +72,7 @@ namespace ewol {
|
|||||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||||
virtual void CalculateSize(const vec2& availlable);
|
virtual void CalculateSize(const vec2& availlable);
|
||||||
virtual ewol::Widget * GetWidgetAtPos(const vec2& pos);
|
virtual ewol::Widget * GetWidgetAtPos(const vec2& pos);
|
||||||
|
void SetTitle(const etk::UString& _title);
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -187,7 +187,7 @@ void widget::ParameterList::OnRegenerateDisplay(void)
|
|||||||
bool widget::ParameterList::OnEventInput(const ewol::EventInput& _event)
|
bool widget::ParameterList::OnEventInput(const ewol::EventInput& _event)
|
||||||
{
|
{
|
||||||
if (true == WidgetScrooled::OnEventInput(_event)) {
|
if (true == WidgetScrooled::OnEventInput(_event)) {
|
||||||
ewol::widgetManager::FocusKeep(this);
|
KeepFocus();
|
||||||
// nothing to do ... done on upper widet ...
|
// nothing to do ... done on upper widet ...
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,8 @@ def Create(target):
|
|||||||
'ewol/eObject/EConfig.cpp',
|
'ewol/eObject/EConfig.cpp',
|
||||||
'ewol/eObject/EMessage.cpp',
|
'ewol/eObject/EMessage.cpp',
|
||||||
'ewol/eObject/EObject.cpp',
|
'ewol/eObject/EObject.cpp',
|
||||||
'ewol/eObject/EObjectManager.cpp'])
|
'ewol/eObject/EObjectManager.cpp',
|
||||||
|
'ewol/eObject/EObjectMessageMultiCast.cpp'])
|
||||||
|
|
||||||
#openGl Basic access abstraction (for the model matrix and include
|
#openGl Basic access abstraction (for the model matrix and include
|
||||||
myModule.AddSrcFile([
|
myModule.AddSrcFile([
|
||||||
@ -42,7 +43,7 @@ def Create(target):
|
|||||||
myModule.AddSrcFile([
|
myModule.AddSrcFile([
|
||||||
'ewol/renderer/os/eSystem.cpp',
|
'ewol/renderer/os/eSystem.cpp',
|
||||||
'ewol/renderer/os/eSystemInput.cpp'])
|
'ewol/renderer/os/eSystemInput.cpp'])
|
||||||
"""
|
|
||||||
# renderer :
|
# renderer :
|
||||||
myModule.AddSrcFile([
|
myModule.AddSrcFile([
|
||||||
'ewol/renderer/resources/Shader.cpp',
|
'ewol/renderer/resources/Shader.cpp',
|
||||||
@ -117,12 +118,6 @@ def Create(target):
|
|||||||
'ewol/widget/meta/Parameter.cpp',
|
'ewol/widget/meta/Parameter.cpp',
|
||||||
'ewol/widget/meta/ParameterList.cpp'])
|
'ewol/widget/meta/ParameterList.cpp'])
|
||||||
|
|
||||||
# game mode area :
|
|
||||||
myModule.AddSrcFile([
|
|
||||||
'ewol/widget/Scene.cpp',
|
|
||||||
'ewol/game/Camera.cpp'])
|
|
||||||
"""
|
|
||||||
|
|
||||||
myModule.CopyFolder('../data/theme/default/widgetEntry.*','theme/default')
|
myModule.CopyFolder('../data/theme/default/widgetEntry.*','theme/default')
|
||||||
myModule.CopyFolder('../data/theme/rounded/widgetEntry.*','theme/rounded')
|
myModule.CopyFolder('../data/theme/rounded/widgetEntry.*','theme/rounded')
|
||||||
myModule.CopyFolder('../data/theme/default/widgetButton.*','theme/default')
|
myModule.CopyFolder('../data/theme/default/widgetButton.*','theme/default')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user