Gooey GUI Library
Loading...
Searching...
No Matches
gooey_dropdown.h File Reference
#include "core/gooey_backend_internal.h"
#include "gooey_widgets_internal.h"

Go to the source code of this file.

Functions

GooeyDropdown * GooeyDropdown_Add (GooeyWindow *win, int x, int y, int width, int height, const char **options, int num_options, void(*callback)(int selected_index))
 Adds a dropdown menu to the window.
 
bool GooeyDropdown_HandleClick (GooeyWindow *win, int x, int y)
 Handles dropdown menu click events.
 
void GooeyDropdown_Draw (GooeyWindow *win)
 Draws the drop down menu on the window.
 

Function Documentation

◆ GooeyDropdown_Add()

GooeyDropdown * GooeyDropdown_Add ( GooeyWindow *  win,
int  x,
int  y,
int  width,
int  height,
const char **  options,
int  num_options,
void(*)(int selected_index)  callback 
)

Adds a dropdown menu to the window.

Parameters
winThe window to add the dropdown menu to.
xThe x-coordinate of the dropdown's position.
yThe y-coordinate of the dropdown's position.
widthThe width of the dropdown menu.
heightThe height of the dropdown menu.
optionsThe list of options for the dropdown menu.
num_optionsThe number of options.
callbackThe callback function to call when an option is selected.
Returns
A new GooeyDropdown object.

◆ GooeyDropdown_Draw()

void GooeyDropdown_Draw ( GooeyWindow *  win)

Draws the drop down menu on the window.

Parameters
winThe window to draw the drop down menu.

◆ GooeyDropdown_HandleClick()

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

Handles dropdown menu click events.

Parameters
winThe wi>ndow containing the dropdown menu.
xThe x-coordinate of the click event.
yThe y-coordinate of the click event.
Returns
True if the dropdown menu was clicked, false otherwise.