9
0
Fork 0

Removed superfluous toolbar handle

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@1412 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2008-12-04 12:57:22 +00:00
parent 5a93c015fe
commit f4f53db66c
9 changed files with 103 additions and 60 deletions

View File

@ -166,7 +166,7 @@ static inline void nxeg_fillwindow(NXEGWINDOW hwnd,
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS #ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
static inline void nxeg_filltoolbar(NXTKTOOLBAR htb, static inline void nxeg_filltoolbar(NXTKWINDOW htb,
FAR const struct nxgl_rect_s *rect, FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]) nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{ {

View File

@ -256,18 +256,18 @@ static inline int nxeg_setposition(NXTKWINDOW hwnd, FAR struct nxgl_point_s *pos
****************************************************************************/ ****************************************************************************/
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS #ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
static inline NXTKTOOLBAR nxeq_opentoolbar(NXTKWINDOW hwnd, nxgl_coord_t height, static inline int nxeq_opentoolbar(NXTKWINDOW hwnd, nxgl_coord_t height,
FAR const struct nx_callback_s *cb, FAR const struct nx_callback_s *cb,
FAR void *arg) FAR void *arg)
{ {
NXTKTOOLBAR htb; int ret;
htb = nxtk_opentoolbar(hwnd, height, cb, arg); ret = nxtk_opentoolbar(hwnd, height, cb, arg);
if (!htb < 0) if (ret < 0)
{ {
message("user_start: nxtk_opentoolbar failed: %d\n", errno); message("user_start: nxtk_opentoolbar failed: %d\n", errno);
g_exitcode = NXEXIT_NXOPENTOOLBAR; g_exitcode = NXEXIT_NXOPENTOOLBAR;
} }
return htb; return ret;
} }
#endif #endif
@ -505,8 +505,6 @@ int user_start(int argc, char *argv[])
#else #else
NXTKWINDOW hwnd1; NXTKWINDOW hwnd1;
NXTKWINDOW hwnd2; NXTKWINDOW hwnd2;
NXTKTOOLBAR htb1;
NXTKTOOLBAR htb2;
#endif #endif
struct nxgl_size_s size; struct nxgl_size_s size;
struct nxgl_point_s pt; struct nxgl_point_s pt;
@ -595,8 +593,8 @@ int user_start(int argc, char *argv[])
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS #ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
message("user_start: Add toolbar to window #1\n"); message("user_start: Add toolbar to window #1\n");
htb1 = nxeq_opentoolbar(hwnd1, CONFIG_TOOLBAR_HEIGHT, &g_tbcb, (FAR void*)1); ret = nxeq_opentoolbar(hwnd1, CONFIG_TOOLBAR_HEIGHT, &g_tbcb, (FAR void*)1);
if (!htb1) if (ret < 0)
{ {
goto errout_with_hwnd1; goto errout_with_hwnd1;
} }
@ -655,8 +653,8 @@ int user_start(int argc, char *argv[])
#ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS #ifndef CONFIG_EXAMPLES_NX_RAWWINDOWS
message("user_start: Add toolbar to window #2\n"); message("user_start: Add toolbar to window #2\n");
htb2 = nxeq_opentoolbar(hwnd2, CONFIG_TOOLBAR_HEIGHT, &g_tbcb, (FAR void*)2); ret = nxeq_opentoolbar(hwnd2, CONFIG_TOOLBAR_HEIGHT, &g_tbcb, (FAR void*)2);
if (!htb2) if (ret < 0)
{ {
goto errout_with_hwnd2; goto errout_with_hwnd2;
} }

View File

@ -80,7 +80,7 @@
* specified toolbar sub-window. * specified toolbar sub-window.
* *
* Input Parameters: * Input Parameters:
* htb - The toolbar sub-window that will receive the bitmap image * hfwnd - The sub-window twhose toolbar will receive the bitmap image
* dest - Describes the rectangular region on in the toolbar sub-window * dest - Describes the rectangular region on in the toolbar sub-window
* will receive the bit map. * will receive the bit map.
* src - The start of the source image. * src - The start of the source image.
@ -94,15 +94,15 @@
* *
****************************************************************************/ ****************************************************************************/
int nxtk_bitmaptoolbar(NXTKWINDOW htb, FAR const struct nxgl_rect_s *dest, int nxtk_bitmaptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES], FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin, unsigned int stride) FAR const struct nxgl_point_s *origin, unsigned int stride)
{ {
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)htb; FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;
struct nxgl_rect_s clipdest; struct nxgl_rect_s clipdest;
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
if (!htb || !dest || !src || !origin) if (!hfwnd || !dest || !src || !origin)
{ {
errno = EINVAL; errno = EINVAL;
return ERROR; return ERROR;
@ -118,6 +118,6 @@ int nxtk_bitmaptoolbar(NXTKWINDOW htb, FAR const struct nxgl_rect_s *dest,
/* Then copy the bitmap */ /* Then copy the bitmap */
nx_bitmap((NXWINDOW)htb, &clipdest, src, origin, stride); nx_bitmap((NXWINDOW)hfwnd, &clipdest, src, origin, stride);
return OK; return OK;
} }

View File

@ -81,16 +81,16 @@
* Create a tool bar at the top of the specified framed window * Create a tool bar at the top of the specified framed window
* *
* Input Parameters: * Input Parameters:
* htb - The toolbar handle returned by nxtk_opentoolbar * hfwnd - The handle returned by nxtk_openwindow
* *
* Return: * Return:
* OK on success; ERROR on failure with errno set appropriately * OK on success; ERROR on failure with errno set appropriately
* *
****************************************************************************/ ****************************************************************************/
int nxtk_closetoolbar(NXTKTOOLBAR htb) int nxtk_closetoolbar(NXTKWINDOW hfwnd)
{ {
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)htb; FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;
/* Un-initialize the toolbar info */ /* Un-initialize the toolbar info */

View File

@ -81,7 +81,7 @@
* Fill the specified rectangle in the client window with the specified color * Fill the specified rectangle in the client window with the specified color
* *
* Input Parameters: * Input Parameters:
* htb - The toolbar handle returned by nxtk_opentoolbar * hfwnd - The handle returned by nxtk_openwindow
* rect - The location within the toolbar window to be filled * rect - The location within the toolbar window to be filled
* color - The color to use in the fill * color - The color to use in the fill
* *
@ -90,14 +90,14 @@
* *
****************************************************************************/ ****************************************************************************/
int nxtk_filltoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_rect_s *rect, int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]) nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{ {
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)htb; FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;
struct nxgl_rect_s fillrect; struct nxgl_rect_s fillrect;
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
if (!htb || !rect || !color) if (!hfwnd || !rect || !color)
{ {
errno = EINVAL; errno = EINVAL;
return ERROR; return ERROR;
@ -113,5 +113,5 @@ int nxtk_filltoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_rect_s *rect,
/* Then fill it */ /* Then fill it */
return nx_fill((NXWINDOW)htb, &fillrect, color); return nx_fill((NXWINDOW)hfwnd, &fillrect, color);
} }

View File

@ -81,7 +81,7 @@
* Fill the specified rectangle in the toolbar with the specified color * Fill the specified rectangle in the toolbar with the specified color
* *
* Input Parameters: * Input Parameters:
* htb - The window handle returned by nxtk_openwindow * hfwnd - The handle returned by nxtk_openwindow
* trap - The trapezoidal region to be filled * trap - The trapezoidal region to be filled
* color - The color to use in the fill * color - The color to use in the fill
* *
@ -90,14 +90,14 @@
* *
****************************************************************************/ ****************************************************************************/
int nxtk_filltraptoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_trapezoid_s *trap, int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *trap,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]) nxgl_mxpixel_t color[CONFIG_NX_NPLANES])
{ {
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)htb; FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;
struct nxgl_rect_s relclip; struct nxgl_rect_s relclip;
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
if (!htb || !trap || !color) if (!hfwnd || !trap || !color)
{ {
errno = EINVAL; errno = EINVAL;
return ERROR; return ERROR;
@ -107,5 +107,5 @@ int nxtk_filltraptoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_trapezoid_s *tra
/* Perform the fill, clipping to the client window */ /* Perform the fill, clipping to the client window */
nxgl_rectoffset(&relclip, &fwnd->tbrect, -fwnd->wnd.bounds.pt1.x, -fwnd->wnd.bounds.pt1.y); nxgl_rectoffset(&relclip, &fwnd->tbrect, -fwnd->wnd.bounds.pt1.x, -fwnd->wnd.bounds.pt1.y);
return nx_filltrapezoid((NXWINDOW)htb, &relclip, trap, color); return nx_filltrapezoid((NXWINDOW)hfwnd, &relclip, trap, color);
} }

View File

@ -81,8 +81,9 @@
* Move a rectangular region within the toolbar sub-window of a framed window * Move a rectangular region within the toolbar sub-window of a framed window
* *
* Input Parameters: * Input Parameters:
* htb - The toolbar sub-window within which the move is to be done. * hfwnd - The sub-window containing the toolbar within which the move is
* This must have been previously created by nxtk_openwindow(). * to be done. This must have been previously created by
* nxtk_openwindow().
* rect - Describes the rectangular region relative to the toolbar * rect - Describes the rectangular region relative to the toolbar
* sub-window to move * sub-window to move
* offset - The offset to move the region * offset - The offset to move the region
@ -92,15 +93,15 @@
* *
****************************************************************************/ ****************************************************************************/
int nxtk_movetoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_rect_s *rect, int nxtk_movetoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset) FAR const struct nxgl_point_s *offset)
{ {
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)htb; FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;
struct nxgl_rect_s srcrect; struct nxgl_rect_s srcrect;
struct nxgl_point_s clipoffset; struct nxgl_point_s clipoffset;
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
if (!htb || !rect || !offset) if (!hfwnd || !rect || !offset)
{ {
errno = EINVAL; errno = EINVAL;
return ERROR; return ERROR;
@ -115,5 +116,5 @@ int nxtk_movetoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_rect_s *rect,
/* Then move it within the toolbar window */ /* Then move it within the toolbar window */
return nx_move((NXTKTOOLBAR)htb, &srcrect, &clipoffset); return nx_move((NXWINDOW)hfwnd, &srcrect, &clipoffset);
} }

View File

@ -87,14 +87,13 @@
* arg - User provided value that will be returned with toolbar callbacks. * arg - User provided value that will be returned with toolbar callbacks.
* *
* Return: * Return:
* Success: A non-NULL handle used with subsequent NXTK toolbar accesses * OK on success; ERROR on failure with errno set appropriately
* Failure: NULL is returned and errno is set appropriately
* *
****************************************************************************/ ****************************************************************************/
NXTKTOOLBAR nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height, int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,
FAR const struct nx_callback_s *cb, FAR const struct nx_callback_s *cb,
FAR void *arg) FAR void *arg)
{ {
FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd; FAR struct nxtk_framedwindow_s *fwnd = (FAR struct nxtk_framedwindow_s *)hfwnd;
@ -102,7 +101,7 @@ NXTKTOOLBAR nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,
if (!hfwnd || !cb) if (!hfwnd || !cb)
{ {
errno = EINVAL; errno = EINVAL;
return NULL; return ERROR;
} }
#endif #endif
@ -124,6 +123,6 @@ NXTKTOOLBAR nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,
/* Return the initialized toolbar reference */ /* Return the initialized toolbar reference */
return (NXTKTOOLBAR)fwnd; return OK;
} }

View File

@ -57,10 +57,6 @@
typedef FAR void *NXTKWINDOW; typedef FAR void *NXTKWINDOW;
/* This is the handle that can be used to access the window toolbar */
typedef FAR void *NXTKTOOLBAR;
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
@ -307,14 +303,13 @@ EXTERN int nxtk_bitmapwindow(NXTKWINDOW hfwnd,
* arg - User provided value that will be returned with toolbar callbacks. * arg - User provided value that will be returned with toolbar callbacks.
* *
* Return: * Return:
* Success: A non-NULL handle used with subsequent NXTK toolbar accesses * OK on success; ERROR on failure with errno set appropriately
* Failure: NULL is returned and errno is set appropriately
* *
****************************************************************************/ ****************************************************************************/
EXTERN NXTKTOOLBAR nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height, EXTERN int nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,
FAR const struct nx_callback_s *cb, FAR const struct nx_callback_s *cb,
FAR void *arg); FAR void *arg);
/**************************************************************************** /****************************************************************************
* Name: nxtk_closetoolbar * Name: nxtk_closetoolbar
@ -323,14 +318,14 @@ EXTERN NXTKTOOLBAR nxtk_opentoolbar(NXTKWINDOW hfwnd, nxgl_coord_t height,
* Create a tool bar at the top of the specified framed window * Create a tool bar at the top of the specified framed window
* *
* Input Parameters: * Input Parameters:
* htb - The toolbar handle returned by nxtk_opentoolbar * hfwnd - The handle returned by nxtk_openwindow
* *
* Return: * Return:
* OK on success; ERROR on failure with errno set appropriately * OK on success; ERROR on failure with errno set appropriately
* *
****************************************************************************/ ****************************************************************************/
EXTERN int nxtk_closetoolbar(NXTKTOOLBAR htb); EXTERN int nxtk_closetoolbar(NXTKWINDOW hfwnd);
/**************************************************************************** /****************************************************************************
* Name: nxtk_filltoolbar * Name: nxtk_filltoolbar
@ -339,7 +334,7 @@ EXTERN int nxtk_closetoolbar(NXTKTOOLBAR htb);
* Fill the specified rectangle in the client window with the specified color * Fill the specified rectangle in the client window with the specified color
* *
* Input Parameters: * Input Parameters:
* htb - The toolbar handle returned by nxtk_opentoolbar * hfwnd - The handle returned by nxtk_openwindow
* rect - The location within the toolbar window to be filled * rect - The location within the toolbar window to be filled
* color - The color to use in the fill * color - The color to use in the fill
* *
@ -348,7 +343,7 @@ EXTERN int nxtk_closetoolbar(NXTKTOOLBAR htb);
* *
****************************************************************************/ ****************************************************************************/
EXTERN int nxtk_filltoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_rect_s *rect, EXTERN int nxtk_filltoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
/**************************************************************************** /****************************************************************************
@ -358,7 +353,7 @@ EXTERN int nxtk_filltoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_rect_s *rect,
* Fill the specified rectangle in the toolbar with the specified color * Fill the specified rectangle in the toolbar with the specified color
* *
* Input Parameters: * Input Parameters:
* htb - The window handle returned by nxtk_openwindow * hfwnd - The handle returned by nxtk_openwindow
* trap - The trapezoidal region to be filled * trap - The trapezoidal region to be filled
* color - The color to use in the fill * color - The color to use in the fill
* *
@ -367,8 +362,58 @@ EXTERN int nxtk_filltoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_rect_s *rect,
* *
****************************************************************************/ ****************************************************************************/
EXTERN int nxtk_filltraptoolbar(NXTKTOOLBAR htb, FAR const struct nxgl_trapezoid_s *trap, EXTERN int nxtk_filltraptoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_trapezoid_s *trap,
nxgl_mxpixel_t color[CONFIG_NX_NPLANES]); nxgl_mxpixel_t color[CONFIG_NX_NPLANES]);
/****************************************************************************
* Name: nxtk_movetoolbar
*
* Description:
* Move a rectangular region within the toolbar sub-window of a framed window
*
* Input Parameters:
* hfwnd - The sub-window containing the toolbar within which the move is
* to be done. This must have been previously created by
* nxtk_openwindow().
* rect - Describes the rectangular region relative to the toolbar
* sub-window to move
* offset - The offset to move the region
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
EXTERN int nxtk_movetoolbar(NXTKWINDOW hfwnd, FAR const struct nxgl_rect_s *rect,
FAR const struct nxgl_point_s *offset);
/****************************************************************************
* Name: nxtk_bitmaptoolbar
*
* Description:
* Copy a rectangular region of a larger image into the rectangle in the
* specified toolbar sub-window.
*
* Input Parameters:
* hfwnd - The sub-window twhose toolbar will receive the bitmap image
* dest - Describes the rectangular region on in the toolbar sub-window
* will receive the bit map.
* src - The start of the source image.
* origin - The origin of the upper, left-most corner of the full bitmap.
* Both dest and origin are in window coordinates, however, origin
* may lie outside of the display.
* stride - The width of the full source image in pixels.
*
* Return:
* OK on success; ERROR on failure with errno set appropriately
*
****************************************************************************/
EXTERN int nxtk_bitmaptoolbar(NXTKWINDOW hfwnd,
FAR const struct nxgl_rect_s *dest,
FAR const void *src[CONFIG_NX_NPLANES],
FAR const struct nxgl_point_s *origin,
unsigned int stride);
#undef EXTERN #undef EXTERN
#if defined(__cplusplus) #if defined(__cplusplus)
} }