#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stddef.h>
#include <assert.h>
#include <limits.h>
#include <math.h>
#include <cairo.h>
#include <cairo-xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include "xwidget.h"
#include "xadjustment.h"
#include "xchildlist.h"
#include "xcolor.h"
#include "xpngloader.h"
Go to the source code of this file.
Data Structures | |
struct | Xputty |
Xputty - the main struct. It should be declared before any other call to a Xputty function. Xputty store a pointer in the childlist, to any Widget_t related to this instance of libxputty. The first created Widget_t is the toplevel window. When the toplevel window call destroy_widget(), Xputty call destroy_widget() for all remaining Widget_t's in the main childlist. So any allocated memory should be released before the toplevel window finaly close. More... | |
Macros | |
#define | XPUTTY1_H_ |
#define | DEBUG 0 |
#define | NDEBUG |
#define | debug_print(...) ((void)((DEBUG) ? fprintf(stderr, __VA_ARGS__) : 0)) |
debug_print - print out state messages when compiled with the -DDEBUG flag More... | |
#define | min(x, y) ((x) < (y) ? (x) : (y)) |
min - set a maximal value (x) as return value More... | |
#define | max(x, y) ((x) < (y) ? (y) : (x)) |
max - set a minimal value (x) as return value More... | |
#define | IS_UTF8(c) (((c)&0xc0)==0xc0) |
IS_UTF8 - check if a char contain UTF 8 formated signs. More... | |
Typedefs | |
typedef struct Childlist_t | Childlist_t |
Childlist_t - maintain a Widget_t list of childs for a Widget_t. More... | |
typedef struct Adjustment_t | Adjustment_t |
Adjustment_t - Adjustment_t for a Widget_t. More... | |
typedef struct Widget_t | Widget_t |
Widget_t - the Widget_t base struct. More... | |
typedef struct XColor_t | XColor_t |
XColor_t - the Widget_t Color struct. More... | |
typedef struct Xputty | Xputty |
Xputty - the main struct.It should be declared before any other call to a Xputty function. More... | |
Functions | |
void | main_init (Xputty *main) |
main_init - open the Display and init the main->childlist. Set the bool run to true. The bool run is used to terminate the main event loop. main_init() should be called directly after the declaration of Xputty before the first Widget_t get created. Any Widget_t created afterwards will be added to the main childlist. The main childlist is used to check if a Widget_t is valid to receive a Event. Xputty check if a Widget_t is registerd in the main childlist, and only forward events when it found the Widget_t in the list. When a Widget_t call destroy_widget() any childs of this Widget_t receive a call to destroy_widget() to release there memory, they get removed from the main childlist and finaly the Widget_t itself will be removed from the main childlist as well. On main_quit() any remaining Widget_t from the main childlist will be destroyed, to ensure that we leave the memory clean. More... | |
void | main_run (Xputty *main) |
main_run - start the main event loop. It should be start after your Widget_t's been created. You could create and destroy additional Widget_t's at any time later during run. More... | |
void | run_embedded (Xputty *main) |
run_embedded - the main event loop to run embedded UI's. It should be start after your Widget_t's been created. You could create and destroy additional Widget_t's at any time later during run. More... | |
void | main_quit (Xputty *main) |
main_quit - destroy all remaining Widget_t's from the main->childlist. Free all resources which may be allocated between init and quit. It should be called after main_run()/run_embedded(); More... | |
#define debug_print | ( | ... | ) | ((void)((DEBUG) ? fprintf(stderr, __VA_ARGS__) : 0)) |
#define IS_UTF8 | ( | c | ) | (((c)&0xc0)==0xc0) |
#define max | ( | x, | |
y | |||
) | ((x) < (y) ? (y) : (x)) |
#define min | ( | x, | |
y | |||
) | ((x) < (y) ? (x) : (y)) |
typedef struct Adjustment_t Adjustment_t |
Adjustment_t - Adjustment_t for a Widget_t.
typedef struct Childlist_t Childlist_t |
Childlist_t - maintain a Widget_t list of childs for a Widget_t.
void main_init | ( | Xputty * | main | ) |
main_init - open the Display and init the main->childlist.
Set the bool run to true.
The bool run is used to terminate the main event loop.
main_init() should be called directly after the declaration of Xputty before the first Widget_t get created.
Any Widget_t created afterwards will be added to the main childlist.
The main childlist is used to check if a Widget_t is valid to receive a Event.
Xputty check if a Widget_t is registerd in the main childlist, and only forward events when it found the Widget_t in the list.
When a Widget_t call destroy_widget() any childs of this Widget_t receive a call to destroy_widget() to release there memory, they get removed from the main childlist and finaly the Widget_t itself will be removed from the main childlist as well. On main_quit() any remaining Widget_t from the main childlist will be destroyed, to ensure that we leave the memory clean.
*main | - pointer to the main Xputty struct |
Definition at line 24 of file xputty.c.
References Xputty::big_font, Xputty::childlist, childlist_init(), Xputty::color_scheme, Xputty::dpy, Xputty::hold_grab, Xputty::normal_font, Xputty::run, set_dark_theme(), and Xputty::small_font.
void main_quit | ( | Xputty * | main | ) |
main_quit - destroy all remaining Widget_t's from the main->childlist.
Free all resources which may be allocated between init and quit.
It should be called after main_run()/run_embedded();
*main | - pointer to the main Xputty struct |
Definition at line 142 of file xputty.c.
References Xputty::childlist, childlist_destroy(), Childlist_t::childs, Xputty::color_scheme, debug_print, destroy_widget(), Xputty::dpy, and Childlist_t::elem.
void main_run | ( | Xputty * | main | ) |
main_run - start the main event loop.
It should be start after your Widget_t's been created.
You could create and destroy additional Widget_t's at any time later during run.
*main | - pointer to the main Xputty struct |
Definition at line 40 of file xputty.c.
References Widget_t::app, Xputty::childlist, Widget_t::childlist, childlist_find_widget(), Childlist_t::childs, destroy_widget(), Xputty::dpy, Childlist_t::elem, Widget_t::event_callback, Widget_t::flags, HIDE_ON_DELETE, Xputty::hold_grab, Xputty::run, Widget_t::widget, and widget_hide().
void run_embedded | ( | Xputty * | main | ) |
run_embedded - the main event loop to run embedded UI's.
It should be start after your Widget_t's been created.
You could create and destroy additional Widget_t's at any time later during run.
*main | - pointer to the main Xputty struct |
Definition at line 95 of file xputty.c.
References Xputty::childlist, Widget_t::childlist, childlist_find_widget(), Childlist_t::childs, destroy_widget(), Xputty::dpy, Childlist_t::elem, Widget_t::event_callback, Widget_t::flags, HIDE_ON_DELETE, Xputty::hold_grab, Widget_t::widget, and widget_hide().