Skip to content

GUIButton

Hampus Sandberg edited this page Jun 28, 2015 · 3 revisions

Index


Info

GUIButton

TODO

Struct

/*
 * @name	GUIButton
 * @brief	- 	A button with a callback function which are called when running
 * 				the function GUI_CheckAllActiveButtonsForTouchEventAt() with
 * 				appropriate arguments.
 * 			- 	A button can have either one or two rows of text. No check is
 * 				done to make sure the text will fit inside the button so the
 * 				user has to make sure the button is big enough.
 * 			- 	The maximum length of the text is determined by the text
 * 				variable you send when calling the GUI_AddButton function. You
 * 				have to make sure you don't send any bigger text than this
 * 				using the GUI_SetButtonTextForRow function as that will
 * 				probably corrupt data! Think of it as static from when
 * 				compiling.
 */
typedef struct
{
	/* Basic information about the object */
	GUIObject object;

	/* Colors */
	guiColor state1TextColor;
	guiColor state1BackgroundColor;
	guiColor state2TextColor;
	guiColor state2BackgroundColor;
	guiColor pressedTextColor;
	guiColor pressedBackgroundColor;

	/* The state of the button */
	GUIButtonState buttonState;
	GUIButtonState lastButtonState;

	/* Pointer to a callback function called when a touch event has happened */
	void (*touchCallback)(GUITouchEvent, uint32_t);

	/* Two rows of text can be displayed and it must have at least one row */
	char* text[2];
	FONT* font;

	/* Internal stuff - Do not touch! */
	uint32_t numOfChar[2];
	uint32_t textWidth[2];
	uint32_t textHeight[2];
} GUIButton;

Example Init

TODO

Clone this wiki locally