From 64a557145108234ab43b87f3d145b7749d78f9f5 Mon Sep 17 00:00:00 2001 From: Edouard Dupin Date: Fri, 10 Feb 2012 18:23:34 +0100 Subject: [PATCH] add scrolling on the list --- Sources/libewol/ewol/widget/Button.cpp | 4 ++- Sources/libewol/ewol/widget/List.cpp | 29 +++++++++++++++++-- Sources/libewol/ewol/widget/List.h | 4 +-- .../libewol/ewol/widget/WidgetScrolled.cpp | 1 - avancement.boo | 7 +++++ 5 files changed, 38 insertions(+), 7 deletions(-) diff --git a/Sources/libewol/ewol/widget/Button.cpp b/Sources/libewol/ewol/widget/Button.cpp index 85b8ea57..60eb7074 100644 --- a/Sources/libewol/ewol/widget/Button.cpp +++ b/Sources/libewol/ewol/widget/Button.cpp @@ -158,7 +158,9 @@ bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, et { //EWOL_DEBUG("Event on BT ..."); if (1 == IdInput) { - if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) { + if( ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent + || ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent + || ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) { // nothing to do ... GenEventInputExternal(ewolEventButtonPressed, x, y); MarkToReedraw(); diff --git a/Sources/libewol/ewol/widget/List.cpp b/Sources/libewol/ewol/widget/List.cpp index d91364d5..c38726c0 100644 --- a/Sources/libewol/ewol/widget/List.cpp +++ b/Sources/libewol/ewol/widget/List.cpp @@ -70,6 +70,7 @@ bool ewol::List::CalculateMinSize(void) void ewol::List::OnRegenerateDisplay(void) { if (true == NeedRedraw()) { + // clean the object list ... ClearOObjectList(); //EWOL_DEBUG("OnRegenerateDisplay(" << m_size.x << "," << m_size.y << ")"); @@ -94,6 +95,11 @@ void ewol::List::OnRegenerateDisplay(void) //uint32_t nbColomn = GetNuberOfColomn(); uint32_t nbRaw = GetNuberOfRaw(); + // For the scrooling windows + m_maxSize.x = m_size.x; + m_maxSize.y = minHeight * nbRaw; + + etk::VectorType listSizeColomn; ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored(); @@ -103,8 +109,13 @@ void ewol::List::OnRegenerateDisplay(void) uint32_t displayableRaw = m_size.y / (minHeight + 2*m_paddingSizeY); + int32_t startRaw = m_originScrooled.y / minHeight - 1; + if (startRaw<0) { + startRaw = 0; + } // We display only compleate lines ... - for(uint32_t iii=0; iii" << (startRaw+displayableRaw) << " in " << nbRaw << "raws"); + for(uint32_t iii=startRaw; iiiText(tmpOriginX, tmpOriginY, "jhgjhg"); //AddOObject(tmpText, "ListText"); + + // call the herited class... + WidgetScrooled::OnRegenerateDisplay(); } } bool ewol::List::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, etkFloat_t x, etkFloat_t y) { + if (true == WidgetScrooled::OnEventInput(IdInput, typeEvent, x, y)) { + ewol::widgetManager::FocusKeep(this); + // nothing to do ... done on upper widet ... + return true; + } int32_t fontId = GetDefaultFontId(); //int32_t minWidth = ewol::GetWidth(fontId, m_label.c_str()); int32_t minHeight = ewol::GetHeight(fontId); - - int32_t rawID = (y - m_origin.y) / (minHeight + 2*m_paddingSizeY); + + int32_t startRaw = m_originScrooled.y / minHeight - 1; + if (startRaw<0) { + startRaw = 0; + } + int32_t rawID = (y - m_origin.y) / (minHeight + 2*m_paddingSizeY) + startRaw; //EWOL_DEBUG("OnEventInput(" << IdInput << "," << typeEvent << "," << 0 << "," << rawID << "," << x <<"," << y << ");"); bool isUsed = OnItemEvent(IdInput, typeEvent, 0, rawID, x, y); if (true == isUsed) { diff --git a/Sources/libewol/ewol/widget/List.h b/Sources/libewol/ewol/widget/List.h index e7d58797..71b5c252 100644 --- a/Sources/libewol/ewol/widget/List.h +++ b/Sources/libewol/ewol/widget/List.h @@ -27,10 +27,10 @@ #include #include -#include +#include namespace ewol { - class List :public ewol::Widget + class List :public ewol::WidgetScrooled { public: List(void); diff --git a/Sources/libewol/ewol/widget/WidgetScrolled.cpp b/Sources/libewol/ewol/widget/WidgetScrolled.cpp index 4628c11e..31c4c383 100644 --- a/Sources/libewol/ewol/widget/WidgetScrolled.cpp +++ b/Sources/libewol/ewol/widget/WidgetScrolled.cpp @@ -55,7 +55,6 @@ void ewol::WidgetScrooled::OnRegenerateDisplay(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_originScrooled.y -= m_pixelScrolling; diff --git a/avancement.boo b/avancement.boo index 09480a6b..01534a9c 100644 --- a/avancement.boo +++ b/avancement.boo @@ -1,5 +1,12 @@ Welcome in the developement file TODO list ... +Basic feature : + - Clipboard management + - Shortcut + - Exit confirmation (or event of exit request) + - Charset normaliqation + + List of feature needed for v1.0 # widget list : - Button Toogle