[DOC] update documentation
This commit is contained in:
parent
2cc41d2152
commit
d82ea4335e
@ -65,7 +65,7 @@ download the software:
|
|||||||
Compile software and test:
|
Compile software and test:
|
||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
lutin ewol-test 0XX_customwidget 001_HelloWord
|
lutin ewol-*
|
||||||
|
|
||||||
Dependency packages
|
Dependency packages
|
||||||
===================
|
===================
|
||||||
|
@ -14,9 +14,14 @@ This generate some restriction that you will see an overwiew in the under sectio
|
|||||||
===User requires:===
|
===User requires:===
|
||||||
To use ewol you need to know only C++ language. It could be usefull to know:
|
To use ewol you need to know only C++ language. It could be usefull to know:
|
||||||
:** [b]Python[/b] for all build tool.
|
:** [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.
|
:** [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:===
|
=== Architecture:===
|
||||||
One of the important point to know in this framwork is some of absurd things came from the multiple architecture type.
|
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.
|
:** 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 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
|
:** 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:
|
:** Main interesting point is packaging of the application data:
|
||||||
::** Linux store it in /usr/share/applName/*
|
::** Linux store it in /usr/share/applName/*
|
||||||
::** MacOs store it in applName.app/subFolder/*
|
::** MacOs store it in applName.app/subFolder/*
|
||||||
|
16
doc/index.bb
16
doc/index.bb
@ -7,7 +7,7 @@ EWOL, or Edn Widget OpenGl Layer, is a multi-platform library for creating graph
|
|||||||
===Where can I use it?===
|
===Where can I use it?===
|
||||||
Everywhere! EWOL is cross-platform devolopped to support bases OS:
|
Everywhere! EWOL is cross-platform devolopped to support bases OS:
|
||||||
: ** Linux (X11) (mouse)
|
: ** Linux (X11) (mouse)
|
||||||
: ** Windows (mouse) (not compile anymore ==> TODO)
|
: ** Windows (mouse) (build on linux...)
|
||||||
: ** MacOs (mouse)
|
: ** MacOs (mouse)
|
||||||
: ** Android (mouse + touch)
|
: ** Android (mouse + touch)
|
||||||
: ** IOs (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.
|
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*
|
:** BSD*
|
||||||
:** MIT
|
:** MIT
|
||||||
:** APPACHE-2
|
:** APPACHE-2
|
||||||
@ -50,36 +50,40 @@ limitations under the License.
|
|||||||
==== Sub library: ====
|
==== Sub library: ====
|
||||||
===== License: =====
|
===== License: =====
|
||||||
:** [b][lib[etk | e-tk]][/b] : APACHE-2
|
:** [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[linearmath | Linear-Math]][/b] : z-lib (subset of bullet lib)
|
||||||
::** [b][lib[earchive | e-Archive]][/b] : APACHE-2
|
::** [b][lib[earchive | e-Archive]][/b] : APACHE-2
|
||||||
:::** [b][lib[z | Z lib]][/b] : z-lib
|
:::** [b][lib[z | Z lib]][/b] : z-lib
|
||||||
:** [b][lib[egami | e-gami]][/b] : APACHE-2
|
:** [b][lib[egami | e-gami]][/b] : APACHE-2
|
||||||
::** [b][lib[esvg | e-svg]][/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[png | libPNG]][/b] : PNG
|
||||||
:** [b][lib[portaudio | portaudio]][/b] : MIT
|
|
||||||
:** [b][lib[ogg | ogg]][/b] : BSD-like
|
:** [b][lib[ogg | ogg]][/b] : BSD-like
|
||||||
:** [b][lib[freetype | Free-Type]][/b] : BSD-like
|
:** [b][lib[freetype | Free-Type]][/b] : BSD-like
|
||||||
:** [b][lib[ejson | e-json]][/b] : APACHE-2
|
:** [b][lib[ejson | e-json]][/b] : APACHE-2
|
||||||
:** [b][lib[exml | e-xml]][/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 : ====
|
==== Description : ====
|
||||||
===== Internal: =====
|
===== 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[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[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[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[esvg | e-svg]][/b] : Generic SVG image parser and displayer
|
||||||
:** [b][lib[ejson | e-json]][/b] : JSON file access (read and write)
|
:** [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[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: =====
|
===== External: =====
|
||||||
:** [b][lib[linearmath | Linear-Math]][/b] : bullet mathamatical sub lib (for using same vec3).
|
:** [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[z | Z lib]][/b] : Clkassical zlib lib.
|
||||||
:** [b][lib[agg | AGG]][/b] : A c++ drawing lib.
|
:** [b][lib[agg | AGG]][/b] : A c++ drawing lib.
|
||||||
:** [b][lib[png | libPNG]][/b] : the classical png display 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[ogg | ogg]][/b] : The classical Ogg coder reader lib.
|
||||||
:** [b][lib[freetype | Free-Type]][/b] : The classicle true-type 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)
|
:** [b][lib[bullet | bullet]][/b] : the classical bullet library physical engine. (dependence by ege)
|
||||||
|
@ -5,34 +5,74 @@ __________________________________________________
|
|||||||
All developpement software will start by getting the dependency and the sources.
|
All developpement software will start by getting the dependency and the sources.
|
||||||
|
|
||||||
=== Linux dependency packages ===
|
=== Linux dependency packages ===
|
||||||
|
|
||||||
|
==== Ubuntu or Debian ====
|
||||||
[code style=shell]
|
[code style=shell]
|
||||||
sudo apt-get install g++ libgl1-mesa-dev zlib1g-dev libasound2-dev
|
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
|
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
|
sudo apt-get install javacc openjdk-6-jdk
|
||||||
# if you want to compile for windows :
|
# Cross compile for windows:
|
||||||
sudo apt-get install mingw32
|
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
|
||||||
# on 64 bits processor for compatibility
|
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 ia32-libs
|
||||||
|
sudo apt-get install g++-multilib libc6-dev-i386
|
||||||
[/code]
|
[/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 instructions ===
|
||||||
|
|
||||||
Download the software :
|
==== download Build system: ====
|
||||||
|
|
||||||
[code style=shell]
|
[code style=shell]
|
||||||
# create a working directory path
|
sudo pip install lutin
|
||||||
mkdir your_workspace_path
|
sudo pip install pillow
|
||||||
cd your_workspace_path
|
[/code]
|
||||||
# clone ewol and all sub-library
|
|
||||||
git clone git://github.com/HeeroYui/ewol.git
|
==== need google repo: ====
|
||||||
cd ewol
|
|
||||||
git submodule init
|
see: http://source.android.com/source/downloading.html#installing-repo
|
||||||
git submodule update
|
|
||||||
cd ..
|
[code style=shell]
|
||||||
# clone the exemple repository
|
mkdir ~/.bin
|
||||||
git clone git://github.com/HeeroYui/example.git
|
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]
|
[/code]
|
||||||
|
|
||||||
[note]
|
[note]
|
||||||
@ -43,68 +83,60 @@ The full build tool documentation is availlable here : [[http://heeroyui.github.
|
|||||||
|
|
||||||
Compile software in debug for the curent platform :
|
Compile software in debug for the curent platform :
|
||||||
[code style=shell]
|
[code style=shell]
|
||||||
./ewol/build/lutin.py -mdebug
|
lutin -mdebug
|
||||||
[/code]
|
[/code]
|
||||||
|
|
||||||
You can specify the platform with:
|
You can specify the platform with:
|
||||||
[code style=shell]
|
[code style=shell]
|
||||||
./ewol/build/lutin.py -tAndroid -mdebug
|
lutin -tAndroid -mdebug
|
||||||
[/code]
|
[/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]
|
[code style=shell]
|
||||||
./ewol/build/lutin.py -mdebug -p
|
lutin -mdebug -p
|
||||||
[/code]
|
[/code]
|
||||||
|
|
||||||
Build with clang instead of gcc:
|
Build with clang instead of gcc:
|
||||||
[code style=shell]
|
[code style=shell]
|
||||||
./ewol/build/lutin.py -C -cclang
|
lutin -cclang
|
||||||
[/code]
|
[/code]
|
||||||
|
|
||||||
Display the build in color :
|
Display the build in color :
|
||||||
[code style=shell]
|
[code style=shell]
|
||||||
./ewol/build/lutin.py -C -mdebug -p
|
lutin -C -mdebug -p
|
||||||
[/code]
|
[/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]
|
[code style=shell]
|
||||||
./ewol/build/lutin.py -C edn-install
|
lutin -C ewol-sample-HelloWord?install
|
||||||
|
#or
|
||||||
|
lutin -C ewol-sample-HelloWord@install
|
||||||
[/code]
|
[/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]
|
[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]
|
[/code]
|
||||||
|
|
||||||
== Simple explanation : ==
|
== 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 :
|
It will create a tree like this :
|
||||||
|
|
||||||
:** workspace
|
:** workspace
|
||||||
::** ewol
|
::** application
|
||||||
:::** external [i](ewol external dependency sub-lib)[/i]
|
:::** Application clone application area.
|
||||||
::::** agg
|
::** framework
|
||||||
::::** bullet
|
:::** atria-soft
|
||||||
::::** date
|
::::** Graphic interface
|
||||||
::::** egami
|
:::** generic-library
|
||||||
::::** ege
|
::::** common untuch library (just wrap in lutin mode)
|
||||||
::::** ejson
|
:::** HeeroYui
|
||||||
::::** etk
|
::::** unstable stuff
|
||||||
::::** exml
|
:::** musicdsp
|
||||||
::::** freetype
|
::::** Common library for audio interfacing
|
||||||
::::** glew
|
:::** tools
|
||||||
::::** lua
|
|
||||||
::::** ogg
|
|
||||||
::::** png
|
|
||||||
::::** portaudio
|
|
||||||
::::** z
|
|
||||||
:::** souces
|
|
||||||
::::** ewol
|
|
||||||
::** example
|
|
||||||
::** youApplication_1
|
|
||||||
::** youApplication_2
|
|
||||||
::** youOtherLib_1
|
|
||||||
::** youOtherLib_2
|
|
||||||
::** out
|
|
||||||
|
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
|
|
||||||
A generic Ewol application is manage by creating an [class[ewol::context::Application]] that is the basis of your application.
|
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:
|
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
|
:** One application at the same time (note an exception for android wallpaper)
|
||||||
:** One Windows displayable at the time
|
:** One Windows displayable at the time (main point of view of apple developpers)
|
||||||
:** Not a big CPU ...
|
:** Not a big CPU ...
|
||||||
|
|
||||||
Then we will create the application:
|
Then we will create the application:
|
||||||
@ -20,16 +20,35 @@ Then we will create the application:
|
|||||||
namespace appl {
|
namespace appl {
|
||||||
class MainApplication : public ewol::context::Application {
|
class MainApplication : public ewol::context::Application {
|
||||||
public:
|
public:
|
||||||
bool init(ewol::Context& _context, size_t _initId) {
|
void onCreate(ewol::Context& _context) override {
|
||||||
APPL_INFO("==> Init APPL (START)");
|
APPL_INFO("==> CREATE ... " PROJECT_NAME " (BEGIN)");
|
||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
APPL_INFO("==> Init APPL (END)");
|
APPL_INFO("==> CREATE ... " PROJECT_NAME " (END)");
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
void unInit(ewol::Context& _context) {
|
void onStart(ewol::Context& _context) override {
|
||||||
APPL_INFO("==> Un-Init APPL (START)");
|
APPL_INFO("==> START ... " PROJECT_NAME " (BEGIN)");
|
||||||
// nothing to do ...
|
// 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:
|
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]
|
[b]Windows.h[/b]
|
||||||
[code style=c++]
|
[code style=c++]
|
||||||
#ifndef __APPL_WINDOWS_H__
|
#pragma once
|
||||||
#define __APPL_WINDOWS_H__
|
|
||||||
|
|
||||||
#include <ewol/widget/Windows.h>
|
#include <ewol/widget/Windows.h>
|
||||||
|
|
||||||
namespace appl {
|
namespace appl {
|
||||||
|
class Windows;
|
||||||
|
using WindowsShared = ememory::SharedPtr<appl::Windows>;
|
||||||
|
using WindowsWeak = ememory::WeakPtr<appl::Windows>;
|
||||||
class Windows : public ewol::widget::Windows {
|
class Windows : public ewol::widget::Windows {
|
||||||
protected:
|
protected:
|
||||||
Windows(void);
|
Windows(void);
|
||||||
init()
|
init();
|
||||||
public:
|
public:
|
||||||
DECLARE_FACTORY(Windows);
|
DECLARE_FACTORY(Windows);
|
||||||
virtual ~Windows(void) {};
|
virtual ~Windows(void) {};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
[/code]
|
[/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.
|
See [tutorial[010_ObjectModel | Next: Object model]] to understand why this structure is so complex.
|
||||||
|
|
||||||
[b]Windows.cpp[/b]
|
[b]Windows.cpp[/b]
|
||||||
@ -119,40 +141,42 @@ See [tutorial[010_ObjectModel | Next: Object model]] to understand why this stru
|
|||||||
#undef __class__
|
#undef __class__
|
||||||
#define __class__ "Windows"
|
#define __class__ "Windows"
|
||||||
|
|
||||||
appl::Windows::Windows(void) {
|
appl::Windows::Windows() {
|
||||||
// To simplify log (if you have a better solution, I am aware)
|
|
||||||
addObjectType("appl::Windows");
|
addObjectType("appl::Windows");
|
||||||
|
propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME);
|
||||||
}
|
}
|
||||||
appl::Windows::init(void) {
|
void appl::Windows::init() {
|
||||||
ewol::widget::Windows::init();
|
ewol::widget::Windows::init();
|
||||||
setTitle("example 001_HelloWord");
|
ewol::widget::LabelShared tmpWidget = ewol::widget::Label::create();
|
||||||
std::shared_ptr<ewol::widget::Label> tmpWidget = ewol::widget::Label::create();
|
if (tmpWidget == nullptr) {
|
||||||
if (NULL == tmpWidget) {
|
|
||||||
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
APPL_ERROR("Can not allocate widget ==> display might be in error");
|
||||||
} else {
|
} else {
|
||||||
tmpWidget->setLabel("Hello <font color='blue'>Word</font>");
|
tmpWidget->propertyValue.set("Hello <font color='blue'>World</font>");
|
||||||
tmpWidget->setExpand(bvec2(true,true));
|
tmpWidget->propertyExpand.set(bvec2(true,true));
|
||||||
setSubWidget(tmpWidget);
|
setSubWidget(tmpWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[/code]
|
[/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++]
|
[code style=c++]
|
||||||
ewol::widget::Windows::init();
|
ewol::widget::Windows::init();
|
||||||
[/code]
|
[/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++]
|
[code style=c++]
|
||||||
setTitle("example 001_HelloWord");
|
propertyTitle.setDirectCheck(std::string("sample ") + PROJECT_NAME);
|
||||||
[/code]
|
[/code]
|
||||||
|
|
||||||
After we simple create a [class[widget::Label]] in the main windows constructor.
|
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.
|
||||||
And we set the widget property (label).
|
|
||||||
|
After we simple create a [class[widget::Label]] in the main windows init.
|
||||||
|
We set label and basic properties:
|
||||||
[code style=c++]
|
[code style=c++]
|
||||||
std::shared_ptr<ewol::widget::Label> tmpWidget = ewol::widget::Label::create();
|
std::shared_ptr<ewol::widget::Label> tmpWidget = ewol::widget::Label::create();
|
||||||
tmpWidget->setLabel("Hello <font color='blue'>Word</font>");
|
tmpWidget->propertyValue.set("Hello <font color='blue'>World</font>");
|
||||||
tmpWidget->setExpand(bvec2(true,true));
|
tmpWidget->propertyExpand.set(bvec2(true,true));
|
||||||
[/code]
|
[/code]
|
||||||
We can see in this example that the label have some other property like the font color.
|
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.
|
:** replace '"' with ''' to simplify xml writing in C code.
|
||||||
[/note]
|
[/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++]
|
[code style=c++]
|
||||||
setSubWidget(tmpWidget);
|
setSubWidget(tmpWidget);
|
||||||
[/code]
|
[/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 ====
|
==== Configure Ewol to have display the windows ====
|
||||||
|
|
||||||
At this point we have created the basic windows.
|
At this point we have created the basic windows.
|
||||||
But the system does not know it.
|
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++]
|
[code style=c++]
|
||||||
std::shared_ptr<ewol::Windows> basicWindows = appl::Windows::create());
|
ewol::WindowsShared basicWindows = appl::Windows::create());
|
||||||
// create the specific windows
|
// create the specific windows
|
||||||
_context.setWindows(basicWindows);
|
_context.setWindows(basicWindows);
|
||||||
[/code]
|
[/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++]
|
[code style=c++]
|
||||||
bool MainApplication::init(ewol::Context& _context, size_t _initId) {
|
bool MainApplication::init(ewol::Context& _context, size_t _initId) {
|
||||||
APPL_INFO("==> Init APPL (START)");
|
APPL_INFO("==> Init APPL (START)");
|
||||||
@ -203,7 +227,7 @@ bool MainApplication::init(ewol::Context& _context, size_t _initId) {
|
|||||||
_context.getFontDefault().setUseExternal(true);
|
_context.getFontDefault().setUseExternal(true);
|
||||||
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
|
_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
|
// create the specific windows
|
||||||
_context.setWindows(basicWindows);
|
_context.setWindows(basicWindows);
|
||||||
APPL_INFO("==> Init APPL (END)");
|
APPL_INFO("==> Init APPL (END)");
|
||||||
@ -211,56 +235,60 @@ bool MainApplication::init(ewol::Context& _context, size_t _initId) {
|
|||||||
}
|
}
|
||||||
[/code]
|
[/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]
|
[note]
|
||||||
You can use many windows and select the one you want to display, but I do not think it is the best design.
|
You can use many windows and select the one you want to display, but I do not think it is the best design.
|
||||||
[/note]
|
[/note]
|
||||||
|
|
||||||
=== Build declaration: ===
|
=== 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]
|
[code style=python]
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import lutinModule as module
|
import lutin.module as module
|
||||||
import lutinTools as tools
|
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():
|
def get_desc():
|
||||||
return "Tutorial 001 : Hello Word"
|
return "Tutorial 001 : Hello Word"
|
||||||
|
|
||||||
# Module creation instance (not optionnal)
|
def get_licence():
|
||||||
def create(target):
|
return "APACHE-2"
|
||||||
# module name is '001_HelloWord' and type binary.
|
|
||||||
myModule = module.Module(__file__, '001_HelloWord', 'BINARY')
|
def get_compagny_type():
|
||||||
# add the file to compile:
|
return "com"
|
||||||
myModule.add_src_file([
|
|
||||||
|
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/Main.cpp',
|
||||||
'appl/debug.cpp',
|
'appl/debug.cpp',
|
||||||
'appl/Windows.cpp',
|
'appl/Windows.cpp',
|
||||||
])
|
])
|
||||||
# add Library dependency name
|
my_module.add_module_depend(['ewol'])
|
||||||
myModule.add_module_depend(['ewol'])
|
my_module.compile_flags('c++', [
|
||||||
# add application C flags
|
"-DPROJECT_NAME=\"\\\""+my_module.name+"\\\"\"",
|
||||||
myModule.compile_flags_CC([
|
"-DAPPL_VERSION=\"\\\"" + tools.version_to_string(get_version()) + "\\\"\""
|
||||||
"-DPROJECT_NAME=\"\\\""+myModule.name+"\\\"\""])
|
])
|
||||||
# Add current include Path
|
my_module.add_path(tools.get_current_path(__file__))
|
||||||
myModule.add_path(tools.get_current_path(__file__))
|
return my_module
|
||||||
return the created module
|
|
||||||
return myModule
|
|
||||||
[/code]
|
[/code]
|
||||||
|
|
||||||
show lutin doc for more information...
|
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
|
Go to your workspace folder and launch
|
||||||
[code style=shell]
|
[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]
|
[/code]
|
||||||
|
|
||||||
Your program example will build correctly...
|
Your program example will build correctly...
|
||||||
|
|
||||||
Launch it :
|
Launch it :
|
||||||
[code style=shell]
|
[code style=shell]
|
||||||
./out/Linux/debug/staging/gcc/001_HelloWord/usr/bin/001_HelloWord -l6
|
lutin -C -mdebug ewol-sample-HelloWord?run
|
||||||
[/code]
|
[/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
|
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
== Basis of the ewol::Object ==
|
== 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:
|
This is designed to manage many common things:
|
||||||
|
|
||||||
:** Unique ID
|
:** Unique ID
|
||||||
@ -14,7 +14,6 @@ This is designed to manage many common things:
|
|||||||
:** Signal generation
|
:** Signal generation
|
||||||
:** Xml configuration
|
:** Xml configuration
|
||||||
:** Removing
|
:** Removing
|
||||||
:** Perodic calling
|
|
||||||
|
|
||||||
[note]
|
[note]
|
||||||
Please do not compare with the gObject basic class...
|
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:
|
Creating an object is really simple:
|
||||||
|
|
||||||
[code style=c++]
|
[code style=c++]
|
||||||
std::shared_ptr<ewol::Button> tmpButon = ewol::Button::create();
|
ewol::widget::ButtonShared tmpButon = ewol::widget::Button::create();
|
||||||
APPL_INFO("We just create a button widget with unique ID=" << tmpButon->getId() << " name='" << tmpButon->getName() << "'");
|
APPL_INFO("We just create a button widget with unique ID=" << tmpButon->getId() << " name='" << tmpButon->propertyName.get() << "'");
|
||||||
[/code]
|
[/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:
|
Set the name of the object:
|
||||||
|
|
||||||
[code style=c++]
|
[code style=c++]
|
||||||
tmpButon->setName("my widget name");
|
tmpButon->propertyName.set("my widget name");
|
||||||
APPL_INFO("We just create an Object with ID=" << tmpButon->getId() << " name='" << tmpButon->getName() << "'");
|
APPL_INFO("We just create an Object with ID=" << tmpButon->getId() << " name='" << tmpButon->propertyName.get() << "'");
|
||||||
[/code]
|
[/code]
|
||||||
|
|
||||||
|
|
||||||
@ -48,13 +52,13 @@ Simply use the function:
|
|||||||
tmpButon->destroy();
|
tmpButon->destroy();
|
||||||
[/code]
|
[/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.
|
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]
|
[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]
|
[/note]
|
||||||
|
|
||||||
|
|
||||||
@ -67,8 +71,8 @@ In Ewol this is possible to get a object with his name.
|
|||||||
[code style=c++]
|
[code style=c++]
|
||||||
#include <ewol/context/Context.h>
|
#include <ewol/context/Context.h>
|
||||||
|
|
||||||
std::shared_ptr<ewol::Object> tmpObject = ewol::getContext().getEObjectManager().getObjectNamed("obj Name");
|
ewol::ObjectShared tmpObject = ewol::getContext().getEObjectManager().getObjectNamed("obj Name");
|
||||||
if (tmpObject == NULL) {
|
if (tmpObject == nullptr) {
|
||||||
APPL_ERROR("The Object does not exist");
|
APPL_ERROR("The Object does not exist");
|
||||||
}
|
}
|
||||||
[/code]
|
[/code]
|
||||||
@ -76,8 +80,8 @@ In Ewol this is possible to get a object with his name.
|
|||||||
=== Find a global Object (inside an Object) ===
|
=== Find a global Object (inside an Object) ===
|
||||||
|
|
||||||
[code style=c++]
|
[code style=c++]
|
||||||
std::shared_ptr<ewol::Object> tmpObject = getObjectNamed("obj Name");
|
ewol::ObjectShared tmpObject = getObjectNamed("obj Name");
|
||||||
if (tmpObject == NULL) {
|
if (tmpObject == nullptr) {
|
||||||
APPL_ERROR("The Object does not exist");
|
APPL_ERROR("The Object does not exist");
|
||||||
}
|
}
|
||||||
[/code]
|
[/code]
|
||||||
@ -85,7 +89,7 @@ In Ewol this is possible to get a object with his name.
|
|||||||
=== Find a sub-object ===
|
=== Find a sub-object ===
|
||||||
|
|
||||||
[code style=c++]
|
[code style=c++]
|
||||||
std::shared_ptr<ewol::Object> tmpObject = getSubObjectNamed("obj Name");
|
ewol::ObjectShared tmpObject = getSubObjectNamed("obj Name");
|
||||||
if (tmpObject == NULL) {
|
if (tmpObject == NULL) {
|
||||||
APPL_ERROR("The Object does not exist");
|
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:
|
It could be really interesting to retrive your own instance:
|
||||||
|
|
||||||
[code style=c++]
|
[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]
|
[/code]
|
||||||
|
|
||||||
== conclusion ==
|
|
||||||
|
|
||||||
TODO ...
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
|
|
||||||
=== Objectif ===
|
=== Objectif ===
|
||||||
:** Understand ewol::Object configuration parameter
|
:** Understand base of [lib[eproperty]] configuration parameter
|
||||||
:** Create an configurable object
|
:** Create an configurable object
|
||||||
|
|
||||||
== Configuration using ==
|
== 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.
|
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]
|
[note]
|
||||||
Using getter and setter is really better, and faster.
|
Parameter is managed by the [lib[eproperty|e-property library]]
|
||||||
[/note]
|
[/note]
|
||||||
|
|
||||||
==== With a string configuration ====
|
==== 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>
|
#include <ewol/object/Object.h>
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class MyObj : public ewol::Object {
|
class MyObj : public ewol::Object {
|
||||||
|
public:
|
||||||
|
eproperty::Value<bool> propertyValue; //!< Property interface (all time start with "property")
|
||||||
protected:
|
protected:
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
MyObj(void) :
|
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..
|
// nothing to do..
|
||||||
}
|
}
|
||||||
void init() {
|
void init() {
|
||||||
ewol::Object::init();
|
ewol::Object::init();
|
||||||
|
// do some stuff with the init value
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
//! @brief Destructor
|
//! @brief Destructor
|
||||||
virtual ~MyObj(void) { }
|
virtual ~MyObj(void) { }
|
||||||
DECLARE_FACTORY(MyObj);
|
DECLARE_FACTORY(MyObj);
|
||||||
private:
|
|
||||||
ewol::object::Param<bool> m_value; //!< Internal Object value
|
|
||||||
public:
|
public:
|
||||||
//! @brief Setter
|
void onChangeParameterValue() {
|
||||||
void setValue(bool _val) {
|
APPL_DEBUG("The internal value has change, new value is : '" << *m_value << "'");
|
||||||
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() << "'");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -80,19 +73,19 @@ In the contructor we need to add:
|
|||||||
[code style=c++]
|
[code style=c++]
|
||||||
m_value(*this, "value", false, "Value of the parameter (descrition string)")
|
m_value(*this, "value", false, "Value of the parameter (descrition string)")
|
||||||
[/code]
|
[/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]"value":[/b] Is the name of the parameter.
|
||||||
:** [b]false:[/b] The default value.
|
:** [b]false:[/b] The default value.
|
||||||
:** [b]"....."[/b] Description of the parameter (optionnal).
|
:** [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 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.get() is an inline fuction then it take no more CPU cycle to access the value than normal variable.
|
|
||||||
|
|
||||||
Some other parameter are availlable :
|
Some other parameter are availlable :
|
||||||
:** ewol::object::Param<T> Basic parameter.
|
:** eproperty::Value<T> Basic parameter.
|
||||||
:** ewol::object::ParamRange<T> For numeric parameter that range value are check befor setting new value.
|
:** eproperty::Range<T> For numeric parameter that range value are check befor setting new value.
|
||||||
:** ewol::object::ParamList<T> For List of parameter values.
|
:** eproperty::List<T> For List of parameter values.
|
||||||
|
|
||||||
|
For more information see [lib[eproperty]]
|
||||||
|
|
||||||
|
@ -1,33 +1,29 @@
|
|||||||
|
|
||||||
=== Objectif ===
|
=== Objectif ===
|
||||||
:** Understand ewol::Object Messaging system
|
:** Understand base of [lib[esignal]] Messaging system
|
||||||
:** Create extern message and receive Object message
|
:** Create extern message and receive Object message
|
||||||
|
|
||||||
== Message system ==
|
== 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].
|
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 ==
|
== Receive signals from other object ==
|
||||||
|
|
||||||
[todo]
|
|
||||||
Link with the signal name
|
|
||||||
[/todo]
|
|
||||||
|
|
||||||
Register on the 'up' and 'value' signal of a button:
|
Register on the 'up' and 'value' signal of a button:
|
||||||
|
|
||||||
Button header :
|
Button header :
|
||||||
[code style=c++]
|
[code style=c++]
|
||||||
...
|
...
|
||||||
public:
|
public:
|
||||||
ewol::object::Signal<void> signalDown;
|
esignal::ISignal<> signalDown;
|
||||||
ewol::object::Signal<void> signalUp;
|
esignal::ISignal<> signalUp;
|
||||||
...
|
...
|
||||||
ewol::object::Signal<bool> signalValue;
|
esignal::ISignal<bool> signalValue;
|
||||||
...
|
...
|
||||||
[/code]
|
[/code]
|
||||||
|
|
||||||
@ -39,10 +35,11 @@ Button header :
|
|||||||
namespace appl {
|
namespace appl {
|
||||||
class MyObj : public ewol::Object {
|
class MyObj : public ewol::Object {
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<ewol::widget::Button> m_button;
|
ewol::widget::ButtonShared m_button;
|
||||||
|
esignal::Connection m_connect;
|
||||||
protected:
|
protected:
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
MyObj(void) {
|
MyObj() {
|
||||||
// nothing to do..
|
// nothing to do..
|
||||||
}
|
}
|
||||||
void init() {
|
void init() {
|
||||||
@ -52,75 +49,43 @@ namespace appl {
|
|||||||
APPL_ERROR("Can not create button...");
|
APPL_ERROR("Can not create button...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// We connect signals here :
|
m_button.propertyToggle.set(true);
|
||||||
m_button->signalUp.bind(shared_from_this(), &appl::MyObj::onCallbackUp);
|
// We connect signals here: (permanent connection)
|
||||||
m_button->signalValue.bind(shared_from_this(), &appl::MyObj::onCallbackValue);
|
m_button->signalUp.connect(shared_from_this(), &appl::MyObj::onCallbackUp);
|
||||||
|
m_button->signalValue.connect(shared_from_this(), &appl::MyObj::onCallbackValue);
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
//! @brief Destructor
|
//! @brief Destructor
|
||||||
virtual ~MyObj(void) { }
|
virtual ~MyObj() { }
|
||||||
DECLARE_FACTORY(MyObj);
|
DECLARE_FACTORY(MyObj);
|
||||||
private:
|
private:
|
||||||
void onCallbackUp() {
|
void onCallbackUp() {
|
||||||
APPL_INFO("button pressed: UP);
|
APPL_INFO("button pressed: UP");
|
||||||
|
}
|
||||||
|
void onCallbackDown() {
|
||||||
|
APPL_INFO("button pressed: DOWN");
|
||||||
}
|
}
|
||||||
void onCallbackValue(const bool& _value) {
|
void onCallbackValue(const bool& _value) {
|
||||||
APPL_INFO("button value: " << _value);
|
APPL_INFO("button value: " << _value);
|
||||||
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[/code]
|
[/code]
|
||||||
|
|
||||||
|
[note]
|
||||||
|
The connection with SharedPtr are static. they keep in internal a WeakPtr to remove connection if the object is removed.
|
||||||
|
[/note]
|
||||||
|
|
||||||
=== Advenced signal connection: ===
|
[note]
|
||||||
|
The connection that return a [class[esignal::Connection]] are volatil, if you don't keep the connection handle, the connection is automaticly removed.
|
||||||
Here we will see how to connect an advance function on a signal
|
[/note]
|
||||||
|
|
||||||
[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;
|
|
||||||
}
|
|
||||||
// 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)
|
|
||||||
|
|
||||||
|
|
||||||
== Declare Signal ==
|
== Declare Signal ==
|
||||||
|
|
||||||
@ -132,23 +97,20 @@ TODO: documentation :
|
|||||||
namespace appl {
|
namespace appl {
|
||||||
class MyObj : public ewol::Object {
|
class MyObj : public ewol::Object {
|
||||||
public:
|
public:
|
||||||
ewol::object::Signal<void> signalEmpty;
|
ewol::object::Signal<> signalEmpty;
|
||||||
ewol::object::Signal<bool> signalBoolean;
|
ewol::object::Signal<bool> signalBoolean;
|
||||||
ewol::object::Signal<std::string> signalString;
|
ewol::object::Signal<std::string> signalString;
|
||||||
protected:
|
protected:
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
MyObj(void) :
|
MyObj() :
|
||||||
signalEmpty(*this, "empty"),
|
signalEmpty(this, "empty"),
|
||||||
signalBoolean(*this, "boolean"),
|
signalBoolean(this, "boolean"),
|
||||||
signalString(*this, "string") {
|
signalString(this, "string") {
|
||||||
// nothing to do..
|
// nothing to do..
|
||||||
}
|
}
|
||||||
void init() {
|
|
||||||
ewol::Object::init();
|
|
||||||
}
|
|
||||||
public:
|
public:
|
||||||
//! @brief Destructor
|
//! @brief Destructor
|
||||||
virtual ~MyObj(void) { }
|
virtual ~MyObj() { }
|
||||||
DECLARE_FACTORY(MyObj);
|
DECLARE_FACTORY(MyObj);
|
||||||
private:
|
private:
|
||||||
void process() {
|
void process() {
|
||||||
@ -164,7 +126,7 @@ namespace appl {
|
|||||||
|
|
||||||
You will now able to reise signals between objects...
|
You will now able to reise signals between objects...
|
||||||
|
|
||||||
|
For more information see [lib[esignal]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,27 +7,37 @@
|
|||||||
Application generation is really simple, but package management can create some problems...
|
Application generation is really simple, but package management can create some problems...
|
||||||
|
|
||||||
For example :
|
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/
|
:** 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.
|
:** 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 ==
|
== Generic Properties ==
|
||||||
|
|
||||||
By default we dertermine some basics for files.
|
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
|
:** "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)
|
:** "USERDATA:XXX" User save data (like game save)
|
||||||
|
::** Linux: ~/.local/share/applName/
|
||||||
|
::** Android: /xxx/yyy/data/applName/
|
||||||
:** "HOME:XXX" User home folder
|
:** "HOME:XXX" User home folder
|
||||||
|
::** Linux: ~/
|
||||||
|
::** Android: /sdcard/
|
||||||
|
::** IOs: --- => no Home
|
||||||
|
::** MacOs: ~/
|
||||||
:** "/XXX" Direct acces on a file in the fileSystem
|
:** "/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.
|
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 ==
|
== Integrate a file in a package ==
|
||||||
|
|
||||||
@ -113,7 +123,7 @@ And when you want to change the theme, just call:
|
|||||||
[/code]
|
[/code]
|
||||||
|
|
||||||
[note]
|
[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]
|
[/note]
|
||||||
|
|
||||||
You can acces on your theme with accessing the filename: "THEME:GUI_COLOR:your/sub/path/file.xx"
|
You can acces on your theme with accessing the filename: "THEME:GUI_COLOR:your/sub/path/file.xx"
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
|
|
||||||
=== Objectifs ===
|
=== Objectifs ===
|
||||||
:** Understand What is a resource
|
:** Understand what is a resource
|
||||||
:** Use resources
|
:** Use resources
|
||||||
|
|
||||||
=== What is a resource: ===
|
=== 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)
|
:** An image (special resolution)
|
||||||
:** A configuration file
|
:** A configuration file
|
||||||
:** An application manager (special case)
|
:** An application manager (special case)
|
||||||
@ -23,25 +23,36 @@ For this example we will load a configuration file:
|
|||||||
#include <ewol/resource/ConfigFile.h>
|
#include <ewol/resource/ConfigFile.h>
|
||||||
namespace appl {
|
namespace appl {
|
||||||
class MyObj : public ewol::Object {
|
class MyObj : public ewol::Object {
|
||||||
|
public:
|
||||||
|
eproperty::Value<std::string> propertyConfig;
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<ewol::resource::ConfigFile> m_config;
|
std::shared_ptr<ewol::resource::ConfigFile> m_config;
|
||||||
int32_t m_configValId;
|
int32_t m_configValId;
|
||||||
protected:
|
protected:
|
||||||
//! @brief Constructor
|
//! @brief Constructor
|
||||||
MyObj(void) :
|
MyObj(void) :
|
||||||
|
propertyConfig(this, "file",
|
||||||
|
"DATA:ExapleConfig.json",
|
||||||
|
"no desc",
|
||||||
|
&appl::MyObj::onChangePropertyFile),
|
||||||
m_configValId(-1) {
|
m_configValId(-1) {
|
||||||
// nothing to do..
|
// nothing to do..
|
||||||
}
|
}
|
||||||
void init() {
|
void init() {
|
||||||
ewol::Object::init();
|
ewol::Object::init();
|
||||||
m_config = ewol::resource::ConfigFile::create("DATA:ExapleConfig.json");
|
onChangePropertyFile();
|
||||||
m_configValId = m_config->request("exampleConfigName");
|
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
//! @brief Destructor
|
//! @brief Destructor
|
||||||
virtual ~MyObj(void) { }
|
virtual ~MyObj(void) { }
|
||||||
DECLARE_FACTORY(MyObj);
|
DECLARE_FACTORY(MyObj);
|
||||||
public:
|
public:
|
||||||
|
void onChangePropertyFile() {
|
||||||
|
m_config = ewol::resource::ConfigFile::create(*propertyConfig);
|
||||||
|
if (m_config != nullptr) {
|
||||||
|
m_configValId = m_config->request("exampleConfigName");
|
||||||
|
}
|
||||||
|
}
|
||||||
void process() {
|
void process() {
|
||||||
double value = m_config->getNumber(m_configValId);
|
double value = m_config->getNumber(m_configValId);
|
||||||
APPL_DEBUG("example value : " << value);
|
APPL_DEBUG("example value : " << value);
|
||||||
@ -53,7 +64,7 @@ namespace appl {
|
|||||||
|
|
||||||
=== Create a new resource: ===
|
=== 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_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_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)
|
:** 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.
|
The resources are loaded fron 0 to 5.
|
||||||
|
|
||||||
Then for basic resource :
|
Then for basic resource:
|
||||||
|
|
||||||
[code style=c++]
|
[code style=c++]
|
||||||
#include <ewol/object/Resource.h>
|
#include <ewol/object/Resource.h>
|
||||||
|
@ -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:
|
We can consider some widget:
|
||||||
:** Windows: Main gui interface to display the unique "windows".
|
:** Windows: Main gui interface to display the unique "windows".
|
||||||
|
:** Container Widget: Widget that manage some subWidget (generic)
|
||||||
:** Simple widget: all widget that display somthing.
|
:** Simple widget: all widget that display somthing.
|
||||||
:** Meta widget: Widget composed with some wodget.
|
:** 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.
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
import monkModule
|
import monkModule
|
||||||
import monkTools as tools
|
import monkTools as tools
|
||||||
|
import os
|
||||||
|
|
||||||
def get_desc():
|
def get_desc():
|
||||||
return "EWOL main library (Edn Widget on OpenGl Layer)"
|
return "EWOL main library (Edn Widget on OpenGl Layer)"
|
||||||
@ -9,10 +10,10 @@ def create():
|
|||||||
# module name is 'ewol' and type binary.
|
# module name is 'ewol' and type binary.
|
||||||
myModule = monkModule.Module(__file__, 'ewol', 'LIBRARY')
|
myModule = monkModule.Module(__file__, 'ewol', 'LIBRARY')
|
||||||
# enable doculentation :
|
# enable doculentation :
|
||||||
myModule.set_website("http://heeroyui.github.io/ewol/")
|
myModule.set_website("http://atria-soft.github.io/ewol/")
|
||||||
myModule.set_website_sources("http://github.com/heeroyui/ewol/")
|
myModule.set_website_sources("http://github.com/atria-soft/ewol/")
|
||||||
myModule.set_path(tools.get_current_path(__file__) + "/ewol/")
|
myModule.set_path(os.path.join(tools.get_current_path(__file__), "ewol"))
|
||||||
myModule.set_path_general_doc(tools.get_current_path(__file__) + "/../doc/")
|
myModule.set_path_general_doc(os.path.join(tools.get_current_path(__file__), "doc"))
|
||||||
# add the currrent module at the
|
# add the currrent module at the
|
||||||
return myModule
|
return myModule
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
#include <ewol/widget/Manager.h>
|
#include <ewol/widget/Manager.h>
|
||||||
#include <ewol/context/Context.h>
|
#include <ewol/context/Context.h>
|
||||||
|
|
||||||
|
namespace appl {
|
||||||
class MainApplication : public ewol::context::Application {
|
class MainApplication : public ewol::context::Application {
|
||||||
public:
|
public:
|
||||||
void onCreate(ewol::Context& _context) override {
|
void onCreate(ewol::Context& _context) override {
|
||||||
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ") (BEGIN)");
|
APPL_INFO(" == > CREATE ... " << PROJECT_NAME << " v" << APPL_VERSION << " (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ") (BEGIN)");
|
||||||
@ -53,7 +53,8 @@ class MainApplication : public ewol::context::Application {
|
|||||||
// nothing to do ...
|
// nothing to do ...
|
||||||
APPL_INFO("==> STOP ... " PROJECT_NAME " (END)");
|
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...).
|
* @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[]) {
|
int main(int _argc, const char *_argv[]) {
|
||||||
// second possibility
|
// second possibility
|
||||||
return ewol::run(new MainApplication(), _argc, _argv);
|
return ewol::run(new appl::MainApplication(), _argc, _argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -250,8 +250,73 @@ void appl::MainWindows::updateProperty() {
|
|||||||
});
|
});
|
||||||
m_listConnection.push_back(std::move(conn));
|
m_listConnection.push_back(std::move(conn));
|
||||||
} else if (type == typeid(gale::Dimension).name()) {
|
} 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()) {
|
} else if (type == typeid(bvec2).name()) {
|
||||||
addSpacer(widgetSizer);
|
addSpacer(widgetSizer);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user