[DEV] create a unique sizer for vert and hori ==> this is simple to manage
This commit is contained in:
parent
9a18f605d9
commit
b83589e174
2
external/etk
vendored
2
external/etk
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 3b6cd4880c0273e48092b5e0bdf493577a054f60
|
Subproject commit 28d5740bf514df698c2cb1f31d9f65ec73fbc392
|
@ -12,7 +12,6 @@
|
|||||||
#include <ewol/widget/Menu.h>
|
#include <ewol/widget/Menu.h>
|
||||||
#include <ewol/widget/Button.h>
|
#include <ewol/widget/Button.h>
|
||||||
#include <ewol/widget/ContextMenu.h>
|
#include <ewol/widget/ContextMenu.h>
|
||||||
#include <ewol/widget/SizerVert.h>
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Menu"
|
#define __class__ "Menu"
|
||||||
@ -32,7 +31,7 @@ widget::Menu::~Menu(void)
|
|||||||
void widget::Menu::SubWidgetRemoveAll(void)
|
void widget::Menu::SubWidgetRemoveAll(void)
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
widget::SizerHori::SubWidgetRemoveAll();
|
widget::Sizer::SubWidgetRemoveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::Menu::SubWidgetAdd(ewol::Widget* newWidget)
|
void widget::Menu::SubWidgetAdd(ewol::Widget* newWidget)
|
||||||
@ -91,7 +90,7 @@ int32_t widget::Menu::Add(int32_t parent, etk::UString label, etk::UString image
|
|||||||
// set the image if one is present ...
|
// set the image if one is present ...
|
||||||
myButton->SetImage(tmpObject->m_image);
|
myButton->SetImage(tmpObject->m_image);
|
||||||
// add it in the widget list
|
// add it in the widget list
|
||||||
widget::SizerHori::SubWidgetAdd(myButton);
|
widget::Sizer::SubWidgetAdd(myButton);
|
||||||
// keep the specific event ...
|
// keep the specific event ...
|
||||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed);
|
myButton->RegisterOnEvent(this, ewolEventButtonPressed, ewolEventButtonPressed);
|
||||||
tmpObject->m_widgetPointer = myButton;
|
tmpObject->m_widgetPointer = myButton;
|
||||||
@ -108,7 +107,7 @@ void widget::Menu::AddSpacer(void)
|
|||||||
void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data)
|
void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, const etk::UString& data)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
if (true == ewol::SizerHori::OnReceiveMessage(CallerObject, eventId, data)) {
|
if (true == ewol::Sizer$::OnReceiveMessage(CallerObject, eventId, data)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@ -158,13 +157,13 @@ void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * e
|
|||||||
|
|
||||||
m_widgetContextMenu->SetPositionMark(widget::CONTEXT_MENU_MARK_TOP, newPosition );
|
m_widgetContextMenu->SetPositionMark(widget::CONTEXT_MENU_MARK_TOP, newPosition );
|
||||||
|
|
||||||
widget::SizerVert * mySizerVert = NULL;
|
widget::Sizer * mySizer = NULL;
|
||||||
widget::Button * myButton = NULL;
|
widget::Button * myButton = NULL;
|
||||||
|
|
||||||
mySizerVert = new widget::SizerVert();
|
mySizer = new widget::Sizer(widget::Sizer::modeVert);
|
||||||
mySizerVert->LockExpendContamination(true);
|
mySizer->LockExpendContamination(true);
|
||||||
// set it in the pop-up-system :
|
// set it in the pop-up-system :
|
||||||
m_widgetContextMenu->SubWidgetSet(mySizerVert);
|
m_widgetContextMenu->SubWidgetSet(mySizer);
|
||||||
|
|
||||||
for(int32_t jjj=m_listElement.Size()-1; jjj>=0; jjj--) {
|
for(int32_t jjj=m_listElement.Size()-1; jjj>=0; jjj--) {
|
||||||
if (m_listElement[iii]!=NULL) {
|
if (m_listElement[iii]!=NULL) {
|
||||||
@ -179,7 +178,7 @@ void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * e
|
|||||||
myButton->SetExpendX(true);
|
myButton->SetExpendX(true);
|
||||||
myButton->SetFillX(true);
|
myButton->SetFillX(true);
|
||||||
// add it in the widget list
|
// add it in the widget list
|
||||||
mySizerVert->SubWidgetAdd(myButton);
|
mySizer->SubWidgetAdd(myButton);
|
||||||
m_listElement[jjj]->m_widgetPointer = myButton;
|
m_listElement[jjj]->m_widgetPointer = myButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,7 +195,7 @@ void widget::Menu::OnReceiveMessage(ewol::EObject * CallerObject, const char * e
|
|||||||
|
|
||||||
void widget::Menu::OnObjectRemove(ewol::EObject * removeObject)
|
void widget::Menu::OnObjectRemove(ewol::EObject * removeObject)
|
||||||
{
|
{
|
||||||
widget::SizerHori::OnObjectRemove(removeObject);
|
widget::Sizer::OnObjectRemove(removeObject);
|
||||||
if (m_widgetContextMenu == removeObject) {
|
if (m_widgetContextMenu == removeObject) {
|
||||||
m_widgetContextMenu = NULL;
|
m_widgetContextMenu = NULL;
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <etk/UString.h>
|
#include <etk/UString.h>
|
||||||
#include <ewol/debug.h>
|
#include <ewol/debug.h>
|
||||||
#include <ewol/widget/Widget.h>
|
#include <ewol/widget/Widget.h>
|
||||||
#include <ewol/widget/SizerHori.h>
|
#include <ewol/widget/Sizer.h>
|
||||||
#include <ewol/widget/ContextMenu.h>
|
#include <ewol/widget/ContextMenu.h>
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
@ -29,7 +29,7 @@ namespace widget {
|
|||||||
const char * m_generateEvent;
|
const char * m_generateEvent;
|
||||||
etk::UString m_message;
|
etk::UString m_message;
|
||||||
};
|
};
|
||||||
class Menu :public widget::SizerHori
|
class Menu :public widget::Sizer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Menu(void);
|
Menu(void);
|
||||||
|
@ -6,27 +6,38 @@
|
|||||||
* @license BSD v3 (see license file)
|
* @license BSD v3 (see license file)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/widget/SizerVert.h>
|
#include <ewol/widget/Sizer.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
|
|
||||||
|
|
||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "SizerVert"
|
#define __class__ "Sizer"
|
||||||
|
|
||||||
|
|
||||||
widget::SizerVert::SizerVert(void)
|
widget::Sizer::Sizer(widget::Sizer::displayMode_te mode):
|
||||||
|
m_mode(mode),
|
||||||
|
m_lockExpendContamination(false,false)
|
||||||
{
|
{
|
||||||
// set contamination enable
|
|
||||||
LockExpendContamination();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::SizerVert::~SizerVert(void)
|
widget::Sizer::~Sizer(void)
|
||||||
{
|
{
|
||||||
SubWidgetRemoveAll();
|
SubWidgetRemoveAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void widget::Sizer::SetMode(widget::Sizer::displayMode_te mode)
|
||||||
|
{
|
||||||
|
m_mode = mode;
|
||||||
|
MarkToRedraw();
|
||||||
|
}
|
||||||
|
|
||||||
bool widget::SizerVert::CalculateSize(float availlableX, float availlableY)
|
widget::Sizer::displayMode_te widget::Sizer::GetMode(void)
|
||||||
|
{
|
||||||
|
return m_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool widget::Sizer::CalculateSize(float availlableX, float availlableY)
|
||||||
{
|
{
|
||||||
//EWOL_DEBUG("Update Size");
|
//EWOL_DEBUG("Update Size");
|
||||||
m_size.setValue(availlableX, availlableY);
|
m_size.setValue(availlableX, availlableY);
|
||||||
@ -37,11 +48,20 @@ bool widget::SizerVert::CalculateSize(float availlableX, float availlableY)
|
|||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||||
if (NULL != m_subWidget[iii]) {
|
if (NULL != m_subWidget[iii]) {
|
||||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||||
unexpendableSize += tmpSize.y();
|
if (m_mode==widget::Sizer::modeVert) {
|
||||||
if (false == m_subWidget[iii]->CanExpentY()) {
|
unexpendableSize += tmpSize.y();
|
||||||
nbWidgetFixedSize++;
|
if (false == m_subWidget[iii]->CanExpentY()) {
|
||||||
|
nbWidgetFixedSize++;
|
||||||
|
} else {
|
||||||
|
nbWidgetNotFixedSize++;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
nbWidgetNotFixedSize++;
|
unexpendableSize += tmpSize.x();
|
||||||
|
if (false == m_subWidget[iii]->CanExpentX()) {
|
||||||
|
nbWidgetFixedSize++;
|
||||||
|
} else {
|
||||||
|
nbWidgetNotFixedSize++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,7 +69,11 @@ bool widget::SizerVert::CalculateSize(float availlableX, float availlableY)
|
|||||||
float sizeToAddAtEveryOne = 0;
|
float sizeToAddAtEveryOne = 0;
|
||||||
// 2 cases : 1 or more can Expend, or all is done ...
|
// 2 cases : 1 or more can Expend, or all is done ...
|
||||||
if (0 != nbWidgetNotFixedSize) {
|
if (0 != nbWidgetNotFixedSize) {
|
||||||
sizeToAddAtEveryOne = (m_size.y() - unexpendableSize) / nbWidgetNotFixedSize;
|
if (m_mode==widget::Sizer::modeVert) {
|
||||||
|
sizeToAddAtEveryOne = (m_size.y() - unexpendableSize) / nbWidgetNotFixedSize;
|
||||||
|
} else {
|
||||||
|
sizeToAddAtEveryOne = (m_size.x() - unexpendableSize) / nbWidgetNotFixedSize;
|
||||||
|
}
|
||||||
if (sizeToAddAtEveryOne<0.0) {
|
if (sizeToAddAtEveryOne<0.0) {
|
||||||
sizeToAddAtEveryOne=0;
|
sizeToAddAtEveryOne=0;
|
||||||
}
|
}
|
||||||
@ -62,12 +86,22 @@ bool widget::SizerVert::CalculateSize(float availlableX, float availlableY)
|
|||||||
//EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")");
|
//EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")");
|
||||||
m_subWidget[iii]->SetOrigin(tmpOrigin.x(), tmpOrigin.y());
|
m_subWidget[iii]->SetOrigin(tmpOrigin.x(), tmpOrigin.y());
|
||||||
// Now Update his Size his size in X and the curent sizer size in Y:
|
// Now Update his Size his size in X and the curent sizer size in Y:
|
||||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
if (m_mode==widget::Sizer::modeVert) {
|
||||||
m_subWidget[iii]->CalculateSize(m_size.x(), tmpSize.y()+sizeToAddAtEveryOne);
|
if (true == m_subWidget[iii]->CanExpentY()) {
|
||||||
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y()+sizeToAddAtEveryOne);
|
m_subWidget[iii]->CalculateSize(m_size.x(), tmpSize.y()+sizeToAddAtEveryOne);
|
||||||
|
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y()+sizeToAddAtEveryOne);
|
||||||
|
} else {
|
||||||
|
m_subWidget[iii]->CalculateSize(m_size.x(), tmpSize.y());
|
||||||
|
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
m_subWidget[iii]->CalculateSize(m_size.x(), tmpSize.y());
|
if (true == m_subWidget[iii]->CanExpentX()) {
|
||||||
tmpOrigin.setY(tmpOrigin.y() + tmpSize.y());
|
m_subWidget[iii]->CalculateSize(tmpSize.x()+sizeToAddAtEveryOne, m_size.y());
|
||||||
|
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x()+sizeToAddAtEveryOne);
|
||||||
|
} else {
|
||||||
|
m_subWidget[iii]->CalculateSize(tmpSize.x(), m_size.y());
|
||||||
|
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -76,7 +110,7 @@ bool widget::SizerVert::CalculateSize(float availlableX, float availlableY)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool widget::SizerVert::CalculateMinSize(void)
|
bool widget::Sizer::CalculateMinSize(void)
|
||||||
{
|
{
|
||||||
//EWOL_DEBUG("Update minimum Size");
|
//EWOL_DEBUG("Update minimum Size");
|
||||||
m_userExpend.setValue(false, false);
|
m_userExpend.setValue(false, false);
|
||||||
@ -92,10 +126,17 @@ bool widget::SizerVert::CalculateMinSize(void)
|
|||||||
}
|
}
|
||||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
||||||
//EWOL_DEBUG("VERT : NewMinSize=" << tmpSize);
|
//EWOL_DEBUG("VERT : NewMinSize=" << tmpSize);
|
||||||
//EWOL_DEBUG(" Get minSize[" << iii << "] ("<< tmpSize.x << "," << tmpSize.y << ")");
|
//EWOL_DEBUG(" Get minSize[" << iii << "] "<< tmpSize);
|
||||||
m_minSize.setY(m_minSize.y() + tmpSize.y());
|
if (m_mode==widget::Sizer::modeVert) {
|
||||||
if (tmpSize.x()>m_minSize.x()) {
|
m_minSize.setY(m_minSize.y() + tmpSize.y());
|
||||||
m_minSize.setX(tmpSize.x());
|
if (tmpSize.x()>m_minSize.x()) {
|
||||||
|
m_minSize.setX(tmpSize.x());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m_minSize.setX(m_minSize.x() + tmpSize.x());
|
||||||
|
if (tmpSize.y()>m_minSize.y()) {
|
||||||
|
m_minSize.setY(tmpSize.y());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -103,45 +144,51 @@ bool widget::SizerVert::CalculateMinSize(void)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::SizerVert::SetMinSize(float x, float y)
|
void widget::Sizer::SetMinSize(float x, float y)
|
||||||
{
|
{
|
||||||
EWOL_ERROR("Sizer can not have a user Minimum size (herited from under elements)");
|
EWOL_ERROR("Sizer can not have a user Minimum size (herited from under elements)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::SizerVert::SetExpendX(bool newExpend)
|
void widget::Sizer::SetExpendX(bool newExpend)
|
||||||
{
|
{
|
||||||
EWOL_ERROR("Sizer can not have a user expend settings X (herited from under elements)");
|
EWOL_ERROR("Sizer can not have a user expend settings X (herited from under elements)");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::SizerVert::CanExpentX(void)
|
bool widget::Sizer::CanExpentX(void)
|
||||||
{
|
{
|
||||||
if (true == m_lockExpendContamination) {
|
if (true == m_lockExpendContamination.x()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return m_userExpend.x();
|
return m_userExpend.x();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::SizerVert::SetExpendY(bool newExpend)
|
void widget::Sizer::SetExpendY(bool newExpend)
|
||||||
{
|
{
|
||||||
EWOL_ERROR("Sizer can not have a user expend settings Y (herited from under elements)");
|
EWOL_ERROR("Sizer can not have a user expend settings Y (herited from under elements)");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool widget::SizerVert::CanExpentY(void)
|
bool widget::Sizer::CanExpentY(void)
|
||||||
{
|
{
|
||||||
if (true == m_lockExpendContamination) {
|
if (true == m_lockExpendContamination.y()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return m_userExpend.y();
|
return m_userExpend.y();
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::SizerVert::LockExpendContamination(bool lockExpend)
|
void widget::Sizer::LockExpendContamination(bool lockExpend)
|
||||||
{
|
{
|
||||||
m_lockExpendContamination = lockExpend;
|
m_lockExpendContamination.setValue(lockExpend,lockExpend);
|
||||||
|
}
|
||||||
|
void widget::Sizer::LockExpendContaminationVert(bool lockExpend)
|
||||||
|
{
|
||||||
|
m_lockExpendContamination.setY(lockExpend);
|
||||||
|
}
|
||||||
|
void widget::Sizer::LockExpendContaminationHori(bool lockExpend)
|
||||||
|
{
|
||||||
|
m_lockExpendContamination.setX(lockExpend);
|
||||||
}
|
}
|
||||||
|
|
||||||
//etk::Vector<ewol::Widget*> m_SubWidget;
|
void widget::Sizer::SubWidgetRemoveAll(void)
|
||||||
|
|
||||||
void widget::SizerVert::SubWidgetRemoveAll(void)
|
|
||||||
{
|
{
|
||||||
// the size automaticly decrement with the auto call of the OnObjectRemove function
|
// the size automaticly decrement with the auto call of the OnObjectRemove function
|
||||||
while (m_subWidget.Size() > 0 ) {
|
while (m_subWidget.Size() > 0 ) {
|
||||||
@ -154,7 +201,7 @@ void widget::SizerVert::SubWidgetRemoveAll(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::SizerVert::SubWidgetAdd(ewol::Widget* newWidget)
|
void widget::Sizer::SubWidgetAdd(ewol::Widget* newWidget)
|
||||||
{
|
{
|
||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
@ -162,8 +209,16 @@ void widget::SizerVert::SubWidgetAdd(ewol::Widget* newWidget)
|
|||||||
m_subWidget.PushBack(newWidget);
|
m_subWidget.PushBack(newWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void widget::Sizer::SubWidgetAddStart(ewol::Widget* newWidget)
|
||||||
|
{
|
||||||
|
if (NULL == newWidget) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_subWidget.PushFront(newWidget);
|
||||||
|
}
|
||||||
|
|
||||||
void widget::SizerVert::SubWidgetRemove(ewol::Widget* newWidget)
|
|
||||||
|
void widget::Sizer::SubWidgetRemove(ewol::Widget* newWidget)
|
||||||
{
|
{
|
||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
@ -178,7 +233,7 @@ void widget::SizerVert::SubWidgetRemove(ewol::Widget* newWidget)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void widget::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
|
void widget::Sizer::SubWidgetUnLink(ewol::Widget* newWidget)
|
||||||
{
|
{
|
||||||
if (NULL == newWidget) {
|
if (NULL == newWidget) {
|
||||||
return;
|
return;
|
||||||
@ -193,7 +248,7 @@ void widget::SizerVert::SubWidgetUnLink(ewol::Widget* newWidget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::SizerVert::OnDraw(ewol::DrawProperty& displayProp)
|
void widget::Sizer::OnDraw(ewol::DrawProperty& displayProp)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||||
if (NULL != m_subWidget[iii]) {
|
if (NULL != m_subWidget[iii]) {
|
||||||
@ -204,7 +259,7 @@ void widget::SizerVert::OnDraw(ewol::DrawProperty& displayProp)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void widget::SizerVert::OnRegenerateDisplay(void)
|
void widget::Sizer::OnRegenerateDisplay(void)
|
||||||
{
|
{
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
||||||
if (NULL != m_subWidget[iii]) {
|
if (NULL != m_subWidget[iii]) {
|
||||||
@ -214,7 +269,7 @@ void widget::SizerVert::OnRegenerateDisplay(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ewol::Widget * widget::SizerVert::GetWidgetAtPos(vec2 pos)
|
ewol::Widget * widget::Sizer::GetWidgetAtPos(vec2 pos)
|
||||||
{
|
{
|
||||||
if (true == IsHide()) {
|
if (true == IsHide()) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -242,7 +297,7 @@ ewol::Widget * widget::SizerVert::GetWidgetAtPos(vec2 pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void widget::SizerVert::OnObjectRemove(ewol::EObject * removeObject)
|
void widget::Sizer::OnObjectRemove(ewol::EObject * removeObject)
|
||||||
{
|
{
|
||||||
// First step call parrent :
|
// First step call parrent :
|
||||||
ewol::Widget::OnObjectRemove(removeObject);
|
ewol::Widget::OnObjectRemove(removeObject);
|
120
sources/ewol/widget/Sizer.h
Normal file
120
sources/ewol/widget/Sizer.h
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
/**
|
||||||
|
* @author Edouard DUPIN
|
||||||
|
*
|
||||||
|
* @copyright 2011, Edouard DUPIN, all right reserved
|
||||||
|
*
|
||||||
|
* @license BSD v3 (see license file)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __EWOL_SIZER_H__
|
||||||
|
#define __EWOL_SIZER_H__
|
||||||
|
|
||||||
|
#include <etk/types.h>
|
||||||
|
#include <ewol/debug.h>
|
||||||
|
#include <ewol/widget/Widget.h>
|
||||||
|
|
||||||
|
namespace widget {
|
||||||
|
class Sizer :public ewol::Widget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
typedef enum {
|
||||||
|
modeVert,
|
||||||
|
modeHori,
|
||||||
|
} displayMode_te;
|
||||||
|
private:
|
||||||
|
etk::Vector<ewol::Widget*> m_subWidget; //!< all sub widget are contained in this element
|
||||||
|
displayMode_te m_mode; //!< Methode to display the widget list (vert/hory ...)
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Constructor
|
||||||
|
* @param[in] mode The mode to display the elements
|
||||||
|
*/
|
||||||
|
Sizer(displayMode_te mode=widget::Sizer::modeHori);
|
||||||
|
/**
|
||||||
|
* @brief Desstructor
|
||||||
|
*/
|
||||||
|
virtual ~Sizer(void);
|
||||||
|
/**
|
||||||
|
* @brief Set the mode to display elements.
|
||||||
|
* @param[in] mode The mode to display the elements.
|
||||||
|
*/
|
||||||
|
void SetMode(displayMode_te mode);
|
||||||
|
/**
|
||||||
|
* @brief Get the mode to display elements.
|
||||||
|
* @return The current mode to display the elements.
|
||||||
|
*/
|
||||||
|
displayMode_te GetMode(void);
|
||||||
|
private:
|
||||||
|
etk::Vector2D<bool> m_lockExpendContamination; //!< If some sub-widget request the expend==> this permit to unpropagate the problem
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Change state of the expend contatmination (if some sub-widget request the expent this permit to not propagate if at this widget)
|
||||||
|
* @param[in] lockExpend New expend state in vertical and horisantal
|
||||||
|
*/
|
||||||
|
void LockExpendContamination(bool lockExpend);
|
||||||
|
/**
|
||||||
|
* @brief Change state of the expend contatmination (if some sub-widget request the expent this permit to not propagate if at this widget)
|
||||||
|
* @param[in] lockExpend New expend state in vertical
|
||||||
|
*/
|
||||||
|
void LockExpendContaminationVert(bool lockExpend);
|
||||||
|
/**
|
||||||
|
* @brief Change state of the expend contatmination (if some sub-widget request the expent this permit to not propagate if at this widget)
|
||||||
|
* @param[in] lockExpend New expend state in horisantal
|
||||||
|
*/
|
||||||
|
void LockExpendContaminationHori(bool lockExpend);
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* @brief Remove all sub element from the widget.
|
||||||
|
*/
|
||||||
|
virtual void SubWidgetRemoveAll(void);
|
||||||
|
/**
|
||||||
|
* @brief Add at end position a Widget (note : This system use an inverted phylisophie (button to top, and left to right)
|
||||||
|
* @param[in] newWidget the element pointer
|
||||||
|
*/
|
||||||
|
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
||||||
|
/**
|
||||||
|
* @brief Add at start position a Widget (note : This system use an inverted phylisophie (button to top, and left to right)
|
||||||
|
* @param[in] newWidget the element pointer
|
||||||
|
*/
|
||||||
|
virtual void SubWidgetAddStart(ewol::Widget* newWidget);
|
||||||
|
/**
|
||||||
|
* @brief Remove definitly a widget from the system and this layer.
|
||||||
|
* @param[in] newWidget the element pointer.
|
||||||
|
*/
|
||||||
|
virtual void SubWidgetRemove(ewol::Widget* newWidget);
|
||||||
|
/**
|
||||||
|
* @brief Just unlick the specify widget, this function does not remove it from the system (if you can, do nt use it ...)
|
||||||
|
* @param[in] newWidget the element pointer.
|
||||||
|
*/
|
||||||
|
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
||||||
|
protected:
|
||||||
|
// Derived function
|
||||||
|
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
||||||
|
public:
|
||||||
|
// Derived function
|
||||||
|
virtual void OnRegenerateDisplay(void);
|
||||||
|
// Derived function
|
||||||
|
virtual ewol::Widget* GetWidgetAtPos(vec2 pos);
|
||||||
|
// Derived function
|
||||||
|
virtual void OnObjectRemove(ewol::EObject* removeObject);
|
||||||
|
// Derived function
|
||||||
|
virtual const char * const GetObjectType(void) { return "EwolSizerVert"; };
|
||||||
|
// Derived function
|
||||||
|
virtual bool CalculateSize(float availlableX, float availlableY);
|
||||||
|
// Derived function
|
||||||
|
virtual bool CalculateMinSize(void);
|
||||||
|
// Derived function
|
||||||
|
virtual void SetMinSize(float x=-1, float y=-1);
|
||||||
|
// Derived function
|
||||||
|
virtual void SetExpendX(bool newExpend=false);
|
||||||
|
// Derived function
|
||||||
|
virtual bool CanExpentX(void);
|
||||||
|
// Derived function
|
||||||
|
virtual void SetExpendY(bool newExpend=false);
|
||||||
|
// Derived function
|
||||||
|
virtual bool CanExpentY(void);
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
@ -1,259 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <ewol/widget/SizerHori.h>
|
|
||||||
#include <ewol/widget/WidgetManager.h>
|
|
||||||
|
|
||||||
#undef __class__
|
|
||||||
#define __class__ "SizerHori"
|
|
||||||
|
|
||||||
widget::SizerHori::SizerHori(void)
|
|
||||||
{
|
|
||||||
// set contamination enable
|
|
||||||
LockExpendContamination();
|
|
||||||
}
|
|
||||||
|
|
||||||
widget::SizerHori::~SizerHori(void)
|
|
||||||
{
|
|
||||||
SubWidgetRemoveAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool widget::SizerHori::CalculateSize(float availlableX, float availlableY)
|
|
||||||
{
|
|
||||||
//EWOL_DEBUG("Update Size");
|
|
||||||
m_size.setValue(availlableX, availlableY);
|
|
||||||
// calculate unExpendable Size :
|
|
||||||
float unexpendableSize=0.0;
|
|
||||||
int32_t nbWidgetFixedSize=0;
|
|
||||||
int32_t nbWidgetNotFixedSize=0;
|
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
|
||||||
if (NULL != m_subWidget[iii]) {
|
|
||||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
|
||||||
unexpendableSize += tmpSize.x();
|
|
||||||
if (false == m_subWidget[iii]->CanExpentX()) {
|
|
||||||
nbWidgetFixedSize++;
|
|
||||||
} else {
|
|
||||||
nbWidgetNotFixedSize++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
float sizeToAddAtEveryOne = 0;
|
|
||||||
// 2 cases : 1 or more can Expend, or all is done ...
|
|
||||||
if (0 != nbWidgetNotFixedSize) {
|
|
||||||
sizeToAddAtEveryOne = (m_size.x() - unexpendableSize) / nbWidgetNotFixedSize;
|
|
||||||
if (sizeToAddAtEveryOne<0.0) {
|
|
||||||
sizeToAddAtEveryOne=0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
vec2 tmpOrigin = m_origin;
|
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
|
||||||
if (NULL != m_subWidget[iii]) {
|
|
||||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
|
||||||
// Set the origin :
|
|
||||||
//EWOL_DEBUG("Set ORIGIN : " << tmpOrigin.x << "," << tmpOrigin.y << ")");
|
|
||||||
m_subWidget[iii]->SetOrigin(tmpOrigin.x(), tmpOrigin.y());
|
|
||||||
// Now Update his Size his size in X and the curent sizer size in Y:
|
|
||||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
|
||||||
m_subWidget[iii]->CalculateSize(tmpSize.x()+sizeToAddAtEveryOne, m_size.y());
|
|
||||||
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x()+sizeToAddAtEveryOne);
|
|
||||||
} else {
|
|
||||||
m_subWidget[iii]->CalculateSize(tmpSize.x(), m_size.y());
|
|
||||||
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MarkToRedraw();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool widget::SizerHori::CalculateMinSize(void)
|
|
||||||
{
|
|
||||||
//EWOL_DEBUG("Update minimum Size");
|
|
||||||
m_userExpend.setValue(false, false);
|
|
||||||
m_minSize.setValue(0, 0);
|
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
|
||||||
if (NULL != m_subWidget[iii]) {
|
|
||||||
m_subWidget[iii]->CalculateMinSize();
|
|
||||||
if (true == m_subWidget[iii]->CanExpentX()) {
|
|
||||||
m_userExpend.setX(true);
|
|
||||||
}
|
|
||||||
if (true == m_subWidget[iii]->CanExpentY()) {
|
|
||||||
m_userExpend.setY(true);
|
|
||||||
}
|
|
||||||
vec2 tmpSize = m_subWidget[iii]->GetMinSize();
|
|
||||||
//EWOL_DEBUG("HORI : NewMinSize=" << tmpSize);
|
|
||||||
m_minSize.setX(m_minSize.x() + tmpSize.x());
|
|
||||||
if (tmpSize.y()>m_minSize.y()) {
|
|
||||||
m_minSize.setY(tmpSize.y());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//EWOL_DEBUG("Hori Result : expend="<< m_userExpend << " minSize="<< m_minSize);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void widget::SizerHori::SetMinSize(float x, float y)
|
|
||||||
{
|
|
||||||
EWOL_ERROR("Sizer can not have a user Minimum size (herited from under elements)");
|
|
||||||
}
|
|
||||||
|
|
||||||
void widget::SizerHori::SetExpendX(bool newExpend)
|
|
||||||
{
|
|
||||||
EWOL_ERROR("Sizer can not have a user expend settings X (herited from under elements)");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool widget::SizerHori::CanExpentX(void)
|
|
||||||
{
|
|
||||||
if (true == m_lockExpendContamination) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return m_userExpend.x();
|
|
||||||
}
|
|
||||||
|
|
||||||
void widget::SizerHori::SetExpendY(bool newExpend)
|
|
||||||
{
|
|
||||||
EWOL_ERROR("Sizer can not have a user expend settings Y (herited from under elements)");
|
|
||||||
}
|
|
||||||
|
|
||||||
bool widget::SizerHori::CanExpentY(void)
|
|
||||||
{
|
|
||||||
if (true == m_lockExpendContamination) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return m_userExpend.y();
|
|
||||||
}
|
|
||||||
|
|
||||||
void widget::SizerHori::LockExpendContamination(bool lockExpend)
|
|
||||||
{
|
|
||||||
m_lockExpendContamination = lockExpend;
|
|
||||||
}
|
|
||||||
|
|
||||||
//etk::Vector<ewol::Widget*> m_subWidget[m_currentCreateId];
|
|
||||||
|
|
||||||
void widget::SizerHori::SubWidgetRemoveAll(void)
|
|
||||||
{
|
|
||||||
// the size automaticly decrement with the auto call of the OnObjectRemove function
|
|
||||||
while (m_subWidget.Size() > 0 ) {
|
|
||||||
if (NULL != m_subWidget[0]) {
|
|
||||||
delete(m_subWidget[0]);
|
|
||||||
// no remove, this element is removed with the function OnObjectRemove ==> it does not exist anymore ...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
m_subWidget.Clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void widget::SizerHori::SubWidgetAdd(ewol::Widget* newWidget)
|
|
||||||
{
|
|
||||||
if (NULL == newWidget) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
m_subWidget.PushBack(newWidget);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void widget::SizerHori::SubWidgetRemove(ewol::Widget* newWidget)
|
|
||||||
{
|
|
||||||
if (NULL == newWidget) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
|
||||||
if (newWidget == m_subWidget[iii]) {
|
|
||||||
if (NULL != m_subWidget[iii]) {
|
|
||||||
delete(m_subWidget[iii]);
|
|
||||||
m_subWidget[iii] = NULL;
|
|
||||||
}
|
|
||||||
m_subWidget.Erase(iii);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void widget::SizerHori::SubWidgetUnLink(ewol::Widget* newWidget)
|
|
||||||
{
|
|
||||||
if (NULL == newWidget) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
|
||||||
if (newWidget == m_subWidget[iii]) {
|
|
||||||
m_subWidget[iii] = NULL;
|
|
||||||
m_subWidget.Erase(iii);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void widget::SizerHori::OnDraw(ewol::DrawProperty& displayProp)
|
|
||||||
{
|
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
|
||||||
if (NULL != m_subWidget[iii]) {
|
|
||||||
m_subWidget[iii]->GenDraw(displayProp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void widget::SizerHori::OnRegenerateDisplay(void)
|
|
||||||
{
|
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
|
||||||
if (NULL != m_subWidget[iii]) {
|
|
||||||
m_subWidget[iii]->OnRegenerateDisplay();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ewol::Widget * widget::SizerHori::GetWidgetAtPos(vec2 pos)
|
|
||||||
{
|
|
||||||
if (true == IsHide()) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
// for all element in the sizer ...
|
|
||||||
for (int32_t iii=0; iii<m_subWidget.Size(); iii++) {
|
|
||||||
if (NULL != m_subWidget[iii]) {
|
|
||||||
vec2 tmpSize = m_subWidget[iii]->GetSize();
|
|
||||||
vec2 tmpOrigin = m_subWidget[iii]->GetOrigin();
|
|
||||||
if( (tmpOrigin.x() <= pos.x() && tmpOrigin.x() + tmpSize.x() >= pos.x())
|
|
||||||
&& (tmpOrigin.y() <= pos.y() && tmpOrigin.y() + tmpSize.y() >= pos.y()) )
|
|
||||||
{
|
|
||||||
ewol::Widget * tmpWidget = m_subWidget[iii]->GetWidgetAtPos(pos);
|
|
||||||
if (NULL != tmpWidget) {
|
|
||||||
return tmpWidget;
|
|
||||||
}
|
|
||||||
// stop searching
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// TODO : Check if we have a mover, otherwire return NULL;
|
|
||||||
return NULL;
|
|
||||||
//return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void widget::SizerHori::OnObjectRemove(ewol::EObject * removeObject)
|
|
||||||
{
|
|
||||||
// First step call parrent :
|
|
||||||
ewol::Widget::OnObjectRemove(removeObject);
|
|
||||||
// second step find if in all the elements ...
|
|
||||||
for(int32_t iii=m_subWidget.Size()-1; iii>=0; iii--) {
|
|
||||||
if(m_subWidget[iii] == removeObject) {
|
|
||||||
EWOL_VERBOSE("Remove sizer sub Element [" << iii << "/" << m_subWidget.Size()-1 << "] ==> destroyed object");
|
|
||||||
m_subWidget[iii] = NULL;
|
|
||||||
m_subWidget.Erase(iii);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __EWOL_SIZER_HORI_H__
|
|
||||||
#define __EWOL_SIZER_HORI_H__
|
|
||||||
|
|
||||||
#include <etk/types.h>
|
|
||||||
#include <ewol/debug.h>
|
|
||||||
#include <ewol/widget/Widget.h>
|
|
||||||
|
|
||||||
namespace widget {
|
|
||||||
class SizerHori :public ewol::Widget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SizerHori(void);
|
|
||||||
virtual ~SizerHori(void);
|
|
||||||
void LockExpendContamination(bool lockExpend=false);
|
|
||||||
private:
|
|
||||||
bool m_lockExpendContamination;
|
|
||||||
etk::Vector<ewol::Widget*> m_subWidget;
|
|
||||||
public:
|
|
||||||
virtual void SubWidgetRemoveAll(void);
|
|
||||||
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
|
||||||
virtual void SubWidgetRemove(ewol::Widget* newWidget);
|
|
||||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
|
||||||
protected:
|
|
||||||
// Derived function
|
|
||||||
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
|
||||||
public:
|
|
||||||
// Derived function
|
|
||||||
virtual void OnRegenerateDisplay(void);
|
|
||||||
// Derived function
|
|
||||||
virtual ewol::Widget * GetWidgetAtPos(vec2 pos);
|
|
||||||
// Derived function
|
|
||||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
|
||||||
// Derived function
|
|
||||||
virtual const char * const GetObjectType(void) { return "EwolSizerHori"; };
|
|
||||||
// Derived function
|
|
||||||
virtual bool CalculateSize(float availlableX, float availlableY);
|
|
||||||
// Derived function
|
|
||||||
virtual bool CalculateMinSize(void);
|
|
||||||
// Derived function
|
|
||||||
virtual void SetMinSize(float x=-1, float y=-1);
|
|
||||||
// Derived function
|
|
||||||
virtual void SetExpendX(bool newExpend=false);
|
|
||||||
// Derived function
|
|
||||||
virtual bool CanExpentX(void);
|
|
||||||
// Derived function
|
|
||||||
virtual void SetExpendY(bool newExpend=false);
|
|
||||||
// Derived function
|
|
||||||
virtual bool CanExpentY(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,61 +0,0 @@
|
|||||||
/**
|
|
||||||
* @author Edouard DUPIN
|
|
||||||
*
|
|
||||||
* @copyright 2011, Edouard DUPIN, all right reserved
|
|
||||||
*
|
|
||||||
* @license BSD v3 (see license file)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __EWOL_SIZER_VERT_H__
|
|
||||||
#define __EWOL_SIZER_VERT_H__
|
|
||||||
|
|
||||||
#include <etk/types.h>
|
|
||||||
#include <ewol/debug.h>
|
|
||||||
#include <ewol/widget/Widget.h>
|
|
||||||
|
|
||||||
namespace widget {
|
|
||||||
class SizerVert :public ewol::Widget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SizerVert(void);
|
|
||||||
virtual ~SizerVert(void);
|
|
||||||
void LockExpendContamination(bool lockExpend=false);
|
|
||||||
private:
|
|
||||||
bool m_lockExpendContamination;
|
|
||||||
etk::Vector<ewol::Widget*> m_subWidget;
|
|
||||||
public:
|
|
||||||
virtual void SubWidgetRemoveAll(void);
|
|
||||||
virtual void SubWidgetAdd(ewol::Widget* newWidget);
|
|
||||||
virtual void SubWidgetRemove(ewol::Widget* newWidget);
|
|
||||||
virtual void SubWidgetUnLink(ewol::Widget* newWidget);
|
|
||||||
protected:
|
|
||||||
// Derived function
|
|
||||||
virtual void OnDraw(ewol::DrawProperty& displayProp);
|
|
||||||
public:
|
|
||||||
// Derived function
|
|
||||||
virtual void OnRegenerateDisplay(void);
|
|
||||||
// Derived function
|
|
||||||
virtual ewol::Widget * GetWidgetAtPos(vec2 pos);
|
|
||||||
// Derived function
|
|
||||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
|
||||||
// Derived function
|
|
||||||
virtual const char * const GetObjectType(void) { return "EwolSizerVert"; };
|
|
||||||
// Derived function
|
|
||||||
virtual bool CalculateSize(float availlableX, float availlableY);
|
|
||||||
// Derived function
|
|
||||||
virtual bool CalculateMinSize(void);
|
|
||||||
// Derived function
|
|
||||||
virtual void SetMinSize(float x=-1, float y=-1);
|
|
||||||
// Derived function
|
|
||||||
virtual void SetExpendX(bool newExpend=false);
|
|
||||||
// Derived function
|
|
||||||
virtual bool CanExpentX(void);
|
|
||||||
// Derived function
|
|
||||||
virtual void SetExpendY(bool newExpend=false);
|
|
||||||
// Derived function
|
|
||||||
virtual bool CanExpentY(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -7,8 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/widget/meta/ColorChooser.h>
|
#include <ewol/widget/meta/ColorChooser.h>
|
||||||
#include <ewol/widget/SizerHori.h>
|
#include <ewol/widget/Sizer.h>
|
||||||
#include <ewol/widget/SizerVert.h>
|
|
||||||
#include <ewol/widget/List.h>
|
#include <ewol/widget/List.h>
|
||||||
#include <ewol/widget/Spacer.h>
|
#include <ewol/widget/Spacer.h>
|
||||||
#include <ewol/widget/WidgetManager.h>
|
#include <ewol/widget/WidgetManager.h>
|
||||||
@ -33,7 +32,8 @@ const char * const eventColorBarHasChange = "event-color-bar-has-change
|
|||||||
const char * const eventColorSpecificHasChange = "event-color-specific-has-change";
|
const char * const eventColorSpecificHasChange = "event-color-specific-has-change";
|
||||||
|
|
||||||
|
|
||||||
widget::ColorChooser::ColorChooser(void)
|
widget::ColorChooser::ColorChooser(void) :
|
||||||
|
widget::Sizer(widget::Sizer::modeVert)
|
||||||
{
|
{
|
||||||
AddEventId(ewolEventColorChooserChange);
|
AddEventId(ewolEventColorChooserChange);
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ void widget::ColorChooser::OnReceiveMessage(ewol::EObject * CallerObject, const
|
|||||||
void widget::ColorChooser::OnObjectRemove(ewol::EObject * removeObject)
|
void widget::ColorChooser::OnObjectRemove(ewol::EObject * removeObject)
|
||||||
{
|
{
|
||||||
// First step call parrent :
|
// First step call parrent :
|
||||||
widget::SizerVert::OnObjectRemove(removeObject);
|
widget::Sizer::OnObjectRemove(removeObject);
|
||||||
// second step find if in all the elements ...
|
// second step find if in all the elements ...
|
||||||
if(removeObject == m_widgetRed) {
|
if(removeObject == m_widgetRed) {
|
||||||
m_widgetRed = NULL;
|
m_widgetRed = NULL;
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
#include <ewol/widget/Button.h>
|
#include <ewol/widget/Button.h>
|
||||||
#include <ewol/widget/Entry.h>
|
#include <ewol/widget/Entry.h>
|
||||||
#include <ewol/widget/Label.h>
|
#include <ewol/widget/Label.h>
|
||||||
#include <ewol/widget/SizerVert.h>
|
#include <ewol/widget/Sizer.h>
|
||||||
#include <ewol/widget/ColorBar.h>
|
#include <ewol/widget/ColorBar.h>
|
||||||
#include <ewol/widget/Slider.h>
|
#include <ewol/widget/Slider.h>
|
||||||
|
|
||||||
extern const char * const ewolEventColorChooserChange;
|
extern const char * const ewolEventColorChooserChange;
|
||||||
|
|
||||||
namespace widget {
|
namespace widget {
|
||||||
class ColorChooser : public widget::SizerVert
|
class ColorChooser : public widget::Sizer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ColorChooser(void);
|
ColorChooser(void);
|
||||||
|
@ -23,8 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/widget/meta/FileChooser.h>
|
#include <ewol/widget/meta/FileChooser.h>
|
||||||
#include <ewol/widget/SizerHori.h>
|
#include <ewol/widget/Sizer.h>
|
||||||
#include <ewol/widget/SizerVert.h>
|
|
||||||
#include <ewol/widget/List.h>
|
#include <ewol/widget/List.h>
|
||||||
#include <ewol/widget/Spacer.h>
|
#include <ewol/widget/Spacer.h>
|
||||||
#include <ewol/widget/Image.h>
|
#include <ewol/widget/Image.h>
|
||||||
@ -78,8 +77,8 @@ widget::FileChooser::FileChooser(void)
|
|||||||
m_widgetListFile = NULL;
|
m_widgetListFile = NULL;
|
||||||
m_widgetCheckBox = NULL;
|
m_widgetCheckBox = NULL;
|
||||||
|
|
||||||
widget::SizerVert * mySizerVert = NULL;
|
widget::Sizer * mySizerVert = NULL;
|
||||||
widget::SizerHori * mySizerHori = NULL;
|
widget::Sizer * mySizerHori = NULL;
|
||||||
widget::Spacer * mySpacer = NULL;
|
widget::Spacer * mySpacer = NULL;
|
||||||
//widget::Label * myLabel = NULL;
|
//widget::Label * myLabel = NULL;
|
||||||
widget::Image * myImage = NULL;
|
widget::Image * myImage = NULL;
|
||||||
@ -95,7 +94,7 @@ widget::FileChooser::FileChooser(void)
|
|||||||
#endif
|
#endif
|
||||||
m_file = "";
|
m_file = "";
|
||||||
|
|
||||||
mySizerVert = new widget::SizerVert();
|
mySizerVert = new widget::Sizer(widget::Sizer::modeVert);
|
||||||
if (NULL == mySizerVert) {
|
if (NULL == mySizerVert) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
@ -103,7 +102,7 @@ widget::FileChooser::FileChooser(void)
|
|||||||
// set it in the pop-up-system :
|
// set it in the pop-up-system :
|
||||||
SubWidgetSet(mySizerVert);
|
SubWidgetSet(mySizerVert);
|
||||||
|
|
||||||
mySizerHori = new widget::SizerHori();
|
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
|
||||||
if (NULL == mySizerHori) {
|
if (NULL == mySizerHori) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
@ -140,7 +139,7 @@ widget::FileChooser::FileChooser(void)
|
|||||||
mySizerHori->SubWidgetAdd(m_widgetCancel);
|
mySizerHori->SubWidgetAdd(m_widgetCancel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mySizerHori = new widget::SizerHori();
|
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
|
||||||
if (NULL == mySizerHori) {
|
if (NULL == mySizerHori) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
@ -194,7 +193,7 @@ widget::FileChooser::FileChooser(void)
|
|||||||
mySizerHori->SubWidgetAdd(mySpacer);
|
mySizerHori->SubWidgetAdd(mySpacer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mySizerHori = new widget::SizerHori();
|
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
|
||||||
if (NULL == mySizerHori) {
|
if (NULL == mySizerHori) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
@ -218,7 +217,7 @@ widget::FileChooser::FileChooser(void)
|
|||||||
mySizerHori->SubWidgetAdd(m_widgetCurrentFileName);
|
mySizerHori->SubWidgetAdd(m_widgetCurrentFileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mySizerHori = new widget::SizerHori();
|
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
|
||||||
if (NULL == mySizerHori) {
|
if (NULL == mySizerHori) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <ewol/widget/meta/Parameter.h>
|
#include <ewol/widget/meta/Parameter.h>
|
||||||
#include <ewol/widget/SizerHori.h>
|
#include <ewol/widget/Sizer.h>
|
||||||
#include <ewol/widget/SizerVert.h>
|
|
||||||
#include <ewol/widget/List.h>
|
#include <ewol/widget/List.h>
|
||||||
#include <ewol/widget/Spacer.h>
|
#include <ewol/widget/Spacer.h>
|
||||||
#include <ewol/widget/Image.h>
|
#include <ewol/widget/Image.h>
|
||||||
@ -35,8 +34,8 @@ widget::Parameter::Parameter(void) :
|
|||||||
{
|
{
|
||||||
AddEventId(ewolEventParameterClose);
|
AddEventId(ewolEventParameterClose);
|
||||||
|
|
||||||
widget::SizerVert * mySizerVert = NULL;
|
widget::Sizer * mySizerVert = NULL;
|
||||||
widget::SizerHori * mySizerHori = NULL;
|
widget::Sizer * mySizerHori = NULL;
|
||||||
widget::Spacer * mySpacer = NULL;
|
widget::Spacer * mySpacer = NULL;
|
||||||
#ifdef __TARGET_OS__Android
|
#ifdef __TARGET_OS__Android
|
||||||
SetDisplayRatio(0.90);
|
SetDisplayRatio(0.90);
|
||||||
@ -44,7 +43,7 @@ widget::Parameter::Parameter(void) :
|
|||||||
SetDisplayRatio(0.80);
|
SetDisplayRatio(0.80);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mySizerVert = new widget::SizerVert();
|
mySizerVert = new widget::Sizer(widget::Sizer::modeVert);
|
||||||
if (NULL == mySizerVert) {
|
if (NULL == mySizerVert) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
@ -53,7 +52,7 @@ widget::Parameter::Parameter(void) :
|
|||||||
// set it in the pop-up-system :
|
// set it in the pop-up-system :
|
||||||
SubWidgetSet(mySizerVert);
|
SubWidgetSet(mySizerVert);
|
||||||
|
|
||||||
mySizerHori = new widget::SizerHori();
|
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
|
||||||
if (NULL == mySizerHori) {
|
if (NULL == mySizerHori) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
@ -77,7 +76,7 @@ widget::Parameter::Parameter(void) :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mySizerHori = new widget::SizerHori();
|
mySizerHori = new widget::Sizer(widget::Sizer::modeHori);
|
||||||
if (NULL == mySizerHori) {
|
if (NULL == mySizerHori) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
@ -103,7 +102,7 @@ widget::Parameter::Parameter(void) :
|
|||||||
mySizerHori->SubWidgetAdd(mySpacer);
|
mySizerHori->SubWidgetAdd(mySpacer);
|
||||||
}
|
}
|
||||||
|
|
||||||
widget::SizerVert * mySizerVert2 = new widget::SizerVert();
|
widget::Sizer * mySizerVert2 = new widget::Sizer(widget::Sizer::modeVert);
|
||||||
if (NULL == mySizerVert2) {
|
if (NULL == mySizerVert2) {
|
||||||
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
EWOL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
|
@ -72,8 +72,7 @@ FILE_LIST+= ewol/widget/Widget.cpp \
|
|||||||
ewol/widget/Menu.cpp \
|
ewol/widget/Menu.cpp \
|
||||||
ewol/widget/PopUp.cpp \
|
ewol/widget/PopUp.cpp \
|
||||||
ewol/widget/ProgressBar.cpp \
|
ewol/widget/ProgressBar.cpp \
|
||||||
ewol/widget/SizerHori.cpp \
|
ewol/widget/Sizer.cpp \
|
||||||
ewol/widget/SizerVert.cpp \
|
|
||||||
ewol/widget/Slider.cpp \
|
ewol/widget/Slider.cpp \
|
||||||
ewol/widget/WSlider.cpp \
|
ewol/widget/WSlider.cpp \
|
||||||
ewol/widget/Spacer.cpp \
|
ewol/widget/Spacer.cpp \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user