New simplified gwin using a pseudo class structure.

ugfx_release_2.6
inmarket 2013-06-06 14:33:32 +10:00
parent eebecad9f7
commit 7baf5c5d44
20 changed files with 1651 additions and 1319 deletions

View File

@ -0,0 +1,65 @@
/*
* This file has a different license to the rest of the GFX system.
* You can copy, modify and distribute this file as you see fit.
* You do not need to publish your source modifications to this file.
* The only thing you are not permitted to do is to relicense it
* under a different license.
*/
#ifndef _GFXCONF_H
#define _GFXCONF_H
#define GFX_USE_OS_CHIBIOS TRUE
//#define GFX_USE_OS_WIN32 TRUE
//#define GFX_USE_OS_POSIX TRUE
/* GFX sub-systems to turn on */
#define GFX_USE_GDISP TRUE
#define GFX_USE_GWIN TRUE
#define GFX_USE_GEVENT TRUE
#define GFX_USE_GTIMER TRUE
#define GFX_USE_GINPUT TRUE
/* Features for the GDISP sub-system. */
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE
#define GDISP_NEED_TEXT TRUE
#define GDISP_NEED_CIRCLE TRUE
#define GDISP_NEED_ELLIPSE TRUE
#define GDISP_NEED_ARC TRUE
#define GDISP_NEED_CONVEX_POLYGON TRUE
#define GDISP_NEED_SCROLL FALSE
#define GDISP_NEED_PIXELREAD FALSE
#define GDISP_NEED_CONTROL FALSE
#define GDISP_NEED_IMAGE TRUE
#define GDISP_NEED_MULTITHREAD TRUE
#define GDISP_NEED_ASYNC FALSE
#define GDISP_NEED_MSGAPI FALSE
/* Builtin Fonts */
#define GDISP_INCLUDE_FONT_SMALL FALSE
#define GDISP_INCLUDE_FONT_LARGER FALSE
#define GDISP_INCLUDE_FONT_UI1 FALSE
#define GDISP_INCLUDE_FONT_UI2 TRUE
#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
/* GDISP image decoders */
#define GDISP_NEED_IMAGE_NATIVE FALSE
#define GDISP_NEED_IMAGE_GIF TRUE
#define GDISP_NEED_IMAGE_BMP FALSE
#define GDISP_NEED_IMAGE_JPG FALSE
#define GDISP_NEED_IMAGE_PNG FALSE
/* Features for the GWIN sub-system. */
#define GWIN_NEED_CONSOLE TRUE
#define GWIN_NEED_GRAPH FALSE
#define GWIN_NEED_BUTTON TRUE
#define GWIN_NEED_SLIDER TRUE
#define GWIN_NEED_CHECKBOX TRUE
/* Features for the GINPUT sub-system. */
#define GINPUT_NEED_MOUSE TRUE
#define GINPUT_NEED_TOGGLE FALSE
#define GINPUT_NEED_DIAL FALSE
#endif /* _GFXCONF_H */

View File

@ -0,0 +1,141 @@
/*
ChibiOS/GFX - Copyright (C) 2012, 2013
Joel Bodenmann aka Tectu <joel@unormal.org>
This file is part of ChibiOS/GFX.
ChibiOS/GFX is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
ChibiOS/GFX is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gfx.h"
static GListener gl;
static GHandle ghConsole;
static GHandle ghButton1, ghButton2, ghButton3, ghButton4;
static GHandle ghSlider1, ghSlider2, ghSlider3, ghSlider4;
static GHandle ghCheckbox1, ghCheckbox2;
#define ScrWidth gdispGetWidth()
#define ScrHeight gdispGetHeight()
#define BUTTON_WIDTH 50
#define BUTTON_HEIGHT 30
#define SLIDER_WIDTH 10
#define CHECKBOX_WIDTH 80
#define CHECKBOX_HEIGHT 20
int main(void) {
GEvent * pe;
// Initialize the display
gfxInit();
gdispClear(White);
// Set the font
gwinSetDefaultFont(gdispOpenFont("UI2"));
// Create out gwin windows/widgets
ghButton1 = gwinCreateButton(NULL, 0+0*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT);
ghButton2 = gwinCreateButton(NULL, 0+1*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT);
ghButton3 = gwinCreateButton(NULL, 0+2*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT);
ghButton4 = gwinCreateButton(NULL, 0+3*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT);
ghConsole = gwinCreateConsole(NULL, ScrWidth/2+1, ScrHeight/2+1, ScrWidth/2-1, ScrHeight/2-1);
ghSlider1 = gwinCreateSlider(NULL, ScrWidth/2+1, ScrHeight/2-2*(SLIDER_WIDTH+1), ScrWidth/2-2, SLIDER_WIDTH);
ghSlider2 = gwinCreateSlider(NULL, ScrWidth/2+1, ScrHeight/2-1*(SLIDER_WIDTH+1), ScrWidth/2-2, SLIDER_WIDTH);
ghSlider3 = gwinCreateSlider(NULL, 0+1*(SLIDER_WIDTH+1), ScrHeight/2+1, SLIDER_WIDTH, ScrHeight/2-2);
ghSlider4 = gwinCreateSlider(NULL, 0+1*(SLIDER_WIDTH+1), ScrHeight/2+1, SLIDER_WIDTH, ScrHeight/2-2);
ghCheckbox1 = gwinCreateCheckbox(NULL, 0, BUTTON_HEIGHT+1, CHECKBOX_WIDTH, CHECKBOX_HEIGHT);
ghCheckbox2 = gwinCreateCheckbox(NULL, 0, BUTTON_HEIGHT+1+1*(CHECKBOX_HEIGHT+1), CHECKBOX_WIDTH, CHECKBOX_HEIGHT);
// Color everything
gwinSetColor(ghConsole, Yellow);
gwinSetBgColor(ghConsole, Black);
// Set the text on all the controls
gwinSetText(ghButton1, "B1", FALSE);
gwinSetText(ghButton2, "B2", FALSE);
gwinSetText(ghButton3, "B3", FALSE);
gwinSetText(ghButton4, "B4", FALSE);
gwinSetText(ghSlider1, "S1", FALSE);
gwinSetText(ghSlider2, "S2", FALSE);
gwinSetText(ghSlider3, "S3", FALSE);
gwinSetText(ghSlider4, "S4", FALSE);
gwinSetText(ghCheckbox1, "C1", FALSE);
gwinSetText(ghCheckbox2, "C2", FALSE);
// Assign the mouse and dials to the buttons & sliders etc.
#if GINPUT_NEED_MOUSE
gwinAttachMouse(ghSlider1, 0);
gwinAttachMouse(ghSlider2, 0);
gwinAttachMouse(ghSlider3, 0);
gwinAttachMouse(ghSlider4, 0);
gwinAttachMouse(ghButton1, 0);
gwinAttachMouse(ghButton2, 0);
gwinAttachMouse(ghButton3, 0);
gwinAttachMouse(ghButton4, 0);
gwinAttachMouse(ghCheckbox1, 0);
gwinAttachMouse(ghCheckbox2, 0);
#endif
#if GINPUT_NEED_DIAL
gwinAttachSliderDial(ghSlider1, 0);
gwinAttachSliderDial(ghSlider3, 1);
#endif
// We want to listen for widget events
geventListenerInit(&gl);
gwinAttachListener(ghSlider1, &gl, 0);
gwinAttachListener(ghSlider2, &gl, 0);
gwinAttachListener(ghSlider3, &gl, 0);
gwinAttachListener(ghSlider4, &gl, 0);
gwinAttachListener(ghButton1, &gl, 0);
gwinAttachListener(ghButton2, &gl, 0);
gwinAttachListener(ghButton3, &gl, 0);
gwinAttachListener(ghButton4, &gl, 0);
gwinAttachListener(ghCheckbox1, &gl, 0);
gwinAttachListener(ghCheckbox2, &gl, 0);
// Draw everything on the screen
gwinClear(ghConsole);
gwinDraw(ghSlider1);
gwinDraw(ghSlider2);
gwinDraw(ghSlider3);
gwinDraw(ghSlider4);
gwinDraw(ghButton1);
gwinDraw(ghButton2);
gwinDraw(ghButton3);
gwinDraw(ghButton4);
gwinDraw(ghCheckbox1);
gwinDraw(ghCheckbox2);
while(1) {
// Get an Event
pe = geventEventWait(&gl, TIME_INFINITE);
switch(pe->type) {
case GEVENT_GWIN_BUTTON:
gwinPrintf(ghConsole, "Button %s\n", gwinGetText(((GEventGWinButton *)pe)->button));
break;
case GEVENT_GWIN_SLIDER:
gwinPrintf(ghConsole, "Slider %s=%d\n", gwinGetText(((GEventGWinSlider *)pe)->slider), ((GEventGWinSlider *)pe)->position);
break;
case GEVENT_GWIN_CHECKBOX:
gwinPrintf(ghConsole, "Checkbox %s=%s\n", gwinGetText(((GEventGWinCheckbox *)pe)->checkbox), ((GEventGWinCheckbox *)pe)->isChecked ? "Checked" : "UnChecked");
break;
default:
gwinPrintf(ghConsole, "Unknown %d\n", pe->type);
break;
}
}
return 0;
}

View File

@ -0,0 +1,6 @@
This demo supports input from both a mouse/touch and/or a dial input.
If your platform does not support one or the other, turn it off in
gfxconf.h
Note that you will need to include the drivers into your project
makefile for whichever inputs you decide to use.

View File

@ -24,240 +24,132 @@
#ifndef _GWIN_BUTTON_H
#define _GWIN_BUTTON_H
#if GWIN_NEED_BUTTON || defined(__DOXYGEN__)
/* This file is included within "gwin/gwidget.h" */
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
#define GW_BUTTON 0x0002
/**
* @brief The Event Type for a Button Event
*/
#define GEVENT_GWIN_BUTTON (GEVENT_GWIN_FIRST+0)
/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
typedef struct GEventGWinButton_t {
/**
* @brief A Button Event
* @note There are currently no GEventGWinButton listening flags - use 0 as the flags to @p gwinAttachListener()
*/
typedef struct GEventGWinButton {
GEventType type; // The type of this event (GEVENT_GWIN_BUTTON)
GHandle button; // The button that has been depressed (actually triggered on release)
} GEventGWinButton;
// There are currently no GEventGWinButton listening flags - use 0
typedef enum GButtonShape_e {
GBTN_3D, GBTN_SQUARE, GBTN_ROUNDED, GBTN_ELLIPSE, GBTN_CUSTOM,
GBTN_ARROW_UP, GBTN_ARROW_DOWN, GBTN_ARROW_LEFT, GBTN_ARROW_RIGHT,
} GButtonShape;
typedef struct GButtonDrawStyle_t {
/**
* @brief Button colors
*/
typedef struct GButtonColors {
color_t color_edge;
color_t color_fill;
color_t color_txt;
} GButtonDrawStyle;
} GButtonColors;
typedef enum GButtonType_e {
GBTN_NORMAL, GBTN_TOGGLE
} GButtonType;
typedef enum GButtonState_e {
GBTN_UP, GBTN_DOWN
} GButtonState;
typedef void (*GButtonDrawFunction)(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param);
// A button window
/**
* @brief The button widget structure
* @note Do not use the members directly - treat it as a black-box.
*/
typedef struct GButtonObject_t {
GWindowObject gwin;
GButtonDrawStyle up;
GButtonDrawStyle dn;
GButtonState state;
GButtonType type;
const char *txt;
GButtonDrawFunction fn;
void *param;
GListener listener;
GWidgetObject w;
GButtonColors c_up;
GButtonColors c_dn;
GButtonColors c_dis;
} GButtonObject;
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Create a button window.
* @brief Create a button widget.
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] gb The GButtonObject structure to initialise. If this is NULL the structure is dynamically allocated.
* @param[in] x,y The screen co-ordinates for the bottom left corner of the window
* @param[in] x,y The screen co-ordinates for the top left corner of the window
* @param[in] width The width of the window
* @param[in] height The height of the window
* @param[in] font The font to use
* @param[in] type The type of button
*
* @note The drawing color gets set to White and the background drawing color to Black.
* @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont()
* @note The dimensions and position may be changed to fit on the real screen.
* @note The button is not automatically drawn. Call gwinButtonDraw() after changing the button style or setting the text.
* @note The button is not automatically drawn. Call gwinDraw() to draw it.
*
* @api
*/
GHandle gwinCreateButton(GButtonObject *gb, coord_t x, coord_t y, coord_t width, coord_t height, font_t font, GButtonType type);
GHandle gwinCreateButton(GButtonObject *gb, coord_t x, coord_t y, coord_t width, coord_t height);
/**
* @brief Set the style of a button.
* @details The button style is defined by its shape and colours.
* @brief Set the colors of a button.
*
* @param[in] gh The window handle (must be a button window)
* @param[in] shape The shape of the button.
* @param[in] pUp The styling for the button when in the up state.
* @param[in] pDown The styling for the button when in the down state.
* @param[in] gh The window handle (must be a button widget)
* @param[in] pUp The colors for the button when in the up state.
* @param[in] pDown The colors for the button when in the down state.
* @param[in] pDisabled The colors for the button when it is disabled.
*
* @note The button is not automatically redrawn. Call gwinButtonDraw() after changing the button style
* @note The button style is copied into the internal button structure - there is no need to
* maintain a static style structures.
* @note The pUp and pDown parameters can be NULL. If they are then the existing color styles
* maintain static style structures (they can be temporary structures on the stack).
* @note The pUp, pDown and pDisabled parameters can be NULL. If they are then the existing color styles
* are not changed for that button state.
* @note Some custom drawn buttons will ignore he specified colors
*
* @api
*/
void gwinSetButtonStyle(GHandle gh, GButtonShape shape, const GButtonDrawStyle *pUp, const GButtonDrawStyle *pDown);
void gwinSetButtonColors(GHandle gh, const GButtonColors *pUp, const GButtonColors *pDown, const GButtonColors *pDisabled);
/**
* @brief Set the text of a button.
* @brief Is the button current pressed
* @return TRUE if the button is depressed
*
* @param[in] gh The window handle (must be a button window)
* @param[in] txt The button 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.
* @note The button is not automatically redrawn. Call gwinButtonDraw() after changing the button text.
* @param[in] gh The window handle (must be a button widget)
*
* @api
*/
void gwinSetButtonText(GHandle gh, const char *txt, bool_t useAlloc);
bool_t gwinIsButtonPressed(GHandle gh);
/**
* @brief Redraw the button.
* @brief Some custom button drawing routines
* @details These function may be passed to @p gwinSetCustomDraw() to get different button drawing styles
*
* @param[in] gh The window handle (must be a button window)
*
* @api
*/
void gwinButtonDraw(GHandle gh);
/**
* @brief Enable or disable a button
*
* @param[in] gh The window handle (must be a button window)
* @param[in] enabled Enable or disable the button
*
* @api
*/
void gwinButtonSetEnabled(GHandle gh, bool_t enabled);
/**
* @brief Set the callback routine to perform a custom button drawing.
*
* @param[in] gh The window handle (must be a button window)
* @param[in] fn The function to use to draw the button
* @param[in] param A parameter to pass to the button drawing function
*
* @api
*/
void gwinSetButtonCustom(GHandle gh, GButtonDrawFunction fn, void *param);
/**
* @brief Enable a button
*
* @api
*/
#define gwinEnableButton(gh) gwinButtonSetEnabled( ((GButtonObject *)(gh)), TRUE)
/**
* @brief Disable a button
*
* @api
*/
#define gwinDisableButton(gh) gwinButtonSetEnabled( ((GButtonObject *)(gh)), FALSE)
/**
* @brief Get the state of a button
*
* @param[in] gh The window handle (must be a button window)
*
* @api
*/
#define gwinGetButtonState(gh) (((GButtonObject *)(gh))->state)
/**
* @brief Get the source handle of a button
* @details Get the source handle of a button so the application can listen for events
*
* @param[in] gh The window handle
*
* @api
*/
#define gwinGetButtonSource(gh) ((GSourceHandle)(gh))
#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
/**
* @brief Attach a mouse to a button
*
* @param[in] gh The button handle
* @param[in] instance The mouse instance
*
* @api
*/
bool_t gwinAttachButtonMouse(GHandle gh, uint16_t instance);
#endif
#if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE
/**
* @brief Attach a toggle to a button
*
* @param[in] gh The button handle
* @param[in] instance The toggle instance
*
* @api
*/
bool_t gwinAttachButtonToggle(GHandle gh, uint16_t instance);
#endif
/**
* @brief Standard button drawing routines
* @details These routines are called to draw the standard button styles.
*
* @param[in] gh The button handle
* @param[in] enabled Is the button currently enabled or disabled
* @param[in] isdown Is the button currently down (depressed)
* @param[in] txt The text to be display inside the button
* @param[in] pstyle The current drawing style for the state we are in
* @param[in] gw The widget object (in this case a button)
* @param[in] param A parameter passed in from the user
*
* @note In your custom button drawing function you may optionally call these
* standard functions and then draw your extra details on top.
* @note The standard functions below ignore the param parameter. It is there
* only to ensure the functions match the GButtonDrawFunction type.
* @note When called by a button press/release the framework ensure that it is
* a button object and sets up clipping to the button object window. These
* drawing routines then don't have to worry about explicitly doing that.
* @note The standard functions below ignore the param parameter except for @p gwinButtonDraw_Image().
* @note The image custom draw function @p gwinButtonDraw_Image() uses param to pass in the gdispImage pointer.
* The image must be already opened before calling @p gwinSetCustomDraw(). The image should be 3
* times the height of the button. The button image is repeated 3 times vertically, the first (top) for
* the "up" image, the 2nd for the "down" image, and the third (bottom) image for the disabled state. If
* the disabled state is never going to be used then the image can be just 2 times the button height.
* No checking is done to compare the size of the button to the size of the image.
* Note text is drawn on top of the image.
* @note These custom drawing routines don't have to worry about setting clipping as the framework
* sets clipping to the object window prior to calling these routines.
*
* @api
* @{
*/
void gwinButtonDraw_3D(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param);
void gwinButtonDraw_Square(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param);
void gwinButtonDraw_3D(GWidgetObject *gw, void *param); // @< A standard 3D button
void gwinButtonDraw_Box(GWidgetObject *gw, void *param); // @< A very simple box style button
#if GDISP_NEED_ARC || defined(__DOXYGEN__)
void gwinButtonDraw_Rounded(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param);
void gwinButtonDraw_Rounded(GWidgetObject *gw, void *param); // @< A rounded rectangle button
#endif
#if GDISP_NEED_ELLIPSE || defined(__DOXYGEN__)
void gwinButtonDraw_Ellipse(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param);
void gwinButtonDraw_Ellipse(GWidgetObject *gw, void *param); // @< A circular button
#endif
#if GDISP_NEED_CONVEX_POLYGON || defined(__DOXYGEN__)
void gwinButtonDraw_ArrowUp(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param);
void gwinButtonDraw_ArrowDown(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param);
void gwinButtonDraw_ArrowLeft(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param);
void gwinButtonDraw_ArrowRight(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param);
void gwinButtonDraw_ArrowUp(GWidgetObject *gw, void *param); // @< An up arrow button
void gwinButtonDraw_ArrowDown(GWidgetObject *gw, void *param); // @< A down arrow button
void gwinButtonDraw_ArrowLeft(GWidgetObject *gw, void *param); // @< A left arrow button
void gwinButtonDraw_ArrowRight(GWidgetObject *gw, void *param); // @< A right arrow button
#endif
#if GDISP_NEED_IMAGE || defined(__DOXYGEN__)
void gwinButtonDraw_Image(GWidgetObject *gw, void *param); // @< An image button - see the notes above on the param.
#endif
/** @} */
@ -265,8 +157,6 @@ void gwinButtonDraw_Square(GHandle gh, bool_t enabled, bool_t isdown, const char
}
#endif
#endif /* GWIN_NEED_BUTTON */
#endif /* _GWIN_BUTTON_H */
/** @} */

View File

@ -12,7 +12,7 @@
* @defgroup Checkbox Checkbox
* @ingroup GWIN
*
* @details GWIN allows it to easily create checkboxes.
* @details GWIN allows it to easily create a group of checkbox buttons.
*
* @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h
* @pre GWIN_NEED_CHECKBOX must be set to TRUE in your gfxconf.h
@ -22,13 +22,12 @@
#ifndef _GWIN_CHECKBOX_H
#define _GWIN_CHECKBOX_H
#if GWIN_NEED_CHECKBOX || defined(__DOXYGEN__)
/* This file is included within "gwin/gwidget.h" */
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
#define GW_CHECKBOX 0x0005
#define GEVENT_GWIN_CHECKBOX (GEVENT_GWIN_FIRST+2)
/*===========================================================================*/
@ -41,124 +40,76 @@ typedef struct GEventGWinCheckbox_t {
bool_t isChecked; // Is the checkbox currently checked or unchecked?
} GEventGWinCheckbox;
typedef enum GCheckboxState_e {
GCHBX_UNCHECKED, GCHBX_CHECKED
} GCheckboxState;
typedef struct GCheckboxColor_t {
color_t border;
color_t checked;
color_t bg;
} GCheckboxColor;
/* custom rendering interface */
typedef void (*GCheckboxDrawFunction)(GHandle gh, bool_t enabled, bool_t state, void* param);
typedef struct GCheckboxColors {
color_t color_border;
color_t color_checked;
color_t color_bg;
color_t color_txt;
} GCheckboxColors;
/* A Checkbox window */
typedef struct GCheckboxObject_t {
GWindowObject gwin;
GListener listener;
GCheckboxDrawFunction fn;
GCheckboxColor *colors;
bool_t isChecked;
void *param;
GWidgetObject w;
GCheckboxColors c;
} GCheckboxObject;
/**
* @brief Create a checkbox window.
* @brief Create a checkbox window.
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] gb The GCheckboxObject structure to initialise. If this is NULL, the structure is dynamically allocated.
* @param[in] x,y The screen co-ordinates for the bottom left corner of the window
* @param[in] x,y The screen co-ordinates for the top left corner of the window
* @param[in] width The width of the window
* @param[in] height The height of the window
*
* @note The checkbox is not automatically drawn. Call gwinCheckboxDraw() after changing the checkbox style.
*
* @return NULL if there is no resultant drawing area, otherwise a window handle.
* @note The drawing color gets set to White and the background drawing color to Black.
* @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont()
* @note The dimensions and position may be changed to fit on the real screen.
* @note The checkbox is not automatically drawn. Call gwinDraw() to draw it.
*
* @api
*/
GHandle gwinCheckboxCreate(GCheckboxObject *gb, coord_t x, coord_t y, coord_t width, coord_t height);
/**
* @brief Redraw a checkbox
*
* @param[in] gh The window handle (must be a checkbox window)
*
* @api
*/
void gwinCheckboxDraw(GHandle gh);
/**
* @brief Enable or disable a button
*
* @param[in] gh The window handle (must be a checkbox window)
* @param[in] enabled Enable or disable the button
*
* @api
*/
void gwinCheckboxSetEnabled(GHandle gh, bool_t enabled);
/**
* @brief Set the callback routine to perform a custom drawing.
*
* @param[in] gh The window handle (must be a checkbox window)
* @param[in] fn The function to use to draw the checkbox
* @param[in] param A parameter to pass to the checkbox drawing function
*
* @api
*/
void gwinCheckboxSetCustom(GHandle gh, GCheckboxDrawFunction fn, void *param);
/**
* @brief Enable a checkbox
*
* @api
*/
#define gwinCheckboxEnable(gh) gwinCheckboxSetEnabled( ((GCheckboxObject *)(gh)), TRUE)
/**
* @brief Disable a checkbox
*
* @api
*/
#define gwinCheckboxDisable(gh) gwinCheckboxSetEnabled( ((GCheckboxObject *)(gh)), FALSE)
GHandle gwinCreateCheckbox(GCheckboxObject *gb, coord_t x, coord_t y, coord_t width, coord_t height);
/**
* @brief Get the state of a checkbox
* @return TRUE if the checkbox is currently checked
*
* @param[in] gh The window handle (must be a checkbox window)
*
* @return The state of the checkbox (GCHBX_CHECKED or GCHBX_UNCHECKED)
*
* @api
*/
#define gwinCheckboxGetState(gh) (((GCheckboxObject *)(gh))->isChecked)
bool_t gwinIsCheckboxChecked(GHandle gh);
/**
* @brief Get the source handle of a checkbox
* @details Get the source handle of a checkbox so the application can listen for events
* @brief Set the colors used to draw the checkbox
*
* @param[in] gh The window handle (must be a checkbox window)
* @param[in] gh The window handle (must be a checkbox window)
* @param[in] pColors The colors to use
*
* @api
*/
#define gwinCheckboxGetSource(gh) ((GSourceHandle)(gh))
void gwinCheckboxSetColors(GHandle gh, GCheckboxColors *pColors);
#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
/**
* @brief Attach a mouse to a checkbox
*
* @param[in] gh The checkbox handle
* @param[in] instance The mouse instance
*
* @api
*/
bool_t gwinCheckboxAttachMouse(GHandle gh, uint16_t instance);
#endif /* GFX_USE_GINPUT && GINPUT_NEED_MOUSE */
#endif /* _GWIN_NEED_CHECKBOX */
/**
* @brief Some custom checkbox drawing routines
* @details These function may be passed to @p gwinSetCustomDraw() to get different checkbox drawing styles
*
* @param[in] gw The widget (which must be a checkbox)
* @param[in] param A parameter passed in from the user
*
* @note In your custom checkbox drawing function you may optionally call this
* standard functions and then draw your extra details on top.
* @note The standard functions below ignore the param parameter.
* @note These custom drawing routines don't have to worry about setting clipping as the framework
* sets clipping to the object window prior to calling these routines.
*
* @api
* @{
*/
void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param);
void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param);
/* @} */
#endif /* _GWIN_CHECKBOX_H */
/** @} */

View File

@ -0,0 +1,123 @@
/*
* This file is subject to the terms of the GFX License, v1.0. If a copy of
* the license was not distributed with this file, you can obtain one at:
*
* http://chibios-gfx.com/license.html
*/
/**
* @file include/gwin/class_gwin.h
* @brief GWIN Graphic window subsystem header file.
*
* @defgroup Internal Internal
* @ingroup GWIN
*
* @note These definitions are normally not used by an application program. They are useful
* only if you want to create your own custom GWIN window or widget.
* @note To access these definitions you must include "gwin/class_gwin.h" in your source file.
*
* @{
*/
#ifndef _CLASS_GWIN_H
#define _CLASS_GWIN_H
#if GFX_USE_GWIN || defined(__DOXYGEN__)
/**
* @brief The Virtual Method Table for a GWIN window
* @{
*/
typedef struct gwinVMT {
const char *classname; // @< The GWIN classname
void (*Destroy)(GWindowObject *gh); // @< The GWIN Destroy function (optional)
void (*AfterClear)(GWindowObject *gh); // @< The GWIN After-Clear function (optional)
} gwinVMT;
/* @} */
/**
* @brief The Virtual Method Table for a widget
* @note A widget must have a destroy function. Either use @p _gwidgetDestroy() or use your own function
* which internally calls @p _gwidgetDestroy().
* @note If no MouseDown(), MouseUp() or MouseMove() function is provided, the widget will not accept being attached to a mouse input source.
* @note If no ToggleOn() or ToggleOff() function is provided, the widget will not accept being attached to a toggle input source.
* @note If no DialMove() function is provided, the widget will not accept being attached to a dial input source.
* @note AssignToggle() and AssignDial() enable a widget to handle more than one toggle/dial device attached to the widget.
* For example, a slider might accept two toggles, one for slider-down and one for slider-up.
* The function enables the widget to record that a particular device instance performs each particular role.
* (eg toggle0 = slider-down, toggle1 = slider-up).
* @{
*/
typedef struct gwidgetVMT {
struct gwinVMT g; // @< This is still a GWIN
void (*DefaultDraw) (GWidgetObject *gw, void *param); // @< The default drawing routine (mandatory)
void (*MouseDown) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse down events (optional)
void (*MouseUp) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse up events (optional)
void (*MouseMove) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse move events (optional)
void (*ToggleOff) (GWidgetObject *gw, uint16_t instance); // @< Process toggle off events (optional)
void (*ToggleOn) (GWidgetObject *gw, uint16_t instance); // @< Process toggle on events (optional)
void (*DialMove) (GWidgetObject *gw, uint16_t instance, uint16_t value); // @< Process dial move events (optional)
void (*AllEvents) (GWidgetObject *gw, GEvent *pe); // @< Process all events (optional)
bool_t (*AssignToggle) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the toggle instance handle (optional)
bool_t (*AssignDial) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the dial instance handle (optional)
} gwidgetVMT;
/* @} */
/**
* @brief The predefined flags for a GWIN and a Widget
* @{
*/
#define GWIN_FLG_DYNAMIC 0x0001 // @< The GWIN structure is allocated
#define GWIN_FLG_WIDGET 0x0002 // @< This is a widget
#define GWIN_FLG_ENABLED 0x0002 // @< The widget is enabled
#define GWIN_FLG_ALLOCTXT 0x0008 // @< The widget text is allocated
#define GWIN_FLG_MOUSECAPTURE 0x0010 // @< The widget has captured the mouse
#define GWIN_FIRST_CONTROL_FLAG 0x0100 // @< Free for GWINs and Widgets to use
/* @} */
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Initialise (and allocate if necessary) the base GWIN object
*
* @param[in] pgw The GWindowObject structure. If NULL one is allocated from the heap
* @param[in] x, y The top left corner of the GWIN relative to the screen
* @param[in] w, h The width and height of the GWIN window
* @param[in] size The size of the GWIN object to allocate
* @param[in] vmt The virtual method table for the GWIN object
*
* @notapi
*/
GHandle _gwinInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwinVMT *vmt);
/**
* @brief Initialise (and allocate if necessary) the base Widget object
*
* @param[in] pgw The GWidgetObject structure. If NULL one is allocated from the heap
* @param[in] x, y The top left corner of the Widget relative to the screen
* @param[in] w, h The width and height of the Widget window
* @param[in] size The size of the Widget object to allocate
* @param[in] vmt The virtual method table for the Widget object
*
* @notapi
*/
GHandle _gwidgetInit(GWidgetObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwidgetVMT *vmt);
/**
* @brief Destroy the Widget object
*
* @param[in] gw The widget to destroy
*
* @notapi
*/
void _gwidgetDestroy(GHandle gh);
#ifdef __cplusplus
}
#endif
#endif /* GFX_USE_GWIN */
#endif /* _CLASS_GWIN_H */
/** @} */

View File

@ -24,22 +24,13 @@
#ifndef _GWIN_CONSOLE_H
#define _GWIN_CONSOLE_H
#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
#define GW_CONSOLE 0x0001
/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
/* This file is included within "gwin/gwin.h" */
// A console window. Supports wrapped text writing and a cursor.
typedef struct GConsoleObject_t {
GWindowObject gwin;
GWindowObject g;
coord_t cx, cy; // Cursor position
#if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM
struct GConsoleWindowStream_t {
const struct GConsoleWindowVMT_t *vmt;
@ -47,15 +38,8 @@ typedef struct GConsoleObject_t {
} stream;
#endif
coord_t cx,cy; // Cursor position
uint8_t fy; // Current font height
uint8_t fp; // Current font inter-character spacing
} GConsoleObject;
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#ifdef __cplusplus
extern "C" {
#endif
@ -67,18 +51,19 @@ extern "C" {
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] gc The GConsoleObject structure to initialise. If this is NULL the structure is dynamically allocated.
* @param[in] x,y The screen co-ordinates for the bottom left corner of the window
* @param[in] x,y The screen co-ordinates for the top left corner of the window
* @param[in] width The width of the window
* @param[in] height The height of the window
* @param[in] font The font to use
*
* @note The console is not automatically cleared on creation. You must do that by calling gwinClear() (possibly after changing your background color)
* @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont()
* @note If the dispay does not support scrolling, the window will be cleared when the bottom line is reached.
* @note The default drawing color gets set to White and the background drawing color to Black.
* @note The dimensions and position may be changed to fit on the real screen.
*
* @api
*/
GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height, font_t font);
GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height);
#if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM
/**
@ -157,7 +142,5 @@ void gwinPrintf(GHandle gh, const char *fmt, ...);
}
#endif
#endif /* GWIN_NEED_CONSOLE */
#endif /* _GWIN_CONSOLE_H */
/** @} */

View File

@ -22,20 +22,7 @@
#ifndef _GWIN_GRAPH_H
#define _GWIN_GRAPH_H
#if GWIN_NEED_GRAPH || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
#define GW_GRAPH 0x0003
/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
// GDISP now has its own point structure
#define GGraphPoint point
/* This file is included within "gwin/gwin.h" */
typedef enum GGraphPointType_e {
GGRAPH_POINT_NONE, GGRAPH_POINT_DOT, GGRAPH_POINT_SQUARE, GGRAPH_POINT_CIRCLE
@ -85,7 +72,7 @@ typedef struct GGraphStyle_t {
// A graph window
typedef struct GGraphObject_t {
GWindowObject gwin;
GWindowObject g;
GGraphStyle style;
coord_t xorigin, yorigin;
coord_t lastx, lasty;
@ -104,10 +91,12 @@ extern "C" {
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] gg The GGraphObject structure to initialise. If this is NULL the structure is dynamically allocated.
* @param[in] x,y The screen co-ordinates for the bottom left corner of the window
* @param[in] x,y The screen co-ordinates for the top left corner of the window
* @param[in] width The width of the window
* @param[in] height The height of the window
*
* @note The console is not automatically cleared on creation. You must do that by calling gwinClear() (possibly after changing your background color)
* @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont()
* @note The coordinate system within the window for graphing operations (but not for any other drawing
* operation) is relative to the bottom left corner and then shifted right and up by the specified
* graphing x and y origin. Note that this system is inverted in the y direction relative to the display.
@ -187,8 +176,6 @@ void gwinGraphDrawPoints(GHandle gh, const point *points, unsigned count);
}
#endif
#endif /* GWIN_NEED_GRAPH */
#endif /* _GWIN_GRAPH_H */
/** @} */

View File

@ -0,0 +1,234 @@
/*
* This file is subject to the terms of the GFX License, v1.0. If a copy of
* the license was not distributed with this file, you can obtain one at:
*
* http://chibios-gfx.com/license.html
*/
/**
* @file include/gwin/gwidget.h
* @brief GWIN Widgets header file.
*/
#ifndef _GWIDGET_H
#define _GWIDGET_H
/* This file is included within "gwin/gwin.h" */
/**
* @defgroup Widget Widget
* @ingroup GWIN
*
* @details A Widget is a GWindow that supports interacting with the user
* via an input device such as a mouse or toggle buttons. It is the
* base class for widgets such as buttons and sliders.
*
* @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h
* @{
*/
// Forward definition
struct GWidgetObject;
/**
* @brief Defines a custom drawing function for a widget
*/
typedef void (*CustomWidgetDrawFunction)(struct GWidgetObject *gw, void *param);
/**
* @brief The GWIN Widget structure
* @note A widget is a GWIN window that accepts user input.
* It also has a number of other properties such as its ability
* to redraw itself (a widget maintains drawing state).
* @note Do you access the members directly. Treat it as a black-box and use the method functions.
*
* @{
*/
typedef struct GWidgetObject {
GWindowObject g; // @< This is still a GWIN
GListener listener; // @< The widget listener
const char * txt; // @< The widget text
CustomWidgetDrawFunction fnDraw; // @< The current draw function
void * fnParam; // @< A parameter for the current draw function
} GWidgetObject;
/* @} */
/**
* A comment/rant on the above structure:
* We would really like the GWindowObject member to be anonymous. While this is
* allowed under the C11, C99, GNU and various other standards which have been
* around forever - compiler support often requires special flags e.g
* gcc requires the -fms-extensions flag (no wonder the language and compilers have
* not really progressed in 30 years). As portability is a key requirement
* we unfortunately won't use this useful feature in case we get a compiler that
* won't support it even with special flags.
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Enable or disable a widget
*
* @param[in] gh The widget handle
* @param[in] enabled Enable or disable the widget
*
* @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget.
* @note Non-widgets will ignore this call.
*
* @api
*/
void gwinSetEnabled(GHandle gh, bool_t enabled);
/**
* @brief Enable a widget
*
* @param[in] gh The widget handle
*
* @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget.
* @note Non-widgets will ignore this call.
*
* @api
*/
#define gwinEnable(gh) gwinSetEnabled(gh, TRUE)
/**
* @brief Disable a widget
*
* @param[in] gh The widget handle
*
* @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget.
* @note Non-widgets will ignore this call.
*
* @api
*/
#define gwinDisable(gh) gwinSetEnabled(gh, FALSE)
/**
* @brief Redraw the widget
*
* @param[in] gh The widget handle
*
* @note Non-widgets will ignore this call.
*
* @api
*/
void gwinDraw(GHandle gh);
/**
* @brief Set the text of a widget.
*
* @param[in] gh The widget handle
* @param[in] txt 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.
*
* @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget.
* @note Non-widgets will ignore this call.
*
* @api
*/
void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc);
/**
* @brief Get the text of a widget.
* @return The widget text or NULL if it isn't a widget
*
* @param[in] gh The widget handle
*
* @api
*/
const char *gwinGetText(GHandle gh);
/**
* @brief Set the routine to perform a custom widget drawing.
*
* @param[in] gh The widget handle
* @param[in] fn The function to use to draw the widget
* @param[in] param A parameter to pass to the widget drawing function
*
* @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget.
* @note Non-widgets will ignore this call.
*
* @api
*/
void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param);
/**
* @brief Attach a Listener to this widget
* @return TRUE on success
*
* @param[in] gh The widget handle
* @param[in] pl The listener
* @param[in] flags Flags to use for listening. For most widgets this should be 0.
*
* @api
*/
bool_t gwinAttachListener(GHandle gh, GListener *pl, unsigned flags);
#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE
/**
* @brief Attach a mouse to a widget
* @return TRUE on success
*
* @param[in] gh The widget handle
* @param[in] instance The mouse instance
*
* @api
*/
bool_t gwinAttachMouse(GHandle gh, uint16_t instance);
#endif
#if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE
/**
* @brief Attach a toggle to a widget
* @return TRUE on success
*
* @param[in] gh The widget handle
* @param[in] role The function the toggle will perform for the widget
* @param[in] instance The toggle instance
*
* @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
*
* @api
*/
bool_t gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance);
#endif
#if GFX_USE_GINPUT && GINPUT_NEED_DIAL
/**
* @brief Attach a toggle to a widget
* @return TRUE on success
*
* @param[in] gh The widget handle
* @param[in] role The function the dial will perform for the widget
* @param[in] instance The dial instance
*
* @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
*
* @api
*/
bool_t gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance);
#endif
#ifdef __cplusplus
}
#endif
/* Include extra widget types */
#if GWIN_NEED_BUTTON || defined(__DOXYGEN__)
#include "gwin/button.h"
#endif
#if GWIN_NEED_SLIDER || defined(__DOXYGEN__)
#include "gwin/slider.h"
#endif
#if GWIN_NEED_CHECKBOX || defined(__DOXYGEN__)
#include "gwin/checkbox.h"
#endif
#endif /* _GWIDGET_H */
/** @} */

View File

@ -12,14 +12,12 @@
* @defgroup Window Window
* @ingroup GWIN
*
* @details GWIN provides a basic window manager which allows it to easily
* create and destroy different windows on runtime. Each window
* will have it's own properties such as colors, brushes as well as
* it's own drawing origin.
* Moving the windows around is not supported yet.
* @details GWIN provides a basic window manager which allows it to easily
* create and destroy different windows at runtime. Each window
* will have it's own properties such as colors as well as
* it's own drawing origin.
*
* @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h
*
* @{
*/
@ -30,30 +28,23 @@
#if GFX_USE_GWIN || defined(__DOXYGEN__)
/*===========================================================================*/
/* Type definitions */
/*===========================================================================*/
typedef uint16_t GWindowType;
#define GW_WINDOW 0x0000
#define GW_FIRST_USER_WINDOW 0x8000
// A basic window
typedef struct GWindowObject_t {
GWindowType type; // What type of window is this
uint16_t flags; // Internal flags
coord_t x, y; // Screen relative position
coord_t width, height; // Dimensions of this window
color_t color, bgcolor; // Current drawing colors
bool_t enabled; // Enabled/Disabled state
/**
* @brief A window object structure
* @note Do you access the members directly. Treat it as a black-box and use the method functions.
*
* @{
*/
typedef struct GWindowObject {
const struct gwinVMT *vmt; // @< The VMT for this GWIN
coord_t x, y; // @< Screen relative position
coord_t width, height; // @< Dimensions of this window
color_t color, bgcolor; // @< Current drawing colors
uint16_t flags; // @< Window flags (the meaning is private to the GWIN class)
#if GDISP_NEED_TEXT
font_t font; // Current font
font_t font; // @< Current font
#endif
} GWindowObject, * GHandle;
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
/* @} */
#ifdef __cplusplus
extern "C" {
@ -65,18 +56,20 @@ extern "C" {
* @brief Create a basic window.
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] gw The window structure to initialize. If this is NULL the structure is dynamically allocated.
* @param[in] x,y The screen coordinates for the bottom left corner of the window
* @param[in] pgw The window structure to initialize. If this is NULL the structure is dynamically allocated.
* @param[in] x,y The screen coordinates for the top left corner of the window
* @param[in] width The width of the window
* @param[in] height The height of the window
*
* @note The default drawing color gets set to White and the background drawing color to Black.
* @note No default font is set so make sure to set one before drawing any text.
* @note The dimensions and position may be changed to fit on the real screen.
* @note The window is not automatically cleared on creation. You must do that by calling gwinClear() (possibly after changing your background color)
* @note The window is not automatically cleared on creation. You must do that by calling @p gwinClear()
* (possibly after changing your background color)
*
* @api
*/
GHandle gwinCreateWindow(GWindowObject *gw, coord_t x, coord_t y, coord_t width, coord_t height);
GHandle gwinCreateWindow(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height);
/**
* @brief Destroy a window (of any type). Releases any dynamically allocated memory.
@ -85,17 +78,22 @@ GHandle gwinCreateWindow(GWindowObject *gw, coord_t x, coord_t y, coord_t width,
*
* @api
*/
void gwinDestroyWindow(GHandle gh);
void gwinDestroy(GHandle gh);
/**
* @brief Enable or disable a widget (of any type).
* @brief Get the real class name of the GHandle
* @details Returns a string describing the object class.
*
* @param[in] gh The window handle
* @param[in] enabled Enable or disable the widget
*
* @api
* @param[in] gh The window
*/
void gwinSetEnabled(GHandle gh, bool_t enabled);
const char *gwinGetClassName(GHandle gh);
/**
* @brief Get an ID that uniquely describes the class of the GHandle
*
* @param[in] gh The window
*/
#define gwinGetClassID(gh) ((void *)((gh)->vmt))
/**
* @brief Get the X coordinate of the window
@ -148,23 +146,16 @@ void gwinSetEnabled(GHandle gh, bool_t enabled);
*/
#define gwinSetBgColor(gh, bgclr) (gh)->bgcolor = (bgclr)
/**
* @brief Enable a window of any type
*
* @param[in] gh The window handle
*/
#define gwinEnable(gh) gwinSetEnabled(gh, TRUE)
/**
* @brief Disable a window of any type
*
* @param[in] gh The window handle
*/
#define gwinDisable(gh) gwinSetEnabled(gh, FALSE)
/* Set up for text */
#if GDISP_NEED_TEXT || defined(__DOXYGEN__)
/**
* @brief Set the default font for all new GWIN windows
*
* @param[in] gh The window
*/
void gwinSetDefaultFont(font_t font);
/**
* @brief Set the current font for this window.
*
@ -178,16 +169,6 @@ void gwinSetEnabled(GHandle gh, bool_t enabled);
/* Drawing Functions */
/**
* @brief Draw the window
* @note Redraws the Window if the GWIN object has a draw routine
*
* @param[in] gh The window handle
*
* @api
*/
void gwinDraw(GHandle gh);
/**
* @brief Clear the window
* @note Uses the current background color to clear the window
@ -538,12 +519,16 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
}
#endif
/* Include widgets */
#include "gwin/gwidget.h"
/* Include extra window types */
#include "gwin/console.h" /* 0x0001 */
#include "gwin/button.h" /* 0x0002 */
#include "gwin/graph.h" /* 0x0003 */
#include "gwin/slider.h" /* 0x0004 */
#include "gwin/checkbox.h" /* 0x0005 */
#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__)
#include "gwin/console.h"
#endif
#if GWIN_NEED_GRAPH || defined(__DOXYGEN__)
#include "gwin/graph.h"
#endif
#endif /* GFX_USE_GWIN */