[DEV] a little better list display ==> multiple colomn
This commit is contained in:
parent
051624b12e
commit
ff84a9ea20
@ -116,7 +116,6 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
// clean the object list ...
|
// clean the object list ...
|
||||||
ClearOObjectList();
|
ClearOObjectList();
|
||||||
//EWOL_DEBUG("OnRegenerateDisplay(" << m_size.x << "," << m_size.y << ")");
|
//EWOL_DEBUG("OnRegenerateDisplay(" << m_size.x << "," << m_size.y << ")");
|
||||||
|
|
||||||
int32_t tmpOriginX = 0;
|
int32_t tmpOriginX = 0;
|
||||||
int32_t tmpOriginY = 0;
|
int32_t tmpOriginY = 0;
|
||||||
/*
|
/*
|
||||||
@ -131,7 +130,7 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
// TODO : Remove this ...
|
// TODO : Remove this ...
|
||||||
int32_t minHeight = 25;
|
int32_t minHeight = 25;
|
||||||
|
|
||||||
//uint32_t nbColomn = GetNuberOfColomn();
|
uint32_t nbColomn = GetNuberOfColomn();
|
||||||
int32_t nbRaw = GetNuberOfRaw();
|
int32_t nbRaw = GetNuberOfRaw();
|
||||||
// For the scrooling windows
|
// For the scrooling windows
|
||||||
m_maxSize.x = m_size.x;
|
m_maxSize.x = m_size.x;
|
||||||
@ -164,40 +163,51 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
// remove all the positions :
|
// remove all the positions :
|
||||||
m_lineSize.Clear();
|
m_lineSize.Clear();
|
||||||
int32_t displayPositionY = m_size.y;
|
int32_t displayPositionY = m_size.y;
|
||||||
|
int32_t displayPositionX = 0;
|
||||||
Vector2D<int32_t> tmpRegister(startRaw, displayPositionY);
|
Vector2D<int32_t> tmpRegister(startRaw, displayPositionY);
|
||||||
// add the default position raw :
|
// add the default position raw :
|
||||||
m_lineSize.PushBack(tmpRegister);
|
m_lineSize.PushBack(tmpRegister);
|
||||||
for(int32_t iii=startRaw; iii<nbRaw && displayPositionY >= 0; iii++) {
|
|
||||||
etk::UString myTextToWrite;
|
for(int32_t jjj=0; jjj<nbColomn && displayPositionX < m_size.x ; jjj++) {
|
||||||
draw::Color fg;
|
int32_t sizeColom = 0;
|
||||||
draw::Color bg;
|
displayPositionY = m_size.y;
|
||||||
GetElement(0, iii, myTextToWrite, fg, bg);
|
for(int32_t iii=startRaw; iii<nbRaw && displayPositionY >= 0; iii++) {
|
||||||
|
etk::UString myTextToWrite;
|
||||||
ewol::OObject2DTextColored * tmpText = new ewol::OObject2DTextColored();
|
draw::Color fg;
|
||||||
if (NULL != tmpText) {
|
draw::Color bg;
|
||||||
// get font size :
|
GetElement(jjj, iii, myTextToWrite, fg, bg);
|
||||||
int32_t tmpFontHeight = tmpText->GetHeight();
|
|
||||||
displayPositionY-=(tmpFontHeight+m_paddingSizeY);
|
|
||||||
|
|
||||||
BGOObjects->SetColor(bg);
|
ewol::OObject2DTextColored * tmpText = new ewol::OObject2DTextColored();
|
||||||
BGOObjects->Rectangle(0, displayPositionY, m_size.x, tmpFontHeight+2*m_paddingSizeY);
|
if (NULL != tmpText) {
|
||||||
|
// get font size :
|
||||||
|
int32_t tmpFontHeight = tmpText->GetHeight();
|
||||||
Vector2D<float> textPos;
|
displayPositionY-=(tmpFontHeight+m_paddingSizeY);
|
||||||
textPos.x = tmpOriginX;
|
|
||||||
textPos.y = displayPositionY;
|
BGOObjects->SetColor(bg);
|
||||||
tmpText->SetColor(fg);
|
BGOObjects->Rectangle(displayPositionX, displayPositionY, m_size.x-displayPositionX, tmpFontHeight+2*m_paddingSizeY);
|
||||||
tmpText->Text(textPos/*, drawClipping*/, myTextToWrite);
|
|
||||||
AddOObject(tmpText);
|
// get the maximum size of the colomn :
|
||||||
// madding move ...
|
Vector2D<float> textSize = tmpText->GetSize(myTextToWrite);
|
||||||
displayPositionY -= m_paddingSizeY;
|
sizeColom = etk_max(sizeColom, textSize.x);
|
||||||
|
|
||||||
// add the raw position to remember it ...
|
Vector2D<float> textPos;
|
||||||
tmpRegister.x++;
|
textPos.x = tmpOriginX + displayPositionX;
|
||||||
tmpRegister.y = displayPositionY;
|
textPos.y = displayPositionY;
|
||||||
m_lineSize.PushBack(tmpRegister);
|
tmpText->SetColor(fg);
|
||||||
//EWOL_DEBUG("List indexation:" << tmpRegister);
|
tmpText->Text(textPos/*, drawClipping*/, myTextToWrite);
|
||||||
|
AddOObject(tmpText);
|
||||||
|
// madding move ...
|
||||||
|
displayPositionY -= m_paddingSizeY;
|
||||||
|
|
||||||
|
// add the raw position to remember it ...
|
||||||
|
tmpRegister.x++;
|
||||||
|
tmpRegister.y = displayPositionY;
|
||||||
|
m_lineSize.PushBack(tmpRegister);
|
||||||
|
//EWOL_DEBUG("List indexation:" << tmpRegister);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
displayPositionX += sizeColom;
|
||||||
|
tmpOriginX += m_paddingSizeX*2*2;
|
||||||
}
|
}
|
||||||
//m_lineSize.PushBack(tmpOriginY);
|
//m_lineSize.PushBack(tmpOriginY);
|
||||||
AddOObject(BGOObjects, 0);
|
AddOObject(BGOObjects, 0);
|
||||||
|
@ -80,7 +80,7 @@ namespace ewol {
|
|||||||
return bg;
|
return bg;
|
||||||
}
|
}
|
||||||
virtual uint32_t GetNuberOfColomn(void) {
|
virtual uint32_t GetNuberOfColomn(void) {
|
||||||
return 0;
|
return 1;
|
||||||
};
|
};
|
||||||
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg) {
|
virtual bool GetTitle(int32_t colomn, etk::UString &myTitle, draw::Color &fg, draw::Color &bg) {
|
||||||
myTitle = "";
|
myTitle = "";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user