Rework of EWOL (Step 3)
This commit is contained in:
parent
187aaa2101
commit
8326ac2dfc
@ -28,7 +28,7 @@
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::EObjectMessageMultiCast"
|
||||
#define __class__ "EObjectMessageMultiCast"
|
||||
|
||||
extern "C" {
|
||||
typedef struct {
|
||||
@ -81,7 +81,7 @@ static void MultiCastRm(ewol::EObject* object)
|
||||
return;
|
||||
}
|
||||
// send the message at all registered widget ...
|
||||
for (int32_t iii=m_messageList.Size(); iii>=0; iii--) {
|
||||
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;
|
||||
@ -195,25 +195,13 @@ void ewol::EObject::GenerateEventId(const char * generateEventId)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generate Multicast event on all EObject requested the event
|
||||
* @param[in] messageId Event Id that is generated
|
||||
* @param[in] data Interger which is transform in etk::UString
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::EObject::SendMultiCast(const char* const messageId, int32_t data)
|
||||
{
|
||||
etk::UString tmpData(data);
|
||||
MultiCastSend(this, messageId, tmpData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Generate Multicast event on all EObject requested the event
|
||||
* @param[in] messageId Event Id that is generated
|
||||
* @param[in] data String that is send at all the destinations
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::EObject::SendMultiCast(const char* const messageId, etk::UString& data)
|
||||
void ewol::EObject::SendMultiCast(const char* const messageId, etk::UString data)
|
||||
{
|
||||
MultiCastSend(this, messageId, data);
|
||||
}
|
||||
@ -270,14 +258,11 @@ void ewol::EObject::RegisterOnEvent(ewol::EObject * destinationObject, const cha
|
||||
*/
|
||||
void ewol::EObject::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
int32_t iii = m_externEvent.Size()-1;
|
||||
while(iii>=0) {
|
||||
for(int32_t iii=m_externEvent.Size()-1; iii>=0; iii--) {
|
||||
if (NULL==m_externEvent[iii]) {
|
||||
m_externEvent.Erase(iii);
|
||||
} else if (m_externEvent[iii]->destEObject == removeObject) {
|
||||
m_externEvent.Erase(iii);
|
||||
} else {
|
||||
iii--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ namespace ewol {
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
~EObject(void);
|
||||
virtual ~EObject(void);
|
||||
|
||||
/**
|
||||
* @brief Get the UniqueId of the EObject
|
||||
@ -93,21 +93,14 @@ namespace ewol {
|
||||
*/
|
||||
void GenerateEventId(const char * generateEventId);
|
||||
|
||||
/**
|
||||
* @brief Generate Multicast event on all EObject requested the event
|
||||
* @param[in] messageId Event Id that is generated
|
||||
* @param[in] data Interger which is transform in etk::UString
|
||||
* @return ---
|
||||
*/
|
||||
void SendMultiCast(const char* const messageId, int32_t data);
|
||||
|
||||
/**
|
||||
* @brief Generate Multicast event on all EObject requested the event
|
||||
* @param[in] messageId Event Id that is generated
|
||||
* @param[in] data String that is send at all the destinations
|
||||
* @return ---
|
||||
*/
|
||||
void SendMultiCast(const char* const messageId, etk::UString& data);
|
||||
//void SendMultiCast(const char* const messageId, etk::UString& data);
|
||||
void SendMultiCast(const char* const messageId, etk::UString data = "");
|
||||
|
||||
/**
|
||||
* @brief Register of the arrival of a Multicast message
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <ewol/EObjectManager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::EObjectManager"
|
||||
#define __class__ "EObjectManager"
|
||||
|
||||
static bool IsInit = false;
|
||||
|
||||
@ -47,9 +47,10 @@ void ewol::EObjectManager::Init(void)
|
||||
void ewol::EObjectManager::UnInit(void)
|
||||
{
|
||||
EWOL_DEBUG("==> Un-Init EObject-Manager");
|
||||
|
||||
ewol::EObjectManager::RemoveAllMark();
|
||||
|
||||
// Some call to permit to remove all the needed stack of EObject
|
||||
for(int32_t iii=0; iii<128 ; iii++) {
|
||||
ewol::EObjectManager::RemoveAllMark();
|
||||
}
|
||||
EWOL_INFO(" Remove missing user widget");
|
||||
while(0<m_eObjectList.Size()) {
|
||||
if (m_eObjectList[0]!=NULL) {
|
||||
|
@ -73,7 +73,7 @@ char* ewol::GetCharTypeMoveEvent(eventKbMoveType_te type)
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::Widget"
|
||||
#define __class__ "Widget"
|
||||
|
||||
ewol::Widget::Widget(void)
|
||||
{
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include <ewol/WidgetManager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::WidgetManager"
|
||||
#define __class__ "WidgetManager"
|
||||
|
||||
static pthread_mutex_t localMutex;
|
||||
static bool IsInit = false;
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::Windows"
|
||||
#define __class__ "Windows"
|
||||
|
||||
|
||||
//list of local events :
|
||||
@ -226,17 +226,6 @@ void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
|
||||
|
||||
bool ewol::Windows::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
if(ewolEventWindowsHideKeyboard == generateEventId) {
|
||||
EWOL_INFO("Request Hide keyboard");
|
||||
KeyboardHide();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ewol::Windows::KeyboardShow(ewol::keyboardMode_te mode)
|
||||
{
|
||||
#if defined(__PLATFORM__Android)
|
||||
@ -300,22 +289,25 @@ void ewol::Windows::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
// second strep find if in alll the elements ...
|
||||
// second step find if in all the elements ...
|
||||
|
||||
if (m_subWidget[m_currentCreateId] == removeObject) {
|
||||
EWOL_DEBUG("Remove main element of the windows ==> destroyed object");
|
||||
m_subWidget[m_currentCreateId] = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
for(int32_t iii=m_popUpWidgetList[m_currentCreateId].Size(); iii>=0; iii--) {
|
||||
for(int32_t iii=m_popUpWidgetList[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
||||
if(m_popUpWidgetList[m_currentCreateId][iii] == removeObject) {
|
||||
EWOL_DEBUG("Remove Pop-up [" << iii << "] element of the windows ==> destroyed object");
|
||||
m_popUpWidgetList[m_currentCreateId][iii] = NULL;
|
||||
m_popUpWidgetList[m_currentCreateId].Erase(iii);
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
if (m_keyBoardwidget == removeObject) {
|
||||
EWOL_DEBUG("Remove Keyboard element of the windows ==> destroyed object");
|
||||
m_keyBoardwidget = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,6 @@ namespace ewol {
|
||||
public:
|
||||
virtual bool CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY);
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos);
|
||||
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
||||
private:
|
||||
bool m_hasDecoration;
|
||||
public:
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <ewol/base/MainThread.h>
|
||||
#include <ewol/base/gui.h>
|
||||
#include <ewol/Texture.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/EObjectManager.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/themeManager.h>
|
||||
#include <ewol/ShortCutManager.h>
|
||||
@ -103,6 +105,7 @@ static void* BaseAppEntry(void* param)
|
||||
EWOL_INFO("Child Thread Up PL" << policy << " PRI" << pr.sched_priority); //The result Set
|
||||
*/
|
||||
|
||||
ewol::EObjectManager::Init();
|
||||
ewol::EObjectMessageMultiCast::Init();
|
||||
ewol::widgetManager::Init();
|
||||
ewol::texture::Init();
|
||||
@ -197,6 +200,7 @@ static void* BaseAppEntry(void* param)
|
||||
ewol::UnInitFont();
|
||||
ewol::widgetManager::UnInit();
|
||||
ewol::EObjectMessageMultiCast::UnInit();
|
||||
ewol::EObjectManager::UnInit();
|
||||
ewol::theme::UnInit();
|
||||
EWOL_DEBUG("==> Un-Init BThread (END)");
|
||||
pthread_exit(NULL);
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
#include <ewol/Debug.h>
|
||||
#include <etk/UString.h>
|
||||
#include <ewol/EObject.h>
|
||||
#include <ewol/EObjectManager.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
#include <ewol/base/gui.h>
|
||||
#include <ewol/ewol.h>
|
||||
@ -71,11 +73,18 @@ void EWOL_NativeRegenerateDisplay(void)
|
||||
{
|
||||
//EWOL_INFO("Resize w=" << w << " h=" << h);
|
||||
if (NULL != gui_uniqueWindows) {
|
||||
// Redraw all needed elements
|
||||
gui_uniqueWindows->OnRegenerateDisplay();
|
||||
// Keep Inter-thread-lock-mutex
|
||||
ewol::widgetManager::DoubleBufferLock();
|
||||
// flip-flop all needed double-buffer in all widget
|
||||
gui_uniqueWindows->OnFlipFlopEvent();
|
||||
// Inform the main thread of openGl draw that somthing to display
|
||||
ewol::widgetManager::SetDoubleBufferNeedDraw();
|
||||
// Release Inter-thread-lock-mutex
|
||||
ewol::widgetManager::DoubleBufferUnLock();
|
||||
// Remove deprecated widget (which have no more reference in the system)
|
||||
ewol::EObjectManager::RemoveAllMark();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ extern const char * const ewolEventButtonLeave = "ewol Button Leave";
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::Button"
|
||||
#define __class__ "Button"
|
||||
|
||||
|
||||
void ewol::Button::Init(void)
|
||||
|
@ -32,7 +32,7 @@
|
||||
extern const char * const ewolEventCheckBoxClicked = "ewol CheckBox Clicked";
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::CheckBox"
|
||||
#define __class__ "CheckBox"
|
||||
|
||||
|
||||
void ewol::CheckBox::Init(void)
|
||||
|
@ -186,7 +186,7 @@ void ewol::ContextMenu::SubWidgetRemove(void)
|
||||
|
||||
bool ewol::ContextMenu::OnDraw(void)
|
||||
{
|
||||
EWOL_DEBUG("On Draw " << m_currentDrawId);
|
||||
//EWOL_DEBUG("On Draw " << m_currentDrawId);
|
||||
ewol::Drawable::OnDraw();
|
||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||
m_subWidget[m_currentDrawId]->GenDraw();
|
||||
@ -283,7 +283,7 @@ void ewol::ContextMenu::SetPositionMark(markPosition_te position, coord2D_ts arr
|
||||
|
||||
void ewol::ContextMenu::OnFlipFlopEvent(void)
|
||||
{
|
||||
EWOL_DEBUG("Flip-Flop");
|
||||
//EWOL_DEBUG("Flip-Flop");
|
||||
bool needFlipFlop = m_needFlipFlop;
|
||||
// call herited classes
|
||||
ewol::Drawable::OnFlipFlopEvent();
|
||||
|
@ -37,7 +37,7 @@ extern const char * const ewolEventEntryModify = "ewol-Entry-Modify";
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::Entry"
|
||||
#define __class__ "Entry"
|
||||
|
||||
|
||||
void ewol::Entry::Init(void)
|
||||
|
@ -33,7 +33,7 @@ extern const char * const ewolEventLabelPressed = "ewol Label Pressed";
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::Label"
|
||||
#define __class__ "Label"
|
||||
|
||||
|
||||
void ewol::Label::Init(void)
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include <ewol/WidgetManager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::List"
|
||||
#define __class__ "List"
|
||||
|
||||
|
||||
void ewol::List::Init(void)
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::Menu"
|
||||
#define __class__ "Menu"
|
||||
|
||||
ewol::Menu::Menu(void)
|
||||
{
|
||||
@ -139,11 +139,10 @@ void ewol::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eve
|
||||
EWOL_DEBUG("Menu ==> Generate Event");
|
||||
// Send a multicast event ...
|
||||
SendMultiCast(m_listElement[iii]->m_generateEvent, m_listElement[iii]->m_message);
|
||||
/*
|
||||
if (NULL != m_widgetContextMenu) {
|
||||
EWOL_DEBUG("Mark the menu to remove ...");
|
||||
m_widgetContextMenu->MarkToRemove();
|
||||
}
|
||||
*/
|
||||
m_widgetContextMenu = NULL;
|
||||
return;
|
||||
} else{
|
||||
|
@ -28,7 +28,7 @@
|
||||
#include <ewol/WidgetManager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::PopUp"
|
||||
#define __class__ "PopUp"
|
||||
|
||||
ewol::PopUp::PopUp(void)
|
||||
{
|
||||
@ -54,7 +54,6 @@ ewol::PopUp::~PopUp(void)
|
||||
|
||||
bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
||||
{
|
||||
/*
|
||||
//EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
||||
// pop-up fill all the display :
|
||||
m_size.x = availlableX;
|
||||
@ -85,14 +84,12 @@ bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
||||
m_subWidget[m_currentCreateId]->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
}
|
||||
MarkToReedraw();
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ewol::PopUp::CalculateMinSize(void)
|
||||
{
|
||||
/*
|
||||
//EWOL_DEBUG("CalculateMinSize");
|
||||
m_userExpendX=false;
|
||||
m_userExpendY=false;
|
||||
@ -106,7 +103,6 @@ bool ewol::PopUp::CalculateMinSize(void)
|
||||
}
|
||||
//EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
||||
MarkToReedraw();
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -128,42 +124,39 @@ void ewol::PopUp::SetExpendY(bool newExpend)
|
||||
|
||||
void ewol::PopUp::SubWidgetSet(ewol::Widget* newWidget)
|
||||
{
|
||||
/*
|
||||
if (NULL == newWidget) {
|
||||
return;
|
||||
}
|
||||
SubWidgetRemove();
|
||||
m_subWidget[m_currentCreateId] = newWidget;
|
||||
newWidget->SetParrent(this);
|
||||
*/
|
||||
m_needFlipFlop = true;
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
|
||||
void ewol::PopUp::SubWidgetRemove(void)
|
||||
{
|
||||
/*
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[m_currentCreateId]);
|
||||
m_subWidget[m_currentCreateId]->MarkToRemove();;
|
||||
m_subWidget[m_currentCreateId] = NULL;
|
||||
}
|
||||
*/
|
||||
m_needFlipFlop = true;
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
bool ewol::PopUp::OnDraw(void)
|
||||
{
|
||||
/*
|
||||
// draw upper classes
|
||||
ewol::Drawable::OnDraw();
|
||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||
m_subWidget[m_currentDrawId]->GenDraw();
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::PopUp::OnRegenerateDisplay(void)
|
||||
{
|
||||
/*
|
||||
if (true == NeedRedraw()) {
|
||||
}
|
||||
// generate a white background and take gray on other surfaces
|
||||
@ -183,13 +176,11 @@ void ewol::PopUp::OnRegenerateDisplay(void)
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->OnRegenerateDisplay();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
bool ewol::PopUp::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos)
|
||||
{
|
||||
/*
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetSize();
|
||||
coord2D_ts tmpOrigin = m_subWidget[m_currentCreateId]->GetOrigin();
|
||||
@ -200,18 +191,14 @@ bool ewol::PopUp::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eve
|
||||
} else {
|
||||
//EWOL_INFO("Event ouside the Pop-up");
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::PopUp::SetDisplayRatio(etkFloat_t ratio)
|
||||
{
|
||||
/*
|
||||
m_displayRatio = ratio;
|
||||
*/
|
||||
}
|
||||
|
||||
void ewol::PopUp::OnFlipFlopEvent(void)
|
||||
@ -228,3 +215,22 @@ void ewol::PopUp::OnFlipFlopEvent(void)
|
||||
m_subWidget[m_currentDrawId]->OnFlipFlopEvent();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::PopUp::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::Drawable::OnObjectRemove(removeObject);
|
||||
// second step find if in all the elements ...
|
||||
if(m_subWidget[m_currentCreateId] == removeObject) {
|
||||
EWOL_DEBUG("Remove pop-up sub Element ==> destroyed object");
|
||||
m_subWidget[m_currentCreateId] = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,13 @@ namespace ewol {
|
||||
public:
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos);
|
||||
virtual void OnFlipFlopEvent(void);
|
||||
/**
|
||||
* @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
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -268,3 +268,29 @@ void ewol::SizerHori::OnFlipFlopEvent(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::SizerHori::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
// second step find if in all the elements ...
|
||||
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
||||
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
||||
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -58,6 +58,13 @@ namespace ewol {
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos);
|
||||
virtual void OnFlipFlopEvent(void);
|
||||
/**
|
||||
* @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
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::SizerVert"
|
||||
#define __class__ "SizerVert"
|
||||
|
||||
|
||||
ewol::SizerVert::SizerVert(void)
|
||||
@ -267,3 +267,25 @@ void ewol::SizerVert::OnFlipFlopEvent(void)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::SizerVert::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::Widget::OnObjectRemove(removeObject);
|
||||
// second step find if in all the elements ...
|
||||
for(int32_t iii=m_subWidget[m_currentCreateId].Size()-1; iii>=0; iii--) {
|
||||
if(m_subWidget[m_currentCreateId][iii] == removeObject) {
|
||||
EWOL_DEBUG("Remove sizer sub Element [" << iii << "] ==> destroyed object");
|
||||
m_subWidget[m_currentCreateId][iii] = NULL;
|
||||
m_subWidget[m_currentCreateId].Erase(iii);
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,6 +59,13 @@ namespace ewol {
|
||||
public:
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos);
|
||||
virtual void OnFlipFlopEvent(void);
|
||||
/**
|
||||
* @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
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::Spacer"
|
||||
#define __class__ "Spacer"
|
||||
|
||||
|
||||
ewol::Spacer::Spacer(void)
|
||||
|
@ -23,14 +23,10 @@
|
||||
*/
|
||||
|
||||
#include <ewol/widgetMeta/FileChooser.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
//#include <etk/Vector.h>
|
||||
#include <etk/VectorType.h>
|
||||
@ -41,7 +37,7 @@ extern "C" {
|
||||
}
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::FileChooser(FolderList)"
|
||||
#define __class__ "FileChooser(FolderList)"
|
||||
|
||||
|
||||
#include <ewol/ewol.h>
|
||||
@ -195,7 +191,7 @@ class FileChooserFolderList : public ewol::List
|
||||
};
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::FileChooser(FileList)"
|
||||
#define __class__ "FileChooser(FileList)"
|
||||
|
||||
const char * const ewolEventFileChooserSelectFile = "ewol-event-file-chooser-Select-File";
|
||||
const char * const ewolEventFileChooserValidateFile = "ewol-event-file-chooser-Validate-File";
|
||||
@ -332,7 +328,7 @@ class FileChooserFileList : public ewol::List
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "ewol::FileChooser"
|
||||
#define __class__ "FileChooser"
|
||||
|
||||
|
||||
extern const char * const ewolEventFileChooserCancel = "ewol-event-file-chooser-cancel";
|
||||
@ -344,29 +340,26 @@ extern const char * const ewolEventFileChooserEntryFile = "ewol-event-file
|
||||
|
||||
ewol::FileChooser::FileChooser(void)
|
||||
{
|
||||
/*
|
||||
AddEventId(ewolEventFileChooserCancel);
|
||||
AddEventId(ewolEventFileChooserValidate);
|
||||
|
||||
m_widgetTitleId = -1;
|
||||
m_widgetValidateId = -1;
|
||||
m_widgetCancelId = -1;
|
||||
m_widgetCurrentFolderId = -1;
|
||||
m_widgetCurrentFileNameId = -1;
|
||||
m_widgetListFolderId = -1;
|
||||
m_widgetListFileId = -1;
|
||||
m_widgetCheckBoxId = -1;
|
||||
m_hasSelectedFile = false;
|
||||
|
||||
m_widgetTitle = NULL;
|
||||
m_widgetValidate = NULL;
|
||||
m_widgetCancel = NULL;
|
||||
m_widgetCurrentFolder = NULL;
|
||||
m_widgetCurrentFileName = NULL;
|
||||
m_widgetListFolder = NULL;
|
||||
m_widgetListFile = NULL;
|
||||
m_widgetCheckBox = NULL;
|
||||
|
||||
ewol::SizerVert * mySizerVert = NULL;
|
||||
ewol::SizerHori * mySizerHori = NULL;
|
||||
ewol::Button * myButton = NULL;
|
||||
ewol::Entry * myEntry = NULL;
|
||||
ewol::Spacer * mySpacer = NULL;
|
||||
FileChooserFileList * myListFile = NULL;
|
||||
FileChooserFolderList * myListFolder = NULL;
|
||||
ewol::Label * myLabel = NULL;
|
||||
ewol::CheckBox * myCheckBox = NULL;
|
||||
#ifdef __PLATFORM__Android
|
||||
m_folder = "/mnt/sdcard/";
|
||||
SetDisplayRatio(0.90);
|
||||
@ -381,35 +374,32 @@ ewol::FileChooser::FileChooser(void)
|
||||
// set it in the pop-up-system :
|
||||
SubWidgetSet(mySizerVert);
|
||||
|
||||
myLabel = new ewol::Label("File chooser ...");
|
||||
m_widgetTitleId = myLabel->GetWidgetId();
|
||||
mySizerVert->SubWidgetAdd(myLabel);
|
||||
m_widgetTitle = new ewol::Label("File chooser ...");
|
||||
mySizerVert->SubWidgetAdd(m_widgetTitle);
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
myLabel = new ewol::Label("Folder : ");
|
||||
myLabel->SetFillY(true);
|
||||
mySizerHori->SubWidgetAdd(myLabel);
|
||||
myEntry = new ewol::Entry(m_folder);
|
||||
m_widgetCurrentFolderId = myEntry->GetWidgetId();
|
||||
myEntry->ExternLinkOnEvent(ewolEventEntryModify, GetWidgetId(), ewolEventFileChooserEntryFolder);
|
||||
myEntry->SetExpendX(true);
|
||||
myEntry->SetFillX(true);
|
||||
myEntry->SetWidth(200);
|
||||
mySizerHori->SubWidgetAdd(myEntry);
|
||||
m_widgetCurrentFolder = new ewol::Entry(m_folder);
|
||||
m_widgetCurrentFolder->RegisterOnEvent(this, ewolEventEntryModify, ewolEventFileChooserEntryFolder);
|
||||
m_widgetCurrentFolder->SetExpendX(true);
|
||||
m_widgetCurrentFolder->SetFillX(true);
|
||||
m_widgetCurrentFolder->SetWidth(200);
|
||||
mySizerHori->SubWidgetAdd(m_widgetCurrentFolder);
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
myLabel = new ewol::Label("File Name : ");
|
||||
myLabel->SetFillY(true);
|
||||
mySizerHori->SubWidgetAdd(myLabel);
|
||||
myEntry = new ewol::Entry(m_file);
|
||||
m_widgetCurrentFileNameId = myEntry->GetWidgetId();
|
||||
myEntry->ExternLinkOnEvent(ewolEventEntryModify, GetWidgetId(), ewolEventFileChooserEntryFile);
|
||||
myEntry->SetExpendX(true);
|
||||
myEntry->SetFillX(true);
|
||||
myEntry->SetWidth(200);
|
||||
mySizerHori->SubWidgetAdd(myEntry);
|
||||
m_widgetCurrentFileName = new ewol::Entry(m_file);
|
||||
m_widgetCurrentFileName->RegisterOnEvent(this, ewolEventEntryModify, ewolEventFileChooserEntryFile);
|
||||
m_widgetCurrentFileName->SetExpendX(true);
|
||||
m_widgetCurrentFileName->SetFillX(true);
|
||||
m_widgetCurrentFileName->SetWidth(200);
|
||||
mySizerHori->SubWidgetAdd(m_widgetCurrentFileName);
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
@ -417,8 +407,8 @@ ewol::FileChooser::FileChooser(void)
|
||||
mySpacer->SetSize(2);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
myListFolder = new FileChooserFolderList();
|
||||
m_widgetListFolderId = myListFolder->GetWidgetId();
|
||||
myListFolder->ExternLinkOnEvent(ewolEventFileChooserSelectFolder, GetWidgetId(), ewolEventFileChooserSelectFolder);
|
||||
m_widgetListFolder = myListFolder;
|
||||
myListFolder->RegisterOnEvent(this, ewolEventFileChooserSelectFolder, ewolEventFileChooserSelectFolder);
|
||||
myListFolder->SetExpendY(true);
|
||||
myListFolder->SetFillY(true);
|
||||
mySizerHori->SubWidgetAdd(myListFolder);
|
||||
@ -426,9 +416,9 @@ ewol::FileChooser::FileChooser(void)
|
||||
mySpacer->SetSize(2);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
myListFile = new FileChooserFileList();
|
||||
m_widgetListFileId = myListFile->GetWidgetId();
|
||||
myListFile->ExternLinkOnEvent(ewolEventFileChooserSelectFile, GetWidgetId(), ewolEventFileChooserSelectFile);
|
||||
myListFile->ExternLinkOnEvent(ewolEventFileChooserValidateFile, GetWidgetId(), ewolEventFileChooserValidateFile);
|
||||
m_widgetListFile = myListFile;
|
||||
myListFile->RegisterOnEvent(this, ewolEventFileChooserSelectFile, ewolEventFileChooserSelectFile);
|
||||
myListFile->RegisterOnEvent(this, ewolEventFileChooserValidateFile, ewolEventFileChooserValidateFile);
|
||||
myListFile->SetExpendX(true);
|
||||
myListFile->SetFillX(true);
|
||||
myListFile->SetExpendY(true);
|
||||
@ -440,26 +430,22 @@ ewol::FileChooser::FileChooser(void)
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
myCheckBox = new ewol::CheckBox("Show hiden files");
|
||||
m_widgetCheckBoxId = myCheckBox->GetWidgetId();
|
||||
myCheckBox->ExternLinkOnEvent(ewolEventCheckBoxClicked, GetWidgetId(), ewolEventFileChooserHidenFileChange);
|
||||
myCheckBox->SetValue(false);
|
||||
mySizerHori->SubWidgetAdd(myCheckBox);
|
||||
m_widgetCheckBox = new ewol::CheckBox("Show hiden files");
|
||||
m_widgetCheckBox->RegisterOnEvent(this, ewolEventCheckBoxClicked, ewolEventFileChooserHidenFileChange);
|
||||
m_widgetCheckBox->SetValue(false);
|
||||
mySizerHori->SubWidgetAdd(m_widgetCheckBox);
|
||||
mySpacer = new ewol::Spacer();
|
||||
mySpacer->SetExpendX(true);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
myButton = new ewol::Button("Open");
|
||||
m_widgetValidateId = myButton->GetWidgetId();
|
||||
myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ewolEventFileChooserValidate);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
myButton = new ewol::Button("Cancel");
|
||||
m_widgetCancelId = myButton->GetWidgetId();
|
||||
myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ewolEventFileChooserCancel);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
m_widgetValidate = new ewol::Button("Open");
|
||||
m_widgetCheckBox->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventFileChooserValidate);
|
||||
mySizerHori->SubWidgetAdd(m_widgetValidate);
|
||||
m_widgetCancel = new ewol::Button("Cancel");
|
||||
m_widgetCheckBox->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventFileChooserCancel);
|
||||
mySizerHori->SubWidgetAdd(m_widgetCancel);
|
||||
|
||||
// set the default Folder properties:
|
||||
UpdateCurrentFolder();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
@ -471,87 +457,77 @@ ewol::FileChooser::~FileChooser(void)
|
||||
|
||||
void ewol::FileChooser::SetTitle(etk::UString label)
|
||||
{
|
||||
/*
|
||||
ewol::Label * tmpWidget = static_cast<ewol::Label*>(ewol::widgetManager::Get(m_widgetTitleId));
|
||||
if (NULL == tmpWidget) {
|
||||
if (NULL == m_widgetTitle) {
|
||||
return;
|
||||
}
|
||||
tmpWidget->SetLabel(label);
|
||||
*/
|
||||
m_widgetTitle->SetLabel(label);
|
||||
}
|
||||
|
||||
void ewol::FileChooser::SetValidateLabel(etk::UString label)
|
||||
{
|
||||
/*
|
||||
ewol::Button * tmpWidget = static_cast<ewol::Button*>(ewol::widgetManager::Get(m_widgetValidateId));
|
||||
if (NULL == tmpWidget) {
|
||||
if (NULL == m_widgetValidate) {
|
||||
return;
|
||||
}
|
||||
tmpWidget->SetLabel(label);
|
||||
*/
|
||||
m_widgetValidate->SetLabel(label);
|
||||
}
|
||||
|
||||
void ewol::FileChooser::SetCancelLabel(etk::UString label)
|
||||
{
|
||||
/*
|
||||
ewol::Button * tmpWidget = static_cast<ewol::Button*>(ewol::widgetManager::Get(m_widgetCancelId));
|
||||
if (NULL == tmpWidget) {
|
||||
if (NULL == m_widgetCancel) {
|
||||
return;
|
||||
}
|
||||
tmpWidget->SetLabel(label);
|
||||
*/
|
||||
m_widgetCancel->SetLabel(label);
|
||||
}
|
||||
|
||||
void ewol::FileChooser::SetFolder(etk::UString folder)
|
||||
{
|
||||
/*
|
||||
m_folder = folder;
|
||||
UpdateCurrentFolder();
|
||||
*/
|
||||
}
|
||||
|
||||
void ewol::FileChooser::SetFileName(etk::UString filename)
|
||||
{
|
||||
/*
|
||||
m_file = filename;
|
||||
ewol::Entry * tmpWidget = static_cast<ewol::Entry*>(ewol::widgetManager::Get(m_widgetCurrentFileNameId));
|
||||
if (NULL == tmpWidget) {
|
||||
if (NULL == m_widgetCurrentFileName) {
|
||||
return;
|
||||
}
|
||||
tmpWidget->SetValue(filename);
|
||||
*/
|
||||
m_widgetCurrentFileName->SetValue(filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
||||
/**
|
||||
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||
* @param[in] CallerObject Pointer on the EObject that information came from
|
||||
* @param[in] eventId Message registered by this class
|
||||
* @param[in] data Data registered by this class
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::FileChooser::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
/*
|
||||
EWOL_INFO("Receive Event from the LIST ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (ewolEventFileChooserEntryFolder == generateEventId) {
|
||||
EWOL_INFO("Receive Event from the LIST ... : widgetPointer=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (ewolEventFileChooserEntryFolder == eventId) {
|
||||
//==> change the folder name
|
||||
// TODO : Change the folder, if it exit ...
|
||||
return true;
|
||||
} else if (ewolEventFileChooserEntryFile == generateEventId) {
|
||||
return;
|
||||
} else if (ewolEventFileChooserEntryFile == eventId) {
|
||||
//==> change the file name
|
||||
ewol::Entry * tmpWidget = static_cast<ewol::Entry*>(ewol::widgetManager::Get(m_widgetCurrentFileNameId));
|
||||
if (NULL != tmpWidget) {
|
||||
m_file = tmpWidget->GetValue();
|
||||
if (NULL != m_widgetCurrentFileName) {
|
||||
m_file = m_widgetCurrentFileName->GetValue();
|
||||
}
|
||||
// TODO : Remove file selection
|
||||
return true;
|
||||
} else if (ewolEventFileChooserCancel == generateEventId) {
|
||||
return;
|
||||
} else if (ewolEventFileChooserCancel == eventId) {
|
||||
//==> Auto remove ...
|
||||
bool tmppp = GenEventInputExternal(generateEventId, x, y);
|
||||
ewol::RmPopUp(GetWidgetId());
|
||||
return tmppp;
|
||||
} else if (ewolEventFileChooserHidenFileChange == generateEventId) {
|
||||
GenerateEventId(eventId);
|
||||
MarkToRemove();
|
||||
return;
|
||||
} else if (ewolEventFileChooserHidenFileChange == eventId) {
|
||||
// regenerate the display ...
|
||||
UpdateCurrentFolder();
|
||||
return true;
|
||||
} else if (ewolEventFileChooserSelectFolder == generateEventId) {
|
||||
return;
|
||||
} else if (ewolEventFileChooserSelectFolder == eventId) {
|
||||
//==> this is an internal event ...
|
||||
FileChooserFolderList * myListFolder = static_cast<FileChooserFolderList *>(ewol::widgetManager::Get(m_widgetListFolderId));
|
||||
FileChooserFolderList * myListFolder = static_cast<FileChooserFolderList *>(m_widgetListFolder);
|
||||
etk::UString tmpString = myListFolder->GetSelectedLine();
|
||||
EWOL_DEBUG(" old PATH : \"" << m_folder << "\" + \"" << tmpString << "\"");
|
||||
m_folder = m_folder + tmpString;
|
||||
@ -573,45 +549,48 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
|
||||
SetFileName("");
|
||||
UpdateCurrentFolder();
|
||||
m_hasSelectedFile = false;
|
||||
return true;
|
||||
} else if (ewolEventFileChooserSelectFile == generateEventId) {
|
||||
return;
|
||||
} else if (ewolEventFileChooserSelectFile == eventId) {
|
||||
m_hasSelectedFile = true;
|
||||
FileChooserFileList * myListFile = static_cast<FileChooserFileList *>(ewol::widgetManager::Get(m_widgetListFileId));
|
||||
FileChooserFileList * myListFile = static_cast<FileChooserFileList *>(m_widgetListFile);
|
||||
etk::UString file = myListFile->GetSelectedLine();
|
||||
SetFileName(file);
|
||||
GenEventInputExternal(generateEventId, x, y);
|
||||
} else if( ewolEventFileChooserValidateFile == generateEventId
|
||||
|| (ewolEventFileChooserValidate == generateEventId && true == m_hasSelectedFile) ) {
|
||||
GenerateEventId(eventId);
|
||||
} else if( ewolEventFileChooserValidateFile == eventId
|
||||
|| (ewolEventFileChooserValidate == eventId && true == m_hasSelectedFile) ) {
|
||||
// select the File ==> generate a validate
|
||||
bool tmppp = GenEventInputExternal(ewolEventFileChooserValidate, x, y);
|
||||
ewol::RmPopUp(GetWidgetId());
|
||||
return tmppp;
|
||||
GenerateEventId(ewolEventFileChooserValidate);
|
||||
MarkToRemove();
|
||||
return;
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
|
||||
void ewol::FileChooser::UpdateCurrentFolder(void)
|
||||
{
|
||||
/*
|
||||
FileChooserFileList * myListFile = static_cast<FileChooserFileList *>(ewol::widgetManager::Get(m_widgetListFileId));
|
||||
FileChooserFolderList * myListFolder = static_cast<FileChooserFolderList *>(ewol::widgetManager::Get(m_widgetListFolderId));
|
||||
ewol::Entry * myEntry = static_cast<ewol::Entry *>(ewol::widgetManager::Get(m_widgetCurrentFolderId));
|
||||
ewol::CheckBox * myhidenFiles = static_cast<ewol::CheckBox *>(ewol::widgetManager::Get(m_widgetCheckBoxId));
|
||||
if (NULL == m_widgetListFile) {
|
||||
return;
|
||||
}
|
||||
if (NULL == m_widgetListFolder) {
|
||||
return;
|
||||
}
|
||||
FileChooserFileList * myListFile = static_cast<FileChooserFileList *>(m_widgetListFile);
|
||||
FileChooserFolderList * myListFolder = static_cast<FileChooserFolderList *>(m_widgetListFolder);
|
||||
|
||||
myListFile->ClearElements();
|
||||
myListFolder->ClearElements();
|
||||
bool ShowHidenFile = true;
|
||||
if (NULL != myhidenFiles) {
|
||||
ShowHidenFile = myhidenFiles->GetValue();
|
||||
if (NULL != m_widgetCheckBox) {
|
||||
ShowHidenFile = m_widgetCheckBox->GetValue();
|
||||
} else {
|
||||
EWOL_ERROR("Can not get the hiden property of the file choozer...");
|
||||
}
|
||||
|
||||
|
||||
myEntry->SetValue(m_folder);
|
||||
if (NULL != m_widgetCurrentFolder) {
|
||||
m_widgetCurrentFolder->SetValue(m_folder);
|
||||
}
|
||||
myListFolder->AddElement(etk::UString("."));
|
||||
if (m_folder != "/" ) {
|
||||
myListFolder->AddElement(etk::UString(".."));
|
||||
@ -643,19 +622,60 @@ void ewol::FileChooser::UpdateCurrentFolder(void)
|
||||
myListFile->EndGenerating();
|
||||
myListFolder->EndGenerating();
|
||||
MarkToReedraw();
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
etk::UString ewol::FileChooser::GetCompleateFileName(void)
|
||||
{
|
||||
/*
|
||||
|
||||
etk::UString tmpString = m_folder;
|
||||
tmpString += "/";
|
||||
tmpString += m_file;
|
||||
return tmpString;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::FileChooser::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
// First step call parrent :
|
||||
ewol::PopUp::OnObjectRemove(removeObject);
|
||||
// second step find if in all the elements ...
|
||||
if(removeObject == m_widgetTitle) {
|
||||
m_widgetTitle = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetValidate) {
|
||||
m_widgetValidate = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetCancel) {
|
||||
m_widgetCancel = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetCurrentFolder) {
|
||||
m_widgetCurrentFolder = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetCurrentFileName) {
|
||||
m_widgetCurrentFileName = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetListFolder) {
|
||||
m_widgetListFolder = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetListFile) {
|
||||
m_widgetListFile = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
if(removeObject == m_widgetCheckBox) {
|
||||
m_widgetCheckBox = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,10 @@
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
|
||||
extern const char * const ewolEventFileChooserCancel;
|
||||
extern const char * const ewolEventFileChooserValidate;
|
||||
@ -38,7 +42,21 @@ namespace ewol {
|
||||
public:
|
||||
FileChooser(void);
|
||||
~FileChooser(void);
|
||||
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y);
|
||||
/**
|
||||
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||
* @param[in] CallerObject Pointer on the EObject that information came from
|
||||
* @param[in] eventId Message registered by this class
|
||||
* @param[in] data Data registered by this class
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
/**
|
||||
* @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
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
void SetTitle(etk::UString label);
|
||||
void SetValidateLabel(etk::UString label);
|
||||
void SetCancelLabel(etk::UString label);
|
||||
@ -47,17 +65,17 @@ namespace ewol {
|
||||
etk::UString GetCompleateFileName(void);
|
||||
void UpdateCurrentFolder(void);
|
||||
private:
|
||||
int32_t m_widgetTitleId;
|
||||
int32_t m_widgetValidateId;
|
||||
int32_t m_widgetCancelId;
|
||||
int32_t m_widgetCurrentFolderId;
|
||||
int32_t m_widgetCurrentFileNameId;
|
||||
int32_t m_widgetListFolderId;
|
||||
int32_t m_widgetListFileId;
|
||||
int32_t m_widgetCheckBoxId;
|
||||
bool m_hasSelectedFile;
|
||||
etk::UString m_folder;
|
||||
etk::UString m_file;
|
||||
ewol::Label* m_widgetTitle;
|
||||
ewol::Button* m_widgetValidate;
|
||||
ewol::Button* m_widgetCancel;
|
||||
ewol::Entry* m_widgetCurrentFolder;
|
||||
ewol::Entry* m_widgetCurrentFileName;
|
||||
ewol::Widget* m_widgetListFolder;
|
||||
ewol::Widget* m_widgetListFile;
|
||||
ewol::CheckBox* m_widgetCheckBox;
|
||||
bool m_hasSelectedFile;
|
||||
etk::UString m_folder;
|
||||
etk::UString m_file;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -74,7 +74,7 @@ ewol::Keyboard::~Keyboard(void)
|
||||
|
||||
#define ADD_BUTTON(upperWidget,widget,text,event) do { \
|
||||
(widget) = new ewol::Button((text)); \
|
||||
(widget)->ExternLinkOnEvent("ewol Button Pressed", GetWidgetId(), (event) ); \
|
||||
(widget)->RegisterOnEvent(this, ewolEventButtonPressed, (event) ); \
|
||||
(widget)->SetExpendX(true); \
|
||||
(widget)->SetFillX(true); \
|
||||
(widget)->SetCanHaveFocus(false); \
|
||||
@ -86,8 +86,6 @@ ewol::Keyboard::~Keyboard(void)
|
||||
|
||||
void ewol::Keyboard::SetMode(keyboardMode_te mode)
|
||||
{
|
||||
/*
|
||||
|
||||
ewol::SizerVert * mySizerVert = NULL;
|
||||
ewol::SizerHori * mySizerHori = NULL;
|
||||
ewol::Button * myButton = NULL;
|
||||
@ -97,7 +95,7 @@ void ewol::Keyboard::SetMode(keyboardMode_te mode)
|
||||
newPadding.x = 12;
|
||||
|
||||
mySizerVert = new ewol::SizerVert();
|
||||
m_subWidget = mySizerVert;
|
||||
m_subWidget[m_currentCreateId] = mySizerVert;
|
||||
|
||||
mySizerHori = new ewol::SizerHori();
|
||||
mySizerVert->SubWidgetAdd(mySizerHori);
|
||||
@ -182,16 +180,24 @@ void ewol::Keyboard::SetMode(keyboardMode_te mode)
|
||||
myButton->SetExpendX(false);
|
||||
ADD_BUTTON(mySizerHori,myButton,"Ctrl",ewolEventKeyEvent);
|
||||
myButton->SetExpendX(false);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
||||
/**
|
||||
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||
* @param[in] CallerObject Pointer on the EObject that information came from
|
||||
* @param[in] eventId Message registered by this class
|
||||
* @param[in] data Data registered by this class
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::Keyboard::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
/*
|
||||
EWOL_INFO("Receive Event from the Keyboard ... : widgetid=" << widgetID << "\"" << generateEventId << "\" ==> internalEvent=\"" << data << "\"" );
|
||||
if (ewolEventKeyEvent == generateEventId) {
|
||||
ewol::Button * bt = static_cast<ewol::Button *>(ewol::widgetManager::Get(widgetID));
|
||||
EWOL_INFO("Receive Event from the Keyboard ... : widget*=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (ewolEventKeyEvent == eventId) {
|
||||
if (NULL == CallerObject) {
|
||||
return;
|
||||
}
|
||||
ewol::Button * bt = static_cast<ewol::Button *>(CallerObject);
|
||||
EWOL_DEBUG("kbevent : \"" << bt->GetLabel() << "\"");
|
||||
etk::UString data = bt->GetLabel();
|
||||
if (data == "DEL") {
|
||||
@ -206,14 +212,13 @@ bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generate
|
||||
}
|
||||
guiAbstraction::SendKeyboardEvent(true, data[0]);
|
||||
guiAbstraction::SendKeyboardEvent(false, data[0]);
|
||||
return true;
|
||||
} else if (ewolEventKeyboardHide == generateEventId) {
|
||||
return;
|
||||
} else if (ewolEventKeyboardHide == eventId) {
|
||||
Hide();
|
||||
ewol::ForceRedrawAll();
|
||||
}
|
||||
//return GenEventInputExternal(eventExternId, x, y);
|
||||
return true;
|
||||
*/
|
||||
return;
|
||||
};
|
||||
|
||||
|
||||
@ -235,49 +240,45 @@ void ewol::Keyboard::SetExpendY(bool newExpend)
|
||||
|
||||
bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
||||
{
|
||||
/*
|
||||
//EWOL_DEBUG("CalculateSize(" << availlableX << "," << availlableY << ")");
|
||||
// pop-up fill all the display :
|
||||
m_size.x = availlableX;
|
||||
m_size.y = availlableY;
|
||||
|
||||
if (NULL != m_subWidget) {
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
coord2D_ts subWidgetSize;
|
||||
subWidgetSize = m_subWidget->GetMinSize();
|
||||
if (true == m_subWidget->CanExpentX()) {
|
||||
subWidgetSize = m_subWidget[m_currentCreateId]->GetMinSize();
|
||||
if (true == m_subWidget[m_currentCreateId]->CanExpentX()) {
|
||||
subWidgetSize.x = m_size.x;
|
||||
}
|
||||
if (true == m_subWidget->CanExpentY()) {
|
||||
if (true == m_subWidget[m_currentCreateId]->CanExpentY()) {
|
||||
subWidgetSize.y = m_size.y;
|
||||
}
|
||||
// force to be an integer ...
|
||||
subWidgetSize.x = (int32_t)subWidgetSize.x;
|
||||
subWidgetSize.y = (int32_t)subWidgetSize.y;
|
||||
|
||||
m_subWidget->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
m_subWidget[m_currentCreateId]->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget[m_currentCreateId]->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
}
|
||||
MarkToReedraw();
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ewol::Keyboard::CalculateMinSize(void)
|
||||
{
|
||||
/*
|
||||
m_userExpendX=false;
|
||||
m_userExpendY=false;
|
||||
m_minSize.x = 50.0;
|
||||
m_minSize.y = 50.0;
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->CalculateMinSize();
|
||||
coord2D_ts tmpSize = m_subWidget->GetMinSize();
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->CalculateMinSize();
|
||||
coord2D_ts tmpSize = m_subWidget[m_currentCreateId]->GetMinSize();
|
||||
m_minSize.x = tmpSize.x;
|
||||
m_minSize.y = tmpSize.y;
|
||||
}
|
||||
//EWOL_DEBUG("CalculateMinSize(" << m_minSize.x << "," << m_minSize.y << ")");
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -285,18 +286,15 @@ bool ewol::Keyboard::CalculateMinSize(void)
|
||||
|
||||
bool ewol::Keyboard::OnDraw(void)
|
||||
{
|
||||
/*
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->GenDraw();
|
||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||
m_subWidget[m_currentDrawId]->GenDraw();
|
||||
}
|
||||
*/
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ewol::Keyboard::OnRegenerateDisplay(void)
|
||||
{
|
||||
/*
|
||||
if (true == NeedRedraw()) {
|
||||
color_ts mycolor;
|
||||
mycolor.red = 1.0;
|
||||
@ -310,20 +308,49 @@ void ewol::Keyboard::OnRegenerateDisplay(void)
|
||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||
AddOObject(BGOObjects);
|
||||
}
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->OnRegenerateDisplay();
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId]->OnRegenerateDisplay();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
bool ewol::Keyboard::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, eventPosition_ts pos)
|
||||
{
|
||||
/*
|
||||
if (NULL != m_subWidget) {
|
||||
return m_subWidget->GenEventInput(IdInput, typeEvent, pos.abs);
|
||||
if (NULL != m_subWidget[m_currentCreateId]) {
|
||||
return m_subWidget[m_currentCreateId]->GenEventInput(IdInput, typeEvent, pos.abs);
|
||||
}
|
||||
*/
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
void ewol::Keyboard::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
ewol::Drawable::OnObjectRemove(removeObject);
|
||||
if (removeObject == m_subWidget[m_currentCreateId]) {
|
||||
m_subWidget[m_currentCreateId] = NULL;
|
||||
m_needFlipFlop = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ewol::Keyboard::OnFlipFlopEvent(void)
|
||||
{
|
||||
bool needFlipFlop = m_needFlipFlop;
|
||||
// call herited classes
|
||||
ewol::Drawable::OnFlipFlopEvent();
|
||||
// internal saving
|
||||
if (true == needFlipFlop) {
|
||||
m_subWidget[m_currentCreateId] = m_subWidget[m_currentDrawId];
|
||||
}
|
||||
// in every case, we propagate the flip-flop EVENT
|
||||
if (NULL != m_subWidget[m_currentDrawId]) {
|
||||
m_subWidget[m_currentDrawId]->OnFlipFlopEvent();
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,22 @@ namespace ewol {
|
||||
public:
|
||||
Keyboard(void);
|
||||
~Keyboard(void);
|
||||
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
|
||||
virtual void OnFlipFlopEvent(void);
|
||||
/**
|
||||
* @brief Receive a message from an other EObject with a specific eventId and data
|
||||
* @param[in] CallerObject Pointer on the EObject that information came from
|
||||
* @param[in] eventId Message registered by this class
|
||||
* @param[in] data Data registered by this class
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
/**
|
||||
* @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
|
||||
* @note : Sub classes must call this class
|
||||
* @return ---
|
||||
*/
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
void SetMode(keyboardMode_te mode);
|
||||
bool IsHide(void) { return m_isHide; };
|
||||
void Hide(void) { m_isHide=true; };
|
||||
@ -51,7 +66,7 @@ namespace ewol {
|
||||
private:
|
||||
bool m_isHide;
|
||||
keyboardMode_te m_mode;
|
||||
ewol::Widget* m_subWidget;
|
||||
ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER];
|
||||
public:
|
||||
virtual bool CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY); // this generate the current size ...
|
||||
virtual bool CalculateMinSize(void); //update the min Size ... and the expend parameters for the sizer
|
||||
|
Loading…
x
Reference in New Issue
Block a user