NXWidgets  1.19
iapplicationwindow.hxx
Go to the documentation of this file.
1 /****************************************************************************
2  * NxWidgets/nxwm/include/iapplicationwindow.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 #ifndef __INCLUDE_IAPPLICATIONWINDOW_NXX
37 #define __INCLUDE_IAPPLICATIONWINDOW_NXX
38 
39 /****************************************************************************
40  * Included Files
41  ****************************************************************************/
42 
43 #include <nuttx/config.h>
44 
45 #include "inxwindow.hxx"
46 #include "cnxstring.hxx"
47 #include "cwidgetcontrol.hxx"
48 
49 #include "iapplication.hxx"
50 
51 /****************************************************************************
52  * Pre-Processor Definitions
53  ****************************************************************************/
54 
55 /****************************************************************************
56  * Abstract Base Class
57  ****************************************************************************/
58 
59 #if defined(__cplusplus)
60 
61 namespace NxWM
62 {
63  /**
64  * Foward references
65  */
66 
67  class IApplication;
68 
69  /**
70  * This callback class is used by the application to get notification of toolbar
71  * related events.
72  */
73 
75  {
76  public:
77  /**
78  * Called when the window minimize button is pressed.
79  */
80 
81  virtual void minimize(void) = 0;
82 
83  /**
84  * Called when the window minimize close is pressed.
85  */
86 
87  virtual void close(void) = 0;
88  };
89 
90  /**
91  * This class represents the general application window. The actual window
92  * may be a contained, framed window or and unframed, fullscreen window.
93  */
94 
96  {
97  public:
98  /**
99  * A virtual destructor is required in order to override the IApplicationWindow
100  * destructor. We do this because if we delete IApplicationWindow, we want the
101  * destructor of the class that inherits from IApplicationWindow to run, not this
102  * one.
103  */
104 
105  virtual ~IApplicationWindow(void) { }
106 
107  /**
108  * Initialize window. Window initialization is separate from
109  * object instantiation so that failures can be reported.
110  *
111  * @return True if the window was successfully initialized.
112  */
113 
114  virtual bool open(void) = 0;
115 
116  /**
117  * Re-draw the application window
118  */
119 
120  virtual void redraw(void) = 0;
121 
122  /**
123  * The application window is hidden (either it is minimized or it is
124  * maximized, but not at the top of the hierarchy)
125  */
126 
127  virtual void hide(void) = 0;
128 
129  /**
130  * Recover the contained window instance
131  *
132  * @return. The window used by this application
133  */
134 
135  virtual NXWidgets::INxWindow *getWindow(void) const = 0;
136 
137  /**
138  * Recover the contained widget control
139  *
140  * @return. The widget control used by this application
141  */
142 
143  virtual NXWidgets::CWidgetControl *getWidgetControl(void) const = 0;
144 
145  /**
146  * Block further activity on this window in preparation for window
147  * shutdown.
148  *
149  * @param app. The application to be blocked
150  */
151 
152  virtual void block(IApplication *app) = 0;
153 
154  /**
155  * Set the window label
156  *
157  * @param appname. The name of the application to place on the window
158  */
159 
160  virtual void setWindowLabel(NXWidgets::CNxString &appname) = 0;
161 
162  /**
163  * Report of this is a "normal" window or a full screen window. The
164  * primary purpose of this method is so that window manager will know
165  * whether or not it show draw the task bar.
166  *
167  * @return True if this is a full screen window.
168  */
169 
170  virtual bool isFullScreen(void) const = 0;
171 
172  /**
173  * Register to receive callbacks when toolbar icons are selected
174  */
175 
176  virtual void registerCallbacks(IApplicationCallback *callback) = 0;
177 
178  /**
179  * Simulate a mouse click or release on the minimize icon. This method
180  * is only available for automated testing of NxWM.
181  *
182  * @param click. True to click; false to release;
183  */
184 
185 #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
186  virtual void clickMinimizePosition(bool click) = 0;
187 #endif
188 
189  /**
190  * Simulate a mouse click or release on the stop icon. This method
191  * is only available for automated testing of NxWM.
192  *
193  * @param click. True to click; false to release;
194  */
195 
196 #if defined(CONFIG_NXWM_UNITTEST) && !defined(CONFIG_NXWM_TOUCHSCREEN)
197  virtual void clickStopIcon(bool click) = 0;
198 #endif
199  };
200 }
201 
202 #endif // __cplusplus
203 
204 #endif // __INCLUDE_IAPPLICATIONWINDOW_NXX
virtual void minimize(void)=0
virtual void close(void)=0