corection of the list raw element error with the size text parsing

This commit is contained in:
Edouard DUPIN 2012-08-31 09:35:22 +02:00
parent c44642ba10
commit 4f598b362d
2 changed files with 19 additions and 10 deletions

View File

@ -171,7 +171,10 @@ void ewol::List::OnRegenerateDisplay(void)
drawClipping.y = 0; drawClipping.y = 0;
drawClipping.w = m_size.x - (2*m_paddingSizeX); drawClipping.w = m_size.x - (2*m_paddingSizeX);
drawClipping.h = m_size.y; drawClipping.h = m_size.y;
// remove all the positions :
m_lineSize.Clear();
// add the default position raw :
m_lineSize.PushBack(0);
for(int32_t iii=startRaw; iii<nbRaw && iii<(startRaw+displayableRaw); iii++) { for(int32_t iii=startRaw; iii<nbRaw && iii<(startRaw+displayableRaw); iii++) {
etk::UString myTextToWrite; etk::UString myTextToWrite;
draw::Color fg; draw::Color fg;
@ -186,10 +189,13 @@ void ewol::List::OnRegenerateDisplay(void)
textPos.x = tmpOriginX; textPos.x = tmpOriginX;
textPos.y = m_size.y - tmpOriginY + m_paddingSizeY; textPos.y = m_size.y - tmpOriginY + m_paddingSizeY;
tmpText->Text(textPos/*, drawClipping*/, myTextToWrite); tmpText->Text(textPos/*, drawClipping*/, myTextToWrite);
// add the raw position to remember it ...
m_lineSize.PushBack(tmpOriginY);
AddOObject(tmpText); AddOObject(tmpText);
tmpOriginY += minHeight + 2* m_paddingSizeY; tmpOriginY += minHeight + 2* m_paddingSizeY;
} }
//m_lineSize.PushBack(tmpOriginY);
AddOObject(BGOObjects, 0); AddOObject(BGOObjects, 0);
// call the herited class... // call the herited class...
@ -217,16 +223,18 @@ bool ewol::List::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInp
// nothing to do ... done on upper widet ... // nothing to do ... done on upper widet ...
return true; return true;
} }
// TODO : Rework this ... // parse all the loged row position to find the good one...
/* int32_t rawID = -1;
int32_t fontId = GetDefaultFontId(); for(int32_t iii=0; iii<m_lineSize.Size()-1; iii++) {
//int32_t minWidth = ewol::GetWidth(fontId, m_label.c_str()); if( relativePos.y>=m_lineSize[iii]
int32_t minHeight = ewol::GetHeight(fontId); && relativePos.y<m_lineSize[iii+1] ) {
*/ // we find the raw :
int32_t minHeight =20; rawID = iii;
break;
}
}
int32_t rawID = (relativePos.y+m_originScrooled.y) / (minHeight + 2*m_paddingSizeY); EWOL_DEBUG("List event : idInput=" << IdInput << " typeEvent=" << typeEvent << " raw=" << rawID << " pos=" << relativePos << "");
//EWOL_DEBUG("OnEventInput(" << IdInput << "," << typeEvent << "," << 0 << "," << rawID << "," << x <<"," << y << ");");
bool isUsed = OnItemEvent(IdInput, typeEvent, 0, rawID, pos.x, pos.y); bool isUsed = OnItemEvent(IdInput, typeEvent, 0, rawID, pos.x, pos.y);
if (true == isUsed) { if (true == isUsed) {
// TODO : this generate bugs ... I did not understand why .. // TODO : this generate bugs ... I did not understand why ..

View File

@ -49,6 +49,7 @@ namespace ewol {
// Drawing capabilities .... // Drawing capabilities ....
private: private:
etk::Vector<ewol::OObject*> m_listOObject; //!< generic element to display... etk::Vector<ewol::OObject*> m_listOObject; //!< generic element to display...
etk::Vector<int32_t> m_lineSize;
public: public:
void AddOObject(ewol::OObject* newObject, int32_t pos=-1); void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
void ClearOObjectList(void); void ClearOObjectList(void);