94 static D4D_POINT d4d_TouchScreenCoor = {0, 0};
97 static void D4D_HandleTouchScreen(
D4D_SCREEN* pScreen);
98 static void D4D_ManageTouchScreenEvents(
void);
104 #pragma mark D4D System Functions
130 d4d_TouchScreen_Status = 0;
131 d4d_LastTouchedObj =
NULL;
139 #if (D4D_EXTSRC_FILE_ENABLE != D4D_FALSE) && (D4D_FNT_EXTSRC_SUPPORT != D4D_FALSE)
171 D4D_ManageTouchScreenEvents();
172 d4d_TouchScreen_Status &= ~D4D_TCHSCR_STATUS_EVENTS;
179 D4D_HandleTouchScreen(pScreen);
276 if(keys != keysLastState)
281 kChange = (
Byte)(keys ^ keysLastState);
286 if((keys & D4D_KEY_UP) == 0)
295 if((keys & D4D_KEY_DOWN) == 0)
304 if((keys & D4D_KEY_LEFT) == 0)
313 if((keys & D4D_KEY_RIGHT) == 0)
322 if((keys & D4D_KEY_ENTER) == 0)
331 if((keys & D4D_KEY_ESC) == 0)
337 keysLastState = keys;
360 #ifdef D4D_INPUT_EVENT_CALLBACK
361 D4D_INPUT_EVENT_CALLBACK();
403 d4d_touchEvent.
touched = touched;
404 d4d_touchEvent.
point.
x = x;
405 d4d_touchEvent.
point.
y = y;
425 d4d_touchEvent.
touched = touched;
426 d4d_touchEvent.
point.
x = x;
427 d4d_touchEvent.
point.
y = y;
439 d4d_TouchScreen_Status = 0;
538 tmp_point.
x = point.
y;
539 tmp_point.
y = point.
x;
552 if(pSz->
cx > pSz->
cy)
597 scanCode = d4d_KeysBuff.
buff[d4d_KeysBuff.
readPos++];
604 scanCode &= ~D4D_KEY_SCANCODE_RELEASEMASK;
609 if((scanCode & D4D_KEY_SCANCODE_RELEASEMASK) == 0)
719 if((pObject->
pData->
flags & parentFlagsMask) != parentFlagsMask)
723 if((pObject->
pData->
flags & endFlagMask) == endFlagMask)
734 if((pObject->
pData->
flags & endFlagMask) == endFlagMask)
810 d4d_LastTouchedObj = pObject;
820 while(*pChildren && !D4D_FindTouchedObject(*pChildren, point))
835 static void D4D_HandleTouchScreen(
D4D_SCREEN* pScreen)
860 d4d_TouchScreen_Status &= ~D4D_TCHSCR_STATUS_NEWTOUCH;
879 if(D4D_FindTouchedObject(*pObjects, d4d_TouchScreenCoor))
886 if(d4d_LastTouchedObj)
905 if(d4d_LastTouchedObj)
907 d4d_msg.
pObject = d4d_LastTouchedObj;
908 d4d_LastTouchedObj =
NULL;
929 d4d_msg.
pObject = d4d_LastTouchedObj;
948 d4d_TouchScreen_Status &= ~D4D_TCHSCR_STATUS_LOSTTOUCH;
982 ScreenTouch = d4d_touchEvent.
touched;
983 *TouchPositionX = d4d_touchEvent.
point.
x;
984 *TouchPositionY = d4d_touchEvent.
point.
y;
1002 static void D4D_ManageTouchScreenEvents(
void)
1013 if(d4d_TouchScreen_Status & D4D_TCHSCR_STATUS_NEWTOUCH)
1016 tmp_res = D4D_GetTouchScreen(&x, &y);
1018 if(((d4d_TouchScreen_Status & D4D_TCHSCR_STATUS_TOUCHED) ^ (tmp_res)))
1023 d4d_TouchScreen_Status &= ~D4D_TCHSCR_STATUS_TOUCHED;
1034 #ifdef D4D_INPUT_EVENT_CALLBACK
1035 D4D_INPUT_EVENT_CALLBACK();
1050 pGeometry->
sz = pObject->
size;
1077 if(pGeometry->
sz.
cx >= 2)
1078 pGeometry->
sz.
cx -= 2;
1079 if(pGeometry->
sz.
cy >= 2)
1080 pGeometry->
sz.
cy -= 2;
#define D4D_OBJECT_F_TOUCHENABLE
Object has enabled touch screen capability.
#define D4D_SCR_FINT_TOUCHENABLE
UnTouched message - is send when the screen is untouched.
#define D4D_TCHSCR_STATUS_NEWTOUCH
void(* OnSysMessage)(struct D4D_MESSAGE_S *pMsg)
Object system message receiver function pointer.
#define D4D_OBJECT_F_FOCUSRECT
Object has an outlined rectangle.
#define D4D_KEY_SCANCODE_ESC
This macro is used to specify Key Scan Code ESC. If not defined, it sets to 0x01 as a default...
#define D4D_KEY_SCANCODE_RIGHT
This macro is used to specify Key Scan Code RIGHT. If not defined, it sets to 0x4D as a default...
D4D_OBJECT * d4d_pKeysCapturer
D4D_OBJECT_SYS_FUNCTION * pObjFunc
The pointer on object system functions.
Type definition of eGUI touch screen event structure.
#define D4D_KEY_SCANCODE_UP
This macro is used to specify Key Scan Code UP. If not defined, it sets to 0x51 as a default...
void D4D_InvalidateScreen(const D4D_SCREEN *pScreen, D4D_BOOL bComplete)
The function mark the screen and its abject as "redraw pending".
D4D_TEXT_PROPERTIES text_properties
Text properties structure.
D4D_ON_USR_MSG OnUsrMessage
The pointer on user message.
D4D_SYSTEM_FLAGS d4d_systemFlags
Byte D4D_TOUCHSCREEN_STATUS
Type definition of eGUI touch screen calibration structure.
Type definition of eGUI point structure.
const D4D_OBJECT *const * pObjects
NULL-terminated array of objects (may lay in ROM)
void D4D_SendMessageMask(D4D_MESSAGE *pMsg, D4D_OBJECT_FLAGS parentFlagsMask, D4D_OBJECT_FLAGS endFlagMask)
D4D_COOR left
Margin of left side.
void(* D4DLCD_FlushBuffer)(D4DLCD_FLUSH_MODE mode)
The LCD driver flush function.
D4D object messages structure.
D4D_OBJECT_DATA_PTR pData
Pointer on runtime object data.
void D4D_TCH_Calibrate(D4D_COLOR fore, D4D_COLOR bckg)
#define D4D_TCHSCR_STATUS_CHECKTOUCH
#define D4D_TCHSCR_STATUS_NEWEVENT
D4D_BOOL D4D_ScrCheckExitBtnCoor(D4D_SCREEN *pScreen, D4D_POINT *point)
#define D4D_KEY_UP
This macro is used to specify Key UP in mask mode (obsolete). If not defined, it sets to 0x01 as a de...
#define D4D_KEY_ESC
This macro is used to specify Key ESC in mask mode (obsolete). If not defined, it sets to 0x20 as a d...
#define D4D_FALSE
This is definition of boolean operation value in eGUI - FALSE.
The string type. This structure contains all properties about string in eGUI.
#define D4D_OBJECT_F_TABSTOP
Object can be focused.
D4D_POINT D4D_SwapCoor(D4D_POINT point)
Function swap the point coordination.
#define D4D_KEY_RIGHT
This macro is used to specify Key RIGHT in mask mode (obsolete). If not defined, it sets to 0x08 as a...
D4D_POINT point
Point of touch event or lost of touch event.
void(* OnMain)(void)
Screen event handler of main screen handler function.
Byte D4D_KEYS
Type definition of eGUI keys - this is obsolete type that is kept just only for backward compatibilit...
D4D_KEY_SCANCODE buff[D4D_KEYS_BUFF_LENGTH]
#define D4D_OBJECT_F_ENABLED
Object after initialization is enabled.
D4D_POINT D4D_GetTouchScreenCoordinates(D4D_OBJECT *pObject)
D4D_BOOL D4D_Init(const D4D_SCREEN *pInitScreen)
Function inits the eGUI itself including all low level drivers.
void D4D_SetOrientation(D4D_ORIENTATION orient)
Set screen orientation function.
Byte D4D_TCH_GetCalibrationStatus(void)
void D4D_CalibrateTouchScreen(void)
#define D4D_TRUE
This is definition of boolean operation value in eGUI - TRUE.
D4D_BOOL D4D_ObjectCheckCoordinates(D4D_OBJECT *pThis, D4D_POINT point)
D4D_SCREEN_FLAGS flags
Screen behaviour flags.
void D4D_TCH_GetCalibratedPosition(D4D_COOR *TouchPositionX, D4D_COOR *TouchPositionY)
#define D4D_TCHSCR_STATUS_LOSTTOUCH
struct D4D_OBJECT_S * pObject
Pointer to object who is receiver of this message. If the receiver is just screen this field must be ...
Key Up message - is send when the object get new Key Up event.
D4D Driver main header file.
void D4D_LCD_SetOrientation(D4D_ORIENTATION new_orientation)
D4D_TOUCHSCREEN_CALIB D4D_GetTouchScreenCalibration(void)
#define D4D_KEY_SCANCODE_ENTER
This macro is used to specify Key Scan Code ENTER. If not defined, it sets to 0x1C as a default...
void D4D_PutRawTouchScreen(D4D_BOOL touched, D4D_COOR x, D4D_COOR y)
D4D_OBJECT_FLAGS flags
runtime object flags
#define D4D_KEY_FUNC_FOCUS_PREV
This macro is used to specify standard system function to to set focus to previous object...
Auto Touched message - is send when the object is still keep touch by touch screen driver ...
#define D4D_TCHSCR_STATUS_TOUCHED
#define D4D_SCREEN_HISTORY
This macro is used to set the screen buffer depth. If not defined, the 5 is used as a default...
void D4D_ClearKeysBuffer(void)
Clear all rest information about pushed Keys in buffer.
#define D4D_SCRATCHPAD_SIZE
Call back function raised by any new input event (touch, mouse, keys).
void D4D_NewKeyEvent(D4D_KEY_SCANCODE scanCode)
Place to key event into key buffer.
const D4D_SIZE d4d_size_zero
D4D Driver private header file.
#define D4D_KEY_SCANCODE_DOWN
This macro is used to specify Key Scan Code DOWN. If not defined, it sets to 0x50 as a default...
D4D_ORIENTATION
Type definition of eGUI display orientation.
Byte D4D_TEXT_PROPERTIES
The string text properties type. The masks are described here D4D BASE Defines masks of aligment prop...
void D4D_FocusNextObject(const D4D_SCREEN *pScreen, D4D_BOOL bInitialSearch)
The function change focus to the next object in the given screen.
D4D_COOR cx
Size in axis X (width)
void D4D_HandleTimeTicks(D4D_SCREEN *pScreen)
Byte D4D_COOR
Type definition of eGUI coordination variables.
#define D4D_MouseCenterCursor()
D4D_POINT position
Position on the screen/object.
#define D4D_HandleMouse()
LWord D4D_OBJECT_FLAGS
The object flags type. The masks are described here D4D OBJECT Defines masks of object behaviour flag...
#define D4D_OBJECT_USR_DATA_CHILD_IX
The relations object index to relation array for first child object.
const D4D_MARGIN d4d_marginDefault
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
void D4D_FocusPrevObject(const D4D_SCREEN *pScreen)
The function change focus to the previous object in the given screen.
D4D_COOR bottom
Margin of bottom side.
void D4D_HandleKeys(void)
D4D_BOOL(* CheckCoordinates)(struct D4D_OBJECT_S *pObj, D4D_POINT point)
Object check coordinates function pointer (return true or false if the input point fits into the obje...
D4D_COOR right
Margin of right side.
Byte d4d_scratchPad[D4D_SCRATCHPAD_SIZE]
void D4D_CheckTouchScreen(void)
D4D_TOUCHSCREEN_CALIB D4D_TCH_GetCalibration(void)
void D4D_ActivateScreen(const D4D_SCREEN *pNewScreen, D4D_BOOL bReplaceCurrent)
The function activate the new screen.
#define NULL
Type definition of null pointer.
void D4D_SetTextProperties(D4D_OBJECT_PTR pObject, D4D_TEXT_PROPERTIES property)
Function sets object text properties.
#define D4D_KEY_FUNC_FOCUS_NEXT
This macro is used to specify standard system function to to set focus to next object. If not defined, it sets to D4D_KEY_SCANCODE_DOWN as a default.
D4D_STR_PROPERTIES * str_properties
pointer to string properties
D4D_COOR y
Coordination in axis Y.
D4D_SCREEN * D4D_GetActiveScreen(void)
Returns pointer to current active screen.
#define D4D_COLOR_SYSTEM_FORE
This macro is used to define the system fore color (For example used in touch screen calibration)...
#define D4D_SCR_F_EXIT
The screen has exit button in title bar.
Byte D4D_TCH_GetRawPosition(D4D_COOR *TouchPositionX, D4D_COOR *TouchPositionY)
#define D4D_SYSTEM_F_SYSTEM_KEYS_DISABLE
#define D4D_MouseShow(show)
D4D_SIZE sz
Size of object.
D4D_OBJECT_PTR D4D_GetFocusedObject(const D4D_SCREEN *pScreen)
The function returns pointer to object that is focused in given screen.
#define D4D_KEY_ENTER
This macro is used to specify Key ENTER in mask mode (obsolete). If not defined, it sets to 0x10 as a...
D4D_MSGID nMsgId
Type of message.
D4D_SIZE size
Size of the object.
#define D4D_OBJECT_USR_DATA_PARENT_IX
The relations object index to relation array for parent object.
#define D4D_COLOR_SYSTEM_BCKG
This macro is used to define the system background color (For example used in touch screen calibratio...
void D4D_PutTouchScreen(D4D_BOOL touched, D4D_COOR x, D4D_COOR y)
Byte flags
Internal screen flags.
#define D4D_KEY_SCANCODE_LEFT
This macro is used to specify Key Scan Code LEFT. If not defined, it sets to 0x4B as a default...
#define D4D_KEY_LEFT
This macro is used to specify Key LEFT in mask mode (obsolete). If not defined, it sets to 0x04 as a ...
D4D_POINT pnt
Left Top corner point.
D4D_KEY_SCANCODE key
There will be stored only code of key without release / press information - is valid with D4D_MSG_KEY...
D4D_POINT D4D_GetClientToScreenPoint(D4D_OBJECT *pObject, D4D_POINT *nClientPoint)
The function convert client point on the screen to the global screen point.
Byte(* OnObjectMsg)(struct D4D_MESSAGE_S *pMsg)
Screen event handler of called before object receives the message.
void D4D_TCH_SetCalibration(D4D_TOUCHSCREEN_CALIB newCalib)
The object main structure type definition.
#define D4D_BEVEL_WIDTH
D4D_BEVEL_WIDTH constant declaration - can't be changed!
D4D_SCREEN_DATA * pData
pointer to screen private run time data
Lost Touch message - is send when the screen is still touch but the coordination leaves the original ...
void D4D_KeysChanged(D4D_KEYS keys)
Place to keys buffer new keys events by binary mask.
void D4D_ComputeGeometry(D4D_GEOMETRY *pGeometry, D4D_OBJECT *pObject)
void D4D_EscapeScreen(void)
The function return to previous screen recorded in the history.
D4D_COOR cy
Size in axis Y (height)
void D4D_TimeTickPut(void)
Notify eGui about new tick tick occur.
void D4D_Poll(void)
Main eGUI function. Must be periodically called in main loop/task loop.
D4D_OBJECT_RELATIONS pRelations
Relationship between the objects.
D4D_BOOL D4D_LCD_Init(void)
#define D4D_KEY_SCANCODE_RELEASEMASK
Mask of scan code for key release. MSB bit of Byte. If this bit is clear, the goes down...
#define D4D_OBJECT_F_VISIBLE
Object after initialization is visible on the screen.
const D4DLCD_FUNCTIONS D4D_LLD_LCD
Touched message - is send when the object is touched by touch screen driver.
LWord D4D_BOOL
Type definition of eGUI boolean.
void D4D_FlushOutput(void)
Function force flush output to LCD.
Type definition of eGUI size structure.
struct D4D_STRING_S *(* GetTextBuffer)(struct D4D_OBJECT_S *pObj)
Object get text buffer function pointer (the function returns the pointer of the object text buffer...
void D4D_EnableSystemKeys(D4D_BOOL bEnable)
Function enable or disable handling system keys (ESC, UP/DOWN, LEFT/RIGHT) automatically.
#define D4D_KEYS_BUFF_LENGTH
This macro is used to specify leght of keybord events buffer. If not defined, it sets to 4 events as ...
D4D_OBJECT_DRAWFLAGS draw
Contains draw flags - is valid with D4D_MSG_DRAW and D4D_MSG_DRAWDONE message.
const D4D_POINT d4d_point_zero
void D4D_SetTouchScreenCalibration(D4D_TOUCHSCREEN_CALIB newCalib)
The screen structure type. The main screen structure that contains all needed data to run the eGUI sc...
Type definition of eGUI geometry structure.
#define D4D_SYSTEM_F_TIMETICK
#define D4D_TCHSCR_STATUS_EVENTS
void D4D_SetFontProperties(D4D_OBJECT_PTR pObject, D4D_FONT_PROPERTIES property)
Function sets object text font properties.
#define D4D_KEY_DOWN
This macro is used to specify Key DOWN in mask mode (obsolete). If not defined, it sets to 0x02 as a ...
Byte d4d_screenHistoryIndex
void D4D_InvalidateObject(D4D_OBJECT_PTR pObject, D4D_BOOL bComplete)
Function invalidate object to redraw on screen.
D4D_MARGIN * pMargin
Object inner margin.
D4D driver - resistive touch screen driver function header file.
#define D4D_OBJECT_F_BEVEL_MASK
Object bevel border mask.
void D4D_SendMessage(D4D_MESSAGE *pMsg)
D4D_SCREEN * d4d_screenHistory[D4D_SCREEN_HISTORY]
Byte D4D_KEY_SCANCODE
Type definition of eGUI keys scan code.
#define D4D_TCHSCR_STATUS_NEWRAWEVENT
Key Down message - is send when the object get new Key Down event.
D4D_BOOL touched
Boolean of touch state (touched or non touched)
void D4D_RedrawScreen(D4D_SCREEN *pScreen)
void D4D_SendMessageBack(D4D_MESSAGE *pMsg)
struct D4D_SCREEN_S * pScreen
Pointer to screen who is receiver of this message.
D4D_FONT_PROPERTIES font_properties
Font properties structure.
D4D_BOOL D4D_ScrCheckCoor(D4D_SCREEN *pScreen, D4D_POINT *point)
The function check if the coordination are in screen area.
void D4D_ClearTouchScreenEvents(void)
D4D_COOR D4D_GetLongerSide(D4D_SIZE *pSz)
Function returns longer side of size structure.
The notification of forcing flush by user code.
D4D_COOR top
Margin of top side.
D4D_COOR x
Coordination in axis X.
union D4D_MESSAGE_S::@0 prm
Additional data for some type of messages.
Type definition of eGUI client area margin structure.
static D4D_KEYS_BUFFER d4d_KeysBuff
D4D_BOOL D4D_IsEnabled(D4D_OBJECT *pObject)
Function find out if the object is enabled or not.
D4D_POINT D4D_GetScreenToClientPoint(D4D_OBJECT *pObject, D4D_POINT *nScreenPoint)
The function convert global screen point on the screen to the client point.
The screen run time data type. It used to internal store the runtime data by eGUI.
#define D4D_KEY_SCANCODE_KEYMASK
Mask of scan code for key index. Lower 7 bits of Byte.