Gooey GUI Library
Loading...
Searching...
No Matches
gooey_button.h File Reference

Button handling functions for the Gooey GUI library. More...

#include "common/gooey_common.h"
#include <stdbool.h>

Go to the source code of this file.

Functions

GooeyButton * GooeyButton_Create (const char *label, int x, int y, int width, int height, void(*callback)())
 Adds a button to the window.
 
void GooeyButton_SetText (GooeyButton *button, const char *text)
 Sets the text of the button.
 
void GooeyButton_SetHighlight (GooeyButton *button, bool is_highlighted)
 Highlights or unhighlights a button.
 

Detailed Description

Button handling functions for the Gooey GUI library.

Author
Yassine Ahmed Ali

This file contains functions for adding, handling, and drawing buttons in a Gooey window.

Function Documentation

◆ GooeyButton_Create()

GooeyButton * GooeyButton_Create ( const char *  label,
int  x,
int  y,
int  width,
int  height,
void(*)()  callback 
)

Adds a button to the window.

This function creates a new button with the specified label, position, dimensions, and callback function. The button is added to the provided window.

Parameters
labelThe label to display on the button.
xThe x-coordinate of the button's position.
yThe y-coordinate of the button's position.
widthThe width of the button.
heightThe height of the button.
callbackThe callback function to call when the button is clicked.
Returns
A pointer to the newly created GooeyButton object.

◆ GooeyButton_SetHighlight()

void GooeyButton_SetHighlight ( GooeyButton *  button,
bool  is_highlighted 
)

Highlights or unhighlights a button.

This function visually indicates whether a button is highlighted, which can be used to show focus or selection.

Parameters
buttonA pointer to the button to modify.
is_highlightedtrue to highlight the button; false to remove the highlight.

◆ GooeyButton_SetText()

void GooeyButton_SetText ( GooeyButton *  button,
const char *  text 
)

Sets the text of the button.

This function updates the label text displayed on the button.

Parameters
buttonThe button to set the text for.
textThe new text to display on the button.