Browse Source

Merge branch 'feature/label_renderer' of XenotriX/uGFX into master

remotes/origin_old/release/v2.9
Joel Bodenmann 3 years ago
committed by Gogs
parent
commit
e414e77d23
  1. 10
      src/gwin/gwin_label.c
  2. 11
      src/gwin/gwin_label.h

10
src/gwin/gwin_label.c

@ -99,10 +99,12 @@ void gwinLabelSetBorder(GHandle gh, gBool border) {
}
#endif // GWIN_LABEL_ATTRIBUTE
static void gwinLabelDraw(GWidgetObject *gw, gJustify justify) {
void gwinLabelDrawJustified(GWidgetObject *gw, void *param) {
gCoord w, h;
gColor c;
gJustify justify = (gJustify)param;
// is it a valid handle?
if (gw->g.vmt != (gwinVMT *)&labelVMT)
return;
@ -129,19 +131,19 @@ static void gwinLabelDraw(GWidgetObject *gw, gJustify justify) {
void gwinLabelDrawJustifiedLeft(GWidgetObject *gw, void *param) {
(void)param;
gwinLabelDraw(gw, gJustifyLeft);
gwinLabelDrawJustified(gw, (void *)gJustifyLeft);
}
void gwinLabelDrawJustifiedRight(GWidgetObject *gw, void *param) {
(void)param;
gwinLabelDraw(gw, gJustifyRight);
gwinLabelDrawJustified(gw, (void *)gJustifyRight);
}
void gwinLabelDrawJustifiedCenter(GWidgetObject *gw, void *param) {
(void)param;
gwinLabelDraw(gw, gJustifyCenter);
gwinLabelDrawJustified(gw, (void *)gJustifyCenter);
}
#undef gh2obj

11
src/gwin/gwin_label.h

@ -112,13 +112,22 @@ void gwinLabelSetBorder(GHandle gh, gBool border);
*
* @note In your custom label drawing function you may optionally call these
* standard functions and then draw your extra details on top.
* @note The built-in 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.
*
* @{
*/
/**
* @brief Renders a label with the text justified based on the parameter.
*
* @param[in] gw The widget object (must be a label object)
* @param[in] param A parameter passed in from the user. Must be of type gJustify.
*
* @api
*/
void gwinLabelDrawJustified(GWidgetObject *gw, void *param);
/**
* @brief Renders a label with the text left jestified.
*

Loading…
Cancel
Save