Skip to content

GUIButtonList

Hampus Sandberg edited this page Apr 12, 2015 · 2 revisions

Index


Info

TODO

Struct

/*
 * @name	GUIButtonList
 * @brief	-	TODO
 */
typedef struct
{
	/* Basic information about the object */
	GUIObject object;

	/* Colors */
	guiColor backgroundColor;
	guiColor titleBackgroundColor;
	guiColor titleTextColor[2];
	guiColor buttonsState1TextColor;
	guiColor buttonsState1BackgroundColor;
	guiColor buttonsState2TextColor;
	guiColor buttonsState2BackgroundColor;
	guiColor buttonsPressedTextColor;
	guiColor buttonsPressedBackgroundColor;

	/*
	 * Pointer to callback functions that are called when a button has been
	 * pressed
	 * Parameters: uint32_t ButtonListId, uint32_t ButtonIndex
	 */
	void (*actionButtonPressed)(uint32_t, uint32_t);

	/* Title text, one for each page */
	char* title[GUI_BUTTON_LIST_MAX_PAGES][2];
	bool titleEnabled;
	FONT* titleFont;
	/* A button with the text set to 0 will be considered empty in the list */
	char* buttonText[GUI_BUTTON_LIST_MAX_BUTTONS][2];
	bool buttonIsStaticText[GUI_BUTTON_LIST_MAX_BUTTONS];
	FONT* buttonFont;

	/* Pages and item per page */
	uint16_t numOfPages;
	uint16_t numOfButtonsPerPage;

	/*
	 * Internal stuff - Do not touch!
	 * The memory for these objects are allocated static to make things more
	 * deterministic.
	 * This of course increase the total memory usage.
	 * TODO: Switch to dynamic memory allocation?
	 */
	GUILabel titleLabel;
	GUIButton button[GUI_BUTTON_LIST_MAX_BUTTONS_PER_PAGE];
	GUIButton previousPageButton;
	GUIButton nextPageButton;
	uint16_t activePage;
	uint16_t listItemHeight;
} GUIButtonList;

Example Init

TODO

Clone this wiki locally