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

Go to the source code of this file.

Functions

GooeyTextbox * GooeyTextBox_Add (GooeyWindow *win, int x, int y, int width, int height, char *placeholder, void(*onTextChanged)(char *text))
 Adds a textbox to the window.
 
void GooeyTextbox_Draw (GooeyWindow *win)
 Draws the textbox on the window.
 
bool GooeyTextbox_HandleClick (GooeyWindow *win, int x, int y)
 Handles textbox click events.
 
void GooeyTextbox_HandleKeyPress (GooeyWindow *win, GooeyEvent *event)
 Handles key press events for the textbox.
 
const char * GooeyTextbox_GetText (GooeyTextbox *textbox)
 Gets the text of the textbox.
 
void GooeyTextbox_SetText (GooeyTextbox *textbox, const char *text)
 Sets the text of the textbox.
 

Function Documentation

◆ GooeyTextBox_Add()

GooeyTextbox * GooeyTextBox_Add ( GooeyWindow *  win,
int  x,
int  y,
int  width,
int  height,
char *  placeholder,
void(*)(char *text)  onTextChanged 
)

Adds a textbox to the window.

Parameters
winThe window to add the textbox to.
xThe x-coordinate of the textbox's position.
yThe y-coordinate of the textbox's position.
widthThe width of the textbox.
heightThe height of the textbox.
placeholderThe placeholder text for the textbox.
onTextChangedThe callback function to call when the text changes.
Returns
A new GooeyTextbox object.

◆ GooeyTextbox_Draw()

void GooeyTextbox_Draw ( GooeyWindow *  win)

Draws the textbox on the window.

Parameters
winThe window to draw the textbox on.

◆ GooeyTextbox_GetText()

const char * GooeyTextbox_GetText ( GooeyTextbox *  textbox)

Gets the text of the textbox.

Parameters
textboxThe textbox to retrieve text from.
Returns
The current text of the textbox.

◆ GooeyTextbox_HandleClick()

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

Handles textbox click events.

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

◆ GooeyTextbox_HandleKeyPress()

void GooeyTextbox_HandleKeyPress ( GooeyWindow *  win,
GooeyEvent *  event 
)

Handles key press events for the textbox.

Parameters
winThe window containing the textbox.
key_eventThe key event to handle.

◆ GooeyTextbox_SetText()

void GooeyTextbox_SetText ( GooeyTextbox *  textbox,
const char *  text 
)

Sets the text of the textbox.

Parameters
textboxThe textbox to set the text for.
textThe new text to set in the textbox.