[DEV] add bach the simple valider of system (visual)
This commit is contained in:
parent
7be7a16357
commit
ab22c78237
@ -105,7 +105,7 @@ namespace ewol {
|
||||
}
|
||||
protected:
|
||||
std::weak_ptr<Object> m_parent; //!< Reference on the current parrent.
|
||||
bool m_destroy; //!< Flag to jknow if the object is requesting has destroy.
|
||||
bool m_destroy; //!< Flag to know if the object is requesting has destroy.
|
||||
protected:
|
||||
/**
|
||||
* @brief Auto-destroy the object
|
||||
|
@ -34,7 +34,7 @@ void ewol::resource::TextureFile::init(std::string _genName, const std::string&
|
||||
std11::unique_lock<std11::recursive_mutex> lock(m_mutex);
|
||||
ewol::resource::Texture::init(_genName);
|
||||
EWOL_DEBUG("create a new resource::Image : _genName=" << _genName << " _tmpfileName=" << _tmpfileName << " size=" << _size);
|
||||
if (false == egami::load(m_data, _tmpfileName, _size)) {
|
||||
if (egami::load(m_data, _tmpfileName, _size) == false) {
|
||||
EWOL_ERROR("ERROR when loading the image : " << _tmpfileName);
|
||||
}
|
||||
ivec2 tmp = m_data.getSize();
|
||||
|
@ -28,6 +28,7 @@ ewol::widget::PopUp::PopUp() :
|
||||
|
||||
void ewol::widget::PopUp::init(const std::string& _shaperName) {
|
||||
ewol::widget::Container::init();
|
||||
m_userFill.set(bvec2(false,false));
|
||||
m_shaper.setString(_shaperName);
|
||||
setMinSize(gale::Dimension(vec2(80,80),gale::Dimension::Pourcent));
|
||||
m_userExpand.set(bvec2(false, false));
|
||||
@ -43,7 +44,14 @@ void ewol::widget::PopUp::setShaperName(const std::string& _shaperName) {
|
||||
}
|
||||
|
||||
void ewol::widget::PopUp::calculateSize(const vec2& _available) {
|
||||
ewol::Widget::calculateSize(_available);
|
||||
#if 0
|
||||
//not call basic class ==> change methode to generate basic size ...
|
||||
ewol::Widget::calculateSize(_available);
|
||||
#else
|
||||
vec2 size = _available;
|
||||
size.setMax(m_minSize);
|
||||
m_size = size;
|
||||
#endif
|
||||
if (nullptr != m_subWidget) {
|
||||
ewol::Padding padding = m_shaper->getPadding();
|
||||
vec2 subWidgetSize = m_subWidget->getCalculateMinSize();
|
||||
|
@ -43,41 +43,38 @@ void ewol::widget::Sizer::calculateSize(const vec2& _availlable) {
|
||||
m_size -= tmpBorderSize*2;
|
||||
// calculate unExpandable size :
|
||||
float unexpandableSize=0.0;
|
||||
int32_t nbWidgetFixedSize=0;
|
||||
int32_t nbWidgetNotFixedSize=0;
|
||||
ivec2 nbWidgetNotFixedSize = ivec2(0,0);
|
||||
for (auto &it : m_subWidget) {
|
||||
if (it != nullptr) {
|
||||
vec2 tmpSize = it->getCalculateMinSize();
|
||||
if (m_mode == ewol::widget::Sizer::modeVert) {
|
||||
unexpandableSize += tmpSize.y();
|
||||
if (false == it->canExpand().y()) {
|
||||
nbWidgetFixedSize++;
|
||||
} else {
|
||||
nbWidgetNotFixedSize++;
|
||||
}
|
||||
} else {
|
||||
unexpandableSize += tmpSize.x();
|
||||
if (false == it->canExpand().x()) {
|
||||
nbWidgetFixedSize++;
|
||||
} else {
|
||||
nbWidgetNotFixedSize++;
|
||||
}
|
||||
if (it == nullptr) {
|
||||
continue;
|
||||
}
|
||||
vec2 tmpSize = it->getCalculateMinSize();
|
||||
if (m_mode == ewol::widget::Sizer::modeVert) {
|
||||
unexpandableSize += tmpSize.y();
|
||||
if (it->canExpand().y() == true) {
|
||||
nbWidgetNotFixedSize+=ivec2(0,1);
|
||||
}
|
||||
} else {
|
||||
unexpandableSize += tmpSize.x();
|
||||
if (it->canExpand().x() == true) {
|
||||
nbWidgetNotFixedSize+=ivec2(1,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 2 cases : 1 or more can Expand, or all is done ...
|
||||
float sizeToAddAtEveryOne = 0;
|
||||
// 2 cases : 1 or more can Expand, or all is done ...
|
||||
if (0 != nbWidgetNotFixedSize) {
|
||||
if (nbWidgetNotFixedSize != ivec2(0,0)) {
|
||||
if (m_mode == ewol::widget::Sizer::modeVert) {
|
||||
sizeToAddAtEveryOne = (m_size.y() - unexpandableSize) / nbWidgetNotFixedSize;
|
||||
sizeToAddAtEveryOne = (m_size.y() - unexpandableSize) / float(nbWidgetNotFixedSize.y());
|
||||
} else {
|
||||
sizeToAddAtEveryOne = (m_size.x() - unexpandableSize) / nbWidgetNotFixedSize;
|
||||
sizeToAddAtEveryOne = (m_size.x() - unexpandableSize) / float(nbWidgetNotFixedSize.x());
|
||||
}
|
||||
if (sizeToAddAtEveryOne<0.0) {
|
||||
sizeToAddAtEveryOne=0;
|
||||
}
|
||||
}
|
||||
// TODO : Need manage gravity ...
|
||||
vec2 tmpOrigin = m_origin + tmpBorderSize;
|
||||
for (auto &it : m_subWidget) {
|
||||
if (it != nullptr) {
|
||||
@ -100,6 +97,12 @@ void ewol::widget::Sizer::calculateSize(const vec2& _availlable) {
|
||||
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x()+sizeToAddAtEveryOne);
|
||||
} else {
|
||||
it->calculateSize(vec2ClipInt32(vec2(tmpSize.x(), m_size.y())));
|
||||
|
||||
int32_t subSize = it->getSize().y();
|
||||
if (subSize <= m_size.y()) {
|
||||
// move localy of half needed
|
||||
it->setOrigin(it->getOrigin() + ivec2(0, (m_size.y()-subSize)/2));
|
||||
}
|
||||
tmpOrigin.setX(tmpOrigin.x() + tmpSize.x());
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ ewol::Widget::Widget() :
|
||||
m_userMinSize(*this, "min-size", gale::Dimension(vec2(0,0),gale::Dimension::Pixel), "User minimum size"),
|
||||
m_userMaxSize(*this, "max-size", gale::Dimension(vec2(ULTIMATE_MAX_SIZE,ULTIMATE_MAX_SIZE),gale::Dimension::Pixel), "User maximum size"),
|
||||
m_userExpand(*this, "expand", bvec2(false,false), "Request the widget Expand size wile space is available"),
|
||||
m_userFill(*this, "fill", bvec2(false,false), "Fill the widget available size"),
|
||||
m_userFill(*this, "fill", bvec2(true,true), "Fill the widget available size"),
|
||||
m_hide(*this, "hide", false, "The widget start hided"),
|
||||
m_gravity(*this, "gravity", ewol::gravityButtomLeft, "Gravity orientation"),
|
||||
m_hasFocus(false),
|
||||
@ -148,7 +148,16 @@ ewol::Widget::~Widget() {
|
||||
|
||||
void ewol::Widget::calculateSize(const vec2& _available) {
|
||||
vec2 size = _available;
|
||||
size.setMax(m_minSize);
|
||||
if (m_userFill->x() == true) {
|
||||
size.setX(std::max(size.x(), m_minSize.x()));
|
||||
} else {
|
||||
size.setX(std::min(size.x(), m_minSize.x()));
|
||||
}
|
||||
if (m_userFill->y() == true) {
|
||||
size.setY(std::max(size.y(), m_minSize.y()));
|
||||
} else {
|
||||
size.setY(std::min(size.y(), m_minSize.y()));
|
||||
}
|
||||
if (m_size == size) {
|
||||
return;
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.module as module
|
||||
import lutin.tools as tools
|
||||
import datetime
|
||||
|
||||
|
||||
def get_type():
|
||||
return "BINARY"
|
||||
|
77
lutin_ewol-tools-visual-test.py
Executable file
77
lutin_ewol-tools-visual-test.py
Executable file
@ -0,0 +1,77 @@
|
||||
#!/usr/bin/python
|
||||
import lutin.module as module
|
||||
import lutin.tools as tools
|
||||
import os
|
||||
|
||||
def get_type():
|
||||
return "BINARY"
|
||||
|
||||
def get_sub_type():
|
||||
return "TOOL"
|
||||
|
||||
def get_desc():
|
||||
return "ewol test software (visual)"
|
||||
|
||||
def get_licence():
|
||||
return "APACHE-2"
|
||||
|
||||
def get_compagny_type():
|
||||
return "com"
|
||||
|
||||
def get_compagny_name():
|
||||
return "atria-soft"
|
||||
|
||||
def get_maintainer():
|
||||
return ["Mr DUPIN Edouard <yui.heero@gmail.com>"]
|
||||
|
||||
def create(target, module_name):
|
||||
my_module = module.Module(__file__, module_name, get_type())
|
||||
# add the file to compile:
|
||||
my_module.add_src_file([
|
||||
'tools/visual_test/appl/debug.cpp',
|
||||
'tools/visual_test/appl/init.cpp',
|
||||
'tools/visual_test/appl/MainWindows.cpp',
|
||||
'tools/visual_test/appl/TestButton.cpp',
|
||||
'tools/visual_test/appl/TestCheckBox.cpp',
|
||||
'tools/visual_test/appl/TestImage.cpp',
|
||||
'tools/visual_test/appl/TestButtonColor.cpp',
|
||||
'tools/visual_test/appl/TestLabel.cpp',
|
||||
'tools/visual_test/appl/TestDistanceField.cpp'
|
||||
])
|
||||
|
||||
my_module.add_module_depend(['ewol'])
|
||||
|
||||
my_module.copy_file('tools/visual_test/data/icon.png','icon.png')
|
||||
|
||||
my_module.copy_path('tools/visual_test/data/icon.*','')
|
||||
my_module.copy_path('tools/visual_test/data/cube.*','')
|
||||
my_module.copy_path('tools/visual_test/data/grass.*','')
|
||||
my_module.copy_path('tools/visual_test/data/stone*','')
|
||||
my_module.copy_path('tools/visual_test/data/sphere.png','')
|
||||
my_module.copy_path('tools/visual_test/data/sphere.obj','')
|
||||
|
||||
my_module.add_path(os.path.join(tools.get_current_path(__file__), "tools/visual_test/"))
|
||||
|
||||
my_module.copy_path("tools/visual_test/data/FreeSerif*","fonts/")
|
||||
|
||||
"""
|
||||
# set the package properties :
|
||||
my_module.pkg_set("VERSION", versionID)
|
||||
my_module.pkg_set("COMPAGNY_TYPE", "org")
|
||||
my_module.pkg_set("COMPAGNY_NAME", "Edouard DUPIN")
|
||||
my_module.pkg_set("MAINTAINER", ["Mr DUPIN Edouard <yui.heero@gmail.com>"])
|
||||
my_module.pkg_set("ICON", tools.get_current_path(__file__) + "/../data/icon.png")
|
||||
my_module.pkg_set("SECTION", ["Development"])
|
||||
my_module.pkg_set("PRIORITY", "optional")
|
||||
my_module.pkg_set("DESCRIPTION", "ewol test software")
|
||||
my_module.pkg_set("NAME", "test software")
|
||||
|
||||
my_module.pkg_add("RIGHT", "SET_ORIENTATION")
|
||||
my_module.pkg_add("RIGHT", "VIBRATE")
|
||||
"""
|
||||
|
||||
return my_module
|
||||
|
||||
|
||||
|
||||
|
189
tools/visual_test/appl/MainWindows.cpp
Normal file
189
tools/visual_test/appl/MainWindows.cpp
Normal file
@ -0,0 +1,189 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/MainWindows.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/Sizer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
#include <ewol/context/Context.h>
|
||||
#include <appl/TestButton.h>
|
||||
#include <appl/TestCheckBox.h>
|
||||
#include <appl/TestButtonColor.h>
|
||||
#include <appl/TestLabel.h>
|
||||
#include <appl/TestImage.h>
|
||||
#include <appl/TestDistanceField.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
|
||||
|
||||
static const char * l_eventChangeTheme = "event-change-theme";
|
||||
static const char * l_eventChangeWidgetNext = "event-change-widget-test-next";
|
||||
static const char * l_eventChangeWidgetPrevious = "event-change-widget-test-previous";
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "MainWindows"
|
||||
|
||||
appl::MainWindows::MainWindows() :
|
||||
m_idWidget(0) {
|
||||
APPL_DEBUG("CREATE WINDOWS ... ");
|
||||
addObjectType("appl::MainWindows");
|
||||
}
|
||||
|
||||
void appl::MainWindows::init() {
|
||||
ewol::widget::Windows::init();
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerHori;
|
||||
std::shared_ptr<ewol::widget::Button> myButton;
|
||||
|
||||
m_sizerVert = ewol::widget::Sizer::create(ewol::widget::Sizer::modeVert);
|
||||
if (m_sizerVert == nullptr) {
|
||||
APPL_ERROR("Allocation error mySizerVert");
|
||||
return;
|
||||
}
|
||||
setSubWidget(m_sizerVert);
|
||||
|
||||
mySizerHori = ewol::widget::Sizer::create(ewol::widget::Sizer::modeHori);
|
||||
if (mySizerHori == nullptr) {
|
||||
APPL_ERROR("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
m_sizerVert->subWidgetAdd(mySizerHori);
|
||||
myButton = ewol::widget::Button::create();
|
||||
if (myButton != nullptr) {
|
||||
myButton->setSubWidget(ewol::widget::Label::create("default theme (cube)"));
|
||||
myButton->setSubWidgetToggle(ewol::widget::Label::create("rounded theme"));
|
||||
myButton->setToggleMode(true);
|
||||
myButton->signalValue.bind(shared_from_this(), &appl::MainWindows::onCallbackThemeChange);
|
||||
mySizerHori->subWidgetAdd(myButton);
|
||||
}
|
||||
myButton = ewol::widget::Button::create();
|
||||
if (myButton != nullptr) {
|
||||
myButton->setSubWidget(ewol::widget::Label::create("Previous Widget test"));
|
||||
myButton->signalPressed.bind(shared_from_this(), &appl::MainWindows::onCallbackWidgetChange, -1);
|
||||
mySizerHori->subWidgetAdd(myButton);
|
||||
}
|
||||
myButton = ewol::widget::Button::create();
|
||||
if (myButton != nullptr) {
|
||||
myButton->setSubWidget(ewol::widget::Label::create("Next Widget test"));
|
||||
myButton->signalPressed.bind(shared_from_this(), &appl::MainWindows::onCallbackWidgetChange, 1);
|
||||
mySizerHori->subWidgetAdd(myButton);
|
||||
}
|
||||
m_testName = ewol::widget::Label::create("none");
|
||||
if (m_testName != nullptr) {
|
||||
mySizerHori->subWidgetAdd(m_testName);
|
||||
}
|
||||
std::shared_ptr<ewol::widget::Spacer> mySpacer = ewol::widget::Spacer::create();
|
||||
if (mySpacer != nullptr) {
|
||||
mySpacer->setExpand(bvec2(false,false));
|
||||
mySpacer->setFill(bvec2(true,false));
|
||||
mySpacer->setMinSize(vec2(3,3));
|
||||
mySpacer->setColor(0x000000FF);
|
||||
m_sizerVert->subWidgetAdd(mySpacer);
|
||||
}
|
||||
}
|
||||
|
||||
void appl::MainWindows::onCallbackThemeChange(const bool& _value) {
|
||||
if (_value == true) {
|
||||
etk::theme::setName("GUI", "shape/round/");
|
||||
} else {
|
||||
etk::theme::setName("GUI", "shape/square/");
|
||||
}
|
||||
// Reload shaders and graphic system ...
|
||||
ewol::getContext().getResourcesManager().reLoadResources();
|
||||
ewol::getContext().forceRedrawAll();
|
||||
}
|
||||
|
||||
void appl::MainWindows::onCallbackWidgetChange(int32_t _increment) {
|
||||
m_idWidget += _increment;
|
||||
|
||||
if (m_subWidget != nullptr) {
|
||||
m_subWidget->destroy();
|
||||
// in theory it must be removed ...
|
||||
m_subWidget.reset();
|
||||
}
|
||||
switch(m_idWidget) {
|
||||
case 0:
|
||||
m_subWidget = appl::TestButton::create();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_sizerVert->subWidgetAdd(m_subWidget);
|
||||
}
|
||||
if (m_testName!=nullptr) {
|
||||
m_testName->setLabel("TestButton");
|
||||
};
|
||||
break;
|
||||
case 1:
|
||||
m_subWidget = TestDistanceField::create();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_sizerVert->subWidgetAdd(m_subWidget);
|
||||
}
|
||||
if (m_testName != nullptr) {
|
||||
m_testName->setLabel("Test Distance Field");
|
||||
};
|
||||
break;
|
||||
case 2:
|
||||
m_subWidget = TestButtonColor::create();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_sizerVert->subWidgetAdd(m_subWidget);
|
||||
}
|
||||
if (m_testName != nullptr) {
|
||||
m_testName->setLabel("TestButtonColor");
|
||||
};
|
||||
break;
|
||||
case 3:
|
||||
m_subWidget = TestLabel::create();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_sizerVert->subWidgetAdd(m_subWidget);
|
||||
}
|
||||
if (m_testName != nullptr) {
|
||||
m_testName->setLabel("TestLabel");
|
||||
};
|
||||
break;
|
||||
case 4:
|
||||
m_subWidget = TestImage::create();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_sizerVert->subWidgetAdd(m_subWidget);
|
||||
}
|
||||
if (m_testName != nullptr) {
|
||||
m_testName->setLabel("TestImage");
|
||||
};
|
||||
break;
|
||||
case 5:
|
||||
m_subWidget = appl::TestCheckBox::create();
|
||||
if (m_subWidget != nullptr) {
|
||||
m_sizerVert->subWidgetAdd(m_subWidget);
|
||||
}
|
||||
if (m_testName != nullptr) {
|
||||
m_testName->setLabel("TestCheckbox");
|
||||
};
|
||||
break;
|
||||
default:
|
||||
m_subWidget = ewol::widget::Label::create("Test software for EWOL");
|
||||
if (m_subWidget != nullptr) {
|
||||
m_subWidget->setExpand(bvec2(true,true));
|
||||
m_sizerVert->subWidgetAdd(m_subWidget);
|
||||
}
|
||||
if (m_testName != nullptr) {
|
||||
m_testName->setLabel("Label");
|
||||
};
|
||||
m_idWidget = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
40
tools/visual_test/appl/MainWindows.h
Normal file
40
tools/visual_test/appl/MainWindows.h
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __MAIN_WINDOWS_H__
|
||||
#define __MAIN_WINDOWS_H__
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Windows.h>
|
||||
#include <ewol/widget/Sizer.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
namespace appl {
|
||||
class MainWindows : public ewol::widget::Windows {
|
||||
private:
|
||||
std::shared_ptr<ewol::widget::Sizer> m_sizerVert;
|
||||
std::shared_ptr<ewol::Widget> m_subWidget;
|
||||
std::shared_ptr<ewol::widget::Label> m_testName;
|
||||
int32_t m_idWidget;
|
||||
public:
|
||||
// Constructeur
|
||||
MainWindows();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(MainWindows);
|
||||
~MainWindows() {};
|
||||
protected:
|
||||
void onCallbackThemeChange(const bool& _value);
|
||||
void onCallbackWidgetChange(int32_t _increment);
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
|
210
tools/visual_test/appl/TestButton.cpp
Normal file
210
tools/visual_test/appl/TestButton.cpp
Normal file
@ -0,0 +1,210 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/TestButton.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/Sizer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestButton"
|
||||
|
||||
appl::TestButton::TestButton() {
|
||||
addObjectType("appl::TestButton");
|
||||
}
|
||||
|
||||
void appl::TestButton::init() {
|
||||
ewol::widget::Composer::init();
|
||||
APPL_INFO("Create " __class__ " (start)");
|
||||
|
||||
std::string myDescription = std::string("")
|
||||
+ "<sizer mode='vert' fill='true' expand='true'>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <button name='[TEST]Button:Expand-x' toggle='true'>\n"
|
||||
+ " <label>Expend X <br/> (false)</label>\n"
|
||||
+ " <label>Expend X <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Expand-y' toggle='true'>\n"
|
||||
+ " <label>Expend Y <br/> (false)</label>\n"
|
||||
+ " <label>Expend Y <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Toggle' toggle='true'>\n"
|
||||
+ " <label>Toggle <br/> (false)</label>\n"
|
||||
+ " <label>Toggle <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:TextToggle' toggle='true'>\n"
|
||||
+ " <label>Text On toggle state <br/> (false)</label>\n"
|
||||
+ " <label>Text On toggle state <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <button name='[TEST]Button:Fill-x' toggle='true'>\n"
|
||||
+ " <label>Fill X <br/> (false)</label>\n"
|
||||
+ " <label>Fill X <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Fill-y' toggle='true'>\n"
|
||||
+ " <label>Fill Y <br/> (false)</label>\n"
|
||||
+ " <label>Fill Y <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:ChangeText'>\n"
|
||||
+ " <label>Change Text<br/> and other ...</label>\n"
|
||||
+ " </button>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <spacer expand='false,false' fill='true,false' min-size='10,10px' color='#F008'/>\n"
|
||||
+ " <sizer mode='vert'>\n"
|
||||
+ " <spacer expand='false,false' fill='false,true' min-size='10,10px' color='#FF08'/>\n"
|
||||
+ " <button name='[TEST]Button:TO-TEST' expand='false,false' fill='false,false' >\n"
|
||||
+ " <label>My <font color='#FF0000'>Button</font> <br/> And Some under line<br/> plop <br/> and an other super long line ...</label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <spacer expand='false,false' fill='false,true' min-size='10,10px' color='#0FF8'/>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <spacer expand='false,false' fill='true,false' min-size='10,10px' color='#0F08'/>\n"
|
||||
+ " </sizer>\n"
|
||||
+ "</sizer>";
|
||||
loadFromString(myDescription);
|
||||
setExpand(bvec2(true,true));
|
||||
setFill(bvec2(true,true));
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Expand-x", signalValue, shared_from_this(), &appl::TestButton::onCallbackExpendX);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Expand-y", signalValue, shared_from_this(), &appl::TestButton::onCallbackExpendY);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Toggle", signalValue, shared_from_this(), &appl::TestButton::onCallbackToggle);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:TextToggle", signalValue, shared_from_this(), &appl::TestButton::onCallbackTextToggle);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Fill-x", signalValue, shared_from_this(), &appl::TestButton::onCallbackFillX);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Fill-y", signalValue, shared_from_this(), &appl::TestButton::onCallbackFillY);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:ChangeText", signalPressed, shared_from_this(), &appl::TestButton::onCallbackChangeText);
|
||||
m_testWidget = std::dynamic_pointer_cast<ewol::widget::Button>(getSubObjectNamed("[TEST]Button:TO-TEST"));
|
||||
if (m_testWidget == nullptr) {
|
||||
APPL_CRITICAL("Can not get the pointer of the widget button pointer");
|
||||
}
|
||||
APPL_INFO("Create " __class__ " (end)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
void appl::TestButton::onCallbackExpendX(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setExpand(bvec2(_value, m_testWidget->getExpand().y()));
|
||||
}
|
||||
|
||||
void appl::TestButton::onCallbackExpendY(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setExpand(bvec2(m_testWidget->getExpand().x(), _value));
|
||||
}
|
||||
|
||||
void appl::TestButton::onCallbackFillX(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setFill(bvec2(_value, m_testWidget->getFill().y()));
|
||||
}
|
||||
|
||||
void appl::TestButton::onCallbackFillY(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setFill(bvec2(m_testWidget->getFill().x(), _value));
|
||||
}
|
||||
|
||||
void appl::TestButton::onCallbackToggle(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setToggleMode(_value);
|
||||
}
|
||||
|
||||
void appl::TestButton::onCallbackTextToggle(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (_value == true) {
|
||||
m_testWidget->setSubWidgetToggle(ewol::widget::Label::create("A stupid very long text on toggle <br/><br/> and on multiple lines"));
|
||||
} else {
|
||||
m_testWidget->setSubWidgetToggle(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TestButton::onCallbackChangeText() {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
static int32_t countTextID = 1;
|
||||
switch (countTextID) {
|
||||
case 0:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple Text"));
|
||||
break;
|
||||
case 1:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("<left>Align Left</left>"));
|
||||
break;
|
||||
case 2:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("<right>Align right</right>"));
|
||||
break;
|
||||
case 3:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("<center>Align center</center>"));
|
||||
break;
|
||||
case 4:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple Text<br/> With Some Other Lines<br/> and more if you want ...<br/> plop"));
|
||||
break;
|
||||
case 5:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple <bold>Text</bold> with bold"));
|
||||
break;
|
||||
case 6:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple <italic>Text</italic> with italic"));
|
||||
break;
|
||||
case 7:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple <italic><bold>Text</bold></italic> with italic bold"));
|
||||
break;
|
||||
case 8:
|
||||
m_testWidget->setSubWidget(nullptr);
|
||||
break;
|
||||
case 9:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple <font color=\"#FFFF0088\">Text</font> with colored text"));
|
||||
break;
|
||||
case 10:
|
||||
m_testWidget->setSubWidget(ewol::widget::Composer::create(ewol::widget::Composer::String, "<label>ploppp</label>\n"));
|
||||
break;
|
||||
case 11:
|
||||
m_testWidget->setSubWidget(ewol::widget::Composer::create(ewol::widget::Composer::String,
|
||||
" <sizer mode=\"vert\" addmode=\"invert\">\n"
|
||||
" <label>ploppp</label>\n"
|
||||
" <label expand=\"true,true\"><center>** ** * *<br/>** * * * *</center></label>\n"
|
||||
" </sizer>\n"));
|
||||
break;
|
||||
case 12:
|
||||
m_testWidget->setSubWidget(ewol::widget::Composer::create(ewol::widget::Composer::String, "<spacer color='red' min-size='30,30px'/>\n"));
|
||||
break;
|
||||
default:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("My <font color=\"#FF0000\">Button</font> <br/> And Some under line<br/> plop <br/> and an other super long line ..."));
|
||||
countTextID=-1;
|
||||
break;
|
||||
}
|
||||
// set at the subWidget all the space they can ...
|
||||
if (m_testWidget->getSubWidget() != nullptr){
|
||||
m_testWidget->getSubWidget()->setFill(bvec2(true,true));
|
||||
m_testWidget->getSubWidget()->setExpand(bvec2(true,true));
|
||||
}
|
||||
countTextID++;
|
||||
}
|
||||
|
36
tools/visual_test/appl/TestButton.h
Normal file
36
tools/visual_test/appl/TestButton.h
Normal file
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_BUTTON_H__
|
||||
#define __TEST_BUTTON_H__
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
namespace appl {
|
||||
class TestButton : public ewol::widget::Composer {
|
||||
private:
|
||||
std::shared_ptr<ewol::widget::Button> m_testWidget;
|
||||
public:
|
||||
// Constructeur
|
||||
TestButton();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TestButton);
|
||||
protected:
|
||||
void onCallbackExpendX(const bool& _value);
|
||||
void onCallbackExpendY(const bool& _value);
|
||||
void onCallbackFillX(const bool& _value);
|
||||
void onCallbackFillY(const bool& _value);
|
||||
void onCallbackToggle(const bool& _value);
|
||||
void onCallbackTextToggle(const bool& _value);
|
||||
void onCallbackChangeText();
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
125
tools/visual_test/appl/TestButtonColor.cpp
Normal file
125
tools/visual_test/appl/TestButtonColor.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/TestButtonColor.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/Sizer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
|
||||
|
||||
static const char * l_eventChangeExpendX = "event-change-expend-X";
|
||||
static const char * l_eventChangeExpendY = "event-change-expend-Y";
|
||||
static const char * l_eventChangeFillX = "event-change-fill-X";
|
||||
static const char * l_eventChangeFillY = "event-change-fill-Y";
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestButton"
|
||||
|
||||
appl::TestButtonColor::TestButtonColor() {
|
||||
addObjectType("appl::TestButtonColor");
|
||||
}
|
||||
|
||||
void appl::TestButtonColor::init() {
|
||||
ewol::widget::Composer::init();
|
||||
|
||||
APPL_INFO("Create " __class__ " (start)");
|
||||
|
||||
std::string myDescription = std::string("")
|
||||
+ "<sizer mode='vert' fill='true' expand='true'>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <button name='[TEST]Button:Expand-x' toggle='true'>\n"
|
||||
+ " <label>Expend X <br/> (false)</label>\n"
|
||||
+ " <label>Expend X <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Expand-y' toggle='true'>\n"
|
||||
+ " <label>Expend Y <br/> (false)</label>\n"
|
||||
+ " <label>Expend Y <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <button name='[TEST]Button:Fill-x' toggle='true'>\n"
|
||||
+ " <label>Fill X <br/> (false)</label>\n"
|
||||
+ " <label>Fill X <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Fill-y' toggle='true'>\n"
|
||||
+ " <label>Fill Y <br/> (false)</label>\n"
|
||||
+ " <label>Fill Y <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <spacer expand='false,false' fill='true,false' min-size='10,10px' color='#F008'/>\n"
|
||||
+ " <sizer mode='vert'>\n"
|
||||
+ " <spacer expand='false,false' fill='false,true' min-size='10,10px' color='#FF08'/>\n"
|
||||
+ " <ButtonColor name='[TEST]TO-TEST' expand='false,false' fill='false,false' />\n"
|
||||
+ " <spacer expand='false,false' fill='false,true' min-size='10,10px' color='#0FF8'/>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <spacer expand='false,false' fill='true,false' min-size='10,10px' color='#0F08'/>\n"
|
||||
+ " </sizer>\n"
|
||||
+ "</sizer>";
|
||||
loadFromString(myDescription);
|
||||
setExpand(bvec2(true,true));
|
||||
setFill(bvec2(true,true));
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Expand-x", signalValue, shared_from_this(), &appl::TestButtonColor::onCallbackExpendX);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Expand-y", signalValue, shared_from_this(), &appl::TestButtonColor::onCallbackExpendY);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Fill-x", signalValue, shared_from_this(), &appl::TestButtonColor::onCallbackFillX);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Fill-y", signalValue, shared_from_this(), &appl::TestButtonColor::onCallbackFillY);
|
||||
m_testWidget = std::dynamic_pointer_cast<ewol::widget::ButtonColor>(getSubObjectNamed("[TEST]TO-TEST"));
|
||||
if (m_testWidget == nullptr) {
|
||||
APPL_CRITICAL("Can not get the pointer of the widget button pointer");
|
||||
}
|
||||
m_testWidget->signalChange.bind(shared_from_this(), &appl::TestButtonColor::onCallbackChangeColor);
|
||||
APPL_INFO("Create " __class__ " (end)");
|
||||
}
|
||||
|
||||
void appl::TestButtonColor::onCallbackExpendX(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setExpand(bvec2(_value, m_testWidget->getExpand().y()));
|
||||
}
|
||||
|
||||
void appl::TestButtonColor::onCallbackExpendY(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setExpand(bvec2(m_testWidget->getExpand().x(), _value));
|
||||
}
|
||||
|
||||
void appl::TestButtonColor::onCallbackFillX(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setFill(bvec2(_value, m_testWidget->getFill().y()));
|
||||
}
|
||||
|
||||
void appl::TestButtonColor::onCallbackFillY(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setFill(bvec2(m_testWidget->getFill().x(), _value));
|
||||
}
|
||||
|
||||
void appl::TestButtonColor::onCallbackChangeColor(const etk::Color<>& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
APPL_WARNING("Color change: " << _value);
|
||||
}
|
39
tools/visual_test/appl/TestButtonColor.h
Normal file
39
tools/visual_test/appl/TestButtonColor.h
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_BUTTON_COLOR_H__
|
||||
#define __TEST_BUTTON_COLOR_H__
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/ButtonColor.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
|
||||
namespace appl {
|
||||
class TestButtonColor : public ewol::widget::Composer {
|
||||
private:
|
||||
std::shared_ptr<ewol::widget::ButtonColor> m_testWidget;
|
||||
public:
|
||||
// Constructeur
|
||||
TestButtonColor();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TestButtonColor);
|
||||
virtual ~TestButtonColor() {};
|
||||
protected:
|
||||
void onCallbackExpendX(const bool& _value);
|
||||
void onCallbackExpendY(const bool& _value);
|
||||
void onCallbackFillX(const bool& _value);
|
||||
void onCallbackFillY(const bool& _value);
|
||||
void onCallbackChangeColor(const etk::Color<>& _value);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
180
tools/visual_test/appl/TestCheckBox.cpp
Normal file
180
tools/visual_test/appl/TestCheckBox.cpp
Normal file
@ -0,0 +1,180 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/TestCheckBox.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/Sizer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestCheckBox"
|
||||
|
||||
appl::TestCheckBox::TestCheckBox() {
|
||||
addObjectType("appl::TestCheckBox");
|
||||
}
|
||||
|
||||
void appl::TestCheckBox::init() {
|
||||
ewol::widget::Composer::init();
|
||||
|
||||
APPL_INFO("Create " __class__ " (start)");
|
||||
|
||||
std::string myDescription = std::string("")
|
||||
+ "<sizer mode='vert' fill='true' expand='true'>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <button name='[TEST]Button:Expand-x' toggle='true'>\n"
|
||||
+ " <label>Expend X <br/> (false)</label>\n"
|
||||
+ " <label>Expend X <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Expand-y' toggle='true'>\n"
|
||||
+ " <label>Expend Y <br/> (false)</label>\n"
|
||||
+ " <label>Expend Y <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:TextToggle' toggle='true'>\n"
|
||||
+ " <label>Text On toggle state <br/> (false)</label>\n"
|
||||
+ " <label>Text On toggle state <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <button name='[TEST]Button:Fill-x' toggle='true'>\n"
|
||||
+ " <label>Fill X <br/> (false)</label>\n"
|
||||
+ " <label>Fill X <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Fill-y' toggle='true'>\n"
|
||||
+ " <label>Fill Y <br/> (false)</label>\n"
|
||||
+ " <label>Fill Y <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:ChangeText'>\n"
|
||||
+ " <label>Change Text<br/> and other ...</label>\n"
|
||||
+ " </button>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <spacer expand='false,false' fill='true,false' min-size='10,10px' color='#F008'/>\n"
|
||||
+ " <sizer mode='vert'>\n"
|
||||
+ " <spacer expand='false,false' fill='false,true' min-size='10,10px' color='#FF08'/>\n"
|
||||
+ " <CheckBox name='[TEST]TO-TEST' expand='false,false' fill='false,false' >\n"
|
||||
+ " <label>My <font color='#FF0000'>CheckBox</font> <br/> And Some under line<br/> plop <br/> and an other super long line ...</label>\n"
|
||||
+ " </CheckBox>\n"
|
||||
+ " <spacer expand='false,false' fill='false,true' min-size='10,10px' color='#0FF8'/>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <spacer expand='false,false' fill='true,false' min-size='10,10px' color='#0F08'/>\n"
|
||||
+ " </sizer>\n"
|
||||
+ "</sizer>";
|
||||
loadFromString(myDescription);
|
||||
setExpand(bvec2(true,true));
|
||||
setFill(bvec2(true,true));
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Expand-x", signalValue, shared_from_this(), &appl::TestCheckBox::onCallbackExpendX);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Expand-y", signalValue, shared_from_this(), &appl::TestCheckBox::onCallbackExpendY);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Fill-x", signalValue, shared_from_this(), &appl::TestCheckBox::onCallbackFillX);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Fill-y", signalValue, shared_from_this(), &appl::TestCheckBox::onCallbackFillY);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:TextToggle", signalValue, shared_from_this(), &appl::TestCheckBox::onCallbackTextToggle);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:ChangeText", signalPressed, shared_from_this(), &appl::TestCheckBox::onCallbackChangeText);
|
||||
m_testWidget = std::dynamic_pointer_cast<ewol::widget::CheckBox>(getSubObjectNamed("[TEST]TO-TEST"));
|
||||
if (m_testWidget == nullptr) {
|
||||
APPL_CRITICAL("Can not get the pointer of the widget button pointer");
|
||||
}
|
||||
APPL_INFO("Create " __class__ " (end)");
|
||||
}
|
||||
|
||||
void appl::TestCheckBox::onCallbackExpendX(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setExpand(bvec2(_value, m_testWidget->getExpand().y()));
|
||||
}
|
||||
|
||||
void appl::TestCheckBox::onCallbackExpendY(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setExpand(bvec2(m_testWidget->getExpand().x(), _value));
|
||||
}
|
||||
|
||||
void appl::TestCheckBox::onCallbackFillX(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setFill(bvec2(_value, m_testWidget->getFill().y()));
|
||||
}
|
||||
|
||||
void appl::TestCheckBox::onCallbackFillY(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setFill(bvec2(m_testWidget->getFill().x(), _value));
|
||||
}
|
||||
|
||||
void appl::TestCheckBox::onCallbackTextToggle(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (_value == true) {
|
||||
m_testWidget->setSubWidgetToggle(ewol::widget::Label::create("A stupid very long text on toggle <br/><br/> and on multiple lines"));
|
||||
} else {
|
||||
m_testWidget->setSubWidgetToggle(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TestCheckBox::onCallbackChangeText() {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
static int32_t countTextID = 1;
|
||||
switch (countTextID) {
|
||||
case 0:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple Text"));
|
||||
break;
|
||||
case 1:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("<left>Align Left</left>"));
|
||||
break;
|
||||
case 2:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("<right>Align right</right>"));
|
||||
break;
|
||||
case 3:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("<center>Align center</center>"));
|
||||
break;
|
||||
case 4:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple Text<br/> With Some Other Lines<br/> and more if you want ...<br/> plop"));
|
||||
break;
|
||||
case 5:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple <bold>Text</bold> with bold"));
|
||||
break;
|
||||
case 6:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple <italic>Text</italic> with italic"));
|
||||
break;
|
||||
case 7:
|
||||
m_testWidget->setSubWidget(ewol::widget::Label::create("simple <italic><bold>Text</bold></italic> with italic bold"));
|
||||
break;
|
||||
case 8:
|
||||
m_testWidget->setSubWidget(nullptr);
|
||||
countTextID=-1;
|
||||
break;
|
||||
}
|
||||
// set at the subWidget all the space they can ...
|
||||
if (m_testWidget->getSubWidget() != nullptr){
|
||||
m_testWidget->getSubWidget()->setFill(bvec2(true,true));
|
||||
m_testWidget->getSubWidget()->setExpand(bvec2(true,true));
|
||||
}
|
||||
countTextID++;
|
||||
}
|
||||
|
||||
|
||||
|
37
tools/visual_test/appl/TestCheckBox.h
Normal file
37
tools/visual_test/appl/TestCheckBox.h
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_CHECK_BOX_H__
|
||||
#define __TEST_CHECK_BOX_H__
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
|
||||
namespace appl {
|
||||
class TestCheckBox : public ewol::widget::Composer {
|
||||
private:
|
||||
std::shared_ptr<ewol::widget::CheckBox> m_testWidget;
|
||||
public:
|
||||
// Constructeur
|
||||
TestCheckBox();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TestCheckBox);
|
||||
protected:
|
||||
void onCallbackExpendX(const bool& _value);
|
||||
void onCallbackExpendY(const bool& _value);
|
||||
void onCallbackFillX(const bool& _value);
|
||||
void onCallbackFillY(const bool& _value);
|
||||
void onCallbackTextToggle(const bool& _value);
|
||||
void onCallbackChangeText();
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
87
tools/visual_test/appl/TestDistanceField.cpp
Normal file
87
tools/visual_test/appl/TestDistanceField.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/TestDistanceField.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/Sizer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestDistanceField"
|
||||
|
||||
appl::TestDistanceField::TestDistanceField(){
|
||||
addObjectType("appl::TestDistanceField");
|
||||
}
|
||||
|
||||
void appl::TestDistanceField::init() {
|
||||
ewol::Widget::init();
|
||||
APPL_INFO("Create " __class__ " (start)");
|
||||
setExpand(bvec2(true, true));
|
||||
setFill(bvec2(true, true));
|
||||
APPL_INFO("Create " __class__ " (end)");
|
||||
}
|
||||
|
||||
|
||||
void appl::TestDistanceField::calculateSize(const vec2& _availlable) {
|
||||
// set minimal size
|
||||
m_size = _availlable;
|
||||
}
|
||||
|
||||
|
||||
void appl::TestDistanceField::calculateMinMaxSize() {
|
||||
m_minSize = vec2(256,256);
|
||||
markToRedraw();
|
||||
}
|
||||
|
||||
|
||||
void appl::TestDistanceField::onDraw() {
|
||||
m_text2.draw();
|
||||
|
||||
m_text1.draw();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void appl::TestDistanceField::onRegenerateDisplay() {
|
||||
if (false == needRedraw()) {
|
||||
return;
|
||||
}
|
||||
APPL_WARNING("Regenerate...");
|
||||
m_text1.clear();
|
||||
m_text1.setPos(vec3(m_size.x()*0.5-20,m_size.y()*0.5+10,0));
|
||||
m_text1.printDecorated("Text To compare ... Avenue AAVVAA ... Normal generic test");
|
||||
|
||||
m_text2.clear();
|
||||
m_text2.setPos(vec3(m_size.x()*0.5-20,m_size.y()*0.5-10,0));
|
||||
m_text2.printDecorated("Text To compare ... Avenue AAVVAA ... Test en distance field Mode");
|
||||
|
||||
}
|
||||
|
||||
bool appl::TestDistanceField::onEventInput(const ewol::event::Input& _event) {
|
||||
if (_event.getId() == 4) {
|
||||
setZoom(getZoom() + 0.01f);
|
||||
} else if (_event.getId() == 5) {
|
||||
setZoom(getZoom() - 0.01f);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
39
tools/visual_test/appl/TestDistanceField.h
Normal file
39
tools/visual_test/appl/TestDistanceField.h
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_DISTANCE_FIELD_H__
|
||||
#define __TEST_DISTANCE_FIELD_H__
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/compositing/Text.h>
|
||||
#include <ewol/compositing/TextDF.h>
|
||||
#include <gale/resource/Program.h>
|
||||
#include <ewol/resource/DistanceFieldFont.h>
|
||||
|
||||
namespace appl {
|
||||
class TestDistanceField : public ewol::Widget {
|
||||
ewol::compositing::Text m_text1;
|
||||
ewol::compositing::TextDF m_text2;
|
||||
public:
|
||||
// Constructeur
|
||||
TestDistanceField();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TestDistanceField);
|
||||
virtual ~TestDistanceField() {};
|
||||
public: // Derived function
|
||||
virtual void onDraw();
|
||||
virtual void calculateMinMaxSize();
|
||||
virtual void calculateSize(const vec2& _availlable);
|
||||
virtual void onRegenerateDisplay();
|
||||
virtual bool onEventInput(const ewol::event::Input& _event);
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
0
tools/visual_test/appl/TestEntry.cpp
Normal file
0
tools/visual_test/appl/TestEntry.cpp
Normal file
0
tools/visual_test/appl/TestEntry.h
Normal file
0
tools/visual_test/appl/TestEntry.h
Normal file
145
tools/visual_test/appl/TestImage.cpp
Normal file
145
tools/visual_test/appl/TestImage.cpp
Normal file
@ -0,0 +1,145 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/TestImage.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/Sizer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestImage"
|
||||
|
||||
appl::TestImage::TestImage() {
|
||||
addObjectType("appl::TestImage");
|
||||
}
|
||||
void appl::TestImage::init() {
|
||||
ewol::widget::Composer::init();
|
||||
|
||||
APPL_INFO("Create " __class__ " (start)");
|
||||
|
||||
std::string myDescription = std::string("")
|
||||
+ "<sizer mode='vert' fill='true' expand='true'>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <button name='[TEST]Button:Expand-x' toggle='true'>\n"
|
||||
+ " <label>Expend X <br/> (false)</label>\n"
|
||||
+ " <label>Expend X <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Expand-y' toggle='true'>\n"
|
||||
+ " <label>Expend Y <br/> (false)</label>\n"
|
||||
+ " <label>Expend Y <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Toggle' toggle='true'>\n"
|
||||
+ " <label>Toggle <br/> (false)</label>\n"
|
||||
+ " <label>Toggle <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:TextToggle' toggle='true'>\n"
|
||||
+ " <label>Text On toggle state <br/> (false)</label>\n"
|
||||
+ " <label>Text On toggle state <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <button name='[TEST]Button:Fill-x' toggle='true'>\n"
|
||||
+ " <label>Fill X <br/> (false)</label>\n"
|
||||
+ " <label>Fill X <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Fill-y' toggle='true'>\n"
|
||||
+ " <label>Fill Y <br/> (false)</label>\n"
|
||||
+ " <label>Fill Y <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:ChangeImage'>\n"
|
||||
+ " <label>Change Image<br/> and other ...</label>\n"
|
||||
+ " </button>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <spacer expand='false,false' fill='true,false' min-size='10,10px' color='#F008'/>\n"
|
||||
+ " <sizer mode='vert'>\n"
|
||||
+ " <spacer expand='false,false' fill='false,true' min-size='10,10px' color='#FF08'/>\n"
|
||||
+ " <image name='[TEST]TO-TEST' expand='false,false' fill='false,false' src='DATA:sphere.png'/>\n"
|
||||
+ " <spacer expand='false,false' fill='false,true' min-size='10,10px' color='#0FF8'/>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <spacer expand='false,false' fill='true,false' min-size='10,10px' color='#0F08'/>\n"
|
||||
+ " </sizer>\n"
|
||||
+ "</sizer>";
|
||||
loadFromString(myDescription);
|
||||
setExpand(bvec2(true,true));
|
||||
setFill(bvec2(true,true));
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Expand-x", signalValue, shared_from_this(), &appl::TestImage::onCallbackExpendX);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Expand-y", signalValue, shared_from_this(), &appl::TestImage::onCallbackExpendY);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Fill-x", signalValue, shared_from_this(), &appl::TestImage::onCallbackFillX);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Fill-y", signalValue, shared_from_this(), &appl::TestImage::onCallbackFillY);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:ChangeImage", signalPressed, shared_from_this(), &appl::TestImage::onCallbackChangeImage);
|
||||
m_testWidget = std::dynamic_pointer_cast<ewol::widget::Image>(getSubObjectNamed("[TEST]TO-TEST"));
|
||||
if (m_testWidget == nullptr) {
|
||||
APPL_CRITICAL("Can not get the pointer of the widget button pointer");
|
||||
}
|
||||
APPL_INFO("Create " __class__ " (end)");
|
||||
}
|
||||
|
||||
void appl::TestImage::onCallbackExpendX(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setExpand(bvec2(_value, m_testWidget->getExpand().y()));
|
||||
}
|
||||
|
||||
void appl::TestImage::onCallbackExpendY(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setExpand(bvec2(m_testWidget->getExpand().x(), _value));
|
||||
}
|
||||
|
||||
void appl::TestImage::onCallbackFillX(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setFill(bvec2(_value, m_testWidget->getFill().y()));
|
||||
}
|
||||
|
||||
void appl::TestImage::onCallbackFillY(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setFill(bvec2(m_testWidget->getFill().x(), _value));
|
||||
}
|
||||
|
||||
|
||||
void appl::TestImage::onCallbackChangeImage() {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
static int32_t countID = 1;
|
||||
switch (countID) {
|
||||
case 0:
|
||||
m_testWidget->setFile("DATA:stone.png");
|
||||
break;
|
||||
case 1:
|
||||
m_testWidget->setFile("DATA:grass.png");
|
||||
break;
|
||||
default:
|
||||
m_testWidget->setFile("DATA:sphere.png");
|
||||
countID=-1;
|
||||
break;
|
||||
}
|
||||
countID++;
|
||||
}
|
||||
|
39
tools/visual_test/appl/TestImage.h
Normal file
39
tools/visual_test/appl/TestImage.h
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_IMAGE_H__
|
||||
#define __TEST_IMAGE_H__
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Image.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
|
||||
namespace appl {
|
||||
class TestImage : public ewol::widget::Composer {
|
||||
private:
|
||||
std::shared_ptr<ewol::widget::Image> m_testWidget;
|
||||
public:
|
||||
// Constructeur
|
||||
TestImage();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TestImage);
|
||||
virtual ~TestImage() {};
|
||||
protected:
|
||||
void onCallbackExpendX(const bool& _value);
|
||||
void onCallbackExpendY(const bool& _value);
|
||||
void onCallbackFillX(const bool& _value);
|
||||
void onCallbackFillY(const bool& _value);
|
||||
void onCallbackChangeImage();
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
180
tools/visual_test/appl/TestLabel.cpp
Normal file
180
tools/visual_test/appl/TestLabel.cpp
Normal file
@ -0,0 +1,180 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/TestLabel.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/Sizer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestButton"
|
||||
|
||||
appl::TestLabel::TestLabel() {
|
||||
addObjectType("appl::TestLabel");
|
||||
}
|
||||
|
||||
void appl::TestLabel::init() {
|
||||
ewol::widget::Composer::init();
|
||||
|
||||
APPL_INFO("Create " __class__ " (start)");
|
||||
|
||||
std::string myDescription = std::string("")
|
||||
+ "<sizer mode='vert' fill='true' expand='true'>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <button name='[TEST]Button:Expand-x' toggle='true'>\n"
|
||||
+ " <label>Expend X <br/> (false)</label>\n"
|
||||
+ " <label>Expend X <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Expand-y' toggle='true'>\n"
|
||||
+ " <label>Expend Y <br/> (false)</label>\n"
|
||||
+ " <label>Expend Y <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Toggle' toggle='true'>\n"
|
||||
+ " <label>Toggle <br/> (false)</label>\n"
|
||||
+ " <label>Toggle <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:TextToggle' toggle='true'>\n"
|
||||
+ " <label>Text On toggle state <br/> (false)</label>\n"
|
||||
+ " <label>Text On toggle state <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <button name='[TEST]Button:Fill-x' toggle='true'>\n"
|
||||
+ " <label>Fill X <br/> (false)</label>\n"
|
||||
+ " <label>Fill X <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:Fill-y' toggle='true'>\n"
|
||||
+ " <label>Fill Y <br/> (false)</label>\n"
|
||||
+ " <label>Fill Y <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:SetMaxSize' toggle='true'>\n"
|
||||
+ " <label>Max Size <br/> (false)</label>\n"
|
||||
+ " <label>Max Size <br/> <b>(true)</b></label>\n"
|
||||
+ " </button>\n"
|
||||
+ " <button name='[TEST]Button:ChangeText'>\n"
|
||||
+ " <label>Change Text<br/> and other ...</label>\n"
|
||||
+ " </button>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <sizer mode='hori'>\n"
|
||||
+ " <spacer expand='false,false' fill='true,false' min-size='10,10px' color='#F008'/>\n"
|
||||
+ " <sizer mode='vert'>\n"
|
||||
+ " <spacer expand='false,false' fill='false,true' min-size='10,10px' color='#FF08'/>\n"
|
||||
+ " <label name='[TEST]TO-TEST' expand='false,false' fill='false,false' >\n"
|
||||
+ " Text de base ...\n"
|
||||
+ " </label>\n"
|
||||
+ " <spacer expand='false,false' fill='false,true' min-size='10,10px' color='#0FF8'/>\n"
|
||||
+ " </sizer>\n"
|
||||
+ " <spacer expand='false,false' fill='true,false' min-size='10,10px' color='#0F08'/>\n"
|
||||
+ " </sizer>\n"
|
||||
+ "</sizer>";
|
||||
loadFromString(myDescription);
|
||||
setExpand(bvec2(true,true));
|
||||
setFill(bvec2(true,true));
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Expand-x", signalValue, shared_from_this(), &appl::TestLabel::onCallbackExpendX);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Expand-y", signalValue, shared_from_this(), &appl::TestLabel::onCallbackExpendY);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Fill-x", signalValue, shared_from_this(), &appl::TestLabel::onCallbackFillX);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:Fill-y", signalValue, shared_from_this(), &appl::TestLabel::onCallbackFillY);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:SetMaxSize", signalValue, shared_from_this(), &appl::TestLabel::onCallbackMaxSize);
|
||||
subBind(ewol::widget::Button, "[TEST]Button:ChangeText", signalPressed, shared_from_this(), &appl::TestLabel::onCallbackChangeLabel);
|
||||
m_testWidget = std::dynamic_pointer_cast<ewol::widget::Label>(getSubObjectNamed("[TEST]TO-TEST"));
|
||||
if (m_testWidget == nullptr) {
|
||||
APPL_CRITICAL("Can not get the pointer of the widget button pointer");
|
||||
}
|
||||
APPL_INFO("Create " __class__ " (end)");
|
||||
}
|
||||
|
||||
void appl::TestLabel::onCallbackExpendX(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setExpand(bvec2(_value, m_testWidget->getExpand().y()));
|
||||
}
|
||||
|
||||
void appl::TestLabel::onCallbackExpendY(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setExpand(bvec2(m_testWidget->getExpand().x(), _value));
|
||||
}
|
||||
|
||||
void appl::TestLabel::onCallbackFillX(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setFill(bvec2(_value, m_testWidget->getFill().y()));
|
||||
}
|
||||
|
||||
void appl::TestLabel::onCallbackFillY(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_testWidget->setFill(bvec2(m_testWidget->getFill().x(), _value));
|
||||
}
|
||||
|
||||
|
||||
void appl::TestLabel::onCallbackMaxSize(const bool& _value) {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (_value == true) {
|
||||
m_testWidget->setMaxSize(vec2(400,9999999999));
|
||||
} else {
|
||||
m_testWidget->setNoMaxSize();
|
||||
}
|
||||
}
|
||||
|
||||
void appl::TestLabel::onCallbackChangeLabel() {
|
||||
if (m_testWidget == nullptr) {
|
||||
return;
|
||||
}
|
||||
m_labelId++;
|
||||
switch(m_labelId) {
|
||||
default:
|
||||
m_labelId=0;
|
||||
case 0:
|
||||
m_testWidget->setLabel("Basic label");
|
||||
break;
|
||||
case 1:
|
||||
m_testWidget->setLabel("Basic <bold>label</bold>");
|
||||
break;
|
||||
case 2:
|
||||
m_testWidget->setLabel("<center>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle à jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#FF0000\">Jusqu'au moment elle <b>n'avait</b> point <i>song figure.</i></font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle à laide;<br/> Jean Valjean seul disait doucement : <br/> Mais non!<br/> mais non!<br/> Quoi qu'il en fut, Cosette toujours crue laide, et avait grandi dans cette id ec la réation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté sait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
"</center>\n");
|
||||
break;
|
||||
case 3:
|
||||
m_testWidget->setLabel("<left>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle à jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#0F0\">Jusqu'au moment elle <b>n'avait</b> point <i>song figure.</i></font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle à laide;<br/> Jean Valjean seul disait doucement :<br/> Mais non!<br/> mais non!<br/> Quoi qu'il en fut, Cosette toujours crue laide, et avait grandi dans cette id ec la réation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté sait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
"</left>\n");
|
||||
break;
|
||||
case 4:
|
||||
m_testWidget->setLabel("<right>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle à jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#00F\">Jusqu'au moment elle<b> n'avait</b> point <i>song figure.</i></font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle à laide;<br/> Jean Valjean seul disait doucement :<br/> Mais non! <br/> mais non!<br/> Quoi qu'il en fut, Cosette toujours crue laide, et avait grandi dans cette id ec la réation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté sait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
"</right>\n");
|
||||
break;
|
||||
case 5:
|
||||
m_testWidget->setLabel("<justify>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle à jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#FF0\">Jusqu'au moment elle <b>n'avait</b> point <i>song figure.</i></font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle à laide;<br/> Jean Valjean seul disait doucement :<br/> Mais non!<br/> mais non!<br/> Quoi qu'il en fut, Cosette toujours crue laide, et avait grandi dans cette id ec la réation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté sait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
"</justify>\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
47
tools/visual_test/appl/TestLabel.h
Normal file
47
tools/visual_test/appl/TestLabel.h
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_LABEL_H__
|
||||
#define __TEST_LABEL_H__
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
|
||||
namespace appl {
|
||||
class TestLabel : public ewol::widget::Composer {
|
||||
private:
|
||||
std::shared_ptr<ewol::widget::Label> m_testWidget;
|
||||
int32_t m_labelId;
|
||||
public:
|
||||
/**
|
||||
* @brief Constructeur
|
||||
*/
|
||||
TestLabel();
|
||||
void init();
|
||||
public:
|
||||
DECLARE_FACTORY(TestLabel);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
virtual ~TestLabel() {};
|
||||
protected:
|
||||
void onCallbackExpendX(const bool& _value);
|
||||
void onCallbackExpendY(const bool& _value);
|
||||
void onCallbackFillX(const bool& _value);
|
||||
void onCallbackFillY(const bool& _value);
|
||||
void onCallbackMaxSize(const bool& _value);
|
||||
void onCallbackChangeLabel();
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
0
tools/visual_test/appl/TestProgressBar.cpp
Normal file
0
tools/visual_test/appl/TestProgressBar.cpp
Normal file
0
tools/visual_test/appl/TestProgressBar.h
Normal file
0
tools/visual_test/appl/TestProgressBar.h
Normal file
340
tools/visual_test/appl/TestScene.cpp
Normal file
340
tools/visual_test/appl/TestScene.cpp
Normal file
@ -0,0 +1,340 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/TestScene.h>
|
||||
|
||||
#include <etk/tool.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/Sizer.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
|
||||
static const char * l_eventAddBox = "event-add-box";
|
||||
static const char * l_eventAddSphere = "event-add-sphere";
|
||||
static const char * l_eventRotationX = "event-rotation-X";
|
||||
static const char * l_eventRotationY = "event-rotation-Y";
|
||||
static const char * l_eventRotationZ = "event-rotation-Z";
|
||||
static const char * l_eventRotation0 = "event-rotation-0";
|
||||
static const char * l_eventLunch = "event-lunch";
|
||||
static const char * l_eventChangeTimeSpeed4 = "event-speed4";
|
||||
static const char * l_eventChangeTimeSpeed2 = "event-speed2";
|
||||
static const char * l_eventChangeTimeSpeed0 = "event-speed0.5";
|
||||
static const char * l_eventChangeTimeSpeed1 = "event-speed1";
|
||||
static const char * l_eventUp = "event-up";
|
||||
static const char * l_eventDown = "event-down";
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestScene"
|
||||
|
||||
TestScene::TestScene() :
|
||||
ewol::widget::Sizer(ewol::widget::Sizer::modeVert)
|
||||
{
|
||||
addObjectType("appl::TestScene");
|
||||
/*
|
||||
m_ground = new game::Element("DATA:grass.obj");
|
||||
if (nullptr != m_ground) {
|
||||
m_ground->SetStaticMode(true);
|
||||
m_gameEngine.AddElement(m_ground);
|
||||
}
|
||||
*/
|
||||
|
||||
APPL_CRITICAL("Create "__class__" (start)");
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerVert2 = nullptr;
|
||||
std::shared_ptr<ewol::widget::Sizer> mySizerHori = nullptr;
|
||||
std::shared_ptr<ewol::widget::Button> myButton = nullptr;
|
||||
/*
|
||||
mySizerHori = new ewol::widget::SizerHori();
|
||||
if (nullptr == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
myButton = new ewol::widget::Button("Add Box");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventAddBox);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("Add Sphere");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventAddSphere);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("Rotation X");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationX);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("Rotation Y"); = nullptr
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("Rotation Z");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationZ);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("Rotation -");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotation0);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("UP");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventUp);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("DOWN");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventDown);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
mySizerHori = new ewol::widget::SizerHori();
|
||||
if (nullptr == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
myButton = new ewol::widget::Button("lunch object");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventLunch);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("1x speed");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed1);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("0.5x speed");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed0);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("2x speed");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed2);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new ewol::widget::Button("4x speed");
|
||||
if (nullptr != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed4);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
*/
|
||||
std::shared_ptr<ewol::widget::Spacer> mySpacer = new widget::Spacer();
|
||||
if (nullptr != mySpacer) {
|
||||
mySpacer->setExpand(bvec2(false,false));
|
||||
mySpacer->setFill(bvec2(true,false));
|
||||
mySpacer->setMinSize(vec2(10,10));
|
||||
mySpacer->setColor(0xFF000080);
|
||||
subWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
mySizerHori = new ewol::widget::Sizer(ewol::widget::Sizer::modeHori);
|
||||
if (nullptr == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
subWidgetAdd(mySizerHori);
|
||||
mySpacer = new ewol::widget::Spacer();
|
||||
if (nullptr != mySpacer) {
|
||||
mySpacer->setExpand(bvec2(false,false));
|
||||
mySpacer->setFill(bvec2(false,true));
|
||||
mySpacer->setMinSize(vec2(10,10));
|
||||
mySpacer->setColor(0x00FF0080);
|
||||
mySizerHori->subWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
m_testWidget = new ewol::widget::Scene(/*&m_gameEngine*/ nullptr);
|
||||
if (nullptr != m_testWidget) {
|
||||
m_testWidget->setExpand(bvec2(true,true));
|
||||
m_testWidget->setFill(bvec2(true,true));
|
||||
mySizerHori->subWidgetAdd(m_testWidget);
|
||||
}
|
||||
|
||||
mySpacer = new ewol::widget::Spacer();
|
||||
if (nullptr != mySpacer) {
|
||||
mySpacer->setExpand(bvec2(false,false));
|
||||
mySpacer->setFill(bvec2(false,true));
|
||||
mySpacer->setMinSize(vec2(10,10));
|
||||
mySpacer->setColor(0x0000FF80);
|
||||
mySizerHori->subWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
mySpacer = new ewol::widget::Spacer();
|
||||
if (nullptr != mySpacer) {
|
||||
mySpacer->setExpand(bvec2(false,false));
|
||||
mySpacer->setFill(bvec2(true,false));
|
||||
mySpacer->setMinSize(vec2(10,10));
|
||||
mySpacer->setColor(0x00FFFF80);
|
||||
subWidgetAdd(mySpacer);
|
||||
}
|
||||
APPL_INFO("Create "__class__" (end)");
|
||||
}
|
||||
|
||||
|
||||
TestScene::~TestScene() {
|
||||
APPL_INFO("Remove "__class__" ...");
|
||||
}
|
||||
|
||||
/*
|
||||
#include <ewol/game/Element.h>
|
||||
|
||||
vec3 baseRotationVect;
|
||||
vec3 baseMove;
|
||||
class stupidCube : public game::Element
|
||||
{
|
||||
public:
|
||||
stupidCube(float poidKg=0.0f) : game::Element("DATA:cube.obj")
|
||||
{
|
||||
m_mass = poidKg;
|
||||
};
|
||||
|
||||
// herited methode
|
||||
virtual bool ArtificialIntelligence(float delta)
|
||||
{
|
||||
if (m_mass == 0.0f) {
|
||||
if (baseRotationVect != vec3(0,0,0) ) {
|
||||
Rotate(baseRotationVect, 0.5 * delta );
|
||||
}
|
||||
if (baseMove != vec3(0,0,0) ) {
|
||||
Translate(baseMove);
|
||||
baseMove = vec3(0,0,0);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class stupidSphere : public game::Element
|
||||
{
|
||||
public:
|
||||
stupidSphere(float poidKg=0.0f) : game::Element("DATA:sphere.obj")
|
||||
{
|
||||
m_mass = poidKg;
|
||||
};
|
||||
|
||||
// herited methode
|
||||
virtual bool ArtificialIntelligence(float delta)
|
||||
{
|
||||
if (m_mass == 0.0f) {
|
||||
if (baseRotationVect != vec3(0,0,0) ) {
|
||||
Rotate(baseRotationVect, 0.5 * delta );
|
||||
}
|
||||
if (baseMove != vec3(0,0,0) ) {
|
||||
Translate(baseMove);
|
||||
baseMove = vec3(0,0,0);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void TestScene::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
ewol::widget::Sizer::onReceiveMessage(_msg);
|
||||
/*
|
||||
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (m_testWidget == CallerObject) {
|
||||
APPL_WARNING("Receive Event from tested Scene ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
}
|
||||
if (eventId == l_eventAddBox) {
|
||||
static bool firstTime = true;
|
||||
if (firstTime==false) {
|
||||
stupidCube * tmpp = new stupidCube();
|
||||
vec3 newPos = vec3(etk::tool::frand(-40,40),etk::tool::frand(-40,40),etk::tool::frand(1,8));
|
||||
APPL_DEBUG("add a box at the pos : " << newPos);
|
||||
tmpp->Translate(newPos);
|
||||
tmpp->Scale(etk::tool::frand(0.5,2) );
|
||||
float angle = etk::tool::frand(-M_PI,M_PI);
|
||||
tmpp->Rotate(vec3(1,0,0), angle);
|
||||
angle = etk::tool::frand(-M_PI,M_PI);
|
||||
tmpp->Rotate(vec3(0,1,0), angle);
|
||||
angle = etk::tool::frand(-M_PI,M_PI);
|
||||
tmpp->Rotate(vec3(0,0,1), angle);
|
||||
m_gameEngine.AddElement(tmpp);
|
||||
} else {
|
||||
firstTime = false;
|
||||
stupidCube * tmpp = new stupidCube();
|
||||
m_gameEngine.AddElement(tmpp);
|
||||
}
|
||||
} else if (eventId == l_eventAddSphere) {
|
||||
if (nullptr!=m_testWidget) {
|
||||
stupidSphere * tmpp = new stupidSphere();
|
||||
vec3 newPos = vec3(etk::tool::frand(-40,40),etk::tool::frand(-40,40),etk::tool::frand(1,8));
|
||||
APPL_DEBUG("add a box at the pos : " << newPos);
|
||||
tmpp->Translate(newPos);
|
||||
tmpp->Scale(etk::tool::frand(0.5,2) );
|
||||
float angle = etk::tool::frand(-M_PI,M_PI);
|
||||
tmpp->Rotate(vec3(1,0,0), angle);
|
||||
angle = etk::tool::frand(-M_PI,M_PI);
|
||||
tmpp->Rotate(vec3(0,1,0), angle);
|
||||
angle = etk::tool::frand(-M_PI,M_PI);
|
||||
tmpp->Rotate(vec3(0,0,1), angle);
|
||||
m_gameEngine.AddElement(tmpp);
|
||||
}
|
||||
} else if (eventId == l_eventUp) {
|
||||
baseMove = vec3(0.1,0,0);
|
||||
} else if (eventId == l_eventDown) {
|
||||
baseMove = vec3(-0.1,0,0);
|
||||
} else if (eventId == l_eventRotationX) {
|
||||
baseRotationVect = vec3(1,0,0);
|
||||
} else if (eventId == l_eventRotationY) {
|
||||
baseRotationVect = vec3(0,1,0);
|
||||
} else if (eventId == l_eventRotationZ) {
|
||||
baseRotationVect = vec3(0,0,1);
|
||||
} else if (eventId == l_eventRotation0) {
|
||||
baseRotationVect = vec3(0,0,0);
|
||||
} else if (eventId == l_eventLunch) {
|
||||
stupidCube * tmpp = new stupidCube(250);
|
||||
vec3 newPos = vec3(5,5,100);
|
||||
tmpp->Translate(newPos);
|
||||
tmpp->SetSpeed(vec3(10,10,50));
|
||||
m_gameEngine.AddElement(tmpp);
|
||||
} else if (eventId == l_eventChangeTimeSpeed1) {
|
||||
if (nullptr!=m_testWidget) {
|
||||
m_testWidget->SetRatioTime(1);
|
||||
}
|
||||
} else if (eventId == l_eventChangeTimeSpeed0) {
|
||||
if (nullptr!=m_testWidget) {
|
||||
m_testWidget->SetRatioTime(0.5);
|
||||
}
|
||||
} else if (eventId == l_eventChangeTimeSpeed2) {
|
||||
if (nullptr!=m_testWidget) {
|
||||
m_testWidget->SetRatioTime(2);
|
||||
}
|
||||
} else if (eventId == l_eventChangeTimeSpeed4) {
|
||||
if (nullptr!=m_testWidget) {
|
||||
m_testWidget->SetRatioTime(4);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return;
|
||||
}
|
||||
|
28
tools/visual_test/appl/TestScene.h
Normal file
28
tools/visual_test/appl/TestScene.h
Normal file
@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_SCENE_H__
|
||||
#define __TEST_SCENE_H__
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Scene.h>
|
||||
#include <ewol/widget/Sizer.h>
|
||||
|
||||
class TestScene : public ewol::widget::Sizer {
|
||||
private:
|
||||
std::shared_ptr<ewol::widget::Scene> m_testWidget;
|
||||
public:
|
||||
// Constructeur
|
||||
TestScene();
|
||||
virtual ~TestScene();
|
||||
public: // Derived function
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
};
|
||||
|
||||
#endif
|
0
tools/visual_test/appl/TestSlider.cpp
Normal file
0
tools/visual_test/appl/TestSlider.cpp
Normal file
0
tools/visual_test/appl/TestSlider.h
Normal file
0
tools/visual_test/appl/TestSlider.h
Normal file
15
tools/visual_test/appl/debug.cpp
Normal file
15
tools/visual_test/appl/debug.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license GPL v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/debug.h>
|
||||
|
||||
int32_t appl::getLogId() {
|
||||
static int32_t g_val = etk::log::registerInstance("test_ewol");
|
||||
return g_val;
|
||||
}
|
52
tools/visual_test/appl/debug.h
Normal file
52
tools/visual_test/appl/debug.h
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license GPL v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __APPL_DEBUG_H__
|
||||
#define __APPL_DEBUG_H__
|
||||
|
||||
#include <etk/log.h>
|
||||
|
||||
namespace appl {
|
||||
int32_t getLogId();
|
||||
};
|
||||
// TODO : Review this problem of multiple intanciation of "std::stringbuf sb"
|
||||
#define APPL_BASE(info,data) \
|
||||
do { \
|
||||
if (info <= etk::log::getLevel(appl::getLogId())) { \
|
||||
std::stringbuf sb; \
|
||||
std::ostream tmpStream(&sb); \
|
||||
tmpStream << data; \
|
||||
etk::log::logStream(appl::getLogId(), info, __LINE__, __class__, __func__, tmpStream); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define APPL_CRITICAL(data) APPL_BASE(1, data)
|
||||
#define APPL_ERROR(data) APPL_BASE(2, data)
|
||||
#define APPL_WARNING(data) APPL_BASE(3, data)
|
||||
#ifdef DEBUG
|
||||
#define APPL_INFO(data) APPL_BASE(4, data)
|
||||
#define APPL_DEBUG(data) APPL_BASE(5, data)
|
||||
#define APPL_VERBOSE(data) APPL_BASE(6, data)
|
||||
#define APPL_TODO(data) APPL_BASE(4, "TODO : " << data)
|
||||
#else
|
||||
#define APPL_INFO(data) do { } while(false)
|
||||
#define APPL_DEBUG(data) do { } while(false)
|
||||
#define APPL_VERBOSE(data) do { } while(false)
|
||||
#define APPL_TODO(data) do { } while(false)
|
||||
#endif
|
||||
|
||||
#define APPL_ASSERT(cond,data) \
|
||||
do { \
|
||||
if (!(cond)) { \
|
||||
APPL_CRITICAL(data); \
|
||||
assert(!#cond); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#endif
|
94
tools/visual_test/appl/init.cpp
Normal file
94
tools/visual_test/appl/init.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/types.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/object/Object.h>
|
||||
#include <ewol/context/Context.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/MainWindows.h>
|
||||
|
||||
class MainApplication : public ewol::context::Application {
|
||||
public:
|
||||
virtual void onCreate(ewol::Context& _context) {
|
||||
APPL_INFO(" == > CREATE ... (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ") (BEGIN)");
|
||||
for( int32_t iii=0 ; iii<_context.getCmd().size(); iii++) {
|
||||
std::string tmpppp = _context.getCmd().get(iii);
|
||||
if ( tmpppp == "-h"
|
||||
|| tmpppp == "--help") {
|
||||
APPL_INFO(" -t c-flags-file-name" );
|
||||
APPL_INFO(" -h/--help display this help" );
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
//etk::theme::setName("COLOR", "color/black/");
|
||||
etk::theme::setName("COLOR", "color/white/");
|
||||
|
||||
_context.setSize(vec2(800, 600));
|
||||
|
||||
_context.setTitle("ewol-tools-visual-test");
|
||||
|
||||
// select internal data for font ...
|
||||
_context.getFontDefault().setUseExternal(true);
|
||||
#ifdef __TARGET_OS__Android
|
||||
_context.getFontDefault().set("FreeSerif", 19);
|
||||
#else
|
||||
_context.getFontDefault().set("FreeSerif;DejaVuSansMono",14);
|
||||
#endif
|
||||
|
||||
// set the application icon ...
|
||||
_context.setIcon("DATA:icon.png");
|
||||
APPL_INFO("==> CREATE ... (END)");
|
||||
}
|
||||
|
||||
void onStart(ewol::Context& _context) {
|
||||
APPL_INFO("==> START ... (BEGIN)");
|
||||
|
||||
std::shared_ptr<appl::MainWindows> basicWindows = appl::MainWindows::create();
|
||||
if (basicWindows == nullptr) {
|
||||
APPL_ERROR("Can not allocate the basic windows");
|
||||
return;
|
||||
}
|
||||
// create the specific windows
|
||||
_context.setWindows(basicWindows);
|
||||
if (basicWindows == nullptr) {
|
||||
APPL_ERROR("Can not allocate the basic windows");
|
||||
_context.stop();
|
||||
return;
|
||||
}
|
||||
|
||||
// create the specific windows
|
||||
_context.setWindows(basicWindows);
|
||||
|
||||
APPL_INFO("==> START ... (END)");
|
||||
return;
|
||||
}
|
||||
|
||||
void onStop(ewol::Context& _context) {
|
||||
APPL_INFO("==> STOP ... (START)");
|
||||
APPL_INFO("==> STOP ... (END)");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
|
||||
* @param std IO
|
||||
* @return std IO
|
||||
*/
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
// second possibility
|
||||
return ewol::run(new MainApplication(), _argc, _argv);
|
||||
}
|
||||
|
||||
|
BIN
tools/visual_test/data/FreeSerif.ttf
Normal file
BIN
tools/visual_test/data/FreeSerif.ttf
Normal file
Binary file not shown.
BIN
tools/visual_test/data/FreeSerifBold.ttf
Normal file
BIN
tools/visual_test/data/FreeSerifBold.ttf
Normal file
Binary file not shown.
BIN
tools/visual_test/data/FreeSerifBoldItalic.ttf
Normal file
BIN
tools/visual_test/data/FreeSerifBoldItalic.ttf
Normal file
Binary file not shown.
BIN
tools/visual_test/data/FreeSerifItalic.ttf
Normal file
BIN
tools/visual_test/data/FreeSerifItalic.ttf
Normal file
Binary file not shown.
46
tools/visual_test/data/cube.obj
Normal file
46
tools/visual_test/data/cube.obj
Normal file
@ -0,0 +1,46 @@
|
||||
# Blender3D v249 OBJ File: untitled.blend
|
||||
# www.blender3d.org
|
||||
mtllib cube.mtl
|
||||
v 1.0 -1.0 -1.0
|
||||
v 1.0 -1.0 1.0
|
||||
v -1.0 -1.0 1.0
|
||||
v -1.0 -1.0 -1.0
|
||||
v 1.0 1.0 -1.0
|
||||
v 1.0 1.0 1.0
|
||||
v -1.0 1.0 1.0
|
||||
v -1.0 1.0 -1.0
|
||||
|
||||
vt 0.0 0.0
|
||||
vt 1.0 0.0
|
||||
vt 1.0 1.0
|
||||
vt 0.0 1.0
|
||||
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn -1.000000 -0.000000 -0.000000
|
||||
vn -0.000000 -0.000000 1.000000
|
||||
vn -0.000001 0.000000 1.000000
|
||||
vn 1.000000 -0.000000 0.000000
|
||||
vn 1.000000 0.000000 0.000001
|
||||
vn 0.000000 1.000000 -0.000000
|
||||
vn -0.000000 -1.000000 0.000000
|
||||
usemtl stone.png
|
||||
s off
|
||||
|
||||
f 5/1/1 1/2/1 4/3/1
|
||||
f 5/1/1 4/3/1 8/4/1
|
||||
|
||||
f 3/1/2 7/2/2 8/3/2
|
||||
f 3/1/2 8/3/2 4/4/2
|
||||
|
||||
f 2/1/3 6/2/3 3/3/3
|
||||
f 6/1/4 7/3/4 3/4/4
|
||||
|
||||
f 1/1/5 5/2/5 2/3/5
|
||||
f 5/1/6 6/3/6 2/4/6
|
||||
|
||||
f 5/1/7 8/2/7 6/3/7
|
||||
f 8/1/7 7/3/7 6/4/7
|
||||
|
||||
f 1/1/8 2/2/8 3/3/8
|
||||
f 1/1/8 3/3/8 4/4/8
|
||||
|
18
tools/visual_test/data/grass.obj
Normal file
18
tools/visual_test/data/grass.obj
Normal file
@ -0,0 +1,18 @@
|
||||
# done myself
|
||||
v 100.0 -100.0 0.0
|
||||
v 100.0 100.0 0.0
|
||||
v -100.0 100.0 0.0
|
||||
v -100.0 -100.0 0.0
|
||||
|
||||
vt 0.0 0.0
|
||||
vt 100.0 0.0
|
||||
vt 100.0 100.0
|
||||
vt 0.0 100.0
|
||||
|
||||
vn 0.000000 0.000000 1.000000
|
||||
|
||||
usemtl grass.png
|
||||
|
||||
f 1/1/1 2/2/1 3/3/1
|
||||
f 1/1/1 3/3/1 4/4/1
|
||||
|
BIN
tools/visual_test/data/grass.png
Normal file
BIN
tools/visual_test/data/grass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 532 B |
BIN
tools/visual_test/data/icon.png
Normal file
BIN
tools/visual_test/data/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.1 KiB |
BIN
tools/visual_test/data/sphere.blend
Normal file
BIN
tools/visual_test/data/sphere.blend
Normal file
Binary file not shown.
12
tools/visual_test/data/sphere.mtl
Normal file
12
tools/visual_test/data/sphere.mtl
Normal file
@ -0,0 +1,12 @@
|
||||
# Blender MTL File: 'sphere.blend'
|
||||
# Material Count: 1
|
||||
newmtl _untitled
|
||||
Ns 0
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.8 0.8 0.8
|
||||
Ks 0.8 0.8 0.8
|
||||
d 1
|
||||
illum 2
|
||||
map_Kd .
|
||||
|
||||
|
1512
tools/visual_test/data/sphere.obj
Normal file
1512
tools/visual_test/data/sphere.obj
Normal file
File diff suppressed because it is too large
Load Diff
BIN
tools/visual_test/data/sphere.png
Normal file
BIN
tools/visual_test/data/sphere.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 163 KiB |
BIN
tools/visual_test/data/stone.png
Normal file
BIN
tools/visual_test/data/stone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
BIN
tools/visual_test/data/stone2.png
Normal file
BIN
tools/visual_test/data/stone2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
Loading…
x
Reference in New Issue
Block a user