2D bitmap graphics library with emphasis on speed and correctness
No Matches
Data Structures | Functions
gp_widget_render.h File Reference

Widget rendering. More...

#include <core/gp_core.h>
#include <core/gp_compiler.h>
#include <gfx/gp_gfx.h>
#include <text/gp_text.h>
#include <utils/gp_timer.h>
#include <utils/gp_bbox.h>
#include <widgets/gp_widget_types.h>
#include <widgets/gp_widgets_color_scheme.h>

Go to the source code of this file.

Data Structures

struct  gp_widget_render_ctx
 Global widget (rendering) context. More...


const gp_pixmapgp_widget_render_buffer (void)
 Returns a pointer to a render pixmap.
const gp_widget_render_ctxgp_widgets_render_ctx (void)
 Returns a pointer to the current render context.
void gp_widgets_getopt (int *argc, char **argv[])
 Parses options, returns positional arguments, e.g. paths.
void gp_widgets_register_callback (int(*on_event)(gp_event *))
 Register application event callback.
void gp_widgets_main_loop (struct gp_widget *layout, void(*init)(int argc, char *argv[]), int argc, char *argv[]) __attribute__((noreturn))
 Widgets main loop.
void gp_widgets_exit (int exit_value) __attribute__((noreturn))
 Exits the appliaction.
gp_widgetgp_widget_layout_replace (gp_widget *layout)
 Replace a application layout.
long gp_dialog_run (gp_dialog *dialog)
 Runs a dialog.
void gp_widgets_clipboard_set (const char *str, size_t len)
 Sets the clipboard data.
char * gp_widgets_clipboard_get (void)
 Returns clipboard data.
void gp_widgets_clipboard_request (gp_widget *self)
 Request clipboard data.
void gp_widgets_clipboard_request_cancel (gp_widget *self)
 Cancel clipboard data request.
void gp_widget_render_zoom (int zoom_inc)
 Increases/decreases font sizes, etc.

Detailed Description

Widget rendering.

Definition in file gp_widget_render.h.

Function Documentation

◆ gp_dialog_run()

long gp_dialog_run ( gp_dialog dialog)

Runs a dialog.

Temporarily replaces layout shown on the screen with a dialog.

@dialog A dialog to be shown to the user.

A return value from a dialog.

◆ gp_widget_layout_replace()

gp_widget * gp_widget_layout_replace ( gp_widget layout)

Replace a application layout.

@layout New application widget layout.

An old application layout.

◆ gp_widget_render_buffer()

const gp_pixmap * gp_widget_render_buffer ( void  )

Returns a pointer to a render pixmap.

Pointer to a render pixmap or NULL if not available.

◆ gp_widget_render_zoom()

void gp_widget_render_zoom ( int  zoom_inc)

Increases/decreases font sizes, etc.

TODO: Broken.

@zoom_inc A zoom increment.

◆ gp_widgets_clipboard_get()

char * gp_widgets_clipboard_get ( void  )

Returns clipboard data.

Returns valid data only after GP_EV_SYS_CLIPBOARD event has been received.

@reuturn A clipboad data buffer allocated by malloc(), has to be freed by the caller.

◆ gp_widgets_clipboard_request()

void gp_widgets_clipboard_request ( gp_widget self)

Request clipboard data.

When data are ready the widget gets GP_EV_SYS_CLIPBOARD event.

@self A widget which requests clipboard data.

◆ gp_widgets_clipboard_request_cancel()

void gp_widgets_clipboard_request_cancel ( gp_widget self)

Cancel clipboard data request.

Call this to cancel clipboard requests, this is useful when widget that may have in-flight clipboard request is being destroyed.

@self A widget which cancels the request.

◆ gp_widgets_clipboard_set()

void gp_widgets_clipboard_set ( const char *  str,
size_t  len 

Sets the clipboard data.

@str A clipboard string. @len Optional size limit, if set to 0 whole string is used.

◆ gp_widgets_exit()

void gp_widgets_exit ( int  exit_value)

Exits the appliaction.

@exit_value Exit value passed to exit().

◆ gp_widgets_getopt()

void gp_widgets_getopt ( int *  argc,
char **  argv[] 

Parses options, returns positional arguments, e.g. paths.

@argc A pointer to main() arguments count. @argv A pointer to an main() arguments array.

◆ gp_widgets_main_loop()

void gp_widgets_main_loop ( struct gp_widget layout,
void(*)(int argc, char *argv[])  init,
int  argc,
char *  argv[] 

Widgets main loop.

Renders a widget layout on a screen or into an window, handles input events, etc. This function does not return.

@layout A widget layout to show. @init An init function. @argc A main() argc. @argv A main() argv.

◆ gp_widgets_register_callback()

void gp_widgets_register_callback ( int(*)(gp_event *)  on_event)

Register application event callback.

All input events that are not handled by the widget library are passed to the callback registered by this function.

@on_event An event callback.

◆ gp_widgets_render_ctx()

const gp_widget_render_ctx * gp_widgets_render_ctx ( void  )

Returns a pointer to the current render context.

A render context.