2012-05-09 21:31:48 +02:00
|
|
|
/****************************************************************************
|
2018-09-17 01:23:45 +02:00
|
|
|
* apps/include/graphics/nxwidgets/cwindoweventhandlerlist.hxx
|
2012-05-09 21:31:48 +02:00
|
|
|
*
|
2021-06-11 08:28:21 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2012-05-09 21:31:48 +02:00
|
|
|
*
|
2021-06-11 08:28:21 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2012-05-09 21:31:48 +02:00
|
|
|
*
|
2021-06-11 08:28:21 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2012-05-09 21:31:48 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2018-09-17 01:23:45 +02:00
|
|
|
#ifndef __APPS_INCLUDE_GRAPHICS_NXWIDGETS_CWINDOWEVENTHANDLERLIST_HXX
|
|
|
|
#define __APPS_INCLUDE_GRAPHICS_NXWIDGETS_CWINDOWEVENTHANDLERLIST_HXX
|
2012-05-09 21:31:48 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
2012-05-19 03:01:00 +02:00
|
|
|
|
2012-05-09 21:31:48 +02:00
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include <nuttx/nx/nxglib.h>
|
|
|
|
|
2018-09-17 01:23:45 +02:00
|
|
|
#include "graphics/nxwidgets/cwindoweventhandler.hxx"
|
|
|
|
#include "graphics/nxwidgets/tnxarray.hxx"
|
2012-05-09 21:31:48 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-Processor Definitions
|
|
|
|
****************************************************************************/
|
2014-04-14 00:26:44 +02:00
|
|
|
|
2012-05-09 21:31:48 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Implementation Classes
|
|
|
|
****************************************************************************/
|
2014-04-14 00:26:44 +02:00
|
|
|
|
2012-05-09 21:31:48 +02:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
|
|
|
|
namespace NXWidgets
|
|
|
|
{
|
|
|
|
class CListDataItem;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* List of window event handlers.
|
|
|
|
*/
|
|
|
|
class CWindowEventHandlerList
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
TNxArray<CWindowEventHandler*> m_eventHandlers; /**< List of event handlers */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the index to the window event handler.
|
|
|
|
*/
|
2014-04-14 00:26:44 +02:00
|
|
|
|
2012-05-09 21:31:48 +02:00
|
|
|
bool findWindowEventHandler(CWindowEventHandler *eventHandler, int &index);
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructor.
|
|
|
|
*
|
|
|
|
* @param widget The owning widget.
|
|
|
|
*/
|
2014-04-14 00:26:44 +02:00
|
|
|
|
2012-05-09 21:31:48 +02:00
|
|
|
CWindowEventHandlerList(void) { }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destructor.
|
|
|
|
*/
|
|
|
|
|
|
|
|
inline ~CWindowEventHandlerList(void) { }
|
2014-04-14 00:26:44 +02:00
|
|
|
|
2012-05-09 21:31:48 +02:00
|
|
|
/**
|
|
|
|
* Get the event handler at the specified index.
|
|
|
|
*
|
|
|
|
* @param index The index of the event handler.
|
|
|
|
* @return The event handler at the specified index.
|
|
|
|
*/
|
|
|
|
|
|
|
|
inline CWindowEventHandler *at(const int index) const
|
|
|
|
{
|
|
|
|
return m_eventHandlers.at(index);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the size of the array.
|
|
|
|
*
|
|
|
|
* @return The size of the array.
|
|
|
|
*/
|
|
|
|
|
|
|
|
inline const nxgl_coord_t size(void) const
|
|
|
|
{
|
|
|
|
return m_eventHandlers.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Adds a window event handler. The event handler will receive
|
|
|
|
* all events raised by this object.
|
|
|
|
* @param eventHandler A pointer to the event handler.
|
|
|
|
*/
|
2014-04-14 00:26:44 +02:00
|
|
|
|
2012-05-09 21:31:48 +02:00
|
|
|
void addWindowEventHandler(CWindowEventHandler *eventHandler);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Remove a window event handler.
|
|
|
|
*
|
|
|
|
* @param eventHandler A pointer to the event handler to remove.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void removeWindowEventHandler(CWindowEventHandler *eventHandler);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Raise the NX window redraw event.
|
2019-05-01 19:11:43 +02:00
|
|
|
*
|
|
|
|
* @param nxRect The region in the window to be redrawn
|
|
|
|
* @param more More redraw requests will follow
|
2012-05-09 21:31:48 +02:00
|
|
|
*/
|
|
|
|
|
2019-05-01 19:11:43 +02:00
|
|
|
void raiseRedrawEvent(FAR const nxgl_rect_s *nxRect, bool more);
|
2012-05-09 21:31:48 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Raise an NX window position/size change event.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void raiseGeometryEvent(void);
|
|
|
|
|
2019-05-02 22:41:53 +02:00
|
|
|
#ifdef CONFIG_NX_XYINPUT
|
2012-05-09 21:31:48 +02:00
|
|
|
/**
|
|
|
|
* Raise an NX mouse window input event.
|
|
|
|
*/
|
|
|
|
|
2019-05-08 00:16:47 +02:00
|
|
|
void raiseMouseEvent(FAR const struct nxgl_point_s *pos,
|
|
|
|
uint8_t buttons);
|
2012-05-09 21:31:48 +02:00
|
|
|
#endif
|
|
|
|
|
2019-05-02 22:41:53 +02:00
|
|
|
#ifdef CONFIG_NX_KBD
|
2012-05-09 21:31:48 +02:00
|
|
|
/**
|
2020-02-23 05:51:44 +01:00
|
|
|
* Raise an NX keyboard input event
|
2012-05-09 21:31:48 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
void raiseKeyboardEvent(void);
|
|
|
|
#endif
|
2012-05-18 00:16:02 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Raise an NX window blocked event.
|
2012-05-19 03:01:00 +02:00
|
|
|
*
|
|
|
|
* @param arg - User provided argument (see nx_block or nxtk_block)
|
2012-05-18 00:16:02 +02:00
|
|
|
*/
|
|
|
|
|
2012-05-19 03:01:00 +02:00
|
|
|
void raiseBlockedEvent(FAR void *arg);
|
2012-05-09 21:31:48 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
2018-09-17 01:23:45 +02:00
|
|
|
#endif // __APPS_INCLUDE_GRAPHICS_NXWIDGETS_CWINDOWEVENTHANDLERLIST_HXX
|