[DEV] continue integration

This commit is contained in:
Edouard DUPIN 2015-07-15 21:03:01 +02:00
parent 7c605538ca
commit ca11f9e116
20 changed files with 633 additions and 368 deletions

View File

@ -0,0 +1,131 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <etk/types.h>
#include <gale/Application.h>
#include <gale/context/Context.h>
gale::Application::Application() {
GALE_INFO("Constructor Gale Application");
}
gale::Application::~Application() {
GALE_INFO("destructor of Gale Application");
}
void gale::Application::onCreate(gale::Context& _context) {
GALE_INFO("Create Gale Application");
}
void gale::Application::onStart(gale::Context& _context) {
GALE_INFO("Start Gale Application");
}
void gale::Application::onResume(gale::Context& _context) {
GALE_INFO("Resume Gale Application");
}
void gale::Application::onRun(gale::Context& _context) {
GALE_INFO("Run Gale Application");
}
void gale::Application::onPause(gale::Context& _context) {
GALE_INFO("Pause Gale Application");
}
void gale::Application::onStop(gale::Context& _context) {
GALE_INFO("Stop Gale Application");
}
void gale::Application::onDestroy(gale::Context& _context) {
GALE_INFO("Destroy Gale Application");
}
void gale::Application::exit(int32_t _value) {
GALE_INFO("Exit Requested");
}
void gale::Application::onPointer(enum gale::key::type _type, int32_t _pointerID, const vec2& _pos, gale::key::status _state) {
}
void gale::Application::onKeyboard(gale::key::Special& _special,
enum gale::key::keyboard _type,
char32_t _value,
gale::key::status _state) {
}
void gale::Application::keyboardShow() {
}
void gale::Application::keyboardHide() {
}
void gale::Application::onResize(const vec2& _size) {
}
void gale::Application::setSize(const vec2& _size) {
}
vec2 gale::Application::getSize() const {
return vec2(0,0);
}
void gale::Application::onMovePosition(const vec2& _size) {
}
void gale::Application::setPosition(const vec2& _size) {
}
vec2 gale::Application::getPosition() const {
return vec2(0,0);
}
void gale::Application::setTitle(const std::string& _title) {
}
std::string gale::Application::getTitle() {
return "";
}
void gale::Application::setIcon(const std::string& _iconFile) {
}
std::string gale::Application::getIcon() {
return "";
}
void gale::Application::setCursor(enum gale::context::cursor _newCursor) {
}
enum gale::context::cursor gale::Application::getCursor() {
return gale::context::cursor_arrow;
}
void gale::Application::openURL(const std::string& _url) {
}
void gale::Application::setOrientation(enum gale::orientation _orientation) {
}
enum gale::orientation gale::Application::getOrientation() {
return gale::orientation_screenAuto;
}

View File

@ -9,40 +9,173 @@
#ifndef __GALE_CONTEXT_APPLICATION_H__ #ifndef __GALE_CONTEXT_APPLICATION_H__
#define __GALE_CONTEXT_APPLICATION_H__ #define __GALE_CONTEXT_APPLICATION_H__
#include <memory>
#include <etk/types.h>
#include <etk/math/Vector2D.h>
#include <gale/orientation.h>
#include <gale/key/status.h>
#include <gale/key/type.h>
#include <gale/key/Special.h>
#include <gale/context/cursor.h>
namespace gale { namespace gale {
class Context; class Context;
class Application : public std::enable_shared_from_this<gale::Application> { class Application : public std::enable_shared_from_this<gale::Application> {
public: public:
Application() {}; Application();
virtual ~Application() {}; virtual ~Application();
public: public:
/** /**
* @brief Initialize the Application * @brief The application is created.
* @param[in] _context Current gale context * @param[in] _context Current gale context.
* @param[in] _initId Initialzation ID (start at 0 and will increment wile returning true)
* @return true if the init is fisnished
* @return false need more inits
*/ */
virtual bool init(gale::Context& _context, size_t _initId) = 0; virtual void onCreate(gale::Context& _context);
/** /**
* @brief The application is ended ==> call this function before ended * @brief The application is started.
* @param[in] _context Current gale context.
*/ */
virtual void unInit(gale::Context& _context) = 0; virtual void onStart(gale::Context& _context);
/**
* @brief The application is resumed (now visible).
* @param[in] _context Current gale context.
*/
virtual void onResume(gale::Context& _context);
/**
* @brief Call periodicly the application to draw all it is needed to draw ... (access on the openGL Context).
* @param[in] _context Current gale context.
*/
virtual void onRun(gale::Context& _context);
/**
* @brief The application is Hide / not visible.
* @param[in] _context Current gale context.
*/
virtual void onPause(gale::Context& _context);
/**
* @brief The application is stopped.
* @param[in] _context Current gale context.
*/
virtual void onStop(gale::Context& _context);
/**
* @brief The application is remoed (call destructor just adter it.).
* @param[in] _context Current gale context.
*/
virtual void onDestroy(gale::Context& _context);
/**
* @brief Exit the application (not availlable on IOs, ==> the user will not understand the comportement. He will think the application crash)
* @param[in] _value value to return on the program
*/
virtual void exit(int32_t _value);
public: public:
/** /**
* @brief Event on an input (finger, mouse, stilet) * @brief Get touch/mouse/... event.
* @param[in] _event Event properties * @param[in] _type Type of pointer event
* @param[in] _pointerID Pointer id of the touch event.
* @param[in] _pos Position of the event (can be <0 if out of window).
* @param[in] _state Key state (up/down/move)
*/ */
virtual void onEventInput(const ewol::event::Input& _event); virtual void onPointer(enum gale::key::type _type, int32_t _pointerID, const vec2& _pos, gale::key::status _state);
/** /**
* @brief Entry event. * @brief Get keyborad value input.
* represent the physical event : * @param[in] _special Current special key status (ctrl/alt/shift ...).
* - Keyboard (key event and move event) * @param[in] _type Type of the event.
* - Accelerometer * @param[in] _value Unicode value of the char pushed (viable only if _type==gale::key::keyboard_char).
* - Joystick * @param[in] _state State of the key (up/down/upRepeate/downRepeate)
* @param[in] _event Event properties
*/ */
virtual void onEventEntry(const ewol::event::Entry& _event); virtual void onKeyboard(gale::key::Special& _special,
enum gale::key::keyboard _type,
char32_t _value,
gale::key::status _state);
/**
* @brief Show the virtal keyboard (if possible : only on iOs/Android)
*/
virtual void keyboardShow();
/**
* @brief Hide the virtal keyboard (if possible : only on iOs/Android)
*/
virtual void keyboardHide();
public:
/**
* @brief Event generated when user change the size of the window.
* @param[in] _size New size of the window.
*/
virtual void onResize(const vec2& _size);
/**
* @brief Set the size of the window (if possible: Android and Ios does not support it)
* @param[in] _size New size of the window.
* @return
*/
virtual void setSize(const vec2& _size);
/**
* @brief Get the size of the window.
* @return Current size of the window.
*/
virtual vec2 getSize() const;
public:
/**
* @brief Event generated when user change the position of the window.
* @param[in] _size New position of the window.
*/
virtual void onMovePosition(const vec2& _size);
/**
* @brief Set the position of the window (if possible: Android and Ios does not support it)
* @param[in] _size New position of the window.
*/
virtual void setPosition(const vec2& _size);
/**
* @brief Get the position of the window.
* @return Current position of the window.
*/
virtual vec2 getPosition() const;
public:
/**
* @brief Set the title of the application
* @param[in] _title New title to set at the application (if possible: Android and Ios does not support it)
*/
virtual void setTitle(const std::string& _title);
/**
* @brief Get the current title of the application
* @return Current title
*/
virtual std::string getTitle();
public:
/**
* @brief set the Icon of the application.
* @param[in] _iconFile File name icon (.bmp/.png).
*/
virtual void setIcon(const std::string& _iconFile);
/**
* @brief Get the current filename of the application.
* @return Filename of the icon.
*/
virtual std::string getIcon();
public:
/**
* @brief Set the cursor type.
* @param[in] _newCursor Selected cursor.
*/
virtual void setCursor(enum gale::context::cursor _newCursor);
/**
* @brief Get the cursor type.
* @return the current cursor.
*/
virtual enum gale::context::cursor getCursor();
public:
/**
* @brief Open an URL on an internal brother.
* @param[in] _url URL to open.
*/
virtual void openURL(const std::string& _url);
public:
/**
* @brief set the screen orientation (if possible : only on iOs/Android)
* @param[in] _orientation New orientation.
*/
virtual void setOrientation(enum gale::orientation _orientation);
/**
* @brief get the screen orientation (if possible : only on iOs/Android)
* @return Current orientation.
*/
virtual enum gale::orientation getOrientation();
}; };
} }

View File

@ -71,7 +71,7 @@ class AndroidContext : public gale::Context {
return true; return true;
} }
public: public:
AndroidContext(gale::context::Application* _application, JNIEnv* _env, jclass _classBase, jobject _objCallback, enum application _typeAPPL) : AndroidContext(gale::Application* _application, JNIEnv* _env, jclass _classBase, jobject _objCallback, enum application _typeAPPL) :
gale::Context(_application), gale::Context(_application),
m_javaApplicationType(_typeAPPL), m_javaApplicationType(_typeAPPL),
m_JavaVirtualMachinePointer(nullptr), m_JavaVirtualMachinePointer(nullptr),
@ -468,7 +468,7 @@ class AndroidContext : public gale::Context {
}; };
static std::vector<AndroidContext*> s_listInstance; static std::vector<AndroidContext*> s_listInstance;
gale::context::Application* s_applicationInit = NULL; gale::Application* s_applicationInit = NULL;
extern "C" { extern "C" {
/* Call to initialize the graphics state */ /* Call to initialize the graphics state */
@ -509,7 +509,7 @@ extern "C" {
GALE_DEBUG("*******************************************"); GALE_DEBUG("*******************************************");
AndroidContext* tmpContext = nullptr; AndroidContext* tmpContext = nullptr;
s_applicationInit = NULL; s_applicationInit = NULL;
gale::context::Application* localApplication = NULL; gale::Application* localApplication = NULL;
// call the basic init of all application (that call us ...) // call the basic init of all application (that call us ...)
main(0,NULL); main(0,NULL);
localApplication = s_applicationInit; localApplication = s_applicationInit;
@ -898,7 +898,7 @@ extern "C" {
}; };
int gale::run(gale::context::Application* _application, int _argc, const char *_argv[]) { int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
s_applicationInit = _application; s_applicationInit = _application;
return 0; return 0;
} }

View File

@ -103,7 +103,7 @@ namespace gale {
enum gale::context::clipBoard::clipboardListe clipboardID; enum gale::context::clipBoard::clipboardListe clipboardID;
// InputId // InputId
enum gale::key::type inputType; enum gale::key::type inputType;
int32_t inputId; int32_t inputId;
// generic dimentions // generic dimentions
vec2 dimention; vec2 dimention;
// keyboard events : // keyboard events :
@ -116,20 +116,20 @@ namespace gale {
eSystemMessage() : eSystemMessage() :
TypeMessage(msgNone), TypeMessage(msgNone),
clipboardID(gale::context::clipBoard::clipboardStd), clipboardID(gale::context::clipBoard::clipboardStd),
inputType(gale::key::typeUnknow), inputType(gale::key::type_unknow),
inputId(-1), inputId(-1),
dimention(0,0), dimention(0,0),
repeateKey(false), repeateKey(false),
stateIsDown(false), stateIsDown(false),
keyboardChar(0), keyboardChar(0),
keyboardMove(gale::key::keyboardUnknow) keyboardMove(gale::key::keyboard_unknow)
{ {
} }
}; };
}; };
#if 0
void gale::Context::inputEventTransfertWidget(std::shared_ptr<gale::Widget> _source, void gale::Context::inputEventTransfertWidget(std::shared_ptr<gale::Widget> _source,
std::shared_ptr<gale::Widget> _destination) { std::shared_ptr<gale::Widget> _destination) {
m_input.transfertEvent(_source, _destination); m_input.transfertEvent(_source, _destination);
@ -143,6 +143,7 @@ void gale::Context::inputEventGrabPointer(std::shared_ptr<gale::Widget> _widget)
void gale::Context::inputEventUnGrabPointer() { void gale::Context::inputEventUnGrabPointer() {
m_input.unGrabPointer(); m_input.unGrabPointer();
} }
#endif
void gale::Context::processEvents() { void gale::Context::processEvents() {
int32_t nbEvent = 0; int32_t nbEvent = 0;
@ -160,8 +161,9 @@ void gale::Context::processEvents() {
case eSystemMessage::msgInit: case eSystemMessage::msgInit:
// this is due to the openGL context // this is due to the openGL context
/*bool returnVal = */ /*bool returnVal = */
m_application->init(*this, m_initStepId); m_application->onCreate(*this);
m_initStepId++; m_application->onStart(*this);
m_application->onResume(*this);
break; break;
case eSystemMessage::msgRecalculateSize: case eSystemMessage::msgRecalculateSize:
forceRedrawAll(); forceRedrawAll();
@ -174,17 +176,18 @@ void gale::Context::processEvents() {
break; break;
case eSystemMessage::msgInputMotion: case eSystemMessage::msgInputMotion:
//GALE_DEBUG("Receive MSG : THREAD_INPUT_MOTION"); //GALE_DEBUG("Receive MSG : THREAD_INPUT_MOTION");
m_input.motion(data->inputType, data->inputId, data->dimention); // TODO : m_input.motion(data->inputType, data->inputId, data->dimention);
break; break;
case eSystemMessage::msgInputState: case eSystemMessage::msgInputState:
//GALE_DEBUG("Receive MSG : THREAD_INPUT_STATE"); //GALE_DEBUG("Receive MSG : THREAD_INPUT_STATE");
m_input.state(data->inputType, data->inputId, data->stateIsDown, data->dimention); // TODO : m_input.state(data->inputType, data->inputId, data->stateIsDown, data->dimention);
break; break;
case eSystemMessage::msgKeyboardKey: case eSystemMessage::msgKeyboardKey:
case eSystemMessage::msgKeyboardMove: case eSystemMessage::msgKeyboardMove:
//GALE_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY"); //GALE_DEBUG("Receive MSG : THREAD_KEYBORAD_KEY");
// store the keyboard special key status for mouse event... // store the keyboard special key status for mouse event...
m_input.setLastKeyboardSpecial(data->keyboardSpecial); // TODO : m_input.setLastKeyboardSpecial(data->keyboardSpecial);
#if 0
if (nullptr != m_windowsCurrent) { if (nullptr != m_windowsCurrent) {
if (false == m_windowsCurrent->onEventShortCut(data->keyboardSpecial, if (false == m_windowsCurrent->onEventShortCut(data->keyboardSpecial,
data->keyboardChar, data->keyboardChar,
@ -231,14 +234,17 @@ void gale::Context::processEvents() {
} }
} }
} }
#endif
break; break;
case eSystemMessage::msgClipboardArrive: case eSystemMessage::msgClipboardArrive:
#if 0
{ {
std::shared_ptr<gale::Widget> tmpWidget = m_widgetManager.focusGet(); std::shared_ptr<gale::Widget> tmpWidget = m_widgetManager.focusGet();
if (tmpWidget != nullptr) { if (tmpWidget != nullptr) {
tmpWidget->onEventClipboard(data->clipboardID); tmpWidget->onEventClipboard(data->clipboardID);
} }
} }
#endif
break; break;
case eSystemMessage::msgHide: case eSystemMessage::msgHide:
GALE_DEBUG("Receive MSG : msgHide"); GALE_DEBUG("Receive MSG : msgHide");
@ -282,12 +288,12 @@ void gale::Context::setArchiveDir(int _mode, const char* _str) {
gale::Context::Context(gale::context::Application* _application, int32_t _argc, const char* _argv[]) : gale::Context::Context(gale::Application* _application, int32_t _argc, const char* _argv[]) :
//m_application(std::make_shared<gale::context::Application>(_application)), //m_application(std::make_shared<gale::Application>(_application)),
m_application(_application), m_application(_application),
m_objectManager(*this), //m_objectManager(*this),
m_previousDisplayTime(0), m_previousDisplayTime(0),
m_input(*this), // TODO : m_input(*this),
#if (defined(__TARGET_OS__Android) || defined(__TARGET_OS__IOs)) #if (defined(__TARGET_OS__Android) || defined(__TARGET_OS__IOs))
m_displayFps(true), m_displayFps(true),
#else #else
@ -297,7 +303,6 @@ gale::Context::Context(gale::context::Application* _application, int32_t _argc,
m_FpsSystemContext("Context ", false), m_FpsSystemContext("Context ", false),
m_FpsSystem( "Draw ", true), m_FpsSystem( "Draw ", true),
m_FpsFlush( "Flush ", false), m_FpsFlush( "Flush ", false),
m_windowsCurrent(nullptr),
m_windowsSize(320,480), m_windowsSize(320,480),
m_initStepId(0) { m_initStepId(0) {
// set a basic // set a basic
@ -353,11 +358,11 @@ gale::Context::Context(gale::context::Application* _application, int32_t _argc,
// force a recalculation // force a recalculation
requestUpdateSize(); requestUpdateSize();
#if defined(__GALE_ANDROID_ORIENTATION_LANDSCAPE__) #if defined(__GALE_ANDROID_ORIENTATION_LANDSCAPE__)
forceOrientation(gale::screenLandscape); forceOrientation(gale::orientation_screenLandscape);
#elif defined(__GALE_ANDROID_ORIENTATION_PORTRAIT__) #elif defined(__GALE_ANDROID_ORIENTATION_PORTRAIT__)
forceOrientation(gale::screenPortrait); forceOrientation(gale::orientation_screenPortrait);
#else #else
forceOrientation(gale::screenAuto); forceOrientation(gale::orientation_screenAuto);
#endif #endif
// release the curent interface : // release the curent interface :
unLockContext(); unLockContext();
@ -369,25 +374,25 @@ gale::Context::~Context() {
// TODO : Clean the message list ... // TODO : Clean the message list ...
// set the curent interface : // set the curent interface :
lockContext(); lockContext();
// Remove current windows
m_windowsCurrent.reset();
// clean all widget and sub widget with their resources: // clean all widget and sub widget with their resources:
m_objectManager.cleanInternalRemoved(); //m_objectManager.cleanInternalRemoved();
// call application to uninit // call application to uninit
m_application->unInit(*this); m_application->onPause(*this);
m_application->onStop(*this);
m_application->onDestroy(*this);
m_application.reset(); m_application.reset();
// clean all messages // clean all messages
m_msgSystem.clean(); m_msgSystem.clean();
// internal clean elements // internal clean elements
m_objectManager.cleanInternalRemoved(); //m_objectManager.cleanInternalRemoved();
m_resourceManager.cleanInternalRemoved(); m_resourceManager.cleanInternalRemoved();
GALE_INFO("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing"); GALE_INFO("List of all widget of this context must be equal at 0 ==> otherwise some remove is missing");
m_objectManager.displayListObject(); //m_objectManager.displayListObject();
// Resource is an lower element as objects ... // Resource is an lower element as objects ...
m_resourceManager.unInit(); m_resourceManager.unInit();
// now All must be removed !!! // now All must be removed !!!
m_objectManager.unInit(); //m_objectManager.unInit();
// release the curent interface : // release the curent interface :
unLockContext(); unLockContext();
GALE_INFO(" == > Gale system Un-Init (END)"); GALE_INFO(" == > Gale system Un-Init (END)");
@ -432,7 +437,7 @@ void gale::Context::OS_SetInputMotion(int _pointerID, const vec2& _pos ) {
return; return;
} }
data->TypeMessage = eSystemMessage::msgInputMotion; data->TypeMessage = eSystemMessage::msgInputMotion;
data->inputType = gale::key::typeFinger; data->inputType = gale::key::type_finger;
data->inputId = _pointerID; data->inputId = _pointerID;
data->dimention = _pos; data->dimention = _pos;
m_msgSystem.post(data); m_msgSystem.post(data);
@ -445,7 +450,7 @@ void gale::Context::OS_SetInputState(int _pointerID, bool _isDown, const vec2& _
return; return;
} }
data->TypeMessage = eSystemMessage::msgInputState; data->TypeMessage = eSystemMessage::msgInputState;
data->inputType = gale::key::typeFinger; data->inputType = gale::key::type_finger;
data->inputId = _pointerID; data->inputId = _pointerID;
data->stateIsDown = _isDown; data->stateIsDown = _isDown;
data->dimention = _pos; data->dimention = _pos;
@ -459,7 +464,7 @@ void gale::Context::OS_SetMouseMotion(int _pointerID, const vec2& _pos ) {
return; return;
} }
data->TypeMessage = eSystemMessage::msgInputMotion; data->TypeMessage = eSystemMessage::msgInputMotion;
data->inputType = gale::key::typeMouse; data->inputType = gale::key::type_mouse;
data->inputId = _pointerID; data->inputId = _pointerID;
data->dimention = _pos; data->dimention = _pos;
m_msgSystem.post(data); m_msgSystem.post(data);
@ -472,7 +477,7 @@ void gale::Context::OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _
return; return;
} }
data->TypeMessage = eSystemMessage::msgInputState; data->TypeMessage = eSystemMessage::msgInputState;
data->inputType = gale::key::typeMouse; data->inputType = gale::key::type_mouse;
data->inputId = _pointerID; data->inputId = _pointerID;
data->stateIsDown = _isDown; data->stateIsDown = _isDown;
data->dimention = _pos; data->dimention = _pos;
@ -480,9 +485,9 @@ void gale::Context::OS_SetMouseState(int _pointerID, bool _isDown, const vec2& _
} }
void gale::Context::OS_SetKeyboard(gale::key::Special& _special, void gale::Context::OS_SetKeyboard(gale::key::Special& _special,
char32_t _myChar, char32_t _myChar,
bool _isDown, bool _isDown,
bool _isARepeateKey) { bool _isARepeateKey) {
gale::eSystemMessage *data = new gale::eSystemMessage(); gale::eSystemMessage *data = new gale::eSystemMessage();
if (data == nullptr) { if (data == nullptr) {
GALE_ERROR("allocationerror of message"); GALE_ERROR("allocationerror of message");
@ -575,7 +580,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
// set the curent interface : // set the curent interface :
lockContext(); lockContext();
processEvents(); processEvents();
if (m_initStepId < m_application->getNbStepInit()) { {
gale::eSystemMessage *data = new gale::eSystemMessage(); gale::eSystemMessage *data = new gale::eSystemMessage();
if (data == nullptr) { if (data == nullptr) {
GALE_ERROR("allocation error of message"); GALE_ERROR("allocation error of message");
@ -585,18 +590,20 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
} }
} }
// call all the widget that neded to do something periodicly // call all the widget that neded to do something periodicly
m_objectManager.timeCall(currentTime); // TODO : m_objectManager.timeCall(currentTime);
// check if the user selected a windows // check if the user selected a windows
#if 0
if (nullptr != m_windowsCurrent) { if (nullptr != m_windowsCurrent) {
// Redraw all needed elements // Redraw all needed elements
m_windowsCurrent->onRegenerateDisplay(); m_windowsCurrent->onRegenerateDisplay();
} }
#endif
if (m_displayFps == true) { if (m_displayFps == true) {
m_FpsSystemEvent.incrementCounter(); m_FpsSystemEvent.incrementCounter();
m_FpsSystemEvent.toc(); m_FpsSystemEvent.toc();
} }
//! bool needRedraw = gale::widgetManager::isDrawingNeeded(); //! bool needRedraw = gale::widgetManager::isDrawingNeeded();
needRedraw = m_widgetManager.isDrawingNeeded(); // TODO : needRedraw = m_widgetManager.isDrawingNeeded();
// release the curent interface : // release the curent interface :
unLockContext(); unLockContext();
} }
@ -608,6 +615,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
if (m_displayFps == true) { if (m_displayFps == true) {
m_FpsSystemContext.tic(); m_FpsSystemContext.tic();
} }
#if 0
if (nullptr != m_windowsCurrent) { if (nullptr != m_windowsCurrent) {
if( true == needRedraw if( true == needRedraw
|| true == _displayEveryTime) { || true == _displayEveryTime) {
@ -617,10 +625,12 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
} }
} }
} }
#endif
if (m_displayFps == true) { if (m_displayFps == true) {
m_FpsSystemContext.toc(); m_FpsSystemContext.toc();
m_FpsSystem.tic(); m_FpsSystem.tic();
} }
#if 0
if (nullptr != m_windowsCurrent) { if (nullptr != m_windowsCurrent) {
if( true == needRedraw if( true == needRedraw
|| true == _displayEveryTime) { || true == _displayEveryTime) {
@ -629,6 +639,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
hasDisplayDone = true; hasDisplayDone = true;
} }
} }
#endif
if (m_displayFps == true) { if (m_displayFps == true) {
m_FpsSystem.toc(); m_FpsSystem.toc();
m_FpsFlush.tic(); m_FpsFlush.tic();
@ -660,7 +671,7 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
m_resourceManager.updateContext(); m_resourceManager.updateContext();
// release open GL Context // release open GL Context
gale::openGL::unLock(); gale::openGL::unLock();
m_objectManager.cleanInternalRemoved(); // TODO : m_objectManager.cleanInternalRemoved();
m_resourceManager.cleanInternalRemoved(); m_resourceManager.cleanInternalRemoved();
// release the curent interface : // release the curent interface :
unLockContext(); unLockContext();
@ -669,43 +680,31 @@ bool gale::Context::OS_Draw(bool _displayEveryTime) {
} }
void gale::Context::resetIOEvent() { void gale::Context::resetIOEvent() {
m_input.newLayerSet(); // TODO : m_input.newLayerSet();
} }
void gale::Context::OS_OpenGlContextDestroy() { void gale::Context::OS_OpenGlContextDestroy() {
m_resourceManager.contextHasBeenDestroyed(); m_resourceManager.contextHasBeenDestroyed();
} }
void gale::Context::setWindows(const std::shared_ptr<gale::widget::Windows>& _windows) {
// remove current focus :
m_widgetManager.focusSetDefault(nullptr);
m_widgetManager.focusRelease();
// set the new pointer as windows system
m_windowsCurrent = _windows;
// set the new default focus :
m_widgetManager.focusSetDefault(_windows);
// request all the widget redrawing
forceRedrawAll();
}
std::shared_ptr<gale::widget::Windows> gale::Context::getWindows() {
return m_windowsCurrent;
};
void gale::Context::forceRedrawAll() { void gale::Context::forceRedrawAll() {
#if 0
if (m_windowsCurrent == nullptr) { if (m_windowsCurrent == nullptr) {
return; return;
} }
m_windowsCurrent->calculateSize(vec2(m_windowsSize.x(), m_windowsSize.y())); m_windowsCurrent->calculateSize(vec2(m_windowsSize.x(), m_windowsSize.y()));
#endif
} }
void gale::Context::OS_Stop() { void gale::Context::OS_Stop() {
// set the curent interface : // set the curent interface :
lockContext(); lockContext();
GALE_INFO("OS_Stop..."); GALE_INFO("OS_Stop...");
#if 0
if (m_windowsCurrent != nullptr) { if (m_windowsCurrent != nullptr) {
m_windowsCurrent->sysOnKill(); m_windowsCurrent->sysOnKill();
} }
#endif
// release the curent interface : // release the curent interface :
unLockContext(); unLockContext();
} }
@ -715,9 +714,11 @@ void gale::Context::OS_Suspend() {
lockContext(); lockContext();
GALE_INFO("OS_Suspend..."); GALE_INFO("OS_Suspend...");
m_previousDisplayTime = -1; m_previousDisplayTime = -1;
#if 0
if (m_windowsCurrent != nullptr) { if (m_windowsCurrent != nullptr) {
m_windowsCurrent->onStateSuspend(); m_windowsCurrent->onStateSuspend();
} }
#endif
// release the curent interface : // release the curent interface :
unLockContext(); unLockContext();
} }
@ -727,10 +728,12 @@ void gale::Context::OS_Resume() {
lockContext(); lockContext();
GALE_INFO("OS_Resume..."); GALE_INFO("OS_Resume...");
m_previousDisplayTime = gale::getTime(); m_previousDisplayTime = gale::getTime();
m_objectManager.timeCallResume(m_previousDisplayTime); // TODO : m_objectManager.timeCallResume(m_previousDisplayTime);
#if 0
if (m_windowsCurrent != nullptr) { if (m_windowsCurrent != nullptr) {
m_windowsCurrent->onStateResume(); m_windowsCurrent->onStateResume();
} }
#endif
// release the curent interface : // release the curent interface :
unLockContext(); unLockContext();
} }
@ -738,9 +741,11 @@ void gale::Context::OS_Foreground() {
// set the curent interface : // set the curent interface :
lockContext(); lockContext();
GALE_INFO("OS_Foreground..."); GALE_INFO("OS_Foreground...");
#if 0
if (m_windowsCurrent != nullptr) { if (m_windowsCurrent != nullptr) {
m_windowsCurrent->onStateForeground(); m_windowsCurrent->onStateForeground();
} }
#endif
// release the curent interface : // release the curent interface :
unLockContext(); unLockContext();
} }
@ -749,9 +754,11 @@ void gale::Context::OS_Background() {
// set the curent interface : // set the curent interface :
lockContext(); lockContext();
GALE_INFO("OS_Background..."); GALE_INFO("OS_Background...");
#if 0
if (m_windowsCurrent != nullptr) { if (m_windowsCurrent != nullptr) {
m_windowsCurrent->onStateBackground(); m_windowsCurrent->onStateBackground();
} }
#endif
// release the curent interface : // release the curent interface :
unLockContext(); unLockContext();
} }
@ -790,7 +797,7 @@ void gale::Context::keyboardHide() {
GALE_INFO("keyboardHide: NOT implemented ..."); GALE_INFO("keyboardHide: NOT implemented ...");
} }
#if 0
bool gale::Context::systemKeyboradEvent(enum gale::key::keyboardSystem _key, bool _down) { bool gale::Context::systemKeyboradEvent(enum gale::key::keyboardSystem _key, bool _down) {
if (m_windowsCurrent == nullptr) { if (m_windowsCurrent == nullptr) {
return false; return false;
@ -799,4 +806,5 @@ bool gale::Context::systemKeyboradEvent(enum gale::key::keyboardSystem _key, boo
bool ret = m_windowsCurrent->onEventHardwareInput(_key, _down); bool ret = m_windowsCurrent->onEventHardwareInput(_key, _down);
unLockContext(); unLockContext();
return ret; return ret;
} }
#endif

View File

@ -14,32 +14,24 @@
#include <gale/gale.h> #include <gale/gale.h>
#include <gale/key/key.h> #include <gale/key/key.h>
#include <gale/resource/Manager.h> #include <gale/resource/Manager.h>
#include <gale/context/Application.h> #include <gale/Application.h>
#include <gale/context/clipBoard.h> #include <gale/context/clipBoard.h>
#include <gale/context/commandLine.h> #include <gale/context/commandLine.h>
#include <gale/context/InputManager.h> // TODO : #include <gale/context/InputManager.h>
#include <gale/context/Fps.h> #include <gale/context/Fps.h>
#include <memory> #include <memory>
#include <gale/orientation.h>
namespace gale { namespace gale {
/** /**
* @not-in-doc * @not-in-doc
*/ */
class eSystemMessage; class eSystemMessage;
/**
* @not-in-doc
*/
enum orientation{
screenAuto = 0,
screenLandscape,
screenPortrait
};
class Context/* : private gale::object::RemoveEvent */{ class Context/* : private gale::object::RemoveEvent */{
private: private:
std::shared_ptr<gale::context::Application> m_application; //!< Application handle std::shared_ptr<gale::Application> m_application; //!< Application handle
public: public:
std::shared_ptr<gale::context::Application> getApplication() { std::shared_ptr<gale::Application> getApplication() {
return m_application; return m_application;
} }
private: private:
@ -55,7 +47,7 @@ namespace gale {
return m_resourceManager; return m_resourceManager;
}; };
public: public:
Context(gale::context::Application* _application, int32_t _argc=0, const char* _argv[]=nullptr); Context(gale::Application* _application, int32_t _argc=0, const char* _argv[]=nullptr);
virtual ~Context(); virtual ~Context();
protected: protected:
/** /**
@ -70,7 +62,7 @@ namespace gale {
void unLockContext(); void unLockContext();
private: private:
int64_t m_previousDisplayTime; // this is to limit framerate ... in case... int64_t m_previousDisplayTime; // this is to limit framerate ... in case...
gale::context::InputManager m_input; // TODO : gale::context::InputManager m_input;
etk::Fifo<gale::eSystemMessage*> m_msgSystem; etk::Fifo<gale::eSystemMessage*> m_msgSystem;
bool m_displayFps; bool m_displayFps;
gale::context::Fps m_FpsSystemEvent; gale::context::Fps m_FpsSystemEvent;
@ -138,19 +130,6 @@ namespace gale {
* @brief The application request that the Window will be killed * @brief The application request that the Window will be killed
*/ */
virtual void stop(); virtual void stop();
private:
std::shared_ptr<gale::widget::Windows> m_windowsCurrent; //!< curent displayed windows
public:
/**
* @brief set the current windows to display :
* @param _windows Windows that might be displayed
*/
void setWindows(const std::shared_ptr<gale::widget::Windows>& _windows);
/**
* @brief get the current windows that is displayed
* @return the current handle on the windows (can be null)
*/
std::shared_ptr<gale::widget::Windows> getWindows();
private: private:
vec2 m_windowsSize; //!< current size of the system vec2 m_windowsSize; //!< current size of the system
public: public:
@ -203,6 +182,7 @@ namespace gale {
void forceRedrawAll(); void forceRedrawAll();
// TODO : Later ... // TODO : Later ...
#if 0
/** /**
* @brief This is to transfert the event from one widget to another one * @brief This is to transfert the event from one widget to another one
* @param source the widget where the event came from * @param source the widget where the event came from
@ -218,6 +198,7 @@ namespace gale {
* @brief This fonction un-lock the pointer properties to move in relative instead of absolute * @brief This fonction un-lock the pointer properties to move in relative instead of absolute
*/ */
void inputEventUnGrabPointer(); void inputEventUnGrabPointer();
#endif
/** /**
* @brief display the virtal keyboard (for touch system only) * @brief display the virtal keyboard (for touch system only)
@ -268,7 +249,7 @@ namespace gale {
* @brief set the cursor display type. * @brief set the cursor display type.
* @param[in] _newCursor selected new cursor. * @param[in] _newCursor selected new cursor.
*/ */
virtual void setCursor(enum gale::context::cursorDisplay _newCursor) { }; virtual void setCursor(enum gale::context::cursor _newCursor) { };
/** /**
* @brief set the Icon of the program * @brief set the Icon of the program
* @param[in] _inputFile new filename icon of the curent program. * @param[in] _inputFile new filename icon of the curent program.
@ -307,13 +288,16 @@ namespace gale {
*/ */
void setInitImage(const std::string& _fileName); void setInitImage(const std::string& _fileName);
protected: protected:
#if 0
TODO : Rework this ==> but how ...
/** /**
* @brief HARDWARE keyboard event from the system * @brief HARDWARE keyboard event from the system
* @param[in] _key event type * @param[in] _key event type
* @param[in] _status Up or down status * @param[in] _status Up or down status
* @return Keep the event or not * @return Keep the event or not
*/ */
virtual bool systemKeyboradEvent(enum gale::key::keyboardSystem _key, bool _down); virtual bool systemKeyboradEvent(enum gale::key::keyboard _key, bool _down);
#endif
}; };
/** /**
* @brief From everyware in the program, we can get the context inteface. * @brief From everyware in the program, we can get the context inteface.

View File

@ -54,7 +54,7 @@ class MacOSInterface : public gale::Context {
private: private:
gale::key::Special m_guiKeyBoardMode; gale::key::Special m_guiKeyBoardMode;
public: public:
MacOSInterface(gale::context::Application* _application, int32_t _argc, const char* _argv[]) : MacOSInterface(gale::Application* _application, int32_t _argc, const char* _argv[]) :
gale::Context(_application, _argc, _argv) { gale::Context(_application, _argc, _argv) {
// nothing to do ... // nothing to do ...
} }
@ -233,13 +233,13 @@ void IOs::foreground() {
static int l_argc = 0; static int l_argc = 0;
static const char **l_argv = nullptr; static const char **l_argv = nullptr;
static gale::context::Application* l_application; static gale::Application* l_application;
/** /**
* @brief Main of the program * @brief Main of the program
* @param std IO * @param std IO
* @return std IO * @return std IO
*/ */
int gale::run(gale::context::Application* _application, int _argc, const char *_argv[]) { int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
l_argc = _argc; l_argc = _argc;
l_argv = _argv; l_argv = _argv;
l_application = _application; l_application = _application;

View File

@ -48,7 +48,7 @@ class WindowsContext : public gale::Context {
bool m_run = true; bool m_run = true;
bool m_clipBoardOwnerStd = false; bool m_clipBoardOwnerStd = false;
public: public:
WindowsContext(gale::context::Application* _application, int32_t _argc, const char* _argv[]) : WindowsContext(gale::Application* _application, int32_t _argc, const char* _argv[]) :
gale::Context(_application, _argc, _argv) { gale::Context(_application, _argc, _argv) {
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; ++iii) { for (int32_t iii=0; iii<MAX_MANAGE_INPUT; ++iii) {
m_inputIsPressed[iii] = false; m_inputIsPressed[iii] = false;
@ -478,7 +478,7 @@ class WindowsContext : public gale::Context {
* @param std IO * @param std IO
* @return std IO * @return std IO
*/ */
int gale::run(gale::context::Application* _application, int _argc, const char *_argv[]) { int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
etk::init(_argc, _argv); etk::init(_argc, _argv);
GLenum err = glewInit(); GLenum err = glewInit();
if (GLEW_OK != err) { if (GLEW_OK != err) {

View File

@ -20,7 +20,6 @@
#include <gale/gale.h> #include <gale/gale.h>
#include <gale/key/key.h> #include <gale/key/key.h>
#include <gale/context/commandLine.h> #include <gale/context/commandLine.h>
#include <gale/widget/Manager.h>
#include <gale/resource/Manager.h> #include <gale/resource/Manager.h>
#include <gale/context/Context.h> #include <gale/context/Context.h>
#include <gale/Dimension.h> #include <gale/Dimension.h>
@ -97,7 +96,7 @@ extern "C" {
} Hints; } Hints;
} }
#include <egami/egami.h> // TODO : #include <egami/egami.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
@ -140,10 +139,10 @@ class X11Interface : public gale::Context {
Atom XAtomeTargetTarget; Atom XAtomeTargetTarget;
Atom XAtomeGALE; Atom XAtomeGALE;
Atom XAtomeDeleteWindows; Atom XAtomeDeleteWindows;
enum gale::context::cursorDisplay m_currentCursor; //!< select the current cursor to display : enum gale::context::cursor m_currentCursor; //!< select the current cursor to display :
char32_t m_lastKeyPressed; //!< The last element key presed... char32_t m_lastKeyPressed; //!< The last element key presed...
public: public:
X11Interface(gale::context::Application* _application, int32_t _argc, const char* _argv[]) : X11Interface(gale::Application* _application, int32_t _argc, const char* _argv[]) :
gale::Context(_application, _argc, _argv), gale::Context(_application, _argc, _argv),
m_display(nullptr), m_display(nullptr),
m_originX(0), m_originX(0),
@ -169,7 +168,7 @@ class X11Interface : public gale::Context {
XAtomeTargetTarget(0), XAtomeTargetTarget(0),
XAtomeGALE(0), XAtomeGALE(0),
XAtomeDeleteWindows(0), XAtomeDeleteWindows(0),
m_currentCursor(gale::context::cursorArrow), m_currentCursor(gale::context::cursor_arrow),
m_lastKeyPressed(0) { m_lastKeyPressed(0) {
X11_INFO("X11:INIT"); X11_INFO("X11:INIT");
for (int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) { for (int32_t iii=0; iii<MAX_MANAGE_INPUT; iii++) {
@ -770,7 +769,7 @@ class X11Interface : public gale::Context {
} }
*/ */
/****************************************************************************************/ /****************************************************************************************/
virtual void setCursor(enum gale::context::cursorDisplay _newCursor) { virtual void setCursor(enum gale::context::cursor _newCursor) {
if (_newCursor != m_currentCursor) { if (_newCursor != m_currentCursor) {
X11_DEBUG("X11-API: set New Cursor : " << _newCursor); X11_DEBUG("X11-API: set New Cursor : " << _newCursor);
// undefine previous cursors ... // undefine previous cursors ...
@ -779,7 +778,7 @@ class X11Interface : public gale::Context {
m_currentCursor = _newCursor; m_currentCursor = _newCursor;
Cursor myCursor = None; Cursor myCursor = None;
switch (m_currentCursor) { switch (m_currentCursor) {
case gale::context::cursorNone: case gale::context::cursor_none:
{ {
Pixmap bitmapNoData; Pixmap bitmapNoData;
XColor black; XColor black;
@ -792,61 +791,61 @@ class X11Interface : public gale::Context {
&black, &black, 0, 0); &black, &black, 0, 0);
} }
break; break;
case gale::context::cursorLeftArrow: case gale::context::cursor_leftArrow:
myCursor = XCreateFontCursor(m_display, XC_top_left_arrow); myCursor = XCreateFontCursor(m_display, XC_top_left_arrow);
break; break;
case gale::context::cursorInfo: case gale::context::cursor_info:
myCursor = XCreateFontCursor(m_display, XC_hand1); myCursor = XCreateFontCursor(m_display, XC_hand1);
break; break;
case gale::context::cursorDestroy: case gale::context::cursor_destroy:
myCursor = XCreateFontCursor(m_display, XC_pirate); myCursor = XCreateFontCursor(m_display, XC_pirate);
break; break;
case gale::context::cursorHelp: case gale::context::cursor_help:
myCursor = XCreateFontCursor(m_display, XC_question_arrow); myCursor = XCreateFontCursor(m_display, XC_question_arrow);
break; break;
case gale::context::cursorCycle: case gale::context::cursor_cycle:
myCursor = XCreateFontCursor(m_display, XC_exchange); myCursor = XCreateFontCursor(m_display, XC_exchange);
break; break;
case gale::context::cursorSpray: case gale::context::cursor_spray:
myCursor = XCreateFontCursor(m_display, XC_spraycan); myCursor = XCreateFontCursor(m_display, XC_spraycan);
break; break;
case gale::context::cursorWait: case gale::context::cursor_wait:
myCursor = XCreateFontCursor(m_display, XC_watch); myCursor = XCreateFontCursor(m_display, XC_watch);
break; break;
case gale::context::cursorText: case gale::context::cursor_text:
myCursor = XCreateFontCursor(m_display, XC_xterm); myCursor = XCreateFontCursor(m_display, XC_xterm);
break; break;
case gale::context::cursorCrossHair: case gale::context::cursor_crossHair:
myCursor = XCreateFontCursor(m_display, XC_crosshair); myCursor = XCreateFontCursor(m_display, XC_crosshair);
break; break;
case gale::context::cursorSlideUpDown: case gale::context::cursor_slideUpDown:
myCursor = XCreateFontCursor(m_display, XC_sb_v_double_arrow); myCursor = XCreateFontCursor(m_display, XC_sb_v_double_arrow);
break; break;
case gale::context::cursorSlideLeftRight: case gale::context::cursor_slideLeftRight:
myCursor = XCreateFontCursor(m_display, XC_sb_h_double_arrow); myCursor = XCreateFontCursor(m_display, XC_sb_h_double_arrow);
break; break;
case gale::context::cursorResizeUp: case gale::context::cursor_resizeUp:
myCursor = XCreateFontCursor(m_display, XC_top_side); myCursor = XCreateFontCursor(m_display, XC_top_side);
break; break;
case gale::context::cursorResizeDown: case gale::context::cursor_resizeDown:
myCursor = XCreateFontCursor(m_display, XC_bottom_side); myCursor = XCreateFontCursor(m_display, XC_bottom_side);
break; break;
case gale::context::cursorResizeLeft: case gale::context::cursor_resizeLeft:
myCursor = XCreateFontCursor(m_display, XC_left_side); myCursor = XCreateFontCursor(m_display, XC_left_side);
break; break;
case gale::context::cursorResizeRight: case gale::context::cursor_resizeRight:
myCursor = XCreateFontCursor(m_display, XC_right_side); myCursor = XCreateFontCursor(m_display, XC_right_side);
break; break;
case gale::context::cursorCornerTopLeft: case gale::context::cursor_cornerTopLeft:
myCursor = XCreateFontCursor(m_display, XC_top_left_corner); myCursor = XCreateFontCursor(m_display, XC_top_left_corner);
break; break;
case gale::context::cursorCornerTopRight: case gale::context::cursor_cornerTopRight:
myCursor = XCreateFontCursor(m_display, XC_top_right_corner); myCursor = XCreateFontCursor(m_display, XC_top_right_corner);
break; break;
case gale::context::cursorCornerButtomLeft: case gale::context::cursor_cornerButtomLeft:
myCursor = XCreateFontCursor(m_display, XC_bottom_right_corner); myCursor = XCreateFontCursor(m_display, XC_bottom_right_corner);
break; break;
case gale::context::cursorCornerButtomRight: case gale::context::cursor_cornerButtomRight:
myCursor = XCreateFontCursor(m_display, XC_bottom_left_corner); myCursor = XCreateFontCursor(m_display, XC_bottom_left_corner);
break; break;
default : default :
@ -1061,6 +1060,8 @@ class X11Interface : public gale::Context {
} }
/****************************************************************************************/ /****************************************************************************************/
void setIcon(const std::string& _inputFile) { void setIcon(const std::string& _inputFile) {
// TODO : ...
#if 0
egami::Image dataImage; egami::Image dataImage;
// load data // load data
if (false == egami::load(dataImage, _inputFile)) { if (false == egami::load(dataImage, _inputFile)) {
@ -1195,7 +1196,7 @@ class X11Interface : public gale::Context {
myImage->data = nullptr; myImage->data = nullptr;
XDestroyImage(myImage); XDestroyImage(myImage);
delete[] tmpVal; delete[] tmpVal;
#endif
} }
/****************************************************************************************/ /****************************************************************************************/
static void setVSync(bool _sync) { static void setVSync(bool _sync) {
@ -1322,7 +1323,7 @@ class X11Interface : public gale::Context {
* @param std IO * @param std IO
* @return std IO * @return std IO
*/ */
int gale::run(gale::context::Application* _application, int _argc, const char *_argv[]) { int gale::run(gale::Application* _application, int _argc, const char *_argv[]) {
etk::init(_argc, _argv); etk::init(_argc, _argv);
X11Interface* interface = new X11Interface(_application, _argc, _argv); X11Interface* interface = new X11Interface(_application, _argc, _argv);
if (interface == nullptr) { if (interface == nullptr) {

View File

@ -8,37 +8,32 @@
#include <gale/context/cursor.h> #include <gale/context/cursor.h>
static const char* cursorDescriptionString[gale::context::cursorCount+1] = { static const char* cursorDescriptionString[] = {
"cursorArrow", "cursor_arrow",
"cursorLeftArrow", "cursor_leftArrow",
"cursorInfo", "cursor_info",
"cursorDestroy", "cursor_destroy",
"cursorHelp", "cursor_help",
"cursorCycle", "cursor_cycle",
"cursorSpray", "cursor_spray",
"cursorWait", "cursor_wait",
"cursorText", "cursor_text",
"cursorCrossHair", "cursor_crossHair",
"cursorSlideUpDown", "cursor_slideUpDown",
"cursorSlideLeftRight", "cursor_slideLeftRight",
"cursorResizeUp", "cursor_resizeUp",
"cursorResizeDown", "cursor_resizeDown",
"cursorResizeLeft", "cursor_resizeLeft",
"cursorResizeRight", "cursor_resizeRight",
"cursorCornerTopLeft", "cursor_cornerTopLeft",
"cursorCornerTopRight", "cursor_cornerTopRight",
"cursorCornerButtomLeft", "cursor_cornerButtomLeft",
"cursorCornerButtomRight", "cursor_cornerButtomRight",
"cursorNone", "cursor_none"
"cursorCount"
}; };
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::context::cursorDisplay _obj) { std::ostream& gale::operator <<(std::ostream& _os, const enum gale::context::cursor _obj) {
if (_obj >= 0 && _obj <gale::context::cursorCount) { _os << cursorDescriptionString[_obj];
_os << cursorDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os; return _os;
} }

View File

@ -13,36 +13,34 @@
namespace gale { namespace gale {
namespace context { namespace context {
enum cursorDisplay { enum cursor {
cursorArrow, // this is the normal arrow ... cursor_arrow, // this is the normal arrow ...
cursorLeftArrow, cursor_leftArrow,
cursorInfo, cursor_info,
cursorDestroy, cursor_destroy,
cursorHelp, cursor_help,
cursorCycle, cursor_cycle,
cursorSpray, cursor_spray,
cursorWait, cursor_wait,
cursorText, cursor_text,
cursorCrossHair, cursor_crossHair,
cursorSlideUpDown, //!< change the position (slide) vertical cursor_slideUpDown, //!< change the position (slide) vertical
cursorSlideLeftRight, //!< change the position (slide) horizontal cursor_slideLeftRight, //!< change the position (slide) horizontal
cursorResizeUp, cursor_resizeUp,
cursorResizeDown, cursor_resizeDown,
cursorResizeLeft, cursor_resizeLeft,
cursorResizeRight, cursor_resizeRight,
cursorCornerTopLeft, cursor_cornerTopLeft,
cursorCornerTopRight, cursor_cornerTopRight,
cursorCornerButtomLeft, cursor_cornerButtomLeft,
cursorCornerButtomRight, cursor_cornerButtomRight,
cursorNone, cursor_none
// just for the count:
cursorCount
}; };
}; };
/** /**
* @brief Debug operator To display the curent element in a Human readable information * @brief Debug operator To display the curent element in a Human readable information
*/ */
std::ostream& operator <<(std::ostream& _os, const enum gale::context::cursorDisplay _obj); std::ostream& operator <<(std::ostream& _os, const enum gale::context::cursor _obj);
}; };
#endif #endif

View File

@ -10,7 +10,7 @@
#define __GALE_H__ #define __GALE_H__
#include <etk/types.h> #include <etk/types.h>
#include <gale/context/Application.h> #include <gale/Application.h>
namespace gale { namespace gale {
/** /**
@ -25,7 +25,7 @@ namespace gale {
* @param[in] _argv Standard argv * @param[in] _argv Standard argv
* @return normal error int for the application error management * @return normal error int for the application error management
*/ */
int32_t run(gale::context::Application* _application, int32_t _argc = 0, const char* _argv[] = NULL); int32_t run(gale::Application* _application, int32_t _argc = 0, const char* _argv[] = NULL);
/** /**
* @brief get GALE version * @brief get GALE version
* @return The string that describe gale version * @return The string that describe gale version

View File

@ -8,73 +8,55 @@
#include <gale/key/keyboard.h> #include <gale/key/keyboard.h>
static const char* keyboardDescriptionString[gale::key::keyboardCount+1] = { static const char* keyboardDescriptionString[] = {
"keyboardUnknow", "keyboard_unknow",
"keyboardChar", "keyboard_char",
"keyboardLeft", "keyboard_left",
"keyboardRight", "keyboard_right",
"keyboardUp", "keyboard_up",
"keyboardDown", "keyboard_down",
"keyboardPageUp", "keyboard_pageUp",
"keyboardPageDown", "keyboard_pageDown",
"keyboardStart", "keyboard_start",
"keyboardEnd", "keyboard_end",
"keyboardPrint", "keyboard_print",
"keyboardStopDefil", "keyboard_stopDefil",
"keyboardWait", "keyboard_wait",
"keyboardInsert", "keyboard_insert",
"keyboardF1", "keyboard_f1",
"keyboardF2", "keyboard_f2",
"keyboardF3", "keyboard_f3",
"keyboardF4", "keyboard_f4",
"keyboardF5", "keyboard_f5",
"keyboardF6", "keyboard_f6",
"keyboardF7", "keyboard_f7",
"keyboardF8", "keyboard_f8",
"keyboardF9", "keyboard_f9",
"keyboardF10", "keyboard_f10",
"keyboardF11", "keyboard_f11",
"keyboardF12", "keyboard_f12",
"keyboardCapLock", "keyboard_capLock",
"keyboardShiftLeft", "keyboard_shiftLeft",
"keyboardShiftRight", "keyboard_shiftRight",
"keyboardCtrlLeft", "keyboard_ctrlLeft",
"keyboardCtrlRight", "keyboard_ctrlRight",
"keyboardMetaLeft", "keyboard_metaLeft",
"keyboardMetaRight", "keyboard_metaRight",
"keyboardAlt", "keyboard_alt",
"keyboardAltGr", "keyboard_altGr",
"keyboardContextMenu", "keyboard_contextMenu",
"keyboardNumLock", "keyboard_numLock",
"keyboardCount" // harware section:
"keyboard_volumeUp",
"keyboard_volumeDown",
"keyboard_menu",
"keyboard_camera",
"keyboard_home",
"keyboard_power",
"keyboard_back",
}; };
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::keyboard _obj) { std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::keyboard _obj) {
if (_obj >= 0 && _obj <gale::key::keyboardCount) { _os << keyboardDescriptionString[_obj];
_os << keyboardDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os; return _os;
} }
static const char* keyboardSystemDescriptionString[gale::key::keyboardSystemCount+1] = {
"keyboardSystemUnknow",
"keyboardSystemVolumeUp",
"keyboardSystemVolumeDown",
"keyboardSystemMenu",
"keyboardSystemCamera",
"keyboardSystemHome",
"keyboardSystemPower",
"keyboardSystemBack",
"keyboardSystemCount"
};
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::keyboardSystem _obj) {
if (_obj >= 0 && _obj <gale::key::keyboardSystemCount) {
_os << keyboardSystemDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os;
}

View File

@ -18,62 +18,56 @@ namespace gale {
* @warning If you modify Id of these element check the java interface file of constant : GaleConstant.java * @warning If you modify Id of these element check the java interface file of constant : GaleConstant.java
*/ */
enum keyboard { enum keyboard {
keyboardUnknow = 0, //!< Unknown keyboard key keyboard_unknow = 0, //!< Unknown keyboard key
keyboardChar, //!< Char input is arrived ... keyboard_char, //!< Char input is arrived ...
keyboardLeft, //!< Left key <-- keyboard_left, //!< Left key <--
keyboardRight, //!< Right key --> keyboard_right, //!< Right key -->
keyboardUp, //!< Up key ^ keyboard_up, //!< Up key ^
keyboardDown, //!< Down key \/ keyboard_down, //!< Down key \/
keyboardPageUp, //!< Page Up key keyboard_pageUp, //!< Page Up key
keyboardPageDown, //!< page down key keyboard_pageDown, //!< page down key
keyboardStart, //!< Start key keyboard_start, //!< Start key
keyboardEnd, //!< End key keyboard_end, //!< End key
keyboardPrint, //!< print screen key. keyboard_print, //!< print screen key.
keyboardStopDefil, //!< Stop display key. keyboard_stopDefil, //!< Stop display key.
keyboardWait, //!< Wait key. keyboard_wait, //!< Wait key.
keyboardInsert, //!< insert key. keyboard_insert, //!< insert key.
keyboardF1, //!< F1 key. keyboard_f1, //!< F1 key.
keyboardF2, //!< F2 key. keyboard_f2, //!< F2 key.
keyboardF3, //!< F3 key. keyboard_f3, //!< F3 key.
keyboardF4, //!< F4 key. keyboard_f4, //!< F4 key.
keyboardF5, //!< F5 key. keyboard_f5, //!< F5 key.
keyboardF6, //!< F6 key. keyboard_f6, //!< F6 key.
keyboardF7, //!< F7 key. keyboard_f7, //!< F7 key.
keyboardF8, //!< F8 key. keyboard_f8, //!< F8 key.
keyboardF9, //!< F9 key. keyboard_f9, //!< F9 key.
keyboardF10, //!< F10 key. keyboard_f10, //!< F10 key.
keyboardF11, //!< F11 key. keyboard_f11, //!< F11 key.
keyboardF12, //!< F12 key. keyboard_f12, //!< F12 key.
keyboardCapLock, //!< Capital Letter Lock key. keyboard_capLock, //!< Capital Letter Lock key.
keyboardShiftLeft, //!< Shift left key. keyboard_shiftLeft, //!< Shift left key.
keyboardShiftRight, //!< Shift right key. keyboard_shiftRight, //!< Shift right key.
keyboardCtrlLeft, //!< Control left key. keyboard_ctrlLeft, //!< Control left key.
keyboardCtrlRight, //!< Control right key. keyboard_ctrlRight, //!< Control right key.
keyboardMetaLeft, //!< Meta left key (apple key or windows key). keyboard_metaLeft, //!< Meta left key (apple key or windows key).
keyboardMetaRight, //!< Meta right key (apple key or windows key). keyboard_metaRight, //!< Meta right key (apple key or windows key).
keyboardAlt, //!< Alt key. keyboard_alt, //!< Alt key.
keyboardAltGr, //!< Alt ground key. keyboard_altGr, //!< Alt ground key.
keyboardContextMenu, //!< Contextual menu key. keyboard_contextMenu, //!< Contextual menu key.
keyboardNumLock, //!< Numerical Lock key. keyboard_numLock, //!< Numerical Lock key
keyboardCount //!< number of posible key // harware section:
keyboard_volumeUp, //!< Hardware volume UP key
keyboard_volumeDown, //!< Hardware volume DOWN key
keyboard_menu, //!< Hardware Menu key
keyboard_camera, //!< Hardware Camera key
keyboard_home, //!< Hardware Home key
keyboard_power, //!< Hardware Power key
keyboard_back //!< Hardware Back key
}; };
/** /**
* @brief Debug operator To display the curent element in a Human redeable information * @brief Debug operator To display the curent element in a Human redeable information
*/ */
std::ostream& operator <<(std::ostream& _os, const enum gale::key::keyboard _obj); std::ostream& operator <<(std::ostream& _os, const enum gale::key::keyboard _obj);
enum keyboardSystem {
keyboardSystemUnknow = 0, //!< Unknown keyboard system key
keyboardSystemVolumeUp, //!< Hardware volume UP key
keyboardSystemVolumeDown, //!< Hardware volume DOWN key
keyboardSystemMenu, //!< Hardware Menu key
keyboardSystemCamera, //!< Hardware Camera key
keyboardSystemHome, //!< Hardware Home key
keyboardSystemPower, //!< Hardware Power key
keyboardSystemBack, //!< Hardware Back key
keyboardSystemCount //!< number of posible System key
};
std::ostream& operator <<(std::ostream& _os, const enum gale::key::keyboardSystem _obj);
}; };
}; };

View File

@ -8,30 +8,27 @@
#include <gale/key/status.h> #include <gale/key/status.h>
static const char* statusDescriptionString[gale::key::statusCount+1] = { static const char* statusDescriptionString[] = {
"statusUnknow", "status_unknow",
"statusDown", "status_down",
"statusMove", "status_downRepeate",
"statusSingle", "status_move",
"statusDouble", "status_single",
"statusTriple", "status_double",
"statusQuad", "status_triple",
"statusQuinte", "status_quad",
"statusUp", "status_quinte",
"statusUpAfter", "status_up",
"statusEnter", "status_upRepeate",
"statusLeave", "status_upAfter",
"statusAbort", "status_enter",
"statusTransfert", "status_leave",
"statusCount" "status_abort",
"status_transfert"
}; };
std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::status _obj) { std::ostream& gale::key::operator <<(std::ostream& _os, const enum gale::key::status _obj) {
if (_obj >= 0 && _obj <gale::key::statusCount) { _os << statusDescriptionString[_obj];
_os << statusDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os; return _os;
} }

View File

@ -17,21 +17,22 @@ namespace gale {
* @brief Keybord event or joyestick event * @brief Keybord event or joyestick event
*/ */
enum status { enum status {
statusUnknow = 0, status_unknow = 0,
statusDown, // availlable on Keyboard too status_down, // availlable on Keyboard too
statusMove, status_downRepeate, // availlable on Keyboard too: the down event us in repeate cycle
statusSingle, status_move,
statusDouble, status_single,
statusTriple, status_double,
statusQuad, status_triple,
statusQuinte, status_quad,
statusUp, // availlable on Keyboard too status_quinte,
statusUpAfter, // mouse input & finger input this appear after the single event (depending on some case...) status_up, // availlable on Keyboard too
statusEnter, status_upRepeate, // availlable on Keyboard too: the up event us in repeate cycle
statusLeave, status_upAfter, // mouse input & finger input this appear after the single event (depending on some case...)
statusAbort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events) status_enter,
statusTransfert, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event) status_leave,
statusCount, // number max of imput possible status_abort, // Appeare when an event is tranfert betwwen widgets (the widget which receive this has lost the events)
status_transfert // Appeare when an event is tranfert betwwen widgets (the widget which receive this has receive the transfert of the event)
}; };
/** /**
* @brief Debug operator To display the curent element in a Human redeable information * @brief Debug operator To display the curent element in a Human redeable information

View File

@ -9,20 +9,15 @@
#include <gale/key/type.h> #include <gale/key/type.h>
static const char* typeDescriptionString[gale::key::typeCount+1] = { static const char* typeDescriptionString[] = {
"typeUnknow", "type_unknow",
"typeMouse", "type_mouse",
"typeFinger", "type_finger",
"typeStylet", "type_stylet"
"typeCount"
}; };
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::key::type _obj) { std::ostream& gale::operator <<(std::ostream& _os, const enum gale::key::type _obj) {
if (_obj >= 0 && _obj < gale::key::typeCount) { _os << typeDescriptionString[_obj];
_os << typeDescriptionString[_obj];
} else {
_os << "[ERROR]";
}
return _os; return _os;
} }

View File

@ -17,11 +17,10 @@ namespace gale {
* @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different * @brief type of input : Note that the keyboard is not prevent due to the fact that data is too different
*/ */
enum type { enum type {
typeUnknow = 0, //!< Unknow input Type type_unknow = 0, //!< Unknow input Type
typeMouse, //!< Mouse type type_mouse, //!< Mouse type
typeFinger, //!< Finger type type_finger, //!< Finger type
typeStylet, //!< Stylet type type_stylet, //!< Stylet type
typeCount //!< number of types
}; };
}; };
/** /**

22
gale/orientation.cpp Normal file
View File

@ -0,0 +1,22 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#include <gale/orientation.h>
static const char* listValues[] = {
"orientation_screenAuto",
"orientation_screenLandscape",
"orientation_screenPortrait"
};
std::ostream& gale::operator <<(std::ostream& _os, const enum gale::orientation _obj) {
_os << listValues[_obj];
return _os;
}

22
gale/orientation.h Normal file
View File

@ -0,0 +1,22 @@
/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#ifndef __GALE_ORIENTATION_H__
#define __GALE_ORIENTATION_H__
namespace gale {
enum orientation {
orientation_screenAuto = 0,
orientation_screenLandscape,
orientation_screenPortrait
};
std::ostream& operator <<(std::ostream& _os, enum gale::orientation _obj);
}
#endif

View File

@ -21,7 +21,9 @@ def create(target):
myModule.add_src_file([ myModule.add_src_file([
'gale/gale.cpp', 'gale/gale.cpp',
'gale/debug.cpp', 'gale/debug.cpp',
'gale/Dimension.cpp' 'gale/Dimension.cpp',
'gale/orientation.cpp',
'gale/Application.cpp',
]) ])
# context : # context :
@ -30,7 +32,7 @@ def create(target):
'gale/context/commandLine.cpp', 'gale/context/commandLine.cpp',
'gale/context/Context.cpp', 'gale/context/Context.cpp',
'gale/context/cursor.cpp', 'gale/context/cursor.cpp',
'gale/context/InputManager.cpp' #'gale/context/InputManager.cpp'
]) ])
if target.name=="Linux": if target.name=="Linux":
myModule.add_src_file('gale/context/X11/Context.cpp') myModule.add_src_file('gale/context/X11/Context.cpp')
@ -106,6 +108,7 @@ def create(target):
]) ])
if target.name=="Linux": if target.name=="Linux":
# todo : myModule.add_module_depend(['egami'])
myModule.add_export_flag('link', '-lGL') myModule.add_export_flag('link', '-lGL')
#`pkg-config --cflags directfb` `pkg-config --libs directfb` #`pkg-config --cflags directfb` `pkg-config --libs directfb`
#ifeq ("$(CONFIG___GALE_LINUX_GUI_MODE_X11__)","y") #ifeq ("$(CONFIG___GALE_LINUX_GUI_MODE_X11__)","y")