added custom render interface for checkboxes

ugfx_release_2.6
Joel Bodenmann 2013-06-03 17:36:39 +02:00
parent 2cd0bc13d5
commit 9945b011a9
2 changed files with 25 additions and 1 deletions

View File

@ -104,6 +104,17 @@ void gwinCheckboxDraw(GHandle gh);
*/
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
*

View File

@ -122,6 +122,19 @@ GHandle gwinCheckboxCreate(GCheckboxObject *gb, coord_t x, coord_t y, coord_t wi
return (GHandle)gb;
}
void gwinCheckboxSetCustom(GHandle gh, GCheckboxDrawFunction fn, void *param) {
#define gcw ((GCheckboxObject *)gh)
if (gh->type != GW_CHECKBOX)
return;
gcw->fn = fn;
gcw->param = param;
#undef gcw
}
void gwinCheckboxSetEnabled(GHandle gh, bool_t enabled) {
if (gh->type != GW_CHECKBOX)
return;
@ -136,7 +149,7 @@ void gwinCheckboxDraw(GHandle gh) {
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
//gdispSetClip(gh->x, gh->y, gh->width, gh->height);
#endif
gcw->fn(gh,