NXWidgets  1.19
cwidgeteventhandler.hxx
Go to the documentation of this file.
1 /****************************************************************************
2  * NxWidgets/libnxwidgets/include/cwidgeteventhandler.hxx
3  *
4  * Copyright (C) 2012 Gregory Nutt. All rights reserved.
5  * Author: Gregory Nutt <gnutt@nuttx.org>
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
18  * me be used to endorse or promote products derived from this software
19  * without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
28  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
29  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *
34  ****************************************************************************
35  *
36  * Portions of this package derive from Woopsi (http://woopsi.org/) and
37  * portions are original efforts. It is difficult to determine at this
38  * point what parts are original efforts and which parts derive from Woopsi.
39  * However, in any event, the work of Antony Dzeryn will be acknowledged
40  * in most NxWidget files. Thanks Antony!
41  *
42  * Copyright (c) 2007-2011, Antony Dzeryn
43  * All rights reserved.
44  *
45  * Redistribution and use in source and binary forms, with or without
46  * modification, are permitted provided that the following conditions are met:
47  *
48  * * Redistributions of source code must retain the above copyright
49  * notice, this list of conditions and the following disclaimer.
50  * * Redistributions in binary form must reproduce the above copyright
51  * notice, this list of conditions and the following disclaimer in the
52  * documentation and/or other materials provided with the distribution.
53  * * Neither the names "Woopsi", "Simian Zombie" nor the
54  * names of its contributors may be used to endorse or promote products
55  * derived from this software without specific prior written permission.
56  *
57  * THIS SOFTWARE IS PROVIDED BY Antony Dzeryn ``AS IS'' AND ANY
58  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
59  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
60  * DISCLAIMED. IN NO EVENT SHALL Antony Dzeryn BE LIABLE FOR ANY
61  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
62  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
63  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
64  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
65  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
66  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67  *
68  ****************************************************************************/
69 
70 #ifndef __INCLUDE_CWIDGETEVENTHANDLER_HXX
71 #define __INCLUDE_CWIDGETEVENTHANDLER_HXX
72 
73 /****************************************************************************
74  * Included Files
75  ****************************************************************************/
76 
77 #include <nuttx/config.h>
78 
79 #include <stdint.h>
80 #include <stdbool.h>
81 
82 #include "cwidgeteventargs.hxx"
83 
84 /****************************************************************************
85  * Pre-Processor Definitions
86  ****************************************************************************/
87 
88 /****************************************************************************
89  * Implementation Classes
90  ****************************************************************************/
91 
92 #if defined(__cplusplus)
93 
94 namespace NXWidgets
95 {
96  class CNxWidget;
97 
98  /**
99  * Base CWidgetEventHandler class, intended to be subclassed. Any class that
100  * needs to listen for widget events should inherit from this class.
101  */
102 
104  {
105  public:
106  /**
107  * Constructor.
108  */
109 
110  inline CWidgetEventHandler() { }
111 
112  /**
113  * Destructor.
114  */
115 
116  virtual inline ~CWidgetEventHandler() { }
117 
118  /**
119  * Handle a mouse button click event.
120  *
121  * @param e The event data.
122  */
123 
124  virtual void handleClickEvent(const CWidgetEventArgs &e) { }
125 
126  /**
127  * Handle a mouse button drag event.
128  *
129  * @param e The event data.
130  */
131 
132  virtual void handleDragEvent(const CWidgetEventArgs &e) { }
133 
134  /**
135  * Handle a drop event, triggered when the widget has been dragged-and-dropped.
136  *
137  * @param e The event data.
138  */
139 
140  virtual void handleDropEvent(const CWidgetEventArgs &e) { }
141 
142  /**
143  * Handle a mouse button release event that occurred within the bounds of
144  * the source widget.
145  *
146  * @param e The event data.
147  */
148 
149  virtual void handleReleaseEvent(const CWidgetEventArgs &e) { }
150 
151  /**
152  * Handle a mouse button release event that occurred outside the bounds of
153  * the source widget.
154  *
155  * @param e The event data.
156  */
157 
158  virtual void handleReleaseOutsideEvent(const CWidgetEventArgs &e) { }
159 
160  /**
161  * Handle a key press event.
162  *
163  * @param e The event data.
164  */
165 
166  virtual void handleKeyPressEvent(const CWidgetEventArgs &e) { }
167 
168  /**
169  * Handle a cursor control event.
170  *
171  * @param e The event data.
172  */
173 
174  virtual void handleCursorControlEvent(const CWidgetEventArgs &e) { }
175 
176  /**
177  * Handle a key repeat event.
178  *
179  * @param e The event data.
180  */
181 
182  virtual void handleFocusEvent(const CWidgetEventArgs &e) { }
183 
184  /**
185  * Handle a widget blur event.
186  *
187  * @param e The event data.
188  */
189 
190  virtual void handleBlurEvent(const CWidgetEventArgs &e) { }
191 
192  /**
193  * Handle a widget close event.
194  *
195  * @param e The event data.
196  */
197 
198  virtual void handleCloseEvent(const CWidgetEventArgs &e) { }
199 
200  /**
201  * Handle a widget hide event.
202  *
203  * @param e The event data.
204  */
205 
206  virtual void handleHideEvent(const CWidgetEventArgs &e) { }
207 
208  /**
209  * Handle a widget show event.
210  *
211  * @param e The event data.
212  */
213 
214  virtual void handleShowEvent(const CWidgetEventArgs &e) { }
215 
216  /**
217  * Handle a widget enable event.
218  *
219  * @param e The event data.
220  */
221 
222  virtual void handleEnableEvent(const CWidgetEventArgs &e) { }
223 
224  /**
225  * Handle a widget disable event.
226  *
227  * @param e The event data.
228  */
229 
230  virtual void handleDisableEvent(const CWidgetEventArgs &e) { }
231 
232  /**
233  * Handle a widget value change event.
234  *
235  * @param e The event data.
236  */
237 
238  virtual void handleValueChangeEvent(const CWidgetEventArgs &e) { }
239 
240  /**
241  * Handle a widget resize event.
242  *
243  * @param e The event data.
244  */
245 
246  virtual void handleResizeEvent(const CWidgetEventArgs &e) { }
247 
248  /**
249  * Handle a widget move event.
250  *
251  * @param e The event data.
252  */
253 
254  virtual void handleMoveEvent(const CWidgetEventArgs &e) { }
255 
256  /**
257  * Handle a widget scroll event.
258  *
259  * @param e The event data.
260  */
261 
262  virtual void handleScrollEvent(const CWidgetEventArgs &e) { }
263 
264  /**
265  * Handle a widget double-click event.
266  *
267  * @param e The event data.
268  */
269 
270  virtual void handleDoubleClickEvent(const CWidgetEventArgs &e) { }
271 
272  /**
273  * Handle a widget action event. For CImage, this is a mouse button pre-release event.
274  *
275  * @param e The event data.
276  */
277 
278  virtual void handleActionEvent(const CWidgetEventArgs &e) { }
279  };
280 }
281 
282 #endif // __cplusplus
283 
284 #endif // __INCLUDE_CWIDGETEVENTHANDLER_HXX
virtual void handleShowEvent(const CWidgetEventArgs &e)
virtual void handleDoubleClickEvent(const CWidgetEventArgs &e)
virtual void handleResizeEvent(const CWidgetEventArgs &e)
virtual void handleValueChangeEvent(const CWidgetEventArgs &e)
virtual void handleKeyPressEvent(const CWidgetEventArgs &e)
virtual void handleBlurEvent(const CWidgetEventArgs &e)
virtual void handleScrollEvent(const CWidgetEventArgs &e)
virtual void handleHideEvent(const CWidgetEventArgs &e)
virtual void handleActionEvent(const CWidgetEventArgs &e)
virtual void handleClickEvent(const CWidgetEventArgs &e)
virtual void handleMoveEvent(const CWidgetEventArgs &e)
virtual void handleCloseEvent(const CWidgetEventArgs &e)
virtual void handleFocusEvent(const CWidgetEventArgs &e)
virtual void handleDragEvent(const CWidgetEventArgs &e)
virtual void handleDropEvent(const CWidgetEventArgs &e)
virtual void handleReleaseEvent(const CWidgetEventArgs &e)
virtual void handleEnableEvent(const CWidgetEventArgs &e)
virtual void handleCursorControlEvent(const CWidgetEventArgs &e)
virtual void handleDisableEvent(const CWidgetEventArgs &e)
virtual void handleReleaseOutsideEvent(const CWidgetEventArgs &e)