2013-06-02 04:13:28 +00:00
|
|
|
/*
|
2013-06-15 11:09:02 +00:00
|
|
|
* This file is subject to the terms of the GFX License. If a copy of
|
2013-06-02 04:13:28 +00:00
|
|
|
* the license was not distributed with this file, you can obtain one at:
|
|
|
|
*
|
2013-07-21 20:20:37 +00:00
|
|
|
* http://ugfx.org/license.html
|
2013-06-02 04:13:28 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file include/gwin/checkbox.h
|
|
|
|
* @brief GWIN Graphic window subsystem header file.
|
|
|
|
*
|
|
|
|
* @defgroup Checkbox Checkbox
|
|
|
|
* @ingroup GWIN
|
|
|
|
*
|
2013-06-06 04:33:32 +00:00
|
|
|
* @details GWIN allows it to easily create a group of checkbox buttons.
|
2013-06-02 04:13:28 +00:00
|
|
|
*
|
|
|
|
* @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
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GWIN_CHECKBOX_H
|
|
|
|
#define _GWIN_CHECKBOX_H
|
|
|
|
|
2013-06-06 04:33:32 +00:00
|
|
|
/* This file is included within "gwin/gwidget.h" */
|
2013-06-02 04:13:28 +00:00
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver constants. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
#define GEVENT_GWIN_CHECKBOX (GEVENT_GWIN_FIRST+2)
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Type definitions */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
2013-07-07 09:40:37 +00:00
|
|
|
typedef struct GEventGWinCheckbox {
|
2013-06-02 16:52:42 +00:00
|
|
|
GEventType type; // The type of this event (GEVENT_GWIN_CHECKBOX)
|
|
|
|
GHandle checkbox; // The checkbox that has been depressed (actually triggered on release)
|
2013-06-02 16:59:51 +00:00
|
|
|
bool_t isChecked; // Is the checkbox currently checked or unchecked?
|
2013-06-02 04:13:28 +00:00
|
|
|
} GEventGWinCheckbox;
|
|
|
|
|
|
|
|
/* A Checkbox window */
|
2013-07-07 09:40:37 +00:00
|
|
|
typedef struct GCheckboxObject {
|
2013-06-06 04:33:32 +00:00
|
|
|
GWidgetObject w;
|
2013-07-05 15:45:24 +00:00
|
|
|
#if GINPUT_NEED_TOGGLE
|
|
|
|
uint16_t toggle;
|
|
|
|
#endif
|
2013-06-02 04:13:28 +00:00
|
|
|
} GCheckboxObject;
|
|
|
|
|
|
|
|
/**
|
2013-06-06 04:33:32 +00:00
|
|
|
* @brief Create a checkbox window.
|
|
|
|
* @return NULL if there is no resultant drawing area, otherwise a window handle.
|
2013-06-02 04:13:28 +00:00
|
|
|
*
|
2013-10-24 08:36:11 +00:00
|
|
|
* @param[in] g The GDisplay to display this window on
|
2013-06-02 04:13:28 +00:00
|
|
|
* @param[in] gb The GCheckboxObject structure to initialise. If this is NULL, the structure is dynamically allocated.
|
2013-06-24 12:58:37 +00:00
|
|
|
* @param[in] pInit The initialization parameters to use
|
2013-06-02 04:13:28 +00:00
|
|
|
*
|
2013-06-10 07:18:01 +00:00
|
|
|
* @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 White and 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 checkbox remembers its normal drawing state. If there is a window manager then it is automatically
|
|
|
|
* redrawn if the window is moved or its visibility state is changed.
|
|
|
|
* @note A checkbox supports mouse and a toggle input.
|
|
|
|
* @note When assigning a toggle, only one toggle is supported. If you try to assign more than one toggle it will
|
|
|
|
* forget the previous toggle. When assigning a toggle the role parameter must be 0.
|
2013-06-02 04:13:28 +00:00
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
2013-10-24 08:36:11 +00:00
|
|
|
GHandle gwinGCheckboxCreate(GDisplay *g, GCheckboxObject *gb, const GWidgetInit *pInit);
|
|
|
|
#define gwinCheckboxCreate(gb, pInit) gwinGCheckboxCreate(GDISP, gb, pInit)
|
2013-06-02 04:13:28 +00:00
|
|
|
|
|
|
|
/**
|
2013-07-07 09:40:37 +00:00
|
|
|
* @brief Set the state of a checkbox
|
2013-06-02 04:13:28 +00:00
|
|
|
*
|
2013-07-07 09:40:37 +00:00
|
|
|
* @param[in] gh The window handle (must be a checkbox window)
|
|
|
|
* @param[in] isChecked TRUE to set the check, FALSE to uncheck.
|
2013-06-02 04:13:28 +00:00
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
2013-07-07 09:40:37 +00:00
|
|
|
void gwinCheckboxCheck(GHandle gh, bool_t isChecked);
|
2013-06-02 04:13:28 +00:00
|
|
|
|
|
|
|
/**
|
2013-07-07 09:40:37 +00:00
|
|
|
* @brief Get the state of a checkbox
|
|
|
|
* @return TRUE if the checkbox is currently checked
|
2013-06-02 04:13:28 +00:00
|
|
|
*
|
2013-07-07 09:40:37 +00:00
|
|
|
* @param[in] gh The window handle (must be a checkbox window)
|
2013-06-02 04:13:28 +00:00
|
|
|
*
|
|
|
|
* @api
|
|
|
|
*/
|
2013-07-07 09:40:37 +00:00
|
|
|
bool_t gwinCheckboxIsChecked(GHandle gh);
|
2013-06-02 04:13:28 +00:00
|
|
|
|
2013-06-03 15:36:39 +00:00
|
|
|
/**
|
2013-06-06 04:33:32 +00:00
|
|
|
* @brief Some custom checkbox drawing routines
|
|
|
|
* @details These function may be passed to @p gwinSetCustomDraw() to get different checkbox drawing styles
|
2013-06-03 15:36:39 +00:00
|
|
|
*
|
2013-06-06 04:33:32 +00:00
|
|
|
* @param[in] gw The widget (which must be a checkbox)
|
|
|
|
* @param[in] param A parameter passed in from the user
|
2013-06-03 15:36:39 +00:00
|
|
|
*
|
2013-06-06 04:33:32 +00:00
|
|
|
* @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.
|
2013-06-02 04:13:28 +00:00
|
|
|
*
|
|
|
|
* @api
|
2013-06-06 04:33:32 +00:00
|
|
|
* @{
|
2013-06-02 04:13:28 +00:00
|
|
|
*/
|
2013-06-06 04:33:32 +00:00
|
|
|
void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param);
|
|
|
|
void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param);
|
|
|
|
/* @} */
|
2013-06-02 04:13:28 +00:00
|
|
|
|
|
|
|
#endif /* _GWIN_CHECKBOX_H */
|
|
|
|
/** @} */
|
|
|
|
|