GUIButtonGridBox - hampussandberg/HexConnect GitHub Wiki
Index
Info
TODO
Struct
/*
* @name GUIButtonGridBox
* @brief - A rectangular box with a title, close button, optional label
* column and a grid of buttons.
* - When a button is pressed actionButtonPressed will be called
* with the row and column for the pressed button as parameters.
* - The position and dimensions can be set using the object
* - There are various color choices for flexibility.
* - The buttons in the grid can have one row of text.
* - If a certain position in the grid should be empty, just don't
* set that button's text to anything, or set it to 0.
* - The font is used for all elements of the button grid box.
* - titleHeight sets the height of the title bar and also the
* height of the close button.
* - Dimensions for the button grid and optional label column are
* calculated automatically according to the dimension of the box
* and it's padding.
*/
typedef struct
{
/* Basic information about the object */
GUIObject object;
/* Colors */
guiColor backgroundColor;
guiColor titleBackgroundColor;
guiColor titleTextColor;
guiColor labelsBackgroundColor;
guiColor labelsTextColor;
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: Row, Column
*/
void (*actionButtonPressed)(uint32_t, uint32_t);
/* Title, info text and button texts */
char* title;
char* labelText[GUI_BUTTON_GRID_MAX_ROWS];
/* A button with the text set to 0 will not be used */
char* buttonText[GUI_BUTTON_GRID_MAX_ROWS][GUI_BUTTON_GRID_MAX_COLUMNS];
FONT* font;
/* Dimensions and Padding */
uint16_t titleHeight;
bool labelColumnEnabled;
uint32_t numOfRows;
uint32_t numOfColumns;
GUIPadding padding;
/*
* 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 closeButton;
GUILabel label[GUI_BUTTON_GRID_MAX_ROWS];
GUIButton button[GUI_BUTTON_GRID_MAX_ROWS][GUI_BUTTON_GRID_MAX_COLUMNS];
} GUIButtonGridBox;
Example Init
TODO