[DOC] update documentation

This commit is contained in:
Edouard DUPIN 2016-03-23 21:44:32 +01:00
parent 2cc41d2152
commit d82ea4335e
14 changed files with 515 additions and 368 deletions

View File

@ -65,7 +65,7 @@ download the software:
Compile software and test:
--------------------------
lutin ewol-test 0XX_customwidget 001_HelloWord
lutin ewol-*
Dependency packages
===================

View File

@ -14,9 +14,14 @@ This generate some restriction that you will see an overwiew in the under sectio
===User requires:===
To use ewol you need to know only C++ language. It could be usefull to know:
:** [b]Python[/b] for all build tool.
:** [b]git[/b] for all version management
:** [b]git[/b] and [b]repo[/b] for all version management.
:** [b]OpenGL-ES2[/b] if you want to create custum advenced widget.
If you just want to have an interface of the openGl just refer to the [lib[gale|Gale library]].
Ewol does not manage the Audio but it is full integrated in [lib[audio-river|River library]].
=== Architecture:===
One of the important point to know in this framwork is some of absurd things came from the multiple architecture type.
@ -24,7 +29,7 @@ I will Explain the main points:
:** IOs does [b]NOT[/b] simply support the shared object sub lib, this force ewol to be APACHE-2, and depend on some sub-library with small license restriction.
:** Android have a JAVA main, then the application main will not be used with this platform
:** Android event (keyboard, mouse, touch-screen and ...) will arrive in asynchron mode ==> need to be resynchronyse in one thread
:** Only one graphyc framework is availlable on all platform. This is OpenGL
:** Only one graphyc framework is availlable on all platform. This is OpenGL (nned check for windows phone)
:** Main interesting point is packaging of the application data:
::** Linux store it in /usr/share/applName/*
::** MacOs store it in applName.app/subFolder/*

View File

@ -7,7 +7,7 @@ EWOL, or Edn Widget OpenGl Layer, is a multi-platform library for creating graph
===Where can I use it?===
Everywhere! EWOL is cross-platform devolopped to support bases OS:
: ** Linux (X11) (mouse)
: ** Windows (mouse) (not compile anymore ==> TODO)
: ** Windows (mouse) (build on linux...)
: ** MacOs (mouse)
: ** Android (mouse + touch)
: ** IOs (touch)
@ -20,7 +20,7 @@ EWOL is [b]FREE software[/b] and [i]all sub-library are FREE and staticly linkab
That allow you to use it for every program you want, including those developing proprietary software, without any license fees or royalties.
[note]The static support is important for some platform like IOs, and this limit the external library use at some license like :
[note]The static support is important for some platform like IOs, and this limit the external library use at some license like:
:** BSD*
:** MIT
:** APPACHE-2
@ -50,36 +50,40 @@ limitations under the License.
==== Sub library: ====
===== License: =====
:** [b][lib[etk | e-tk]][/b] : APACHE-2
:** [b][lib[elog | e-log]][/b] : APACHE-2
::** [b][lib[linearmath | Linear-Math]][/b] : z-lib (subset of bullet lib)
::** [b][lib[earchive | e-Archive]][/b] : APACHE-2
:::** [b][lib[z | Z lib]][/b] : z-lib
:** [b][lib[egami | e-gami]][/b] : APACHE-2
::** [b][lib[esvg | e-svg]][/b] : APACHE-2
:::** [b][lib[agg | AGG]][/b] : BSD-like
::** [b][lib[png | libPNG]][/b] : PNG
:** [b][lib[portaudio | portaudio]][/b] : MIT
:** [b][lib[ogg | ogg]][/b] : BSD-like
:** [b][lib[freetype | Free-Type]][/b] : BSD-like
:** [b][lib[ejson | e-json]][/b] : APACHE-2
:** [b][lib[exml | e-xml]][/b] : APACHE-2
:** [b][lib[audio | audio]][/b] : APACHE-2
:** [b][lib[audio-orchestra | orchestra]][/b] : APACHE-2
:** [b][lib[audio-river | river]][/b] : APACHE-2
...
==== Description : ====
===== Internal: =====
:** [b][lib[elog | e-log]][/b] : Generic Log interface (for Android and MacOs) ...
:** [b][lib[etk | e-tk]][/b] : Generic toolkit to acces on file, standardize acces on string (for Android and MacOs) ...
:** [b][lib[earchive | e-Archive]][/b] : Generic access to a zip file (used to access on file on Android)
:** [b][lib[eggami | e-gami]][/b] : generic image accessor for PNG, svg and bmp image (might add some other type ...)
:** [b][lib[esvg | e-svg]][/b] : Generic SVG image parser and displayer
:** [b][lib[ejson | e-json]][/b] : JSON file access (read and write)
:** [b][lib[exml | e-xml]][/b] : XML file access (read and write)
:** [b][lib[ege | e-ge]][/b] : (library in BSDv3) Ewol Game engine is a wrapper on the the bullet physical engine and ewol renderer engin. this is in developpement for now (the simple objective is to produce game to make profitable all my work)
:** [b][lib[ege | e-ge]][/b] : (library in BSDv3) Ewol Game engine is a wrapper on the the bullet physical engine and ewol renderer engin. This is in developpement for now (the simple objective is to produce game to make profitable all my work)
===== External: =====
:** [b][lib[linearmath | Linear-Math]][/b] : bullet mathamatical sub lib (for using same vec3).
:** [b][lib[z | Z lib]][/b] : Clkassical zlib lib.
:** [b][lib[agg | AGG]][/b] : A c++ drawing lib.
:** [b][lib[png | libPNG]][/b] : the classical png display lib.
:** [b][lib[portaudio | portaudio]][/b] : The classical audio wrapper lib.
:** [b][lib[portaudio | portaudio]][/b] : The classical audio wrapper lib. (not used anymore)
:** [b][lib[ogg | ogg]][/b] : The classical Ogg coder reader lib.
:** [b][lib[freetype | Free-Type]][/b] : The classicle true-type reader lib.
:** [b][lib[bullet | bullet]][/b] : the classical bullet library physical engine. (dependence by ege)

View File

@ -5,34 +5,74 @@ __________________________________________________
All developpement software will start by getting the dependency and the sources.
=== Linux dependency packages ===
==== Ubuntu or Debian ====
[code style=shell]
sudo apt-get install g++ libgl1-mesa-dev zlib1g-dev libasound2-dev
# if you want to compile with clang :
# Compile with Clang:
sudo apt-get install clang
# For andoid compilation (jdk 7 does not work...)
# For andoid compilation (jdk 7 does not work...):
sudo apt-get install javacc openjdk-6-jdk
# if you want to compile for windows :
sudo apt-get install mingw32
# on 64 bits processor for compatibility
# Cross compile for windows:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-mingw-w64
# On 64 bits processor for compatibility:
sudo apt-get install ia32-libs
sudo apt-get install g++-multilib libc6-dev-i386
[/code]
==== Arch-linux ====
[code style=shell]
# Cross compile for windows:
pacman -S mingw-w64-gcc
# Cross compile for Android:
in /etc/pacman.conf file uncomment:
[multilib]
Include = /etc/pacman.d/mirrorlist
# update the system:
Pacman -Syu
# install lib C:
pacman -S lib32-glibc lib32-zlib lib32-gcc-libs
# install open-jdk 7.0
pacman -S jdk7-openjdk
# connect adb: (and you can do a "android/sdk/platform-tools/adb shell" to enable computer key on device)
pacman -S android-udev
[/code]
=== Download instructions ===
Download the software :
==== download Build system: ====
[code style=shell]
# create a working directory path
mkdir your_workspace_path
cd your_workspace_path
# clone ewol and all sub-library
git clone git://github.com/HeeroYui/ewol.git
cd ewol
git submodule init
git submodule update
cd ..
# clone the exemple repository
git clone git://github.com/HeeroYui/example.git
sudo pip install lutin
sudo pip install pillow
[/code]
==== need google repo: ====
see: http://source.android.com/source/downloading.html#installing-repo
[code style=shell]
mkdir ~/.bin
PATH=~/.bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo
chmod a+x ~/.bin/repo
[/code]
==== download the software: ====
[code style=shell]
mkdir WORKING_DIRECTORY
cd WORKING_DIRECTORY
repo init -u git://github.com/atria-soft/manifest.git
repo sync -j8
[/code]
==== Compile software and test: ====
[code style=shell]
lutin ewol-*
[/code]
[note]
@ -43,68 +83,60 @@ The full build tool documentation is availlable here : [[http://heeroyui.github.
Compile software in debug for the curent platform :
[code style=shell]
./ewol/build/lutin.py -mdebug
lutin -mdebug
[/code]
You can specify the platform with:
[code style=shell]
./ewol/build/lutin.py -tAndroid -mdebug
lutin -tAndroid -mdebug
[/code]
It coud be usefull to disable the package generation in local debug :
It coud be usefull to disable the package generation in local debug:
[code style=shell]
./ewol/build/lutin.py -mdebug -p
lutin -mdebug -p
[/code]
Build with clang instead of gcc:
[code style=shell]
./ewol/build/lutin.py -C -cclang
lutin -cclang
[/code]
Display the build in color :
[code style=shell]
./ewol/build/lutin.py -C -mdebug -p
lutin -C -mdebug -p
[/code]
Build in realease and install the program named 'edn'
Build in realease and install the program named 'ewol-sample-HelloWord'. Note the install will install it in user mode in the ~/.local/application/ in a stand-alone mode
[code style=shell]
./ewol/build/lutin.py -C edn-install
lutin -C ewol-sample-HelloWord?install
#or
lutin -C ewol-sample-HelloWord@install
[/code]
To run an application you will find it directly on the out 'staging' tree :
To run an application you will find it directly on the out 'staging' tree or execute the command:
[code style=shell]
./out/Linux/debug/staging/clang/edn/usr/bin/edn
lutin -C ewol-sample-HelloWord@run
#or (with better log level
lutin -C ewol-sample-HelloWord@run:--elog-level=5
# or specify the lib
lutin -C ewol-sample-HelloWord@run:--elog-lib=etk:6
[/code]
== Simple explanation : ==
The workspace is a simple folder that contain all the modules ans sub module.
The workspace is a simple folder that contain all the modules ans sub module availlable for build.
It will create a tree like this :
:** workspace
::** ewol
:::** external [i](ewol external dependency sub-lib)[/i]
::::** agg
::::** bullet
::::** date
::::** egami
::::** ege
::::** ejson
::::** etk
::::** exml
::::** freetype
::::** glew
::::** lua
::::** ogg
::::** png
::::** portaudio
::::** z
:::** souces
::::** ewol
::** example
::** youApplication_1
::** youApplication_2
::** youOtherLib_1
::** youOtherLib_2
::** out
::** application
:::** Application clone application area.
::** framework
:::** atria-soft
::::** Graphic interface
:::** generic-library
::::** common untuch library (just wrap in lutin mode)
:::** HeeroYui
::::** unstable stuff
:::** musicdsp
::::** Common library for audio interfacing
:::** tools

View File

@ -9,9 +9,9 @@
A generic Ewol application is manage by creating an [class[ewol::context::Application]] that is the basis of your application.
Due to the fact the ewol library is a multi-platform framework, you will have many contraint like:
:** One application at the same time
:** One Windows displayable at the time
Due to the fact the ewol library is a multi-platform framework (base on [lib[gale|Gale]]), you will have many contraint like:
:** One application at the same time (note an exception for android wallpaper)
:** One Windows displayable at the time (main point of view of apple developpers)
:** Not a big CPU ...
Then we will create the application:
@ -20,16 +20,35 @@ Then we will create the application:
namespace appl {
class MainApplication : public ewol::context::Application {
public:
bool init(ewol::Context& _context, size_t _initId) {
APPL_INFO("==> Init APPL (START)");
void onCreate(ewol::Context& _context) override {
APPL_INFO("==> CREATE ... " PROJECT_NAME " (BEGIN)");
// nothing to do ...
APPL_INFO("==> Init APPL (END)");
return true;
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
}
void unInit(ewol::Context& _context) {
APPL_INFO("==> Un-Init APPL (START)");
void onStart(ewol::Context& _context) override {
APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
// nothing to do ...
APPL_INFO("==> Un-Init APPL (END)");
APPL_INFO("==> START ... " PROJECT_NAME " (END)");
}
void onResume(ewol::Context& _context) override {
APPL_INFO("==> RESUME ... " PROJECT_NAME " (BEGIN)");
// nothing to do ...
APPL_INFO("==> RESUME ... " PROJECT_NAME " (END)");
}
void onPause(ewol::Context& _context) override {
APPL_INFO("==> PAUSE ... " PROJECT_NAME " (BEGIN)");
// nothing to do ...
APPL_INFO("==> PAUSE ... " PROJECT_NAME " (END)");
}
void onStop(ewol::Context& _context) override {
APPL_INFO("==> STOP ... " PROJECT_NAME " (START)");
// nothing to do ...
APPL_INFO("==> STOP ... " PROJECT_NAME " (END)");
}
void onDestroy(ewol::Context& _context) override {
APPL_INFO("==> DESTROY ... " PROJECT_NAME " (START)");
// nothing to do ...
APPL_INFO("==> DESTROY ... " PROJECT_NAME " (END)");
}
};
};
@ -85,28 +104,31 @@ We select an order to search the font names and the system basic size.
Create the main Windows:
For this point we will create a class that herited form the basic [class[ewol::wiget::Windows]] class:
For this point we will create a class that herited form the basic [class[ewol::widget::Windows]] class:
[b]Windows.h[/b]
[code style=c++]
#ifndef __APPL_WINDOWS_H__
#define __APPL_WINDOWS_H__
#pragma once
#include <ewol/widget/Windows.h>
namespace appl {
class Windows;
using WindowsShared = ememory::SharedPtr<appl::Windows>;
using WindowsWeak = ememory::WeakPtr<appl::Windows>;
class Windows : public ewol::widget::Windows {
protected:
Windows(void);
init()
init();
public:
DECLARE_FACTORY(Windows);
virtual ~Windows(void) {};
};
};
#endif
[/code]
The C macro "DECLARE_FACTORY" create a simple factory function "create" that return the [class[ewol::Object]] well create.
For some internal reason, we create the object and we call the "init" function after creating the object. When well done we return the shared object created.
See [tutorial[010_ObjectModel | Next: Object model]] to understand why this structure is so complex.
[b]Windows.cpp[/b]
@ -119,40 +141,42 @@ See [tutorial[010_ObjectModel | Next: Object model]] to understand why this stru
#undef __class__
#define __class__ "Windows"
appl::Windows::Windows(void) {
// To simplify log (if you have a better solution, I am aware)
appl::Windows::Windows() {
addObjectType("appl::Windows");
propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME);
}
appl::Windows::init(void) {
void appl::Windows::init() {
ewol::widget::Windows::init();
setTitle("example 001_HelloWord");
std::shared_ptr<ewol::widget::Label> tmpWidget = ewol::widget::Label::create();
if (NULL == tmpWidget) {
ewol::widget::LabelShared tmpWidget = ewol::widget::Label::create();
if (tmpWidget == nullptr) {
APPL_ERROR("Can not allocate widget ==> display might be in error");
} else {
tmpWidget->setLabel("Hello <font color='blue'>Word</font>");
tmpWidget->setExpand(bvec2(true,true));
tmpWidget->propertyValue.set("Hello <font color='blue'>World</font>");
tmpWidget->propertyExpand.set(bvec2(true,true));
setSubWidget(tmpWidget);
}
}
[/code]
The init function can not be virtual due to his polymorphic status, then we need to call parrent init
The init function is virtual and you must call your parent object (or at least the [class[ewol::Object]] init)
[code style=c++]
ewol::widget::Windows::init();
[/code]
The fist basic property to set is the Title:
The title is assiciated on the current windows then it is a simple [class[ewol::widget::Windows]] property.
Please use the "setDirectCheck" fucntion instead of "set" function when you are in the constructor (the callback can be unstable when we construct the object)
[code style=c++]
setTitle("example 001_HelloWord");
propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME);
[/code]
After we simple create a [class[widget::Label]] in the main windows constructor.
And we set the widget property (label).
The object [class[ewol::widget::Windows]] is a simple container. But the reference between Object is shared_ptr, and this is not accessible in the constructor. This is the reason we use init function.
After we simple create a [class[widget::Label]] in the main windows init.
We set label and basic properties:
[code style=c++]
std::shared_ptr<ewol::widget::Label> tmpWidget = ewol::widget::Label::create();
tmpWidget->setLabel("Hello <font color='blue'>Word</font>");
tmpWidget->setExpand(bvec2(true,true));
tmpWidget->propertyValue.set("Hello <font color='blue'>World</font>");
tmpWidget->propertyExpand.set(bvec2(true,true));
[/code]
We can see in this example that the label have some other property like the font color.
@ -175,27 +199,27 @@ but it support to:
:** replace '"' with ''' to simplify xml writing in C code.
[/note]
The last step is to add the widget on the windows :
The last step is to add the widget on the windows:
[code style=c++]
setSubWidget(tmpWidget);
[/code]
When we call this function, it use the shard_from_this() function that create an exception if we are in constructor
When we call this function, it use the shared_from_this() function that create an exception if we are in constructor (when setting the wub-widget parrent)
==== Configure Ewol to have display the windows ====
At this point we have created the basic windows.
But the system does not know it.
Then we create windows and set it in the main contect main (in the MainApplication::init()):
Then we create windows and set it in the main context main (in the appl::MainApplication::init()):
[code style=c++]
std::shared_ptr<ewol::Windows> basicWindows = appl::Windows::create());
ewol::WindowsShared basicWindows = appl::Windows::create());
// create the specific windows
_context.setWindows(basicWindows);
[/code]
Her we call the create function that is created by the DECLARE_FACTORY macro
Here we call the create function that is created by the DECLARE_FACTORY macro
Then the init fuction is :
Then the init fuction is:
[code style=c++]
bool MainApplication::init(ewol::Context& _context, size_t _initId) {
APPL_INFO("==> Init APPL (START)");
@ -203,7 +227,7 @@ bool MainApplication::init(ewol::Context& _context, size_t _initId) {
_context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
std::shared_ptr<ewol::Windows> basicWindows = appl::Windows::create();
ewol::WindowsShared basicWindows = appl::Windows::create();
// create the specific windows
_context.setWindows(basicWindows);
APPL_INFO("==> Init APPL (END)");
@ -211,56 +235,60 @@ bool MainApplication::init(ewol::Context& _context, size_t _initId) {
}
[/code]
To un-init the application, the context call a generic function [b]MainApplication::unInit[/b].
In this function we just need to remove the windows and un-init all needed by the system.
[code style=c++]
void MainApplication::unInit(ewol::Context& _context) {
APPL_INFO("==> Un-Init APPL (START)");
// Windows is auto-removed just before
APPL_INFO("==> Un-Init APPL (END)");
}
[/code]
[note]
You can use many windows and select the one you want to display, but I do not think it is the best design.
[/note]
=== Build declaration: ===
ewol commonly use the [b]lutin.py[/b] build system.
ewol commonly use the [b]lutin[/b] build system.
Then we need to add a "lutin_YourApplicationName.py", then for this example: [b]lutin_001_HelloWord.py[/b]
Then we need to add a "lutin_YourApplicationName.py", then for this example: [b]lutin_ewol-sample-HelloWord.py[/b]
[code style=python]
#!/usr/bin/python
import lutinModule as module
import lutinTools as tools
import lutin.module as module
import lutin.tools as tools
def get_type():
return "BINARY"
def get_sub_type():
return "SAMPLE"
# optionnal : Describe in the "lutin.py --help"
def get_desc():
return "Tutorial 001 : Hello Word"
# Module creation instance (not optionnal)
def create(target):
# module name is '001_HelloWord' and type binary.
myModule = module.Module(__file__, '001_HelloWord', 'BINARY')
# add the file to compile:
myModule.add_src_file([
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 get_version():
return [0,1]
def create(target, module_name):
my_module = module.Module(__file__, module_name, get_type())
my_module.add_src_file([
'appl/Main.cpp',
'appl/debug.cpp',
'appl/Windows.cpp',
])
# add Library dependency name
myModule.add_module_depend(['ewol'])
# add application C flags
myModule.compile_flags_CC([
"-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""])
# Add current include Path
myModule.add_path(tools.get_current_path(__file__))
return the created module
return myModule
my_module.add_module_depend(['ewol'])
my_module.compile_flags('c++', [
"-DPROJECT_NAME=\"\\\""+my_module.name+"\\\"\"",
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\""
])
my_module.add_path(tools.get_current_path(__file__))
return my_module
[/code]
show lutin doc for more information...
@ -273,49 +301,14 @@ I do not explain again the lutin file, for next tutorial, show example sources .
Go to your workspace folder and launch
[code style=shell]
./ewol/build/lutin.py -C -mdebug 001_HelloWord
lutin -C -mdebug ewol-sample-HelloWord
# or
lutin -C -mdebug ewol-sample-HelloWord?build
[/code]
Your program example will build correctly...
Launch it :
[code style=shell]
./out/Linux/debug/staging/gcc/001_HelloWord/usr/bin/001_HelloWord -l6
lutin -C -mdebug ewol-sample-HelloWord?run
[/code]
The [b]-l6[/b] is used to specify the Log level of the application display (this log is synchronous)
The output compile in a separate folder depending on the compilation tool (gcc or clang)
It create a complete final tree in the ./out/Linux/debug/staging/gcc/001_HelloWord/ folder
The final folder contain the package generated:
:** out
::** MacOs
::** Android
::** Windows
::** ...
::** Linux
:::** release
:::** debug
::::** build
:::::** clang
:::::** gcc
::::::** ewol
::::::** exml
::::::** ejson
::::::** 001_HelloWord
::::::** ...
::::** staging
:::::** clang
:::::** gcc
::::::** 001_HelloWord
:::::::** usr
::::::::** bin
::::::::** share
::::** final
:::::** 001_HelloWord.deb

View File

@ -5,7 +5,7 @@
== Basis of the ewol::Object ==
An object in Ewol is a simple class : [class[ewol::Object]] This object is the basis of all element in the ewol system.
An object in Ewol is a simple class: [class[ewol::Object]] This object is the basis of all element in the ewol system.
This is designed to manage many common things:
:** Unique ID
@ -14,7 +14,6 @@ This is designed to manage many common things:
:** Signal generation
:** Xml configuration
:** Removing
:** Perodic calling
[note]
Please do not compare with the gObject basic class...
@ -26,18 +25,23 @@ Please do not compare with the gObject basic class...
Creating an object is really simple:
[code style=c++]
std::shared_ptr<ewol::Button> tmpButon = ewol::Button::create();
APPL_INFO("We just create a button widget with unique ID=" << tmpButon->getId() << " name='" << tmpButon->getName() << "'");
ewol::widget::ButtonShared tmpButon = ewol::widget::Button::create();
APPL_INFO("We just create a button widget with unique ID=" << tmpButon->getId() << " name='" << tmpButon->propertyName.get() << "'");
[/code]
Note that all object created are std::shared_ptr.
Note that all object created are [class[ememory::SharedPtr]] base for the current version on [class[std::shared_ptr]].
We wrapped it because the current inplementation of [class[std::shared_ptr]] is not thread safe, and we want use a thread-safe vertion of it.
[note]
The widget is not stored in a ememory::SharedPtr<ewol::widget::Button> but in a ewol::widget::ButtonShared to simplify the using of the pointer.
You have also: ememory::WeakPtr<ewol::widget::Button> = ewol::widget::ButtonWeak
[/note]
Set the name of the object:
[code style=c++]
tmpButon->setName("my widget name");
APPL_INFO("We just create an Object with ID=" << tmpButon->getId() << " name='" << tmpButon->getName() << "'");
tmpButon->propertyName.set("my widget name");
APPL_INFO("We just create an Object with ID=" << tmpButon->getId() << " name='" << tmpButon->propertyName.get() << "'");
[/code]
@ -48,13 +52,13 @@ Simply use the function:
tmpButon->destroy();
[/code]
This function request his parrent to remove the std::shared_ptr it keep on it.
This function request his parrent to remove the [class[ememory::SharedPtr]] it keep on it.
And when all std::shared_ptr is removed the object will be really removed.
At his point we can think an object is allive all the time someone keep a reference on it, then when you are not a parrent of the object, do not keep a std::shared_ptr but a std::weak_ptr.
At his point we can think an object is allive all the time someone keep a reference on it, then when you are not a parrent of the object, do not keep a [class[ememory::SharedPtr]] but a [class[ememory::WeakPtr]].
[note]
If some Object is not removed when you close the application, the system inform you with displaying all object already alive.
If some Object is not removed when you close the application, the system inform you with displaying all object alive.
[/note]
@ -67,8 +71,8 @@ In Ewol this is possible to get a object with his name.
[code style=c++]
#include <ewol/context/Context.h>
std::shared_ptr<ewol::Object> tmpObject = ewol::getContext().getEObjectManager().getObjectNamed("obj Name");
if (tmpObject == NULL) {
ewol::ObjectShared tmpObject = ewol::getContext().getEObjectManager().getObjectNamed("obj Name");
if (tmpObject == nullptr) {
APPL_ERROR("The Object does not exist");
}
[/code]
@ -76,8 +80,8 @@ In Ewol this is possible to get a object with his name.
=== Find a global Object (inside an Object) ===
[code style=c++]
std::shared_ptr<ewol::Object> tmpObject = getObjectNamed("obj Name");
if (tmpObject == NULL) {
ewol::ObjectShared tmpObject = getObjectNamed("obj Name");
if (tmpObject == nullptr) {
APPL_ERROR("The Object does not exist");
}
[/code]
@ -85,7 +89,7 @@ In Ewol this is possible to get a object with his name.
=== Find a sub-object ===
[code style=c++]
std::shared_ptr<ewol::Object> tmpObject = getSubObjectNamed("obj Name");
ewol::ObjectShared tmpObject = getSubObjectNamed("obj Name");
if (tmpObject == NULL) {
APPL_ERROR("The Object does not exist");
}
@ -96,13 +100,8 @@ In Ewol this is possible to get a object with his name.
It could be really interesting to retrive your own instance:
[code style=c++]
std::shared_ptr<ewol::Object> tmpObject ...;
ewol::ObjectShared tmpObject ...;
std::shared_ptr<appl::MyOwnObject> myObject = std::dynamic_pointer_cast<appl::MyOwnObject>(tmpObject);
appl::MyOwnObjectShared myObject = std::dynamic_pointer_cast<appl::MyOwnObject>(tmpObject);
[/code]
== conclusion ==
TODO ...

View File

@ -1,16 +1,16 @@
=== Objectif ===
:** Understand ewol::Object configuration parameter
:** Understand base of [lib[eproperty]] configuration parameter
:** Create an configurable object
== Configuration using ==
All [class[ewol::Object]] have a configuration of parameters (the object name is a parameter), Then we need to set get and use xml to update parameters.
=== Set a Parameter ===
=== Set a Parameter/Property ===
[note]
Using getter and setter is really better, and faster.
Parameter is managed by the [lib[eproperty|e-property library]]
[/note]
==== With a string configuration ====
@ -42,35 +42,28 @@ All [class[ewol::Object]] have a configuration of parameters (the object name is
#include <ewol/object/Object.h>
namespace appl {
class MyObj : public ewol::Object {
public:
eproperty::Value<bool> propertyValue; //!< Property interface (all time start with "property")
protected:
//! @brief Constructor
MyObj(void) :
m_value(*this, "value", false, "Value of the parameter (descrition string)") {
propertyValue(this, "value",
false,
"Value of the parameter (descrition string)",
&appl::MyObj::onChangeParameterValue) {
// nothing to do..
}
void init() {
ewol::Object::init();
// do some stuff with the init value
}
public:
//! @brief Destructor
virtual ~MyObj(void) { }
DECLARE_FACTORY(MyObj);
private:
ewol::object::Param<bool> m_value; //!< Internal Object value
public:
//! @brief Setter
void setValue(bool _val) {
m_value.set(_val);
}
//! @brief Getter
bool getValue() const {
return m_value.get();
}
public: // herited function:
void onParameterChangeValue(const ewol::object::ParameterRef& _paramPointer) {
if (_paramPointer == m_value) {
APPL_DEBUG("The internal value has change, new value is : '" << m_value.get() << "'");
}
void onChangeParameterValue() {
APPL_DEBUG("The internal value has change, new value is : '" << *m_value << "'");
}
}
}
@ -80,19 +73,19 @@ In the contructor we need to add:
[code style=c++]
m_value(*this, "value", false, "Value of the parameter (descrition string)")
[/code]
:** [b]'*this':[/b] Reference the main class to call it chen value change.
:** [b]'this':[/b] Pointer the main class to call it chen value change.
:** [b]"value":[/b] Is the name of the parameter.
:** [b]false:[/b] The default value.
:** [b]"....."[/b] Description of the parameter (optionnal).
:** [b]&appl::MyObj::onChangeParameterValue[/b] The callback when the value change (optionnal).
The function [b]onParameterChangeValue[/b] is called only the parameter change (no historic has been registered)
The last point is that the m_value.get() is an inline fuction then it take no more CPU cycle to access the value than normal variable.
The last point is that the *m_value is an inline fuction then it take no more CPU cycle to access the value than normal variable.
Some other parameter are availlable :
:** ewol::object::Param<T> Basic parameter.
:** ewol::object::ParamRange<T> For numeric parameter that range value are check befor setting new value.
:** ewol::object::ParamList<T> For List of parameter values.
:** eproperty::Value<T> Basic parameter.
:** eproperty::Range<T> For numeric parameter that range value are check befor setting new value.
:** eproperty::List<T> For List of parameter values.
For more information see [lib[eproperty]]

View File

@ -1,33 +1,29 @@
=== Objectif ===
:** Understand ewol::Object Messaging system
:** Understand base of [lib[esignal]] Messaging system
:** Create extern message and receive Object message
== Message system ==
Message system is based on generic std::funtion and std::bind methode:
esignal base his signal on landa functions
It permit to an object to generate some [b]'signals'[/b].
All signal are synchronous
All signal are synchronous [i](asynchronous is not implemented yet)[/i]
== Receive signals from other object ==
[todo]
Link with the signal name
[/todo]
Register on the 'up' and 'value' signal of a button:
Button header :
[code style=c++]
...
public:
ewol::object::Signal<void> signalDown;
ewol::object::Signal<void> signalUp;
esignal::ISignal<> signalDown;
esignal::ISignal<> signalUp;
...
ewol::object::Signal<bool> signalValue;
esignal::ISignal<bool> signalValue;
...
[/code]
@ -39,10 +35,11 @@ Button header :
namespace appl {
class MyObj : public ewol::Object {
private:
std::shared_ptr<ewol::widget::Button> m_button;
ewol::widget::ButtonShared m_button;
esignal::Connection m_connect;
protected:
//! @brief Constructor
MyObj(void) {
MyObj() {
// nothing to do..
}
void init() {
@ -52,75 +49,43 @@ namespace appl {
APPL_ERROR("Can not create button...");
return;
}
// We connect signals here :
m_button->signalUp.bind(shared_from_this(), &appl::MyObj::onCallbackUp);
m_button->signalValue.bind(shared_from_this(), &appl::MyObj::onCallbackValue);
m_button.propertyToggle.set(true);
// We connect signals here: (permanent connection)
m_button->signalUp.connect(shared_from_this(), &appl::MyObj::onCallbackUp);
m_button->signalValue.connect(shared_from_this(), &appl::MyObj::onCallbackValue);
}
public:
//! @brief Destructor
virtual ~MyObj(void) { }
virtual ~MyObj() { }
DECLARE_FACTORY(MyObj);
private:
void onCallbackUp() {
APPL_INFO("button pressed: UP);
APPL_INFO("button pressed: UP");
}
void onCallbackDown() {
APPL_INFO("button pressed: DOWN");
}
void onCallbackValue(const bool& _value) {
APPL_INFO("button value: " << _value);
}
}
}
[/code]
=== Advenced signal connection: ===
Here we will see how to connect an advance function on a signal
[code style=c++]
#include <ewol/object/Object.h>
#include <ewol/widget/Button.h>
namespace appl {
class MyObj : public ewol::Object {
private:
std::shared_ptr<ewol::widget::Button> m_button;
protected:
//! @brief Constructor
MyObj(void) {
// nothing to do..
}
void init() {
ewol::Object::init();
m_button = ewol::widget::Button::Create();
if (m_button == nullptr) {
APPL_ERROR("Can not create button...");
return;
if (_value == true) {
// We connect signals here: (removable connection)
m_connect = m_button->signalDown.connect(this, &appl::MyObj::onCallbackDown);
} else {
// we disconnect the previous connection
m_connect.disconnect();
}
// We connect signals here :
m_button->signalUp.register(shared_from_this(), std::bind(&appl::MyObj::onCallbackUp, this, std::string("tmpVariableToSend")));
m_button->signalValue.register(shared_from_this(), std::bind(&appl::MyObj::onCallbackValue, this));
}
public:
//! @brief Destructor
virtual ~MyObj(void) { }
DECLARE_FACTORY(MyObj);
private:
void onCallbackUp(const std::string& _value) {
APPL_INFO("button pressed: UP inputMessage: " << _value);
}
void onCallbackValue() {
APPL_INFO("button value: " << _value);
}
}
}
[/code]
=== Connect to a signal with a named widget ===
TODO: documentation :
:** subBind(_type, _name, _event, _obj, _func)
:** globalBind(_type, _name, _event, _obj, _func)
:** externSubBind(_object, _type, _name, _event, _obj, _func)
[note]
The connection with SharedPtr are static. they keep in internal a WeakPtr to remove connection if the object is removed.
[/note]
[note]
The connection that return a [class[esignal::Connection]] are volatil, if you don't keep the connection handle, the connection is automaticly removed.
[/note]
== Declare Signal ==
@ -132,23 +97,20 @@ TODO: documentation :
namespace appl {
class MyObj : public ewol::Object {
public:
ewol::object::Signal<void> signalEmpty;
ewol::object::Signal<> signalEmpty;
ewol::object::Signal<bool> signalBoolean;
ewol::object::Signal<std::string> signalString;
protected:
//! @brief Constructor
MyObj(void) :
signalEmpty(*this, "empty"),
signalBoolean(*this, "boolean"),
signalString(*this, "string") {
MyObj() :
signalEmpty(this, "empty"),
signalBoolean(this, "boolean"),
signalString(this, "string") {
// nothing to do..
}
void init() {
ewol::Object::init();
}
public:
//! @brief Destructor
virtual ~MyObj(void) { }
virtual ~MyObj() { }
DECLARE_FACTORY(MyObj);
private:
void process() {
@ -164,7 +126,7 @@ namespace appl {
You will now able to reise signals between objects...
For more information see [lib[esignal]]

View File

@ -7,27 +7,37 @@
Application generation is really simple, but package management can create some problems...
For example :
:** Android does not permit access on the file system, but we need data that is named assets, thes data in contained in a zip file.
:** Android does not permit access on the file system, but we need data that is named assets, these data in contained in a zip file.
:** Linux set his own application data in a special path : /usr/shared/applName/
:** MacOs create a bundle (*.app) that is a folder with all application data.
:** ...
For all tese reason we need to wrap standard application interface. (you can acces directly but it could be tricky and depend on the target)
For all these reasons we need to wrap standard application interface. (you can acces directly but it could be tricky and depend on the target)
== Generic Properties ==
By default we dertermine some basics for files.
Then we need to determine file in the tree with :
Then we need to determine file in the tree with:
:** "DATA:XXX" Application internal data
::** Linux: /usr/share/applName/
::** Android: /xxx/yyy/applName.apk/asssets/
::** IOs: applName.app/share
::** MacOs: applName.app/Resources
:** "USERDATA:XXX" User save data (like game save)
::** Linux: ~/.local/share/applName/
::** Android: /xxx/yyy/data/applName/
:** "HOME:XXX" User home folder
::** Linux: ~/
::** Android: /sdcard/
::** IOs: --- => no Home
::** MacOs: ~/
:** "/XXX" Direct acces on a file in the fileSystem
:** ...
When you will call a file, you need to just call it with the starting name.
For example if I want to acces at an application data I will call the file : "DATA:myImage.png"
For example if I want to access at an application data I will call the file : "DATA:myImage.png"
== Integrate a file in a package ==
@ -113,7 +123,7 @@ And when you want to change the theme, just call:
[/code]
[note]
This is not done automaticly, because reloading the resources can have a real cost of time.
This is not done automaticly, because reloading the resources can have a real cost of time.
[/note]
You can acces on your theme with accessing the filename: "THEME:GUI_COLOR:your/sub/path/file.xx"

View File

@ -1,11 +1,11 @@
=== Objectifs ===
:** Understand What is a resource
:** Understand what is a resource
:** Use resources
=== What is a resource: ===
A resource is an usique element that can be used by manny element like:
A resource is an unique element that can be used by many element like:
:** An image (special resolution)
:** A configuration file
:** An application manager (special case)
@ -23,25 +23,36 @@ For this example we will load a configuration file:
#include <ewol/resource/ConfigFile.h>
namespace appl {
class MyObj : public ewol::Object {
public:
eproperty::Value<std::string> propertyConfig;
private:
std::shared_ptr<ewol::resource::ConfigFile> m_config;
int32_t m_configValId;
protected:
//! @brief Constructor
MyObj(void) :
propertyConfig(this, "file",
"DATA:ExapleConfig.json",
"no desc",
&appl::MyObj::onChangePropertyFile),
m_configValId(-1) {
// nothing to do..
}
void init() {
ewol::Object::init();
m_config = ewol::resource::ConfigFile::create("DATA:ExapleConfig.json");
m_configValId = m_config->request("exampleConfigName");
onChangePropertyFile();
}
public:
//! @brief Destructor
virtual ~MyObj(void) { }
DECLARE_FACTORY(MyObj);
public:
void onChangePropertyFile() {
m_config = ewol::resource::ConfigFile::create(*propertyConfig);
if (m_config != nullptr) {
m_configValId = m_config->request("exampleConfigName");
}
}
void process() {
double value = m_config->getNumber(m_configValId);
APPL_DEBUG("example value : " << value);
@ -53,7 +64,7 @@ namespace appl {
=== Create a new resource: ===
A resource is a generic [class[ewol::Resource]] that hrited form a generic [class[ewol::Object]], simply change the FACTORY macro in :
A resource is a generic [class[ewol::Resource]] that herited form a generic [class[ewol::Object]], simply change the FACTORY macro in:
:** DECLARE_RESOURCE_FACTORY(className) To declare a resource with no name (unique for every creation)
:** DECLARE_RESOURCE_NAMED_FACTORY(className) To create a resource that have a specific name. When created, we will find the previous resource with the specify name in the fanctory.
:** DECLARE_RESOURCE_SINGLE_FACTORY(className,uniqueName) This is to have a unique resource for all the application (name is specify in the Macro)
@ -66,7 +77,7 @@ The resources can be reloaded, then we need to reaload in the good order (level
The resources are loaded fron 0 to 5.
Then for basic resource :
Then for basic resource:
[code style=c++]
#include <ewol/object/Resource.h>

View File

@ -9,16 +9,87 @@ A widget is a simple entity of a graphical Object. It herited of every [class[ew
We can consider some widget:
:** Windows: Main gui interface to display the unique "windows".
:** Container Widget: Widget that manage some subWidget (generic)
:** Simple widget: all widget that display somthing.
:** Meta widget: Widget composed with some wodget.
=== Simple load of a widget: ===
=== Simple load & configure of a widget: ===
We have 4 way to create a widget:
==== call create and configure ====
First create the widget:
[code style=c++]
ewol::widget::ButtonShared tmpWidget = ewol::widget::Button::create();
if (tmpWidget == nullptr) {
APPL_CRITICAL("The widget can not be created");
}
[/code]
Set some parameters:
[code style=c++]
tmpWidget->propertyName.set("my name");
tmpWidget->propertyExpand.set(bvec2(true,false));
tmpWidget->propertyFill.set(bvec2(true,true));
[/code]
[note]
This is the faster way to configure your gui. and the check are done when you compile your code.
[/note]
==== Call create and direct configuration ====
We can configure the wiget before the init() is called.
[code style=c++]
ewol::widget::ButtonShared tmpWidget = ewol::widget::Button::create(
"name", std::string("my name"),
"expand", bvec2(true,false),
"fill", bvec2(true,true));
if (tmpWidget == nullptr) {
APPL_CRITICAL("The widget can not be created");
}
[/code]
[note]
The configuration is done and check at the runtime ==> you need to test it to be sure your configuration work.
[/note]
==== Call generic factory system (compositing) ====
=== Create an interface with a XML form: ===
[code style=c++]
#include <ewol::widget::Composer.h>
ewol::widget::WidgetShared tmpWidget = ewol::widget::composerGenerateString("<button name='my name' expand='true,false' fill='true,true'/>");
if (tmpWidget == nullptr) {
APPL_CRITICAL("The widget can not be created");
}
[/code]
With this way you just like string ...
==== Load from a xml file (compositing) ====
File gui.xml
[code]
<button name="my name"
expand="true,false"
fill="true,true"/>
[/code]
[code style=c++]
#include <ewol::widget::Composer.h>
ewol::widget::WidgetShared tmpWidget = ewol::widget::composerGenerateFile("DATA:gui.xml");
if (tmpWidget == nullptr) {
APPL_CRITICAL("The widget can not be created");
}
[/code]
This last way is just to simplify gui generation
=== Create in C++ the interface: ===
=== Now we will create a simple hierarchic gui ===
The objective is to create a text label area with 2 button centered.

View File

@ -1,6 +1,7 @@
#!/usr/bin/python
import monkModule
import monkTools as tools
import os
def get_desc():
return "EWOL main library (Edn Widget on OpenGl Layer)"
@ -9,10 +10,10 @@ def create():
# module name is 'ewol' and type binary.
myModule = monkModule.Module(__file__, 'ewol', 'LIBRARY')
# enable doculentation :
myModule.set_website("http://heeroyui.github.io/ewol/")
myModule.set_website_sources("http://github.com/heeroyui/ewol/")
myModule.set_path(tools.get_current_path(__file__) + "/ewol/")
myModule.set_path_general_doc(tools.get_current_path(__file__) + "/../doc/")
myModule.set_website("http://atria-soft.github.io/ewol/")
myModule.set_website_sources("http://github.com/atria-soft/ewol/")
myModule.set_path(os.path.join(tools.get_current_path(__file__), "ewol"))
myModule.set_path_general_doc(os.path.join(tools.get_current_path(__file__), "doc"))
# add the currrent module at the
return myModule

View File

@ -17,43 +17,44 @@
#include <ewol/widget/Manager.h>
#include <ewol/context/Context.h>
class MainApplication : public ewol::context::Application {
public:
void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (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(" -h/--help display this help" );
exit(0);
namespace appl {
class MainApplication : public ewol::context::Application {
public:
void onCreate(ewol::Context& _context) override {
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (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(" -h/--help display this help" );
exit(0);
}
}
// TODO : Remove this : Move if in the windows properties
_context.setSize(vec2(800, 600));
// select internal data for font ...
_context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
ewol::widget::WindowsShared basicWindows = appl::Windows::create();
// create the specific windows
_context.setWindows(basicWindows);
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
}
// TODO : Remove this : Move if in the windows properties
_context.setSize(vec2(800, 600));
// select internal data for font ...
_context.getFontDefault().setUseExternal(true);
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
ewol::widget::WindowsShared basicWindows = appl::Windows::create();
// create the specific windows
_context.setWindows(basicWindows);
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
}
void onStart(ewol::Context& _context) override {
APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
// nothing to do ...
APPL_INFO("==> START ... " PROJECT_NAME " (END)");
}
void onStop(ewol::Context& _context) override {
APPL_INFO("==> STOP ... " PROJECT_NAME " (START)");
// nothing to do ...
APPL_INFO("==> STOP ... " PROJECT_NAME " (END)");
}
};
void onStart(ewol::Context& _context) override {
APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
// nothing to do ...
APPL_INFO("==> START ... " PROJECT_NAME " (END)");
}
void onStop(ewol::Context& _context) override {
APPL_INFO("==> STOP ... " PROJECT_NAME " (START)");
// nothing to do ...
APPL_INFO("==> STOP ... " PROJECT_NAME " (END)");
}
};
}
/**
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
@ -62,7 +63,7 @@ class MainApplication : public ewol::context::Application {
*/
int main(int _argc, const char *_argv[]) {
// second possibility
return ewol::run(new MainApplication(), _argc, _argv);
return ewol::run(new appl::MainApplication(), _argc, _argv);
}

View File

@ -250,8 +250,73 @@ void appl::MainWindows::updateProperty() {
});
m_listConnection.push_back(std::move(conn));
} else if (type == typeid(gale::Dimension).name()) {
type = "gale::Dimension";
addSpacer(widgetSizer);
ewol::widget::SpinShared widgetTmp = ewol::widget::Spin::create();
widgetSizer->subWidgetAdd(widgetTmp);
eproperty::Value<gale::Dimension>* paramValue = dynamic_cast<eproperty::Value<gale::Dimension>*>(param);
if (paramValue == nullptr) {
APPL_ERROR("nullptr... 2 ");
return;
}
gale::Dimension value = paramValue->get();
widgetTmp->propertyMantis.set(3);
widgetTmp->propertyValue.set(value.get(value.getType()).x()*1000);
esignal::Connection conn = widgetTmp->signalValueDouble.connect(
[=](const double& _value) {
APPL_INFO("set parameter : X name=" << param->getName() << " value=" << _value);
gale::Dimension lastValueInterpreted = paramValue->get();
vec2 val = lastValueInterpreted.get(lastValueInterpreted.getType());
val.setX(_value);
lastValueInterpreted.set(val, lastValueInterpreted.getType());
paramValue->set(lastValueInterpreted);
return;
});
m_listConnection.push_back(std::move(conn));
ewol::widget::LabelShared widgetLabel = ewol::widget::Label::create();
widgetLabel->propertyValue.set("x");
widgetSizer->subWidgetAdd(widgetLabel);
widgetTmp = ewol::widget::Spin::create();
widgetSizer->subWidgetAdd(widgetTmp);
widgetTmp->propertyValue.set(value.get(value.getType()).y()*1000);
widgetTmp->propertyMantis.set(3);
conn = widgetTmp->signalValueDouble.connect(
[=](const double& _value) {
APPL_INFO("set parameter : Y name=" << param->getName() << " value=" << _value);
gale::Dimension lastValueInterpreted = paramValue->get();
vec2 val = lastValueInterpreted.get(lastValueInterpreted.getType());
val.setY(_value);
lastValueInterpreted.set(val, lastValueInterpreted.getType());
paramValue->set(lastValueInterpreted);
return;
});
m_listConnection.push_back(std::move(conn));
widgetLabel = ewol::widget::Label::create();
widgetLabel->propertyValue.set("y");
widgetSizer->subWidgetAdd(widgetLabel);
ewol::widget::SelectShared widgetSelectTmp = ewol::widget::Select::create();
widgetSizer->subWidgetAdd(widgetSelectTmp);
widgetSelectTmp->propertyExpand.set(bvec2(true,false));
widgetSelectTmp->propertyFill.set(bvec2(true,false));
widgetSelectTmp->optionAdd(gale::Dimension::Pourcent, "Pourcent");
widgetSelectTmp->optionAdd(gale::Dimension::Pixel, "Pixel");
widgetSelectTmp->optionAdd(gale::Dimension::Meter, "Meter");
widgetSelectTmp->optionAdd(gale::Dimension::Centimeter, "Centimeter");
widgetSelectTmp->optionAdd(gale::Dimension::Millimeter, "Millimeter");
widgetSelectTmp->optionAdd(gale::Dimension::Kilometer, "Kilometer");
widgetSelectTmp->optionAdd(gale::Dimension::Inch, "Inch");
widgetSelectTmp->optionAdd(gale::Dimension::foot, "foot");
widgetSelectTmp->propertyValue.set(value.getType());
conn = widgetSelectTmp->signalValue.connect(
[=](const int32_t& _value) {
APPL_INFO("set parameter: gravity name=" << param->getName() << " value=" << (enum gale::Dimension::distance)_value);
gale::Dimension lastValueInterpreted = paramValue->get();
lastValueInterpreted.set(lastValueInterpreted.get(lastValueInterpreted.getType()), (enum gale::Dimension::distance)_value);
paramValue->set(lastValueInterpreted);
return;
});
m_listConnection.push_back(std::move(conn));
} else if (type == typeid(bvec2).name()) {
addSpacer(widgetSizer);
@ -481,26 +546,26 @@ void appl::MainWindows::updateProperty() {
} else {
// property list ...
std::vector<std::string> listElement = param->getListValue();
ewol::widget::SelectShared widgetTmp = ewol::widget::Select::create();
widgetSizer->subWidgetAdd(widgetTmp);
widgetTmp->propertyExpand.set(bvec2(true,false));
widgetTmp->propertyFill.set(bvec2(true,false));
std::string value = param->getString();
int32_t selectId = 0;
for (int32_t iii=0; iii<listElement.size(); ++iii) {
widgetTmp->optionAdd(iii, listElement[iii]);
if (listElement[iii] == value) {
selectId = iii;
}
ewol::widget::SelectShared widgetTmp = ewol::widget::Select::create();
widgetSizer->subWidgetAdd(widgetTmp);
widgetTmp->propertyExpand.set(bvec2(true,false));
widgetTmp->propertyFill.set(bvec2(true,false));
std::string value = param->getString();
int32_t selectId = 0;
for (int32_t iii=0; iii<listElement.size(); ++iii) {
widgetTmp->optionAdd(iii, listElement[iii]);
if (listElement[iii] == value) {
selectId = iii;
}
widgetTmp->propertyValue.set(selectId);
esignal::Connection conn = widgetTmp->signalValue.connect(
[=](const int32_t& _value) {
APPL_INFO("set parameter: gravity name=" << param->getName() << " value=" << listElement[_value]);
param->setString(listElement[_value]);
return;
});
m_listConnection.push_back(std::move(conn));
}
widgetTmp->propertyValue.set(selectId);
esignal::Connection conn = widgetTmp->signalValue.connect(
[=](const int32_t& _value) {
APPL_INFO("set parameter: gravity name=" << param->getName() << " value=" << listElement[_value]);
param->setString(listElement[_value]);
return;
});
m_listConnection.push_back(std::move(conn));
}
}
ewol::widget::SpacerShared mySpacer = ewol::widget::Spacer::create();