2012-05-12 15:50:21 +02:00
|
|
|
/****************************************************************************
|
2018-09-17 01:23:45 +02:00
|
|
|
* apps/include/graphics/nxwm/cwindowmessenger.hxx
|
2012-05-12 15:50:21 +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-12 15:50:21 +02:00
|
|
|
*
|
2021-06-11 08:28:21 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2012-05-12 15:50:21 +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-12 15:50:21 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2018-09-17 01:23:45 +02:00
|
|
|
#ifndef __APPS_INCLUDE_GRAPHICS_NXWM_CWINDOWMESSENGER_HXX
|
|
|
|
#define __APPS_INCLUDE_GRAPHICS_NXWM_CWINDOWMESSENGER_HXX
|
2012-05-12 15:50:21 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
2013-02-28 19:48:11 +01:00
|
|
|
|
2012-05-12 15:50:21 +02:00
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
2012-05-17 00:43:40 +02:00
|
|
|
|
2013-02-28 19:48:11 +01:00
|
|
|
#include <nuttx/wqueue.h>
|
2012-05-12 15:50:21 +02:00
|
|
|
#include <nuttx/nx/nxtk.h>
|
2014-09-20 22:41:45 +02:00
|
|
|
#include <nuttx/nx/nxterm.h>
|
2012-05-12 15:50:21 +02:00
|
|
|
|
2018-09-17 01:23:45 +02:00
|
|
|
#include "graphics/nxwidgets/cwindoweventhandler.hxx"
|
|
|
|
#include "graphics/nxwidgets/cwidgetstyle.hxx"
|
|
|
|
#include "graphics/nxwidgets/cwidgetcontrol.hxx"
|
2012-05-12 15:50:21 +02:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-Processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Implementation Classes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
|
|
|
|
namespace NxWM
|
|
|
|
{
|
2012-05-17 00:43:40 +02:00
|
|
|
/**
|
|
|
|
* Forward references.
|
|
|
|
*/
|
|
|
|
|
|
|
|
class IApplication;
|
|
|
|
|
2012-05-12 15:50:21 +02:00
|
|
|
/**
|
2012-05-19 01:08:34 +02:00
|
|
|
* The class CWindowMessenger integrates the widget control with some special
|
2012-05-19 17:26:38 +02:00
|
|
|
* handling of mouse and keyboard inputs needs by NxWM. It use used
|
2012-05-19 06:20:56 +02:00
|
|
|
* in place of CWidgetControl whenever an NxWM window is created.
|
|
|
|
*
|
2012-05-19 17:26:38 +02:00
|
|
|
* CWindowMessenger cohabitates with CWidgetControl only because it needs the
|
|
|
|
* CWidgetControl as an argument in its messaging.
|
2012-05-12 15:50:21 +02:00
|
|
|
*/
|
|
|
|
|
2012-05-19 06:20:56 +02:00
|
|
|
class CWindowMessenger : public NXWidgets::CWindowEventHandler,
|
|
|
|
public NXWidgets::CWidgetControl
|
2012-05-12 15:50:21 +02:00
|
|
|
{
|
|
|
|
private:
|
2013-02-28 19:48:11 +01:00
|
|
|
/** Structure that stores data for the work queue callback. */
|
|
|
|
|
|
|
|
struct work_state_t
|
|
|
|
{
|
|
|
|
work_s work;
|
|
|
|
CWindowMessenger *windowMessenger;
|
|
|
|
void *instance;
|
2017-09-24 14:20:45 +02:00
|
|
|
|
|
|
|
work_state_t() : work() {}
|
2013-02-28 19:48:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/** Work queue callback functions */
|
|
|
|
|
|
|
|
static void inputWorkCallback(FAR void *arg);
|
|
|
|
static void destroyWorkCallback(FAR void *arg);
|
|
|
|
|
2019-04-18 16:23:10 +02:00
|
|
|
#ifdef CONFIG_NX_XYINPUT
|
2012-05-12 15:50:21 +02:00
|
|
|
/**
|
|
|
|
* Handle an NX window mouse input event.
|
|
|
|
*/
|
|
|
|
|
2019-05-08 00:16:47 +02:00
|
|
|
void handleMouseEvent(FAR const struct nxgl_point_s *pos, uint8_t buttons);
|
2012-05-12 15:50:21 +02:00
|
|
|
#endif
|
|
|
|
|
2019-04-18 16:23:10 +02:00
|
|
|
#ifdef CONFIG_NX_KBD
|
2012-05-12 15:50:21 +02:00
|
|
|
/**
|
|
|
|
* Handle a NX window keyboard input event.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void handleKeyboardEvent(void);
|
|
|
|
#endif
|
|
|
|
|
2012-05-19 03:01:00 +02:00
|
|
|
/**
|
|
|
|
* Handle a NX window blocked event
|
|
|
|
*
|
|
|
|
* @param arg - User provided argument (see nx_block or nxtk_block)
|
|
|
|
*/
|
2013-02-28 19:48:11 +01:00
|
|
|
|
2012-05-19 03:01:00 +02:00
|
|
|
void handleBlockedEvent(FAR void *arg);
|
|
|
|
|
2012-05-12 15:50:21 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
/**
|
2012-05-19 01:08:34 +02:00
|
|
|
* CWindowMessenger Constructor
|
2012-05-19 06:20:56 +02:00
|
|
|
*
|
|
|
|
* @param style The default style that all widgets on this display
|
|
|
|
* should use. If this is not specified, the widget will use the
|
|
|
|
* values stored in the defaultCWidgetStyle object.
|
2012-05-12 15:50:21 +02:00
|
|
|
*/
|
|
|
|
|
2022-10-15 19:55:16 +02:00
|
|
|
CWindowMessenger(FAR const NXWidgets::CWidgetStyle *style = NULL);
|
2012-05-12 15:50:21 +02:00
|
|
|
|
|
|
|
/**
|
2012-05-19 01:08:34 +02:00
|
|
|
* CWindowMessenger Destructor.
|
2012-05-12 15:50:21 +02:00
|
|
|
*/
|
|
|
|
|
2012-05-19 01:08:34 +02:00
|
|
|
~CWindowMessenger(void);
|
2012-05-12 15:50:21 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // __cplusplus
|
|
|
|
|
2018-09-17 01:23:45 +02:00
|
|
|
#endif // __APPS_INCLUDE_GRAPHICS_NXWM_CWINDOWMESSENGER_HXX
|