13 #include "../../gfx.h"
15 #if (GFX_USE_GWIN && GWIN_NEED_CHECKBOX) || defined(__DOXYGEN__)
17 #include "gwin_class.h"
20 #define CHK_TOP_FADE 50
21 #define CHK_BOTTOM_FADE 25
25 GSourceListener * psl;
27 #define pce ((GEventGWinCheckbox *)pe)
34 pce->type = GEVENT_GWIN_CHECKBOX;
51 SendCheckboxEvent(gw);
55 #if GINPUT_NEED_KEYBOARD || GWIN_NEED_KEYBOARD
56 static void CheckboxKeyboard(
GWidgetObject* gw, GEventKeyboard* pke)
59 if ((pke->keystate & GKEYSTATE_KEYUP))
63 if (pke->c[0] == GKEY_ENTER || pke->c[0] == GKEY_SPACE) {
66 SendCheckboxEvent(gw);
71 #if GINPUT_NEED_TOGGLE
76 SendCheckboxEvent(gw);
79 static void CheckboxToggleAssign(
GWidgetObject *gw, gU16 role, gU16 instance) {
81 ((GCheckboxObject *)gw)->toggle = instance;
86 return ((GCheckboxObject *)gw)->toggle;
94 sizeof(GCheckboxObject),
100 #if GINPUT_NEED_MOUSE
107 #if GINPUT_NEED_KEYBOARD || GWIN_NEED_KEYBOARD
112 #if GINPUT_NEED_TOGGLE
115 CheckboxToggleAssign,
132 if (!(gb = (GCheckboxObject *)_gwidgetCreate(g, &gb->w, pInit, &checkboxVMT)))
135 #if GINPUT_NEED_TOGGLE
136 gb->toggle = GWIDGET_NO_INSTANCE;
175 #define gcw ((GCheckboxObject *)gw)
181 pcol = getCheckboxColors(gw);
196 _gwidgetDrawFocusRect(gw, 1, 1, ld-2, ld-2);
204 #define gcw ((GCheckboxObject *)gw)
210 pcol = getCheckboxColors(gw);
228 _gwidgetDrawFocusRect(gw, ep+1, 1, ld-2, ld-2);
235 #if GWIN_FLAT_STYLING
241 pcol = getCheckboxColors(gw);
243 #if GWIN_NEED_FLASHING
245 pcol = _gwinGetFlashedColor(gw, pcol, gTrue);
262 pcol = getCheckboxColors(gw);
264 #if GWIN_NEED_FLASHING
266 pcol = _gwinGetFlashedColor(gw, pcol, gTrue);
273 for(alpha = 0, i = 0; i < gw->
g.
height; i++, alpha += dalpha)
GHandle gwinGCheckboxCreate(GDisplay *g, GCheckboxObject *gb, const GWidgetInit *pInit)
Create a checkbox window.
gBool gwinCheckboxIsChecked(GHandle gh)
Get the state of a checkbox.
void gwinCheckboxCheck(GHandle gh, gBool isChecked)
Set the state of a checkbox.
#define GCHECKBOX_FLG_CHECKED
The internal checkbox flags.
COLOR_TYPE gColor
The color type definition.
gColor gdispBlendColor(gColor fg, gColor bg, gU8 alpha)
Blend 2 colors according to the alpha.
void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gFont font, gColor color, gJustify justify)
Draw a text string vertically centered within the specified box.
void gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Fill an area with a color.
void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color)
Draw a line.
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gFont font, gColor color, gColor bgColor, gJustify justify)
Draw a text string vertically centered within the specified box. The box background is filled with th...
gI16 gCoord
The type for a coordinate or length on the screen.
void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Draw a rectangular box.
GEvent * geventGetEventBuffer(GSourceListener *psl)
Get the event buffer from the GSourceListener.
void geventSendEvent(GSourceListener *psl)
Called by a source to indicate the listener's event buffer has been filled.
GSourceListener * geventGetSourceListener(GSourceHandle gsh, GSourceListener *lastlr)
Called by a source with a possible event to get a listener record.
gI32 fixed
The type for a fixed point type.
#define FIXED(x)
Macros to convert to and from a fixed point.
void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param)
Renders a square checkbox where the text is on the left side of the checkbox.
void gwinCheckboxDraw_Button(GWidgetObject *gw, void *param)
Renders a checkbox in form of a rectangular button with the text inside of it.
void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param)
Renders a square checkbox where the text is on the right side of the checkbox.
void gwinSetVisible(GHandle gh, gBool visible)
Sets whether a window is visible or not.
A window object structure.
const struct gwinVMT * vmt
The Virtual Method Table for a GWIN window.