From 41271d632b74f5cf47c30d3b699eb6b2786f2136 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 23 Jun 2018 13:02:07 +1000 Subject: Added new type definitions - moving towards V3.0 --- src/gwin/gwin.c | 12 +- src/gwin/gwin.h | 1532 +++++++++++++++++++++---------------------- src/gwin/gwin_button.c | 6 +- src/gwin/gwin_button.h | 12 +- src/gwin/gwin_checkbox.c | 14 +- src/gwin/gwin_checkbox.h | 18 +- src/gwin/gwin_class.h | 24 +- src/gwin/gwin_console.c | 38 +- src/gwin/gwin_console.h | 16 +- src/gwin/gwin_container.h | 8 - src/gwin/gwin_frame.h | 8 - src/gwin/gwin_gl3d.c | 6 +- src/gwin/gwin_gl3d.h | 8 - src/gwin/gwin_graph.h | 8 - src/gwin/gwin_image.c | 10 +- src/gwin/gwin_image.h | 18 +- src/gwin/gwin_keyboard.h | 8 - src/gwin/gwin_label.c | 2 +- src/gwin/gwin_label.h | 10 +- src/gwin/gwin_list.c | 20 +- src/gwin/gwin_list.h | 33 +- src/gwin/gwin_progressbar.c | 2 +- src/gwin/gwin_progressbar.h | 8 - src/gwin/gwin_radio.c | 10 +- src/gwin/gwin_radio.h | 12 +- src/gwin/gwin_slider.c | 2 +- src/gwin/gwin_slider.h | 12 +- src/gwin/gwin_tabset.c | 4 +- src/gwin/gwin_tabset.h | 16 +- src/gwin/gwin_textedit.c | 8 +- src/gwin/gwin_textedit.h | 8 - src/gwin/gwin_widget.c | 58 +- src/gwin/gwin_widget.h | 52 +- src/gwin/gwin_wm.c | 72 +- 34 files changed, 961 insertions(+), 1114 deletions(-) (limited to 'src/gwin') diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 2de0c125..7bc257bf 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -121,7 +121,7 @@ void _gwinDestroy(GHandle gh, GRedrawMethod how) { return; // Make the window invisible - gwinSetVisible(gh, FALSE); + gwinSetVisible(gh, gFalse); // Make sure it is flushed first - must be REDRAW_WAIT or REDRAW_INSESSION _gwinFlushRedraws(how); @@ -209,12 +209,12 @@ const char *gwinGetClassName(GHandle gh) { return gh->vmt->classname; } -bool_t gwinGetVisible(GHandle gh) { - return (gh->flags & GWIN_FLG_SYSVISIBLE) ? TRUE : FALSE; +gBool gwinGetVisible(GHandle gh) { + return (gh->flags & GWIN_FLG_SYSVISIBLE) ? gTrue : gFalse; } -bool_t gwinGetEnabled(GHandle gh) { - return (gh->flags & GWIN_FLG_SYSENABLED) ? TRUE : FALSE; +gBool gwinGetEnabled(GHandle gh) { + return (gh->flags & GWIN_FLG_SYSENABLED) ? gTrue : gFalse; } #if GDISP_NEED_TEXT @@ -395,7 +395,7 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor gdispGFillConvexPoly(gh->display, tx+gh->x, ty+gh->y, pntarray, cnt, gh->color); _gwinDrawEnd(gh); } - void gwinDrawThickLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1, coord_t width, bool_t round) { + void gwinDrawThickLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1, coord_t width, gBool round) { if (!_gwinDrawStart(gh)) return; gdispGDrawThickLine(gh->display, gh->x+x0, gh->y+y0, gh->x+x1, gh->y+y1, gh->color, width, round); _gwinDrawEnd(gh); diff --git a/src/gwin/gwin.h b/src/gwin/gwin.h index 54421bd4..79768366 100644 --- a/src/gwin/gwin.h +++ b/src/gwin/gwin.h @@ -77,7 +77,7 @@ typedef struct GWindowInit { coord_t y; /**< The initial position relative to its parent */ coord_t width; /**< The width */ coord_t height; /**< The height */ - bool_t show; /**< Should the window be visible initially */ + gBool show; /**< Should the window be visible initially */ #if GWIN_NEED_CONTAINERS GHandle parent; /**< The parent - must be a container or NULL */ #endif @@ -89,10 +89,6 @@ typedef struct GWindowInit { */ typedef enum { GWIN_NORMAL, GWIN_MAXIMIZE, GWIN_MINIMIZE } GWindowMinMax; -#ifdef __cplusplus -extern "C" { -#endif - /*------------------------------------------------- * Window Manager functions *-------------------------------------------------*/ @@ -122,978 +118,974 @@ extern "C" { * Functions that affect all windows *-------------------------------------------------*/ +/** + * @brief Clear a GWindowInit structure to all zero's + * @note This function is provided just to prevent problems + * on operating systems where using memset() causes issues + * in the users application. + * + * @param[in] pwi The GWindowInit structure to clear + * + * @api + */ +void gwinClearInit(GWindowInit *pwi); + +/** + * @brief Set the default foreground color for all new GWIN windows + * + * @param[in] clr The color to be set + * + * @api + */ +void gwinSetDefaultColor(color_t clr); + +/** + * @brief Get the default foreground color for all new GWIN windows + * + * @return The current default color for all new GWIN windows + * + * @api + */ +color_t gwinGetDefaultColor(void); + +/** + * @brief Set the default background color for all new GWIN windows + * + * @param[in] bgclr The background color + * + * @api + */ +void gwinSetDefaultBgColor(color_t bgclr); + +/** + * @brief Get the default background color for all new GWIN windows + * + * @return The current default background color for all new GWIN windows + * + * @api + */ +color_t gwinGetDefaultBgColor(void); + +#if GDISP_NEED_TEXT || defined(__DOXYGEN__) /** - * @brief Clear a GWindowInit structure to all zero's - * @note This function is provided just to prevent problems - * on operating systems where using memset() causes issues - * in the users application. + * @brief Set the default font for all new GWIN windows * - * @param[in] pwi The GWindowInit structure to clear + * @param[in] font The new font to be set * * @api */ - void gwinClearInit(GWindowInit *pwi); + void gwinSetDefaultFont(font_t font); /** - * @brief Set the default foreground color for all new GWIN windows + * @brief Get the current default font * - * @param[in] clr The color to be set + * @return The current default font * * @api */ - void gwinSetDefaultColor(color_t clr); + font_t gwinGetDefaultFont(void); +#endif + +/*------------------------------------------------- +* Base functions +*-------------------------------------------------*/ + +/** + * @brief Create a basic window. + * @return NULL if there is no resultant drawing area, otherwise a window handle. + * + * @param[in] g The GDisplay to display this window on + * @param[in] pgw The window structure to initialize. If this is NULL the structure is dynamically allocated. + * @param[in] pInit How to initialise the window + * + * @note The drawing color and the background color get set to the current defaults. If you haven't called + * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are GFX_WHITE and GFX_BLACK respectively. + * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there + * is no default font and text drawing operations will no nothing. + * @note A basic window does not save the drawing state. It is not automatically redrawn if the window is moved or + * its visibility state is changed. + * + * @api + */ +GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit); +#define gwinWindowCreate(pgw, pInit) gwinGWindowCreate(GDISP, pgw, pInit); + +/** + * @brief Destroy a window (of any type). Releases any dynamically allocated memory. + * + * @param[in] gh The window handle + * + * @api + */ +void gwinDestroy(GHandle gh); + +/** + * @brief Get the real class name of the GHandle + * @details Returns a string describing the object class. + * + * @param[in] gh The window + * + * @return A string describing the object class. + * + * @api + */ +const char* gwinGetClassName(GHandle gh); + +/** + * @brief Get an ID that uniquely describes the class of the GHandle + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetClassID(gh) ((void *)((gh)->vmt)) + +/** + * @brief Get the X coordinate of the window + * @details Returns the X coordinate of the origin of the window. + * The coordinate is relative to the physical screen zero point. + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetScreenX(gh) ((gh)->x) + +/** + * @brief Get the Y coordinate of the window + * @details Returns the Y coordinate of the origin of the window. + * The coordinate is relative to the physical screen zero point. + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetScreenY(gh) ((gh)->y) + +/** + * @brief Get the width of the window + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetWidth(gh) ((gh)->width) + +/** + * @brief Get the height of the window + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetHeight(gh) ((gh)->height) + +/** + * @brief Set foreground color + * @details Set the color which will be used to draw + * + * @param[in] gh The window + * @param[in] clr The color to be set + * + * @api + */ +#define gwinSetColor(gh, clr) (gh)->color = (clr) + +/** + * @brief Set background color + * @details Set the color which will be used as background + * @note gwinClear() must be called to set the background color + * + * @param[in] gh The window + * @param[in] bgclr The background color + * + * @api + */ +#define gwinSetBgColor(gh, bgclr) (gh)->bgcolor = (bgclr) + +/** + * @brief Get the foreground color of a window + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetColor(gh) (gh)->color +/** + * @brief Get the background color of a window + * + * @param[in] gh The window + * + * @api + */ +#define gwinGetBgColor(gh) (gh)->bgcolor + +/** + * @brief Sets whether a window is visible or not + * + * @param[in] gh The window + * @param[in] visible Whether the window should be visible or not + * + * @note When a window is marked as not visible, drawing operations + * on the window do nothing. + * @note When a window is marked as visible, it is not automatically + * redrawn as many window types don't remember their drawing state. + * Widgets such as Buttons, Sliders etc will be redrawn. + * @note If there is no window manager in use, when a window is marked + * as not visible, nothing is done to remove the window from the screen. + * When there is a window manager, it is up to the window manager to + * handle what happens. + * @note Even when you mark a window as visible, it may still not be displayed + * if it's parent is invisible. When the parent becomes visible this child + * will automatically be shown because it is already marked as visible. + * + * @api + */ +void gwinSetVisible(GHandle gh, gBool visible); + +/** + * @brief Makes a widget become visible + * + * @param[in] gh The window handle + * + * @api + */ +#define gwinShow(gh) gwinSetVisible(gh, gTrue) + +/** + * @brief Makes a widget become invisible + * + * @param[in] gh The window handle + * + * @api + */ +#define gwinHide(gh) gwinSetVisible(gh, gFalse) + +/** + * @brief Gets the visibility of a window + * @return gTrue if visible + * + * @note It is possible for a child to be marked as visible by @p gwinSetVisible() + * but for this call to return gFalse if one of its parents are not visible. + * + * @param[in] gh The window + * + * @api + */ +gBool gwinGetVisible(GHandle gh); + +/** + * @brief Enable or disable a window + * + * @param[in] gh The window handle + * @param[in] enabled Enable or disable the window + * + * @note The window is automatically redrawn if it supports self-redrawing. + * @note Even when you mark a window as enabled, it may still remain disabled + * if it's parent is disabled. When the parent becomes enabled this child + * will automatically be enabled because it is already marked as enabled. + * + * @api + */ +void gwinSetEnabled(GHandle gh, gBool enabled); + +/** + * @brief Enables a widget + * + * @param[in] gh The window handle + * + * @api + */ +#define gwinEnable(gh) gwinSetEnabled(gh, gTrue) + +/** + * @brief Disables a widget + * + * @param[in] gh The window handle + * + * @api + */ +#define gwinDisable(gh) gwinSetEnabled(gh, gFalse) + +/** + * @brief Gets the enabled state of a window + * @return gTrue if enabled + * + * @note It is possible for a child to be marked as enabled by @p gwinSetEnabled() + * but for this call to return gFalse if one of its parents are not enabled. + * + * @param[in] gh The window + * + * @api + */ +gBool gwinGetEnabled(GHandle gh); + +/** + * @brief Move a window + * + * @param[in] gh The window + * @param[in] x, y The new position (screen relative) for this window + * + * @note The final window position may not be the requested position. Windows + * are clipped to the screen area and the window manager may also affect the position. + * @note The window is redrawn if it is visible. See the comments in @p gwinSetVisible() + * with regard to what can be redrawn and what can't. + * @note It is up to the window manager to determine what happens with the screen area + * uncovered by moving the window. When there is no window manager, nothing + * is done with the uncovered area. + * + * @api + */ +void gwinMove(GHandle gh, coord_t x, coord_t y); + +/** + * @brief Resize a window + * + * @param[in] gh The window + * @param[in] width, height The new size of the window + * + * @note The final window size may not be the requested size. Windows + * are clipped to the screen area and the window manager may also affect the size. + * @note The window is redrawn if it is visible. See the comments in @p gwinSetVisible() + * with regard to what can be redrawn and what can't. + * @note It is up to the window manager to determine what happens with any screen area + * uncovered by resizing the window. When there is no window manager, nothing + * is done with the uncovered area. + * + * @api + */ +void gwinResize(GHandle gh, coord_t width, coord_t height); + +/** + * @brief Redraw a window + * + * @param[in] gh The window + * + * @note This is normally never required as windows and widgets will redraw as required. + * Note that some windows are incapable of redrawing themselves as they don't save + * their drawing state. + * + * @api + */ +void gwinRedraw(GHandle gh); + +#if GWIN_NEED_WINDOWMANAGER || defined (__DOXYGEN__) /** - * @brief Get the default foreground color for all new GWIN windows + * @brief Redraw a display + * + * @param[in] g The display to redraw. Passing NULL will redraw all displays. + * @param[in] preserve Should the redraw try to preserve existing screen data for those + * windows that can't redraw themselves? * - * @return The current default color for all new GWIN windows + * @note This is normally never required as windows and widgets will redraw as required. + * @note Some windows are incapable of redrawing themselves as they don't save + * their drawing state. + * @note This does not clear the background - just redraws the gwin windows (where possible) * * @api */ - color_t gwinGetDefaultColor(void); + void gwinRedrawDisplay(GDisplay *g, gBool preserve); /** - * @brief Set the default background color for all new GWIN windows + * @brief Minimize, Maximize or Restore a window + * @pre GWIN_NEED_WINDOWMANAGER must be GFXON * - * @param[in] bgclr The background color + * @param[in] gh The window + * @param[in] minmax The new minimized/maximized state + * + * @note The final window state may not be the requested state. Window Managers + * do not need to implement changing the minmax state. If there is no + * window manager this call is ignored. + * @note The window is redrawn if it is changed. See the comments in @p gwinSetVisible() + * with regard to what can be redrawn and what can't. + * @note It is up to the window manager to determine what happens with any screen area + * uncovered by resizing the window. + * @note When a window is minimised it may be asked to draw the window or the window + * manager may draw the minimised window. * * @api */ - void gwinSetDefaultBgColor(color_t bgclr); + void gwinSetMinMax(GHandle gh, GWindowMinMax minmax); /** - * @brief Get the default background color for all new GWIN windows + * @brief Get the Minimized/Maximized state of a window + * @pre GWIN_NEED_WINDOWMANAGER must be GFXON * - * @return The current default background color for all new GWIN windows + * @param[in] gh The window + * + * @return GWIN_NORMAL, GWIN_MAXIMIZE or GWIN_MINIMIZE * * @api */ - color_t gwinGetDefaultBgColor(void); - - #if GDISP_NEED_TEXT || defined(__DOXYGEN__) - /** - * @brief Set the default font for all new GWIN windows - * - * @param[in] font The new font to be set - * - * @api - */ - void gwinSetDefaultFont(font_t font); - - /** - * @brief Get the current default font - * - * @return The current default font - * - * @api - */ - font_t gwinGetDefaultFont(void); - #endif - -/*------------------------------------------------- - * Base functions - *-------------------------------------------------*/ + GWindowMinMax gwinGetMinMax(GHandle gh); /** - * @brief Create a basic window. - * @return NULL if there is no resultant drawing area, otherwise a window handle. + * @brief Raise a window to the top of the z-order + * @pre GWIN_NEED_WINDOWMANAGER must be GFXON * - * @param[in] g The GDisplay to display this window on - * @param[in] pgw The window structure to initialize. If this is NULL the structure is dynamically allocated. - * @param[in] pInit How to initialise the window + * @param[in] gh The window * - * @note The drawing color and the background color get set to the current defaults. If you haven't called - * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are GFX_WHITE and GFX_BLACK respectively. - * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there - * is no default font and text drawing operations will no nothing. - * @note A basic window does not save the drawing state. It is not automatically redrawn if the window is moved or - * its visibility state is changed. + * @note The window z-order is only supported by some window managers. See the comments + * in @p gwinSetVisible() with regard to what can be redrawn and what can't. * * @api */ - GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit); - #define gwinWindowCreate(pgw, pInit) gwinGWindowCreate(GDISP, pgw, pInit); + void gwinRaise(GHandle gh); /** - * @brief Destroy a window (of any type). Releases any dynamically allocated memory. + * @brief Get the next window in the z-order + * @return The next window or NULL if no more windows * - * @param[in] gh The window handle + * @param[in] gh The previous window or NULL to get the first window + * + * @note This returns the next window in the system from top to bottom. + * @note Where there are parent child relationships, this ignores them + * and will list all windows in the system. There is no defined + * order between children of siblings and they can in fact be mixed + * in order. The only relationship honored is that parents will be + * listed before their children. * * @api */ - void gwinDestroy(GHandle gh); + GHandle gwinGetNextWindow(GHandle gh); /** - * @brief Get the real class name of the GHandle - * @details Returns a string describing the object class. + * @brief Set a window or widget to flash * - * @param[in] gh The window + * @param[in] gh The window handle + * @param[in] flash Enable or disable the flashing of the window * - * @return A string describing the object class. + * @note The window is automatically redrawn if it supports self-redrawing. + * @note When a window is set to flash, its appearance changes in some + * way every flash period (GWIN_FLASHING_PERIOD). How its appearance + * changes depends on the draw for each window/widget. + * + * @pre Requires GWIN_NEED_FLASHING to be GFXON * * @api */ - const char* gwinGetClassName(GHandle gh); + void gwinSetFlashing(GHandle gh, gBool flash); /** - * @brief Get an ID that uniquely describes the class of the GHandle + * @brief Enables flashing of a window or widget * - * @param[in] gh The window + * @param[in] gh The window handle * * @api */ - #define gwinGetClassID(gh) ((void *)((gh)->vmt)) + #define gwinFlash(gh) gwinSetFlashing(gh, gTrue) /** - * @brief Get the X coordinate of the window - * @details Returns the X coordinate of the origin of the window. - * The coordinate is relative to the physical screen zero point. + * @brief Disables a widget * - * @param[in] gh The window + * @param[in] gh The window handle * * @api */ - #define gwinGetScreenX(gh) ((gh)->x) + #define gwinNoFlash(gh) gwinSetFlashing(gh, gFalse) +#endif +#if GDISP_NEED_TEXT || defined(__DOXYGEN__) /** - * @brief Get the Y coordinate of the window - * @details Returns the Y coordinate of the origin of the window. - * The coordinate is relative to the physical screen zero point. + * @brief Set the current font for this window. * - * @param[in] gh The window + * @param[in] gh The window handle + * @param[in] font The font to use for text functions * * @api */ - #define gwinGetScreenY(gh) ((gh)->y) + void gwinSetFont(GHandle gh, font_t font); +#endif + +/*------------------------------------------------- +* Drawing functions +*-------------------------------------------------*/ + +/** + * @brief Clear the window + * @note Uses the current background color to clear the window + * + * @param[in] gh The window handle + * + * @api + */ +void gwinClear(GHandle gh); + +/** + * @brief Set a pixel in the window + * @note Uses the current foreground color to set the pixel + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The coordinates of the pixel + * + * @api + */ +void gwinDrawPixel(GHandle gh, coord_t x, coord_t y); + +/** + * @brief Draw a line in the window + * @note Uses the current foreground color to draw the line + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x0,y0 The start position + * @param[in] x1,y1 The end position + * + * @api + */ +void gwinDrawLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1); +/** + * @brief Draw a box in the window + * @note Uses the current foreground color to draw the box + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The start position + * @param[in] cx,cy The size of the box (outside dimensions) + * + * @api + */ +void gwinDrawBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); + +/** + * @brief Fill an rectangular area in the window + * @note Uses the current foreground color to fill the box + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The start position + * @param[in] cx,cy The size of the box (outside dimensions) + * + * @api + */ +void gwinFillArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); + +/** + * @brief Fill an area in the window using the supplied bitmap. + * @details The bitmap is in the pixel format specified by the low level driver + * @note If GDISP_NEED_ASYNC is defined then the buffer must be static + * or at least retained until this call has finished the blit. You can + * tell when all graphics drawing is finished by @p gdispIsBusy() going gFalse. + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x, y The start filled area + * @param[in] cx, cy The width and height to be filled + * @param[in] srcx, srcy The bitmap position to start the fill from + * @param[in] srccx The width of a line in the bitmap. + * @param[in] buffer The pixels to use to fill the area. + * + * @api + */ +void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer); + +/*------------------------------------------------- +* Circle, ellipse, arc and arc-sectors functions +*-------------------------------------------------*/ + +#if GDISP_NEED_CIRCLE || defined(__DOXYGEN__) /** - * @brief Get the width of the window + * @brief Draw a circle in the window. + * @note Uses the current foreground color to draw the circle + * @note May leave GDISP clipping to this window's dimensions * - * @param[in] gh The window + * @param[in] gh The window handle + * @param[in] x, y The center of the circle + * @param[in] radius The radius of the circle * * @api */ - #define gwinGetWidth(gh) ((gh)->width) + void gwinDrawCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); /** - * @brief Get the height of the window + * @brief Draw a filled circle in the window. + * @note Uses the current foreground color to draw the filled circle + * @note May leave GDISP clipping to this window's dimensions * - * @param[in] gh The window + * @param[in] gh The window handle + * @param[in] x, y The center of the circle + * @param[in] radius The radius of the circle * * @api */ - #define gwinGetHeight(gh) ((gh)->height) + void gwinFillCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); +#endif +#if GDISP_NEED_DUALCIRCLE || defined(__DOXYGEN__) /** - * @brief Set foreground color - * @details Set the color which will be used to draw + * @brief Draw two filled circles with the same centre in the window. + * @note Uses the current foreground color to draw the inner circle + * @note Uses the current background color to draw the outer circle + * @note May leave GDISP clipping to this window's dimensions + * @pre GDISP_NEED_DUALCIRCLE must be GFXON in your gfxconf.h * - * @param[in] gh The window - * @param[in] clr The color to be set + * @param[in] gh The window handle + * @param[in] x,y The center of the circle + * @param[in] radius1 The radius of the larger circle + * @param[in] radius2 The radius of the smaller circle * * @api */ - #define gwinSetColor(gh, clr) (gh)->color = (clr) + void gwinFillDualCircle(GHandle gh, coord_t x, coord_t y, coord_t radius1, coord_t radius2); +#endif +#if GDISP_NEED_ELLIPSE || defined(__DOXYGEN__) /** - * @brief Set background color - * @details Set the color which will be used as background - * @note gwinClear() must be called to set the background color + * @brief Draw an ellipse. + * @note Uses the current foreground color to draw the ellipse + * @note May leave GDISP clipping to this window's dimensions * - * @param[in] gh The window - * @param[in] bgclr The background color + * @param[in] gh The window handle + * @param[in] x,y The center of the ellipse + * @param[in] a,b The dimensions of the ellipse * * @api */ - #define gwinSetBgColor(gh, bgclr) (gh)->bgcolor = (bgclr) + void gwinDrawEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); /** - * @brief Get the foreground color of a window + * @brief Draw an filled ellipse. + * @note Uses the current foreground color to draw the filled ellipse + * @note May leave GDISP clipping to this window's dimensions * - * @param[in] gh The window + * @param[in] gh The window handle + * @param[in] x,y The center of the ellipse + * @param[in] a,b The dimensions of the ellipse * * @api */ - #define gwinGetColor(gh) (gh)->color + void gwinFillEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); +#endif - /** - * @brief Get the background color of a window +#if GDISP_NEED_ARC || defined(__DOXYGEN__) + /* + * @brief Draw an arc in the window. + * @note Uses the current foreground color to draw the arc + * @note May leave GDISP clipping to this window's dimensions * - * @param[in] gh The window + * @param[in] gh The window handle + * @param[in] x,y The center point + * @param[in] radius The radius of the arc + * @param[in] start The start angle (0 to 360) + * @param[in] end The end angle (0 to 360) * * @api */ - #define gwinGetBgColor(gh) (gh)->bgcolor + void gwinDrawArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); - /** - * @brief Sets whether a window is visible or not - * - * @param[in] gh The window - * @param[in] visible Whether the window should be visible or not - * - * @note When a window is marked as not visible, drawing operations - * on the window do nothing. - * @note When a window is marked as visible, it is not automatically - * redrawn as many window types don't remember their drawing state. - * Widgets such as Buttons, Sliders etc will be redrawn. - * @note If there is no window manager in use, when a window is marked - * as not visible, nothing is done to remove the window from the screen. - * When there is a window manager, it is up to the window manager to - * handle what happens. - * @note Even when you mark a window as visible, it may still not be displayed - * if it's parent is invisible. When the parent becomes visible this child - * will automatically be shown because it is already marked as visible. + /* + * @brief Draw a filled arc in the window. + * @note Uses the current foreground color to draw the filled arc + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center point + * @param[in] radius The radius of the arc + * @param[in] start The start angle (0 to 360) + * @param[in] end The end angle (0 to 360) * * @api */ - void gwinSetVisible(GHandle gh, bool_t visible); + void gwinFillArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); - /** - * @brief Makes a widget become visible + /* + * @brief Draw a thick arc in the window. + * @note Uses the current foreground color to draw the thick arc + * @note May leave GDISP clipping to this window's dimensions * * @param[in] gh The window handle + * @param[in] x,y The center point + * @param[in] startradius The inner radius of the thick arc + * @param[in] endradius The outer radius of the thick arc + * @param[in] startangle The start angle (0 to 360) + * @param[in] endangle The end angle (0 to 360) * * @api */ - #define gwinShow(gh) gwinSetVisible(gh, TRUE) + void gwinDrawThickArc(GHandle gh, coord_t x, coord_t y, coord_t startradius, coord_t endradius, coord_t startangle, coord_t endangle); +#endif - /** - * @brief Makes a widget become invisible +#if GDISP_NEED_ARCSECTORS || defined(__DOXYGEN__) + /* + * @brief Draw a selection of 45 degree arcs of a circle in the window. + * @note Uses the current foreground color to draw the arc sector + * @note May leave GDISP clipping to this window's dimensions * * @param[in] gh The window handle + * @param[in] x,y The center of the circle + * @param[in] radius The radius of the circle + * @param[in] sectors Bits determine which sectors are drawn. + * Bits go anti-clockwise from the 0 degree mark (y = 0, x is positive), as follows: + * bit 0 - upper right right ----- + * bit 1 - upper upper right /2 1\ + * bit 2 - upper upper left /3 0\ + * bit 3 - upper left left \4 7/ + * bit 4 - lower left left \5 6/ + * bit 5 - lower lower left ----- + * bit 6 - lower lower right + * bit 7 - lower left left * * @api */ - #define gwinHide(gh) gwinSetVisible(gh, FALSE) + void gwinDrawArcSectors(GHandle gh, coord_t x, coord_t y, coord_t radius, uint8_t sectors); - /** - * @brief Gets the visibility of a window - * @return TRUE if visible - * - * @note It is possible for a child to be marked as visible by @p gwinSetVisible() - * but for this call to return FALSE if one of its parents are not visible. + /* + * @brief Draw a filled selection of 45 degree arcs of a circle in the window. + * @note Uses the current foreground color to draw the arc sector + * @note May leave GDISP clipping to this window's dimensions * - * @param[in] gh The window + * @param[in] gh The window handle + * @param[in] x,y The center of the circle + * @param[in] radius The radius of the circle + * @param[in] sectors Bits determine which sectors are drawn. + * Bits go anti-clockwise from the 0 degree mark (y = 0, x is positive), as follows: + * bit 0 - upper right right ----- + * bit 1 - upper upper right /2 1\ + * bit 2 - upper upper left /3 0\ + * bit 3 - upper left left \4 7/ + * bit 4 - lower left left \5 6/ + * bit 5 - lower lower left ----- + * bit 6 - lower lower right + * bit 7 - lower left left * * @api */ - bool_t gwinGetVisible(GHandle gh); + void gwinFillArcSectors(GHandle gh, coord_t x, coord_t y, coord_t radius, uint8_t sectors); +#endif +/*------------------------------------------------- +* Pixel read-back functions +*-------------------------------------------------*/ + +#if GDISP_NEED_PIXELREAD || defined(__DOXYGEN__) /** - * @brief Enable or disable a window + * @brief Get the color of a pixel in the window. + * @return The color of the pixel. + * @note May leave GDISP clipping to this window's dimensions * * @param[in] gh The window handle - * @param[in] enabled Enable or disable the window - * - * @note The window is automatically redrawn if it supports self-redrawing. - * @note Even when you mark a window as enabled, it may still remain disabled - * if it's parent is disabled. When the parent becomes enabled this child - * will automatically be enabled because it is already marked as enabled. + * @param[in] x,y The position in the window * * @api */ - void gwinSetEnabled(GHandle gh, bool_t enabled); + color_t gwinGetPixelColor(GHandle gh, coord_t x, coord_t y); +#endif + +/*------------------------------------------------- +* Text functions +*-------------------------------------------------*/ +#if GDISP_NEED_TEXT || defined(__DOXYGEN__) /** - * @brief Enables a widget + * @brief Draw a text character at the specified position in the window. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character + * @note May leave GDISP clipping to this window's dimensions * * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] c The character to draw * * @api */ - #define gwinEnable(gh) gwinSetEnabled(gh, TRUE) + void gwinDrawChar(GHandle gh, coord_t x, coord_t y, char c); /** - * @brief Disables a widget + * @brief Draw a text character with a filled background at the specified position in the window. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character and fills the background using the background drawing color + * @note May leave GDISP clipping to this window's dimensions * * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] c The character to draw * * @api */ - #define gwinDisable(gh) gwinSetEnabled(gh, FALSE) + void gwinFillChar(GHandle gh, coord_t x, coord_t y, char c); /** - * @brief Gets the enabled state of a window - * @return TRUE if enabled - * - * @note It is possible for a child to be marked as enabled by @p gwinSetEnabled() - * but for this call to return FALSE if one of its parents are not enabled. + * @brief Draw a text string in the window + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character + * @note May leave GDISP clipping to this window's dimensions * - * @param[in] gh The window + * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] str The string to draw * * @api */ - bool_t gwinGetEnabled(GHandle gh); + void gwinDrawString(GHandle gh, coord_t x, coord_t y, const char *str); /** - * @brief Move a window - * - * @param[in] gh The window - * @param[in] x, y The new position (screen relative) for this window + * @brief Draw a text string with a filled background in the window + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character and fills the background using the background drawing color + * @note May leave GDISP clipping to this window's dimensions * - * @note The final window position may not be the requested position. Windows - * are clipped to the screen area and the window manager may also affect the position. - * @note The window is redrawn if it is visible. See the comments in @p gwinSetVisible() - * with regard to what can be redrawn and what can't. - * @note It is up to the window manager to determine what happens with the screen area - * uncovered by moving the window. When there is no window manager, nothing - * is done with the uncovered area. + * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] str The string to draw * * @api */ - void gwinMove(GHandle gh, coord_t x, coord_t y); + void gwinFillString(GHandle gh, coord_t x, coord_t y, const char *str); /** - * @brief Resize a window - * - * @param[in] gh The window - * @param[in] width, height The new size of the window + * @brief Draw a text string verticly centered within the specified box. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character. + * @note The specified box does not need to align with the window box + * @note May leave GDISP clipping to this window's dimensions * - * @note The final window size may not be the requested size. Windows - * are clipped to the screen area and the window manager may also affect the size. - * @note The window is redrawn if it is visible. See the comments in @p gwinSetVisible() - * with regard to what can be redrawn and what can't. - * @note It is up to the window manager to determine what happens with any screen area - * uncovered by resizing the window. When there is no window manager, nothing - * is done with the uncovered area. + * @param[in] gh The window handle + * @param[in] x,y The position for the text (need to define top-right or base-line - check code) + * @param[in] cx,cy The width and height of the box + * @param[in] str The string to draw + * @param[in] justify Justify the text left, center or right within the box * * @api */ - void gwinResize(GHandle gh, coord_t width, coord_t height); + void gwinDrawStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); /** - * @brief Redraw a window - * - * @param[in] gh The window + * @brief Draw a text string verticly centered within the specified filled box. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character and fills the background using the background drawing color + * @note The entire box is filled. Note this box does not need to align with the window box + * @note May leave GDISP clipping to this window's dimensions * - * @note This is normally never required as windows and widgets will redraw as required. - * Note that some windows are incapable of redrawing themselves as they don't save - * their drawing state. + * @param[in] gh The window handle + * @param[in] x,y The position for the text (need to define top-right or base-line - check code) + * @param[in] cx,cy The width and height of the box + * @param[in] str The string to draw + * @param[in] justify Justify the text left, center or right within the box * * @api */ - void gwinRedraw(GHandle gh); - - #if GWIN_NEED_WINDOWMANAGER || defined (__DOXYGEN__) - /** - * @brief Redraw a display - * - * @param[in] g The display to redraw. Passing NULL will redraw all displays. - * @param[in] preserve Should the redraw try to preserve existing screen data for those - * windows that can't redraw themselves? - * - * @note This is normally never required as windows and widgets will redraw as required. - * @note Some windows are incapable of redrawing themselves as they don't save - * their drawing state. - * @note This does not clear the background - just redraws the gwin windows (where possible) - * - * @api - */ - void gwinRedrawDisplay(GDisplay *g, bool_t preserve); - - /** - * @brief Minimize, Maximize or Restore a window - * @pre GWIN_NEED_WINDOWMANAGER must be GFXON - * - * @param[in] gh The window - * @param[in] minmax The new minimized/maximized state - * - * @note The final window state may not be the requested state. Window Managers - * do not need to implement changing the minmax state. If there is no - * window manager this call is ignored. - * @note The window is redrawn if it is changed. See the comments in @p gwinSetVisible() - * with regard to what can be redrawn and what can't. - * @note It is up to the window manager to determine what happens with any screen area - * uncovered by resizing the window. - * @note When a window is minimised it may be asked to draw the window or the window - * manager may draw the minimised window. - * - * @api - */ - void gwinSetMinMax(GHandle gh, GWindowMinMax minmax); - - /** - * @brief Get the Minimized/Maximized state of a window - * @pre GWIN_NEED_WINDOWMANAGER must be GFXON - * - * @param[in] gh The window - * - * @return GWIN_NORMAL, GWIN_MAXIMIZE or GWIN_MINIMIZE - * - * @api - */ - GWindowMinMax gwinGetMinMax(GHandle gh); - - /** - * @brief Raise a window to the top of the z-order - * @pre GWIN_NEED_WINDOWMANAGER must be GFXON - * - * @param[in] gh The window - * - * @note The window z-order is only supported by some window managers. See the comments - * in @p gwinSetVisible() with regard to what can be redrawn and what can't. - * - * @api - */ - void gwinRaise(GHandle gh); - - /** - * @brief Get the next window in the z-order - * @return The next window or NULL if no more windows - * - * @param[in] gh The previous window or NULL to get the first window - * - * @note This returns the next window in the system from top to bottom. - * @note Where there are parent child relationships, this ignores them - * and will list all windows in the system. There is no defined - * order between children of siblings and they can in fact be mixed - * in order. The only relationship honored is that parents will be - * listed before their children. - * - * @api - */ - GHandle gwinGetNextWindow(GHandle gh); - - /** - * @brief Set a window or widget to flash - * - * @param[in] gh The window handle - * @param[in] flash Enable or disable the flashing of the window - * - * @note The window is automatically redrawn if it supports self-redrawing. - * @note When a window is set to flash, its appearance changes in some - * way every flash period (GWIN_FLASHING_PERIOD). How its appearance - * changes depends on the draw for each window/widget. - * - * @pre Requires GWIN_NEED_FLASHING to be GFXON - * - * @api - */ - void gwinSetFlashing(GHandle gh, bool_t flash); - - /** - * @brief Enables flashing of a window or widget - * - * @param[in] gh The window handle - * - * @api - */ - #define gwinFlash(gh) gwinSetFlashing(gh, TRUE) - - /** - * @brief Disables a widget - * - * @param[in] gh The window handle - * - * @api - */ - #define gwinNoFlash(gh) gwinSetFlashing(gh, FALSE) - #endif - - #if GDISP_NEED_TEXT || defined(__DOXYGEN__) - /** - * @brief Set the current font for this window. - * - * @param[in] gh The window handle - * @param[in] font The font to use for text functions - * - * @api - */ - void gwinSetFont(GHandle gh, font_t font); - #endif + void gwinFillStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); +#endif /*------------------------------------------------- - * Drawing functions - *-------------------------------------------------*/ +* Polygon functions +*-------------------------------------------------*/ +#if GDISP_NEED_CONVEX_POLYGON || defined(__DOXYGEN__) /** - * @brief Clear the window - * @note Uses the current background color to clear the window + * @brief Draw an enclosed polygon (convex, non-convex or complex). + * + * @note Uses the current foreground color. * * @param[in] gh The window handle + * @param[in] tx, ty Transform all points in pntarray by tx, ty + * @param[in] pntarray An array of points + * @param[in] cnt The number of points in the array * * @api */ - void gwinClear(GHandle gh); + void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); /** - * @brief Set a pixel in the window - * @note Uses the current foreground color to set the pixel - * @note May leave GDISP clipping to this window's dimensions + * @brief Fill a convex polygon + * @details Doesn't handle non-convex or complex polygons. + * + * @note Uses the current foreground color. * * @param[in] gh The window handle - * @param[in] x,y The coordinates of the pixel + * @param[in] tx, ty Transform all points in pntarray by tx, ty + * @param[in] pntarray An array of points + * @param[in] cnt The number of points in the array + * + * @note Convex polygons are those that have no internal angles. That is; + * you can draw a line from any point on the polygon to any other point + * on the polygon without it going outside the polygon. In our case we generalise + * this a little by saying that an infinite horizontal line (at any y value) will cross + * no more than two edges on the polygon. Some non-convex polygons do fit this criteria + * and can therefore be drawn. + * @note This routine is designed to be very efficient with even simple display hardware. * * @api */ - void gwinDrawPixel(GHandle gh, coord_t x, coord_t y); + void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); /** - * @brief Draw a line in the window + * @brief Draw a thick line in the window + * @details The line thickness is specified in pixels. The line ends can + * be selected to be either flat or round. + * @note Uses gdispGFillConvexPoly() internally to perform the drawing. * @note Uses the current foreground color to draw the line - * @note May leave GDISP clipping to this window's dimensions - * + * * @param[in] gh The window handle * @param[in] x0,y0 The start position - * @param[in] x1,y1 The end position - * + * @param[in] x1,y1 The end position + * @param[in] width The width of the line + * @param[in] round Use round ends for the line + * * @api */ - void gwinDrawLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1); + void gwinDrawThickLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1, coord_t width, gBool round); +#endif - /** - * @brief Draw a box in the window - * @note Uses the current foreground color to draw the box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The start position - * @param[in] cx,cy The size of the box (outside dimensions) - * - * @api - */ - void gwinDrawBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); +/*------------------------------------------------- +* Image functions +*-------------------------------------------------*/ +#if GDISP_NEED_IMAGE || defined(__DOXYGEN__) /** - * @brief Fill an rectangular area in the window - * @note Uses the current foreground color to fill the box - * @note May leave GDISP clipping to this window's dimensions + * @brief Draw the image + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. * * @param[in] gh The window handle - * @param[in] x,y The start position - * @param[in] cx,cy The size of the box (outside dimensions) + * @param[in] img The image structure + * @param[in] x,y The window location to draw the image + * @param[in] cx,cy The area on the screen to draw + * @param[in] sx,sy The image position to start drawing at * - * @api - */ - void gwinFillArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); - - /** - * @brief Fill an area in the window using the supplied bitmap. - * @details The bitmap is in the pixel format specified by the low level driver - * @note If GDISP_NEED_ASYNC is defined then the buffer must be static - * or at least retained until this call has finished the blit. You can - * tell when all graphics drawing is finished by @p gdispIsBusy() going FALSE. - * @note May leave GDISP clipping to this window's dimensions + * @pre gdispImageOpen() must have returned successfully. * - * @param[in] gh The window handle - * @param[in] x, y The start filled area - * @param[in] cx, cy The width and height to be filled - * @param[in] srcx, srcy The bitmap position to start the fill from - * @param[in] srccx The width of a line in the bitmap. - * @param[in] buffer The pixels to use to fill the area. + * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image + * is simply not drawn. + * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a + * fast blit from the cached frame. If not, it reads the input and decodes it as it + * is drawing. This may be significantly slower than if the image has been cached (but + * uses a lot less RAM) * * @api */ - void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer); - -/*------------------------------------------------- - * Circle, ellipse, arc and arc-sectors functions - *-------------------------------------------------*/ - - #if GDISP_NEED_CIRCLE || defined(__DOXYGEN__) - /** - * @brief Draw a circle in the window. - * @note Uses the current foreground color to draw the circle - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x, y The center of the circle - * @param[in] radius The radius of the circle - * - * @api - */ - void gwinDrawCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); - - /** - * @brief Draw a filled circle in the window. - * @note Uses the current foreground color to draw the filled circle - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x, y The center of the circle - * @param[in] radius The radius of the circle - * - * @api - */ - void gwinFillCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); - #endif - - #if GDISP_NEED_DUALCIRCLE || defined(__DOXYGEN__) - /** - * @brief Draw two filled circles with the same centre in the window. - * @note Uses the current foreground color to draw the inner circle - * @note Uses the current background color to draw the outer circle - * @note May leave GDISP clipping to this window's dimensions - * @pre GDISP_NEED_DUALCIRCLE must be GFXON in your gfxconf.h - * - * @param[in] gh The window handle - * @param[in] x,y The center of the circle - * @param[in] radius1 The radius of the larger circle - * @param[in] radius2 The radius of the smaller circle - * - * @api - */ - void gwinFillDualCircle(GHandle gh, coord_t x, coord_t y, coord_t radius1, coord_t radius2); - #endif - - #if GDISP_NEED_ELLIPSE || defined(__DOXYGEN__) - /** - * @brief Draw an ellipse. - * @note Uses the current foreground color to draw the ellipse - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center of the ellipse - * @param[in] a,b The dimensions of the ellipse - * - * @api - */ - void gwinDrawEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); - - /** - * @brief Draw an filled ellipse. - * @note Uses the current foreground color to draw the filled ellipse - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center of the ellipse - * @param[in] a,b The dimensions of the ellipse - * - * @api - */ - void gwinFillEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); - #endif - - #if GDISP_NEED_ARC || defined(__DOXYGEN__) - /* - * @brief Draw an arc in the window. - * @note Uses the current foreground color to draw the arc - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center point - * @param[in] radius The radius of the arc - * @param[in] start The start angle (0 to 360) - * @param[in] end The end angle (0 to 360) - * - * @api - */ - void gwinDrawArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); - - /* - * @brief Draw a filled arc in the window. - * @note Uses the current foreground color to draw the filled arc - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center point - * @param[in] radius The radius of the arc - * @param[in] start The start angle (0 to 360) - * @param[in] end The end angle (0 to 360) - * - * @api - */ - void gwinFillArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); - - /* - * @brief Draw a thick arc in the window. - * @note Uses the current foreground color to draw the thick arc - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center point - * @param[in] startradius The inner radius of the thick arc - * @param[in] endradius The outer radius of the thick arc - * @param[in] startangle The start angle (0 to 360) - * @param[in] endangle The end angle (0 to 360) - * - * @api - */ - void gwinDrawThickArc(GHandle gh, coord_t x, coord_t y, coord_t startradius, coord_t endradius, coord_t startangle, coord_t endangle); - #endif - - #if GDISP_NEED_ARCSECTORS || defined(__DOXYGEN__) - /* - * @brief Draw a selection of 45 degree arcs of a circle in the window. - * @note Uses the current foreground color to draw the arc sector - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center of the circle - * @param[in] radius The radius of the circle - * @param[in] sectors Bits determine which sectors are drawn. - * Bits go anti-clockwise from the 0 degree mark (y = 0, x is positive), as follows: - * bit 0 - upper right right ----- - * bit 1 - upper upper right /2 1\ - * bit 2 - upper upper left /3 0\ - * bit 3 - upper left left \4 7/ - * bit 4 - lower left left \5 6/ - * bit 5 - lower lower left ----- - * bit 6 - lower lower right - * bit 7 - lower left left - * - * @api - */ - void gwinDrawArcSectors(GHandle gh, coord_t x, coord_t y, coord_t radius, uint8_t sectors); - - /* - * @brief Draw a filled selection of 45 degree arcs of a circle in the window. - * @note Uses the current foreground color to draw the arc sector - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center of the circle - * @param[in] radius The radius of the circle - * @param[in] sectors Bits determine which sectors are drawn. - * Bits go anti-clockwise from the 0 degree mark (y = 0, x is positive), as follows: - * bit 0 - upper right right ----- - * bit 1 - upper upper right /2 1\ - * bit 2 - upper upper left /3 0\ - * bit 3 - upper left left \4 7/ - * bit 4 - lower left left \5 6/ - * bit 5 - lower lower left ----- - * bit 6 - lower lower right - * bit 7 - lower left left - * - * @api - */ - void gwinFillArcSectors(GHandle gh, coord_t x, coord_t y, coord_t radius, uint8_t sectors); - #endif - -/*------------------------------------------------- - * Pixel read-back functions - *-------------------------------------------------*/ - - #if GDISP_NEED_PIXELREAD || defined(__DOXYGEN__) - /** - * @brief Get the color of a pixel in the window. - * @return The color of the pixel. - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position in the window - * - * @api - */ - color_t gwinGetPixelColor(GHandle gh, coord_t x, coord_t y); - #endif - -/*------------------------------------------------- - * Text functions - *-------------------------------------------------*/ - - #if GDISP_NEED_TEXT || defined(__DOXYGEN__) - /** - * @brief Draw a text character at the specified position in the window. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] c The character to draw - * - * @api - */ - void gwinDrawChar(GHandle gh, coord_t x, coord_t y, char c); - - /** - * @brief Draw a text character with a filled background at the specified position in the window. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character and fills the background using the background drawing color - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] c The character to draw - * - * @api - */ - void gwinFillChar(GHandle gh, coord_t x, coord_t y, char c); - - /** - * @brief Draw a text string in the window - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] str The string to draw - * - * @api - */ - void gwinDrawString(GHandle gh, coord_t x, coord_t y, const char *str); - - /** - * @brief Draw a text string with a filled background in the window - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character and fills the background using the background drawing color - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] str The string to draw - * - * @api - */ - void gwinFillString(GHandle gh, coord_t x, coord_t y, const char *str); - - /** - * @brief Draw a text string verticly centered within the specified box. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character. - * @note The specified box does not need to align with the window box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text (need to define top-right or base-line - check code) - * @param[in] cx,cy The width and height of the box - * @param[in] str The string to draw - * @param[in] justify Justify the text left, center or right within the box - * - * @api - */ - void gwinDrawStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); - - /** - * @brief Draw a text string verticly centered within the specified filled box. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character and fills the background using the background drawing color - * @note The entire box is filled. Note this box does not need to align with the window box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text (need to define top-right or base-line - check code) - * @param[in] cx,cy The width and height of the box - * @param[in] str The string to draw - * @param[in] justify Justify the text left, center or right within the box - * - * @api - */ - void gwinFillStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); - #endif - -/*------------------------------------------------- - * Polygon functions - *-------------------------------------------------*/ - - #if GDISP_NEED_CONVEX_POLYGON || defined(__DOXYGEN__) - /** - * @brief Draw an enclosed polygon (convex, non-convex or complex). - * - * @note Uses the current foreground color. - * - * @param[in] gh The window handle - * @param[in] tx, ty Transform all points in pntarray by tx, ty - * @param[in] pntarray An array of points - * @param[in] cnt The number of points in the array - * - * @api - */ - void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); - - /** - * @brief Fill a convex polygon - * @details Doesn't handle non-convex or complex polygons. - * - * @note Uses the current foreground color. - * - * @param[in] gh The window handle - * @param[in] tx, ty Transform all points in pntarray by tx, ty - * @param[in] pntarray An array of points - * @param[in] cnt The number of points in the array - * - * @note Convex polygons are those that have no internal angles. That is; - * you can draw a line from any point on the polygon to any other point - * on the polygon without it going outside the polygon. In our case we generalise - * this a little by saying that an infinite horizontal line (at any y value) will cross - * no more than two edges on the polygon. Some non-convex polygons do fit this criteria - * and can therefore be drawn. - * @note This routine is designed to be very efficient with even simple display hardware. - * - * @api - */ - void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); - - /** - * @brief Draw a thick line in the window - * @details The line thickness is specified in pixels. The line ends can - * be selected to be either flat or round. - * @note Uses gdispGFillConvexPoly() internally to perform the drawing. - * @note Uses the current foreground color to draw the line - * - * @param[in] gh The window handle - * @param[in] x0,y0 The start position - * @param[in] x1,y1 The end position - * @param[in] width The width of the line - * @param[in] round Use round ends for the line - * - * @api - */ - void gwinDrawThickLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1, coord_t width, bool_t round); - #endif - -/*------------------------------------------------- - * Image functions - *-------------------------------------------------*/ - - #if GDISP_NEED_IMAGE || defined(__DOXYGEN__) - /** - * @brief Draw the image - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @param[in] gh The window handle - * @param[in] img The image structure - * @param[in] x,y The window location to draw the image - * @param[in] cx,cy The area on the screen to draw - * @param[in] sx,sy The image position to start drawing at - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image - * is simply not drawn. - * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a - * fast blit from the cached frame. If not, it reads the input and decodes it as it - * is drawing. This may be significantly slower than if the image has been cached (but - * uses a lot less RAM) - * - * @api - */ - gdispImageError gwinDrawImage(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); - #endif - -#ifdef __cplusplus -} + gdispImageError gwinDrawImage(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); #endif /*------------------------------------------------- - * Additional functionality - *-------------------------------------------------*/ +* Additional functionality +*-------------------------------------------------*/ - /* Include widgets */ - #if GWIN_NEED_WIDGET || defined(__DOXYGEN__) - #include "gwin_widget.h" - #endif +/* Include widgets */ +#if GWIN_NEED_WIDGET || defined(__DOXYGEN__) + #include "gwin_widget.h" +#endif - /* Include containers */ - #if GWIN_NEED_CONTAINERS || defined(__DOXYGEN__) - #include "gwin_container.h" - #endif +/* Include containers */ +#if GWIN_NEED_CONTAINERS || defined(__DOXYGEN__) + #include "gwin_container.h" +#endif - /* Include vanilla window objects */ - #if GWIN_NEED_CONSOLE || defined(__DOXYGEN__) - #include "gwin_console.h" - #endif - #if GWIN_NEED_GRAPH || defined(__DOXYGEN__) - #include "gwin_graph.h" - #endif - #if GWIN_NEED_IMAGE || defined(__DOXYGEN__) - #include "gwin_image.h" - #endif - #if GWIN_NEED_GL3D || defined(__DOXYGEN__) - #include "gwin_gl3d.h" - #endif +/* Include vanilla window objects */ +#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__) + #include "gwin_console.h" +#endif +#if GWIN_NEED_GRAPH || defined(__DOXYGEN__) + #include "gwin_graph.h" +#endif +#if GWIN_NEED_IMAGE || defined(__DOXYGEN__) + #include "gwin_image.h" +#endif +#if GWIN_NEED_GL3D || defined(__DOXYGEN__) + #include "gwin_gl3d.h" +#endif #endif /* GFX_USE_GWIN */ diff --git a/src/gwin/gwin_button.c b/src/gwin/gwin_button.c index 8b3a2b6b..618c78b2 100644 --- a/src/gwin/gwin_button.c +++ b/src/gwin/gwin_button.c @@ -145,11 +145,11 @@ GHandle gwinGButtonCreate(GDisplay *g, GButtonObject *gw, const GWidgetInit *pIn return (GHandle)gw; } -bool_t gwinButtonIsPressed(GHandle gh) { +gBool gwinButtonIsPressed(GHandle gh) { if (gh->vmt != (gwinVMT *)&buttonVMT) - return FALSE; + return gFalse; - return (gh->flags & GBUTTON_FLG_PRESSED) ? TRUE : FALSE; + return (gh->flags & GBUTTON_FLG_PRESSED) ? gTrue : gFalse; } /*---------------------------------------------------------- diff --git a/src/gwin/gwin_button.h b/src/gwin/gwin_button.h index ba3bc354..ebbd88cb 100644 --- a/src/gwin/gwin_button.h +++ b/src/gwin/gwin_button.h @@ -58,10 +58,6 @@ typedef struct GButtonObject { #endif } GButtonObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a button widget. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -87,13 +83,13 @@ GHandle gwinGButtonCreate(GDisplay *g, GButtonObject *gb, const GWidgetInit *pIn /** * @brief Is the button current pressed - * @return TRUE if the button is pressed + * @return gTrue if the button is pressed * * @param[in] gh The window handle (must be a button widget) * * @api */ -bool_t gwinButtonIsPressed(GHandle gh); +gBool gwinButtonIsPressed(GHandle gh); /** * @defgroup Renderings_Button Renderings @@ -222,10 +218,6 @@ void gwinButtonDraw_Normal(GWidgetObject *gw, void *param); #endif /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_BUTTON_H */ /** @} */ diff --git a/src/gwin/gwin_checkbox.c b/src/gwin/gwin_checkbox.c index 1b3d395a..21d2ba86 100644 --- a/src/gwin/gwin_checkbox.c +++ b/src/gwin/gwin_checkbox.c @@ -33,7 +33,7 @@ static void SendCheckboxEvent(GWidgetObject *gw) { continue; pce->type = GEVENT_GWIN_CHECKBOX; pce->gwin = &gw->g; - pce->isChecked = (gw->g.flags & GCHECKBOX_FLG_CHECKED) ? TRUE : FALSE; + pce->isChecked = (gw->g.flags & GCHECKBOX_FLG_CHECKED) ? gTrue : gFalse; #if GWIN_WIDGET_TAGS pce->tag = gw->tag; #endif @@ -139,7 +139,7 @@ GHandle gwinGCheckboxCreate(GDisplay *g, GCheckboxObject *gb, const GWidgetInit return (GHandle)gb; } -void gwinCheckboxCheck(GHandle gh, bool_t isChecked) { +void gwinCheckboxCheck(GHandle gh, gBool isChecked) { if (gh->vmt != (gwinVMT *)&checkboxVMT) return; @@ -154,11 +154,11 @@ void gwinCheckboxCheck(GHandle gh, bool_t isChecked) { SendCheckboxEvent((GWidgetObject *)gh); } -bool_t gwinCheckboxIsChecked(GHandle gh) { +gBool gwinCheckboxIsChecked(GHandle gh) { if (gh->vmt != (gwinVMT *)&checkboxVMT) - return FALSE; + return gFalse; - return (gh->flags & GCHECKBOX_FLG_CHECKED) ? TRUE : FALSE; + return (gh->flags & GCHECKBOX_FLG_CHECKED) ? gTrue : gFalse; } /*---------------------------------------------------------- @@ -242,7 +242,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) { #if GWIN_NEED_FLASHING // Flash the on and off state. - pcol = _gwinGetFlashedColor(gw, pcol, TRUE); + pcol = _gwinGetFlashedColor(gw, pcol, gTrue); #endif gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter); @@ -263,7 +263,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) { #if GWIN_NEED_FLASHING // Flash the on and off state. - pcol = _gwinGetFlashedColor(gw, pcol, TRUE); + pcol = _gwinGetFlashedColor(gw, pcol, gTrue); #endif /* Fill the box blended from variants of the fill color */ diff --git a/src/gwin/gwin_checkbox.h b/src/gwin/gwin_checkbox.h index 2fba95c1..ebab833d 100644 --- a/src/gwin/gwin_checkbox.h +++ b/src/gwin/gwin_checkbox.h @@ -42,7 +42,7 @@ typedef struct GEventGWinCheckbox { #if GWIN_WIDGET_TAGS WidgetTag tag; // The checkbox tag #endif - bool_t isChecked; // Is the checkbox currently checked or unchecked? + gBool isChecked; // Is the checkbox currently checked or unchecked? } GEventGWinCheckbox; /** @@ -61,10 +61,6 @@ typedef struct GCheckboxObject { #endif } GCheckboxObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a checkbox window. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -92,21 +88,21 @@ GHandle gwinGCheckboxCreate(GDisplay *g, GCheckboxObject *gb, const GWidgetInit * @brief Set the state of a checkbox * * @param[in] gh The window handle (must be a checkbox window) - * @param[in] isChecked TRUE to set the check, FALSE to uncheck. + * @param[in] isChecked gTrue to set the check, gFalse to uncheck. * * @api */ -void gwinCheckboxCheck(GHandle gh, bool_t isChecked); +void gwinCheckboxCheck(GHandle gh, gBool isChecked); /** * @brief Get the state of a checkbox - * @return TRUE if the checkbox is currently checked + * @return gTrue if the checkbox is currently checked * * @param[in] gh The window handle (must be a checkbox window) * * @api */ -bool_t gwinCheckboxIsChecked(GHandle gh); +gBool gwinCheckboxIsChecked(GHandle gh); /** * @defgroup Renderings_Checkbox Renderings @@ -156,10 +152,6 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param); void gwinCheckboxDraw_Button(GWidgetObject *gw, void *param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_CHECKBOX_H */ /** @} */ diff --git a/src/gwin/gwin_class.h b/src/gwin/gwin_class.h index 4b173e3c..c161c0f6 100644 --- a/src/gwin/gwin_class.h +++ b/src/gwin/gwin_class.h @@ -154,7 +154,7 @@ typedef struct gwinVMT { typedef struct gwmVMT { void (*Init) (void); /**< The window manager has just been set as the current window manager */ void (*DeInit) (void); /**< The window manager has just been removed as the current window manager */ - bool_t (*Add) (GHandle gh, const GWindowInit *pInit); /**< A window has been added */ + gBool (*Add) (GHandle gh, const GWindowInit *pInit); /**< A window has been added */ void (*Delete) (GHandle gh); /**< A window has been deleted */ void (*Redraw) (GHandle gh); /**< A window needs to be redraw (or undrawn) */ void (*Size) (GHandle gh, coord_t w, coord_t h); /**< A window wants to be resized */ @@ -168,14 +168,10 @@ typedef struct gwinVMT { * @brief The current window manager */ extern GWindowManager *_GWINwm; - extern bool_t _gwinFlashState; + extern gBool _gwinFlashState; #endif -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Initialise (and allocate if necessary) the base GWIN object * @@ -220,7 +216,7 @@ typedef enum GRedrawMethod { REDRAW_WAIT, REDRAW_NOWAIT, REDRAW_INSESSION } GRed * @note This call will attempt to flush any pending redraws * in the system. The doWait parameter tells this call * how to handle someone already holding the drawing lock. - * If doWait is TRUE it waits to obtain the lock. If FALSE + * If doWait is gTrue it waits to obtain the lock. If gFalse * and the drawing lock is free then the redraw is done * immediately. If the drawing lock was taken it will postpone the flush * on the basis that someone else will do it for us later. @@ -231,13 +227,13 @@ void _gwinFlushRedraws(GRedrawMethod how); /** * @brief Obtain a drawing session - * @return TRUE if the drawing session was obtained, FALSE if the window is not visible + * @return gTrue if the drawing session was obtained, gFalse if the window is not visible * * @param[in] gh The window * * @note This function blocks until a drawing session is available if the window is visible */ -bool_t _gwinDrawStart(GHandle gh); +gBool _gwinDrawStart(GHandle gh); /** * @brief Release a drawing session @@ -261,12 +257,12 @@ void _gwinDestroy(GHandle gh, GRedrawMethod how); /** * @brief Add a window to the window manager and set its position and size - * @return TRUE if successful + * @return gTrue if successful * * @param[in] gh The window * @param[in] pInit The window init structure */ -bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit); +gBool _gwinWMAdd(GHandle gh, const GWindowInit *pInit); #if GWIN_NEED_WIDGET || defined(__DOXYGEN__) /** @@ -391,7 +387,7 @@ bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit); * @param[in] flashOffState Whether the off-state should be flashed as well. If false, only the * pressed color set is flashed. */ - const GColorSet *_gwinGetFlashedColor(GWidgetObject *gw, const GColorSet *pcol, bool_t flashOffState); + const GColorSet *_gwinGetFlashedColor(GWidgetObject *gw, const GColorSet *pcol, gBool flashOffState); #endif #else #define _gwinFixFocus(gh) @@ -446,10 +442,6 @@ bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit); #endif -#ifdef __cplusplus -} -#endif - #endif /* GFX_USE_GWIN */ #endif /* _CLASS_GWIN_H */ diff --git a/src/gwin/gwin_console.c b/src/gwin/gwin_console.c index 2d99b153..7bd0780e 100644 --- a/src/gwin/gwin_console.c +++ b/src/gwin/gwin_console.c @@ -79,7 +79,7 @@ #if GWIN_CONSOLE_ESCSEQ // Convert escape sequences to attributes - static bool_t ESCtoAttr(char c, uint8_t *pattr) { + static gBool ESCtoAttr(char c, uint8_t *pattr) { uint8_t attr; attr = pattr[0]; @@ -105,12 +105,12 @@ attr &= ~ESC_BOLD; break; default: - return FALSE; + return gFalse; } if (attr == pattr[0]) - return FALSE; + return gFalse; pattr[0] = attr; - return TRUE; + return gTrue; } static color_t ESCPrintColor(GConsoleObject *gcw) { @@ -348,7 +348,7 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p #if GWIN_CONSOLE_USE_HISTORY gc->buffer = 0; #if GWIN_CONSOLE_HISTORY_ATCREATE - gwinConsoleSetBuffer(&gc->g, TRUE); + gwinConsoleSetBuffer(&gc->g, gTrue); #endif #endif @@ -376,11 +376,11 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p #endif #if GWIN_CONSOLE_USE_HISTORY - bool_t gwinConsoleSetBuffer(GHandle gh, bool_t onoff) { + gBool gwinConsoleSetBuffer(GHandle gh, gBool onoff) { #define gcw ((GConsoleObject *)gh) if (gh->vmt != &consoleVMT) - return FALSE; + return gFalse; // Do we want the buffer turned off? if (!onoff) { @@ -388,12 +388,12 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p gfxFree(gcw->buffer); gcw->buffer = 0; } - return FALSE; + return gFalse; } // Is the buffer already on? if (gcw->buffer) - return TRUE; + return gTrue; // Get the number of characters that fit in the x direction #if GWIN_CONSOLE_HISTORY_AVERAGING @@ -408,12 +408,12 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p // Allocate the buffer if (!(gcw->buffer = gfxAlloc(gcw->bufsize))) - return FALSE; + return gFalse; // All good! gh->flags &= ~GCONSOLE_FLG_OVERRUN; gcw->bufpos = 0; - return TRUE; + return gTrue; #undef gcw } @@ -676,7 +676,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { va_list ap; char *p, *s, c, filler; int i, precision, width; - bool_t is_long, left_align; + gBool is_long, left_align; long l; #if GWIN_CONSOLE_USE_FLOAT float f; @@ -689,7 +689,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { return; va_start(ap, fmt); - while (TRUE) { + while (gTrue) { c = *fmt++; if (c == 0) { va_end(ap); @@ -702,10 +702,10 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { p = tmpbuf; s = tmpbuf; - left_align = FALSE; + left_align = gFalse; if (*fmt == '-') { fmt++; - left_align = TRUE; + left_align = gTrue; } filler = ' '; if (*fmt == '0') { @@ -714,7 +714,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { } width = 0; - while (TRUE) { + while (gTrue) { c = *fmt++; if (c >= '0' && c <= '9') c -= '0'; @@ -726,7 +726,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { } precision = 0; if (c == '.') { - while (TRUE) { + while (gTrue) { c = *fmt++; if (c >= '0' && c <= '9') c -= '0'; @@ -739,7 +739,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { } /* Long modifier.*/ if (c == 'l' || c == 'L') { - is_long = TRUE; + is_long = gTrue; if (*fmt) c = *fmt++; } @@ -808,7 +808,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { i = (int)(p - s); if ((width -= i) < 0) width = 0; - if (left_align == FALSE) + if (!left_align) width = -width; if (width < 0) { if (*s == '-' && filler == '0') { diff --git a/src/gwin/gwin_console.h b/src/gwin/gwin_console.h index fcfca35e..208ab16b 100644 --- a/src/gwin/gwin_console.h +++ b/src/gwin/gwin_console.h @@ -54,10 +54,6 @@ typedef struct GConsoleObject { } GConsoleObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a console window. * @details A console window allows text to be written. @@ -102,15 +98,15 @@ GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *p * @pre GWIN_CONSOLE_USE_HISTORY must be set to GFXON in your gfxconf.h * * @param[in] gh The window handle (must be a console window) - * @param[in] onoff If TRUE a buffer is allocated to maintain console text - * when the console is obscured or invisible. If FALSE, then + * @param[in] onoff If gTrue a buffer is allocated to maintain console text + * when the console is obscured or invisible. If gFalse, then * any existing buffer is deallocated. * @note When the history buffer is turned on, scrolling is implemented using the * history buffer. * - * @return TRUE if the history buffer is now turned on. + * @return gTrue if the history buffer is now turned on. */ - bool_t gwinConsoleSetBuffer(GHandle gh, bool_t onoff); + gBool gwinConsoleSetBuffer(GHandle gh, gBool onoff); #endif /** @@ -172,9 +168,5 @@ void gwinPutCharArray(GHandle gh, const char *str, size_t n); */ void gwinPrintf(GHandle gh, const char *fmt, ...); -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_CONSOLE_H */ /** @} */ diff --git a/src/gwin/gwin_container.h b/src/gwin/gwin_container.h index 9020c73e..a4a3afa2 100644 --- a/src/gwin/gwin_container.h +++ b/src/gwin/gwin_container.h @@ -46,10 +46,6 @@ typedef GWidgetObject GContainerObject; * won't support it even with special flags. */ -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Get the first child window * @@ -182,10 +178,6 @@ void gwinContainerDraw_Transparent(GWidgetObject *gw, void *param); /** @} */ -#ifdef __cplusplus -} -#endif - /* Include extra container types */ #if GWIN_NEED_FRAME || defined(__DOXYGEN__) #include "gwin_frame.h" diff --git a/src/gwin/gwin_frame.h b/src/gwin/gwin_frame.h index 06488321..7d60773c 100644 --- a/src/gwin/gwin_frame.h +++ b/src/gwin/gwin_frame.h @@ -50,10 +50,6 @@ typedef GContainerObject GFrameObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a frame widget * @@ -138,10 +134,6 @@ void gwinFrameDraw_Transparent(GWidgetObject *gw, void *param); #endif /* GDISP_NEED_IMAGE */ /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_FRAME_H */ /** @} */ diff --git a/src/gwin/gwin_gl3d.c b/src/gwin/gwin_gl3d.c index c9db1a3b..4c3f0f7f 100644 --- a/src/gwin/gwin_gl3d.c +++ b/src/gwin/gwin_gl3d.c @@ -35,7 +35,7 @@ static const gwinVMT gl3dVMT = { 0, // The after-clear routine }; -static bool_t haveGLwindow = FALSE; +static gBool haveGLwindow = gFalse; GHandle gwinGGL3DCreate(GDisplay *g, GGL3DObject *gl, const GWindowInit *pInit) { ZBuffer * zb; @@ -71,7 +71,7 @@ GHandle gwinGGL3DCreate(GDisplay *g, GGL3DObject *gl, const GWindowInit *pInit) glViewport(0, 0, gl->g.width, gl->g.height); - haveGLwindow = TRUE; + haveGLwindow = gTrue; gwinSetVisible((GHandle)gl, pInit->show); return (GHandle)gl; } @@ -79,7 +79,7 @@ GHandle gwinGGL3DCreate(GDisplay *g, GGL3DObject *gl, const GWindowInit *pInit) static void gl3dDestroy(GWindowObject *gh) { (void) gh; glClose(); - haveGLwindow = FALSE; + haveGLwindow = gFalse; } static void gl3dRedraw(GWindowObject *gh) { diff --git a/src/gwin/gwin_gl3d.h b/src/gwin/gwin_gl3d.h index 5dbfa893..205e681c 100644 --- a/src/gwin/gwin_gl3d.h +++ b/src/gwin/gwin_gl3d.h @@ -38,10 +38,6 @@ typedef struct GGL3DObject { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a gl3d window. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -64,10 +60,6 @@ GHandle gwinGGL3DCreate(GDisplay *g, GGL3DObject *gg, const GWindowInit *pInit); /* Include the gl interface */ #include "../../3rdparty/tinygl-0.4-ugfx/include/GL/gl.h" -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_GL3D_H */ /** @} */ diff --git a/src/gwin/gwin_graph.h b/src/gwin/gwin_graph.h index 76059a6f..7c893d5b 100644 --- a/src/gwin/gwin_graph.h +++ b/src/gwin/gwin_graph.h @@ -85,10 +85,6 @@ typedef struct GGraphObject { /* External declarations. */ /*===========================================================================*/ -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a graph window. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -180,10 +176,6 @@ void gwinGraphDrawPoint(GHandle gh, coord_t x, coord_t y); */ void gwinGraphDrawPoints(GHandle gh, const point *points, unsigned count); -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_GRAPH_H */ /** @} */ diff --git a/src/gwin/gwin_image.c b/src/gwin/gwin_image.c index 855eecc9..a4cc5028 100644 --- a/src/gwin/gwin_image.c +++ b/src/gwin/gwin_image.c @@ -108,7 +108,7 @@ static void ImageRedraw(GHandle gh) { // Fall through default: // Start the timer to draw the next frame of the animation - gtimerStart(&gw->timer, ImageTimer, (void*)gh, FALSE, delay); + gtimerStart(&gw->timer, ImageTimer, (void*)gh, gFalse, delay); break; } #endif @@ -139,20 +139,20 @@ GHandle gwinGImageCreate(GDisplay *g, GImageObject *gobj, GWindowInit *pInit) { return (GHandle)gobj; } -bool_t gwinImageOpenGFile(GHandle gh, GFILE *f) { +gBool gwinImageOpenGFile(GHandle gh, GFILE *f) { // is it a valid handle? if (gh->vmt != (gwinVMT *)&imageVMT) - return FALSE; + return gFalse; if (gdispImageIsOpen(&gw->image)) gdispImageClose(&gw->image); if ((gdispImageOpenGFile(&gw->image, f) & GDISP_IMAGE_ERR_UNRECOVERABLE)) - return FALSE; + return gFalse; _gwinUpdate(gh); - return TRUE; + return gTrue; } gdispImageError gwinImageCache(GHandle gh) { diff --git a/src/gwin/gwin_image.h b/src/gwin/gwin_image.h index b45629ee..2cf00761 100644 --- a/src/gwin/gwin_image.h +++ b/src/gwin/gwin_image.h @@ -40,10 +40,6 @@ typedef struct GImageObject { #endif } GImageObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create an image widget. * @details Display's a picture. @@ -63,18 +59,18 @@ GHandle gwinGImageCreate(GDisplay *g, GImageObject *widget, GWindowInit *pInit); /** * @brief Opens the image using a GFILE - * @return TRUE if the image can be opened + * @return gTrue if the image can be opened * * @param[in] gh The widget (must be an image widget) * @param[in] f The open (for reading) GFILE to use * * @api */ -bool_t gwinImageOpenGFile(GHandle gh, GFILE *f); +gBool gwinImageOpenGFile(GHandle gh, GFILE *f); /** * @brief Opens the image using the specified filename - * @return TRUE if the open succeeds + * @return gTrue if the open succeeds * * @param[in] gh The widget (must be an image widget) * @param[in] filename The filename to open @@ -87,7 +83,7 @@ bool_t gwinImageOpenGFile(GHandle gh, GFILE *f); * @brief Sets the input routines that support reading the image from memory * in RAM or flash. * @pre GFILE_NEED_MEMFS must be GFXON - * @return TRUE if the IO open function succeeds + * @return gTrue if the IO open function succeeds * * @param[in] gh The widget (must be an image widget) * @param[in] ptr A pointer to the image in RAM or Flash @@ -98,7 +94,7 @@ bool_t gwinImageOpenGFile(GHandle gh, GFILE *f); /** * @brief Sets the input routines that support reading the image from a BaseFileStream (eg. an SD-Card). - * @return TRUE if the IO open function succeeds + * @return gTrue if the IO open function succeeds * @pre GFILE_NEED_CHIBIOSFS and GFX_USE_OS_CHIBIOS must be GFXON * * @param[in] gh The widget (must be an image widget) @@ -120,10 +116,6 @@ bool_t gwinImageOpenGFile(GHandle gh, GFILE *f); */ gdispImageError gwinImageCache(GHandle gh); -#ifdef __cplusplus -} -#endif - #endif // _GWIN_IMAGE_H /** @} */ diff --git a/src/gwin/gwin_keyboard.h b/src/gwin/gwin_keyboard.h index f98d6570..0f4185ab 100644 --- a/src/gwin/gwin_keyboard.h +++ b/src/gwin/gwin_keyboard.h @@ -64,10 +64,6 @@ typedef struct GKeyboardObject { uint32_t key; } GKeyboardObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a keyboard widget. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -138,9 +134,5 @@ void gwinKeyboardDraw_Normal(GWidgetObject *gw, void *param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_KEYBOARD_H */ /** @} */ diff --git a/src/gwin/gwin_label.c b/src/gwin/gwin_label.c index e6e31eec..b522768a 100644 --- a/src/gwin/gwin_label.c +++ b/src/gwin/gwin_label.c @@ -105,7 +105,7 @@ GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit) return (GHandle)widget; } -void gwinLabelSetBorder(GHandle gh, bool_t border) { +void gwinLabelSetBorder(GHandle gh, gBool border) { // is it a valid handle? if (gh->vmt != (gwinVMT *)&labelVMT) return; diff --git a/src/gwin/gwin_label.h b/src/gwin/gwin_label.h index 66c4d97d..77bf5364 100644 --- a/src/gwin/gwin_label.h +++ b/src/gwin/gwin_label.h @@ -53,10 +53,6 @@ typedef struct GLabelObject { #endif } GLabelObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a label widget. * @details A label widget is a simple window which has a static text. @@ -80,7 +76,7 @@ GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit); * * @api */ -void gwinLabelSetBorder(GHandle gh, bool_t border); +void gwinLabelSetBorder(GHandle gh, gBool border); #if GWIN_LABEL_ATTRIBUTE || defined(__DOXYGEN__) /** @@ -159,9 +155,5 @@ void gwinLabelDrawJustifiedCenter(GWidgetObject *gw, void *param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif // _GWIN_LABEL_H /** @} */ diff --git a/src/gwin/gwin_list.c b/src/gwin/gwin_list.c index 5866603c..a14da805 100644 --- a/src/gwin/gwin_list.c +++ b/src/gwin/gwin_list.c @@ -297,7 +297,7 @@ static const gwidgetVMT listVMT = { #endif }; -GHandle gwinGListCreate(GDisplay *g, GListObject* gobj, GWidgetInit* pInit, bool_t multiselect) { +GHandle gwinGListCreate(GDisplay *g, GListObject* gobj, GWidgetInit* pInit, gBool multiselect) { if (!(gobj = (GListObject *)_gwidgetCreate(g, &gobj->w, pInit, &listVMT))) return 0; @@ -315,7 +315,7 @@ GHandle gwinGListCreate(GDisplay *g, GListObject* gobj, GWidgetInit* pInit, bool return (GHandle)gobj; } -void gwinListEnableRender(GHandle gh, bool_t ena) { +void gwinListEnableRender(GHandle gh, gBool ena) { // is it a valid handle? if (gh->vmt != (gwinVMT *)&listVMT) return; @@ -348,7 +348,7 @@ void gwinListSetScroll(GHandle gh, scroll_t flag) { } } -int gwinListAddItem(GHandle gh, const char* text, bool_t useAlloc) { +int gwinListAddItem(GHandle gh, const char* text, gBool useAlloc) { ListItem *newItem; // is it a valid handle? @@ -391,7 +391,7 @@ int gwinListAddItem(GHandle gh, const char* text, bool_t useAlloc) { return gh2obj->cnt-1; } -void gwinListItemSetText(GHandle gh, int item, const char* text, bool_t useAlloc) { +void gwinListItemSetText(GHandle gh, int item, const char* text, gBool useAlloc) { const gfxQueueASyncItem *qi; int i; ListItem *newItem; @@ -578,23 +578,23 @@ uint16_t gwinListItemGetParam(GHandle gh, int item) { return 0; } -bool_t gwinListItemIsSelected(GHandle gh, int item) { +gBool gwinListItemIsSelected(GHandle gh, int item) { const gfxQueueASyncItem * qi; int i; // is it a valid handle? if (gh->vmt != (gwinVMT *)&listVMT) - return FALSE; + return gFalse; // watch out for an invalid item if (item < 0 || item > (gh2obj->cnt) - 1) - return FALSE; + return gFalse; for(qi = gfxQueueASyncPeek(&gh2obj->list_head), i = 0; qi; qi = gfxQueueASyncNext(qi), i++) { if (i == item) - return (qi2li->flags & GLIST_FLG_SELECTED) ? TRUE : FALSE; + return (qi2li->flags & GLIST_FLG_SELECTED) ? gTrue : gFalse; } - return FALSE; + return gFalse; } int gwinListItemCount(GHandle gh) { @@ -617,7 +617,7 @@ const char* gwinListGetSelectedText(GHandle gh) { return gwinListItemGetText(gh, gwinListGetSelected(gh)); } -void gwinListSetSelected(GHandle gh, int item, bool_t doSelect) { +void gwinListSetSelected(GHandle gh, int item, gBool doSelect) { const gfxQueueASyncItem * qi; int i; diff --git a/src/gwin/gwin_list.h b/src/gwin/gwin_list.h index 041bbb68..9bd7075d 100644 --- a/src/gwin/gwin_list.h +++ b/src/gwin/gwin_list.h @@ -104,11 +104,6 @@ typedef struct ListItem { #endif } ListItem; - -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a list widget * @@ -127,13 +122,13 @@ extern "C" { * @param[in] g The GDisplay to display this window on * @param[in] widget The GListObject structure to initialize. If this is NULL, the structure is dynamically allocated. * @param[in] pInit The initialization parameters to use - * @param[in] multiselect If TRUE the list is multi-select instead of single-select. + * @param[in] multiselect If gTrue the list is multi-select instead of single-select. * * @return NULL if there is no resulting drawing area, otherwise a window handle. * * @api */ -GHandle gwinGListCreate(GDisplay *g, GListObject *widget, GWidgetInit *pInit, bool_t multiselect); +GHandle gwinGListCreate(GDisplay *g, GListObject *widget, GWidgetInit *pInit, gBool multiselect); #define gwinListCreate(w, pInit, m) gwinGListCreate(GDISP, w, pInit, m) /** @@ -144,11 +139,11 @@ GHandle gwinGListCreate(GDisplay *g, GListObject *widget, GWidgetInit *pInit, bo * by temporarely disabling the render using this function. * * @param[in] gh The widget handle (must be a list handle) - * @param[in] ena TRUE or FALSE + * @param[in] ena gTrue or gFalse * * @api */ -void gwinListEnableRender(GHandle gh, bool_t ena); +void gwinListEnableRender(GHandle gh, gBool ena); /** * @brief Change the behaviour of the scroll bar @@ -170,13 +165,13 @@ void gwinListSetScroll(GHandle gh, scroll_t flag); * * @param[in] gh The widget handle (must be a list handle) * @param[in] text The string which shall be displayed in the list afterwards - * @param[in] useAlloc If set to TRUE, the string will be dynamically allocated. A static buffer must be passed otherwise + * @param[in] useAlloc If set to gTrue, the string will be dynamically allocated. A static buffer must be passed otherwise * * @return The current ID of the item. The ID might change if you remove items from the middle of the list * * @api */ -int gwinListAddItem(GHandle gh, const char* text, bool_t useAlloc); +int gwinListAddItem(GHandle gh, const char* text, gBool useAlloc); /** * @brief Set the custom parameter of an item with a given ID @@ -184,11 +179,11 @@ int gwinListAddItem(GHandle gh, const char* text, bool_t useAlloc); * @param[in] gh The widget handle (must be a list handle) * @param[in] item The item ID * @param[in] text The text to replace the existing text - * @param[in] useAlloc If set to TRUE, the string will be dynamically allocated. A static buffer must be passed otherwise + * @param[in] useAlloc If set to gTrue, the string will be dynamically allocated. A static buffer must be passed otherwise * * @api */ -void gwinListItemSetText(GHandle gh, int item, const char* text, bool_t useAlloc); +void gwinListItemSetText(GHandle gh, int item, const char* text, gBool useAlloc); /** * @brief Get the name behind an item with a given ID @@ -273,11 +268,11 @@ int gwinListItemCount(GHandle gh); * @param[in] gh The widget handle (must be a list handle) * @param[in] item The item ID * - * @return TRUE if the item is selected, FALSE otherwise + * @return gTrue if the item is selected, gFalse otherwise * * @api */ -bool_t gwinListItemIsSelected(GHandle gh, int item); +gBool gwinListItemIsSelected(GHandle gh, int item); /** * @brief Get the ID of the selected item @@ -312,7 +307,7 @@ const char* gwinListGetSelectedText(GHandle gh); * * @param[in] gh The widget handle (must be a list handle) * @param[in] item The item ID - * @param[in] doSelect TRUE to select the item or FALSE to deselect the item + * @param[in] doSelect gTrue to select the item or gFalse to deselect the item * * @note Changing the selection using this api call will NOT send the list selection * change event. @@ -323,7 +318,7 @@ const char* gwinListGetSelectedText(GHandle gh); * are selected, even in single-select mode. * @api */ -void gwinListSetSelected(GHandle gh, int item, bool_t doSelect); +void gwinListSetSelected(GHandle gh, int item, gBool doSelect); /** * @brief Scroll the list so the specified item is in view @@ -396,10 +391,6 @@ void gwinListDefaultDraw(GWidgetObject* gw, void* param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif // _GWIN_LIST_H /** @} */ diff --git a/src/gwin/gwin_progressbar.c b/src/gwin/gwin_progressbar.c index ce11934f..23d1b4c7 100644 --- a/src/gwin/gwin_progressbar.c +++ b/src/gwin/gwin_progressbar.c @@ -201,7 +201,7 @@ void gwinProgressbarDecrement(GHandle gh) { if (gh->vmt != (gwinVMT *)&progressbarVMT) return; - gtimerStart(&gsw->gt, _progressbarCallback, gh, TRUE, delay); + gtimerStart(&gsw->gt, _progressbarCallback, gh, gTrue, delay); #undef gsw } diff --git a/src/gwin/gwin_progressbar.h b/src/gwin/gwin_progressbar.h index 95feaf4a..aa4deb2d 100644 --- a/src/gwin/gwin_progressbar.h +++ b/src/gwin/gwin_progressbar.h @@ -36,10 +36,6 @@ typedef struct GProgressbarObject { #endif } GProgressbarObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a progressbar window. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -221,9 +217,5 @@ void gwinProgressbarDraw_Std(GWidgetObject *gw, void *param); #endif /* GDISP_NEED_IMAGE */ /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_PROGRESSBAR_H */ /** @} */ diff --git a/src/gwin/gwin_radio.c b/src/gwin/gwin_radio.c index 8e0b4e64..d3747762 100644 --- a/src/gwin/gwin_radio.c +++ b/src/gwin/gwin_radio.c @@ -154,11 +154,11 @@ void gwinRadioPress(GHandle gh) { SendRadioEvent((GWidgetObject *)gh); } -bool_t gwinRadioIsPressed(GHandle gh) { +gBool gwinRadioIsPressed(GHandle gh) { if (gh->vmt != (gwinVMT *)&radioVMT) - return FALSE; + return gFalse; - return (gh->flags & GRADIO_FLG_PRESSED) ? TRUE : FALSE; + return (gh->flags & GRADIO_FLG_PRESSED) ? gTrue : gFalse; } GHandle gwinRadioGetActive(uint16_t group) { @@ -224,7 +224,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) { #if GWIN_NEED_FLASHING // Flash only the on state. - pcol = _gwinGetFlashedColor(gw, pcol, FALSE); + pcol = _gwinGetFlashedColor(gw, pcol, gFalse); #endif gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter); @@ -243,7 +243,7 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) { #if GWIN_NEED_FLASHING // Flash only the on state. - pcol = _gwinGetFlashedColor(gw, pcol, FALSE); + pcol = _gwinGetFlashedColor(gw, pcol, gFalse); #endif if ((gw->g.flags & GRADIO_FLG_PRESSED)) { diff --git a/src/gwin/gwin_radio.h b/src/gwin/gwin_radio.h index 514620c1..2328f95c 100644 --- a/src/gwin/gwin_radio.h +++ b/src/gwin/gwin_radio.h @@ -65,10 +65,6 @@ typedef struct GRadioObject { uint16_t group; } GRadioObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a radio widget. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -106,13 +102,13 @@ void gwinRadioPress(GHandle gh); /** * @brief Is the radio button currently pressed - * @return TRUE if the button is pressed + * @return gTrue if the button is pressed * * @param[in] gh The window handle (must be a radio widget) * * @api */ -bool_t gwinRadioIsPressed(GHandle gh); +gBool gwinRadioIsPressed(GHandle gh); /** * @brief Find the currently pressed radio button in the specified group @@ -177,9 +173,5 @@ void gwinRadioDraw_Button(GWidgetObject *gw, void *param); void gwinRadioDraw_Tab(GWidgetObject *gw, void *param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_RADIO_H */ /** @} */ diff --git a/src/gwin/gwin_slider.c b/src/gwin/gwin_slider.c index d2e671b1..d3316bc2 100644 --- a/src/gwin/gwin_slider.c +++ b/src/gwin/gwin_slider.c @@ -326,7 +326,7 @@ void gwinSliderSetPosition(GHandle gh, int pos) { #undef gsw } -void gwinSliderSendExtendedEvents(GHandle gh, bool_t enabled) { +void gwinSliderSendExtendedEvents(GHandle gh, gBool enabled) { if (gh->vmt != (gwinVMT *)&sliderVMT) return; diff --git a/src/gwin/gwin_slider.h b/src/gwin/gwin_slider.h index c388417d..588a39e8 100644 --- a/src/gwin/gwin_slider.h +++ b/src/gwin/gwin_slider.h @@ -69,10 +69,6 @@ typedef struct GSliderObject { int pos; } GSliderObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a slider window. * @return NULL if there is no resultant drawing area, otherwise a window handle. @@ -143,14 +139,14 @@ void gwinSliderSetPosition(GHandle gh, int pos); * @brief Should the slider send extended events. * * @param[in] gh The window handle (must be a slider window) - * @param[in] enabled TRUE to enable extended events, FALSE to disable them + * @param[in] enabled gTrue to enable extended events, gFalse to disable them * * @note The slider by default will only send slider events with an action of GSLIDER_EVENT_SET. * This call can be used to enable other slider action's to be sent as events * * @api */ -void gwinSliderSendExtendedEvents(GHandle gh, bool_t enabled); +void gwinSliderSendExtendedEvents(GHandle gh, gBool enabled); /** * @defgroup Renderings_Slider Renderings @@ -199,9 +195,5 @@ void gwinSliderDraw_Image(GWidgetObject *gw, void *param); #endif /* GDISP_NEED_IMAGE */ /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_SLIDER_H */ /** @} */ diff --git a/src/gwin/gwin_tabset.c b/src/gwin/gwin_tabset.c index 0bb18c18..43718391 100644 --- a/src/gwin/gwin_tabset.c +++ b/src/gwin/gwin_tabset.c @@ -108,7 +108,7 @@ static const gcontainerVMT tabpageVMT = { 0, // A child has been deleted (optional) }; -void gwinTabsetSetTitle(GHandle gh, const char *title, bool_t useAlloc) { +void gwinTabsetSetTitle(GHandle gh, const char *title, gBool useAlloc) { if (gh->vmt != (gwinVMT *)&tabpageVMT) return; @@ -305,7 +305,7 @@ GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, ui // API calls /////////////////////////////////////////////////////////////////////////////////////////////////// -GHandle gwinTabsetAddTab(GHandle gh, const char *title, bool_t useAlloc) { +GHandle gwinTabsetAddTab(GHandle gh, const char *title, gBool useAlloc) { GWidgetInit wi; if (gh->vmt != (gwinVMT *)&tabsetVMT) diff --git a/src/gwin/gwin_tabset.h b/src/gwin/gwin_tabset.h index 90d9eb3b..8c07c7d2 100644 --- a/src/gwin/gwin_tabset.h +++ b/src/gwin/gwin_tabset.h @@ -60,10 +60,6 @@ typedef struct GTabsetObject { coord_t border_top; } GTabsetObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a tabset widget * @@ -89,11 +85,11 @@ GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, ui * * @param[in] gh The tabset handle * @param[in] title The text to set. This must be a constant string unless useAlloc is set. - * @param[in] useAlloc If TRUE the string specified will be copied into dynamically allocated memory. + * @param[in] useAlloc If gTrue the string specified will be copied into dynamically allocated memory. * * @api */ -GHandle gwinTabsetAddTab(GHandle gh, const char *title, bool_t useAlloc); +GHandle gwinTabsetAddTab(GHandle gh, const char *title, gBool useAlloc); /** * @brief Delete a tab-page. @@ -144,14 +140,14 @@ GHandle gwinTabsetGetTabByTitle(GHandle gh, const char *title); * * @param[in] gh The tab-page handle (NB: Use the page handle NOT the tabset handle) * @param[in] title The text to set. This must be a constant string unless useAlloc is set. - * @param[in] useAlloc If TRUE the string specified will be copied into dynamically allocated memory. + * @param[in] useAlloc If gTrue the string specified will be copied into dynamically allocated memory. * * @note This function should be used to change the text associated with a tab-page * rather than @p gwinSetText(). * * @api */ -void gwinTabsetSetTitle(GHandle gh, const char *title, bool_t useAlloc); +void gwinTabsetSetTitle(GHandle gh, const char *title, gBool useAlloc); /** * @brief Get the title of a tab-page. @@ -232,10 +228,6 @@ void gwinTabsetDraw_Transparent(GWidgetObject *gw, void *param); #endif /* GDISP_NEED_IMAGE */ /** @} */ -#ifdef __cplusplus -} -#endif - #endif /* _GWIN_TABSET_H */ /** @} */ diff --git a/src/gwin/gwin_textedit.c b/src/gwin/gwin_textedit.c index 61c28c66..1cc168f1 100644 --- a/src/gwin/gwin_textedit.c +++ b/src/gwin/gwin_textedit.c @@ -53,7 +53,7 @@ static void TextEditRemoveChar(GHandle gh) { gh2obj->w.text = p; } -static bool_t TextEditAddChars(GHandle gh, unsigned cnt) { +static gBool TextEditAddChars(GHandle gh, unsigned cnt) { char *p; const char *q; unsigned sz; @@ -65,21 +65,21 @@ static bool_t TextEditAddChars(GHandle gh, unsigned cnt) { if (!(gh->flags & GWIN_FLG_ALLOCTXT)) { if (!(p = gfxAlloc(sz+cnt))) - return FALSE; + return gFalse; memcpy(p, gh2obj->w.text, pos); memcpy(p+pos+cnt, gh2obj->w.text+pos, sz-pos); gh->flags |= GWIN_FLG_ALLOCTXT; gh2obj->w.text = p; } else { if (!(p = gfxRealloc((char *)gh2obj->w.text, sz, sz+cnt))) - return FALSE; + return gFalse; gh2obj->w.text = p; q = p+pos; p += sz; while(--p >= q) p[cnt] = p[0]; } - return TRUE; + return gTrue; } // Function that allows to set the cursor to any position in the string diff --git a/src/gwin/gwin_textedit.h b/src/gwin/gwin_textedit.h index 0fdcc843..ea501caa 100644 --- a/src/gwin/gwin_textedit.h +++ b/src/gwin/gwin_textedit.h @@ -40,10 +40,6 @@ typedef struct GTexteditObject { uint16_t cursorPos; } GTexteditObject; -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Create a TextEdit widget * @details A TextEdit widget is a rectangular box which allows the user to input data through a keyboard. @@ -116,9 +112,5 @@ void gwinTexteditDefaultDraw(GWidgetObject* gw, void* param); /** @} */ -#ifdef __cplusplus -} -#endif - #endif // _GWIN_TEXTEDIT_H /** @} */ diff --git a/src/gwin/gwin_widget.c b/src/gwin/gwin_widget.c index 38b4e236..d4865935 100644 --- a/src/gwin/gwin_widget.c +++ b/src/gwin/gwin_widget.c @@ -238,12 +238,12 @@ static void gwidgetEvent(void *param, GEvent *pe) { return _widgetInFocus; } - bool_t gwinSetFocus(GHandle gh) { + gBool gwinSetFocus(GHandle gh) { GHandle oldFocus; // Do we already have the focus? if (gh == _widgetInFocus) - return TRUE; + return gTrue; // The new window must be NULLL or a visible enabled widget with a keyboard handler if (!gh || ((gh->flags & (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED|GWIN_FLG_SYSENABLED|GWIN_FLG_VISIBLE|GWIN_FLG_SYSVISIBLE)) == (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED|GWIN_FLG_SYSENABLED|GWIN_FLG_VISIBLE|GWIN_FLG_SYSVISIBLE) @@ -253,20 +253,20 @@ static void gwidgetEvent(void *param, GEvent *pe) { _widgetInFocus = gh; if (oldFocus) _gwinUpdate(oldFocus); if (gh) _gwinUpdate(gh); - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } void _gwinMoveFocus(void) { GHandle gh; - bool_t looponce; + gBool looponce; // Find a new focus window (one may or may not exist). - looponce = FALSE; + looponce = gFalse; for(gh = gwinGetNextWindow(_widgetInFocus); ; gh = gwinGetNextWindow(gh)) { if (!gh && !looponce) { - looponce = TRUE; + looponce = gTrue; gh = gwinGetNextWindow(0); } if (gwinSetFocus(gh)) @@ -494,7 +494,7 @@ void gwinWidgetClearInit(GWidgetInit *pwi) { *p++ = 0; } -void gwinSetDefaultStyle(const GWidgetStyle *pstyle, bool_t updateAll) { +void gwinSetDefaultStyle(const GWidgetStyle *pstyle, gBool updateAll) { if (!pstyle) pstyle = &BlackWidgetStyle; @@ -521,7 +521,7 @@ const GWidgetStyle *gwinGetDefaultStyle(void) { return defaultStyle; } -void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) { +void gwinSetText(GHandle gh, const char *text, gBool useAlloc) { if (!(gh->flags & GWIN_FLG_WIDGET)) return; @@ -595,12 +595,12 @@ const char *gwinGetText(GHandle gh) { return gw->text; } -bool_t gwinIsWidget(GHandle gh) { +gBool gwinIsWidget(GHandle gh) { if (gh->flags & GWIN_FLG_WIDGET) { - return TRUE; + return gTrue; } - return FALSE; + return gFalse; } void gwinSetStyle(GHandle gh, const GWidgetStyle *pstyle) { @@ -630,39 +630,39 @@ void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param) { _gwinUpdate(gh); } -bool_t gwinAttachListener(GListener *pl) { +gBool gwinAttachListener(GListener *pl) { return geventAttachSource(pl, GWIDGET_SOURCE, 0); } #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - bool_t DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance) { + gBool DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance) { // This is now a NULL event because we automatically attach to all mice in the system. (void) instance; - return TRUE; + return gTrue; } #endif #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE - bool_t gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance) { + gBool gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance) { GSourceHandle gsh; uint16_t oi; // Is this a widget if (!(gh->flags & GWIN_FLG_WIDGET)) - return FALSE; + return gFalse; // Is the role valid if (role >= wvmt->toggleroles) - return FALSE; + return gFalse; // Is this a valid device if (!(gsh = ginputGetToggle(instance))) - return FALSE; + return gFalse; // Is this already done? oi = wvmt->ToggleGet(gw, role); if (instance == oi) - return TRUE; + return gTrue; // Remove the old instance if (oi != GWIDGET_NO_INSTANCE) { @@ -676,16 +676,16 @@ bool_t gwinAttachListener(GListener *pl) { return geventAttachSource(&gl, gsh, GLISTEN_TOGGLE_ON|GLISTEN_TOGGLE_OFF); } - bool_t gwinDetachToggle(GHandle gh, uint16_t role) { + gBool gwinDetachToggle(GHandle gh, uint16_t role) { uint16_t oi; // Is this a widget if (!(gh->flags & GWIN_FLG_WIDGET)) - return FALSE; + return gFalse; // Is the role valid if (role >= ((gwidgetVMT *)gh->vmt)->toggleroles) - return FALSE; + return gFalse; oi = ((gwidgetVMT *)gh->vmt)->ToggleGet(gw, role); @@ -695,31 +695,31 @@ bool_t gwinAttachListener(GListener *pl) { if (!FindToggleUser(oi)) geventDetachSource(&gl, ginputGetToggle(oi)); } - return TRUE; + return gTrue; } #endif #if GFX_USE_GINPUT && GINPUT_NEED_DIAL - bool_t gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance) { + gBool gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance) { GSourceHandle gsh; uint16_t oi; if (!(gh->flags & GWIN_FLG_WIDGET)) - return FALSE; + return gFalse; // Is the role valid if (role >= wvmt->dialroles) - return FALSE; + return gFalse; // Is this a valid device if (!(gsh = ginputGetDial(instance))) - return FALSE; + return gFalse; // Is this already done? oi = wvmt->DialGet(gw, role); if (instance == oi) - return TRUE; + return gTrue; // Remove the old instance if (oi != GWIDGET_NO_INSTANCE) { diff --git a/src/gwin/gwin_widget.h b/src/gwin/gwin_widget.h index 58c71b16..c74eb877 100644 --- a/src/gwin/gwin_widget.h +++ b/src/gwin/gwin_widget.h @@ -90,7 +90,7 @@ typedef uint16_t WidgetTag; * to clear it. * @note The text element must be static string (not stack allocated). If you want to use * a dynamic string (eg a stack allocated string) use NULL for this member and then call - * @p gwinSetText() with useAlloc set to TRUE. + * @p gwinSetText() with useAlloc set to gTrue. * * @{ */ @@ -168,10 +168,6 @@ typedef struct GEventGWin { #define GEVENT_GWIN_CTRL_FIRST (GEVENT_GWIN_FIRST+0x40) /** @} */ -#ifdef __cplusplus -extern "C" { -#endif - /** * @brief Clear a GWidgetInit structure to all zero's * @note This function is provided just to prevent problems @@ -188,7 +184,7 @@ void gwinWidgetClearInit(GWidgetInit *pwi); * @brief Set the default style for widgets created hereafter. * * @param[in] pstyle The default style. Passing NULL uses the system compiled style. - * @param[in] updateAll If TRUE then all existing widgets that are using the current default style + * @param[in] updateAll If gTrue then all existing widgets that are using the current default style * will be updated to use this new style. Widgets that have custom styles different * from the default style will not be updated. * @@ -196,7 +192,7 @@ void gwinWidgetClearInit(GWidgetInit *pwi); * * @api */ -void gwinSetDefaultStyle(const GWidgetStyle *pstyle, bool_t updateAll); +void gwinSetDefaultStyle(const GWidgetStyle *pstyle, gBool updateAll); /** * @brief Get the current default style. @@ -212,14 +208,14 @@ const GWidgetStyle *gwinGetDefaultStyle(void); * * @param[in] gh The widget handle * @param[in] text The text to set. This must be a constant string unless useAlloc is set. - * @param[in] useAlloc If TRUE the string specified will be copied into dynamically allocated memory. + * @param[in] useAlloc If gTrue the string specified will be copied into dynamically allocated memory. * * @note The widget is automatically redrawn * @note Non-widgets will ignore this call. * * @api */ -void gwinSetText(GHandle gh, const char *text, bool_t useAlloc); +void gwinSetText(GHandle gh, const char *text, gBool useAlloc); /** * @brief Get the text of a widget. @@ -254,11 +250,11 @@ const char *gwinGetText(GHandle gh); * * @param[in] gh The handle to check. * - * @return TRUE if the passed handle is a widget handle. FALSE otherwise. + * @return gTrue if the passed handle is a widget handle. gFalse otherwise. * * @api */ -bool_t gwinIsWidget(GHandle gh); +gBool gwinIsWidget(GHandle gh); #if GWIN_WIDGET_TAGS || defined(__DOXYGEN__) /** @@ -328,22 +324,22 @@ void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param); /** * @brief Attach a Listener to listen for widget events - * @return TRUE on success + * @return gTrue on success * * @param[in] pl The listener * * @api */ -bool_t gwinAttachListener(GListener *pl); +gBool gwinAttachListener(GListener *pl); #if (GFX_USE_GINPUT && GINPUT_NEED_MOUSE) || defined(__DOXYGEN__) - bool_t DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance); + gBool DEPRECATED("This call can now be removed. Attaching the mouse to GWIN is now automatic.") gwinAttachMouse(uint16_t instance); #endif #if (GFX_USE_GINPUT && GINPUT_NEED_TOGGLE) || defined(__DOXYGEN__) /** * @brief Attach a toggle to a widget - * @return TRUE on success + * @return gTrue on success * * @param[in] gh The widget handle * @param[in] role The function the toggle will perform for the widget @@ -351,31 +347,31 @@ bool_t gwinAttachListener(GListener *pl); * * @note See the documentation on the specific widget to see the possible * values for the role parameter. If it is out of range, this function - * will return FALSE + * will return gFalse * * @api */ - bool_t gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance); + gBool gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance); /** * @brief Detach a toggle from a widget - * @return TRUE on success + * @return gTrue on success * * @param[in] gh The widget handle * @param[in] role The function the toggle will perform for the widget * * @note See the documentation on the specific widget to see the possible * values for the role parameter. If it is out of range, this function - * will return FALSE + * will return gFalse * * @api */ - bool_t gwinDetachToggle(GHandle gh, uint16_t role); + gBool gwinDetachToggle(GHandle gh, uint16_t role); #endif #if (GFX_USE_GINPUT && GINPUT_NEED_DIAL) || defined(__DOXYGEN__) /** * @brief Attach a toggle to a widget - * @return TRUE on success + * @return gTrue on success * * @param[in] gh The widget handle * @param[in] role The function the dial will perform for the widget @@ -383,17 +379,17 @@ bool_t gwinAttachListener(GListener *pl); * * @note See the documentation on the specific widget to see the possible * values for the role parameter. If it is out of range, this function - * will return FALSE + * will return gFalse * * @api */ - bool_t gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance); + gBool gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance); #endif #if (GFX_USE_GINPUT && GINPUT_NEED_KEYBOARD) || GWIN_NEED_KEYBOARD || defined(__DOXYGEN__) /** * @brief Set the keyboard focus to a specific window - * @return Returns TRUE if the focus could be set to that window + * @return Returns gTrue if the focus could be set to that window * * @param[in] gh The window * @@ -402,7 +398,7 @@ bool_t gwinAttachListener(GListener *pl); * * @api */ - bool_t gwinSetFocus(GHandle gh); + gBool gwinSetFocus(GHandle gh); /** * @brief Get the widget that is currently in focus @@ -417,11 +413,7 @@ bool_t gwinAttachListener(GListener *pl); GHandle gwinGetFocus(void); #else #define gwinGetFocus() (0) - #define gwinSetFocus(gh) (FALSE) -#endif - -#ifdef __cplusplus -} + #define gwinSetFocus(gh) (gFalse) #endif /* Include extra widget types */ diff --git a/src/gwin/gwin_wm.c b/src/gwin/gwin_wm.c index 7f251a70..6761180f 100644 --- a/src/gwin/gwin_wm.c +++ b/src/gwin/gwin_wm.c @@ -34,11 +34,11 @@ gfxMutexDestroy(&gmutex); } - bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit) { + gBool _gwinWMAdd(GHandle gh, const GWindowInit *pInit) { gh->x = gh->y = gh->width = gh->height = 0; gwinMove(gh, pInit->x, pInit->y); gwinResize(gh, pInit->width, pInit->height); - return TRUE; + return gTrue; } void _gwinFlushRedraws(GRedrawMethod how) { @@ -83,12 +83,12 @@ gh->flags &= ~(GWIN_FLG_NEEDREDRAW|GWIN_FLG_BGREDRAW); } - bool_t _gwinDrawStart(GHandle gh) { + gBool _gwinDrawStart(GHandle gh) { if (!(gh->flags & GWIN_FLG_SYSVISIBLE)) - return FALSE; + return gFalse; getLock(gh); - return TRUE; + return gTrue; } void _gwinDrawEnd(GHandle gh) { @@ -96,7 +96,7 @@ exitLock(gh); } - void gwinSetVisible(GHandle gh, bool_t visible) { + void gwinSetVisible(GHandle gh, gBool visible) { if (visible) { if (!(gh->flags & GWIN_FLG_VISIBLE)) { gh->flags |= (GWIN_FLG_VISIBLE|GWIN_FLG_SYSVISIBLE|GWIN_FLG_BGREDRAW); @@ -111,7 +111,7 @@ } } - void gwinSetEnabled(GHandle gh, bool_t enabled) { + void gwinSetEnabled(GHandle gh, gBool enabled) { if (enabled) { if (!(gh->flags & GWIN_FLG_ENABLED)) { gh->flags |= (GWIN_FLG_ENABLED|GWIN_FLG_SYSENABLED); @@ -161,7 +161,7 @@ // The default window manager extern const GWindowManager GNullWindowManager; GWindowManager * _GWINwm; -bool_t _gwinFlashState; +gBool _gwinFlashState; static gfxSem gwinsem; static gfxQueueASync _GWINList; #if GWIN_NEED_FLASHING @@ -190,7 +190,7 @@ void _gwmInit(void) #endif #if !GWIN_REDRAW_IMMEDIATE gtimerInit(&RedrawTimer); - gtimerStart(&RedrawTimer, RedrawTimerFn, 0, TRUE, TIME_INFINITE); + gtimerStart(&RedrawTimer, RedrawTimerFn, 0, gTrue, TIME_INFINITE); #endif _GWINwm = (GWindowManager *)&GNullWindowManager; _GWINwm->vmt->Init(); @@ -366,11 +366,11 @@ void _gwinUpdate(GHandle gh) { } #endif -bool_t _gwinDrawStart(GHandle gh) { +gBool _gwinDrawStart(GHandle gh) { // This test should occur inside the lock. We do this // here as well as an early out (more efficient). if (!(gh->flags & GWIN_FLG_SYSVISIBLE)) - return FALSE; + return gFalse; // Obtain the drawing lock gfxSemWait(&gwinsem, TIME_INFINITE); @@ -378,14 +378,14 @@ bool_t _gwinDrawStart(GHandle gh) { // Re-test visibility as we may have waited a while if (!(gh->flags & GWIN_FLG_SYSVISIBLE)) { _gwinDrawEnd(gh); - return FALSE; + return gFalse; } // OK - we are ready to draw. #if GDISP_NEED_CLIP gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height); #endif - return TRUE; + return gTrue; } void _gwinDrawEnd(GHandle gh) { @@ -401,19 +401,19 @@ void _gwinDrawEnd(GHandle gh) { gfxSemSignal(&gwinsem); } -bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit) { +gBool _gwinWMAdd(GHandle gh, const GWindowInit *pInit) { #if GWIN_NEED_CONTAINERS // Save the parent gh->parent = pInit->parent; // Ensure the display is consistent with any parents if (gh->parent && (!(gh->parent->flags & GWIN_FLG_CONTAINER) || gh->display != gh->parent->display)) - return FALSE; + return gFalse; #endif // Add to the window manager if (!_GWINwm->vmt->Add(gh, pInit)) - return FALSE; + return gFalse; #if GWIN_NEED_CONTAINERS // Notify the parent it has been added @@ -421,7 +421,7 @@ bool_t _gwinWMAdd(GHandle gh, const GWindowInit *pInit) { ((gcontainerVMT *)gh->parent->vmt)->NotifyAdd(gh->parent, gh); #endif - return TRUE; + return gTrue; } void gwinSetWindowManager(struct GWindowManager *gwm) { @@ -448,7 +448,7 @@ void gwinRedraw(GHandle gh) { } #if GWIN_NEED_CONTAINERS - void gwinSetVisible(GHandle gh, bool_t visible) { + void gwinSetVisible(GHandle gh, gBool visible) { if (visible) { // Mark us as visible gh->flags |= GWIN_FLG_VISIBLE; @@ -463,7 +463,7 @@ void gwinRedraw(GHandle gh) { TriggerRedraw(); } #else - void gwinSetVisible(GHandle gh, bool_t visible) { + void gwinSetVisible(GHandle gh, gBool visible) { if (visible) { if (!(gh->flags & GWIN_FLG_VISIBLE)) { gh->flags |= (GWIN_FLG_VISIBLE|GWIN_FLG_SYSVISIBLE|GWIN_FLG_NEEDREDRAW|GWIN_FLG_BGREDRAW); @@ -491,7 +491,7 @@ void gwinRedraw(GHandle gh) { #if GWIN_NEED_CONTAINERS // These two sub-functions set/clear system enable recursively. - void gwinSetEnabled(GHandle gh, bool_t enabled) { + void gwinSetEnabled(GHandle gh, gBool enabled) { if (enabled) { // Mark us as enabled gh->flags |= GWIN_FLG_ENABLED; @@ -530,7 +530,7 @@ void gwinRedraw(GHandle gh) { } } #else - void gwinSetEnabled(GHandle gh, bool_t enabled) { + void gwinSetEnabled(GHandle gh, gBool enabled) { if (enabled) { if (!(gh->flags & GWIN_FLG_ENABLED)) { gh->flags |= (GWIN_FLG_ENABLED|GWIN_FLG_SYSENABLED); @@ -577,7 +577,7 @@ GWindowMinMax gwinGetMinMax(GHandle gh) { return GWIN_NORMAL; } -void gwinRedrawDisplay(GDisplay *g, bool_t preserve) { +void gwinRedrawDisplay(GDisplay *g, gBool preserve) { GHandle gh; for(gh = gwinGetNextWindow(0); gh; gh = gwinGetNextWindow(gh)) { @@ -631,7 +631,7 @@ GHandle gwinGetNextWindow(GHandle gh) { gtimerStop(&FlashTimer); } - void gwinSetFlashing(GHandle gh, bool_t flash) { + void gwinSetFlashing(GHandle gh, gBool flash) { // Start flashing? if (flash) { @@ -642,9 +642,9 @@ GHandle gwinGetNextWindow(GHandle gh) { RedrawPending |= DOREDRAW_FLASHRUNNING; // Ensure we start the timer with flash bit on - _gwinFlashState = FALSE; + _gwinFlashState = gFalse; FlashTimerFn(0); // First flash - gtimerStart(&FlashTimer, FlashTimerFn, 0, TRUE, GWIN_FLASHING_PERIOD); // Subsequent flashes + gtimerStart(&FlashTimer, FlashTimerFn, 0, gTrue, GWIN_FLASHING_PERIOD); // Subsequent flashes } // Stop flashing? @@ -656,7 +656,7 @@ GHandle gwinGetNextWindow(GHandle gh) { } #if GWIN_NEED_WIDGET - const GColorSet *_gwinGetFlashedColor(GWidgetObject *gw, const GColorSet *pcol, bool_t flashOffState) { + const GColorSet *_gwinGetFlashedColor(GWidgetObject *gw, const GColorSet *pcol, gBool flashOffState) { // Does the flashing state affect the current colors? if ((gw->g.flags & GWIN_FLG_FLASHING) && _gwinFlashState) { @@ -688,7 +688,7 @@ GHandle gwinGetNextWindow(GHandle gh) { static void WM_Init(void); static void WM_DeInit(void); -static bool_t WM_Add(GHandle gh, const GWindowInit *pInit); +static gBool WM_Add(GHandle gh, const GWindowInit *pInit); static void WM_Delete(GHandle gh); static void WM_Redraw(GHandle gh); static void WM_Size(GHandle gh, coord_t w, coord_t h); @@ -726,7 +726,7 @@ static void WM_DeInit(void) { // A full window manager would remove any borders etc } -static bool_t WM_Add(GHandle gh, const GWindowInit *pInit) { +static gBool WM_Add(GHandle gh, const GWindowInit *pInit) { // Note the window will not currently be marked as visible // Put it on the end of the queue @@ -737,7 +737,7 @@ static bool_t WM_Add(GHandle gh, const GWindowInit *pInit) { gh->x = gh->y = 0; WM_Move(gh, pInit->x, pInit->y); WM_Size(gh, pInit->width, pInit->height); - return TRUE; + return gTrue; } static void WM_Delete(GHandle gh) { @@ -860,7 +860,7 @@ static void WM_Size(GHandle gh, coord_t w, coord_t h) { } else { // We need to make this window invisible and ensure that has been drawn - gwinSetVisible(gh, FALSE); + gwinSetVisible(gh, gFalse); _gwinFlushRedraws(REDRAW_WAIT); // Resize @@ -878,7 +878,7 @@ static void WM_Size(GHandle gh, coord_t w, coord_t h) { #endif // Mark it visible again in its new location - gwinSetVisible(gh, TRUE); + gwinSetVisible(gh, gTrue); } } else { gh->width = w; gh->height = h; @@ -941,7 +941,7 @@ static void WM_Move(GHandle gh, coord_t x, coord_t y) { // Clear the old area and then redraw if ((gh->flags & GWIN_FLG_SYSVISIBLE)) { // We need to make this window invisible and ensure that has been drawn - gwinSetVisible(gh, FALSE); + gwinSetVisible(gh, gFalse); _gwinFlushRedraws(REDRAW_WAIT); // Do the move @@ -959,7 +959,7 @@ static void WM_Move(GHandle gh, coord_t x, coord_t y) { } #endif - gwinSetVisible(gh, TRUE); + gwinSetVisible(gh, gTrue); } else { u = gh->x; gh->x = x; v = gh->y; gh->y = y; @@ -996,13 +996,13 @@ static void WM_Raise(GHandle gh) { if ((gh->flags & GWIN_FLG_CONTAINER)) { GHandle gx; GHandle child; - bool_t restart; + gBool restart; // Raise the children too // Note: Children can also have their own children so after each move we have to start again. for (gx = gwinGetNextWindow(0); gx; gx = gwinGetNextWindow(gx)) { if ((gx->flags & GWIN_FLG_CONTAINER)) { - restart = FALSE; + restart = gFalse; for (child = gwinGetNextWindow(0); child && child != gx; child = gwinGetNextWindow(child)) { if (child->parent == gx) { // Oops - this child is behind its parent. Move it to the front. @@ -1012,7 +1012,7 @@ static void WM_Raise(GHandle gh) { // Restart at the front of the list for this parent container as we have moved this child // to the end of the list. We also need to restart everything once this container is done. child = 0; - restart = TRUE; + restart = gTrue; } } if (restart) -- cgit v1.2.3