[BREAK compatibility] Change the input event call function and manage touch without flag
This commit is contained in:
parent
a89e656309
commit
2f34ae3f87
@ -34,9 +34,10 @@ namespace ewol {
|
||||
};
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <etk/VectorType.h>
|
||||
#include <ewol/Debug.h>
|
||||
#include <ewol/OObject.h>
|
||||
#include <etk/VectorType.h>
|
||||
#include <ewol/base/eventInputManagement.h>
|
||||
|
||||
namespace ewol {
|
||||
typedef enum {
|
||||
@ -342,13 +343,14 @@ namespace ewol {
|
||||
virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos) { return this; };
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos) { return false; };
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos) { return false; };
|
||||
/**
|
||||
* @brief Event on a short-cut of this Widget (in case of return false, the event on the keyevent will arrive in the function @ref OnEventKb)
|
||||
* @param[in] shift The key Shift (left or/and right) is pressed (if true)
|
||||
|
@ -1,3 +1,27 @@
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file eventInputManagement.cpp
|
||||
* @brief Input (mouse,finger) abstraction layer (Sources)
|
||||
* @author Edouard DUPIN
|
||||
* @date 00/04/2011
|
||||
* @par Project
|
||||
* ewol
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#include <etk/Types.h>
|
||||
#include <ewol/Debug.h>
|
||||
@ -112,29 +136,32 @@ void ewol::eventInput::UnInit(void)
|
||||
|
||||
extern ewol::Windows* gui_uniqueWindows;
|
||||
|
||||
/**
|
||||
* @brief generate the event on the destinated widger
|
||||
* @param[in] type Type of the event that might be sended
|
||||
* @param[in] destWidget Pointer on the requested widget that element might be sended
|
||||
* @param[in] IdInput Id of the event (PC : [0..9] and touch : [1..9])
|
||||
* @param[in] typeEvent type of the eventg generated
|
||||
* @param[in] pos position of the event
|
||||
* @return true if event has been greped
|
||||
*/
|
||||
static bool localEventInput(ewol::inputType_te type, ewol::Widget* destWidget, int32_t IdInput, ewol::eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
if (NULL != destWidget) {
|
||||
if (type == ewol::INPUT_TYPE_MOUSE) {
|
||||
return destWidget->OnEventInput(IdInput, typeEvent, pos);
|
||||
} else if (type == ewol::INPUT_TYPE_FINGER) {
|
||||
return destWidget->OnEventInput(-1*IdInput, typeEvent, pos);
|
||||
if (type == ewol::INPUT_TYPE_MOUSE || type == ewol::INPUT_TYPE_FINGER) {
|
||||
return destWidget->OnEventInput(type, IdInput, typeEvent, pos);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Convert the system event id in the correct EWOL id depending of the system management mode
|
||||
*
|
||||
* This function find the next input id unused on the specifiic widget ==> on PC, the ID does not change (IHM is not the same
|
||||
*
|
||||
* @param[in] destWidget Pointer of the widget destination
|
||||
* @param[in] realInputId System Id
|
||||
*
|
||||
* @return the ewol input id
|
||||
*/
|
||||
static int32_t localGetDestinationId(ewol::inputType_te type, ewol::Widget* destWidget, int32_t realInputId)
|
||||
@ -187,7 +214,7 @@ void ewol::eventInput::Motion(ewol::inputType_te type, int pointerID, coord2D_ts
|
||||
destWidget = gui_uniqueWindows->GetWidgetAtPos(pos);
|
||||
}
|
||||
if (NULL != destWidget) {
|
||||
destWidget->OnEventInput(0, ewol::EVENT_INPUT_TYPE_MOVE, pos);
|
||||
destWidget->OnEventInput(type, 0, ewol::EVENT_INPUT_TYPE_MOVE, pos);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1,4 +1,26 @@
|
||||
|
||||
/**
|
||||
*******************************************************************************
|
||||
* @file eventInputManagement.h
|
||||
* @brief Input (mouse,finger) abstraction layer (header)
|
||||
* @author Edouard DUPIN
|
||||
* @date 00/04/2011
|
||||
* @par Project
|
||||
* ewol
|
||||
*
|
||||
* @par Copyright
|
||||
* Copyright 2011 Edouard DUPIN, all right reserved
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY.
|
||||
*
|
||||
* Licence summary :
|
||||
* You can modify and redistribute the sources code and binaries.
|
||||
* You can send me the bug-fix
|
||||
*
|
||||
* Term of the licence in in the file licence.txt.
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@ -8,6 +30,7 @@
|
||||
namespace ewol
|
||||
{
|
||||
typedef enum {
|
||||
INPUT_TYPE_UNKNOW,
|
||||
INPUT_TYPE_MOUSE,
|
||||
INPUT_TYPE_FINGER,
|
||||
} inputType_te;
|
||||
|
@ -268,13 +268,14 @@ void ewol::Button::OnRegenerateDisplay(void)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::Button::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::Button::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
|
@ -83,13 +83,14 @@ namespace ewol {
|
||||
public:
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventKb(ewol::eventKbType_te typeEvent, uniChar_t unicodeData);
|
||||
};
|
||||
|
||||
|
@ -239,13 +239,14 @@ void ewol::ButtonColor::OnRegenerateDisplay(void)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::ButtonColor::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::ButtonColor::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
|
@ -76,13 +76,14 @@ namespace ewol {
|
||||
public:
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
color_ts GetCurrentColor(void) { return m_selectedColor; };
|
||||
void SetCurrentColor(color_ts color);
|
||||
/**
|
||||
|
@ -182,13 +182,14 @@ void ewol::CheckBox::OnRegenerateDisplay(void)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::CheckBox::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::CheckBox::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on checkbox ...");
|
||||
if (1 == IdInput) {
|
||||
|
@ -68,13 +68,14 @@ namespace ewol {
|
||||
public:
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventKb(eventKbType_te typeEvent, uniChar_t unicodeData);
|
||||
};
|
||||
|
||||
|
@ -250,13 +250,14 @@ void ewol::ColorBar::OnRegenerateDisplay(void)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::ColorBar::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::ColorBar::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
coord2D_ts relativePos = RelativePosition(pos);
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
|
@ -64,13 +64,14 @@ namespace ewol {
|
||||
public:
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
};
|
||||
|
||||
extern const char * const TYPE_EOBJECT_WIDGET_COLOR_BAR;
|
||||
|
@ -316,13 +316,14 @@ ewol::Widget * ewol::ContextMenu::GetWidgetAtPos(coord2D_ts pos)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::ContextMenu::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::ContextMenu::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
//EWOL_INFO("Event ouside the context menu");
|
||||
if (IdInput > 0) {
|
||||
|
@ -90,13 +90,14 @@ namespace ewol {
|
||||
virtual ewol::Widget * GetWidgetAtPos(coord2D_ts pos);
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
/**
|
||||
* @brief Event generated to inform a flip-flop has occured on the current widget
|
||||
* @param ---
|
||||
|
@ -209,13 +209,14 @@ void ewol::Entry::OnRegenerateDisplay(void)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::Entry::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::Entry::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on Entry ...");
|
||||
if (1 == IdInput) {
|
||||
|
@ -79,13 +79,14 @@ namespace ewol {
|
||||
public:
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
/**
|
||||
* @brief Event on the keybord (if no shortcut has been detected before).
|
||||
* @param[in] type of the event (ewol::EVENT_KB_TYPE_DOWN or ewol::EVENT_KB_TYPE_UP)
|
||||
|
@ -184,13 +184,14 @@ void ewol::Image::OnRegenerateDisplay(void)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::Image::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::Image::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on BT ...");
|
||||
if (1 == IdInput) {
|
||||
|
@ -66,13 +66,14 @@ namespace ewol {
|
||||
public:
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -236,13 +236,14 @@ Tangent Function: tan(teta) = Opposite / Adjacent
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::Joystick::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::Joystick::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
if (1 == IdInput) {
|
||||
if( ewol::EVENT_INPUT_TYPE_DOWN == typeEvent
|
||||
|
@ -83,13 +83,14 @@ namespace ewol {
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
void SetLockMode(bool lockWhenOut) { m_lock = lockWhenOut; };
|
||||
void SetDisplayMode(joystickMode_te newMode) { m_displayMode = newMode; };
|
||||
/**
|
||||
|
@ -157,13 +157,14 @@ void ewol::Label::OnRegenerateDisplay(void)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::Label::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::Label::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
//EWOL_DEBUG("Event on Label ...");
|
||||
if (1 == IdInput) {
|
||||
|
@ -64,13 +64,14 @@ namespace ewol {
|
||||
public:
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
};
|
||||
|
||||
extern const char * const TYPE_EOBJECT_WIDGET_LABEL;
|
||||
|
@ -239,16 +239,17 @@ void ewol::List::OnRegenerateDisplay(void)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::List::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::List::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
coord2D_ts relativePos = RelativePosition(pos);
|
||||
if (true == WidgetScrooled::OnEventInput(IdInput, typeEvent, pos)) {
|
||||
if (true == WidgetScrooled::OnEventInput(type, IdInput, typeEvent, pos)) {
|
||||
ewol::widgetManager::FocusKeep(this);
|
||||
// nothing to do ... done on upper widet ...
|
||||
return true;
|
||||
|
@ -72,13 +72,14 @@ namespace ewol {
|
||||
virtual void OnRegenerateDisplay(void);
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
protected:
|
||||
// function call to display the list :
|
||||
virtual color_ts GetBasicBG(void) {
|
||||
|
@ -164,13 +164,14 @@ void ewol::Slider::OnRegenerateDisplay(void)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::Slider::OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::Slider::OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
coord2D_ts relativePos = RelativePosition(pos);
|
||||
//EWOL_DEBUG("Event on Slider ...");
|
||||
|
@ -69,13 +69,14 @@ namespace ewol {
|
||||
public:
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, eventInputType_te typeEvent, coord2D_ts pos);
|
||||
};
|
||||
|
||||
extern const char * const TYPE_EOBJECT_WIDGET_SLIDER;
|
||||
|
@ -145,201 +145,200 @@ void ewol::WidgetScrooled::OnRegenerateDisplay(void)
|
||||
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
bool ewol::WidgetScrooled::OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, coord2D_ts pos)
|
||||
bool ewol::WidgetScrooled::OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, coord2D_ts pos)
|
||||
{
|
||||
coord2D_ts relativePos = RelativePosition(pos);
|
||||
if (SCROLL_MODE_NORMAL == m_scroollingMode) {
|
||||
#ifdef __MODE__Touch
|
||||
if (1 == IdInput) {
|
||||
EWOL_VERBOSE("event 1 << " << (int32_t)typeEvent << "(" << x << "," << y << ")");
|
||||
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_INIT;
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
EWOL_VERBOSE("SCROOL ==> INIT");
|
||||
return true;
|
||||
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_DISABLE;
|
||||
EWOL_VERBOSE("SCROOL ==> DISABLE");
|
||||
if (ewol::INPUT_TYPE_MOUSE==type && ( ewol::INPUT_TYPE_UNKNOW==m_highSpeedType || ewol::INPUT_TYPE_MOUSE==m_highSpeedType )) {
|
||||
if (1 == IdInput && ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
// check if selected the scrolling position whth the scrolling bar ...
|
||||
if (relativePos.x >= (m_size.x-SCROLL_BAR_SPACE)) {
|
||||
if(m_size.y < m_maxSize.y) {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_VERTICAL;
|
||||
m_highSpeedType = ewol::INPUT_TYPE_MOUSE;
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = m_originScrooled.y / m_maxSize.y * (m_size.y-SCROLL_BAR_SPACE*2);
|
||||
m_highSpeedButton = 1;
|
||||
// force direct scrolling in this case
|
||||
m_originScrooled.y = (int32_t)(m_maxSize.y * (relativePos.y-SCROLL_BAR_SPACE) / (m_size.y-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, m_maxSize.y);
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
} else if (relativePos.y >= (m_size.y-SCROLL_BAR_SPACE)) {
|
||||
if(m_size.x < m_maxSize.x) {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_HORIZONTAL;
|
||||
m_highSpeedType = ewol::INPUT_TYPE_MOUSE;
|
||||
m_highSpeedStartPos.x = m_originScrooled.x / m_maxSize.x * (m_size.x-SCROLL_BAR_SPACE*2);
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
m_highSpeedButton = 1;
|
||||
// force direct scrolling in this case
|
||||
m_originScrooled.x = (int32_t)(m_maxSize.x * (relativePos.x-SCROLL_BAR_SPACE) / (m_size.x-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.x = etk_avg(0, m_originScrooled.x, m_maxSize.x);
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_originScrooled.y -= m_pixelScrolling;
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, m_maxSize.y);
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} else if (ewol::SCROLL_INIT==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
// wait that the cursor move more than 10 px to enable it :
|
||||
if( abs(relativePos.x - m_highSpeedStartPos.x) > 10
|
||||
|| abs(relativePos.y - m_highSpeedStartPos.y) > 10 ) {
|
||||
// the scrooling can start :
|
||||
// select the direction :
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE;
|
||||
EWOL_VERBOSE("SCROOL ==> ENABLE");
|
||||
MarkToReedraw();
|
||||
}
|
||||
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_originScrooled.y += m_pixelScrolling;
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, m_maxSize.y);
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} if (ewol::SCROLL_ENABLE==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
//m_originScrooled.x = (int32_t)(m_maxSize.x * x / m_size.x);
|
||||
m_originScrooled.x -= relativePos.x - m_highSpeedStartPos.x;
|
||||
m_originScrooled.y -= relativePos.y - m_highSpeedStartPos.y;
|
||||
m_originScrooled.x = etk_max(m_originScrooled.x, 0);
|
||||
m_originScrooled.y = etk_max(m_originScrooled.y, 0);
|
||||
m_originScrooled.x = etk_min(m_originScrooled.x, m_maxSize.x);
|
||||
m_originScrooled.y = etk_min(m_originScrooled.y, m_maxSize.y);
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
EWOL_VERBOSE("SCROOL ==> MOVE (" << m_originScrooled.x << "," << m_originScrooled.y << ")");
|
||||
}else if (2 == IdInput) {
|
||||
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_INIT;
|
||||
m_highSpeedType = ewol::INPUT_TYPE_MOUSE;
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
m_highSpeedButton = 2;
|
||||
return true;
|
||||
}
|
||||
} else if (ewol::SCROLL_DISABLE!=m_highSpeedMode && ewol::EVENT_INPUT_TYPE_LEAVE == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_DISABLE;
|
||||
m_highSpeedType = ewol::INPUT_TYPE_UNKNOW;
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
} else if (ewol::SCROLL_DISABLE!=m_highSpeedMode && ewol::EVENT_INPUT_TYPE_LEAVE == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_DISABLE;
|
||||
EWOL_VERBOSE("SCROOL ==> DISABLE");
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
if (1 == IdInput && ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
// check if selected the scrolling position whth the scrolling bar ...
|
||||
if (relativePos.x >= (m_size.x-SCROLL_BAR_SPACE)) {
|
||||
if(m_size.y < m_maxSize.y) {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_VERTICAL;
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = m_originScrooled.y / m_maxSize.y * (m_size.y-SCROLL_BAR_SPACE*2);
|
||||
m_highSpeedButton = 1;
|
||||
// force direct scrolling in this case
|
||||
if (IdInput==m_highSpeedButton && ewol::SCROLL_DISABLE!=m_highSpeedMode) {
|
||||
if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_GREP_END_EVENT;
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} else if (ewol::SCROLL_GREP_END_EVENT == m_highSpeedMode) {
|
||||
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_DISABLE;
|
||||
m_highSpeedType = ewol::INPUT_TYPE_UNKNOW;
|
||||
m_highSpeedButton = -1;
|
||||
MarkToReedraw();
|
||||
}
|
||||
return true;
|
||||
} else if (ewol::SCROLL_INIT==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
// wait that the cursor move more than 10 px to enable it :
|
||||
if( abs(relativePos.x - m_highSpeedStartPos.x) > 10
|
||||
|| abs(relativePos.y - m_highSpeedStartPos.y) > 10 ) {
|
||||
// the scrooling can start :
|
||||
// select the direction :
|
||||
if (relativePos.x == m_highSpeedStartPos.x) {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_VERTICAL;
|
||||
} else if (relativePos.y == m_highSpeedStartPos.y) {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_HORIZONTAL;
|
||||
} else {
|
||||
etkFloat_t coef = (relativePos.y - m_highSpeedStartPos.y) / (relativePos.x - m_highSpeedStartPos.x);
|
||||
if (abs(coef) <= 1 ) {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_HORIZONTAL;
|
||||
} else {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_VERTICAL;
|
||||
}
|
||||
}
|
||||
if (m_highSpeedMode == ewol::SCROLL_ENABLE_HORIZONTAL) {
|
||||
m_highSpeedStartPos.x = m_originScrooled.x / m_maxSize.x * (m_size.x-SCROLL_BAR_SPACE*2);
|
||||
} else {
|
||||
m_highSpeedStartPos.y = m_originScrooled.y / m_maxSize.y * (m_size.y-SCROLL_BAR_SPACE*2);
|
||||
}
|
||||
MarkToReedraw();
|
||||
}
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, m_maxSize.y);
|
||||
return true;
|
||||
} if (ewol::SCROLL_ENABLE_HORIZONTAL==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
m_originScrooled.x = (int32_t)(m_maxSize.x * (relativePos.x-SCROLL_BAR_SPACE) / (m_size.x-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.x = etk_avg(0, m_originScrooled.x, m_maxSize.x);
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} if (ewol::SCROLL_ENABLE_VERTICAL==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
m_originScrooled.y = (int32_t)(m_maxSize.y * (relativePos.y-SCROLL_BAR_SPACE) / (m_size.y-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, m_maxSize.y);
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
} else if (relativePos.y >= (m_size.y-SCROLL_BAR_SPACE)) {
|
||||
if(m_size.x < m_maxSize.x) {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_HORIZONTAL;
|
||||
m_highSpeedStartPos.x = m_originScrooled.x / m_maxSize.x * (m_size.x-SCROLL_BAR_SPACE*2);
|
||||
}
|
||||
} else if (ewol::INPUT_TYPE_FINGER==type && ( ewol::INPUT_TYPE_UNKNOW==m_highSpeedType || ewol::INPUT_TYPE_FINGER==m_highSpeedType )) {
|
||||
if (1 == IdInput) {
|
||||
EWOL_VERBOSE("event 1 << " << (int32_t)typeEvent << "(" << x << "," << y << ")");
|
||||
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_INIT;
|
||||
m_highSpeedType = ewol::INPUT_TYPE_FINGER;
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
m_highSpeedButton = 1;
|
||||
// force direct scrolling in this case
|
||||
m_originScrooled.x = (int32_t)(m_maxSize.x * (relativePos.x-SCROLL_BAR_SPACE) / (m_size.x-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.x = etk_avg(0, m_originScrooled.x, m_maxSize.x);
|
||||
EWOL_VERBOSE("SCROOL ==> INIT");
|
||||
return true;
|
||||
} else if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_DISABLE;
|
||||
m_highSpeedType = ewol::INPUT_TYPE_UNKNOW;
|
||||
EWOL_VERBOSE("SCROOL ==> DISABLE");
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} else if (ewol::SCROLL_INIT==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
// wait that the cursor move more than 10 px to enable it :
|
||||
if( abs(relativePos.x - m_highSpeedStartPos.x) > 10
|
||||
|| abs(relativePos.y - m_highSpeedStartPos.y) > 10 ) {
|
||||
// the scrooling can start :
|
||||
// select the direction :
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_FINGER;
|
||||
EWOL_VERBOSE("SCROOL ==> ENABLE");
|
||||
MarkToReedraw();
|
||||
}
|
||||
return true;
|
||||
} if (ewol::SCROLL_ENABLE_FINGER==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
//m_originScrooled.x = (int32_t)(m_maxSize.x * x / m_size.x);
|
||||
m_originScrooled.x -= relativePos.x - m_highSpeedStartPos.x;
|
||||
m_originScrooled.y -= relativePos.y - m_highSpeedStartPos.y;
|
||||
m_originScrooled.x = etk_max(m_originScrooled.x, 0);
|
||||
m_originScrooled.y = etk_max(m_originScrooled.y, 0);
|
||||
m_originScrooled.x = etk_min(m_originScrooled.x, m_maxSize.x);
|
||||
m_originScrooled.y = etk_min(m_originScrooled.y, m_maxSize.y);
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
EWOL_VERBOSE("SCROOL ==> MOVE (" << m_originScrooled.x << "," << m_originScrooled.y << ")");
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} else if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_originScrooled.y -= m_pixelScrolling;
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, m_maxSize.y);
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_originScrooled.y += m_pixelScrolling;
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, m_maxSize.y);
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}else if (2 == IdInput) {
|
||||
if (ewol::EVENT_INPUT_TYPE_DOWN == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_INIT;
|
||||
m_highSpeedStartPos.x = relativePos.x;
|
||||
m_highSpeedStartPos.y = relativePos.y;
|
||||
m_highSpeedButton = 2;
|
||||
return true;
|
||||
}
|
||||
} else if (ewol::SCROLL_DISABLE!=m_highSpeedMode && ewol::EVENT_INPUT_TYPE_LEAVE == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_DISABLE;
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
if (IdInput==m_highSpeedButton && ewol::SCROLL_DISABLE!=m_highSpeedMode) {
|
||||
if (ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_GREP_END_EVENT;
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} else if (ewol::SCROLL_GREP_END_EVENT == m_highSpeedMode) {
|
||||
if (ewol::EVENT_INPUT_TYPE_SINGLE == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_DISABLE;
|
||||
m_highSpeedButton = -1;
|
||||
MarkToReedraw();
|
||||
} else if (ewol::EVENT_INPUT_TYPE_DOUBLE == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_DISABLE;
|
||||
m_highSpeedButton = -1;
|
||||
MarkToReedraw();
|
||||
} else if (ewol::EVENT_INPUT_TYPE_TRIPLE == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_DISABLE;
|
||||
m_highSpeedButton = -1;
|
||||
MarkToReedraw();
|
||||
}
|
||||
return true;
|
||||
} else if (ewol::SCROLL_INIT==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
// wait that the cursor move more than 10 px to enable it :
|
||||
if( abs(relativePos.x - m_highSpeedStartPos.x) > 10
|
||||
|| abs(relativePos.y - m_highSpeedStartPos.y) > 10 ) {
|
||||
// the scrooling can start :
|
||||
// select the direction :
|
||||
if (relativePos.x == m_highSpeedStartPos.x) {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_VERTICAL;
|
||||
} else if (relativePos.y == m_highSpeedStartPos.y) {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_HORIZONTAL;
|
||||
} else {
|
||||
etkFloat_t coef = (relativePos.y - m_highSpeedStartPos.y) / (relativePos.x - m_highSpeedStartPos.x);
|
||||
if (abs(coef) <= 1 ) {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_HORIZONTAL;
|
||||
} else {
|
||||
m_highSpeedMode = ewol::SCROLL_ENABLE_VERTICAL;
|
||||
}
|
||||
}
|
||||
if (m_highSpeedMode == ewol::SCROLL_ENABLE_HORIZONTAL) {
|
||||
m_highSpeedStartPos.x = m_originScrooled.x / m_maxSize.x * (m_size.x-SCROLL_BAR_SPACE*2);
|
||||
} else {
|
||||
m_highSpeedStartPos.y = m_originScrooled.y / m_maxSize.y * (m_size.y-SCROLL_BAR_SPACE*2);
|
||||
}
|
||||
MarkToReedraw();
|
||||
}
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, m_maxSize.y);
|
||||
return true;
|
||||
} if (ewol::SCROLL_ENABLE_HORIZONTAL==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
m_originScrooled.x = (int32_t)(m_maxSize.x * (relativePos.x-SCROLL_BAR_SPACE) / (m_size.x-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.x = etk_avg(0, m_originScrooled.x, m_maxSize.x);
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} if (ewol::SCROLL_ENABLE_VERTICAL==m_highSpeedMode && ewol::EVENT_INPUT_TYPE_MOVE == typeEvent) {
|
||||
m_originScrooled.y = (int32_t)(m_maxSize.y * (relativePos.y-SCROLL_BAR_SPACE) / (m_size.y-SCROLL_BAR_SPACE*2));
|
||||
m_originScrooled.y = etk_avg(0, m_originScrooled.y, m_maxSize.y);
|
||||
} else if (ewol::SCROLL_DISABLE!=m_highSpeedMode && ewol::EVENT_INPUT_TYPE_LEAVE == typeEvent) {
|
||||
m_highSpeedMode = ewol::SCROLL_DISABLE;
|
||||
m_highSpeedType = ewol::INPUT_TYPE_UNKNOW;
|
||||
EWOL_VERBOSE("SCROOL ==> DISABLE");
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else if (SCROLL_MODE_CENTER == m_scroollingMode) {
|
||||
#ifdef __MODE__Touch
|
||||
// TODO ...
|
||||
#else
|
||||
etkFloat_t tmp1=ewol::GetCurrentHeight() / m_maxSize.y;
|
||||
etkFloat_t tmp2=ewol::GetCurrentWidth() / m_maxSize.x;
|
||||
//EWOL_INFO(" elements Zoom : " << tmp1 << " " << tmp2);
|
||||
tmp1 = etk_min(tmp1, tmp2);
|
||||
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_zoom -= 0.1;
|
||||
if (tmp1 < 1.0) {
|
||||
m_zoom = etk_max(tmp1, m_zoom);
|
||||
} else {
|
||||
m_zoom = etk_max(1.0, m_zoom);
|
||||
if (ewol::INPUT_TYPE_MOUSE==type) {
|
||||
etkFloat_t tmp1=ewol::GetCurrentHeight() / m_maxSize.y;
|
||||
etkFloat_t tmp2=ewol::GetCurrentWidth() / m_maxSize.x;
|
||||
//EWOL_INFO(" elements Zoom : " << tmp1 << " " << tmp2);
|
||||
tmp1 = etk_min(tmp1, tmp2);
|
||||
if (4 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_zoom -= 0.1;
|
||||
if (tmp1 < 1.0) {
|
||||
m_zoom = etk_max(tmp1, m_zoom);
|
||||
} else {
|
||||
m_zoom = etk_max(1.0, m_zoom);
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_zoom += 0.1;
|
||||
if (tmp1 > 1.0) {
|
||||
m_zoom = etk_min(tmp1, m_zoom);
|
||||
} else {
|
||||
m_zoom = etk_min(1.0, m_zoom);
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
} else if (5 == IdInput && ewol::EVENT_INPUT_TYPE_UP == typeEvent) {
|
||||
m_zoom += 0.1;
|
||||
if (tmp1 > 1.0) {
|
||||
m_zoom = etk_min(tmp1, m_zoom);
|
||||
} else {
|
||||
m_zoom = etk_min(1.0, m_zoom);
|
||||
}
|
||||
MarkToReedraw();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
EWOL_ERROR("Scrolling mode unknow ... " << m_scroollingMode );
|
||||
}
|
||||
|
@ -33,12 +33,9 @@ namespace ewol {
|
||||
typedef enum {
|
||||
SCROLL_DISABLE,
|
||||
SCROLL_INIT,
|
||||
#ifdef __MODE__Touch
|
||||
SCROLL_ENABLE,
|
||||
#else
|
||||
SCROLL_ENABLE_HORIZONTAL,
|
||||
SCROLL_ENABLE_VERTICAL,
|
||||
#endif
|
||||
SCROLL_ENABLE_FINGER, // Specific for touchpad
|
||||
SCROLL_ENABLE_HORIZONTAL, // Specific for mouse
|
||||
SCROLL_ENABLE_VERTICAL, // Specific for mouse
|
||||
SCROLL_GREP_END_EVENT,
|
||||
}highSpeedMode_te;
|
||||
|
||||
@ -53,15 +50,16 @@ namespace ewol {
|
||||
void AddOObject(ewol::OObject* newObject, int32_t pos=-1);
|
||||
void ClearOObjectList(void);
|
||||
protected:
|
||||
coord2D_ts m_originScrooled;
|
||||
coord2D_ts m_maxSize;
|
||||
etkFloat_t m_zoom; //!< current zoom on the display
|
||||
coord2D_ts m_originScrooled;
|
||||
coord2D_ts m_maxSize;
|
||||
etkFloat_t m_zoom; //!< current zoom on the display
|
||||
private:
|
||||
scrollingMode_te m_scroollingMode; //!< mode of management of the scrooling
|
||||
etkFloat_t m_pixelScrolling;
|
||||
coord2D_ts m_highSpeedStartPos;
|
||||
highSpeedMode_te m_highSpeedMode;
|
||||
int32_t m_highSpeedButton;
|
||||
scrollingMode_te m_scroollingMode; //!< mode of management of the scrooling
|
||||
etkFloat_t m_pixelScrolling;
|
||||
coord2D_ts m_highSpeedStartPos;
|
||||
highSpeedMode_te m_highSpeedMode;
|
||||
int32_t m_highSpeedButton;
|
||||
ewol::inputType_te m_highSpeedType;
|
||||
public:
|
||||
WidgetScrooled(void);
|
||||
virtual ~WidgetScrooled(void);
|
||||
@ -84,13 +82,14 @@ namespace ewol {
|
||||
virtual void OnDraw(void);
|
||||
/**
|
||||
* @brief Event on an input of this Widget
|
||||
* @param[in] type Type of the input (ewol::INPUT_TYPE_MOUSE/ewol::INPUT_TYPE_FINGER ...)
|
||||
* @param[in] IdInput Id of the current Input (PC : left=1, right=2, middle=3, none=0 / Tactil : first finger=1 , second=2 (only on this widget, no knowledge at ouside finger))
|
||||
* @param[in] typeEvent ewol type of event like EVENT_INPUT_TYPE_DOWN/EVENT_INPUT_TYPE_MOVE/EVENT_INPUT_TYPE_UP/EVENT_INPUT_TYPE_SINGLE/EVENT_INPUT_TYPE_DOUBLE/...
|
||||
* @param[in] pos Absolute position of the event
|
||||
* @return true the event is used
|
||||
* @return false the event is not used
|
||||
*/
|
||||
virtual bool OnEventInput(int32_t IdInput, ewol::eventInputType_te typeEvent, coord2D_ts pos);
|
||||
virtual bool OnEventInput(ewol::inputType_te type, int32_t IdInput, ewol::eventInputType_te typeEvent, coord2D_ts pos);
|
||||
/**
|
||||
* @brief extern interface to request a draw ... (called by the drawing thread [Android, X11, ...])
|
||||
* This function generate a clipping with the viewport openGL system. Like this a widget draw can not draw over an other widget
|
||||
|
Loading…
x
Reference in New Issue
Block a user