Test the basic list with one colomn

This commit is contained in:
Edouard Dupin 2011-12-28 11:31:46 +01:00
parent 7a36ff135f
commit 769f7b8a32
3 changed files with 86 additions and 6 deletions

View File

@ -12,7 +12,8 @@ include $(LOCAL_PATH)/file.mk
LOCAL_SRC_FILES := $(FILE_LIST) LOCAL_SRC_FILES := $(FILE_LIST)
LOCAL_LDLIBS := LOCAL_LDLIBS :=
LOCAL_CFLAGS := -DEWOL_USE_FREE_TYPE LOCAL_CFLAGS := -DEWOL_USE_FREE_TYPE \
-DDRAW_DEBUG_LEVEL=3 \
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)

View File

@ -33,6 +33,9 @@
#include <ewol/widget/Test.h> #include <ewol/widget/Test.h>
#include <ewol/widget/Label.h> #include <ewol/widget/Label.h>
#include <ewol/widget/Entry.h> #include <ewol/widget/Entry.h>
#include <ewol/widget/List.h>
#include <Debug.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
@ -41,6 +44,76 @@
// need to run xcompmgr to have transparency // need to run xcompmgr to have transparency
class MaListExemple : public ewol::List
{
public:
MaListExemple(void) { };
~MaListExemple(void) { };
virtual color_ts GetBasicBG(void) {
color_ts bg;
bg.red = 1.0;
bg.green = 0.0;
bg.blue = 0.0;
bg.alpha = 1.0;
return bg;
}
uint32_t GetNuberOfColomn(void) {
return 1;
};
bool GetTitle(int32_t colomn, etk::String &myTitle, color_ts &fg, color_ts &bg) {
myTitle = "title";
return true;
};
uint32_t GetNuberOfRaw(void) {
return 3;
};
bool GetElement(int32_t colomn, int32_t raw, etk::String &myTextToWrite, color_ts &fg, color_ts &bg) {
switch (raw) {
case 0:
myTextToWrite = "Ligne 1";
break;
case 1:
myTextToWrite = "ma ligne 2";
break;
case 2:
myTextToWrite = "ma ligne 3";
break;
default:
myTextToWrite = "ERROR";
break;
}
fg.red = 0.0;
fg.green = 0.0;
fg.blue = 0.0;
fg.alpha = 1.0;
if (raw % 2) {
bg.red = 1.0;
bg.green = 1.0;
bg.blue = 1.0;
bg.alpha = 1.0;
} else {
bg.red = 0.5;
bg.green = 0.5;
bg.blue = 0.5;
bg.alpha = 1.0;
}
return true;
};
bool OnItemEvent(int32_t IdInput, ewol::eventInputType_te typeEvent, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y) {
if (typeEvent == ewol::EVENT_INPUT_TYPE_SINGLE) {
DRAW_INFO("Event on List : IdInput=" << IdInput << " colomn=" << colomn << " raw=" << raw );
}
return false;
}
};
class Plop :public ewol::Windows class Plop :public ewol::Windows
{ {
public: public:
@ -50,6 +123,13 @@ class Plop :public ewol::Windows
ewol::SizerHori * mySizer = new ewol::SizerHori(); ewol::SizerHori * mySizer = new ewol::SizerHori();
SetSubWidget(mySizer); SetSubWidget(mySizer);
MaListExemple * myList = new MaListExemple();
//myList->SetExpendX(true);
myList->SetExpendY(true);
myList->SetFillY(true);
mySizer->SubWidgetAdd(myList);
ewol::SizerVert * mySizerVert = new ewol::SizerVert(); ewol::SizerVert * mySizerVert = new ewol::SizerVert();
mySizer->SubWidgetAdd(mySizerVert); mySizer->SubWidgetAdd(mySizerVert);
@ -99,10 +179,6 @@ class Plop :public ewol::Windows
myButton->SetExpendY(true); myButton->SetExpendY(true);
mySizerVert->SubWidgetAdd(myButton); mySizerVert->SubWidgetAdd(myButton);
myButton = new ewol::Button("Exemple 2");
myButton->SetExpendX(true);
myButton->SetFillY(true);
mySizer->SubWidgetAdd(myButton);
}; };
~Plop(void) ~Plop(void)

View File

@ -1,3 +1,6 @@
FILE_LIST = Main.cpp \ FILE_LIST = Main.cpp \
Debug.cpp \