First step to the List Display
This commit is contained in:
parent
abec5813db
commit
1daa4b8ee0
@ -3,7 +3,7 @@
|
|||||||
* @file ewol/widget/List.cpp
|
* @file ewol/widget/List.cpp
|
||||||
* @brief ewol list widget system (Sources)
|
* @brief ewol list widget system (Sources)
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @date 07/11/2011
|
* @date 27/12/2011
|
||||||
* @par Project
|
* @par Project
|
||||||
* ewol
|
* ewol
|
||||||
*
|
*
|
||||||
@ -25,6 +25,66 @@
|
|||||||
|
|
||||||
#include <ewol/widget/List.h>
|
#include <ewol/widget/List.h>
|
||||||
|
|
||||||
|
#include <ewol/OObject.h>
|
||||||
|
#include <ewol/WidgetManager.h>
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "ewol::List"
|
#define __class__ "ewol::List"
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::List::Init(void)
|
||||||
|
{
|
||||||
|
m_paddingSize = 2;
|
||||||
|
SetCanHaveFocus(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ewol::List::List(void)
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
}
|
||||||
|
|
||||||
|
ewol::List::~List(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ewol::List::CalculateMinSize(void)
|
||||||
|
{
|
||||||
|
/*int32_t fontId = GetDefaultFontId();
|
||||||
|
int32_t minWidth = ewol::GetWidth(fontId, m_label.c_str());
|
||||||
|
int32_t minHeight = ewol::GetHeight(fontId);
|
||||||
|
m_minSize.x = 3+minWidth;
|
||||||
|
m_minSize.y = 3+minHeight;
|
||||||
|
*/
|
||||||
|
m_minSize.x = 150;
|
||||||
|
m_minSize.y = 150;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ewol::List::OnRegenerateDisplay(void)
|
||||||
|
{
|
||||||
|
// clean the object list ...
|
||||||
|
ClearOObjectList();
|
||||||
|
|
||||||
|
|
||||||
|
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 += m_paddingSize;
|
||||||
|
tmpOriginY += m_paddingSize;
|
||||||
|
|
||||||
|
//ewol::OObject2DText * tmpText = new ewol::OObject2DText("", -1, m_textColorFg);
|
||||||
|
//tmpText->Text(tmpOriginX, tmpOriginY, "jhgjhg");
|
||||||
|
|
||||||
|
//AddOObject(tmpText, "ListText");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* @file ewol/widget/List.h
|
* @file ewol/widget/List.h
|
||||||
* @brief ewol list widget system (header)
|
* @brief ewol list widget system (header)
|
||||||
* @author Edouard DUPIN
|
* @author Edouard DUPIN
|
||||||
* @date 07/11/2011
|
* @date 27/12/2011
|
||||||
* @par Project
|
* @par Project
|
||||||
* ewol
|
* ewol
|
||||||
*
|
*
|
||||||
@ -30,11 +30,61 @@
|
|||||||
#include <ewol/Widget.h>
|
#include <ewol/Widget.h>
|
||||||
|
|
||||||
namespace ewol {
|
namespace ewol {
|
||||||
|
typedef enum {
|
||||||
|
EVENT_LIST_CKICKED,
|
||||||
|
EVENT_LIST_LEFT_CKICKED,
|
||||||
|
} listEvent_te;
|
||||||
|
|
||||||
|
|
||||||
class List :public ewol::Widget
|
class List :public ewol::Widget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
List(void) { };
|
List(void);
|
||||||
virtual ~List(void) { };
|
void Init(void);
|
||||||
|
virtual ~List(void);
|
||||||
|
virtual bool CalculateMinSize(void);
|
||||||
|
void SetLabel(etk::String newLabel);
|
||||||
|
private:
|
||||||
|
int32_t m_paddingSize;
|
||||||
|
int32_t m_displayStartRaw; //!< Current starting diaplayed raw
|
||||||
|
int32_t m_diaplayCurrentNbLine; //!< Number of line in the display
|
||||||
|
public:
|
||||||
|
virtual void OnRegenerateDisplay(void);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// function call to display the list :
|
||||||
|
virtual int32_t GetNuberOfColomn(void) {
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
virtual bool GetTitle(int32_t colomn, etk::String &myTitle, color_ts &fg, color_ts &bg) {
|
||||||
|
myTitle = "";
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
virtual int32_t GetNuberOfRaw(void) {
|
||||||
|
return 0;
|
||||||
|
};
|
||||||
|
virtual bool GetElement(int32_t colomn, int32_t raw, etk::String &myTextToWrite, color_ts &fg, color_ts &bg) {
|
||||||
|
myTextToWrite = "";
|
||||||
|
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 false;
|
||||||
|
};
|
||||||
|
virtual bool OnItemEvent(listEvent_te event, int32_t colomn, int32_t raw, etkFloat_t x, etkFloat_t y) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user