First application test
This commit is contained in:
commit
2edbefd754
57
Makefile
Normal file
57
Makefile
Normal file
@ -0,0 +1,57 @@
|
||||
#############################################################################"
|
||||
# main makefile for a basic application
|
||||
# this is minimal application main makefile
|
||||
#############################################################################"
|
||||
|
||||
# Project name ==> generate the application name [a-z] <== make attention at the case this generate error on Android compilation
|
||||
PROJECT_NAME=human
|
||||
|
||||
#Can be manny things, but limit whith no space no special char and no Maj ... [a-z]
|
||||
# com : Commercial
|
||||
# net : Network??
|
||||
# org : Organisation
|
||||
# gov : Governement
|
||||
# mil : Military
|
||||
# edu : Education
|
||||
# pri : Private
|
||||
# museum : ...
|
||||
PROJECT_COMPAGNY_TYPE=org
|
||||
|
||||
# Compagny name of the project [a-zA-Z0-9 \-]
|
||||
PROJECT_COMPAGNY_NAME=Edouard DUPIN
|
||||
|
||||
# List of mainainer that might be contact in problem case : "Mr NAME Surname<mail@host.com>" "second ..."
|
||||
PROJECT_MAINTAINER="Mr DUPIN Edouard <yui.heero@gmail.com>"
|
||||
|
||||
# the icon of the project is all time needed ... if it is not present the ewol icon might be set (must be a .png file) (and no space in the fileName and filePath)
|
||||
PROJECT_ICON=$(shell pwd)/data/icon.png
|
||||
|
||||
# project section : (must be separate by coma
|
||||
# refer to : http://packages.debian.org/sid/
|
||||
# admin cli-mono comm database debian-installer
|
||||
# debug doc editors electronics devel embedded
|
||||
# fonts games gnome gnu-r gnustep graphics
|
||||
# hamradio haskell httpd interpreters java
|
||||
# kde kernel libdevel libs lisp localization
|
||||
# mail math misc net news ocaml oldlibs otherosfs
|
||||
# perl php python ruby science shells sound tex
|
||||
# text utils vcs video virtual web x11 xfce zope ...
|
||||
PROJECT_SECTION=test
|
||||
|
||||
# project prority
|
||||
# required : Packages which are necessary for the proper functioning of the system (usually, this means that dpkg functionality depends on these packages). Removing a required package may cause your system to become totally broken and you may not even be able to use dpkg to put things back, so only do so if you know what you are doing. Systems with only the required packages are probably unusable, but they do have enough functionality to allow the sysadmin to boot and install more software.
|
||||
# important : Important programs, including those which one would expect to find on any Unix-like system. If the expectation is that an experienced Unix person who found it missing would say "What on earth is going on, where is foo?", it must be an important package.[6] Other packages without which the system will not run well or be usable must also have priority important. This does not include Emacs, the X Window System, TeX or any other large applications. The important packages are just a bare minimum of commonly-expected and necessary tools.
|
||||
# standard : These packages provide a reasonably small but not too limited character-mode system. This is what will be installed by default if the user doesn't select anything else. It doesn't include many large applications.
|
||||
# optional : (In a sense everything that isn't required is optional, but that's not what is meant here.) This is all the software that you might reasonably want to install if you didn't know what it was and don't have specialized requirements. This is a much larger system and includes the X Window System, a full TeX distribution, and many applications. Note that optional packages should not conflict with each other.
|
||||
# extra : This contains all packages that conflict with others with required, important, standard or optional priorities, or are only likely to be useful if you already know what they are or have specialized requirements (such as packages containing only detached debugging symbols).
|
||||
PROJECT_PRIORITY=extra
|
||||
|
||||
# description of the current project inside quote and no \n
|
||||
PROJECT_DESCRIPTION="Test software"
|
||||
|
||||
# Add package needed :
|
||||
# current user packages
|
||||
USER_PACKAGES =$(shell pwd)/sources/
|
||||
|
||||
# include the basic makefile of ewol :
|
||||
include $(shell pwd)/../ewol/Makefile.mk
|
41
config/Linux.config
Normal file
41
config/Linux.config
Normal file
@ -0,0 +1,41 @@
|
||||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# Linux kernel version:
|
||||
#
|
||||
|
||||
#
|
||||
# Modules
|
||||
#
|
||||
BUILD_HUMAN=y
|
||||
# BUILD_AGG is not set
|
||||
# BUILD_ETK is not set
|
||||
# BUILD_EWOL is not set
|
||||
# BUILD_FREETYPE is not set
|
||||
# BUILD_LUA is not set
|
||||
# BUILD_OGG is not set
|
||||
# BUILD_PARSERSVG is not set
|
||||
# BUILD_LIBPNG is not set
|
||||
# BUILD_PORTAUDIO is not set
|
||||
# BUILD_TINYXML is not set
|
||||
# BUILD_ZLIB is not set
|
||||
# BUILD_LIBZIP is not set
|
||||
|
||||
#
|
||||
# edn
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
APPL_BUFFER_FONT_NORMAL=y
|
||||
# APPL_BUFFER_FONT_DISTANCE_FIELD is not set
|
||||
|
||||
#
|
||||
# ewol
|
||||
#
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
# __EWOL_INTEGRATED_FONT__ is not set
|
||||
__EWOL_APPL_BASIC_TITLE__="Edn : Sources Code Editor"
|
46
data/cube.obj
Normal file
46
data/cube.obj
Normal file
@ -0,0 +1,46 @@
|
||||
# Blender3D v249 OBJ File: untitled.blend
|
||||
# www.blender3d.org
|
||||
mtllib cube.mtl
|
||||
v 1.0 -1.0 -1.0
|
||||
v 1.0 -1.0 1.0
|
||||
v -1.0 -1.0 1.0
|
||||
v -1.0 -1.0 -1.0
|
||||
v 1.0 1.0 -1.0
|
||||
v 1.0 1.0 1.0
|
||||
v -1.0 1.0 1.0
|
||||
v -1.0 1.0 -1.0
|
||||
|
||||
vt 0.0 0.0
|
||||
vt 1.0 0.0
|
||||
vt 1.0 1.0
|
||||
vt 0.0 1.0
|
||||
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn -1.000000 -0.000000 -0.000000
|
||||
vn -0.000000 -0.000000 1.000000
|
||||
vn -0.000001 0.000000 1.000000
|
||||
vn 1.000000 -0.000000 0.000000
|
||||
vn 1.000000 0.000000 0.000001
|
||||
vn 0.000000 1.000000 -0.000000
|
||||
vn -0.000000 -1.000000 0.000000
|
||||
usemtl stone.png
|
||||
s off
|
||||
|
||||
f 5/1/1 1/2/1 4/3/1
|
||||
f 5/1/1 4/3/1 8/4/1
|
||||
|
||||
f 3/1/2 7/2/2 8/3/2
|
||||
f 3/1/2 8/3/2 4/4/2
|
||||
|
||||
f 2/1/3 6/2/3 3/3/3
|
||||
f 6/1/4 7/3/4 3/4/4
|
||||
|
||||
f 1/1/5 5/2/5 2/3/5
|
||||
f 5/1/6 6/3/6 2/4/6
|
||||
|
||||
f 5/1/7 8/2/7 6/3/7
|
||||
f 8/1/7 7/3/7 6/4/7
|
||||
|
||||
f 1/1/8 2/2/8 3/3/8
|
||||
f 1/1/8 3/3/8 4/4/8
|
||||
|
18
data/grass.obj
Normal file
18
data/grass.obj
Normal file
@ -0,0 +1,18 @@
|
||||
# done myself
|
||||
v 100.0 -100.0 0.0
|
||||
v 100.0 100.0 0.0
|
||||
v -100.0 100.0 0.0
|
||||
v -100.0 -100.0 0.0
|
||||
|
||||
vt 0.0 0.0
|
||||
vt 100.0 0.0
|
||||
vt 100.0 100.0
|
||||
vt 0.0 100.0
|
||||
|
||||
vn 0.000000 0.000000 1.000000
|
||||
|
||||
usemtl grass.png
|
||||
|
||||
f 1/1/1 2/2/1 3/3/1
|
||||
f 1/1/1 3/3/1 4/4/1
|
||||
|
BIN
data/grass.png
Normal file
BIN
data/grass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 532 B |
BIN
data/icon.png
Normal file
BIN
data/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.4 KiB |
BIN
data/sphere.blend
Normal file
BIN
data/sphere.blend
Normal file
Binary file not shown.
11
data/sphere.mtl
Normal file
11
data/sphere.mtl
Normal file
@ -0,0 +1,11 @@
|
||||
# Blender MTL File: 'sphere.blend'
|
||||
# Material Count: 1
|
||||
newmtl
|
||||
Ns 0
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.8 0.8 0.8
|
||||
Ks 0.8 0.8 0.8
|
||||
d 1
|
||||
illum 2
|
||||
|
||||
|
1000
data/sphere.obj
Normal file
1000
data/sphere.obj
Normal file
File diff suppressed because it is too large
Load Diff
BIN
data/stone.png
Normal file
BIN
data/stone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
BIN
data/stone2.png
Normal file
BIN
data/stone2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
26
sources/Linux.mk
Normal file
26
sources/Linux.mk
Normal file
@ -0,0 +1,26 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
# load the common sources file of the platform
|
||||
include $(LOCAL_PATH)/file.mk
|
||||
|
||||
LOCAL_CONFIG_FILES := Config.in
|
||||
|
||||
# name of the librairy
|
||||
LOCAL_MODULE := human
|
||||
|
||||
# name of the dependency
|
||||
LOCAL_STATIC_LIBRARIES := ewol
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)
|
||||
|
||||
LOCAL_SRC_FILES := $(FILE_LIST)
|
||||
|
||||
|
||||
LOCAL_LDLIBS :=
|
||||
|
||||
LOCAL_CFLAGS := -DPROJECT_NAME="\"$(LOCAL_MODULE)\""
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
10
sources/appl/Debug.cpp
Normal file
10
sources/appl/Debug.cpp
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
// *********** << needed to have a goo display (do not exeed)
|
||||
const char * applLog = "human ";
|
27
sources/appl/Debug.h
Normal file
27
sources/appl/Debug.h
Normal file
@ -0,0 +1,27 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __DEBUG_H__
|
||||
#define __DEBUG_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/Debug.h>
|
||||
|
||||
extern const char * applLog;
|
||||
|
||||
#define APPL_CRITICAL(data) ETK_CRITICAL(applLog, data)
|
||||
#define APPL_WARNING(data) ETK_WARNING(applLog, data)
|
||||
#define APPL_ERROR(data) ETK_ERROR(applLog, data)
|
||||
#define APPL_INFO(data) ETK_INFO(applLog, data)
|
||||
#define APPL_DEBUG(data) ETK_DEBUG(applLog, data)
|
||||
#define APPL_VERBOSE(data) ETK_VERBOSE(applLog, data)
|
||||
#define APPL_ASSERT(cond, data) ETK_ASSERT(applLog, cond, data)
|
||||
#define APPL_CHECK_INOUT(cond) ETK_CHECK_INOUT(applLog, cond)
|
||||
#define APPL_TODO(cond) ETK_TODO(applLog, cond)
|
||||
|
||||
#endif
|
177
sources/appl/MainWindows.cpp
Normal file
177
sources/appl/MainWindows.cpp
Normal file
@ -0,0 +1,177 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/MainWindows.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
#include <appl/TestButton.h>
|
||||
#include <appl/TestButtonColor.h>
|
||||
#include <appl/TestLabel.h>
|
||||
#include <appl/TestScene.h>
|
||||
|
||||
|
||||
static const char * l_eventChangeTheme = "event-change-theme";
|
||||
static const char * l_eventChangeWidgetNext = "event-change-widget-test-next";
|
||||
static const char * l_eventChangeWidgetPrevious = "event-change-widget-test-previous";
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "MainWindows"
|
||||
|
||||
MainWindows::MainWindows(void) :
|
||||
m_idWidget(0),
|
||||
m_subWidget(NULL)
|
||||
{
|
||||
APPL_DEBUG("CREATE WINDOWS ... ");
|
||||
widget::SizerHori* mySizerHori = NULL;
|
||||
widget::Button* myButton = NULL;
|
||||
|
||||
m_sizerVert = new widget::SizerVert();
|
||||
if (NULL == m_sizerVert) {
|
||||
APPL_DEBUG("Allocation error mySizerVert");
|
||||
return;
|
||||
}
|
||||
SetSubWidget(m_sizerVert);
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
m_sizerVert->SubWidgetAdd(mySizerHori);
|
||||
myButton = new widget::Button("default theme (cube)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("rounded theme");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeTheme);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Previous Widget test");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeWidgetPrevious);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Next Widget test");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeWidgetNext);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
widget::Spacer* mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(true);
|
||||
mySpacer->SetFillY(false);
|
||||
mySpacer->SetSize(3);
|
||||
mySpacer->SetColor(0x000000FF);
|
||||
m_sizerVert->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
// add the basic widget with a strange methode ...
|
||||
OnReceiveMessage(NULL, NULL, "");
|
||||
}
|
||||
|
||||
|
||||
MainWindows::~MainWindows(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MainWindows::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
if( CallerObject != this
|
||||
&& CallerObject != NULL) {
|
||||
ewol::Windows::OnReceiveMessage(CallerObject, eventId, data);
|
||||
}
|
||||
APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (eventId == l_eventChangeTheme) {
|
||||
if (data=="1") {
|
||||
etk::theme::SetName("GUI", "rounded");
|
||||
} else {
|
||||
etk::theme::SetName("GUI", "default");
|
||||
}
|
||||
// Reload shaders and graphic system ...
|
||||
ewol::resource::ReLoadResources();
|
||||
return;
|
||||
} else if (eventId == l_eventChangeWidgetPrevious) {
|
||||
m_idWidget--;
|
||||
} else if (eventId == l_eventChangeWidgetNext) {
|
||||
m_idWidget++;
|
||||
}
|
||||
|
||||
if (m_subWidget != NULL) {
|
||||
delete (m_subWidget);
|
||||
// inn theory it must be removed ...
|
||||
m_subWidget = NULL;
|
||||
}
|
||||
// special init forcing ...
|
||||
if(CallerObject == NULL) {
|
||||
m_idWidget = 4;
|
||||
}
|
||||
switch(m_idWidget)
|
||||
{
|
||||
default:
|
||||
m_idWidget = 0;
|
||||
case 0:
|
||||
m_subWidget = (ewol::Widget*)new widget::Label("Test software for EWOL");
|
||||
if (NULL != m_subWidget) {
|
||||
m_subWidget->SetExpendX(true);
|
||||
m_subWidget->SetExpendY(true);
|
||||
m_sizerVert->SubWidgetAdd(m_subWidget);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
m_subWidget = (ewol::Widget*)new TestButton();
|
||||
if (NULL != m_subWidget) {
|
||||
m_sizerVert->SubWidgetAdd(m_subWidget);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
m_subWidget = (ewol::Widget*)new TestButtonColor();
|
||||
if (NULL != m_subWidget) {
|
||||
m_sizerVert->SubWidgetAdd(m_subWidget);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
m_subWidget = (ewol::Widget*)new TestLabel();
|
||||
if (NULL != m_subWidget) {
|
||||
m_sizerVert->SubWidgetAdd(m_subWidget);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
m_subWidget = (ewol::Widget*)new TestScene();
|
||||
if (NULL != m_subWidget) {
|
||||
m_sizerVert->SubWidgetAdd(m_subWidget);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindows::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
ewol::Windows::OnObjectRemove(removeObject);
|
||||
if (m_subWidget == removeObject) {
|
||||
m_subWidget = NULL;
|
||||
} else if (m_sizerVert == removeObject) {
|
||||
m_sizerVert = NULL;
|
||||
}
|
||||
}
|
39
sources/appl/MainWindows.h
Normal file
39
sources/appl/MainWindows.h
Normal file
@ -0,0 +1,39 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __MAIN_WINDOWS_H__
|
||||
#define __MAIN_WINDOWS_H__
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Windows.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
|
||||
class MainWindows : public ewol::Windows
|
||||
{
|
||||
private:
|
||||
widget::SizerVert* m_sizerVert;
|
||||
ewol::Widget* m_subWidget;
|
||||
int32_t m_idWidget;
|
||||
public:
|
||||
// Constructeur
|
||||
MainWindows(void);
|
||||
~MainWindows(void);
|
||||
// Derived function
|
||||
const char * const GetObjectType(void) { return "MainWindows"; };
|
||||
// Derived function
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
// Derived function
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
320
sources/appl/TestButton.cpp
Normal file
320
sources/appl/TestButton.cpp
Normal file
@ -0,0 +1,320 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/TestButton.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
|
||||
static const char * l_eventChangeExpendX = "event-change-expend-X";
|
||||
static const char * l_eventChangeExpendY = "event-change-expend-Y";
|
||||
static const char * l_eventChangeFillX = "event-change-fill-X";
|
||||
static const char * l_eventChangeFillY = "event-change-fill-Y";
|
||||
static const char * l_eventChangeToggle = "event-change-toggle-mode";
|
||||
static const char * l_eventChangeText = "event-change-text";
|
||||
static const char * l_eventChangeTextToggle = "event-change-text-toggle";
|
||||
static const char * l_eventChangeImage = "event-change-image";
|
||||
static const char * l_eventChangeImageToggle = "event-change-image-toggle";
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestButton"
|
||||
|
||||
TestButton::TestButton(void)
|
||||
{
|
||||
APPL_CRITICAL("Create "__class__" (start)");
|
||||
widget::SizerVert* mySizerVert2 = NULL;
|
||||
widget::SizerHori* mySizerHori = NULL;
|
||||
widget::Button* myButton = NULL;
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
myButton = new widget::Button("Expend X <br/> (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Expend X <br/> (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeExpendX);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Expend Y <br/> (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Expend Y <br/> (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeExpendY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Toggle<br/>(false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Toggle<br/><b>(true)</b>");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeToggle);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Text On toggle state<br/>(false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Text On toggle state<br/><b>(true)</b>");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeTextToggle);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
myButton = new widget::Button("Fill X (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Fill X (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeFillX);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Fill Y (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Fill Y (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeFillY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Image (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Image (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeImage);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Image Toggle (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Image Toggle (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeImageToggle);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Change Text");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeText);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
widget::Spacer* mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(true);
|
||||
mySpacer->SetFillY(false);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0xFF000080);
|
||||
SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(false);
|
||||
mySpacer->SetFillY(true);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x00FF0080);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
m_testWidget = new widget::Button("My <font color=\"#FF0000\">Button</font> <br/> And Some under line<br/> plop <br/> and an other super long line ...");
|
||||
if (NULL != m_testWidget) {
|
||||
m_testWidget->SetExpendX(false);
|
||||
m_testWidget->SetExpendY(false);
|
||||
m_testWidget->SetFillX(false);
|
||||
m_testWidget->SetFillY(false);
|
||||
m_testWidget->RegisterOnEvent(this, ewolEventButtonPressed);
|
||||
m_testWidget->RegisterOnEvent(this, ewolEventButtonDown);
|
||||
m_testWidget->RegisterOnEvent(this, ewolEventButtonUp);
|
||||
m_testWidget->RegisterOnEvent(this, ewolEventButtonEnter);
|
||||
m_testWidget->RegisterOnEvent(this, ewolEventButtonLeave);
|
||||
m_testWidget->RegisterOnEvent(this, ewolEventButtonValue);
|
||||
mySizerHori->SubWidgetAdd(m_testWidget);
|
||||
}
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(false);
|
||||
mySpacer->SetFillY(true);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x0000FF80);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(true);
|
||||
mySpacer->SetFillY(false);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x00FFFF80);
|
||||
SubWidgetAdd(mySpacer);
|
||||
}
|
||||
APPL_CRITICAL("Create "__class__" (end)");
|
||||
}
|
||||
|
||||
|
||||
TestButton::~TestButton(void)
|
||||
{
|
||||
APPL_CRITICAL("Remove "__class__" ...");
|
||||
}
|
||||
|
||||
|
||||
void TestButton::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
widget::SizerVert::OnReceiveMessage(CallerObject, eventId, data);
|
||||
|
||||
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (m_testWidget == CallerObject) {
|
||||
APPL_WARNING("Receive Event from tested Button ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
}
|
||||
if (eventId == l_eventChangeExpendX) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetExpendX(true);
|
||||
} else {
|
||||
m_testWidget->SetExpendX(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeExpendY) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetExpendY(true);
|
||||
} else {
|
||||
m_testWidget->SetExpendY(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeFillX) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetFillX(true);
|
||||
} else {
|
||||
m_testWidget->SetFillX(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeFillY) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetFillY(true);
|
||||
} else {
|
||||
m_testWidget->SetFillY(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeToggle) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetToggleMode(true);
|
||||
} else {
|
||||
m_testWidget->SetToggleMode(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeTextToggle) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetLabelToggle("A stupid very long text on toggle <br/><br/> and on multiple lines");
|
||||
} else {
|
||||
m_testWidget->SetLabelToggle("");
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeImage) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetImage("THEME:GUI:icon.png");
|
||||
m_testWidget->SetImageSize(50);
|
||||
} else {
|
||||
m_testWidget->SetImage("");
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeImageToggle) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetImageToggle("THEME:GUI:icon.png");
|
||||
} else {
|
||||
m_testWidget->SetImageToggle("");
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeText) {
|
||||
if (NULL!=m_testWidget) {
|
||||
static int32_t countTextID = 1;
|
||||
switch (countTextID%10)
|
||||
{
|
||||
case 0:
|
||||
m_testWidget->SetLabel("simple Text");
|
||||
break;
|
||||
case 1:
|
||||
m_testWidget->SetLabel("<left>Align Left</left>");
|
||||
break;
|
||||
case 2:
|
||||
m_testWidget->SetLabel("<right>Align right</right>");
|
||||
break;
|
||||
case 3:
|
||||
m_testWidget->SetLabel("simple Text<br/> With Some Other Lines<br/> and more if you want ...<br/> plop");
|
||||
break;
|
||||
case 4:
|
||||
m_testWidget->SetLabel("simple <bold>Text</bold> with bold");
|
||||
break;
|
||||
case 5:
|
||||
m_testWidget->SetLabel("simple <italic>Text</italic> with italic");
|
||||
break;
|
||||
case 6:
|
||||
m_testWidget->SetLabel("simple <italic><bold>Text</bold></italic> with italic bold");
|
||||
break;
|
||||
case 7:
|
||||
m_testWidget->SetLabel("");
|
||||
break;
|
||||
case 8:
|
||||
m_testWidget->SetLabel("simple <font color=\"#FFFF0088\">Text</font> with colored text");
|
||||
break;
|
||||
default:
|
||||
m_testWidget->SetLabel("My <font color=\"#FF0000\">Button</font> <br/> And Some under line<br/> plop <br/> and an other super long line ...");
|
||||
break;
|
||||
}
|
||||
countTextID++;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestButton::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
widget::SizerVert::OnObjectRemove(removeObject);
|
||||
if (m_testWidget == removeObject) {
|
||||
m_testWidget = NULL;
|
||||
}
|
||||
}
|
34
sources/appl/TestButton.h
Normal file
34
sources/appl/TestButton.h
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_BUTTON_H__
|
||||
#define __TEST_BUTTON_H__
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
|
||||
class TestButton : public widget::SizerVert
|
||||
{
|
||||
private:
|
||||
widget::Button* m_testWidget;
|
||||
public:
|
||||
// Constructeur
|
||||
TestButton(void);
|
||||
virtual ~TestButton(void);
|
||||
// Derived function
|
||||
virtual const char * const GetObjectType(void) { return "TestButton"; };
|
||||
// Derived function
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
// Derived function
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
};
|
||||
|
||||
#endif
|
199
sources/appl/TestButtonColor.cpp
Normal file
199
sources/appl/TestButtonColor.cpp
Normal file
@ -0,0 +1,199 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/TestButtonColor.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
|
||||
static const char * l_eventChangeExpendX = "event-change-expend-X";
|
||||
static const char * l_eventChangeExpendY = "event-change-expend-Y";
|
||||
static const char * l_eventChangeFillX = "event-change-fill-X";
|
||||
static const char * l_eventChangeFillY = "event-change-fill-Y";
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestButton"
|
||||
|
||||
TestButtonColor::TestButtonColor(void)
|
||||
{
|
||||
APPL_DEBUG("CREATE "__class__" ... ");
|
||||
widget::SizerVert* mySizerVert2 = NULL;
|
||||
widget::SizerHori* mySizerHori = NULL;
|
||||
widget::Button* myButton = NULL;
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
myButton = new widget::Button("Expend X (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Expend X (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeExpendX);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Expend Y (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Expend Y (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeExpendY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Fill X (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Fill X (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeFillX);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Fill Y (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Fill Y (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeFillY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
|
||||
widget::Spacer* mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(true);
|
||||
mySpacer->SetFillY(false);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0xFF000080);
|
||||
SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(false);
|
||||
mySpacer->SetFillY(true);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x00FF0080);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
m_testWidget = new widget::ButtonColor(draw::color::olive);
|
||||
if (NULL != m_testWidget) {
|
||||
m_testWidget->SetExpendX(false);
|
||||
m_testWidget->SetExpendY(false);
|
||||
m_testWidget->SetFillX(false);
|
||||
m_testWidget->SetFillY(false);
|
||||
m_testWidget->RegisterOnEvent(this, ewolEventButtonColorChange);
|
||||
mySizerHori->SubWidgetAdd(m_testWidget);
|
||||
}
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(false);
|
||||
mySpacer->SetFillY(true);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x0000FF80);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(true);
|
||||
mySpacer->SetFillY(false);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x00FFFF80);
|
||||
SubWidgetAdd(mySpacer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TestButtonColor::~TestButtonColor(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestButtonColor::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
widget::SizerVert::OnReceiveMessage(CallerObject, eventId, data);
|
||||
|
||||
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (m_testWidget == CallerObject) {
|
||||
APPL_WARNING("Receive Event from tested Button ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
}
|
||||
if (eventId == l_eventChangeExpendX) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetExpendX(true);
|
||||
} else {
|
||||
m_testWidget->SetExpendX(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeExpendY) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetExpendY(true);
|
||||
} else {
|
||||
m_testWidget->SetExpendY(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeFillX) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetFillX(true);
|
||||
} else {
|
||||
m_testWidget->SetFillX(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeFillY) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetFillY(true);
|
||||
} else {
|
||||
m_testWidget->SetFillY(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestButtonColor::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
widget::SizerVert::OnObjectRemove(removeObject);
|
||||
if (m_testWidget == removeObject) {
|
||||
m_testWidget = NULL;
|
||||
}
|
||||
}
|
35
sources/appl/TestButtonColor.h
Normal file
35
sources/appl/TestButtonColor.h
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_BUTTON_COLOR_H__
|
||||
#define __TEST_BUTTON_COLOR_H__
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/ButtonColor.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
|
||||
class TestButtonColor : public widget::SizerVert
|
||||
{
|
||||
private:
|
||||
widget::ButtonColor* m_testWidget;
|
||||
public:
|
||||
// Constructeur
|
||||
TestButtonColor(void);
|
||||
virtual ~TestButtonColor(void);
|
||||
// Derived function
|
||||
virtual const char * const GetObjectType(void) { return "TestButton"; };
|
||||
// Derived function
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
// Derived function
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
};
|
||||
|
||||
#endif
|
0
sources/appl/TestCheckBox.cpp
Normal file
0
sources/appl/TestCheckBox.cpp
Normal file
0
sources/appl/TestCheckBox.h
Normal file
0
sources/appl/TestCheckBox.h
Normal file
0
sources/appl/TestEntry.cpp
Normal file
0
sources/appl/TestEntry.cpp
Normal file
0
sources/appl/TestEntry.h
Normal file
0
sources/appl/TestEntry.h
Normal file
0
sources/appl/TestImage.cpp
Normal file
0
sources/appl/TestImage.cpp
Normal file
0
sources/appl/TestImage.h
Normal file
0
sources/appl/TestImage.h
Normal file
257
sources/appl/TestLabel.cpp
Normal file
257
sources/appl/TestLabel.cpp
Normal file
@ -0,0 +1,257 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/TestLabel.h>
|
||||
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
|
||||
static const char * l_eventChangeExpendX = "event-change-expend-X";
|
||||
static const char * l_eventChangeExpendY = "event-change-expend-Y";
|
||||
static const char * l_eventChangeFillX = "event-change-fill-X";
|
||||
static const char * l_eventChangeFillY = "event-change-fill-Y";
|
||||
static const char * l_eventChangeMaxSize = "event-change-maxSize";
|
||||
static const char * l_eventChangeLabel = "event-change-label";
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestButton"
|
||||
|
||||
TestLabel::TestLabel(void) :
|
||||
m_labelId(0)
|
||||
{
|
||||
APPL_DEBUG("CREATE "__class__" ... ");
|
||||
widget::SizerVert* mySizerVert2 = NULL;
|
||||
widget::SizerHori* mySizerHori = NULL;
|
||||
widget::Button* myButton = NULL;
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
myButton = new widget::Button("Expend X (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Expend X (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeExpendX);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Expend Y (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Expend Y (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeExpendY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Fill X (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Fill X (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeFillX);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Fill Y (false)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("Fill Y (true)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeFillY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("maxSize (-1,-1)");
|
||||
if (NULL != myButton) {
|
||||
myButton->SetToggleMode(true);
|
||||
myButton->SetLabelToggle("maxSize (400,-1)");
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonValue, l_eventChangeMaxSize);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Next Label");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeLabel);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
|
||||
widget::Spacer* mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(true);
|
||||
mySpacer->SetFillY(false);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0xFF000080);
|
||||
SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(false);
|
||||
mySpacer->SetFillY(true);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x00FF0080);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
m_testWidget = new widget::Label("Basic label");
|
||||
if (NULL != m_testWidget) {
|
||||
m_testWidget->SetExpendX(false);
|
||||
m_testWidget->SetExpendY(false);
|
||||
m_testWidget->SetFillX(false);
|
||||
m_testWidget->SetFillY(false);
|
||||
//m_testWidget->RegisterOnEvent(this, ewolEventButtonColorChange);
|
||||
mySizerHori->SubWidgetAdd(m_testWidget);
|
||||
}
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(false);
|
||||
mySpacer->SetFillY(true);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x0000FF80);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(true);
|
||||
mySpacer->SetFillY(false);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x00FFFF80);
|
||||
SubWidgetAdd(mySpacer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TestLabel::~TestLabel(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TestLabel::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
widget::SizerVert::OnReceiveMessage(CallerObject, eventId, data);
|
||||
|
||||
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (m_testWidget == CallerObject) {
|
||||
APPL_WARNING("Receive Event from tested Button ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
}
|
||||
if (eventId == l_eventChangeExpendX) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetExpendX(true);
|
||||
} else {
|
||||
m_testWidget->SetExpendX(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeExpendY) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetExpendY(true);
|
||||
} else {
|
||||
m_testWidget->SetExpendY(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeFillX) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetFillX(true);
|
||||
} else {
|
||||
m_testWidget->SetFillX(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeFillY) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetFillY(true);
|
||||
} else {
|
||||
m_testWidget->SetFillY(false);
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeMaxSize) {
|
||||
if (NULL!=m_testWidget) {
|
||||
if (data=="1") {
|
||||
m_testWidget->SetMaxSize(vec2(400,-1));
|
||||
} else {
|
||||
m_testWidget->SetMaxSize(vec2(-1,-1));
|
||||
}
|
||||
}
|
||||
} else if (eventId == l_eventChangeLabel) {
|
||||
if (NULL!=m_testWidget) {
|
||||
m_labelId++;
|
||||
switch(m_labelId)
|
||||
{
|
||||
default:
|
||||
m_labelId=0;
|
||||
case 0:
|
||||
m_testWidget->SetLabel("Basic label");
|
||||
break;
|
||||
case 1:
|
||||
m_testWidget->SetLabel("Basic <bold>label</bold>");
|
||||
break;
|
||||
case 2:
|
||||
m_testWidget->SetLabel("<center>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#FF0000\">Jusqu'à ce moment elle <b>n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement : <br/> Mais non!<br/> mais non!<br/> Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
"</center>\n");
|
||||
break;
|
||||
case 3:
|
||||
m_testWidget->SetLabel("<left>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#0F0\">Jusqu'à ce moment elle <b>n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement :<br/> Mais non!<br/> mais non!<br/> Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
"</left>\n");
|
||||
break;
|
||||
case 4:
|
||||
m_testWidget->SetLabel("<right>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#00F\">Jusqu'à ce moment elle<b> n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement :<br/> Mais non! <br/> mais non!<br/> Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
"</right>\n");
|
||||
break;
|
||||
case 5:
|
||||
m_testWidget->SetLabel("<justify>\n"
|
||||
" Un jour Cosette se <b>regarda</b> par hasard dans son miroir et se dit: Tiens! <b>Il lui semblait presque <i>qu'elle était jolie.</i></b> Ceci la jeta dans un trouble singulier. <font color=\"#FF0\">Jusqu'à ce moment elle <b>n'avait</b> point <i>songé</i> à sa figure.</font> Elle se voyait dans son miroir, mais elle ne s'y regardait pas. Et puis, on lui avait souvent dit qu'elle était laide;<br/> Jean Valjean seul disait doucement :<br/> Mais non!<br/> mais non!<br/> Quoi qu'il en fut, Cosette s'était toujours crue laide, et avait grandi dans cette idée avec la résignation facile de l'enfance. Voici que tout d'un coup son miroir lui disait comme Jean Valjean : Mais non! Elle ne dormit pas de la nuit. Si j'étais jolie ? pensait-elle, comme cela serait drole que je fusse jolie! Et elle se rappelait celles de ses compagnes dont la beauté faisait effet dans le couvent, et elle se disait : Comment! je serais comme mademoiselle une telle!\n"
|
||||
"</justify>\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestLabel::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
widget::SizerVert::OnObjectRemove(removeObject);
|
||||
if (m_testWidget == removeObject) {
|
||||
m_testWidget = NULL;
|
||||
}
|
||||
}
|
41
sources/appl/TestLabel.h
Normal file
41
sources/appl/TestLabel.h
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_LABEL_H__
|
||||
#define __TEST_LABEL_H__
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
|
||||
class TestLabel : public widget::SizerVert
|
||||
{
|
||||
private:
|
||||
widget::Label* m_testWidget;
|
||||
int32_t m_labelId;
|
||||
public:
|
||||
/**
|
||||
* @brief Constructeur
|
||||
*/
|
||||
TestLabel(void);
|
||||
/**
|
||||
* @brief Destructor
|
||||
*/
|
||||
virtual ~TestLabel(void);
|
||||
// Derived function
|
||||
virtual const char * const GetObjectType(void) { return "TestButton"; };
|
||||
// Derived function
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
// Derived function
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
};
|
||||
|
||||
#endif
|
0
sources/appl/TestProgressBar.cpp
Normal file
0
sources/appl/TestProgressBar.cpp
Normal file
0
sources/appl/TestProgressBar.h
Normal file
0
sources/appl/TestProgressBar.h
Normal file
301
sources/appl/TestScene.cpp
Normal file
301
sources/appl/TestScene.cpp
Normal file
@ -0,0 +1,301 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/TestScene.h>
|
||||
|
||||
#include <etk/tool.h>
|
||||
#include <ewol/widget/Button.h>
|
||||
#include <ewol/widget/CheckBox.h>
|
||||
#include <ewol/widget/SizerHori.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <ewol/widget/Entry.h>
|
||||
#include <ewol/widget/List.h>
|
||||
#include <ewol/widget/ContextMenu.h>
|
||||
#include <ewol/widget/PopUp.h>
|
||||
#include <ewol/widget/Slider.h>
|
||||
#include <ewol/widget/Spacer.h>
|
||||
#include <ewol/widget/Menu.h>
|
||||
#include <ewol/widget/meta/FileChooser.h>
|
||||
#include <ewol/widget/meta/Parameter.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
static const char * l_eventAddBox = "event-add-box";
|
||||
static const char * l_eventAddSphere = "event-add-sphere";
|
||||
static const char * l_eventRotationX = "event-rotation-X";
|
||||
static const char * l_eventRotationY = "event-rotation-Y";
|
||||
static const char * l_eventRotationZ = "event-rotation-Z";
|
||||
static const char * l_eventRotation0 = "event-rotation-0";
|
||||
static const char * l_eventLunch = "event-lunch";
|
||||
static const char * l_eventChangeTimeSpeed2 = "event-speed2";
|
||||
static const char * l_eventChangeTimeSpeed0 = "event-speed0.5";
|
||||
static const char * l_eventChangeTimeSpeed1 = "event-speed1";
|
||||
static const char * l_eventUp = "event-up";
|
||||
static const char * l_eventDown = "event-down";
|
||||
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "TestScene"
|
||||
|
||||
TestScene::TestScene(void)
|
||||
{
|
||||
m_ground = new game::Element("DATA:grass.obj");
|
||||
m_gameEngine.AddElement(m_ground, true);
|
||||
|
||||
APPL_CRITICAL("Create "__class__" (start)");
|
||||
widget::SizerVert* mySizerVert2 = NULL;
|
||||
widget::SizerHori* mySizerHori = NULL;
|
||||
widget::Button* myButton = NULL;
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
myButton = new widget::Button("Add Box");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventAddBox);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Add Sphere");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventAddSphere);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Rotation X");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationX);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Rotation Y");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationY);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Rotation Z");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotationZ);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("Rotation -");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventRotation0);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("UP");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventUp);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("DOWN");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventDown);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
myButton = new widget::Button("lunch object");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventLunch);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("1x speed");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed1);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("0.5x speed");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed0);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
myButton = new widget::Button("2x speed");
|
||||
if (NULL != myButton) {
|
||||
myButton->RegisterOnEvent(this, ewolEventButtonPressed, l_eventChangeTimeSpeed2);
|
||||
mySizerHori->SubWidgetAdd(myButton);
|
||||
}
|
||||
|
||||
widget::Spacer* mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(true);
|
||||
mySpacer->SetFillY(false);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0xFF000080);
|
||||
SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
mySizerHori = new widget::SizerHori();
|
||||
if (NULL == mySizerHori) {
|
||||
APPL_DEBUG("Allocation error mySizerHori");
|
||||
return;
|
||||
}
|
||||
SubWidgetAdd(mySizerHori);
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(false);
|
||||
mySpacer->SetFillY(true);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x00FF0080);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
m_testWidget = new widget::Scene(&m_gameEngine);
|
||||
if (NULL != m_testWidget) {
|
||||
m_testWidget->SetExpendX(true);
|
||||
m_testWidget->SetExpendY(true);
|
||||
m_testWidget->SetFillX(true);
|
||||
m_testWidget->SetFillY(true);
|
||||
mySizerHori->SubWidgetAdd(m_testWidget);
|
||||
}
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(false);
|
||||
mySpacer->SetFillY(true);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x0000FF80);
|
||||
mySizerHori->SubWidgetAdd(mySpacer);
|
||||
}
|
||||
|
||||
mySpacer = new widget::Spacer();
|
||||
if (NULL != mySpacer) {
|
||||
mySpacer->SetExpendX(false);
|
||||
mySpacer->SetExpendY(false);
|
||||
mySpacer->SetFillX(true);
|
||||
mySpacer->SetFillY(false);
|
||||
mySpacer->SetSize(10);
|
||||
mySpacer->SetColor(0x00FFFF80);
|
||||
SubWidgetAdd(mySpacer);
|
||||
}
|
||||
// et other property on the Engine :
|
||||
m_gameEngine.AddGravity(game::gravityEarth);
|
||||
|
||||
|
||||
|
||||
APPL_CRITICAL("Create "__class__" (end)");
|
||||
}
|
||||
|
||||
|
||||
TestScene::~TestScene(void)
|
||||
{
|
||||
APPL_CRITICAL("Remove "__class__" ...");
|
||||
}
|
||||
|
||||
|
||||
#include <ewol/game/Element.h>
|
||||
|
||||
vec3 baseRotationVect;
|
||||
vec3 baseMove;
|
||||
class stupidCube : public game::Element
|
||||
{
|
||||
public:
|
||||
stupidCube(float poidKg=0.0f) : game::Element("DATA:cube.obj")
|
||||
{
|
||||
m_mass = poidKg;
|
||||
};
|
||||
|
||||
// herited methode
|
||||
virtual bool ArtificialIntelligence(int32_t deltaMicroSecond)
|
||||
{
|
||||
if (m_mass == 0.0f) {
|
||||
if (baseRotationVect != vec3(0,0,0) ) {
|
||||
Rotate(baseRotationVect, 0.01);
|
||||
}
|
||||
if (baseMove != vec3(0,0,0) ) {
|
||||
Translate(baseMove);
|
||||
baseMove = vec3(0,0,0);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void TestScene::OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data)
|
||||
{
|
||||
widget::SizerVert::OnReceiveMessage(CallerObject, eventId, data);
|
||||
|
||||
//APPL_INFO("Receive Event from the main windows ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
if (m_testWidget == CallerObject) {
|
||||
APPL_WARNING("Receive Event from tested Scene ... : \"" << eventId << "\" ==> data=\"" << data << "\"" );
|
||||
}
|
||||
if (eventId == l_eventAddBox) {
|
||||
stupidCube * tmpp = new stupidCube();
|
||||
static bool firstTime = true;
|
||||
if (firstTime==false) {
|
||||
vec3 newPos = vec3(etk::tool::frand(-20,20),etk::tool::frand(-20,20),etk::tool::frand(1,8));
|
||||
APPL_DEBUG("add a box at the pos : " << newPos);
|
||||
tmpp->Translate(newPos);
|
||||
}
|
||||
firstTime = false;
|
||||
m_gameEngine.AddElement(tmpp, true);
|
||||
} else if (eventId == l_eventAddSphere) {
|
||||
if (NULL!=m_testWidget) {
|
||||
|
||||
}
|
||||
} else if (eventId == l_eventUp) {
|
||||
baseMove = vec3(0.1,0,0);
|
||||
} else if (eventId == l_eventDown) {
|
||||
baseMove = vec3(-0.1,0,0);
|
||||
} else if (eventId == l_eventRotationX) {
|
||||
baseRotationVect = vec3(1,0,0);
|
||||
} else if (eventId == l_eventRotationY) {
|
||||
baseRotationVect = vec3(0,1,0);
|
||||
} else if (eventId == l_eventRotationZ) {
|
||||
baseRotationVect = vec3(0,0,1);
|
||||
} else if (eventId == l_eventRotation0) {
|
||||
baseRotationVect = vec3(0,0,0);
|
||||
} else if (eventId == l_eventLunch) {
|
||||
stupidCube * tmpp = new stupidCube(250);
|
||||
tmpp->SetSpeed(vec3(10,10,50));
|
||||
m_gameEngine.AddElement(tmpp, true);
|
||||
} else if (eventId == l_eventChangeTimeSpeed1) {
|
||||
if (NULL!=m_testWidget) {
|
||||
m_testWidget->SetRatioTime(1);
|
||||
}
|
||||
} else if (eventId == l_eventChangeTimeSpeed0) {
|
||||
if (NULL!=m_testWidget) {
|
||||
m_testWidget->SetRatioTime(0.5);
|
||||
}
|
||||
} else if (eventId == l_eventChangeTimeSpeed2) {
|
||||
if (NULL!=m_testWidget) {
|
||||
m_testWidget->SetRatioTime(2);
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void TestScene::OnObjectRemove(ewol::EObject * removeObject)
|
||||
{
|
||||
widget::SizerVert::OnObjectRemove(removeObject);
|
||||
if (m_testWidget == removeObject) {
|
||||
m_testWidget = NULL;
|
||||
}
|
||||
}
|
37
sources/appl/TestScene.h
Normal file
37
sources/appl/TestScene.h
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __TEST_SCENE_H__
|
||||
#define __TEST_SCENE_H__
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <ewol/widget/Widget.h>
|
||||
#include <ewol/widget/Scene.h>
|
||||
#include <ewol/widget/SizerVert.h>
|
||||
#include <ewol/game/Engine.h>
|
||||
|
||||
class TestScene : public widget::SizerVert
|
||||
{
|
||||
private:
|
||||
game::Element* m_ground;
|
||||
//game::Element m_sky;
|
||||
game::Engine m_gameEngine;
|
||||
widget::Scene* m_testWidget;
|
||||
public:
|
||||
// Constructeur
|
||||
TestScene(void);
|
||||
virtual ~TestScene(void);
|
||||
// Derived function
|
||||
virtual const char * const GetObjectType(void) { return "TestButton"; };
|
||||
// Derived function
|
||||
virtual void OnReceiveMessage(ewol::EObject * CallerObject, const char * eventId, etk::UString data);
|
||||
// Derived function
|
||||
virtual void OnObjectRemove(ewol::EObject * removeObject);
|
||||
};
|
||||
|
||||
#endif
|
0
sources/appl/TestSlider.cpp
Normal file
0
sources/appl/TestSlider.cpp
Normal file
0
sources/appl/TestSlider.h
Normal file
0
sources/appl/TestSlider.h
Normal file
107
sources/appl/init.cpp
Normal file
107
sources/appl/init.cpp
Normal file
@ -0,0 +1,107 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD v3 (see license file)
|
||||
*/
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/UString.h>
|
||||
#include <etk/os/FSNode.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/config.h>
|
||||
#include <ewol/commandLine.h>
|
||||
#include <ewol/eObject/EObject.h>
|
||||
#include <ewol/widget/WidgetManager.h>
|
||||
|
||||
#include <appl/Debug.h>
|
||||
#include <appl/MainWindows.h>
|
||||
|
||||
MainWindows * basicWindows = NULL;
|
||||
|
||||
|
||||
/**
|
||||
* @brief Main of the program (This can be set in every case, but it is not used in Andoid...).
|
||||
* @param std IO
|
||||
* @return std IO
|
||||
*/
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
// only one things to do :
|
||||
return ewol::Run(argc, argv);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief main application function Initialisation
|
||||
*/
|
||||
void APP_Init(void)
|
||||
{
|
||||
#ifdef __TARGET_OS__Linux
|
||||
#ifdef MODE_RELEASE
|
||||
APPL_INFO("==> Init "PROJECT_NAME" (START) (Linux) (Release)");
|
||||
#else
|
||||
APPL_INFO("==> Init "PROJECT_NAME" (START) (Linux) (Debug)");
|
||||
#endif
|
||||
#else
|
||||
#ifdef MODE_RELEASE
|
||||
APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Release)");
|
||||
#else
|
||||
APPL_INFO("==> Init "PROJECT_NAME" (START) (Android) (Debug)");
|
||||
#endif
|
||||
#endif
|
||||
etk::InitDefaultFolder(PROJECT_NAME);
|
||||
ewol::ChangeSize(ivec2(800, 300));
|
||||
#ifdef __TARGET_OS__Android
|
||||
ewol::config::FontSetDefault("FreeSerif", 19);
|
||||
#else
|
||||
ewol::config::FontSetDefault("FreeSerif", 14);
|
||||
#endif
|
||||
|
||||
basicWindows = new MainWindows();
|
||||
|
||||
if (NULL == basicWindows) {
|
||||
APPL_ERROR("Can not allocate the basic windows");
|
||||
ewol::Stop();
|
||||
return;
|
||||
}
|
||||
// create the specific windows
|
||||
ewol::WindowsSet(basicWindows);
|
||||
|
||||
|
||||
// add files
|
||||
APPL_INFO("show list of command line input : ");
|
||||
for( int32_t iii=0 ; iii<ewol::commandLine::Size(); iii++) {
|
||||
APPL_INFO("parameter [" << iii << "] is \"" << ewol::commandLine::Get(iii) << "\"");
|
||||
}
|
||||
|
||||
APPL_INFO("==> Init "PROJECT_NAME" (END)");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief the system request the icon file name :
|
||||
*/
|
||||
etk::UString APP_Icon(void)
|
||||
{
|
||||
etk::UString bitmapFile("DATA:iconHuman.bmp");
|
||||
return bitmapFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief main application function Un-Initialisation
|
||||
*/
|
||||
void APP_UnInit(void)
|
||||
{
|
||||
APPL_INFO("==> Un-Init "PROJECT_NAME" (START)");
|
||||
// Remove windows :
|
||||
ewol::WindowsSet(NULL);
|
||||
|
||||
if (NULL != basicWindows) {
|
||||
delete(basicWindows);
|
||||
basicWindows = NULL;
|
||||
}
|
||||
APPL_INFO("==> Un-Init "PROJECT_NAME" (END)");
|
||||
}
|
||||
|
19
sources/file.mk
Normal file
19
sources/file.mk
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
|
||||
###############################################################################
|
||||
### Files Listes ###
|
||||
###############################################################################
|
||||
|
||||
# Globals debug tool:
|
||||
FILE_LIST:= appl/Debug.cpp \
|
||||
appl/init.cpp \
|
||||
appl/MainWindows.cpp \
|
||||
appl/TestButton.cpp \
|
||||
appl/TestButtonColor.cpp \
|
||||
appl/TestLabel.cpp \
|
||||
appl/TestScene.cpp
|
||||
|
||||
LOCAL_COPY_FOLDERS := ../data/icon.*:theme/default \
|
||||
../data/cube.*: \
|
||||
../data/grass.*: \
|
||||
../data/stone*: \
|
Loading…
Reference in New Issue
Block a user