summaryrefslogtreecommitdiff
path: root/nuttx/include
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-12-02 16:39:39 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-12-02 16:39:39 +0000
commit763c04c953eb1111d1020653a8edb9688d3211c9 (patch)
tree47f8e1b0ed67b4f5867628fe25249b98591a1c13 /nuttx/include
parentd368ddb4ccfcfe9670d166d5db983332dab6a12a (diff)
downloadpx4-nuttx-763c04c953eb1111d1020653a8edb9688d3211c9.tar.gz
px4-nuttx-763c04c953eb1111d1020653a8edb9688d3211c9.tar.bz2
px4-nuttx-763c04c953eb1111d1020653a8edb9688d3211c9.zip
Revised/simplified toolkit concept
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1390 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r--nuttx/include/nuttx/nxtk.h212
1 files changed, 164 insertions, 48 deletions
diff --git a/nuttx/include/nuttx/nxtk.h b/nuttx/include/nuttx/nxtk.h
index 4be3bb7d3..4081450e0 100644
--- a/nuttx/include/nuttx/nxtk.h
+++ b/nuttx/include/nuttx/nxtk.h
@@ -43,9 +43,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
-#include <nuttx/nxtk.h>
-#include "nxbe.h"
-#include "nxfe.h"
+#include <nuttx/nx.h>
/****************************************************************************
* Pre-processor definitions
@@ -55,42 +53,13 @@
* Public Types
****************************************************************************/
-/* This is an objects, implemented in C, that provides access to the NX
- * window APIs. Why would you use this object instead of direct calls to the
- * nx_ APIs? So that you can support polymorphism. (Doesn't this make you
- * really appreciate C++?). All of the APIs provided in the NX toolkit
- * export this interface.
- *
- * The methods provided in this call table are the nx_* window APIs discussed
- * in include/nx.h accessed through a vtable. See that header for description
- * of each method.
- */
-
-typedef FAR struct nxtk_base_s *NXTWINDOW;
-struct nxtk_base_s
-{
- /* Destructor */
-
- void (*close)(NXTWINDOW hwnd);
-
- /* Window methods (documented in include/nuttx/nx.h) */
-
- int (*getposition)(NXTWINDOW hwnd);
- int (*setposition)(NXTWINDOW hwnd, FAR struct nxgl_point_s *pos);
- int (*setsize)(NXTWINDOW hwnd, FAR struct nxgl_rect_s *size);
- int (*raise)(NXTWINDOW hwnd);
- int (*lower)(NXTWINDOW hwnd);
- int (*fill)(NXTWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
- int (*filltrapezoid)(NXTWINDOW hwnd, FAR struct nxgl_trapezoid_s *trap,
- nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
- int (*move)(NXTWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
- FAR const struct nxgl_point_s *offset);
- int (*bitmap)(NXTWINDOW hwnd, FAR const struct nxgl_rect_s *dest,
- FAR const void *src[CONFIG_NX_NPLANES],
- FAR const struct nxgl_point_s *origin,
- unsigned int stride);
-};
+/* This is the handle that can be used to access the window data region */
+
+typedef FAR void *NXTKWINDOW;
+
+/* This is the handle that can be used to access the window toolbar */
+
+typedef FAR void *NXTKTOOLBAR;
/****************************************************************************
* Public Data
@@ -109,27 +78,174 @@ extern "C" {
****************************************************************************/
/****************************************************************************
- * Name: nxtk_rawwindow
+ * Name: nxtk_openwindow
*
* Description:
- * This function is the constructor for a raw NXTWINDOW object.
- * This provides a one-to-one mapping with the window APIs in nx.h.
+ * Create a new, framed window.
*
* Input Parameters:
- * handle - The handle returned by nx_connect or nx_open
+ * handle - The handle returned by nx_connect
* cb - Callbacks used to process window events
- * arg - User provided value that will be returned with NX callbacks.
+ * arg - User provided value that will be returned with NXTK callbacks.
+ *
+ * Return:
+ * Success: A non-NULL handle used with subsequent NXTK window accesses
+ * Failure: NULL is returned and errno is set appropriately
+ *
+ ****************************************************************************/
+
+EXTERN NXTKWINDOW nxtk_openwindow(NXHANDLE handle,
+ FAR const struct nx_callback_s *cb,
+ FAR void *arg);
+
+/****************************************************************************
+ * Name: nxtk_closewindow
+ *
+ * Description:
+ * Close the window opened by nxtk_openwindow
+ *
+ * Input Parameters:
+ * hfwnd - The handle returned by nxtk_openwindow
+ *
+ * Return:
+ * Success: A non-NULL handle used with subsequent NXTK window accesses
+ * Failure: NULL is returned and errno is set appropriately
+ *
+ ****************************************************************************/
+
+EXTERN void nxtk_closewindow(NXTKWINDOW hfwnd);
+
+/****************************************************************************
+ * Name: nxtk_getposition
+ *
+ * Description:
+ * Request the position and size information for the selected framed window.
+ * The size/position for the client window and toolbar will be return
+ * asynchronously through the client callback function pointer.
+ *
+ * Input Parameters:
+ * hfwnd - The window handle returned by nxtk_openwindow.
+ *
+ * Return:
+ * OK on success; ERROR on failure with errno set appropriately
+ *
+ ****************************************************************************/
+
+EXTERN int nxtk_getposition(NXTKWINDOW hfwnd);
+
+/****************************************************************************
+ * Name: nxtk_setposition
+ *
+ * Description:
+ * Set the position for the selected client window. This position does not
+ * include the offsets for the borders nor for any toolbar. Those offsets
+ * will be added in to set the full window position.
+ *
+ * Input Parameters:
+ * hfwnd - The window handle returned by nxtk_openwindow
+ * pos - The new position of the client sub-window
+ *
+ * Return:
+ * OK on success; ERROR on failure with errno set appropriately
+ *
+ ****************************************************************************/
+
+EXTERN int nxtk_setposition(NXTKWINDOW hfwnd, FAR struct nxgl_point_s *pos);
+
+/****************************************************************************
+ * Name: nxtk_setsize
+ *
+ * Description:
+ * Set the size for the selected client window. This size does not
+ * include the sizes of the borders nor for any toolbar. Those sizes
+ * will be added in to set the full window size.
+ *
+ * Input Parameters:
+ * hfwnd - The window handle returned by nxtk_openwindow
+ * size - The new size of the client sub-window.
+ *
+ * Return:
+ * OK on success; ERROR on failure with errno set appropriately
+ *
+ ****************************************************************************/
+
+EXTERN int nxtk_setsize(NXTKWINDOW hfwnd, FAR struct nxgl_rect_s *size);
+
+/****************************************************************************
+ * Name: nxtk_fillwindow
+ *
+ * Description:
+ * Fill the specified rectangle in the client window with the specified color
+ *
+ * Input Parameters:
+ * hfwnd - The window handle returned by nxtk_openwindow
+ * rect - The location within the client window to be filled
+ * color - The color to use in the fill
+ *
+ * Return:
+ * OK on success; ERROR on failure with errno set appropriately
+ *
+ ****************************************************************************/
+
+EXTERN int nxtk_fillwindow(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
+
+/****************************************************************************
+ * Name: nxtk_opentoolbar
+ *
+ * Description:
+ * Create a tool bar at the top of the specified framed window
+ *
+ * Input Parameters:
+ * hwnd - The handle returned by nxtk_openwindow
+ * height - The request height of the toolbar in pixels
+ * cb - Callbacks used to process toolbar events
+ * arg - User provided value that will be returned with toolbar callbacks.
*
* Return:
- * Success: A non-NULL handle used with subsequent method calls
+ * Success: A non-NULL handle used with subsequent NXTK toolbar accesses
* Failure: NULL is returned and errno is set appropriately
*
****************************************************************************/
-EXTERN NXTWINDOW nxtk_rawwindow(NXHANDLE handle,
- FAR const struct nx_callback_s *cb,
- FAR void *arg);
+EXTERN NXTKTOOLBAR nxtk_opentoolbar(NXTKWINDOW hwnd, nxgl_coord_t height,
+ FAR const struct nx_callback_s *cb,
+ FAR void *arg);
+
+/****************************************************************************
+ * Name: nxtk_closetoolbar
+ *
+ * Description:
+ * Create a tool bar at the top of the specified framed window
+ *
+ * Input Parameters:
+ * htb - The toolbar handle returned by nxtk_opentoolbar
+ *
+ * Return:
+ * None
+ *
+ ****************************************************************************/
+
+EXTERN void nxtk_closetoolbar(NXTKTOOLBAR htb);
+
+/****************************************************************************
+ * Name: nxtk_filltoolbar
+ *
+ * Description:
+ * Fill the specified rectangle in the client window with the specified color
+ *
+ * Input Parameters:
+ * htb - The toolbar handle returned by nxtk_opentoolbar
+ * rect - The location within the toolbar window to be filled
+ * color - The color to use in the fill
+ *
+ * Return:
+ * OK on success; ERROR on failure with errno set appropriately
+ *
+ ****************************************************************************/
+EXTERN int nxtk_filltoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_rect_s *rect,
+ nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
#undef EXTERN
#if defined(__cplusplus)
}