Gooey GUI Library
|
#include "common/gooey_common.h"
#include <stdbool.h>
Go to the source code of this file.
Functions | |
GooeyTextbox * | GooeyTextBox_Create (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, void *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. | |
GooeyTextbox * GooeyTextBox_Create | ( | int | x, |
int | y, | ||
int | width, | ||
int | height, | ||
char * | placeholder, | ||
void(*)(char *text) | onTextChanged | ||
) |
Adds a textbox to the window.
This function creates and adds a textbox to the specified window at the given position with a defined size. The textbox can display placeholder text, and a callback function is triggered whenever the text inside the textbox changes.
x | The x-coordinate of the textbox's position. |
y | The y-coordinate of the textbox's position. |
width | The width of the textbox. |
height | The height of the textbox. |
placeholder | The placeholder text for the textbox. |
onTextChanged | The callback function to call when the text changes. |
void GooeyTextbox_Draw | ( | GooeyWindow * | win | ) |
Draws the textbox on the window.
This function renders the textbox on the specified window. It should be called after the textbox's state has been updated to reflect the changes visually.
win | The window to draw the textbox on. |
const char * GooeyTextbox_GetText | ( | GooeyTextbox * | textbox | ) |
Gets the text of the textbox.
This function retrieves the current content of the textbox.
textbox | The textbox to retrieve text from. |
bool GooeyTextbox_HandleClick | ( | GooeyWindow * | win, |
int | x, | ||
int | y | ||
) |
Handles textbox click events.
This function is responsible for detecting and processing click events on the textbox. If the textbox is clicked, it will enter an active state.
win | The window containing the textbox. |
x | The x-coordinate of the click event. |
y | The y-coordinate of the click event. |
void GooeyTextbox_HandleKeyPress | ( | GooeyWindow * | win, |
void * | event | ||
) |
Handles key press events for the textbox.
This function processes key events, allowing the user to type text inside the textbox. The textbox's content is updated in real-time as the user types.
win | The window containing the textbox. |
event | The key event to handle. |
void GooeyTextbox_SetText | ( | GooeyTextbox * | textbox, |
const char * | text | ||
) |
Sets the text of the textbox.
This function sets the textbox's content to the specified text.
textbox | The textbox to set the text for. |
text | The new text to set in the textbox. |