Gooey GUI Library
Loading...
Searching...
No Matches
gooey_button.h File Reference
#include "core/gooey_backend_internal.h"
#include "gooey_widgets_internal.h"
#include <stdbool.h>

Go to the source code of this file.

Functions

GooeyButton * GooeyButton_Add (GooeyWindow *win, const char *label, int x, int y, int width, int height, void(*callback)())
 Adds a button to the window.
 
bool GooeyButton_HandleClick (GooeyWindow *win, int x, int y)
 Handles button click events.
 
void GooeyButton_SetText (GooeyButton *button, const char *text)
 Sets the text of the button.
 
void GooeyButton_Draw (GooeyWindow *win)
 Draws the button on the window.
 
void GooeyButton_SetHighlight (GooeyButton *button, bool is_highlighted)
 Highlights or unhighlights a button.
 

Function Documentation

◆ GooeyButton_Add()

GooeyButton * GooeyButton_Add ( GooeyWindow *  win,
const char *  label,
int  x,
int  y,
int  width,
int  height,
void(*)()  callback 
)

Adds a button to the window.

Parameters
winThe window to add the button to.
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 new GooeyButton object.

◆ GooeyButton_Draw()

void GooeyButton_Draw ( GooeyWindow *  win)

Draws the button on the window.

Parameters
winThe window to draw the button on.

◆ GooeyButton_HandleClick()

bool GooeyButton_HandleClick ( GooeyWindow *  win,
int  x,
int  y 
)

Handles button click events.

Parameters
winThe window containing the button.
xThe x-coordinate of the click event.
yThe y-coordinate of the click event.
Returns
True if the button was clicked, false otherwise.

◆ GooeyButton_SetHighlight()

void GooeyButton_SetHighlight ( GooeyButton *  button,
bool  is_highlighted 
)

Highlights or unhighlights a button.

This function visually indicates whether a button is highlighted.

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.

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