add scrolling on the list
This commit is contained in:
parent
6446535f31
commit
64a5571451
@ -158,7 +158,9 @@ bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, et
|
|||||||
{
|
{
|
||||||
//EWOL_DEBUG("Event on BT ...");
|
//EWOL_DEBUG("Event on BT ...");
|
||||||
if (1 == IdInput) {
|
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 ...
|
// nothing to do ...
|
||||||
GenEventInputExternal(ewolEventButtonPressed, x, y);
|
GenEventInputExternal(ewolEventButtonPressed, x, y);
|
||||||
MarkToReedraw();
|
MarkToReedraw();
|
||||||
|
@ -70,6 +70,7 @@ bool ewol::List::CalculateMinSize(void)
|
|||||||
void ewol::List::OnRegenerateDisplay(void)
|
void ewol::List::OnRegenerateDisplay(void)
|
||||||
{
|
{
|
||||||
if (true == NeedRedraw()) {
|
if (true == NeedRedraw()) {
|
||||||
|
|
||||||
// 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 << ")");
|
||||||
@ -94,6 +95,11 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
|
|
||||||
//uint32_t nbColomn = GetNuberOfColomn();
|
//uint32_t nbColomn = GetNuberOfColomn();
|
||||||
uint32_t nbRaw = GetNuberOfRaw();
|
uint32_t nbRaw = GetNuberOfRaw();
|
||||||
|
// For the scrooling windows
|
||||||
|
m_maxSize.x = m_size.x;
|
||||||
|
m_maxSize.y = minHeight * nbRaw;
|
||||||
|
|
||||||
|
|
||||||
etk::VectorType<int32_t> listSizeColomn;
|
etk::VectorType<int32_t> listSizeColomn;
|
||||||
|
|
||||||
ewol::OObject2DColored * BGOObjects = new ewol::OObject2DColored();
|
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);
|
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 ...
|
// 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;
|
etk::String myTextToWrite;
|
||||||
color_ts fg;
|
color_ts fg;
|
||||||
color_ts bg;
|
color_ts bg;
|
||||||
@ -123,17 +134,29 @@ void ewol::List::OnRegenerateDisplay(void)
|
|||||||
//tmpText->Text(tmpOriginX, tmpOriginY, "jhgjhg");
|
//tmpText->Text(tmpOriginX, tmpOriginY, "jhgjhg");
|
||||||
|
|
||||||
//AddOObject(tmpText, "ListText");
|
//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)
|
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 fontId = GetDefaultFontId();
|
||||||
//int32_t minWidth = ewol::GetWidth(fontId, m_label.c_str());
|
//int32_t minWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||||
int32_t minHeight = ewol::GetHeight(fontId);
|
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 << ");");
|
//EWOL_DEBUG("OnEventInput(" << IdInput << "," << typeEvent << "," << 0 << "," << rawID << "," << x <<"," << y << ");");
|
||||||
bool isUsed = OnItemEvent(IdInput, typeEvent, 0, rawID, x, y);
|
bool isUsed = OnItemEvent(IdInput, typeEvent, 0, rawID, x, y);
|
||||||
if (true == isUsed) {
|
if (true == isUsed) {
|
||||||
|
@ -27,10 +27,10 @@
|
|||||||
|
|
||||||
#include <etk/Types.h>
|
#include <etk/Types.h>
|
||||||
#include <ewol/Debug.h>
|
#include <ewol/Debug.h>
|
||||||
#include <ewol/Widget.h>
|
#include <ewol/widget/WidgetScrolled.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
class List :public ewol::Widget
|
class List :public ewol::WidgetScrooled
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
List(void);
|
List(void);
|
||||||
|
@ -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)
|
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) {
|
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||||
EWOL_INFO("mouse-event GDK_SCROLL_UP");
|
EWOL_INFO("mouse-event GDK_SCROLL_UP");
|
||||||
m_originScrooled.y -= m_pixelScrolling;
|
m_originScrooled.y -= m_pixelScrolling;
|
||||||
|
@ -1,5 +1,12 @@
|
|||||||
Welcome in the developement file TODO list ...
|
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
|
List of feature needed for v1.0
|
||||||
# widget list :
|
# widget list :
|
||||||
- Button Toogle
|
- Button Toogle
|
||||||
|
Loading…
x
Reference in New Issue
Block a user