Example #1
0
/**
 * Create a new widget
 * @param strText: Text for display.
 * @param textColor: Color of text on screen.
 * @param backColor: Color of background on screen.
 * @param font: Font to use (must be a GL_FontOption)
 * @param pUpdateHandler: Callback function executed each time the label is able to redraw.
 *        Its forceRedisplay parameter is true (1) when entire screen is being redrawn.
 *        Function should return true if the label has been changed and must be redrawn.
 */
GL_PageControls_TypeDef* Widget_NewLabel(
		const char* strText,
		uint16_t textColor, uint16_t backColor, _Bool isTransparent,
		GL_FontOption font,
		_Bool (*pUpdateHandler)(GL_PageControls_TypeDef* pThis, _Bool forceRedisplay)
	)
{
	// Instance data for *this* button being created.
	LabelData *pInstanceData = (LabelData*) malloc(sizeof(LabelData));
	assert (pInstanceData != 0);

	// Create object to return
	GL_PageControls_TypeDef *pControl = NewCustomWidget(
				0,
				getWidth,
				getHeight,
				eventHandler,
				drawHandler,
				pInstanceData
				);

	// Store parameters
	Widget_ChangeLabelText(pControl, strText);
	pInstanceData->textColor = textColor;
	pInstanceData->backColor = backColor;
	pInstanceData->isTransparent = isTransparent;
	pInstanceData->font = font;
	pInstanceData->pUpdateHandler = pUpdateHandler;
	pInstanceData->isRedrawRequired = 0;

	return pControl;
}
Example #2
0
static void displayStoreFeedback(void)
{
	clearLabel();
	Widget_ChangeLabelColour(s_lblStatus, LCD_COLOR_YELLOW);
	Widget_ChangeLabelText(s_lblStatus, "Values stored to EEPROM.");
}
Example #3
0
static void resetLabel(void)
{
	Widget_ChangeLabelColour(s_lblStatus, LCD_COLOR_WHITE);
	Widget_ChangeLabelText(s_lblStatus, "Tap Item then Edit.");
}
Example #4
0
static void clearLabel(void)
{
	Widget_ChangeLabelColour(s_lblStatus, LCD_COLOR_WHITE);
	Widget_ChangeLabelText(s_lblStatus, "                            ");
}
Example #5
0
static void displayDefaultsFeedback(void)
{
	Widget_ChangeLabelColour(s_lblStatus, LCD_COLOR_YELLOW);
	Widget_ChangeLabelText(s_lblStatus, "All values reset to default.");
}