GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
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... | |
Functions | |
const gp_pixmap * | gp_widget_render_buffer (void) |
Returns a pointer to a render pixmap. | |
const gp_widget_render_ctx * | gp_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. | |
void | gp_widgets_quit (void) |
Quits the widgets. | |
gp_widget * | gp_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. | |
Widget rendering.
Definition in file gp_widget_render.h.
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.
Replace a application layout.
@layout New application widget layout.
const gp_pixmap * gp_widget_render_buffer | ( | void | ) |
Returns a pointer to a render pixmap.
void gp_widget_render_zoom | ( | int | zoom_inc | ) |
Increases/decreases font sizes, etc.
TODO: Broken.
@zoom_inc A zoom increment.
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.
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.
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.
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.
void gp_widgets_exit | ( | int | exit_value | ) |
Exits the appliaction.
@exit_value Exit value passed to exit().
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.
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.
void gp_widgets_quit | ( | void | ) |
Quits the widgets.
Deinitializes widgets, backend, etc. but unlike the gp_widgets_exit() returns back to the caller. The caller can do additional cleanup but after that it must call a function that does not return as returning back to the widget library will cause crash.
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.
const gp_widget_render_ctx * gp_widgets_render_ctx | ( | void | ) |
Returns a pointer to the current render context.