First display of a simple list and generation of the event needed at this one
This commit is contained in:
parent
1daa4b8ee0
commit
9bfc6c4e50
@ -70,16 +70,47 @@ void ewol::List::OnRegenerateDisplay(void)
|
||||
|
||||
int32_t tmpOriginX = 0;
|
||||
int32_t tmpOriginY = 0;
|
||||
|
||||
int32_t tmpOriginYBG = 0;
|
||||
/*
|
||||
if (true==m_userFillX) {
|
||||
tmpOriginX = (m_size.x - m_minSize.x) / 2;
|
||||
tmpOriginX = 0;
|
||||
}
|
||||
if (true==m_userFillY) {
|
||||
tmpOriginY = (m_size.y - m_minSize.y) / 2;
|
||||
}
|
||||
tmpOriginY = 0;
|
||||
}*/
|
||||
tmpOriginX += m_paddingSize;
|
||||
tmpOriginY += m_paddingSize;
|
||||
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
//int32_t minWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t minHeight = ewol::GetHeight(fontId);
|
||||
|
||||
|
||||
//uint32_t nbColomn = GetNuberOfColomn();
|
||||
uint32_t nbRaw = GetNuberOfRaw();
|
||||
etk::VectorType<int32_t> listSizeColomn;
|
||||
|
||||
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
||||
AddOObject(BGOObjects, "ListDeco");
|
||||
color_ts basicBG = GetBasicBG();
|
||||
BGOObjects->SetColor(basicBG);
|
||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||
|
||||
|
||||
for(uint32_t iii=0; iii<nbRaw; iii++) {
|
||||
etk::String myTextToWrite;
|
||||
color_ts fg;
|
||||
color_ts bg;
|
||||
GetElement(0, iii, myTextToWrite, fg, bg);
|
||||
BGOObjects->SetColor(bg);
|
||||
BGOObjects->Rectangle(0, tmpOriginYBG, m_size.x, minHeight+2*m_paddingSize);
|
||||
tmpOriginYBG += minHeight+2*m_paddingSize;
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, fg);
|
||||
tmpText->Text(tmpOriginX, tmpOriginY, myTextToWrite.c_str());
|
||||
AddOObject(tmpText, "");
|
||||
tmpOriginY += minHeight + 2* m_paddingSize;
|
||||
}
|
||||
//ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
//tmpText->Text(tmpOriginX, tmpOriginY, "jhgjhg");
|
||||
|
||||
@ -88,3 +119,14 @@ void ewol::List::OnRegenerateDisplay(void)
|
||||
}
|
||||
|
||||
|
||||
bool ewol::List::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
//int32_t minWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t minHeight = ewol::GetHeight(fontId);
|
||||
|
||||
int32_t rawID = y / (minHeight + 2*m_paddingSize);
|
||||
//EWOL_DEBUG("OnEventInput(" << IdInput << "," << typeEvent << "," << 0 << "," << rawID << "," << x <<"," << y << ");");
|
||||
return OnItemEvent(IdInput, typeEvent, 0, rawID, x, y);
|
||||
return false;
|
||||
}
|
@ -30,12 +30,6 @@
|
||||
#include <ewol/Widget.h>
|
||||
|
||||
namespace ewol {
|
||||
typedef enum {
|
||||
EVENT_LIST_CKICKED,
|
||||
EVENT_LIST_LEFT_CKICKED,
|
||||
} listEvent_te;
|
||||
|
||||
|
||||
class List :public ewol::Widget
|
||||
{
|
||||
public:
|
||||
@ -50,17 +44,25 @@ namespace ewol {
|
||||
int32_t m_diaplayCurrentNbLine; //!< Number of line in the display
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
||||
protected:
|
||||
// function call to display the list :
|
||||
virtual int32_t GetNuberOfColomn(void) {
|
||||
virtual color_ts GetBasicBG(void) {
|
||||
color_ts bg;
|
||||
bg.red = 1.0;
|
||||
bg.green = 1.0;
|
||||
bg.blue = 1.0;
|
||||
bg.alpha = 1.0;
|
||||
return bg;
|
||||
}
|
||||
virtual uint32_t GetNuberOfColomn(void) {
|
||||
return 0;
|
||||
};
|
||||
virtual bool GetTitle(int32_t colomn, etk::String &myTitle, color_ts &fg, color_ts &bg) {
|
||||
myTitle = "";
|
||||
return false;
|
||||
};
|
||||
virtual int32_t GetNuberOfRaw(void) {
|
||||
virtual uint32_t GetNuberOfRaw(void) {
|
||||
return 0;
|
||||
};
|
||||
virtual bool GetElement(int32_t colomn, int32_t raw, etk::String &myTextToWrite, color_ts &fg, color_ts &bg) {
|
||||
@ -82,7 +84,7 @@ namespace ewol {
|
||||
}
|
||||
return false;
|
||||
};
|
||||
virtual bool OnItemEvent(listEvent_te event, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y) {
|
||||
virtual bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user