Remove windows internal decoration ==> think at it later ... and first compilation of edn with it

This commit is contained in:
Edouard Dupin 2012-01-11 15:30:34 +01:00
parent fcefec4958
commit bc0afc31f8
13 changed files with 109 additions and 182 deletions

View File

@ -22,8 +22,8 @@
*******************************************************************************
*/
#ifndef __TOOLS_MEMORY_H__
#define __TOOLS_MEMORY_H__
#ifndef __ETK_TOOLS_MEMORY_H__
#define __ETK_TOOLS_MEMORY_H__
#ifndef ETK_MEMORY_CHECKER
#define ETK_MEMORY_CHECKER 0

View File

@ -1554,7 +1554,7 @@ template<class CLASS_TYPE> class RegExpNodePThese : public RegExpNode<CLASS_TYPE
#define __class__ "etk::RegExp"
// Regular expression manager
template<class CLASS_TYPE> class etkRegExp {
template<class CLASS_TYPE> class RegExp {
// public API :
public:
// create the regular expression
@ -1564,7 +1564,7 @@ template<class CLASS_TYPE> class etkRegExp {
* @param[in,out]
* @return
*/
etkRegExp(const char *exp)
RegExp(const char *exp)
{
m_isOk = false;
m_areaFind.start=0;
@ -1579,7 +1579,7 @@ template<class CLASS_TYPE> class etkRegExp {
* @param[in,out]
* @return
*/
etkRegExp(etk::String &exp)
RegExp(etk::String &exp)
{
m_isOk = false;
m_areaFind.start=0;
@ -1594,7 +1594,7 @@ template<class CLASS_TYPE> class etkRegExp {
* @param[in,out]
* @return
*/
etkRegExp(void)
RegExp(void)
{
m_isOk = false;
m_areaFind.start=0;
@ -1608,7 +1608,7 @@ template<class CLASS_TYPE> class etkRegExp {
* @param[in,out]
* @return
*/
~etkRegExp(void)
~RegExp(void)
{
// TODO : remove all under nodes...
m_isOk = false;

View File

@ -43,6 +43,14 @@ namespace etk {
}
return (static_cast<T*> (_singleton));
}
static T *getInstance()
{
if (NULL == _singleton)
{
_singleton = new T;
}
return (static_cast<T*> (_singleton));
}
static void Kill()
{
if (NULL != _singleton)

View File

@ -54,41 +54,10 @@ ewol::Windows::Windows(void)
m_subWidget = NULL;
m_popUpWidget = NULL;
m_keyBoardwidget = NULL;
m_keyboardShow = false;
// enable specific drawing system ...
SpecificDrawEnable();
SetDecorationDisable();
if (true == m_hasDecoration) {
ewol::OObject2DColored * myOObject = new ewol::OObject2DColored();
// Close
myOObject->SetColor(1.0, 0.0, 0.0, 1.0);
myOObject->Rectangle( 0, 0, 20, 20);
// Reduce
myOObject->SetColor(0.0, 1.0, 0.0, 1.0);
myOObject->Rectangle(20, 0, 20, 20);
// Expend - Un-expend
myOObject->SetColor(0.0, 0.0, 1.0, 1.0);
myOObject->Rectangle(40, 0, 20, 20);
coord origin;
coord size;
origin.x = 0.0;
origin.y = 0.0;
size.x = 20;
size.y = 20;
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventWindowsClose);
origin.x = 20.0;
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventWindowsMinimize);
origin.x = 40.0;
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventWindowsExpend);
AddOObject(myOObject, "leftBoutton");
ewol::OObject2DText * myOObjectText = new ewol::OObject2DText();
myOObjectText->Text(62, 2, "My Title ...", m_size.x-2);
AddOObject(myOObjectText, "Title");
}
KeyboardShow(KEYBOARD_MODE_CODE);
//KeyboardShow(KEYBOARD_MODE_CODE);
}
ewol::Windows::~Windows(void)
@ -112,7 +81,7 @@ bool ewol::Windows::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY
m_size.x = availlableX;
m_size.y = availlableY;
int32_t keyboardHigh = 0;
if (NULL != m_keyBoardwidget && true == m_keyboardShow ) {
if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) {
m_keyBoardwidget->CalculateMinSize();
coord tmpSize = m_keyBoardwidget->GetMinSize();
keyboardHigh = (int32_t)tmpSize.y;
@ -137,23 +106,7 @@ bool ewol::Windows::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY
bool ewol::Windows::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
{
if (true == m_hasDecoration) {
if( x >= 60
&& y <=20)
{
if(EVENT_INPUT_TYPE_MOVE == typeEvent && true == ewol::IsPressedInput(1) ) {
ewol::StartMoveSystem();
}
}
if( x >= m_size.x - 20
&& y >= m_size.y - 20)
{
if(EVENT_INPUT_TYPE_MOVE == typeEvent && true == ewol::IsPressedInput(1) ) {
ewol::StartResizeSystem();
}
}
}
if (NULL != m_keyBoardwidget && true == m_keyboardShow ) {
if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) {
coord tmpSize = m_keyBoardwidget->GetMinSize();
if (y > m_size.y - tmpSize.y) {
m_keyBoardwidget->GenEventInput(IdInput, typeEvent, x, y);
@ -216,7 +169,7 @@ void ewol::Windows::OnRegenerateDisplay(void)
if (NULL != m_popUpWidget) {
m_popUpWidget->OnRegenerateDisplay();
}
if (NULL != m_keyBoardwidget && true == m_keyboardShow ) {
if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) {
m_keyBoardwidget->OnRegenerateDisplay();
}
}
@ -234,7 +187,7 @@ bool ewol::Windows::OnDraw(void)
m_popUpWidget->GenDraw();
//EWOL_DEBUG("Draw Pop-up");
}
if (NULL != m_keyBoardwidget && true == m_keyboardShow ) {
if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) {
m_keyBoardwidget->GenDraw();
//EWOL_DEBUG("Draw Pop-up");
}
@ -311,11 +264,18 @@ bool ewol::Windows::OnEventAreaExternal(int32_t widgetID, const char * generateE
void ewol::Windows::KeyboardShow(ewol::keyboardMode_te mode)
{
m_keyboardShow = true;
if (NULL == m_keyBoardwidget) {
// Create the keyboard ...
m_keyBoardwidget = new ewol::Keyboard(GetWidgetId());
m_keyBoardwidget->ExternLinkOnEvent("ewol event Keyboard request hide", GetWidgetId(), ewolEventWindowsHideKeyboard );
m_keyBoardwidget = new ewol::Keyboard();
if (NULL == m_keyBoardwidget) {
EWOL_ERROR("Fail to initialize memory");
} else {
m_keyBoardwidget->ExternLinkOnEvent("ewol event Keyboard request hide", GetWidgetId(), ewolEventWindowsHideKeyboard );
m_keyBoardwidget->SetParrent(this);
}
}
if (NULL != m_keyBoardwidget) {
m_keyBoardwidget->Show();
}
CalculateSize(m_size.x, m_size.y);
OnRegenerateDisplay();
@ -324,8 +284,10 @@ void ewol::Windows::KeyboardShow(ewol::keyboardMode_te mode)
void ewol::Windows::KeyboardHide(void)
{
m_keyboardShow = false;
EWOL_INFO("Request Hide keyboard");
if (NULL != m_keyBoardwidget) {
m_keyBoardwidget->Hide();
}
CalculateSize(m_size.x, m_size.y);
OnRegenerateDisplay();
}

View File

@ -75,7 +75,6 @@ namespace ewol {
ewol::Widget* m_subWidget;
ewol::Widget* m_popUpWidget;
ewol::Keyboard* m_keyBoardwidget;
bool m_keyboardShow;
public:
void SetSubWidget(ewol::Widget * widget);
void PopUpWidgetPush(ewol::Widget * widget);

View File

@ -41,9 +41,9 @@ namespace guiAbstraction
void ChangeSize(int32_t w, int32_t h);
void ChangePos(int32_t x, int32_t y);
void GetAbsPos(int32_t & x, int32_t & y);
void StartResizeSystem(void);
void StartMoveSystem(void);
bool IsPressedInput(int32_t inputID);
void KeyboardShow(ewol::keyboardMode_te mode);
void KeyboardHide(void);
void ForceRedrawAll(void);
void SendKeyboardEvent(bool isDown, etk::String &keyInput);
};

View File

@ -523,24 +523,6 @@ void guiAbstraction::GetAbsPos(int32_t & x, int32_t & y)
}
}
void guiAbstraction::StartResizeSystem(void)
{
if (true == guiAbstractionIsInit) {
//myX11Access->StartResizeSystem();
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
void guiAbstraction::StartMoveSystem(void)
{
if (true == guiAbstractionIsInit) {
//myX11Access->StartMoveSystem();
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
bool guiAbstraction::IsPressedInput(int32_t inputID)
{
//if (true == guiAbstractionIsInit) {
@ -551,6 +533,20 @@ bool guiAbstraction::IsPressedInput(int32_t inputID)
//}
}
void guiAbstraction::KeyboardShow(ewol::keyboardMode_te mode)
{
if (NULL != m_uniqueWindows) {
m_uniqueWindows->KeyboardShow(mode);
}
}
void guiAbstraction::KeyboardHide(void)
{
if (NULL != m_uniqueWindows) {
m_uniqueWindows->KeyboardHide();
}
}
void guiAbstraction::ForceRedrawAll(void)
{
if (NULL != m_uniqueWindows) {

View File

@ -405,8 +405,6 @@ namespace guiAbstraction {
m_previous_y = -1;
m_previousTime = 0;
m_previousDouble = false;
m_resizeMode=false;
m_moveMode=false;
m_originX = 0;
m_originY = 0;
m_cursorEventX = 0;
@ -501,8 +499,6 @@ namespace guiAbstraction {
break;
case ButtonPress:
{
m_moveMode = false;
m_resizeMode = false;
int32_t btId = event.xbutton.button;
EWOL_VERBOSE("X11 bt=" << btId << " event : " << event.type << "=\"ButtonPress\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")");
// Send Down message
@ -532,8 +528,6 @@ namespace guiAbstraction {
break;
case ButtonRelease:
{
m_moveMode = false;
m_resizeMode = false;
int32_t btId = event.xbutton.button;
EWOL_VERBOSE("X11 bt=" << btId << " event : " << event.type << "=\"ButtonRelease\" (" << (etkFloat_t)event.xbutton.x << "," << (etkFloat_t)event.xbutton.y << ")");
// send Up event ...
@ -611,25 +605,11 @@ namespace guiAbstraction {
}
break;
case EnterNotify:
m_resizeMode = false;
m_moveMode = false;
//EWOL_DEBUG("X11 event : " << event.type << " = \"EnterNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_ENTER, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y);
break;
case MotionNotify:
if (true == m_resizeMode) {
if (m_cursorEventX >=50 && m_cursorEventY >=50) {
ChangeSize(m_cursorEventX, m_cursorEventY);
}
} else if (true == m_moveMode) {
int32_t tmpX, tmpY;
this->GetAbsPos(tmpX, tmpY);
//EWOL_DEBUG("Current absolute position : " << tmpX << "x" << tmpY);
int32_t newPosX = (m_startX - m_screenOffsetX) - (m_startX - tmpX);
int32_t newPosY = (m_startY - m_screenOffsetY) - (m_startY - tmpY);
//EWOL_DEBUG("Change POS : (" << (m_startY - m_screenOffsetX) << "," << (m_startY - m_screenOffsetY) << ") ==> (" << newPosX << "," << newPosY << ")");
this->ChangePos(newPosX, newPosY);
} else {
{
// For compatibility of the Android system :
bool findOne = false;
for (int32_t iii=0; iii<NB_MAX_INPUT ; iii++) {
@ -646,20 +626,14 @@ namespace guiAbstraction {
}
break;
case LeaveNotify:
m_resizeMode = false;
m_moveMode = false;
//EWOL_DEBUG("X11 event : " << event.type << " = \"LeaveNotify\" (" << (etkFloat_t)event.xcrossing.x << "," << (etkFloat_t)event.xcrossing.y << ")");
m_uniqueWindows->GenEventInput(0, ewol::EVENT_INPUT_TYPE_LEAVE, (etkFloat_t)event.xcrossing.x, (etkFloat_t)event.xcrossing.y);
break;
case FocusIn:
m_resizeMode = false;
m_moveMode = false;
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusIn\"");
m_uniqueWindows->SetFocus();
break;
case FocusOut:
m_resizeMode = false;
m_moveMode = false;
EWOL_VERBOSE("X11 event : " << event.type << " = \"FocusOut\"");
m_uniqueWindows->RmFocus();
break;
@ -723,6 +697,20 @@ namespace guiAbstraction {
XQueryPointer(m_display, WindowHandle, &fromroot, &tmpwin, &x, &y, &tmp, &tmp, &tmp2);
};
void KeyboardShow(ewol::keyboardMode_te mode)
{
if (NULL != m_uniqueWindows) {
m_uniqueWindows->KeyboardShow(mode);
}
}
void KeyboardHide(void)
{
if (NULL != m_uniqueWindows) {
m_uniqueWindows->KeyboardHide();
}
ForceRedrawAll();
}
void ForceRedrawAll(void)
{
if (NULL != m_uniqueWindows) {
@ -731,33 +719,12 @@ namespace guiAbstraction {
};
private:
bool m_resizeMode;
bool m_moveMode;
/*
int32_t m_startX;
int32_t m_startY;
int32_t m_screenOffsetX;
int32_t m_screenOffsetY;
public:
void StartResizeSystem(void)
{
EWOL_INFO("Start Resizing the windows");
m_resizeMode = true;
this->GetAbsPos(m_startX, m_startY);
m_screenOffsetX = m_cursorEventX;
m_screenOffsetY = m_cursorEventY;
};
public:
// TODO : need to Check all of this... to write a better code... if needed...
void StartMoveSystem(void)
{
EWOL_INFO("Start Moving the windows");
m_moveMode=true;
this->GetAbsPos(m_startX, m_startY);
EWOL_DEBUG("ref pos : (" << m_startX << "," << m_startY << ") (" << m_cursorEventX << "," << m_cursorEventY << ")");
m_screenOffsetX = m_cursorEventX;
m_screenOffsetY = m_cursorEventY;
};
*/
private:
bool inputIsPressed[20];
public:
@ -867,24 +834,6 @@ void guiAbstraction::GetAbsPos(int32_t & x, int32_t & y)
}
}
void guiAbstraction::StartResizeSystem(void)
{
if (true == guiAbstractionIsInit) {
myX11Access->StartResizeSystem();
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
void guiAbstraction::StartMoveSystem(void)
{
if (true == guiAbstractionIsInit) {
myX11Access->StartMoveSystem();
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
bool guiAbstraction::IsPressedInput(int32_t inputID)
{
if (true == guiAbstractionIsInit) {
@ -895,6 +844,24 @@ bool guiAbstraction::IsPressedInput(int32_t inputID)
}
}
void guiAbstraction::KeyboardShow(ewol::keyboardMode_te mode)
{
if (true == guiAbstractionIsInit) {
myX11Access->KeyboardShow(mode);
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
void guiAbstraction::KeyboardHide(void)
{
if (true == guiAbstractionIsInit) {
myX11Access->KeyboardHide();
} else {
EWOL_CRITICAL("X11 ==> not init ... ");
}
}
void guiAbstraction::ForceRedrawAll(void)
{
if (true == guiAbstractionIsInit) {

View File

@ -65,26 +65,21 @@ void ewol::GetAbsPos(int32_t & x, int32_t & y)
}
void ewol::StartResizeSystem(void)
{
#ifdef __PLATFORM__Linux
guiAbstraction::StartResizeSystem();
#endif
}
void ewol::StartMoveSystem(void)
{
#ifdef __PLATFORM__Linux
guiAbstraction::StartMoveSystem();
#endif
}
bool ewol::IsPressedInput(int32_t inputID)
{
return guiAbstraction::IsPressedInput(inputID);
}
void ewol::KeyboardShow(ewol::keyboardMode_te mode)
{
guiAbstraction::KeyboardShow(mode);
}
void ewol::KeyboardHide(void)
{
guiAbstraction::KeyboardHide();
}
void ewol::ForceRedrawAll(void)
{
guiAbstraction::ForceRedrawAll();

View File

@ -39,9 +39,9 @@ namespace ewol {
void ChangeSize(int32_t w, int32_t h);
void ChangePos(int32_t x, int32_t y);
void GetAbsPos(int32_t & x, int32_t & y);
void StartResizeSystem(void);
void StartMoveSystem(void);
bool IsPressedInput(int32_t inputID);
void KeyboardShow(ewol::keyboardMode_te mode);
void KeyboardHide(void);
void ForceRedrawAll(void);
};

View File

@ -26,6 +26,7 @@
#include <ewol/widget/Entry.h>
#include <ewol/OObject.h>
#include <ewol/WidgetManager.h>
#include <ewol/ewol.h>
const char * const ewolEventEntryClick = "ewol Entry click";
@ -176,6 +177,7 @@ bool ewol::Entry::OnEventArea(const char * generateEventId, etkFloat_t x, etkFlo
EWOL_INFO("Entry Clicked ... " << m_data);
eventIsOK = true;
ewol::widgetManager::FocusKeep(this);
ewol::KeyboardShow(KEYBOARD_MODE_CODE);
} else if(ewolEventEntryEnter == generateEventId) {
//OnRegenerateDisplay();
}

View File

@ -33,6 +33,7 @@
#include <ewol/WidgetManager.h>
//#include <etk/Vector.h>
#include <etk/VectorType.h>
#include <ewol/ewol.h>
#include <ewol/base/gui.h>
@ -49,14 +50,14 @@ const char * const ewolEventKeyboardHide = "ewol event Keyboard request hide";
const char * const ewolEventKeyEvent = "ewol event internal key event";
ewol::Keyboard::Keyboard(int32_t windowsID)
ewol::Keyboard::Keyboard(void)
{
// set event that can propagate outside ....
AddEventId(ewolEventKeyboardHide);
SpecificDrawEnable();
m_mode = KEYBOARD_MODE_TEXT;
m_windowsID = windowsID;
m_isHide = true;
SetMode(m_mode);
}
@ -83,7 +84,6 @@ void ewol::Keyboard::SetMode(keyboardMode_te mode)
ewol::SizerVert * mySizerVert = NULL;
ewol::SizerHori * mySizerHori = NULL;
ewol::Button * myButton = NULL;
ewol::Spacer * mySpacer = NULL;
mySizerVert = new ewol::SizerVert();
m_subWidget = mySizerVert;
@ -190,12 +190,8 @@ bool ewol::Keyboard::OnEventAreaExternal(int32_t widgetID, const char * generate
guiAbstraction::SendKeyboardEvent(false, data);
return true;
} else if (ewolEventKeyboardHide == eventExternId) {
EWOL_INFO("plop1 : " << m_windowsID);
ewol::Widget * tmpWidget = ewol::widgetManager::Get(m_windowsID);
if (NULL != tmpWidget) {
EWOL_INFO(" find .. ");
((ewol::Windows*)tmpWidget)->KeyboardHide();
}
Hide();
ewol::ForceRedrawAll();
}
//return GenEventInputExternal(eventExternId, x, y);
return true;
@ -227,7 +223,6 @@ bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlable
if (NULL != m_subWidget) {
coord subWidgetSize;
coord subWidgetOrigin;
subWidgetSize = m_subWidget->GetMinSize();
if (true == m_subWidget->CanExpentX()) {
subWidgetSize.x = m_size.x;

View File

@ -38,14 +38,17 @@ namespace ewol {
class Keyboard : public ewol::Widget
{
public:
Keyboard(int32_t windowsID);
Keyboard(void);
~Keyboard(void);
virtual bool OnEventAreaExternal(int32_t widgetID, const char * generateEventId, const char * eventExternId, etkFloat_t x, etkFloat_t y);
void SetMode(keyboardMode_te mode);
bool IsHide(void) { return m_isHide; };
void Hide(void) { m_isHide=true; };
void Show(void) { m_isHide=false; };
private:
bool m_isHide;
keyboardMode_te m_mode;
ewol::Widget* m_subWidget;
int32_t m_windowsID;
ewol::Widget* m_subWidget;
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