diff --git a/Makefile b/Makefile index c0c75a53..601b9ab2 100644 --- a/Makefile +++ b/Makefile @@ -186,6 +186,13 @@ else endif CXXFILES += ewolWidget.cpp \ ewolWindows.cpp +# list of widgets : +CXXFILES += widget/ewolButton.cpp \ + widget/ewolCheckBox.cpp \ + widget/ewolEntry.cpp \ + widget/ewolList.cpp \ + widget/ewolSizerHori.cpp \ + widget/ewolSizerVert.cpp # Ewol Test Software : diff --git a/Sources/base/guiX11.cpp b/Sources/base/guiX11.cpp index 1109dbde..497eab7a 100644 --- a/Sources/base/guiX11.cpp +++ b/Sources/base/guiX11.cpp @@ -272,24 +272,39 @@ namespace guiAbstraction { XSetWMProtocols(m_display, WindowHandle, &m_delAtom, 1); } - //code to remove decoration - { - - Hints hints; - Atom property; - hints.flags = 2;// Specify that we're changing the window decorations. - hints.decorations = 0;// 0 (false) means that window decorations should go bye-bye - property = XInternAtom(m_display, "_MOTIF_WM_HINTS", true); - if (0 != property) { - XChangeProperty(m_display,WindowHandle,property,property,32,PropModeReplace,(unsigned char *)&hints,5); - XMapWindow(m_display, WindowHandle); - } else { - EWOL_ERROR("Can not get the property for the rmoving decoration of the X11 system ...."); - } - } return true; } + void RemoveDecoration(void) + { + Hints hints; + Atom property; + hints.flags = 2;// Specify that we're changing the window decorations. + hints.decorations = 0;// 0 (false) means that window decorations should go bye-bye + property = XInternAtom(m_display, "_MOTIF_WM_HINTS", true); + if (0 != property) { + XChangeProperty(m_display,WindowHandle,property,property,32,PropModeReplace,(unsigned char *)&hints,5); + XMapWindow(m_display, WindowHandle); + } else { + EWOL_ERROR("Can not get the property for the rmoving decoration of the X11 system ...."); + } + } + + void AddDecoration(void) + { + Hints hints; + Atom property; + hints.flags = 2;// Specify that we're changing the window decorations. + hints.decorations = 1;// 1 (true) means that window decorations should enable + property = XInternAtom(m_display, "_MOTIF_WM_HINTS", true); + if (0 != property) { + XChangeProperty(m_display,WindowHandle,property,property,32,PropModeReplace,(unsigned char *)&hints,5); + XMapWindow(m_display, WindowHandle); + } else { + EWOL_ERROR("Can not get the property for the rmoving decoration of the X11 system ...."); + } + } + bool CreateOGlContext(void) { #if defined(EWOL_X11_MODE__XRENDER) diff --git a/Sources/ewolFontFreeType.cpp b/Sources/ewolFontFreeType.cpp index 14a3092d..5bf784e3 100644 --- a/Sources/ewolFontFreeType.cpp +++ b/Sources/ewolFontFreeType.cpp @@ -344,7 +344,10 @@ class FTFont{ } // set the bassic charset: m_elements.Clear(); - for (int32_t iii=0; iii<127; iii++) { + freeTypeFontElement_ts tmpchar1; + tmpchar1.unicodeCharVal = 0; + m_elements.PushBack(tmpchar1); + for (int32_t iii=0x20; iii<127; iii++) { freeTypeFontElement_ts tmpchar; tmpchar.unicodeCharVal = iii; m_elements.PushBack(tmpchar); @@ -556,20 +559,35 @@ void ewol::DrawText(int32_t fontID, float posDrawX = drawPosition.x; while(*tmpVal != 0) { int32_t tmpChar = *tmpVal++; + int32_t charIndex; if (tmpChar >= 0x80) { - tmpChar = 0; + charIndex = 0; + } else if (tmpChar < 0x20) { + charIndex = 0; + } else if (tmpChar < 0x80) { + charIndex = tmpChar - 0x1F; + } else { + for (int32_t iii=0x80-0x20; iii < listOfElement.Size(); iii++) { + if (listOfElement[iii].unicodeCharVal == tmpChar) { + charIndex = iii; + break; + } + } + // TODO : Update if possible the mapping + charIndex = 0; } - float sizeWidth = listOfElement[tmpChar].width; - if (tmpChar != 0x20) { + float sizeWidth = listOfElement[charIndex].width; + // 0x01 == 0x20 == ' '; + if (tmpChar != 0x01) { // set texture coordonates : - coordTex.PushBack(listOfElement[tmpChar].posStart); + coordTex.PushBack(listOfElement[charIndex].posStart); texCoord_ts tmpTex; - tmpTex.u = listOfElement[tmpChar].posStop.u; - tmpTex.v = listOfElement[tmpChar].posStart.v; + tmpTex.u = listOfElement[charIndex].posStop.u; + tmpTex.v = listOfElement[charIndex].posStart.v; coordTex.PushBack(tmpTex); - coordTex.PushBack(listOfElement[tmpChar].posStop); - tmpTex.u = listOfElement[tmpChar].posStart.u; - tmpTex.v = listOfElement[tmpChar].posStop.v; + coordTex.PushBack(listOfElement[charIndex].posStop); + tmpTex.u = listOfElement[charIndex].posStart.u; + tmpTex.v = listOfElement[charIndex].posStop.v; coordTex.PushBack(tmpTex); // set display positions : coord2D_ts tmpCoord; diff --git a/Sources/ewolWindows.cpp b/Sources/ewolWindows.cpp index 649191c5..ff7b68b7 100644 --- a/Sources/ewolWindows.cpp +++ b/Sources/ewolWindows.cpp @@ -46,24 +46,27 @@ const char * ewolEventWindowsExpend = "ewol Windows expend/unExpend"; ewol::Windows::Windows(void) { - ewol::OObject2DColored * myOObject = new ewol::OObject2DColored(); - myOObject->Rectangle( 0, 0, 20, 20, 1.0, 0.0, 0.0, 1.0); // Close - myOObject->Rectangle(20, 0, 20, 20, 0.0, 1.0, 0.0, 1.0); // Reduce - myOObject->Rectangle(40, 0, 20, 20, 0.0, 0.0, 1.0, 1.0); // Expend - Un-expend - - AddEventArea({ 0.0,0.0}, {20, 20}, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventWindowsClose); - AddEventArea({20.0,0.0}, {20, 20}, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventWindowsMinimize); - AddEventArea({40.0,0.0}, {20, 20}, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventWindowsExpend); - - AddOObject(myOObject, "leftBoutton"); - - color_ts textColorFg; - textColorFg.red = .0; - textColorFg.green = .0; - textColorFg.blue = .0; - textColorFg.alpha = 1.0; - ewol::OObject2DText * myOObjectText = new ewol::OObject2DText(62, 2, "Monospace", 17 , FONT_MODE_BOLD, textColorFg, "My Title ..."); - AddOObject(myOObjectText, "Title"); + SetDecorationDisable(); + if (true == m_hasDecoration) { + ewol::OObject2DColored * myOObject = new ewol::OObject2DColored(); + myOObject->Rectangle( 0, 0, 20, 20, 1.0, 0.0, 0.0, 1.0); // Close + myOObject->Rectangle(20, 0, 20, 20, 0.0, 1.0, 0.0, 1.0); // Reduce + myOObject->Rectangle(40, 0, 20, 20, 0.0, 0.0, 1.0, 1.0); // Expend - Un-expend + + AddEventArea({ 0.0,0.0}, {20, 20}, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventWindowsClose); + AddEventArea({20.0,0.0}, {20, 20}, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventWindowsMinimize); + AddEventArea({40.0,0.0}, {20, 20}, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventWindowsExpend); + + AddOObject(myOObject, "leftBoutton"); + + color_ts textColorFg; + textColorFg.red = .0; + textColorFg.green = .0; + textColorFg.blue = .0; + textColorFg.alpha = 1.0; + ewol::OObject2DText * myOObjectText = new ewol::OObject2DText(62, 2, "Monospace", 17 , FONT_MODE_BOLD, textColorFg, "My Title ..."); + AddOObject(myOObjectText, "Title"); + } } @@ -78,18 +81,20 @@ bool ewol::Windows::CalculateSize(double availlableX, double availlableY) bool ewol::Windows::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, double x, double y) { - if( x >= 60 - && y <=20) - { - if(EVENT_INPUT_TYPE_MOVE == typeEvent && true == ewol::IsPressedInput(1) ) { - ewol::StartMoveSystem(); + 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( x >= m_size.x - 20 + && y >= m_size.y - 20) + { + if(EVENT_INPUT_TYPE_MOVE == typeEvent && true == ewol::IsPressedInput(1) ) { + ewol::StartResizeSystem(); + } } } return true; diff --git a/Sources/ewolWindows.h b/Sources/ewolWindows.h index 5fb01e10..fca3f684 100644 --- a/Sources/ewolWindows.h +++ b/Sources/ewolWindows.h @@ -56,6 +56,18 @@ namespace ewol { // Widget overwrite function public: virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, double X, double Y); + private: + bool m_hasDecoration; + public: + void SetDecorationDisable(void) + { + m_hasDecoration = false; + } + + void SetDecorationEnable(void) + { + m_hasDecoration = true; + } }; }; diff --git a/Sources/widget/ewolButton.cpp b/Sources/widget/ewolButton.cpp new file mode 100644 index 00000000..e57430a0 --- /dev/null +++ b/Sources/widget/ewolButton.cpp @@ -0,0 +1,26 @@ +/** + ******************************************************************************* + * @file ewolButton.cpp + * @brief ewol Button widget system (Sources) + * @author Edouard DUPIN + * @date 07/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 + diff --git a/Sources/widget/ewolButton.h b/Sources/widget/ewolButton.h new file mode 100644 index 00000000..7c9bc00f --- /dev/null +++ b/Sources/widget/ewolButton.h @@ -0,0 +1,41 @@ +/** + ******************************************************************************* + * @file ewolButton.h + * @brief ewol Button widget system (header) + * @author Edouard DUPIN + * @date 07/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. + * + ******************************************************************************* + */ + +#ifndef __EWOL_BUTTON_H__ +#define __EWOL_BUTTON_H__ + +#include +#include +#include + +namespace ewol { + class Button :public ewol::Widget + { + public: + Button(void) { }; + virtual ~Button(void) { }; + }; +}; + +#endif diff --git a/Sources/widget/ewolCheckBox.cpp b/Sources/widget/ewolCheckBox.cpp new file mode 100644 index 00000000..b25588dd --- /dev/null +++ b/Sources/widget/ewolCheckBox.cpp @@ -0,0 +1,26 @@ +/** + ******************************************************************************* + * @file ewolCheckBox.cpp + * @brief ewol check-box widget system (Sources) + * @author Edouard DUPIN + * @date 07/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 diff --git a/Sources/widget/ewolCheckBox.h b/Sources/widget/ewolCheckBox.h new file mode 100644 index 00000000..326c6b95 --- /dev/null +++ b/Sources/widget/ewolCheckBox.h @@ -0,0 +1,41 @@ +/** + ******************************************************************************* + * @file ewolCheckBox.h + * @brief ewol check-box widget system (header) + * @author Edouard DUPIN + * @date 07/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. + * + ******************************************************************************* + */ + +#ifndef __EWOL_CHECK_BOX_H__ +#define __EWOL_CHECK_BOX_H__ + +#include +#include +#include + +namespace ewol { + class CheckBox :public ewol::Widget + { + public: + CheckBox(void) { }; + virtual ~CheckBox(void) { }; + }; +}; + +#endif diff --git a/Sources/widget/ewolEntry.cpp b/Sources/widget/ewolEntry.cpp new file mode 100644 index 00000000..df78a963 --- /dev/null +++ b/Sources/widget/ewolEntry.cpp @@ -0,0 +1,26 @@ +/** + ******************************************************************************* + * @file ewolEntry.cpp + * @brief ewol entry widget system (Sources) + * @author Edouard DUPIN + * @date 07/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 diff --git a/Sources/widget/ewolEntry.h b/Sources/widget/ewolEntry.h new file mode 100644 index 00000000..86428365 --- /dev/null +++ b/Sources/widget/ewolEntry.h @@ -0,0 +1,41 @@ +/** + ******************************************************************************* + * @file ewolEntry.h + * @brief ewol entry widget system (header) + * @author Edouard DUPIN + * @date 07/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. + * + ******************************************************************************* + */ + +#ifndef __EWOL_ENTRY_H__ +#define __EWOL_ENTRY_H__ + +#include +#include +#include + +namespace ewol { + class Entry :public ewol::Widget + { + public: + Entry(void) { }; + virtual ~Entry(void) { }; + }; +}; + +#endif diff --git a/Sources/widget/ewolList.cpp b/Sources/widget/ewolList.cpp new file mode 100644 index 00000000..63818f24 --- /dev/null +++ b/Sources/widget/ewolList.cpp @@ -0,0 +1,26 @@ +/** + ******************************************************************************* + * @file ewolList.cpp + * @brief ewol list widget system (Sources) + * @author Edouard DUPIN + * @date 07/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 diff --git a/Sources/widget/ewolList.h b/Sources/widget/ewolList.h new file mode 100644 index 00000000..e37d6158 --- /dev/null +++ b/Sources/widget/ewolList.h @@ -0,0 +1,41 @@ +/** + ******************************************************************************* + * @file ewolList.h + * @brief ewol list widget system (header) + * @author Edouard DUPIN + * @date 07/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. + * + ******************************************************************************* + */ + +#ifndef __EWOL_LIST_H__ +#define __EWOL_LIST_H__ + +#include +#include +#include + +namespace ewol { + class List :public ewol::Widget + { + public: + List(void) { }; + virtual ~List(void) { }; + }; +}; + +#endif diff --git a/Sources/widget/ewolSizerHori.cpp b/Sources/widget/ewolSizerHori.cpp new file mode 100644 index 00000000..b4dc9c17 --- /dev/null +++ b/Sources/widget/ewolSizerHori.cpp @@ -0,0 +1,98 @@ +/** + ******************************************************************************* + * @file ewolSizerHori.cpp + * @brief ewol hirisantal sizer widget system (Sources) + * @author Edouard DUPIN + * @date 07/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 + + +ewol::SizerHori::SizerHori(void) +{ + +} + +ewol::SizerHori::~SizerHori(void) +{ + SubWidgetRemoveAll(); +} + + +bool ewol::SizerHori::CalculateSize(double availlableX, double availlableY) +{ + EWOL_DEBUG("Update Size"); +} + + + + +//etk::VectorType m_SubWidget; + +void ewol::SizerHori::SubWidgetRemoveAll(void) +{ + for (int32_t iii=0; iiiSetParrent(this); +} + + +void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget) +{ + if (NULL == newWidget) { + return; + } + for (int32_t iii=0; iii +#include +#include + +namespace ewol { + class SizerHori :public ewol::Widget + { + public: + SizerHori(void); + virtual ~SizerHori(void); + public: + virtual bool CalculateSize(double availlableX, double availlableY); // this generate the current size ... + private: + etk::VectorType m_SubWidget; + public: + void SubWidgetRemoveAll(void); + void SubWidgetAdd(ewol::Widget* newWidget); + void SubWidgetRemove(ewol::Widget* newWidget); + void SubWidgetUnLink(ewol::Widget* newWidget); + }; +}; + +#endif diff --git a/Sources/widget/ewolSizerVert.cpp b/Sources/widget/ewolSizerVert.cpp new file mode 100644 index 00000000..7f8cdce2 --- /dev/null +++ b/Sources/widget/ewolSizerVert.cpp @@ -0,0 +1,26 @@ +/** + ******************************************************************************* + * @file ewolSizerVert.cpp + * @brief ewol vertical sizer widget system (Sources) + * @author Edouard DUPIN + * @date 07/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 diff --git a/Sources/widget/ewolSizerVert.h b/Sources/widget/ewolSizerVert.h new file mode 100644 index 00000000..b9b3c64c --- /dev/null +++ b/Sources/widget/ewolSizerVert.h @@ -0,0 +1,41 @@ +/** + ******************************************************************************* + * @file ewolSizerVert.h + * @brief ewol vertical sizer widget system (header) + * @author Edouard DUPIN + * @date 07/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. + * + ******************************************************************************* + */ + +#ifndef __EWOL_SIZER_VERT_H__ +#define __EWOL_SIZER_VERT_H__ + +#include +#include +#include + +namespace ewol { + class SizerVert :public ewol::Widget + { + public: + SizerVert(void) { }; + virtual ~SizerVert(void) { }; + }; +}; + +#endif