add scrolling on the list

This commit is contained in:
Edouard Dupin 2012-02-10 18:23:34 +01:00
parent 6446535f31
commit 64a5571451
5 changed files with 38 additions and 7 deletions

View File

@ -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();

View File

@ -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<int32_t> 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<nbRaw && iii<displayableRaw; iii++) {
EWOL_DEBUG("Request drawing list : " << startRaw << "-->" << (startRaw+displayableRaw) << " in " << nbRaw << "raws");
for(uint32_t iii=startRaw; iii<nbRaw && iii<(startRaw+displayableRaw); iii++) {
etk::String myTextToWrite;
color_ts fg;
color_ts bg;
@ -123,17 +134,29 @@ void ewol::List::OnRegenerateDisplay(void)
//tmpText->Text(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) {

View File

@ -27,10 +27,10 @@
#include <etk/Types.h>
#include <ewol/Debug.h>
#include <ewol/Widget.h>
#include <ewol/widget/WidgetScrolled.h>
namespace ewol {
class List :public ewol::Widget
class List :public ewol::WidgetScrooled
{
public:
List(void);

View File

@ -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;

View File

@ -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