2D bitmap graphics library with emphasis on speed and correctness
No Matches
gp_widget_log.h File Reference

A text log widget. More...

#include <stdlib.h>
#include <utils/gp_cbuffer.h>

Go to the source code of this file.


void gp_widget_log_append (gp_widget *self, const char *text)
 Appends text to the log.
gp_widgetgp_widget_log_new (gp_widget_tattr tattr, unsigned int min_width, unsigned int min_lines, size_t max_logs)
 Allocates a log widget.

Detailed Description

A text log widget.

Log widget JSON attributes

Attribute Type Default Description
max_logs uint A maximal number of log lines the widget can store.
min_lines uint A minimal number of log lines visible on the screen.
min_width uint A minimal widget width in text characters.
tattr string normal Log text attributes gp_widget_tattr, e.g. mono for monospace.

Definition in file gp_widget_log.h.

Function Documentation

◆ gp_widget_log_append()

void gp_widget_log_append ( gp_widget self,
const char *  text 

Appends text to the log.

selfA log widget.
textText to be appended.

◆ gp_widget_log_new()

gp_widget * gp_widget_log_new ( gp_widget_tattr  tattr,
unsigned int  min_width,
unsigned int  min_lines,
size_t  max_logs 

Allocates a log widget.

The log widget is a circular buffer of loglines, when size reaches the max_log_lines the oldest message gets removed from the log.

tattrText attributes
min_widthMinimal width in letters
min_linesMinimal number of lines
max_logsMaximal number of log lines stored internally.
Newly allocated log widget.