libtextscreen
Typedefs | Functions
txt_widget.h File Reference

Base "widget" GUI component class. More...

Typedefs

typedef struct txt_widget_s txt_widget_t
 A GUI widget. More...
 

Functions

void TXT_SignalConnect (txt_widget_t *widget, const char *signal_name, TxtWidgetSignalFunc func, void *user_data)
 Set a callback function to be invoked when a signal occurs. More...
 
void TXT_SetWidgetAlign (txt_widget_t *widget, txt_horiz_align_t horiz_align)
 Set the policy for how a widget should be aligned within a table. More...
 
int TXT_SelectableWidget (txt_widget_t *widget)
 Query whether a widget is selectable with the cursor. More...
 
int TXT_HoveringOverWidget (txt_widget_t *widget)
 Query whether the mouse is hovering over the specified widget. More...
 
void TXT_SetWidgetBG (txt_widget_t *widget)
 Set the background to draw the specified widget, depending on whether it is selected and the mouse is hovering over it. More...
 
int TXT_ContainsWidget (txt_widget_t *haystack, txt_widget_t *needle)
 Query whether the specified widget is contained within another widget. More...
 

Detailed Description

Base "widget" GUI component class.

Typedef Documentation

◆ txt_widget_t

typedef struct txt_widget_s txt_widget_t

A GUI widget.

A widget is an individual component of a GUI. Various different widget types exist.

Widgets may emit signals. The types of signal emitted by a widget depend on the type of the widget. It is possible to be notified when a signal occurs using the TXT_SignalConnect function.

Function Documentation

◆ TXT_ContainsWidget()

int TXT_ContainsWidget ( txt_widget_t haystack,
txt_widget_t needle 
)

Query whether the specified widget is contained within another widget.

Parameters
haystackThe widget that might contain needle.
needleThe widget being queried.

◆ TXT_HoveringOverWidget()

int TXT_HoveringOverWidget ( txt_widget_t widget)

Query whether the mouse is hovering over the specified widget.

Parameters
widgetThe widget.
Returns
Non-zero if the mouse cursor is over the widget.

◆ TXT_SelectableWidget()

int TXT_SelectableWidget ( txt_widget_t widget)

Query whether a widget is selectable with the cursor.

Parameters
widgetThe widget.
Returns
Non-zero if the widget is selectable.

◆ TXT_SetWidgetAlign()

void TXT_SetWidgetAlign ( txt_widget_t widget,
txt_horiz_align_t  horiz_align 
)

Set the policy for how a widget should be aligned within a table.

By default, widgets are aligned to the left of the column.

Parameters
widgetThe widget.
horiz_alignThe alignment to use.

◆ TXT_SetWidgetBG()

void TXT_SetWidgetBG ( txt_widget_t widget)

Set the background to draw the specified widget, depending on whether it is selected and the mouse is hovering over it.

Parameters
widgetThe widget.

◆ TXT_SignalConnect()

void TXT_SignalConnect ( txt_widget_t widget,
const char *  signal_name,
TxtWidgetSignalFunc  func,
void *  user_data 
)

Set a callback function to be invoked when a signal occurs.

Parameters
widgetThe widget to watch.
signal_nameThe signal to watch.
funcThe callback function to invoke.
user_dataUser-specified pointer to pass to the callback function.