diff --git a/Sources/libewol/ewol/OObject/e2d.cpp b/Sources/libewol/ewol/OObject/e2d.cpp deleted file mode 100644 index 353ecee3..00000000 --- a/Sources/libewol/ewol/OObject/e2d.cpp +++ /dev/null @@ -1,211 +0,0 @@ -/** - ******************************************************************************* - * @file ewol/OObject/2DColored.cpp - * @brief ewol OpenGl Object system (Sources) - * @author Edouard DUPIN - * @date 09/11/2011 - * @par Project - * ewol - * - * @par Copyright - * Copyright 2011 Edouard DUPIN, all right reserved - * - * This software is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY. - * - * Licence summary : - * You can modify and redistribute the sources code and binaries. - * You can send me the bug-fix - * - * Term of the licence in in the file licence.txt. - * - ******************************************************************************* - */ - -#include -#include -#include - - -#undef __class__ -#define __class__ "OObject::e2d" - - -ewol::oobject::e2d::e2d(void) -{ - m_size.x = 30; - m_size.y = 30; -} - -ewol::oobject::e2d::e2d(etk::File file) -{ - LoadFile(file); -} - - -ewol::oobject::e2d::~e2d(void) -{ - -} - - -void ewol::oobject::e2d::Draw(void) -{ - if (m_coord.Size()<=0) { - return; - } - glPushMatrix(); - // Enable Pointers - glEnableClientState( GL_VERTEX_ARRAY ); - glEnableClientState( GL_COLOR_ARRAY ); - - etkFloat_t minimum = etk_min(m_size.x, m_size.y); - glScalef( minimum, minimum, 1.0 ); - //glScalef( 30.0, 30.0, 1.0 ); - - // Set the vertex pointer to our vertex data - glVertexPointer(2, oglTypeFloat_t, 0, &m_coord[0] ); - glColorPointer(4, oglTypeFloat_t, 0, &m_coordColor[0] ); - // Render : draw all of the triangles at once - glDrawArrays( GL_TRIANGLES, 0, m_coord.Size()); - - - // Disable Pointers - glDisableClientState( GL_COLOR_ARRAY ); - glDisableClientState( GL_VERTEX_ARRAY ); - glPopMatrix(); -} - - -void ewol::oobject::e2d::LoadFile(etk::File file) -{ - m_fileName = file; - // Remove all local elements : - m_dotList.Clear(); - m_linkList.Clear(); - - EWOL_DEBUG("open file (e2d) \"" << m_fileName << "\""); - - // allocate the document in the stack - TiXmlDocument XmlDocument; - if (false == m_fileName.Exist()) { - EWOL_ERROR("File Does not exist : " << m_fileName); - return; - } - int32_t fileSize = m_fileName.Size(); - if (0==fileSize) { - EWOL_ERROR("This file is empty : " << m_fileName); - return; - } - if (false == m_fileName.fOpenRead()) { - EWOL_ERROR("Can not open the file : " << m_fileName); - return; - } - // allocate data - char * fileBuffer = new char[fileSize+5]; - if (NULL == fileBuffer) { - EWOL_ERROR("Error Memory allocation size=" << m_fileName); - return; - } - memset(fileBuffer, 0, (fileSize+5)*sizeof(char)); - // load data from the file : - m_fileName.fRead(fileBuffer, 1, fileSize); - // close the file: - m_fileName.fClose(); - // load the XML from the memory - XmlDocument.Parse((const char*)fileBuffer, 0, TIXML_ENCODING_UTF8); - - TiXmlElement* root = XmlDocument.FirstChildElement( "e2d" ); - if (NULL == root ) { - EWOL_ERROR("(l ?) main node not find: \"e2d\" in \"" << m_fileName << "\""); - return; - } else { - - for(TiXmlNode * pNode = root->FirstChild(); - NULL != pNode; - pNode = pNode->NextSibling() ) { - if (pNode->Type()==TiXmlNode::TINYXML_COMMENT) { - // nothing to do, just proceed to next step - } else if (!strcmp(pNode->Value(), "element")) { - for(TiXmlNode * pGuiNode = pNode->FirstChild(); - NULL != pGuiNode; - pGuiNode = pGuiNode->NextSibling()) { - if (pGuiNode->Type()==TiXmlNode::TINYXML_COMMENT) { - // nothing to do, just proceed to next step - } else if (!strcmp(pGuiNode->Value(), "dot")) { - const char *xxx = pGuiNode->ToElement()->Attribute("x"); - const char *yyy = pGuiNode->ToElement()->Attribute("y"); - - if( NULL != xxx - && NULL != yyy) { - coord2D_ts pos; - double posX, posY; - sscanf(xxx, "%lf", &posX); - sscanf(yyy, "%lf", &posY); - pos.x = posX; - pos.y = posY; - EWOL_VERBOSE("load dot : " << xxx << "," << yyy << " ==>" << pos); - m_dotList.PushBack(pos); - } - } else if (!strcmp(pGuiNode->Value(), "link")) { - const char *id[3]; - const char *color[3]; - id[0] = pGuiNode->ToElement()->Attribute("id1"); - id[1] = pGuiNode->ToElement()->Attribute("id2"); - id[2] = pGuiNode->ToElement()->Attribute("id3"); - color[0] = pGuiNode->ToElement()->Attribute("color1"); - color[1] = pGuiNode->ToElement()->Attribute("color2"); - color[2] = pGuiNode->ToElement()->Attribute("color3"); - - if( NULL != id[0] - && NULL != id[1] - && NULL != id[2] - && NULL != color[0] - && NULL != color[1] - && NULL != color[2]) { - link_ts localLink; - int r=0; - int v=0; - int b=0; - int a=-1; - for(int32_t kkk=0; kkk<3; kkk++) { - sscanf(id[kkk], "%d", &localLink.dot[kkk]); - sscanf(color[kkk], "#%02x%02x%02x%02x", &r, &v, &b, &a); - localLink.color[kkk].red = (float)r/255.0; - localLink.color[kkk].green = (float)v/255.0; - localLink.color[kkk].blue = (float)b/255.0; - if (-1 == a) { - localLink.color[kkk].alpha = 1; - } else { - localLink.color[kkk].alpha = (float)a/255.0; - } - } - EWOL_VERBOSE("load link : [" << localLink.dot[0] << "," << localLink.dot[1] << "," << localLink.dot[2] << "] "); - EWOL_VERBOSE(" col: [" << localLink.color[0] << "," << localLink.color[1] << "," << localLink.color[2] << "] "); - m_linkList.PushBack(localLink); - } - } else { - EWOL_ERROR("(l "<Row()<<") node not suported : \""<Value()<<"\" must be [dot,link]"); - } - } - } else { - EWOL_ERROR("(l "<Row()<<") node not suported : \""<Value()<<"\" must be [element]"); - } - } - } - if (NULL != fileBuffer) { - delete[] fileBuffer; - } - // Generate the drawing : - - for (int32_t iii=0; iii -#include - - -typedef struct { - int32_t dot[3]; - color_ts color[3]; -} link_ts; - - -namespace ewol { - namespace oobject { - class e2d :public ewol::OObject2DColored - { - protected: - etk::VectorType m_dotList; //!< list of all point in the buffer - etk::VectorType m_linkList; //!< List of all triangle in the mesh - etk::File m_fileName; //!< e2d file name ... - coord2D_ts m_size; //!< User requested Size ... - public: - e2d(void); - e2d(etk::File file); - virtual ~e2d(void); - void LoadFile(etk::File file); - void SetSize(coord2D_ts newSize) { m_size = newSize; m_size.x=etk_max(m_size.x,0); m_size.y=etk_max(m_size.y,0);}; - virtual void Draw(void); - }; - }; -}; - -#endif - diff --git a/Sources/libewol/ewol/Windows.cpp b/Sources/libewol/ewol/Windows.cpp index 1c25d0f9..e3f90c99 100644 --- a/Sources/libewol/ewol/Windows.cpp +++ b/Sources/libewol/ewol/Windows.cpp @@ -50,7 +50,6 @@ ewol::Windows::Windows(void) for(int32_t iii=0; iiiMarkToRemove(); - m_keyBoardwidget=NULL; - } } //!< EObject name : @@ -119,24 +113,16 @@ bool ewol::Windows::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY //EWOL_DEBUG("calculateMinSize on : " << m_currentCreateId); m_size.x = availlableX; m_size.y = availlableY; - int32_t keyboardHigh = 0; - if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) { - m_keyBoardwidget->CalculateMinSize(); - coord2D_ts tmpSize = m_keyBoardwidget->GetMinSize(); - keyboardHigh = (int32_t)tmpSize.y; - m_keyBoardwidget->SetOrigin(0, m_size.y - keyboardHigh); - m_keyBoardwidget->CalculateSize(m_size.x, keyboardHigh); - } if (NULL != m_subWidget[m_currentCreateId]) { m_subWidget[m_currentCreateId]->CalculateMinSize(); // TODO : Check if min Size is possible ... // TODO : Herited from MinSize .. and expand ??? - m_subWidget[m_currentCreateId]->CalculateSize(m_size.x, m_size.y - keyboardHigh); + m_subWidget[m_currentCreateId]->CalculateSize(m_size.x, m_size.y); } for(int32_t iii=0; iiiCalculateMinSize(); - m_popUpWidgetList[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y - keyboardHigh); + m_popUpWidgetList[m_currentCreateId][iii]->CalculateSize(m_size.x, m_size.y); } } return true; @@ -152,13 +138,6 @@ ewol::Widget * ewol::Windows::GetWidgetAtPos(coord2D_ts pos) { // calculate relative position coord2D_ts relativePos = RelativePosition(pos); - - if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) { - coord2D_ts tmpSize = m_keyBoardwidget->GetMinSize(); - if (relativePos.y > m_size.y - tmpSize.y) { - return m_keyBoardwidget->GetWidgetAtPos(pos); - } - } // event go directly on the pop-up if (0 < m_popUpWidgetList[m_currentCreateId].Size()) { if (NULL == m_popUpWidgetList[m_currentCreateId][m_popUpWidgetList[m_currentCreateId].Size()-1]) { @@ -217,9 +196,6 @@ void ewol::Windows::OnRegenerateDisplay(void) m_popUpWidgetList[m_currentCreateId][iii]->OnRegenerateDisplay(); } } - if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) { - m_keyBoardwidget->OnRegenerateDisplay(); - } } @@ -243,10 +219,6 @@ void ewol::Windows::OnDraw(void) //EWOL_DEBUG("Draw Pop-up"); } } - if (NULL != m_keyBoardwidget && false == m_keyBoardwidget->IsHide() ) { - m_keyBoardwidget->GenDraw(); - //EWOL_DEBUG("Draw kewboard"); - } } @@ -274,38 +246,6 @@ void ewol::Windows::PopUpWidgetPush(ewol::Widget * widget) ewol::eventInput::NewLayerSet(); } -void ewol::Windows::KeyboardShow(ewol::keyboardMode_te mode) -{ -/* -#if defined(__PLATFORM__Android) - if (NULL == m_keyBoardwidget) { - // Create the keyboard ... - 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); -#endif -*/ -} - - -void ewol::Windows::KeyboardHide(void) -{ - EWOL_INFO("Request Hide keyboard"); - if (NULL != m_keyBoardwidget) { - m_keyBoardwidget->Hide(); - } - CalculateSize(m_size.x, m_size.y); -} - /** * @brief Event generated to inform a flip-flop has occured on the current widget @@ -358,11 +298,6 @@ void ewol::Windows::OnObjectRemove(ewol::EObject * removeObject) m_needFlipFlop = true; } } - if (m_keyBoardwidget == removeObject) { - EWOL_DEBUG("Remove Keyboard element of the windows ==> destroyed object"); - m_keyBoardwidget = NULL; - m_needFlipFlop = true; - } } diff --git a/Sources/libewol/ewol/Windows.h b/Sources/libewol/ewol/Windows.h index d77bd44a..c459cd63 100644 --- a/Sources/libewol/ewol/Windows.h +++ b/Sources/libewol/ewol/Windows.h @@ -29,10 +29,9 @@ #include #include #include -#include namespace ewol { - + class Windows :public ewol::Widget { public: @@ -89,8 +88,6 @@ namespace ewol { private: ewol::Widget* m_subWidget[NB_BOUBLE_BUFFER]; etk::VectorType m_popUpWidgetList[NB_BOUBLE_BUFFER]; - // TODO : Add flip flop ... - ewol::Keyboard* m_keyBoardwidget; public: void SetSubWidget(ewol::Widget * widget); void PopUpWidgetPush(ewol::Widget * widget); @@ -99,8 +96,6 @@ namespace ewol { public: virtual void OnRegenerateDisplay(void); public: - void KeyboardShow(ewol::keyboardMode_te mode); - void KeyboardHide(void); /** * @brief Event generated to inform a flip-flop has occured on the current widget * @param --- diff --git a/Sources/libewol/ewol/base/gui.h b/Sources/libewol/ewol/base/gui.h index e6b89ac4..7c427de0 100644 --- a/Sources/libewol/ewol/base/gui.h +++ b/Sources/libewol/ewol/base/gui.h @@ -29,6 +29,7 @@ #include #include #include +#include void EWOL_NativeResize(int w, int h ); void EWOL_GenericDraw(bool everyTime); diff --git a/Sources/libewol/ewol/ewol.h b/Sources/libewol/ewol/ewol.h index 23a4a073..82d17745 100644 --- a/Sources/libewol/ewol/ewol.h +++ b/Sources/libewol/ewol/ewol.h @@ -44,6 +44,11 @@ namespace ewol { // TODO : Deprecated remove it ... bool IsPressedInput(int32_t inputID); + typedef enum { + KEYBOARD_MODE_TEXT, + KEYBOARD_MODE_NUMBER, + KEYBOARD_MODE_CODE, + } keyboardMode_te; void KeyboardShow(ewol::keyboardMode_te mode); void KeyboardHide(void); void ForceRedrawAll(void); diff --git a/Sources/libewol/ewol/widget/Entry.cpp b/Sources/libewol/ewol/widget/Entry.cpp index 52b54c7d..15732208 100644 --- a/Sources/libewol/ewol/widget/Entry.cpp +++ b/Sources/libewol/ewol/widget/Entry.cpp @@ -325,7 +325,7 @@ void ewol::Entry::UpdateTextPosition(void) void ewol::Entry::OnGetFocus(void) { m_displayCursor = true; - ewol::KeyboardShow(ewol::KEYBOARD_MODE_CODE); + ewol::KeyboardShow(ewol::KEYBOARD_MODE_TEXT); MarkToReedraw(); } diff --git a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp b/Sources/libewol/ewol/widgetMeta/Keyboard.cpp deleted file mode 100644 index 1a94372f..00000000 --- a/Sources/libewol/ewol/widgetMeta/Keyboard.cpp +++ /dev/null @@ -1,403 +0,0 @@ -/** - ******************************************************************************* - * @file ewol/widgetMeta/Keyboard.cpp - * @brief ewol keyboard meta widget system (Sources) - * @author Edouard DUPIN - * @date 07/01/2012 - * @par Project - * ewol - * - * @par Copyright - * Copyright 2011 Edouard DUPIN, all right reserved - * - * This software is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY. - * - * Licence summary : - * You can modify and redistribute the sources code and binaries. - * You can send me the bug-fix - * - * Term of the licence in in the file licence.txt. - * - ******************************************************************************* - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -extern "C" { - // file browsing ... - #include -} - -#undef __class__ -#define __class__ "ewol::Keyboard" - - -extern const char * const ewolEventKeyboardHide = "ewol event Keyboard request hide"; -extern const char * const ewolEventKeyEvent = "ewol event internal key event"; - - -ewol::Keyboard::Keyboard(void) -{ - /* - // set event that can propagate outside .... - AddEventId(ewolEventKeyboardHide); - - m_mode = KEYBOARD_MODE_TEXT; - m_isHide = true; - SetMode(m_mode); - */ -} - - -ewol::Keyboard::~Keyboard(void) -{ - /* - if (NULL != m_subWidget) { - ewol::widgetManager::MarkWidgetToBeRemoved(m_subWidget); - m_subWidget = NULL; - } - */ -} - -#define ADD_BUTTON(upperWidget,widget,text,event) do { \ - (widget) = new ewol::Button((text)); \ - (widget)->RegisterOnEvent(this, ewolEventButtonPressed, (event) ); \ - (widget)->SetExpendX(true); \ - (widget)->SetFillX(true); \ - (widget)->SetCanHaveFocus(false); \ - (widget)->SetPadding(newPadding); \ - (upperWidget)->SubWidgetAdd((widget)); \ - } while (0) - - - -void ewol::Keyboard::SetMode(keyboardMode_te mode) -{ - ewol::SizerVert * mySizerVert = NULL; - ewol::SizerHori * mySizerHori = NULL; - ewol::Button * myButton = NULL; - - coord2D_ts newPadding; - newPadding.y = 20; - newPadding.x = 12; - - mySizerVert = new ewol::SizerVert(); - m_subWidget[m_currentCreateId] = mySizerVert; - - mySizerHori = new ewol::SizerHori(); - mySizerVert->SubWidgetAdd(mySizerHori); - ADD_BUTTON(mySizerHori,myButton,"1",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"2",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"3",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"4",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"5",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"6",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"7",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"8",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"9",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"0",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"(",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,")",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"{",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"}",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"+",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"=",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"DEL",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"SUPR",ewolEventKeyEvent); - mySizerHori = new ewol::SizerHori(); - mySizerVert->SubWidgetAdd(mySizerHori); - ADD_BUTTON(mySizerHori,myButton,"TAB",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"a",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"z",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"e",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"r",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"t",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"y",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"u",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"i",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"o",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"p",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"$",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"ENTER",ewolEventKeyEvent); - mySizerHori = new ewol::SizerHori(); - mySizerVert->SubWidgetAdd(mySizerHori); - ADD_BUTTON(mySizerHori,myButton,"CAPLOCK",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"q",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"s",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"d",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"f",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"g",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"h",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"j",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"k",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"l",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"m",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"%",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"*",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"ENTER",ewolEventKeyEvent); - mySizerHori = new ewol::SizerHori(); - mySizerVert->SubWidgetAdd(mySizerHori); - ADD_BUTTON(mySizerHori,myButton,"SHIFT",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"<",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,">",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"w",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"x",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"c",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"v",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"b",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"n",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,",",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,";",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,".",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,":",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"/",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"!",ewolEventKeyEvent); - mySizerHori = new ewol::SizerHori(); - mySizerVert->SubWidgetAdd(mySizerHori); - ADD_BUTTON(mySizerHori,myButton,"Hide",ewolEventKeyboardHide); - myButton->SetExpendX(false); - ADD_BUTTON(mySizerHori,myButton,"Ctrl",ewolEventKeyEvent); - myButton->SetExpendX(false); - ADD_BUTTON(mySizerHori,myButton,"Pomme",ewolEventKeyEvent); - myButton->SetExpendX(false); - ADD_BUTTON(mySizerHori,myButton,"Alt",ewolEventKeyEvent); - myButton->SetExpendX(false); - ADD_BUTTON(mySizerHori,myButton," ",ewolEventKeyEvent); - ADD_BUTTON(mySizerHori,myButton,"AltGr",ewolEventKeyEvent); - myButton->SetExpendX(false); - ADD_BUTTON(mySizerHori,myButton,"Ctrl",ewolEventKeyEvent); - myButton->SetExpendX(false); -} - - -//!< EObject name : -extern const char * const ewol::TYPE_EOBJECT_WIDGET_KEYBORAD = "Keyboard"; - -/** - * @brief Check if the object has the specific type. - * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it - * @param[in] objectType type of the object we want to check - * @return true if the object is compatible, otherwise false - */ -bool ewol::Keyboard::CheckObjectType(const char * const objectType) -{ - if (NULL == objectType) { - EWOL_ERROR("check error : \"" << ewol::TYPE_EOBJECT_WIDGET_KEYBORAD << "\" != NULL(pointer) "); - return false; - } - if (objectType == ewol::TYPE_EOBJECT_WIDGET_KEYBORAD) { - return true; - } else { - if(true == ewol::Drawable::CheckObjectType(objectType)) { - return true; - } - EWOL_ERROR("check error : \"" << ewol::TYPE_EOBJECT_WIDGET_KEYBORAD << "\" != \"" << objectType << "\""); - return false; - } -} - -/** - * @brief Get the current Object type of the EObject - * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it - * @param[in] objectType type description - * @return true if the object is compatible, otherwise false - */ -const char * const ewol::Keyboard::GetObjectType(void) -{ - return ewol::TYPE_EOBJECT_WIDGET_KEYBORAD; -} - - - -/** - * @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 ... : widget*=" << CallerObject << "\"" << eventId << "\" ==> data=\"" << data << "\"" ); - if (ewolEventKeyEvent == eventId) { - if (NULL == CallerObject) { - return; - } - ewol::Button * bt = EWOL_CAST_WIDGET_BUTTON(CallerObject); - EWOL_DEBUG("kbevent : \"" << bt->GetLabel() << "\""); - etk::UString data = bt->GetLabel(); - if (data == "DEL") { - char tmppp[2] = {0x08, 0x00}; - data = tmppp; - } - if (data == "ENTER") { - data = "\n"; - } - if (data == "TAB") { - data = "\t"; - } - guiAbstraction::SendKeyboardEvent(true, data[0]); - guiAbstraction::SendKeyboardEvent(false, data[0]); - return; - } else if (ewolEventKeyboardHide == eventId) { - Hide(); - ewol::ForceRedrawAll(); - } - //return GenEventInputExternal(eventExternId, x, y); - return; -}; - - -void ewol::Keyboard::SetMinSise(etkFloat_t x, etkFloat_t y) -{ - EWOL_ERROR("Pop-up can not have a user Minimum size (herited from under elements)"); -} - -void ewol::Keyboard::SetExpendX(bool newExpend) -{ - EWOL_ERROR("Pop-up can not have a user expend settings X (herited from under elements)"); -} - -void ewol::Keyboard::SetExpendY(bool newExpend) -{ - EWOL_ERROR("Pop-up can not have a user expend settings Y (herited from under elements)"); -} - - -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[m_currentCreateId]) { - coord2D_ts subWidgetSize; - subWidgetSize = m_subWidget[m_currentCreateId]->GetMinSize(); - if (true == m_subWidget[m_currentCreateId]->CanExpentX()) { - subWidgetSize.x = m_size.x; - } - 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[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_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; -} - - - -void ewol::Keyboard::OnDraw(void) -{ - if (NULL != m_subWidget[m_currentDrawId]) { - m_subWidget[m_currentDrawId]->GenDraw(); - } -} - - -void ewol::Keyboard::OnRegenerateDisplay(void) -{ - if (true == NeedRedraw()) { - color_ts mycolor; - mycolor.red = 1.0; - mycolor.green = 1.0; - mycolor.blue = 1.0; - mycolor.alpha = 0.50; - // generate a white background and take gray on other surfaces - ClearOObjectList(); - ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); - BGOObjects->SetColor(mycolor); - BGOObjects->Rectangle(0, 0, m_size.x, m_size.y); - AddOObject(BGOObjects); - } - if (NULL != m_subWidget[m_currentCreateId]) { - m_subWidget[m_currentCreateId]->OnRegenerateDisplay(); - } -} - - -/** - * @brief Get the widget at the specific windows absolute position - * @param[in] pos gAbsolute position of the requested widget knowledge - * @return NULL No widget found - * @return pointer on the widget found - */ -ewol::Widget * ewol::Keyboard::GetWidgetAtPos(coord2D_ts pos) -{ - if (NULL != m_subWidget[m_currentCreateId]) { - return m_subWidget[m_currentCreateId]->GetWidgetAtPos(pos); - } - return this; -} - -/** - * @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; - } -} - - -/** - * @brief Event generated to inform a flip-flop has occured on the current widget - * @param --- - * @return --- - */ -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(); - } -} diff --git a/Sources/libewol/ewol/widgetMeta/Keyboard.h b/Sources/libewol/ewol/widgetMeta/Keyboard.h deleted file mode 100644 index d956288f..00000000 --- a/Sources/libewol/ewol/widgetMeta/Keyboard.h +++ /dev/null @@ -1,115 +0,0 @@ -/** - ******************************************************************************* - * @file ewol/widgetMeta/Keyboard.h - * @brief ewol keyboard meta widget system (header) - * @author Edouard DUPIN - * @date 07/01/2012 - * @par Project - * ewol - * - * @par Copyright - * Copyright 2011 Edouard DUPIN, all right reserved - * - * This software is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY. - * - * Licence summary : - * You can modify and redistribute the sources code and binaries. - * You can send me the bug-fix - * - * Term of the licence in in the file licence.txt. - * - ******************************************************************************* - */ - -#ifndef __EWOL_WIDGET_META_KEYBOARD_H__ -#define __EWOL_WIDGET_META_KEYBOARD_H__ - -#include -#include -#include -#include - -extern const char * const ewolEventKeyboardHide; - -namespace ewol { - typedef enum { - KEYBOARD_MODE_TEXT, - KEYBOARD_MODE_CODE, - } keyboardMode_te; - - class Keyboard : public ewol::Drawable - { - public: - Keyboard(void); - ~Keyboard(void); - /** - * @brief Check if the object has the specific type. - * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it - * @param[in] objectType type of the object we want to check - * @return true if the object is compatible, otherwise false - */ - virtual bool CheckObjectType(const char * const objectType); - - /** - * @brief Get the current Object type of the EObject - * @note In Embended platforme, it is many time no -rtti flag, then it is not possible to use dynamic cast ==> this will replace it - * @param[in] objectType type description - * @return true if the object is compatible, otherwise false - */ - virtual const char * const GetObjectType(void); - /** - * @brief Event generated to inform a flip-flop has occured on the current widget - * @param --- - * @return --- - */ - 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); - /** - * @brief Get the widget at the specific windows absolute position - * @param[in] pos gAbsolute position of the requested widget knowledge - * @return NULL No widget found - * @return pointer on the widget found - */ - virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos); - 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[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 - protected: - virtual void OnDraw(void); - public: - virtual void OnRegenerateDisplay(void); - virtual void SetMinSise(etkFloat_t x=-1, etkFloat_t y=-1); - virtual void SetExpendX(bool newExpend=false); - virtual void SetExpendY(bool newExpend=false); - }; - - extern const char * const TYPE_EOBJECT_WIDGET_KEYBORAD; - -}; - -#define EWOL_CAST_WIDGET_KEYBOARD(curentPointer) EWOL_CAST(ewol::TYPE_EOBJECT_WIDGET_KEYBORAD,ewol::Keyboard,curentPointer) - -#endif diff --git a/Sources/libewol/file.mk b/Sources/libewol/file.mk index cd7855a0..adecf8f5 100644 --- a/Sources/libewol/file.mk +++ b/Sources/libewol/file.mk @@ -17,7 +17,6 @@ FILE_LIST = ewol/ewol.cpp \ ewol/OObject/2DColored.cpp \ ewol/OObject/2DTextured.cpp \ ewol/OObject/Sprite.cpp \ - ewol/OObject/e2d.cpp \ ewol/Texture.cpp \ ewol/Texture/TextureBMP.cpp \ ewol/Texture/TexturePNG.cpp \ @@ -50,7 +49,6 @@ FILE_LIST = ewol/ewol.cpp \ ewol/widget/WidgetScrolled.cpp \ ewol/widgetMeta/FileChooser.cpp \ ewol/widgetMeta/ColorChooser.cpp \ - ewol/widgetMeta/Keyboard.cpp \ ewol/theme/Theme.cpp