[DEV] exception idea ==> but not supported on Android...
This commit is contained in:
69
test/Main.cpp
Normal file
69
test/Main.cpp
Normal file
@@ -0,0 +1,69 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD 3 clauses (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <ewol/ewol.h>
|
||||
#include <ewol/context/commandLine.h>
|
||||
|
||||
#include <appl/debug.h>
|
||||
#include <appl/Windows.h>
|
||||
#include <ewol/object/Object.h>
|
||||
#include <ewol/widget/Manager.h>
|
||||
#include <ewol/context/Context.h>
|
||||
#include <appl/widget/VectorDisplay.h>
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
*/
|
||||
bool APP_Init(ewol::Context& _context) {
|
||||
APPL_INFO("==> Init APPL (START) [" << ewol::getBoardType() << "] (" << ewol::getCompilationMode() << ")");
|
||||
|
||||
// TODO : Remove this : Move if in the windows properties
|
||||
_context.setSize(vec2(800, 600));
|
||||
|
||||
// select internal data for font ...
|
||||
_context.getFontDefault().setUseExternal(true);
|
||||
_context.getFontDefault().set("FreeSerif;DejaVuSansMono", 19);
|
||||
|
||||
appl::widget::VectorDisplay::init(_context.getWidgetManager());
|
||||
|
||||
ewol::widget::Windows* basicWindows = new appl::Windows();
|
||||
// create the specific windows
|
||||
_context.setWindows(basicWindows);
|
||||
APPL_INFO("==> Init APPL (END)");
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief main application function Un-Initialisation
|
||||
*/
|
||||
void APP_UnInit(ewol::Context& _context) {
|
||||
APPL_INFO("==> Un-Init APPL (START)");
|
||||
// Nothing to do (main windows will be remove after this call if not done...
|
||||
ewol::widget::Windows* basicWindows = _context.getWindows();
|
||||
|
||||
if (NULL != basicWindows) {
|
||||
basicWindows->removeObject();
|
||||
basicWindows = NULL;
|
||||
}
|
||||
_context.setWindows(NULL);
|
||||
APPL_INFO("==> Un-Init APPL (END)");
|
||||
}
|
||||
|
||||
14
test/Main.h
Normal file
14
test/Main.h
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD 3 clauses (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __APPL_MAIN_H__
|
||||
#define __APPL_MAIN_H__
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
71
test/Windows.cpp
Normal file
71
test/Windows.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD 3 clauses (see license file)
|
||||
*/
|
||||
|
||||
#include <ewol/ewol.h>
|
||||
#include <test/debug.h>
|
||||
#include <test/Windows.h>
|
||||
#include <ewol/widget/Label.h>
|
||||
#include <etk/tool.h>
|
||||
|
||||
#undef __class__
|
||||
#define __class__ "Windows"
|
||||
|
||||
static const char* const g_eventPlay1 = "appl-play-1";
|
||||
static const char* const g_eventPlay2 = "appl-play-2";
|
||||
|
||||
appl::Windows::Windows(void) :
|
||||
m_composer(NULL) {
|
||||
setTitle("example 001_HelloWord");
|
||||
std::string composition = std::string("");
|
||||
composition += "<sizer mode='vert'>\n";
|
||||
composition += " <sizer mode='hori'>\n";
|
||||
composition += " <button name='bt-play1'>\n";
|
||||
composition += " <label>\n";
|
||||
composition += " Play 1\n";
|
||||
composition += " </label>\n";
|
||||
composition += " </button>\n";
|
||||
composition += " <button name='bt-play2'>\n";
|
||||
composition += " <label>\n";
|
||||
composition += " Play 2\n";
|
||||
composition += " </label>\n";
|
||||
composition += " </button>\n";
|
||||
composition += " </sizer>\n";
|
||||
composition += " <spacer expand='true' fill='true'/>\n";
|
||||
composition += "</sizer>\n";
|
||||
|
||||
m_composer = new ewol::widget::Composer(ewol::widget::Composer::String, composition);
|
||||
if (m_composer == NULL) {
|
||||
APPL_CRITICAL(" An error occured ... in the windows creatrion ...");
|
||||
return;
|
||||
}
|
||||
setSubWidget(m_composer);
|
||||
m_composer->registerOnEventNameWidget(this, "bt-play1", "pressed", g_eventPlay1);
|
||||
m_composer->registerOnEventNameWidget(this, "bt-play2", "pressed", g_eventPlay2);
|
||||
}
|
||||
|
||||
|
||||
void appl::Windows::onObjectRemove(ewol::Object * _removeObject) {
|
||||
if (_removeObject == m_composer) {
|
||||
m_composer = NULL;
|
||||
markToRedraw();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void appl::Windows::onReceiveMessage(const ewol::object::Message& _msg) {
|
||||
if (_msg.getMessage() == g_eventChangeValues) {
|
||||
|
||||
return;
|
||||
}
|
||||
if (_msg.getMessage() == g_eventAutoMode) {
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
28
test/Windows.h
Normal file
28
test/Windows.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD 3 clauses (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __APPL_WINDOWS_H__
|
||||
#define __APPL_WINDOWS_H__
|
||||
|
||||
#include <ewol/widget/Windows.h>
|
||||
#include <ewol/widget/Composer.h>
|
||||
|
||||
namespace appl {
|
||||
class Windows : public ewol::widget::Windows {
|
||||
private:
|
||||
ewol::widget::Composer* m_composer;
|
||||
public:
|
||||
Windows(void);
|
||||
public: // herited functions
|
||||
virtual void onObjectRemove(ewol::Object * _removeObject);
|
||||
virtual void onReceiveMessage(const ewol::object::Message& _msg);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
12
test/debug.cpp
Normal file
12
test/debug.cpp
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD 3 clauses (see license file)
|
||||
*/
|
||||
|
||||
|
||||
#include <appl/debug.h>
|
||||
|
||||
const char * applLogName = "example ";
|
||||
29
test/debug.h
Normal file
29
test/debug.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @author Edouard DUPIN
|
||||
*
|
||||
* @copyright 2010, Edouard DUPIN, all right reserved
|
||||
*
|
||||
* @license BSD 3 clauses (see license file)
|
||||
*/
|
||||
|
||||
#ifndef __APPL_DEBUG_H__
|
||||
#define __APPL_DEBUG_H__
|
||||
|
||||
#include <etk/types.h>
|
||||
#include <etk/debugGeneric.h>
|
||||
|
||||
extern const char * applLogName;
|
||||
|
||||
#define APPL_CRITICAL(data) ETK_CRITICAL(applLogName, data)
|
||||
#define APPL_WARNING(data) ETK_WARNING(applLogName, data)
|
||||
#define APPL_ERROR(data) ETK_ERROR(applLogName, data)
|
||||
#define APPL_INFO(data) ETK_INFO(applLogName, data)
|
||||
#define APPL_DEBUG(data) ETK_DEBUG(applLogName, data)
|
||||
#define APPL_VERBOSE(data) ETK_VERBOSE(applLogName, data)
|
||||
#define APPL_ASSERT(cond, data) ETK_ASSERT(applLogName, cond, data)
|
||||
#define APPL_CHECK_INOUT(cond) ETK_CHECK_INOUT(applLogName, cond)
|
||||
#define APPL_TODO(cond) ETK_TODO(applLogName, cond)
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user