Add new basic file widget ==> need to write it now...

This commit is contained in:
Edouard Dupin 2011-11-07 17:10:00 +01:00
parent 7f64c17034
commit 6d28038192
17 changed files with 594 additions and 54 deletions

View File

@ -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 :

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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;
}
};
};

View File

@ -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 <widget/ewolButton.h>

View File

@ -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 <etkTypes.h>
#include <ewolDebug.h>
#include <ewolWidget.h>
namespace ewol {
class Button :public ewol::Widget
{
public:
Button(void) { };
virtual ~Button(void) { };
};
};
#endif

View File

@ -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 <widget/ewolCheckBox.h>

View File

@ -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 <etkTypes.h>
#include <ewolDebug.h>
#include <ewolWidget.h>
namespace ewol {
class CheckBox :public ewol::Widget
{
public:
CheckBox(void) { };
virtual ~CheckBox(void) { };
};
};
#endif

View File

@ -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 <widget/ewolEntry.h>

View File

@ -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 <etkTypes.h>
#include <ewolDebug.h>
#include <ewolWidget.h>
namespace ewol {
class Entry :public ewol::Widget
{
public:
Entry(void) { };
virtual ~Entry(void) { };
};
};
#endif

View File

@ -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 <widget/ewolList.h>

41
Sources/widget/ewolList.h Normal file
View File

@ -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 <etkTypes.h>
#include <ewolDebug.h>
#include <ewolWidget.h>
namespace ewol {
class List :public ewol::Widget
{
public:
List(void) { };
virtual ~List(void) { };
};
};
#endif

View File

@ -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 <widget/ewolSizerHori.h>
ewol::SizerHori::SizerHori(void)
{
}
ewol::SizerHori::~SizerHori(void)
{
SubWidgetRemoveAll();
}
bool ewol::SizerHori::CalculateSize(double availlableX, double availlableY)
{
EWOL_DEBUG("Update Size");
}
//etk::VectorType<ewol::Widget*> m_SubWidget;
void ewol::SizerHori::SubWidgetRemoveAll(void)
{
for (int32_t iii=0; iii<m_SubWidget.Size(); iii++) {
delete(m_SubWidget[iii]);
m_SubWidget[iii] = NULL;
}
m_SubWidget.Clear();
}
void ewol::SizerHori::SubWidgetAdd(ewol::Widget* newWidget)
{
if (NULL == newWidget) {
return;
}
m_SubWidget.PushBack(newWidget);
newWidget->SetParrent(this);
}
void ewol::SizerHori::SubWidgetRemove(ewol::Widget* newWidget)
{
if (NULL == newWidget) {
return;
}
for (int32_t iii=0; iii<m_SubWidget.Size(); iii++) {
if (newWidget == m_SubWidget[iii]) {
delete(m_SubWidget[iii]);
m_SubWidget[iii] = NULL;
m_SubWidget.Erase(iii);
return;
}
}
}
void ewol::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
{
if (NULL == newWidget) {
return;
}
for (int32_t iii=0; iii<m_SubWidget.Size(); iii++) {
if (newWidget == m_SubWidget[iii]) {
m_SubWidget[iii] = NULL;
m_SubWidget.Erase(iii);
return;
}
}
}

View File

@ -0,0 +1,50 @@
/**
*******************************************************************************
* @file ewolSizerHori.h
* @brief ewol hirisantal 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_HORI_H__
#define __EWOL_SIZER_HORI_H__
#include <etkTypes.h>
#include <ewolDebug.h>
#include <ewolWidget.h>
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<ewol::Widget*> m_SubWidget;
public:
void SubWidgetRemoveAll(void);
void SubWidgetAdd(ewol::Widget* newWidget);
void SubWidgetRemove(ewol::Widget* newWidget);
void SubWidgetUnLink(ewol::Widget* newWidget);
};
};
#endif

View File

@ -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 <widget/ewolSizerVert.h>

View File

@ -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 <etkTypes.h>
#include <ewolDebug.h>
#include <ewolWidget.h>
namespace ewol {
class SizerVert :public ewol::Widget
{
public:
SizerVert(void) { };
virtual ~SizerVert(void) { };
};
};
#endif