Create the scolled widget abstraction
This commit is contained in:
parent
78bada11a7
commit
5447f326c6
@ -76,6 +76,7 @@ char* ewol::GetCharTypeMoveEvent(eventKbMoveType_te type)
|
||||
|
||||
ewol::Widget::Widget(void)
|
||||
{
|
||||
m_needRegenerateDisplay = true;
|
||||
m_currentDrawId = 0;
|
||||
m_currentCreateId = 1;
|
||||
m_needFlipFlop = false;
|
||||
|
@ -309,6 +309,11 @@ namespace ewol {
|
||||
void SpecificDrawDisable(void) { m_specificDraw = false; };
|
||||
void SpecificDrawEnable(void) { m_specificDraw = true; };
|
||||
virtual bool OnDraw(void) { /*EWOL_ERROR("plop");*/ return true; };
|
||||
private:
|
||||
bool m_needRegenerateDisplay;
|
||||
protected:
|
||||
void MarkToReedraw(void) { m_needRegenerateDisplay = true; };
|
||||
bool NeedRedraw(void) { bool tmpData=m_needRegenerateDisplay; m_needRegenerateDisplay=false; return tmpData; };
|
||||
public:
|
||||
virtual void OnRegenerateDisplay(void) { };
|
||||
bool GenDraw(void)
|
||||
|
@ -99,7 +99,7 @@ bool ewol::Windows::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY
|
||||
m_popUpWidget->CalculateSize(m_size.x, m_size.y - keyboardHigh);
|
||||
}
|
||||
// regenerate all the display ...
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -163,6 +163,9 @@ void ewol::Windows::SysDraw(void)
|
||||
|
||||
void ewol::Windows::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (true == NeedRedraw()) {
|
||||
// no decoration ...
|
||||
}
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->OnRegenerateDisplay();
|
||||
}
|
||||
@ -277,7 +280,7 @@ void ewol::Windows::KeyboardShow(ewol::keyboardMode_te mode)
|
||||
m_keyBoardwidget->Show();
|
||||
}
|
||||
CalculateSize(m_size.x, m_size.y);
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
|
||||
@ -288,5 +291,5 @@ void ewol::Windows::KeyboardHide(void)
|
||||
m_keyBoardwidget->Hide();
|
||||
}
|
||||
CalculateSize(m_size.x, m_size.y);
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
@ -87,6 +87,7 @@ typedef struct {
|
||||
void EWOL_NativeEventInputMotion(int pointerID, float x, float y );
|
||||
void EWOL_NativeEventInputState(int pointerID, bool isUp, float x, float y );
|
||||
void EWOL_NativeResize(int w, int h );
|
||||
void EWOL_NativeRegenerateDisplay(void);
|
||||
|
||||
|
||||
|
||||
@ -172,6 +173,7 @@ static void* BaseAppEntry(void* param)
|
||||
}
|
||||
if (0 == ewol::threadMsg::WaitingMessage(androidJniMsg)) {
|
||||
if (countNbEvent > 0) {
|
||||
EWOL_NativeRegenerateDisplay();
|
||||
// TODO : Generate the display here ... Instead of every time we call the sub-Widget ...
|
||||
ewol::widgetManager::GetDoubleBufferFlipFlop();
|
||||
countNbEvent = 0;
|
||||
|
@ -47,6 +47,13 @@ void EWOL_NativeResize(int w, int h )
|
||||
}
|
||||
}
|
||||
|
||||
void EWOL_NativeRegenerateDisplay(void)
|
||||
{
|
||||
//EWOL_INFO("Resize w=" << w << " h=" << h);
|
||||
if (NULL != gui_uniqueWindows) {
|
||||
gui_uniqueWindows->OnRegenerateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
void guiAbstraction::SetDisplayOnWindows(ewol::Windows * newWindows)
|
||||
{
|
||||
|
@ -103,63 +103,65 @@ bool ewol::Button::GetValue(void)
|
||||
|
||||
void ewol::Button::OnRegenerateDisplay(void)
|
||||
{
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
|
||||
// TODO later : Add this in the basic element of the widget ...
|
||||
int32_t borderSize = 2;
|
||||
int32_t paddingSize = 3;
|
||||
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
int32_t tmpSizeY = m_minSize.y;
|
||||
int32_t tmpOriginX = (m_size.x - tmpSizeX) / 2;
|
||||
int32_t tmpOriginY = (m_size.y - tmpSizeY) / 2;
|
||||
// no change for the text orogin :
|
||||
int32_t tmpTextOriginX = (m_size.x - tmpSizeX) / 2 + borderSize + 2*paddingSize;
|
||||
int32_t tmpTextOriginY = (m_size.y - tmpSizeY) / 2 + borderSize + 2*paddingSize;
|
||||
|
||||
if (true==m_userFillX) {
|
||||
tmpSizeX = m_size.x;
|
||||
tmpOriginX = 0;
|
||||
if (true == NeedRedraw()) {
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
|
||||
// TODO later : Add this in the basic element of the widget ...
|
||||
int32_t borderSize = 2;
|
||||
int32_t paddingSize = 3;
|
||||
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
int32_t tmpSizeY = m_minSize.y;
|
||||
int32_t tmpOriginX = (m_size.x - tmpSizeX) / 2;
|
||||
int32_t tmpOriginY = (m_size.y - tmpSizeY) / 2;
|
||||
// no change for the text orogin :
|
||||
int32_t tmpTextOriginX = (m_size.x - tmpSizeX) / 2 + borderSize + 2*paddingSize;
|
||||
int32_t tmpTextOriginY = (m_size.y - tmpSizeY) / 2 + borderSize + 2*paddingSize;
|
||||
|
||||
if (true==m_userFillX) {
|
||||
tmpSizeX = m_size.x;
|
||||
tmpOriginX = 0;
|
||||
}
|
||||
if (true==m_userFillY) {
|
||||
tmpSizeY = m_size.y;
|
||||
tmpOriginY = 0;
|
||||
}
|
||||
tmpOriginX += paddingSize;
|
||||
tmpOriginY += paddingSize;
|
||||
tmpSizeX -= 2*paddingSize;
|
||||
tmpSizeY -= 2*paddingSize;
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
/*
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
int32_t fontHeight = ewol::GetHeight(fontId);
|
||||
int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
*/
|
||||
tmpText->Text(tmpTextOriginX, tmpTextOriginY, m_label.c_str(), m_size.x - borderSize - 2*paddingSize);
|
||||
|
||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||
tmpOObjects->SetColor(m_textColorBg);
|
||||
tmpOObjects->Rectangle( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
tmpOObjects->SetColor(m_textColorFg);
|
||||
tmpOObjects->RectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, borderSize);
|
||||
|
||||
AddOObject(tmpOObjects, "BouttonDecoration");
|
||||
|
||||
AddOObject(tmpText, "BouttonText");
|
||||
|
||||
// Regenerate the event Area:
|
||||
EventAreaRemoveAll();
|
||||
coord origin;
|
||||
coord size;
|
||||
origin.x = tmpOriginX;
|
||||
origin.y = tmpOriginY;
|
||||
size.x = tmpSizeX;
|
||||
size.y = tmpSizeY;
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventButtonPressed);
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_ENTER, ewolEventButtonEnter);
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_LEAVE, ewolEventButtonLeave);
|
||||
}
|
||||
if (true==m_userFillY) {
|
||||
tmpSizeY = m_size.y;
|
||||
tmpOriginY = 0;
|
||||
}
|
||||
tmpOriginX += paddingSize;
|
||||
tmpOriginY += paddingSize;
|
||||
tmpSizeX -= 2*paddingSize;
|
||||
tmpSizeY -= 2*paddingSize;
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
/*
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
int32_t fontHeight = ewol::GetHeight(fontId);
|
||||
int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
*/
|
||||
tmpText->Text(tmpTextOriginX, tmpTextOriginY, m_label.c_str(), m_size.x - borderSize - 2*paddingSize);
|
||||
|
||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||
tmpOObjects->SetColor(m_textColorBg);
|
||||
tmpOObjects->Rectangle( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
tmpOObjects->SetColor(m_textColorFg);
|
||||
tmpOObjects->RectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, borderSize);
|
||||
|
||||
AddOObject(tmpOObjects, "BouttonDecoration");
|
||||
|
||||
AddOObject(tmpText, "BouttonText");
|
||||
|
||||
// Regenerate the event Area:
|
||||
EventAreaRemoveAll();
|
||||
coord origin;
|
||||
coord size;
|
||||
origin.x = tmpOriginX;
|
||||
origin.y = tmpOriginY;
|
||||
size.x = tmpSizeX;
|
||||
size.y = tmpSizeY;
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventButtonPressed);
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_ENTER, ewolEventButtonEnter);
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_LEAVE, ewolEventButtonLeave);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -179,7 +181,7 @@ bool ewol::Button::OnEventArea(const char * generateEventId, etkFloat_t x, etkFl
|
||||
//eventIsOK = true;
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
} else if(ewolEventButtonEnter == generateEventId) {
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
//return eventIsOK;
|
||||
// in every case this not stop the propagation of the event
|
||||
|
@ -92,7 +92,7 @@ void ewol::CheckBox::SetValue(bool val)
|
||||
return;
|
||||
}
|
||||
m_value = val;
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
bool ewol::CheckBox::GetValue(void)
|
||||
@ -103,45 +103,46 @@ bool ewol::CheckBox::GetValue(void)
|
||||
|
||||
void ewol::CheckBox::OnRegenerateDisplay(void)
|
||||
{
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
if (true == NeedRedraw()) {
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
|
||||
int32_t borderWidth = 2;
|
||||
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
int32_t fontHeight = ewol::GetHeight(fontId);
|
||||
etkFloat_t boxSize = etk_max(20, fontHeight);
|
||||
//int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t posy = (m_size.y - fontHeight - 6)/2 + 3;
|
||||
//int32_t posx = (m_size.x - fontWidth - 6)/2 + 25;
|
||||
tmpText->Text(boxSize+5, posy, m_label.c_str(), m_size.x - (boxSize+5));
|
||||
|
||||
|
||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||
tmpOObjects->SetColor(m_textColorBg);
|
||||
tmpOObjects->Rectangle( 2.5, 2.5, boxSize, boxSize);
|
||||
tmpOObjects->SetColor(m_textColorFg);
|
||||
tmpOObjects->RectangleBorder( 2.5, 2.5, boxSize, boxSize, borderWidth);
|
||||
if (m_value) {
|
||||
tmpOObjects->Line( 2.5, 2.5, boxSize+2.5, boxSize+2.5, borderWidth);
|
||||
tmpOObjects->Line( 2.5, boxSize+2.5, boxSize+2.5, 2.5, borderWidth);
|
||||
}
|
||||
|
||||
AddOObject(tmpOObjects, "Decoration");
|
||||
AddOObject(tmpText, "Text");
|
||||
|
||||
int32_t borderWidth = 2;
|
||||
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
int32_t fontHeight = ewol::GetHeight(fontId);
|
||||
etkFloat_t boxSize = etk_max(20, fontHeight);
|
||||
//int32_t fontWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||
int32_t posy = (m_size.y - fontHeight - 6)/2 + 3;
|
||||
//int32_t posx = (m_size.x - fontWidth - 6)/2 + 25;
|
||||
tmpText->Text(boxSize+5, posy, m_label.c_str(), m_size.x - (boxSize+5));
|
||||
|
||||
|
||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||
tmpOObjects->SetColor(m_textColorBg);
|
||||
tmpOObjects->Rectangle( 2.5, 2.5, boxSize, boxSize);
|
||||
tmpOObjects->SetColor(m_textColorFg);
|
||||
tmpOObjects->RectangleBorder( 2.5, 2.5, boxSize, boxSize, borderWidth);
|
||||
if (m_value) {
|
||||
tmpOObjects->Line( 2.5, 2.5, boxSize+2.5, boxSize+2.5, borderWidth);
|
||||
tmpOObjects->Line( 2.5, boxSize+2.5, boxSize+2.5, 2.5, borderWidth);
|
||||
// Regenerate the event Area:
|
||||
EventAreaRemoveAll();
|
||||
coord origin;
|
||||
coord size;
|
||||
origin.x = 3.0;
|
||||
origin.y = 3.0;
|
||||
size.x = m_size.x-6;
|
||||
size.y = m_size.y-6;
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventCheckBoxClicked);
|
||||
}
|
||||
|
||||
AddOObject(tmpOObjects, "Decoration");
|
||||
AddOObject(tmpText, "Text");
|
||||
|
||||
// Regenerate the event Area:
|
||||
EventAreaRemoveAll();
|
||||
coord origin;
|
||||
coord size;
|
||||
origin.x = 3.0;
|
||||
origin.y = 3.0;
|
||||
size.x = m_size.x-6;
|
||||
size.y = m_size.y-6;
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventCheckBoxClicked);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@ -164,7 +165,7 @@ bool ewol::CheckBox::OnEventArea(const char * generateEventId, etkFloat_t x, etk
|
||||
} else {
|
||||
m_value = true;
|
||||
}
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
eventIsOK = true;
|
||||
}
|
||||
return eventIsOK;
|
||||
|
@ -99,7 +99,7 @@ void ewol::Entry::SetValue(etk::String newData)
|
||||
{
|
||||
m_data = newData;
|
||||
UpdateTextPosition();
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
etk::String ewol::Entry::GetValue(void)
|
||||
@ -110,62 +110,64 @@ etk::String ewol::Entry::GetValue(void)
|
||||
|
||||
void ewol::Entry::OnRegenerateDisplay(void)
|
||||
{
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
|
||||
// TODO later : Add this in the basic element of the widget ...
|
||||
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
int32_t tmpSizeY = m_minSize.y;
|
||||
int32_t tmpOriginX = 0;
|
||||
int32_t tmpOriginY = (m_size.y - tmpSizeY) / 2;
|
||||
// no change for the text orogin :
|
||||
int32_t tmpTextOriginX = m_borderSize + 2*m_paddingSize;
|
||||
int32_t tmpTextOriginY = tmpOriginY + m_borderSize + 2*m_paddingSize;
|
||||
|
||||
if (true==m_userFillX) {
|
||||
tmpSizeX = m_size.x;
|
||||
if (true == NeedRedraw()) {
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
|
||||
// TODO later : Add this in the basic element of the widget ...
|
||||
|
||||
int32_t tmpSizeX = m_minSize.x;
|
||||
int32_t tmpSizeY = m_minSize.y;
|
||||
int32_t tmpOriginX = 0;
|
||||
int32_t tmpOriginY = (m_size.y - tmpSizeY) / 2;
|
||||
// no change for the text orogin :
|
||||
int32_t tmpTextOriginX = m_borderSize + 2*m_paddingSize;
|
||||
int32_t tmpTextOriginY = tmpOriginY + m_borderSize + 2*m_paddingSize;
|
||||
|
||||
if (true==m_userFillX) {
|
||||
tmpSizeX = m_size.x;
|
||||
}
|
||||
if (true==m_userFillY) {
|
||||
//tmpSizeY = m_size.y;
|
||||
tmpOriginY = 0;
|
||||
tmpTextOriginY = tmpOriginY + m_borderSize + 2*m_paddingSize;
|
||||
}
|
||||
tmpOriginX += m_paddingSize;
|
||||
tmpOriginY += m_paddingSize;
|
||||
tmpSizeX -= 2*m_paddingSize;
|
||||
tmpSizeY -= 2*m_paddingSize;
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
tmpText->Text(tmpTextOriginX, tmpTextOriginY, m_data.c_str() + m_displayStartPosition, m_size.x - (m_borderSize + 2*m_paddingSize));
|
||||
|
||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||
tmpOObjects->SetColor(m_textColorBg);
|
||||
tmpOObjects->Rectangle( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
tmpOObjects->SetColor(m_textColorFg);
|
||||
tmpOObjects->RectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_borderSize);
|
||||
if (true == m_displayCursor) {
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
int32_t fontHeight = ewol::GetHeight(fontId);
|
||||
int32_t fontWidth = ewol::GetWidth(fontId, m_data.c_str() + m_displayStartPosition);
|
||||
int32_t XCursorPos = fontWidth + m_borderSize + 2*m_paddingSize;
|
||||
tmpOObjects->Line(XCursorPos, tmpTextOriginY, XCursorPos, tmpTextOriginY + fontHeight, 1);
|
||||
}
|
||||
|
||||
AddOObject(tmpOObjects, "BouttonDecoration");
|
||||
|
||||
AddOObject(tmpText, "BouttonText");
|
||||
|
||||
// Regenerate the event Area:
|
||||
EventAreaRemoveAll();
|
||||
coord origin;
|
||||
coord size;
|
||||
origin.x = tmpOriginX;
|
||||
origin.y = tmpOriginY;
|
||||
size.x = tmpSizeX;
|
||||
size.y = tmpSizeY;
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventEntryClick);
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_ENTER, ewolEventEntryEnter);
|
||||
}
|
||||
if (true==m_userFillY) {
|
||||
//tmpSizeY = m_size.y;
|
||||
tmpOriginY = 0;
|
||||
tmpTextOriginY = tmpOriginY + m_borderSize + 2*m_paddingSize;
|
||||
}
|
||||
tmpOriginX += m_paddingSize;
|
||||
tmpOriginY += m_paddingSize;
|
||||
tmpSizeX -= 2*m_paddingSize;
|
||||
tmpSizeY -= 2*m_paddingSize;
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
tmpText->Text(tmpTextOriginX, tmpTextOriginY, m_data.c_str() + m_displayStartPosition, m_size.x - (m_borderSize + 2*m_paddingSize));
|
||||
|
||||
ewol::OObject2DColored * tmpOObjects = new ewol::OObject2DColored;
|
||||
tmpOObjects->SetColor(m_textColorBg);
|
||||
tmpOObjects->Rectangle( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY);
|
||||
tmpOObjects->SetColor(m_textColorFg);
|
||||
tmpOObjects->RectangleBorder( tmpOriginX, tmpOriginY, tmpSizeX, tmpSizeY, m_borderSize);
|
||||
if (true == m_displayCursor) {
|
||||
int32_t fontId = GetDefaultFontId();
|
||||
int32_t fontHeight = ewol::GetHeight(fontId);
|
||||
int32_t fontWidth = ewol::GetWidth(fontId, m_data.c_str() + m_displayStartPosition);
|
||||
int32_t XCursorPos = fontWidth + m_borderSize + 2*m_paddingSize;
|
||||
tmpOObjects->Line(XCursorPos, tmpTextOriginY, XCursorPos, tmpTextOriginY + fontHeight, 1);
|
||||
}
|
||||
|
||||
AddOObject(tmpOObjects, "BouttonDecoration");
|
||||
|
||||
AddOObject(tmpText, "BouttonText");
|
||||
|
||||
// Regenerate the event Area:
|
||||
EventAreaRemoveAll();
|
||||
coord origin;
|
||||
coord size;
|
||||
origin.x = tmpOriginX;
|
||||
origin.y = tmpOriginY;
|
||||
size.x = tmpSizeX;
|
||||
size.y = tmpSizeY;
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventEntryClick);
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_ENTER, ewolEventEntryEnter);
|
||||
}
|
||||
|
||||
|
||||
@ -179,7 +181,7 @@ bool ewol::Entry::OnEventArea(const char * generateEventId, etkFloat_t x, etkFlo
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
ewol::KeyboardShow(KEYBOARD_MODE_CODE);
|
||||
} else if(ewolEventEntryEnter == generateEventId) {
|
||||
//OnRegenerateDisplay();
|
||||
//MarkToReedraw();
|
||||
}
|
||||
return eventIsOK;
|
||||
}
|
||||
@ -206,7 +208,7 @@ bool ewol::Entry::OnEventKb(eventKbType_te typeEvent, char UTF8_data[UTF8_MAX_SI
|
||||
m_data += UTF8_data;
|
||||
}
|
||||
UpdateTextPosition();
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -238,11 +240,11 @@ void ewol::Entry::UpdateTextPosition(void)
|
||||
void ewol::Entry::OnGetFocus(void)
|
||||
{
|
||||
m_displayCursor = true;
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
void ewol::Entry::OnLostFocus(void)
|
||||
{
|
||||
m_displayCursor = false;
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
@ -83,37 +83,39 @@ void ewol::Label::SetLabel(etk::String newLabel)
|
||||
|
||||
void ewol::Label::OnRegenerateDisplay(void)
|
||||
{
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
|
||||
int32_t paddingSize = 3;
|
||||
|
||||
int32_t tmpOriginX = 0;
|
||||
int32_t tmpOriginY = 0;
|
||||
|
||||
if (true==m_userFillX) {
|
||||
tmpOriginX = (m_size.x - m_minSize.x) / 2;
|
||||
if (true == NeedRedraw()) {
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
|
||||
int32_t paddingSize = 3;
|
||||
|
||||
int32_t tmpOriginX = 0;
|
||||
int32_t tmpOriginY = 0;
|
||||
|
||||
if (true==m_userFillX) {
|
||||
tmpOriginX = (m_size.x - m_minSize.x) / 2;
|
||||
}
|
||||
if (true==m_userFillY) {
|
||||
tmpOriginY = (m_size.y - m_minSize.y) / 2;
|
||||
}
|
||||
tmpOriginX += paddingSize;
|
||||
tmpOriginY += paddingSize;
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
tmpText->Text(tmpOriginX, tmpOriginY, m_label.c_str(), m_size.x - 2*paddingSize);
|
||||
|
||||
AddOObject(tmpText, "LabelText");
|
||||
|
||||
// Regenerate the event Area:
|
||||
EventAreaRemoveAll();
|
||||
coord origin;
|
||||
coord size;
|
||||
origin.x = tmpOriginX;
|
||||
origin.y = tmpOriginY;
|
||||
size.x = m_minSize.x;
|
||||
size.y = m_minSize.y;
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventLabelPressed);
|
||||
}
|
||||
if (true==m_userFillY) {
|
||||
tmpOriginY = (m_size.y - m_minSize.y) / 2;
|
||||
}
|
||||
tmpOriginX += paddingSize;
|
||||
tmpOriginY += paddingSize;
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
tmpText->Text(tmpOriginX, tmpOriginY, m_label.c_str(), m_size.x - 2*paddingSize);
|
||||
|
||||
AddOObject(tmpText, "LabelText");
|
||||
|
||||
// Regenerate the event Area:
|
||||
EventAreaRemoveAll();
|
||||
coord origin;
|
||||
coord size;
|
||||
origin.x = tmpOriginX;
|
||||
origin.y = tmpOriginY;
|
||||
size.x = m_minSize.x;
|
||||
size.y = m_minSize.y;
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventLabelPressed);
|
||||
}
|
||||
|
||||
bool ewol::Label::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y)
|
||||
|
@ -69,60 +69,61 @@ bool ewol::List::CalculateMinSize(void)
|
||||
|
||||
void ewol::List::OnRegenerateDisplay(void)
|
||||
{
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
//EWOL_DEBUG("OnRegenerateDisplay(" << m_size.x << "," << m_size.y << ")");
|
||||
|
||||
int32_t tmpOriginX = 0;
|
||||
int32_t tmpOriginY = 0;
|
||||
int32_t tmpOriginYBG = 0;
|
||||
/*
|
||||
if (true==m_userFillX) {
|
||||
tmpOriginX = 0;
|
||||
}
|
||||
if (true==m_userFillY) {
|
||||
tmpOriginY = 0;
|
||||
}*/
|
||||
tmpOriginX += m_paddingSizeX;
|
||||
tmpOriginY += m_paddingSizeY;
|
||||
|
||||
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();
|
||||
color_ts basicBG = GetBasicBG();
|
||||
BGOObjects->SetColor(basicBG);
|
||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||
|
||||
uint32_t displayableRaw = m_size.y / (minHeight + 2*m_paddingSizeY);
|
||||
|
||||
// We display only compleate lines ...
|
||||
for(uint32_t iii=0; iii<nbRaw && iii<displayableRaw; 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_paddingSizeY);
|
||||
tmpOriginYBG += minHeight+2*m_paddingSizeY;
|
||||
if (true == NeedRedraw()) {
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
//EWOL_DEBUG("OnRegenerateDisplay(" << m_size.x << "," << m_size.y << ")");
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, fg);
|
||||
tmpText->Text(tmpOriginX, tmpOriginY, myTextToWrite.c_str(), m_size.x - (2*m_paddingSizeX));
|
||||
AddOObject(tmpText);
|
||||
tmpOriginY += minHeight + 2* m_paddingSizeY;
|
||||
int32_t tmpOriginX = 0;
|
||||
int32_t tmpOriginY = 0;
|
||||
int32_t tmpOriginYBG = 0;
|
||||
/*
|
||||
if (true==m_userFillX) {
|
||||
tmpOriginX = 0;
|
||||
}
|
||||
if (true==m_userFillY) {
|
||||
tmpOriginY = 0;
|
||||
}*/
|
||||
tmpOriginX += m_paddingSizeX;
|
||||
tmpOriginY += m_paddingSizeY;
|
||||
|
||||
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();
|
||||
color_ts basicBG = GetBasicBG();
|
||||
BGOObjects->SetColor(basicBG);
|
||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||
|
||||
uint32_t displayableRaw = m_size.y / (minHeight + 2*m_paddingSizeY);
|
||||
|
||||
// We display only compleate lines ...
|
||||
for(uint32_t iii=0; iii<nbRaw && iii<displayableRaw; 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_paddingSizeY);
|
||||
tmpOriginYBG += minHeight+2*m_paddingSizeY;
|
||||
|
||||
ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, fg);
|
||||
tmpText->Text(tmpOriginX, tmpOriginY, myTextToWrite.c_str(), m_size.x - (2*m_paddingSizeX));
|
||||
AddOObject(tmpText);
|
||||
tmpOriginY += minHeight + 2* m_paddingSizeY;
|
||||
}
|
||||
AddOObject(BGOObjects, "ListDeco", 0);
|
||||
//ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
//tmpText->Text(tmpOriginX, tmpOriginY, "jhgjhg");
|
||||
|
||||
//AddOObject(tmpText, "ListText");
|
||||
}
|
||||
AddOObject(BGOObjects, "ListDeco", 0);
|
||||
//ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||
//tmpText->Text(tmpOriginX, tmpOriginY, "jhgjhg");
|
||||
|
||||
//AddOObject(tmpText, "ListText");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -84,6 +84,7 @@ bool ewol::PopUp::CalculateSize(etkFloat_t availlableX, etkFloat_t availlableY)
|
||||
m_subWidget->SetOrigin(subWidgetOrigin.x, subWidgetOrigin.y);
|
||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -149,11 +150,13 @@ bool ewol::PopUp::OnDraw(void)
|
||||
|
||||
void ewol::PopUp::OnRegenerateDisplay(void)
|
||||
{
|
||||
if (true == NeedRedraw()) {
|
||||
}
|
||||
// generate a white background and take gray on other surfaces
|
||||
ClearOObjectList();
|
||||
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
||||
AddOObject(BGOObjects, "ListDeco");
|
||||
|
||||
|
||||
BGOObjects->SetColor(m_colorEmptyArea);
|
||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||
// set the area in white ...
|
||||
|
@ -90,6 +90,7 @@ bool ewol::SizerHori::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl
|
||||
}
|
||||
}
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,7 @@ bool ewol::SizerVert::CalculateSize(etkFloat_t availlableX, etkFloat_t availlabl
|
||||
}
|
||||
}
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -55,5 +55,6 @@ bool ewol::Spacer::CalculateMinSize(void)
|
||||
void ewol::Spacer::SetSize(etkFloat_t size)
|
||||
{
|
||||
m_size = size;
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
|
@ -57,101 +57,103 @@ bool ewol::Test::CalculateMinSize(void)
|
||||
|
||||
void ewol::Test::OnRegenerateDisplay(void)
|
||||
{
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
ewol::OObject2DColored * tmpOObjects = NULL;
|
||||
|
||||
tmpOObjects = new ewol::OObject2DColored;
|
||||
|
||||
tmpOObjects->SetColor(1.0, 0.0, 0.0, 1.0);
|
||||
tmpOObjects->Rectangle( 0, 0, m_size.x, m_size.y);
|
||||
tmpOObjects->SetColor(1.0, 1.0, 1.0, 1.0);
|
||||
tmpOObjects->Rectangle( 3, 3, m_size.x-6, m_size.y-6);
|
||||
|
||||
tmpOObjects->SetColor(0.0, 0.0, 1.0, 1.0);
|
||||
|
||||
if (0 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 100, 50, 10); // 0°
|
||||
} else if (1 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 100, 100, 15); // 45°
|
||||
} else if (2 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 50, 100, 20); // 90°
|
||||
} else if (3 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 0, 100, 5); // 135°
|
||||
} else if (4 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 0, 50, 3); // 180°
|
||||
} else if (5 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 0, 0, 2); // 225°
|
||||
} else if (6 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 50, 0, 1); // °
|
||||
} else {
|
||||
tmpOObjects->Line(50, 50, 100, 0, 0.5); // °
|
||||
if (true == NeedRedraw()) {
|
||||
// clean the object list ...
|
||||
ClearOObjectList();
|
||||
ewol::OObject2DColored * tmpOObjects = NULL;
|
||||
|
||||
tmpOObjects = new ewol::OObject2DColored;
|
||||
|
||||
tmpOObjects->SetColor(1.0, 0.0, 0.0, 1.0);
|
||||
tmpOObjects->Rectangle( 0, 0, m_size.x, m_size.y);
|
||||
tmpOObjects->SetColor(1.0, 1.0, 1.0, 1.0);
|
||||
tmpOObjects->Rectangle( 3, 3, m_size.x-6, m_size.y-6);
|
||||
|
||||
tmpOObjects->SetColor(0.0, 0.0, 1.0, 1.0);
|
||||
|
||||
if (0 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 100, 50, 10); // 0°
|
||||
} else if (1 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 100, 100, 15); // 45°
|
||||
} else if (2 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 50, 100, 20); // 90°
|
||||
} else if (3 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 0, 100, 5); // 135°
|
||||
} else if (4 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 0, 50, 3); // 180°
|
||||
} else if (5 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 0, 0, 2); // 225°
|
||||
} else if (6 == m_elementID) {
|
||||
tmpOObjects->Line(50, 50, 50, 0, 1); // °
|
||||
} else {
|
||||
tmpOObjects->Line(50, 50, 100, 0, 0.5); // °
|
||||
}
|
||||
|
||||
if (0 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->Disc(200, 100, 5);
|
||||
} else if (1 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->Disc(200, 100, 10);
|
||||
} else if (2 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->Disc(200, 100, 15);
|
||||
} else if (3 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->Disc(200, 100, 20);
|
||||
} else if (4 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->Disc(200, 100, 25);
|
||||
} else if (5 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 0.75);
|
||||
tmpOObjects->Disc(200, 100, 100);
|
||||
} else if (6 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 0.75);
|
||||
tmpOObjects->Disc(200, 100, 200);
|
||||
} else {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 0.5);
|
||||
tmpOObjects->Disc(200, 100, 300);
|
||||
}
|
||||
tmpOObjects->SetColor(0.0, 0.0, 0.0, 1.0);
|
||||
if (0 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 10, 3);
|
||||
} else if (1 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 20, 3);
|
||||
} else if (2 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 30, 2);
|
||||
} else if (3 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 40, 1);
|
||||
} else if (4 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 50, 0.5);
|
||||
} else if (5 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 100, 25);
|
||||
} else if (6 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 100, 35);
|
||||
} else {
|
||||
tmpOObjects->Circle(100, 100, 100, 50);
|
||||
}
|
||||
tmpOObjects->SetColor(1.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->DiscPart(150, 60, 60, 45, 180);
|
||||
tmpOObjects->SetColor(0.0, 0.0, 0.0, 1.0);
|
||||
tmpOObjects->CirclePart(150, 60, 60, 2, 45, 180);
|
||||
|
||||
AddOObject(tmpOObjects, "BouttonDecoration");
|
||||
/*
|
||||
tmpOObjects = new ewol::OObject2DColored;
|
||||
ewol::theme::Generate(0, 0, *tmpOObjects, 50, 50, m_size.x*0.75, m_size.y*0.75);
|
||||
AddOObject(tmpOObjects, "themeObject");
|
||||
*/
|
||||
|
||||
// Regenerate the event Area:
|
||||
EventAreaRemoveAll();
|
||||
coord origin;
|
||||
coord size;
|
||||
origin.x = 3.0;
|
||||
origin.y = 3.0;
|
||||
size.x = m_size.x-6;
|
||||
size.y = m_size.y-6;
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventTestPressed);
|
||||
}
|
||||
|
||||
if (0 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->Disc(200, 100, 5);
|
||||
} else if (1 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->Disc(200, 100, 10);
|
||||
} else if (2 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->Disc(200, 100, 15);
|
||||
} else if (3 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->Disc(200, 100, 20);
|
||||
} else if (4 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->Disc(200, 100, 25);
|
||||
} else if (5 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 0.75);
|
||||
tmpOObjects->Disc(200, 100, 100);
|
||||
} else if (6 == m_elementID) {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 0.75);
|
||||
tmpOObjects->Disc(200, 100, 200);
|
||||
} else {
|
||||
tmpOObjects->SetColor(0.0, 1.0, 0.0, 0.5);
|
||||
tmpOObjects->Disc(200, 100, 300);
|
||||
}
|
||||
tmpOObjects->SetColor(0.0, 0.0, 0.0, 1.0);
|
||||
if (0 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 10, 3);
|
||||
} else if (1 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 20, 3);
|
||||
} else if (2 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 30, 2);
|
||||
} else if (3 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 40, 1);
|
||||
} else if (4 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 50, 0.5);
|
||||
} else if (5 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 100, 25);
|
||||
} else if (6 == m_elementID) {
|
||||
tmpOObjects->Circle(100, 100, 100, 35);
|
||||
} else {
|
||||
tmpOObjects->Circle(100, 100, 100, 50);
|
||||
}
|
||||
tmpOObjects->SetColor(1.0, 1.0, 0.0, 1.0);
|
||||
tmpOObjects->DiscPart(150, 60, 60, 45, 180);
|
||||
tmpOObjects->SetColor(0.0, 0.0, 0.0, 1.0);
|
||||
tmpOObjects->CirclePart(150, 60, 60, 2, 45, 180);
|
||||
|
||||
AddOObject(tmpOObjects, "BouttonDecoration");
|
||||
/*
|
||||
tmpOObjects = new ewol::OObject2DColored;
|
||||
ewol::theme::Generate(0, 0, *tmpOObjects, 50, 50, m_size.x*0.75, m_size.y*0.75);
|
||||
AddOObject(tmpOObjects, "themeObject");
|
||||
*/
|
||||
|
||||
// Regenerate the event Area:
|
||||
EventAreaRemoveAll();
|
||||
coord origin;
|
||||
coord size;
|
||||
origin.x = 3.0;
|
||||
origin.y = 3.0;
|
||||
size.x = m_size.x-6;
|
||||
size.y = m_size.y-6;
|
||||
AddEventArea(origin, size, FLAG_EVENT_INPUT_1 | FLAG_EVENT_INPUT_CLICKED_ALL, ewolEventTestPressed);
|
||||
}
|
||||
|
||||
bool ewol::Test::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloat_t y)
|
||||
@ -163,7 +165,7 @@ bool ewol::Test::OnEventArea(const char * generateEventId, etkFloat_t x, etkFloa
|
||||
if (m_elementID > 7 ) {
|
||||
m_elementID = 0;
|
||||
}
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
eventIsOK = true;
|
||||
}
|
||||
return eventIsOK;
|
||||
|
64
Sources/libewol/ewol/widget/WidgetScrolled.cpp
Normal file
64
Sources/libewol/ewol/widget/WidgetScrolled.cpp
Normal file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/widget/WidgetScrolled.cpp
|
||||
* @brief ewol Scrooled widget system (Sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 06/02/2012
|
||||
* @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/widget/WidgetScrolled.h>
|
||||
|
||||
#include <ewol/OObject.h>
|
||||
#include <ewol/WidgetManager.h>
|
||||
|
||||
|
||||
|
||||
ewol::WidgetScrooled::WidgetScrooled(void)
|
||||
{
|
||||
m_originScrooledX = 0;
|
||||
m_originScrooledY = 0;
|
||||
m_pixelScrolling = 20;
|
||||
}
|
||||
|
||||
ewol::WidgetScrooled::~WidgetScrooled(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool ewol::WidgetScrooled::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y)
|
||||
{
|
||||
|
||||
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
EWOL_INFO("mouse-event GDK_SCROLL_UP");
|
||||
m_originScrooledY -= m_pixelScrolling;
|
||||
if (m_originScrooledY < 0) {
|
||||
m_originScrooledY = 0;
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
EWOL_INFO("mouse-event GDK_SCROLL_DOWN");
|
||||
m_originScrooledY += m_pixelScrolling;
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
49
Sources/libewol/ewol/widget/WidgetScrolled.h
Normal file
49
Sources/libewol/ewol/widget/WidgetScrolled.h
Normal file
@ -0,0 +1,49 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file ewol/widget/WidgetScrolled.h
|
||||
* @brief ewol Scrooled widget system (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 06/02/2012
|
||||
* @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_SCROLLED_WIDGET_H__
|
||||
#define __EWOL_SCROLLED_WIDGET_H__
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/Widget.h>
|
||||
|
||||
namespace ewol {
|
||||
class WidgetScrooled :public ewol::Widget
|
||||
{
|
||||
protected:
|
||||
int32_t m_originScrooledX;
|
||||
int32_t m_originScrooledY;
|
||||
private:
|
||||
uint32_t m_pixelScrolling;
|
||||
public:
|
||||
WidgetScrooled(void);
|
||||
virtual ~WidgetScrooled(void);
|
||||
virtual bool OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y);
|
||||
protected:
|
||||
void SetScrollingSize(uint32_t nbPixel) { m_pixelScrolling = nbPixel; };
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
@ -77,7 +77,7 @@ class FileChooserFolderList : public ewol::List
|
||||
{
|
||||
etk::String* tmpEmement = new etk::String(element);
|
||||
m_listDirectory.PushBack(tmpEmement);
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
void ClearElements(void) {
|
||||
for (int32_t iii=0; iii<m_listDirectory.Size(); iii++) {
|
||||
@ -87,7 +87,7 @@ class FileChooserFolderList : public ewol::List
|
||||
}
|
||||
}
|
||||
m_listDirectory.Clear();
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
etk::String GetSelectedLine(void)
|
||||
@ -159,7 +159,7 @@ class FileChooserFolderList : public ewol::List
|
||||
m_selectedLine = raw;
|
||||
}
|
||||
// need to regenerate the display of the list :
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -211,7 +211,7 @@ class FileChooserFileList : public ewol::List
|
||||
{
|
||||
etk::String* tmpEmement = new etk::String(element);
|
||||
m_listFile.PushBack(tmpEmement);
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
void ClearElements(void) {
|
||||
for (int32_t iii=0; iii<m_listFile.Size(); iii++) {
|
||||
@ -221,7 +221,7 @@ class FileChooserFileList : public ewol::List
|
||||
}
|
||||
}
|
||||
m_listFile.Clear();
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
}
|
||||
|
||||
etk::String GetSelectedLine(void)
|
||||
@ -284,7 +284,7 @@ class FileChooserFileList : public ewol::List
|
||||
m_selectedLine = raw;
|
||||
}
|
||||
// need to regenerate the display of the list :
|
||||
OnRegenerateDisplay();
|
||||
MarkToReedraw();
|
||||
if (m_selectedLine >=0 ) {
|
||||
// generate event extern :
|
||||
return GenEventInputExternal(ewolEventFileChooserSelectFile, x, y);
|
||||
|
@ -237,6 +237,7 @@ bool ewol::Keyboard::CalculateSize(etkFloat_t availlableX, etkFloat_t availlable
|
||||
m_subWidget->SetOrigin(m_origin.x, m_origin.y);
|
||||
m_subWidget->CalculateSize(subWidgetSize.x, subWidgetSize.y);
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -270,19 +271,19 @@ bool ewol::Keyboard::OnDraw(void)
|
||||
|
||||
void ewol::Keyboard::OnRegenerateDisplay(void)
|
||||
{
|
||||
color_ts mycolor;
|
||||
mycolor.red = 1.0;
|
||||
mycolor.green = 1.0;
|
||||
mycolor.blue = 1.0;
|
||||
mycolor.alpha = 0.50;
|
||||
|
||||
// generate a white background and take gray on other surfaces
|
||||
ClearOObjectList();
|
||||
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
||||
|
||||
BGOObjects->SetColor(mycolor);
|
||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||
AddOObject(BGOObjects, "ListDeco");
|
||||
if (true == NeedRedraw()) {
|
||||
color_ts mycolor;
|
||||
mycolor.red = 1.0;
|
||||
mycolor.green = 1.0;
|
||||
mycolor.blue = 1.0;
|
||||
mycolor.alpha = 0.50;
|
||||
// generate a white background and take gray on other surfaces
|
||||
ClearOObjectList();
|
||||
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
||||
BGOObjects->SetColor(mycolor);
|
||||
BGOObjects->Rectangle(0, 0, m_size.x, m_size.y);
|
||||
AddOObject(BGOObjects, "ListDeco");
|
||||
}
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->OnRegenerateDisplay();
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ FILE_LIST = ewol/ewol.cpp \
|
||||
ewol/WidgetManager.cpp \
|
||||
ewol/WidgetMessageMultiCast.cpp \
|
||||
ewol/Windows.cpp \
|
||||
ewol/widget/WidgetScrolled.cpp \
|
||||
ewol/widget/Button.cpp \
|
||||
ewol/widget/Label.cpp \
|
||||
ewol/widget/CheckBox.cpp \
|
||||
|
Loading…
x
Reference in New Issue
Block a user