Menu dev OK and change the thread system. add the safe remove of the widgets
This commit is contained in:
parent
3ad5f9ff83
commit
74a1a39d8c
@ -15,8 +15,7 @@ LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
|
|||||||
LOCAL_CFLAGS := -D__PLATFORM__Android \
|
LOCAL_CFLAGS := -D__PLATFORM__Android \
|
||||||
-Wno-write-strings \
|
-Wno-write-strings \
|
||||||
-DDATA_IN_APK \
|
-DDATA_IN_APK \
|
||||||
-DETK_DEBUG_LEVEL=3 \
|
-DETK_DEBUG_LEVEL=3
|
||||||
-std=c++0x
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,8 +15,7 @@ LOCAL_CFLAGS := -D__PLATFORM__Linux \
|
|||||||
-DETK_DEBUG_LEVEL=3 \
|
-DETK_DEBUG_LEVEL=3 \
|
||||||
-DEWOL_DEBUG_LEVEL=3 \
|
-DEWOL_DEBUG_LEVEL=3 \
|
||||||
-DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \
|
-DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \
|
||||||
-DVERSION_BUILD_TIME="\"pasd_heure\"" \
|
-DVERSION_BUILD_TIME="\"pasd_heure\""
|
||||||
-std=c++0x
|
|
||||||
|
|
||||||
# load the common sources file of the platform
|
# load the common sources file of the platform
|
||||||
include $(LOCAL_PATH)/file.mk
|
include $(LOCAL_PATH)/file.mk
|
||||||
|
@ -18,8 +18,7 @@ LOCAL_CFLAGS := -D__PLATFORM__Android \
|
|||||||
-DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \
|
-DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \
|
||||||
-DVERSION_BUILD_TIME="\"pasd_heure\"" \
|
-DVERSION_BUILD_TIME="\"pasd_heure\"" \
|
||||||
-DEWOL_USE_FREE_TYPE \
|
-DEWOL_USE_FREE_TYPE \
|
||||||
-DDATA_IN_APK \
|
-DDATA_IN_APK
|
||||||
-std=c++0x
|
|
||||||
|
|
||||||
# load the common sources file of the platform
|
# load the common sources file of the platform
|
||||||
include $(LOCAL_PATH)/file.mk
|
include $(LOCAL_PATH)/file.mk
|
||||||
|
@ -16,8 +16,7 @@ LOCAL_CFLAGS := -D__PLATFORM__Linux \
|
|||||||
-DEWOL_DEBUG_LEVEL=3 \
|
-DEWOL_DEBUG_LEVEL=3 \
|
||||||
-DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \
|
-DEWOL_VERSION_TAG_NAME="\"UNKNOW-debug\"" \
|
||||||
-DVERSION_BUILD_TIME="\"pasd_heure\"" \
|
-DVERSION_BUILD_TIME="\"pasd_heure\"" \
|
||||||
-DEWOL_USE_FREE_TYPE \
|
-DEWOL_USE_FREE_TYPE
|
||||||
-std=c++0x
|
|
||||||
|
|
||||||
# `pkg-config --cflags freetype2`
|
# `pkg-config --cflags freetype2`
|
||||||
|
|
||||||
|
@ -654,6 +654,29 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
// update texture start X Pos
|
// update texture start X Pos
|
||||||
tuB -= addElement;
|
tuB -= addElement;
|
||||||
}
|
}
|
||||||
|
etkFloat_t TexSizeY = tvD - tvC;
|
||||||
|
if (dyC < drawClipping.y) {
|
||||||
|
// clip display
|
||||||
|
etkFloat_t drawSize = drawClipping.y - dyC;
|
||||||
|
// Update element start display
|
||||||
|
dyC = drawClipping.y;
|
||||||
|
etkFloat_t addElement = TexSizeY * drawSize / listOfElement[charIndex].size.y;
|
||||||
|
// update texture start X Pos
|
||||||
|
tvC += addElement;
|
||||||
|
}
|
||||||
|
if (dyD > drawClipping.y + drawClipping.h) {
|
||||||
|
// clip display
|
||||||
|
etkFloat_t drawSize = dyD - (drawClipping.y + drawClipping.h);
|
||||||
|
// Update element start display
|
||||||
|
dyD = drawClipping.y + drawClipping.h;
|
||||||
|
etkFloat_t addElement = TexSizeX * drawSize / listOfElement[charIndex].size.y;
|
||||||
|
// update texture start X Pos
|
||||||
|
tvD -= addElement;
|
||||||
|
}
|
||||||
|
if( dxB <= dxA
|
||||||
|
|| dyD <= dyC) {
|
||||||
|
// nothing to do ...
|
||||||
|
} else {
|
||||||
/* Bitmap position
|
/* Bitmap position
|
||||||
* 0------1
|
* 0------1
|
||||||
* | |
|
* | |
|
||||||
@ -721,6 +744,7 @@ int32_t ewol::DrawText(int32_t fontID,
|
|||||||
coord.PushBack(bitmapDrawPos[3]);
|
coord.PushBack(bitmapDrawPos[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
posDrawX += listOfElement[charIndex].advance;
|
posDrawX += listOfElement[charIndex].advance;
|
||||||
}
|
}
|
||||||
int32_t sizeOut = posDrawX - textPos.x;
|
int32_t sizeOut = posDrawX - textPos.x;
|
||||||
|
@ -133,6 +133,8 @@ namespace ewol {
|
|||||||
ewol::Widget * m_parrent; //!< parrent of the current widget (if NULL ==> this is the main node(root))
|
ewol::Widget * m_parrent; //!< parrent of the current widget (if NULL ==> this is the main node(root))
|
||||||
public:
|
public:
|
||||||
void SetParrent(ewol::Widget * newParrent) { m_parrent = newParrent; };
|
void SetParrent(ewol::Widget * newParrent) { m_parrent = newParrent; };
|
||||||
|
void UnlinkParrent(void) { if (NULL != m_parrent) { m_parrent->removedChild(this); m_parrent=NULL; } };
|
||||||
|
virtual void removedChild(ewol::Widget * removedChild) { };
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------------------------------------------
|
||||||
// -- Widget Size:
|
// -- Widget Size:
|
||||||
|
@ -39,6 +39,7 @@ static pthread_mutex_t localMutex;
|
|||||||
|
|
||||||
// internal element of the widget manager :
|
// internal element of the widget manager :
|
||||||
static etk::VectorType<widgetList_ts> m_widgetList; // all widget allocated ==> all time increment ... never removed ...
|
static etk::VectorType<widgetList_ts> m_widgetList; // all widget allocated ==> all time increment ... never removed ...
|
||||||
|
static etk::VectorType<widgetList_ts> m_widgetDeletedList; // all widget allocated
|
||||||
// For the focus Management
|
// For the focus Management
|
||||||
static ewol::Widget * m_focusWidgetDefault = NULL;
|
static ewol::Widget * m_focusWidgetDefault = NULL;
|
||||||
static ewol::Widget * m_focusWidgetCurrent = NULL;
|
static ewol::Widget * m_focusWidgetCurrent = NULL;
|
||||||
@ -102,6 +103,17 @@ void ewol::widgetManager::Rm(ewol::Widget * newWidget)
|
|||||||
FocusRemoveIfRemove(newWidget);
|
FocusRemoveIfRemove(newWidget);
|
||||||
// Remove Element
|
// Remove Element
|
||||||
m_widgetList.Erase(iii);
|
m_widgetList.Erase(iii);
|
||||||
|
EWOL_CRITICAL("Widget direct remove is really DANGEROUS due to the multithreading ...");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int32_t iii=0; iii<m_widgetDeletedList.Size(); iii++) {
|
||||||
|
if (m_widgetDeletedList[iii].widgetPointer == newWidget) {
|
||||||
|
// Remove focus here is an impossible case ...
|
||||||
|
FocusRemoveIfRemove(newWidget);
|
||||||
|
// Remove Element
|
||||||
|
m_widgetDeletedList.Erase(iii);
|
||||||
|
//Normal remove of the widget ...
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,6 +237,7 @@ static bool needRedraw = true;
|
|||||||
|
|
||||||
void ewol::widgetManager::GetDoubleBufferFlipFlop(void)
|
void ewol::widgetManager::GetDoubleBufferFlipFlop(void)
|
||||||
{
|
{
|
||||||
|
ewol::widgetManager::RemoveAllMarkWidget();
|
||||||
pthread_mutex_lock(&localMutex);
|
pthread_mutex_lock(&localMutex);
|
||||||
// flip/Flop all the widget registered :
|
// flip/Flop all the widget registered :
|
||||||
for(int32_t iii=0; iii<m_widgetList.Size(); iii++) {
|
for(int32_t iii=0; iii<m_widgetList.Size(); iii++) {
|
||||||
@ -254,3 +267,64 @@ void ewol::widgetManager::GetDoubleBufferStopDraw(void)
|
|||||||
{
|
{
|
||||||
pthread_mutex_unlock(&localMutex);
|
pthread_mutex_unlock(&localMutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::widgetManager::MarkWidgetToBeRemoved(int32_t widgetId)
|
||||||
|
{
|
||||||
|
MarkWidgetToBeRemoved(ewol::widgetManager::Get(widgetId));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::widgetManager::MarkWidgetToBeRemoved(ewol::Widget * expectedWidget)
|
||||||
|
{
|
||||||
|
if (expectedWidget == NULL) {
|
||||||
|
EWOL_WARNING("try to remove a NULL Pointer on the widget");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int32_t findId = -1;
|
||||||
|
// check if the widget is not destroy :
|
||||||
|
for(int32_t iii=0; iii<m_widgetList.Size(); iii++) {
|
||||||
|
if (m_widgetList[iii].widgetPointer == expectedWidget) {
|
||||||
|
findId = iii;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (-1 == findId) {
|
||||||
|
EWOL_CRITICAL("Try to connect a wiget that is already removed or not registerd (imposible case)");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Remove the focus ..
|
||||||
|
FocusRemoveIfRemove(expectedWidget);
|
||||||
|
// move the widget from the basic list and set it in the remove list
|
||||||
|
widgetList_ts tmpWidgetProperty = m_widgetList[findId];
|
||||||
|
m_widgetList.Erase(findId);
|
||||||
|
// Unlink from the parrent ...
|
||||||
|
// TODO : Set it again ....
|
||||||
|
//tmpWidgetProperty.widgetPointer->UnlinkParrent();
|
||||||
|
// add ...
|
||||||
|
m_widgetDeletedList.PushBack(tmpWidgetProperty);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ewol::widgetManager::RemoveAllMarkWidget(void)
|
||||||
|
{
|
||||||
|
etk::VectorType<widgetList_ts> m_widgetDeletedList_tmp = m_widgetDeletedList;
|
||||||
|
pthread_mutex_lock(&localMutex);
|
||||||
|
// flip/Flop all the widget registered :
|
||||||
|
for(int32_t iii=0; iii<m_widgetDeletedList_tmp.Size(); iii++) {
|
||||||
|
if (NULL != m_widgetDeletedList_tmp[iii].widgetPointer) {
|
||||||
|
delete(m_widgetDeletedList_tmp[iii].widgetPointer);
|
||||||
|
m_widgetDeletedList_tmp[iii].widgetPointer = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pthread_mutex_unlock(&localMutex);
|
||||||
|
|
||||||
|
if (m_widgetDeletedList.Size() != 0 ) {
|
||||||
|
EWOL_CRITICAL("Memory leak ==> not all the widget are auto-removed");
|
||||||
|
// in every case clean the list ...
|
||||||
|
m_widgetDeletedList.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -53,6 +53,11 @@ namespace ewol {
|
|||||||
bool GetDoubleBufferNeedDraw(void);
|
bool GetDoubleBufferNeedDraw(void);
|
||||||
void GetDoubleBufferStartDraw(void);
|
void GetDoubleBufferStartDraw(void);
|
||||||
void GetDoubleBufferStopDraw(void);
|
void GetDoubleBufferStopDraw(void);
|
||||||
|
|
||||||
|
// For the multithreaded context the widget mus not de removed by the user ==> he might mark if to be remove later with a mutex protection...
|
||||||
|
void MarkWidgetToBeRemoved(int32_t widgetId);
|
||||||
|
void MarkWidgetToBeRemoved(ewol::Widget * expectedWidget);
|
||||||
|
void RemoveAllMarkWidget(void);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
* @file ewol/WidgetMessageMulticast.cpp
|
* @file ewol/WidgetMessageMultiCast.cpp
|
||||||
* @brief basic ewol Widget Message Multi-cast (Sources)
|
* @brief basic ewol Widget Message Multi-cast (Sources)
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @date 31/01/2012
|
* @date 31/01/2012
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
* @file ewol/WidgetMessageMulticast.h
|
* @file ewol/WidgetMessageMultiCast.h
|
||||||
* @brief basic ewol Widget Message Multi-cast (Header)
|
* @brief basic ewol Widget Message Multi-cast (Header)
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @date 31/01/2012
|
* @date 31/01/2012
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
#include <ewol/Font.h>
|
#include <ewol/Font.h>
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
#include <ewol/importgl.h>
|
#include <ewol/importgl.h>
|
||||||
|
#include <ewol/WidgetManager.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -46,7 +47,6 @@ ewol::Windows::Windows(void)
|
|||||||
{
|
{
|
||||||
SetCanHaveFocus(true);
|
SetCanHaveFocus(true);
|
||||||
m_subWidget = NULL;
|
m_subWidget = NULL;
|
||||||
m_popUpWidget = NULL;
|
|
||||||
m_keyBoardwidget = NULL;
|
m_keyBoardwidget = NULL;
|
||||||
// enable specific drawing system ...
|
// enable specific drawing system ...
|
||||||
SpecificDrawEnable();
|
SpecificDrawEnable();
|
||||||
@ -57,15 +57,20 @@ ewol::Windows::Windows(void)
|
|||||||
ewol::Windows::~Windows(void)
|
ewol::Windows::~Windows(void)
|
||||||
{
|
{
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
delete(m_subWidget);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget);
|
||||||
m_subWidget=NULL;
|
m_subWidget=NULL;
|
||||||
}
|
}
|
||||||
if (NULL != m_popUpWidget) {
|
|
||||||
delete(m_popUpWidget);
|
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
|
||||||
m_popUpWidget=NULL;
|
if (NULL != m_popUpWidgetList[iii]) {
|
||||||
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_popUpWidgetList[iii]);
|
||||||
|
m_popUpWidgetList[iii]=NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
m_popUpWidgetList.Clear();
|
||||||
|
|
||||||
if (NULL != m_keyBoardwidget) {
|
if (NULL != m_keyBoardwidget) {
|
||||||
delete(m_keyBoardwidget);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_keyBoardwidget);
|
||||||
m_keyBoardwidget=NULL;
|
m_keyBoardwidget=NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,9 +93,11 @@ bool ewol::Windows::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY
|
|||||||
// TODO : Herited from MinSize .. and expand ???
|
// TODO : Herited from MinSize .. and expand ???
|
||||||
m_subWidget->CalculateSize(m_size.x, m_size.y - keyboardHigh);
|
m_subWidget->CalculateSize(m_size.x, m_size.y - keyboardHigh);
|
||||||
}
|
}
|
||||||
if (NULL != m_popUpWidget) {
|
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
|
||||||
m_popUpWidget->CalculateMinSize();
|
if (NULL != m_popUpWidgetList[iii]) {
|
||||||
m_popUpWidget->CalculateSize(m_size.x, m_size.y - keyboardHigh);
|
m_popUpWidgetList[iii]->CalculateMinSize();
|
||||||
|
m_popUpWidgetList[iii]->CalculateSize(m_size.x, m_size.y - keyboardHigh);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// regenerate all the display ...
|
// regenerate all the display ...
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
@ -108,8 +115,12 @@ bool ewol::Windows::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, e
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// event go directly on the pop-up
|
// event go directly on the pop-up
|
||||||
if (NULL != m_popUpWidget) {
|
if (0 < m_popUpWidgetList.Size()) {
|
||||||
m_popUpWidget->GenEventInput(IdInput, typeEvent, x, y);
|
if (NULL == m_popUpWidgetList[m_popUpWidgetList.Size()-1]) {
|
||||||
|
m_popUpWidgetList.PopBack();
|
||||||
|
} else {
|
||||||
|
m_popUpWidgetList[m_popUpWidgetList.Size()-1]->GenEventInput(IdInput, typeEvent, x, y);
|
||||||
|
}
|
||||||
// otherwise in the normal windows
|
// otherwise in the normal windows
|
||||||
} else if (NULL != m_subWidget) {
|
} else if (NULL != m_subWidget) {
|
||||||
m_subWidget->GenEventInput(IdInput, typeEvent, x, y);
|
m_subWidget->GenEventInput(IdInput, typeEvent, x, y);
|
||||||
@ -145,13 +156,13 @@ void ewol::Windows::SysDraw(void)
|
|||||||
#endif
|
#endif
|
||||||
//http://www.khronos.org/opengles/documentation/opengles1_0/html/glBlendFunc.html
|
//http://www.khronos.org/opengles/documentation/opengles1_0/html/glBlendFunc.html
|
||||||
|
|
||||||
glEnable(GL_POLYGON_SMOOTH);
|
//glEnable(GL_POLYGON_SMOOTH);
|
||||||
glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
//glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
glShadeModel(GL_POLYGON_SMOOTH);
|
//glShadeModel(GL_POLYGON_SMOOTH);
|
||||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
//glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||||
|
|
||||||
|
|
||||||
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA);
|
//glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA);
|
||||||
@ -171,8 +182,10 @@ void ewol::Windows::OnRegenerateDisplay(void)
|
|||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
m_subWidget->OnRegenerateDisplay();
|
m_subWidget->OnRegenerateDisplay();
|
||||||
}
|
}
|
||||||
if (NULL != m_popUpWidget) {
|
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
|
||||||
m_popUpWidget->OnRegenerateDisplay();
|
if (NULL != m_popUpWidgetList[iii]) {
|
||||||
|
m_popUpWidgetList[iii]->OnRegenerateDisplay();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) {
|
if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) {
|
||||||
m_keyBoardwidget->OnRegenerateDisplay();
|
m_keyBoardwidget->OnRegenerateDisplay();
|
||||||
@ -188,10 +201,12 @@ bool ewol::Windows::OnDraw(void)
|
|||||||
//EWOL_DEBUG("Draw Windows");
|
//EWOL_DEBUG("Draw Windows");
|
||||||
}
|
}
|
||||||
// second display the pop-up
|
// second display the pop-up
|
||||||
if (NULL != m_popUpWidget) {
|
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
|
||||||
m_popUpWidget->GenDraw();
|
if (NULL != m_popUpWidgetList[iii]) {
|
||||||
|
m_popUpWidgetList[iii]->GenDraw();
|
||||||
//EWOL_DEBUG("Draw Pop-up");
|
//EWOL_DEBUG("Draw Pop-up");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) {
|
if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) {
|
||||||
m_keyBoardwidget->GenDraw();
|
m_keyBoardwidget->GenDraw();
|
||||||
//EWOL_DEBUG("Draw Pop-up");
|
//EWOL_DEBUG("Draw Pop-up");
|
||||||
@ -205,7 +220,7 @@ void ewol::Windows::SetSubWidget(ewol::Widget * widget)
|
|||||||
{
|
{
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
EWOL_INFO("Remove current main windows Widget...");
|
EWOL_INFO("Remove current main windows Widget...");
|
||||||
delete(m_subWidget);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget);
|
||||||
m_subWidget = NULL;
|
m_subWidget = NULL;
|
||||||
}
|
}
|
||||||
m_subWidget = widget;
|
m_subWidget = widget;
|
||||||
@ -216,26 +231,26 @@ void ewol::Windows::SetSubWidget(ewol::Widget * widget)
|
|||||||
|
|
||||||
void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
|
void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget)
|
||||||
{
|
{
|
||||||
if (NULL != m_popUpWidget) {
|
m_popUpWidgetList.PushBack(widget);
|
||||||
EWOL_INFO("Remove current pop-up Widget...");
|
|
||||||
delete(m_popUpWidget);
|
|
||||||
m_popUpWidget = NULL;
|
|
||||||
}
|
|
||||||
m_popUpWidget = widget;
|
|
||||||
// Regenerate the size calculation :
|
// Regenerate the size calculation :
|
||||||
CalculateSize(m_size.x, m_size.y);
|
CalculateSize(m_size.x, m_size.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::Windows::PopUpWidgetPop(int32_t popUpId)
|
||||||
void ewol::Windows::PopUpWidgetPop(void)
|
|
||||||
{
|
{
|
||||||
if (NULL != m_popUpWidget) {
|
if(popUpId >= 0) {
|
||||||
EWOL_INFO("Remove current pop-up Widget...");
|
for(int32_t iii=0; iii<m_popUpWidgetList.Size(); iii++) {
|
||||||
delete(m_popUpWidget);
|
if (NULL != m_popUpWidgetList[iii]) {
|
||||||
m_popUpWidget = NULL;
|
if (m_popUpWidgetList[iii]->GetWidgetId() == popUpId) {
|
||||||
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_popUpWidgetList[iii]);
|
||||||
|
m_popUpWidgetList[iii] = NULL;
|
||||||
|
m_popUpWidgetList.Erase(iii);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::Windows::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
bool ewol::Windows::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y)
|
||||||
{
|
{
|
||||||
|
@ -69,12 +69,12 @@ namespace ewol {
|
|||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
ewol::Widget* m_subWidget;
|
ewol::Widget* m_subWidget;
|
||||||
ewol::Widget* m_popUpWidget;
|
etk::VectorType<ewol::Widget*> m_popUpWidgetList;
|
||||||
ewol::Keyboard* m_keyBoardwidget;
|
ewol::Keyboard* m_keyBoardwidget;
|
||||||
public:
|
public:
|
||||||
void SetSubWidget(ewol::Widget * widget);
|
void SetSubWidget(ewol::Widget * widget);
|
||||||
void PopUpWidgetPush(ewol::Widget * widget);
|
void PopUpWidgetPush(ewol::Widget * widget);
|
||||||
void PopUpWidgetPop(void);
|
void PopUpWidgetPop(int32_t popUpId);
|
||||||
protected:
|
protected:
|
||||||
virtual bool OnDraw(void);
|
virtual bool OnDraw(void);
|
||||||
public:
|
public:
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
static ewol::threadMsg::threadMsg_ts androidJniMsg;
|
static ewol::threadMsg::threadMsg_ts androidJniMsg;
|
||||||
static pthread_t androidJniThread;
|
static pthread_t androidJniThread;
|
||||||
//static pthread_attr_t androidJniThreadAttr;
|
static pthread_attr_t androidJniThreadAttr;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
THREAD_INIT,
|
THREAD_INIT,
|
||||||
@ -98,6 +98,22 @@ static void* BaseAppEntry(void* param)
|
|||||||
|
|
||||||
EWOL_INFO("v" EWOL_VERSION_TAG_NAME);
|
EWOL_INFO("v" EWOL_VERSION_TAG_NAME);
|
||||||
EWOL_INFO("Build Date: " VERSION_BUILD_TIME);
|
EWOL_INFO("Build Date: " VERSION_BUILD_TIME);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
struct sched_param pr;
|
||||||
|
int ret = 9;
|
||||||
|
int policy;
|
||||||
|
pthread_getschedparam(pthread_self(), &policy, &pr);
|
||||||
|
EWOL_INFO("Child Thread Up PL" << policy << " PRI" << pr.sched_priority); //The result here
|
||||||
|
policy = SCHED_RR;
|
||||||
|
pr.sched_priority = 19;
|
||||||
|
pthread_setschedparam(pthread_self(), policy, &pr);
|
||||||
|
sleep(1);
|
||||||
|
pthread_getschedparam(pthread_self(), &policy, &pr);
|
||||||
|
EWOL_INFO("Child Thread Up PL" << policy << " PRI" << pr.sched_priority); //The result Set
|
||||||
|
*/
|
||||||
|
|
||||||
ewol::widgetManager::Init();
|
ewol::widgetManager::Init();
|
||||||
ewol::texture::Init();
|
ewol::texture::Init();
|
||||||
ewol::theme::Init();
|
ewol::theme::Init();
|
||||||
@ -230,7 +246,18 @@ void EWOL_SystemStart(void)
|
|||||||
ewol::threadMsg::Init(androidJniMsg);
|
ewol::threadMsg::Init(androidJniMsg);
|
||||||
// init the thread :
|
// init the thread :
|
||||||
EWOL_DEBUG("Create the thread");
|
EWOL_DEBUG("Create the thread");
|
||||||
pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
pthread_attr_init(&androidJniThreadAttr);
|
||||||
|
//pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_JOINABLE)
|
||||||
|
pthread_attr_setdetachstate(&androidJniThreadAttr, PTHREAD_CREATE_DETACHED);
|
||||||
|
//pthread_attr_setscope( &androidJniThreadAttr, PTHREAD_SCOPE_SYSTEM);
|
||||||
|
// try to set prio :
|
||||||
|
struct sched_param pr;
|
||||||
|
pr.sched_priority = 10;
|
||||||
|
pthread_attr_setschedpolicy(&androidJniThreadAttr, SCHED_RR);
|
||||||
|
pthread_attr_setschedparam(&androidJniThreadAttr, &pr);
|
||||||
|
|
||||||
|
pthread_create(&androidJniThread, &androidJniThreadAttr, BaseAppEntry, NULL);
|
||||||
|
//pthread_create(&androidJniThread, NULL, BaseAppEntry, NULL);
|
||||||
isGlobalSystemInit = true;
|
isGlobalSystemInit = true;
|
||||||
EWOL_DEBUG("Send Init message to the thread");
|
EWOL_DEBUG("Send Init message to the thread");
|
||||||
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
|
ewol::threadMsg::SendMessage(androidJniMsg, THREAD_INIT, ewol::threadMsg::MSG_PRIO_REAL_TIME);
|
||||||
|
@ -37,13 +37,19 @@ ewol::Windows* gui_uniqueWindows = NULL;
|
|||||||
etkFloat_t gui_width = 320;
|
etkFloat_t gui_width = 320;
|
||||||
etkFloat_t gui_height = 480;
|
etkFloat_t gui_height = 480;
|
||||||
|
|
||||||
void ewol::RmPopUp(void)
|
void ewol::RmPopUp(int32_t widgetID)
|
||||||
{
|
{
|
||||||
if (NULL != gui_uniqueWindows) {
|
if (NULL != gui_uniqueWindows) {
|
||||||
gui_uniqueWindows->PopUpWidgetPop();
|
gui_uniqueWindows->PopUpWidgetPop(widgetID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::PopUpWidgetPush(ewol::Widget * tmpWidget)
|
||||||
|
{
|
||||||
|
if (NULL != gui_uniqueWindows && NULL != tmpWidget) {
|
||||||
|
gui_uniqueWindows->PopUpWidgetPush(tmpWidget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void EWOL_NativeResize(int w, int h )
|
void EWOL_NativeResize(int w, int h )
|
||||||
{
|
{
|
||||||
|
@ -42,7 +42,8 @@ namespace ewol {
|
|||||||
void KeyboardShow(ewol::keyboardMode_te mode);
|
void KeyboardShow(ewol::keyboardMode_te mode);
|
||||||
void KeyboardHide(void);
|
void KeyboardHide(void);
|
||||||
void ForceRedrawAll(void);
|
void ForceRedrawAll(void);
|
||||||
void RmPopUp(void);
|
void PopUpWidgetPush(ewol::Widget * tmpWidget);
|
||||||
|
void RmPopUp(int32_t widgetID);
|
||||||
int32_t CmdLineNb(void);
|
int32_t CmdLineNb(void);
|
||||||
etk::UString CmdLineGet(int32_t id);
|
etk::UString CmdLineGet(int32_t id);
|
||||||
|
|
||||||
|
@ -44,11 +44,14 @@ void ewol::Button::Init(void)
|
|||||||
AddEventId(ewolEventButtonEnter);
|
AddEventId(ewolEventButtonEnter);
|
||||||
AddEventId(ewolEventButtonLeave);
|
AddEventId(ewolEventButtonLeave);
|
||||||
|
|
||||||
m_padding.x = 4;
|
m_alignement = ewol::TEXT_ALIGN_CENTER;
|
||||||
|
|
||||||
#ifdef __PLATFORM__Android
|
#ifdef __PLATFORM__Android
|
||||||
m_padding.y = 12;
|
m_padding.y = 12;
|
||||||
|
m_padding.x = 12;
|
||||||
#else
|
#else
|
||||||
m_padding.y = 4;
|
m_padding.y = 4;
|
||||||
|
m_padding.x = 4;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
m_textColorFg.red = 0.0;
|
m_textColorFg.red = 0.0;
|
||||||
@ -81,6 +84,11 @@ ewol::Button::~Button(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::Button::SetPadding(coord2D_ts newPadding)
|
||||||
|
{
|
||||||
|
m_padding = newPadding;
|
||||||
|
}
|
||||||
|
|
||||||
bool ewol::Button::CalculateMinSize(void)
|
bool ewol::Button::CalculateMinSize(void)
|
||||||
{
|
{
|
||||||
int32_t fontId = GetDefaultFontId();
|
int32_t fontId = GetDefaultFontId();
|
||||||
@ -103,6 +111,13 @@ void ewol::Button::SetValue(bool val)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ewol::Button::SetAlignement(textAlignement_te typeAlign)
|
||||||
|
{
|
||||||
|
m_alignement = typeAlign;
|
||||||
|
MarkToReedraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::Button::GetValue(void)
|
bool ewol::Button::GetValue(void)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -126,6 +141,9 @@ void ewol::Button::OnRegenerateDisplay(void)
|
|||||||
if (true==m_userFillX) {
|
if (true==m_userFillX) {
|
||||||
tmpSizeX = m_size.x;
|
tmpSizeX = m_size.x;
|
||||||
tmpOriginX = 0;
|
tmpOriginX = 0;
|
||||||
|
if (m_alignement == ewol::TEXT_ALIGN_LEFT) {
|
||||||
|
tmpTextOriginX = m_padding.x;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (true==m_userFillY) {
|
if (true==m_userFillY) {
|
||||||
tmpSizeY = m_size.y;
|
tmpSizeY = m_size.y;
|
||||||
@ -183,7 +201,7 @@ bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, et
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ewol::Button::OnEventKb(eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE])
|
bool ewol::Button::OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE])
|
||||||
{
|
{
|
||||||
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
//EWOL_DEBUG("BT PRESSED : \"" << UTF8_data << "\" size=" << strlen(UTF8_data));
|
||||||
if( UTF8_data != NULL
|
if( UTF8_data != NULL
|
||||||
|
@ -34,6 +34,10 @@ extern const char * const ewolEventButtonEnter;
|
|||||||
extern const char * const ewolEventButtonLeave;
|
extern const char * const ewolEventButtonLeave;
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
typedef enum {
|
||||||
|
TEXT_ALIGN_LEFT,
|
||||||
|
TEXT_ALIGN_CENTER,
|
||||||
|
} textAlignement_te;
|
||||||
class Button :public ewol::Widget
|
class Button :public ewol::Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -46,7 +50,10 @@ namespace ewol {
|
|||||||
etk::UString GetLabel(void) {return m_label;};
|
etk::UString GetLabel(void) {return m_label;};
|
||||||
void SetValue(bool val);
|
void SetValue(bool val);
|
||||||
bool GetValue(void);
|
bool GetValue(void);
|
||||||
|
void SetAlignement(textAlignement_te typeAlign);
|
||||||
|
void SetPadding(coord2D_ts newPadding);
|
||||||
private:
|
private:
|
||||||
|
textAlignement_te m_alignement;
|
||||||
coord2D_ts m_padding;
|
coord2D_ts m_padding;
|
||||||
etk::UString m_label;
|
etk::UString m_label;
|
||||||
color_ts m_textColorFg; //!< Text color
|
color_ts m_textColorFg; //!< Text color
|
||||||
@ -55,7 +62,7 @@ namespace ewol {
|
|||||||
virtual void OnRegenerateDisplay(void);
|
virtual void OnRegenerateDisplay(void);
|
||||||
public:
|
public:
|
||||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
||||||
virtual bool OnEventKb(eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]);
|
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SIZE]);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -24,8 +24,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include <ewol/widget/ContextMenu.h>
|
|
||||||
#include <ewol/ewol.h>
|
#include <ewol/ewol.h>
|
||||||
|
#include <ewol/WidgetManager.h>
|
||||||
|
#include <ewol/widget/ContextMenu.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::ContextMenu"
|
#define __class__ "ewol::ContextMenu"
|
||||||
@ -51,7 +52,8 @@ ewol::ContextMenu::ContextMenu(void)
|
|||||||
m_colorBorder.blue = 0.0;
|
m_colorBorder.blue = 0.0;
|
||||||
m_colorBorder.alpha = 0.50;
|
m_colorBorder.alpha = 0.50;
|
||||||
|
|
||||||
m_arrowPos = {0,0};
|
m_arrowPos.x = 0;
|
||||||
|
m_arrowPos.y = 0;
|
||||||
m_arrawBorder = ewol::CONTEXT_MENU_MARK_TOP;
|
m_arrawBorder = ewol::CONTEXT_MENU_MARK_TOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,7 +101,32 @@ bool ewol::ContextMenu::CalculateSize(etkFloat_t availlableX, etkFloat_t availla
|
|||||||
subWidgetOrigin.y = (int32_t)(m_size.y - m_origin.y - subWidgetSize.y)/2 + m_origin.y;
|
subWidgetOrigin.y = (int32_t)(m_size.y - m_origin.y - subWidgetSize.y)/2 + m_origin.y;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
// set the widget position at the border of the screen
|
||||||
|
subWidgetOrigin.x -= m_padding.x*2;
|
||||||
|
subWidgetOrigin.x = etk_max(0, subWidgetOrigin.x);
|
||||||
|
subWidgetOrigin.x += m_padding.x*2;
|
||||||
|
subWidgetOrigin.x = (int32_t)subWidgetOrigin.x;
|
||||||
|
|
||||||
|
subWidgetOrigin.y -= m_padding.y*2;
|
||||||
|
subWidgetOrigin.y = etk_max(0, subWidgetOrigin.y);
|
||||||
|
subWidgetOrigin.y += m_padding.y*2;
|
||||||
|
subWidgetOrigin.y = (int32_t)subWidgetOrigin.y;
|
||||||
|
switch (m_arrawBorder)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case ewol::CONTEXT_MENU_MARK_TOP:
|
||||||
|
case ewol::CONTEXT_MENU_MARK_BOTTOM:
|
||||||
|
if (m_arrowPos.x <= m_offset ) {
|
||||||
|
subWidgetOrigin.x = m_arrowPos.x+m_padding.x;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ewol::CONTEXT_MENU_MARK_RIGHT:
|
||||||
|
case ewol::CONTEXT_MENU_MARK_LEFT:
|
||||||
|
if (m_arrowPos.y <= m_offset ) {
|
||||||
|
subWidgetOrigin.y = m_arrowPos.y+m_padding.y;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
m_subWidget->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y);
|
m_subWidget->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y);
|
||||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||||
}
|
}
|
||||||
@ -155,7 +182,7 @@ void ewol::ContextMenu::SubWidgetSet(ewol::Widget* newWidget)
|
|||||||
void ewol::ContextMenu::SubWidgetRemove(void)
|
void ewol::ContextMenu::SubWidgetRemove(void)
|
||||||
{
|
{
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
delete(m_subWidget);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget);
|
||||||
m_subWidget = NULL;
|
m_subWidget = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -184,10 +211,27 @@ void ewol::ContextMenu::OnRegenerateDisplay(void)
|
|||||||
|
|
||||||
// display border ...
|
// display border ...
|
||||||
BGOObjects->SetColor(m_colorBorder);
|
BGOObjects->SetColor(m_colorBorder);
|
||||||
|
switch (m_arrawBorder)
|
||||||
|
{
|
||||||
|
case ewol::CONTEXT_MENU_MARK_TOP:
|
||||||
BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y);
|
BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y);
|
||||||
|
if (m_arrowPos.x <= tmpOrigin.x ) {
|
||||||
|
int32_t laking = m_offset - m_padding.y;
|
||||||
|
BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y+laking);
|
||||||
|
BGOObjects->SetPoint(m_arrowPos.x, m_arrowPos.y+laking);
|
||||||
|
} else {
|
||||||
int32_t laking = m_offset - m_padding.y;
|
int32_t laking = m_offset - m_padding.y;
|
||||||
BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y+laking);
|
BGOObjects->SetPoint(m_arrowPos.x+laking, m_arrowPos.y+laking);
|
||||||
BGOObjects->SetPoint(m_arrowPos.x-laking, m_arrowPos.y+laking);
|
BGOObjects->SetPoint(m_arrowPos.x-laking, m_arrowPos.y+laking);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
case ewol::CONTEXT_MENU_MARK_BOTTOM:
|
||||||
|
case ewol::CONTEXT_MENU_MARK_RIGHT:
|
||||||
|
case ewol::CONTEXT_MENU_MARK_LEFT:
|
||||||
|
EWOL_TODO("later");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
BGOObjects->Rectangle(tmpOrigin.x-m_padding.x, tmpOrigin.y - m_padding.y, tmpSize.x + m_padding.x*2, tmpSize.y + m_padding.y*2);
|
BGOObjects->Rectangle(tmpOrigin.x-m_padding.x, tmpOrigin.y - m_padding.y, tmpSize.x + m_padding.x*2, tmpSize.y + m_padding.y*2);
|
||||||
// set the area in white ...
|
// set the area in white ...
|
||||||
@ -220,7 +264,7 @@ bool ewol::ContextMenu::OnEventInput(int32_t IdInput, eventInputType_te typeEven
|
|||||||
|| typeEvent == ewol::EVENT_INPUT_TYPE_UP
|
|| typeEvent == ewol::EVENT_INPUT_TYPE_UP
|
||||||
|| typeEvent == ewol::EVENT_INPUT_TYPE_ENTER
|
|| typeEvent == ewol::EVENT_INPUT_TYPE_ENTER
|
||||||
|| typeEvent == ewol::EVENT_INPUT_TYPE_LEAVE ) {
|
|| typeEvent == ewol::EVENT_INPUT_TYPE_LEAVE ) {
|
||||||
ewol::RmPopUp();
|
ewol::RmPopUp(GetWidgetId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,6 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
|
|
||||||
int32_t tmpOriginX = 0;
|
int32_t tmpOriginX = 0;
|
||||||
int32_t tmpOriginY = 0;
|
int32_t tmpOriginY = 0;
|
||||||
int32_t tmpOriginYBG = 0;
|
|
||||||
/*
|
/*
|
||||||
if (true==m_userFillX) {
|
if (true==m_userFillX) {
|
||||||
tmpOriginX = 0;
|
tmpOriginX = 0;
|
||||||
@ -107,14 +106,21 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
BGOObjects->SetColor(basicBG);
|
BGOObjects->SetColor(basicBG);
|
||||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||||
|
|
||||||
uint32_t displayableRaw = m_size.y / (minHeight + 2*m_paddingSizeY);
|
uint32_t displayableRaw = m_size.y / (minHeight + 2*m_paddingSizeY) +2;
|
||||||
|
|
||||||
int32_t startRaw = m_originScrooled.y / (minHeight + 2*m_paddingSizeY) - 1;
|
int32_t startRaw = m_originScrooled.y / (minHeight + 2*m_paddingSizeY);
|
||||||
|
|
||||||
|
if (startRaw >= nbRaw-1 ) {
|
||||||
|
startRaw = nbRaw - 1;
|
||||||
|
}
|
||||||
if (startRaw<0) {
|
if (startRaw<0) {
|
||||||
startRaw = 0;
|
startRaw = 0;
|
||||||
}
|
}
|
||||||
|
// Calculate the real position ...
|
||||||
|
tmpOriginY = -m_originScrooled.y + startRaw*(minHeight + 2*m_paddingSizeY);
|
||||||
|
|
||||||
// We display only compleate lines ...
|
// We display only compleate lines ...
|
||||||
EWOL_VERBOSE("Request drawing list : " << startRaw << "-->" << (startRaw+displayableRaw) << " in " << nbRaw << "raws");
|
//EWOL_DEBUG("Request drawing list : " << startRaw << "-->" << (startRaw+displayableRaw) << " in " << nbRaw << "raws ; start display : " << m_originScrooled.y << " ==> " << tmpOriginY << " line size=" << minHeight + 2*m_paddingSizeY );
|
||||||
|
|
||||||
clipping_ts drawClipping;
|
clipping_ts drawClipping;
|
||||||
drawClipping.x = 0;
|
drawClipping.x = 0;
|
||||||
@ -128,24 +134,19 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
color_ts bg;
|
color_ts bg;
|
||||||
GetElement(0, iii, myTextToWrite, fg, bg);
|
GetElement(0, iii, myTextToWrite, fg, bg);
|
||||||
BGOObjects->SetColor(bg);
|
BGOObjects->SetColor(bg);
|
||||||
BGOObjects->Rectangle(0, tmpOriginYBG, m_size.x, minHeight+2*m_paddingSizeY);
|
BGOObjects->Rectangle(0, tmpOriginY, m_size.x, minHeight+2*m_paddingSizeY);
|
||||||
tmpOriginYBG += minHeight+2*m_paddingSizeY;
|
|
||||||
|
|
||||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, fg);
|
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, fg);
|
||||||
|
|
||||||
coord2D_ts textPos;
|
coord2D_ts textPos;
|
||||||
textPos.x = tmpOriginX;
|
textPos.x = tmpOriginX;
|
||||||
textPos.y = tmpOriginY;
|
textPos.y = tmpOriginY + m_paddingSizeY;
|
||||||
tmpText->Text(textPos, drawClipping, myTextToWrite);
|
tmpText->Text(textPos, drawClipping, myTextToWrite);
|
||||||
|
|
||||||
AddOObject(tmpText);
|
AddOObject(tmpText);
|
||||||
tmpOriginY += minHeight + 2* m_paddingSizeY;
|
tmpOriginY += minHeight + 2* m_paddingSizeY;
|
||||||
}
|
}
|
||||||
AddOObject(BGOObjects, "ListDeco", 0);
|
AddOObject(BGOObjects, "ListDeco", 0);
|
||||||
//ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
|
||||||
//tmpText->Text(tmpOriginX, tmpOriginY, "jhgjhg");
|
|
||||||
|
|
||||||
//AddOObject(tmpText, "ListText");
|
|
||||||
|
|
||||||
// call the herited class...
|
// call the herited class...
|
||||||
WidgetScrooled::OnRegenerateDisplay();
|
WidgetScrooled::OnRegenerateDisplay();
|
||||||
|
@ -24,8 +24,13 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#include <ewol/ewol.h>
|
||||||
|
#include <ewol/WidgetMessageMultiCast.h>
|
||||||
|
#include <ewol/WidgetManager.h>
|
||||||
#include <ewol/widget/Menu.h>
|
#include <ewol/widget/Menu.h>
|
||||||
#include <ewol/widget/Button.h>
|
#include <ewol/widget/Button.h>
|
||||||
|
#include <ewol/widget/ContextMenu.h>
|
||||||
|
#include <ewol/widget/SizerVert.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::Menu"
|
#define __class__ "ewol::Menu"
|
||||||
@ -33,6 +38,7 @@
|
|||||||
ewol::Menu::Menu(void)
|
ewol::Menu::Menu(void)
|
||||||
{
|
{
|
||||||
m_staticId = 0;
|
m_staticId = 0;
|
||||||
|
m_popUpId = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ewol::Menu::~Menu(void)
|
ewol::Menu::~Menu(void)
|
||||||
@ -85,19 +91,22 @@ int32_t ewol::Menu::Add(int32_t parent, etk::UString label, etk::UString image,
|
|||||||
}
|
}
|
||||||
tmpObject->m_localId = m_staticId++;
|
tmpObject->m_localId = m_staticId++;
|
||||||
tmpObject->m_parentId = parent;
|
tmpObject->m_parentId = parent;
|
||||||
|
tmpObject->m_widgetId = -1;
|
||||||
tmpObject->m_label = label;
|
tmpObject->m_label = label;
|
||||||
tmpObject->m_image = image;
|
tmpObject->m_image = image;
|
||||||
tmpObject->m_generateEvent = generateEvent;
|
tmpObject->m_generateEvent = generateEvent;
|
||||||
tmpObject->m_message = message;
|
tmpObject->m_message = message;
|
||||||
m_listElement.PushBack(tmpObject);
|
m_listElement.PushBack(tmpObject);
|
||||||
if (-1 == tmpObject->m_parentId) {
|
if (-1 == tmpObject->m_parentId) {
|
||||||
ewol::Button * myButton = new ewol::Button(label);
|
ewol::Button * myButton = NULL;
|
||||||
ewol::SizerHori::SubWidgetAdd(myButton);
|
myButton = new ewol::Button(label);
|
||||||
/*
|
if (NULL == myButton) {
|
||||||
if (false == myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), "event ... ") ) {
|
EWOL_ERROR("Allocation button error");
|
||||||
EDN_CRITICAL("link with an entry event");
|
return tmpObject->m_localId;;
|
||||||
}
|
}
|
||||||
*/
|
ewol::SizerHori::SubWidgetAdd(myButton);
|
||||||
|
myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ewolEventButtonPressed);
|
||||||
|
tmpObject->m_widgetId = myButton->GetWidgetId();
|
||||||
}
|
}
|
||||||
return tmpObject->m_localId;
|
return tmpObject->m_localId;
|
||||||
}
|
}
|
||||||
@ -106,3 +115,83 @@ void ewol::Menu::AddSpacer(void)
|
|||||||
{
|
{
|
||||||
EWOL_TODO("NOT now...");
|
EWOL_TODO("NOT now...");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ewol::Menu::OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y)
|
||||||
|
{
|
||||||
|
if (true == ewol::SizerHori::OnEventAreaExternal(widgetID, generateEventId, data, x, y)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (NULL==data && generateEventId==ewolEventButtonPressed) {
|
||||||
|
for(int32_t iii=0; iii<m_listElement.Size(); iii++) {
|
||||||
|
if (widgetID == m_listElement[iii]->m_widgetId) {
|
||||||
|
// 2 posible case
|
||||||
|
if (m_listElement[iii]->m_generateEvent != NULL) {
|
||||||
|
ewol::widgetMessageMultiCast::Send(GetWidgetId(), m_listElement[iii]->m_generateEvent, m_listElement[iii]->m_message);
|
||||||
|
ewol::RmPopUp(m_popUpId);
|
||||||
|
m_popUpId = -1;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
bool findChild = false;
|
||||||
|
for(int32_t jjj=0; jjj<m_listElement.Size(); jjj++) {
|
||||||
|
if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) {
|
||||||
|
findChild = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (false == findChild) {
|
||||||
|
EWOL_WARNING("Event on menu element with no child an no event... label=" << m_listElement[iii]->m_label);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// create a context menu :
|
||||||
|
ewol::ContextMenu * tmpWidget = new ewol::ContextMenu();
|
||||||
|
if (NULL == tmpWidget) {
|
||||||
|
EWOL_ERROR("Allocation Error");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// Get the button widget :
|
||||||
|
coord2D_ts newPosition;
|
||||||
|
newPosition.x = x;
|
||||||
|
newPosition.y = y;
|
||||||
|
ewol::Widget * eventFromWidget = ewol::widgetManager::Get(widgetID);
|
||||||
|
if (NULL != eventFromWidget) {
|
||||||
|
coord tmpOri = eventFromWidget->GetOrigin();
|
||||||
|
coord tmpSize = eventFromWidget->GetSize();
|
||||||
|
// calculate the correct position
|
||||||
|
newPosition.x = tmpOri.x + tmpSize.x/2;
|
||||||
|
newPosition.y = tmpOri.y + tmpSize.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpWidget->SetPositionMark(ewol::CONTEXT_MENU_MARK_TOP, newPosition );
|
||||||
|
|
||||||
|
ewol::SizerVert * mySizerVert = NULL;
|
||||||
|
ewol::Button * myButton = NULL;
|
||||||
|
|
||||||
|
mySizerVert = new ewol::SizerVert();
|
||||||
|
mySizerVert->LockExpendContamination(true);
|
||||||
|
// set it in the pop-up-system :
|
||||||
|
tmpWidget->SubWidgetSet(mySizerVert);
|
||||||
|
|
||||||
|
for(int32_t jjj=0; jjj<m_listElement.Size(); jjj++) {
|
||||||
|
if (m_listElement[iii]->m_localId == m_listElement[jjj]->m_parentId) {
|
||||||
|
myButton = new ewol::Button(m_listElement[jjj]->m_label);
|
||||||
|
if (NULL == myButton) {
|
||||||
|
EWOL_ERROR("Allocation Error");
|
||||||
|
}
|
||||||
|
m_listElement[jjj]->m_widgetId = myButton->GetWidgetId();
|
||||||
|
myButton->ExternLinkOnEvent(ewolEventButtonPressed, GetWidgetId(), ewolEventButtonPressed);
|
||||||
|
myButton->SetExpendX(true);
|
||||||
|
myButton->SetFillX(true);
|
||||||
|
myButton->SetAlignement(ewol::TEXT_ALIGN_LEFT);
|
||||||
|
mySizerVert->SubWidgetAdd(myButton);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_popUpId = tmpWidget->GetWidgetId();
|
||||||
|
ewol::PopUpWidgetPush(tmpWidget);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@ -37,6 +37,7 @@ namespace ewol {
|
|||||||
public :
|
public :
|
||||||
int32_t m_localId;
|
int32_t m_localId;
|
||||||
int32_t m_parentId;
|
int32_t m_parentId;
|
||||||
|
int32_t m_widgetId;
|
||||||
etk::UString m_label;
|
etk::UString m_label;
|
||||||
etk::UString m_image;
|
etk::UString m_image;
|
||||||
const char * m_generateEvent;
|
const char * m_generateEvent;
|
||||||
@ -55,11 +56,14 @@ namespace ewol {
|
|||||||
private:
|
private:
|
||||||
etk::VectorType<MenuElement*> m_listElement;
|
etk::VectorType<MenuElement*> m_listElement;
|
||||||
int32_t m_staticId;
|
int32_t m_staticId;
|
||||||
|
int32_t m_popUpId;
|
||||||
public:
|
public:
|
||||||
void Clear(void);
|
void Clear(void);
|
||||||
int32_t AddTitle(etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = "");
|
int32_t AddTitle(etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = "");
|
||||||
int32_t Add(int32_t parent, etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = "");
|
int32_t Add(int32_t parent, etk::UString label, etk::UString image="", const char * generateEvent = NULL, const etk::UString message = "");
|
||||||
void AddSpacer(void);
|
void AddSpacer(void);
|
||||||
|
|
||||||
|
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * data, etkFloat_t x, etkFloat_t y);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <ewol/widget/PopUp.h>
|
#include <ewol/widget/PopUp.h>
|
||||||
|
#include <ewol/WidgetManager.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::PopUp"
|
#define __class__ "ewol::PopUp"
|
||||||
@ -136,7 +137,7 @@ void ewol::PopUp::SubWidgetSet(ewol::Widget* newWidget)
|
|||||||
void ewol::PopUp::SubWidgetRemove(void)
|
void ewol::PopUp::SubWidgetRemove(void)
|
||||||
{
|
{
|
||||||
if (NULL != m_subWidget) {
|
if (NULL != m_subWidget) {
|
||||||
delete(m_subWidget);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget);
|
||||||
m_subWidget = NULL;
|
m_subWidget = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <ewol/widget/SizerHori.h>
|
#include <ewol/widget/SizerHori.h>
|
||||||
|
#include <ewol/WidgetManager.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::SizerHori"
|
#define __class__ "ewol::SizerHori"
|
||||||
@ -165,7 +166,7 @@ void ewol::SizerHori::SubWidgetRemoveAll(void)
|
|||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||||
if (NULL != m_subWidget[iii]) {
|
if (NULL != m_subWidget[iii]) {
|
||||||
delete(m_subWidget[iii]);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[iii]);
|
||||||
m_subWidget[iii] = NULL;
|
m_subWidget[iii] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -191,7 +192,7 @@ void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget)
|
|||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||||
if (newWidget == m_subWidget[iii]) {
|
if (newWidget == m_subWidget[iii]) {
|
||||||
if (NULL != m_subWidget[iii]) {
|
if (NULL != m_subWidget[iii]) {
|
||||||
delete(m_subWidget[iii]);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[iii]);
|
||||||
m_subWidget[iii] = NULL;
|
m_subWidget[iii] = NULL;
|
||||||
}
|
}
|
||||||
m_subWidget.Erase(iii);
|
m_subWidget.Erase(iii);
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <ewol/widget/SizerVert.h>
|
#include <ewol/widget/SizerVert.h>
|
||||||
|
#include <ewol/WidgetManager.h>
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
@ -167,7 +168,7 @@ void ewol::SizerVert::LockExpendContamination(bool lockExpend)
|
|||||||
void ewol::SizerVert::SubWidgetRemoveAll(void)
|
void ewol::SizerVert::SubWidgetRemoveAll(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||||
delete(m_subWidget[iii]);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[iii]);
|
||||||
m_subWidget[iii] = NULL;
|
m_subWidget[iii] = NULL;
|
||||||
}
|
}
|
||||||
m_subWidget.Clear();
|
m_subWidget.Clear();
|
||||||
@ -191,7 +192,7 @@ void ewol::SizerVert::SubWidgetRemove(ewol::Widget* newWidget)
|
|||||||
}
|
}
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||||
if (newWidget == m_subWidget[iii]) {
|
if (newWidget == m_subWidget[iii]) {
|
||||||
delete(m_subWidget[iii]);
|
ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget[iii]);
|
||||||
m_subWidget[iii] = NULL;
|
m_subWidget[iii] = NULL;
|
||||||
m_subWidget.Erase(iii);
|
m_subWidget.Erase(iii);
|
||||||
return;
|
return;
|
||||||
|
@ -109,7 +109,7 @@ bool ewol::WidgetScrooled::OnEventInput(int32_t IdInput, ewol::eventInputType_te
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||||
EWOL_INFO("mouse-event GDK_SCROLL_UP");
|
//EWOL_INFO("mouse-event GDK_SCROLL_UP");
|
||||||
m_originScrooled.y -= m_pixelScrolling;
|
m_originScrooled.y -= m_pixelScrolling;
|
||||||
if (m_originScrooled.y < 0) {
|
if (m_originScrooled.y < 0) {
|
||||||
m_originScrooled.y = 0;
|
m_originScrooled.y = 0;
|
||||||
@ -117,7 +117,7 @@ bool ewol::WidgetScrooled::OnEventInput(int32_t IdInput, ewol::eventInputType_te
|
|||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
return true;
|
return true;
|
||||||
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||||
EWOL_INFO("mouse-event GDK_SCROLL_DOWN");
|
//EWOL_INFO("mouse-event GDK_SCROLL_DOWN");
|
||||||
m_originScrooled.y += m_pixelScrolling;
|
m_originScrooled.y += m_pixelScrolling;
|
||||||
if (m_maxSize.y < m_originScrooled.y) {
|
if (m_maxSize.y < m_originScrooled.y) {
|
||||||
m_originScrooled.y = m_maxSize.y;
|
m_originScrooled.y = m_maxSize.y;
|
||||||
|
@ -528,7 +528,7 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
|
|||||||
} else if (ewolEventFileChooserCancel == generateEventId) {
|
} else if (ewolEventFileChooserCancel == generateEventId) {
|
||||||
//==> Auto remove ...
|
//==> Auto remove ...
|
||||||
bool tmppp = GenEventInputExternal(generateEventId, x, y);
|
bool tmppp = GenEventInputExternal(generateEventId, x, y);
|
||||||
ewol::RmPopUp();
|
ewol::RmPopUp(GetWidgetId());
|
||||||
return tmppp;
|
return tmppp;
|
||||||
} else if (ewolEventFileChooserHidenFileChange == generateEventId) {
|
} else if (ewolEventFileChooserHidenFileChange == generateEventId) {
|
||||||
// regenerate the display ...
|
// regenerate the display ...
|
||||||
@ -568,7 +568,7 @@ bool ewol::FileChooser::OnEventAreaExternal(int32_t widgetID, const char * gener
|
|||||||
} else if (ewolEventFileChooserValidateFile == generateEventId) {
|
} else if (ewolEventFileChooserValidateFile == generateEventId) {
|
||||||
// select the File ==> generate a validate
|
// select the File ==> generate a validate
|
||||||
bool tmppp = GenEventInputExternal(ewolEventFileChooserValidate, x, y);
|
bool tmppp = GenEventInputExternal(ewolEventFileChooserValidate, x, y);
|
||||||
ewol::RmPopUp();
|
ewol::RmPopUp(GetWidgetId());
|
||||||
return tmppp;
|
return tmppp;
|
||||||
} else if (ewolEventFileChooserValidate == generateEventId && false == m_hasSelectedFile) {
|
} else if (ewolEventFileChooserValidate == generateEventId && false == m_hasSelectedFile) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -72,6 +72,7 @@ ewol::Keyboard::~Keyboard(void)
|
|||||||
(widget)->SetExpendX(true); \
|
(widget)->SetExpendX(true); \
|
||||||
(widget)->SetFillX(true); \
|
(widget)->SetFillX(true); \
|
||||||
(widget)->SetCanHaveFocus(false); \
|
(widget)->SetCanHaveFocus(false); \
|
||||||
|
(widget)->SetPadding(newPadding); \
|
||||||
(upperWidget)->SubWidgetAdd((widget)); \
|
(upperWidget)->SubWidgetAdd((widget)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -84,6 +85,10 @@ void ewol::Keyboard::SetMode(keyboardMode_te mode)
|
|||||||
ewol::SizerHori * mySizerHori = NULL;
|
ewol::SizerHori * mySizerHori = NULL;
|
||||||
ewol::Button * myButton = NULL;
|
ewol::Button * myButton = NULL;
|
||||||
|
|
||||||
|
coord2D_ts newPadding;
|
||||||
|
newPadding.y = 20;
|
||||||
|
newPadding.x = 12;
|
||||||
|
|
||||||
mySizerVert = new ewol::SizerVert();
|
mySizerVert = new ewol::SizerVert();
|
||||||
m_subWidget = mySizerVert;
|
m_subWidget = mySizerVert;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user