#include "xputty.h"
Go to the source code of this file.
Data Structures | |
struct | Func_t |
Func_t - struct to hold all supported event callbacks. More... | |
struct | Resize_t |
Resize_t - struct used to resize child widgets. More... | |
struct | Widget_t |
Widget_t - struct to hold the basic Widget_t info. More... | |
Macros | |
#define | XWIDGET_H |
#define | SYSTEM_TRAY_REQUEST_DOCK 0 |
#define | SYSTEM_TRAY_BEGIN_MESSAGE 1 |
#define | SYSTEM_TRAY_CANCEL_MESSAGE 2 |
Typedefs | |
typedef void(* | vfunc) (void *widget, void *event, Xputty *main, void *user_data) |
*vfunc - function pointer to connect Xevents from the main loop to Widget_t More... | |
typedef void(* | evfunc) (void *widget, void *event, void *user_data) |
*evfunc - function pointer to connect Xevents from a Widget_t to a event handler More... | |
typedef void(* | xevfunc) (void *widget, void *user_data) |
*xevfunc - function pointer to connect XEvents from a Widget_t to a event handler More... | |
Enumerations | |
enum | EventType { EXPOSE = 1, CONFIGURE, ENTER, LEAVE, ADJ_INTERN, VALUE_CHANGED, USER, MEM_FREE, CONFIGURE_NOTIFY, MAP_NOTIFY, UNMAP_NOTIFY, DIALOG_RESPONSE, BUTTON_PRESS, BUTTON_RELEASE, POINTER_MOTION, KEY_PRESS, KEY_RELEASE } |
EventType - enum to hold identifier for all supported event callbacks Events could be connected to a handler by using this identifier. More... | |
enum | Gravity { NORTHWEST, NORTHEAST, SOUTHWEST, SOUTHEAST, CENTER, ASPECT, FIXEDSIZE, MENUITEM, NONE } |
Gravity - enum to indicate how to resize a widget. More... | |
enum | { IS_WIDGET = 1<<0, IS_WINDOW = 1<<1, IS_POPUP = 1<<2, IS_RADIO = 1<<3, IS_TOOLTIP = 1<<4, USE_TRANSPARENCY = 1<<5, HAS_FOCUS = 1<<6, HAS_POINTER = 1<<7, HAS_TOOLTIP = 1<<8, HAS_MEM = 1<<9, NO_AUTOREPEAT = 1<<10, FAST_REDRAW = 1<<11, HIDE_ON_DELETE = 1<<12, REUSE_IMAGE = 1<<13, NO_PROPAGATE = 1<<14 } |
anonymous enum - flags to set Widget_t propertys More... | |
Functions | |
Widget_t * | create_window (Xputty *app, Window win, int x, int y, int width, int height) |
*create_window - create a Window You need to create as least minimun one Window to get started. The first created Window is the top_level_widget() A Window could be created on the DefaultRootWindow() or embeded into a other XWindow More... | |
Widget_t * | create_widget (Xputty *app, Widget_t *win, int x, int y, int width, int height) |
*create_widget - create a widget A Widget_t could only be created as child of a other Widget_t To create a Widget_t you need to create a Widget_t with create_window() before. More... | |
void | connect_func (void(**event)(), void(*handler)()) |
connect_func - connect a event with a handler without type check. For supported events see: Func_t More... | |
void | widget_set_title (Widget_t *w, const char *title) |
widget_set_title - set window title for a Widget_t More... | |
void | widget_show (Widget_t *w) |
widget_show - map/show widget More... | |
void | pop_widget_show_all (Widget_t *w) |
pop_widget_show_all - map/show popup widget with all it's childs More... | |
void | widget_hide (Widget_t *w) |
widget_hide - unmap/hide a Widget_t More... | |
void | widget_show_all (Widget_t *w) |
widget_show_all - map/show Widget_t with all childs More... | |
void | show_tooltip (Widget_t *wid) |
show_tooltip - check if a Widget_t have a tooltip, and show it, if a tooltip is available. More... | |
void | hide_tooltip (Widget_t *wid) |
hide_tooltip - check if a Widget_t have a tooltip, and hide it, if a tooltip is mapped. More... | |
Widget_t * | get_toplevel_widget (Xputty *main) |
*get_toplevel_widget - get pointer to the top level Widget_t More... | |
void | quit (Widget_t *w) |
quit - exit the main loop More... | |
void | quit_widget (Widget_t *w) |
quit_widget - remove a widget from the processing loop More... | |
void | transparent_draw (void *wid, void *user_data) |
transparent_draw - copy parent surface to child surface you usaualy didn't need to call this, it's used automaticaly when a Widget_t have set the flag USE_TRANSPARENCY this is the default setting for Widget_t More... | |
void | widget_reset_scale (Widget_t *w) |
widget_reset_scale - used to reset scaling mode after a image surface is drawn to the Widget_t surface with widget_set_scale() More... | |
void | widget_set_scale (Widget_t *w) |
widget_set_scale - set scaling mode to scale a image surface to the size of the Widget_t surface More... | |
void | destroy_widget (Widget_t *w, Xputty *main) |
destroy_widget - destroy a widget When a Widget_t receive a destroy_widget() call, it will propagate that to all childs in it's Childlist_t. So all childs get destroyed before the Widget_t itself close. More... | |
void | widget_event_loop (void *w_, void *event, Xputty *main, void *user_data) |
widget_event_loop - the internal widget event loop More... | |
void | send_configure_event (Widget_t *w, int x, int y, int width, int height) |
send_configure_event - send a ConfigureNotify to Widget_t used to resize a Widget_t More... | |
void | send_button_press_event (Widget_t *w) |
send_button_press_event - send ButtonPress event to Widget_t simulate a BUTTON_PRESS Event More... | |
void | send_button_release_event (Widget_t *w) |
send_button_release_event - send ButtonRelease event to Widget_t simulate a BUTTON_RELEASE Event More... | |
void | send_systray_message (Widget_t *w) |
send_systray_message - request a systray icon for Widget_t currently not working More... | |
void | expose_widget (Widget_t *w) |
expose_widgets - send a expose event (EXPOSE) to a Widget_t More... | |
int | key_mapping (Display *dpy, XKeyEvent *xkey) |
_key_mapping - modifier key's mapped to a integer value More... | |
typedef void(* evfunc) (void *widget, void *event, void *user_data) |
typedef void(* vfunc) (void *widget, void *event, Xputty *main, void *user_data) |
typedef void(* xevfunc) (void *widget, void *user_data) |
anonymous enum |
anonymous enum - flags to set Widget_t propertys
IS_WIDGET | - Widget_t is a sub widget |
IS_WINDOW | - Widget_t has no Widget_t parent |
IS_POPUP | - Widget_t is a pop up widget |
IS_RADIO | - Widget_t is part of a radio group |
USE_TRANSPARENCY | - Widget_t need transparent draw (buffer) |
HAS_FOCUS | - Mouse pointer is above Widget_t |
HAS_POINTER | - Mouse pointer is pressed on Widget_t |
HAS_TOOLTIP | - Widget_t have tooltip |
HAS_MEM | - Widget_t have mem to be released |
Enumerator | |
---|---|
IS_WIDGET | Widget_t is a sub widget |
IS_WINDOW | |
IS_POPUP | Widget_t is a pop up widget |
IS_RADIO | Widget_t is part of a radio group |
IS_TOOLTIP | Widget_t is a tooltip widget |
USE_TRANSPARENCY | Widget_t need transparent draw (buffer) |
HAS_FOCUS | Mouse pointer is above Widget_t |
HAS_POINTER | Mouse pointer is pressed on Widget_t |
HAS_TOOLTIP | Widget_t have tooltip |
HAS_MEM | Widget_t have mem to be released |
NO_AUTOREPEAT | Widget_t didn't receive autorepeated keys |
FAST_REDRAW | Widget_t need fast redrawing |
HIDE_ON_DELETE | Hide Widget_t instead delete on "WM_DELETE_WINDOW" |
REUSE_IMAGE | |
NO_PROPAGATE | Widget_t didn't receive redraw events on propagate |
Definition at line 231 of file xwidget.h.
enum EventType |
EventType - enum to hold identifier for all supported event callbacks
Events could be connected to a handler by using this identifier.
EXPOSE | - (xevfunc) expose_callback(void * widget, void user_data) |
CONFIGURE | - (xevfunc) configure_callback(void * widget, void user_data) |
ENTER | - (xevfunc) enter_callback(void * widget, void user_data) |
LEAVE | - (xevfunc) leave_callback(void * widget, void user_data) |
ADJ_INTERN | - (xevfunc) adj_callback(void * widget, void user_data) |
VALUE_CHANGED | - (xevfunc) value_changed_callback(void * widget, void user_data) |
USER | - (xevfunc) user_callback(void * widget, void user_data) |
MEM_FREE | - (xevfunc) mem_free_callback(void * widget, void user_data) |
CONFIGURE_NOTIFY | - (xevfunc) configure_notify_callback(void * widget, void user_data) |
MAP_NOTIFY | - (xevfunc) map_notify_callback(void * widget, void user_data) |
UNMAP_NOTIFY | - (xevfunc) unmap_notify_callback(void * widget, void user_data) |
DIALOG_RESPONS | - (xevfunc) dialog_callback(void * widget, void user_data) |
BUTTON_PRESS | - (evfunc) button_press_callback(void * widget, void * event, void user_data) |
BUTTON_RELEASE | - (evfunc) button_release_callback(void * widget, void * event, void user_data) |
POINTER_MOTION | - (evfunc) motion_callback(void * widget, void * event, void user_data) |
KEY_PRESS | - (evfunc) key_press_callback(void * widget, void * event, void user_data) |
KEY_RELEASE | - (evfunc) key_release_callback(void * widget, void * event, void user_data) |
Enumerator | |
---|---|
EXPOSE | |
CONFIGURE | |
ENTER | |
LEAVE | |
ADJ_INTERN | |
VALUE_CHANGED | |
USER | |
MEM_FREE | |
CONFIGURE_NOTIFY | |
MAP_NOTIFY | |
UNMAP_NOTIFY | |
DIALOG_RESPONSE | |
BUTTON_PRESS | |
BUTTON_RELEASE | |
POINTER_MOTION | |
KEY_PRESS | |
KEY_RELEASE |
Definition at line 123 of file xwidget.h.
enum Gravity |
Gravity - enum to indicate how to resize a widget.
NORTHWEST | - Widget_t adjust nord/west |
NORTHEAST | - Widget_t adjust nord/east |
SOUTHWEST | - Widget_t adjust south/west |
SOUTHEAST | - Widget_t adjust south/east |
CENTER | - Widget_t adjust centered |
ASPECT | - Widget_t adjust in a aspect frame |
NONE | - Widget_t request no adjustment in frame |
Enumerator | |
---|---|
NORTHWEST | Widget_t adjust nord/west |
NORTHEAST | Widget_t adjust nord/east |
SOUTHWEST | Widget_t adjust south/west |
SOUTHEAST | Widget_t adjust south/east |
CENTER | Widget_t adjust centered |
ASPECT | Widget_t adjust in a aspect frame |
FIXEDSIZE | Widget_t has fixed size |
MENUITEM | Widget_t adjust in a aspect frame |
NONE | Widget_t request no adjustment in frame |
Definition at line 155 of file xwidget.h.
void connect_func | ( | void(**)() | event, |
void(*)() | handler | ||
) |
connect_func - connect a event with a handler without type check. For supported events see: Func_t
**event | - the event to connect |
*handler | - the handler to handle the event |
Definition at line 380 of file xwidget.c.
References debug_print.
*create_widget - create a widget
A Widget_t could only be created as child of a other Widget_t
To create a Widget_t you need to create a Widget_t with create_window() before.
*app | - pointer to the Xputty *main struct to use |
*parent | - pointer to the Parrent Widget_t |
x,y,width,height | - the position/geometry to create the widget |
Definition at line 268 of file xwidget.c.
References _dummy1_callback(), _dummy_callback(), Widget_t::adj, Func_t::adj_callback, Widget_t::adj_x, Widget_t::adj_y, Widget_t::app, Resize_t::ascale, Widget_t::buffer, Func_t::button_press_callback, Func_t::button_release_callback, CENTER, Xputty::childlist, Widget_t::childlist, childlist_add_child(), childlist_init(), Func_t::configure_callback, configure_event(), Func_t::configure_notify_callback, Widget_t::cr, Widget_t::crb, Resize_t::cscale_x, Resize_t::cscale_y, Widget_t::data, debug_print, Func_t::dialog_callback, Xputty::dpy, Func_t::enter_callback, Widget_t::event_callback, Func_t::expose_callback, FAST_REDRAW, Widget_t::flags, Widget_t::func, Resize_t::gravity, Widget_t::height, HIDE_ON_DELETE, Widget_t::image, Resize_t::init_height, Resize_t::init_width, Resize_t::init_x, Resize_t::init_y, Widget_t::input_label, IS_WIDGET, Func_t::key_press_callback, Func_t::key_release_callback, Widget_t::label, Func_t::leave_callback, Func_t::map_notify_callback, Func_t::mem_free_callback, Func_t::motion_callback, NO_AUTOREPEAT, NO_PROPAGATE, Widget_t::parent, Widget_t::parent_struct, Resize_t::rcscale_x, Resize_t::rcscale_y, REUSE_IMAGE, Widget_t::scale, Resize_t::scale_x, Resize_t::scale_y, Widget_t::state, Widget_t::surface, transparent_draw(), Func_t::unmap_notify_callback, USE_TRANSPARENCY, Func_t::user_callback, Func_t::value_changed_callback, Widget_t::widget, widget_event_loop(), Widget_t::width, Widget_t::x, Widget_t::xic, Widget_t::xim, and Widget_t::y.
*create_window - create a Window
You need to create as least minimun one Window to get started.
The first created Window is the top_level_widget()
A Window could be created on the DefaultRootWindow() or embeded into a other XWindow
*app | - pointer to the Xputty *main struct to use |
win | - pointer to the Parrent Window (may be Root) |
x,y,width,height | - the position/geometry to create the window |
Definition at line 145 of file xwidget.c.
References _dummy1_callback(), _dummy_callback(), Widget_t::adj, Func_t::adj_callback, Widget_t::adj_x, Widget_t::adj_y, Widget_t::app, Resize_t::ascale, Widget_t::buffer, Func_t::button_press_callback, Func_t::button_release_callback, CENTER, Xputty::childlist, Widget_t::childlist, childlist_add_child(), childlist_init(), Func_t::configure_callback, configure_event(), Func_t::configure_notify_callback, Widget_t::cr, Widget_t::crb, Resize_t::cscale_x, Resize_t::cscale_y, Widget_t::data, debug_print, Func_t::dialog_callback, Xputty::dpy, Func_t::enter_callback, Widget_t::event_callback, Func_t::expose_callback, FAST_REDRAW, Widget_t::flags, Widget_t::func, Resize_t::gravity, Widget_t::height, HIDE_ON_DELETE, Widget_t::image, Resize_t::init_height, Resize_t::init_width, Resize_t::init_x, Resize_t::init_y, Widget_t::input_label, IS_WINDOW, Func_t::key_press_callback, Func_t::key_release_callback, Widget_t::label, Func_t::leave_callback, Func_t::map_notify_callback, Func_t::mem_free_callback, Func_t::motion_callback, NO_AUTOREPEAT, NO_PROPAGATE, Widget_t::parent, Widget_t::parent_struct, Resize_t::rcscale_x, Resize_t::rcscale_y, REUSE_IMAGE, Widget_t::scale, Resize_t::scale_x, Resize_t::scale_y, Widget_t::state, Widget_t::surface, transparent_draw(), Func_t::unmap_notify_callback, Func_t::user_callback, Func_t::value_changed_callback, Widget_t::widget, widget_event_loop(), Widget_t::width, Widget_t::x, Widget_t::xic, Widget_t::xim, and Widget_t::y.
destroy_widget - destroy a widget
When a Widget_t receive a destroy_widget() call, it will propagate that to all childs in it's Childlist_t. So all childs get destroyed before the Widget_t itself close.
*w | - pointer to the Widget_t sending the request |
*main | - pointer to main struct |
Definition at line 71 of file xwidget.c.
References Widget_t::adj_x, Widget_t::adj_y, Widget_t::app, Widget_t::buffer, Xputty::childlist, Widget_t::childlist, childlist_destroy(), childlist_find_child(), childlist_has_child(), childlist_remove_child(), Childlist_t::childs, Widget_t::cr, Widget_t::crb, delete_adjustment(), Xputty::dpy, Widget_t::flags, Widget_t::func, HAS_MEM, Widget_t::image, IS_WIDGET, Func_t::mem_free_callback, Widget_t::parent, quit(), REUSE_IMAGE, Xputty::run, Widget_t::surface, Widget_t::widget, Widget_t::xic, and Widget_t::xim.
void expose_widget | ( | Widget_t * | w | ) |
expose_widgets - send a expose event (EXPOSE) to a Widget_t
w | - the Widget_t to send the event to |
Definition at line 461 of file xwidget.c.
References Widget_t::app, Xputty::dpy, and Widget_t::widget.
*get_toplevel_widget - get pointer to the top level Widget_t
*main | - pointer to the main Xputty struct |
Definition at line 457 of file xwidget.c.
References Xputty::childlist, and Childlist_t::childs.
void hide_tooltip | ( | Widget_t * | wid | ) |
hide_tooltip - check if a Widget_t have a tooltip, and hide it, if a tooltip is mapped.
*wid | - pointer to the Widget_t receiving the event |
Definition at line 446 of file xwidget.c.
References Widget_t::childlist, Childlist_t::childs, Childlist_t::elem, Widget_t::flags, IS_TOOLTIP, and widget_hide().
int key_mapping | ( | Display * | dpy, |
XKeyEvent * | xkey | ||
) |
void pop_widget_show_all | ( | Widget_t * | w | ) |
pop_widget_show_all - map/show popup widget with all it's childs
*w | - pointer to the Widget_t to map |
Definition at line 418 of file xwidget.c.
References Widget_t::app, Widget_t::childlist, Childlist_t::childs, Xputty::dpy, Childlist_t::elem, Widget_t::func, Func_t::map_notify_callback, and Widget_t::widget.
void quit | ( | Widget_t * | w | ) |
quit - exit the main loop
*w | - pointer to the Widget_t sending the request |
Definition at line 701 of file xwidget.c.
References Widget_t::app, Xputty::dpy, get_toplevel_widget(), and Widget_t::widget.
void quit_widget | ( | Widget_t * | w | ) |
quit_widget - remove a widget from the processing loop
*w | - pointer to the Widget_t sending the request |
Definition at line 713 of file xwidget.c.
References Widget_t::app, Xputty::dpy, and Widget_t::widget.
void send_button_press_event | ( | Widget_t * | w | ) |
send_button_press_event - send ButtonPress event to Widget_t
simulate a BUTTON_PRESS Event
*w | - pointer to the Widget_t to send the notify |
Definition at line 630 of file xwidget.c.
References Widget_t::app, Xputty::dpy, and Widget_t::widget.
void send_button_release_event | ( | Widget_t * | w | ) |
send_button_release_event - send ButtonRelease event to Widget_t
simulate a BUTTON_RELEASE Event
*w | - pointer to the Widget_t to send the notify |
Definition at line 649 of file xwidget.c.
References Widget_t::app, Xputty::dpy, and Widget_t::widget.
void send_configure_event | ( | Widget_t * | w, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
send_configure_event - send a ConfigureNotify to Widget_t
used to resize a Widget_t
*w | - pointer to the Widget_t to send the notify |
x,y | - the new Widget_t position |
width,height | - the new Widget_t size |
Definition at line 612 of file xwidget.c.
References Widget_t::app, Xputty::dpy, and Widget_t::widget.
void send_systray_message | ( | Widget_t * | w | ) |
send_systray_message - request a systray icon for Widget_t
currently not working
*w | - pointer to the Widget_t to send the notify |
Definition at line 668 of file xwidget.c.
References Widget_t::app, Xputty::dpy, SYSTEM_TRAY_REQUEST_DOCK, and Widget_t::widget.
void show_tooltip | ( | Widget_t * | wid | ) |
show_tooltip - check if a Widget_t have a tooltip, and show it, if a tooltip is available.
*wid | - pointer to the Widget_t receiving the event |
Definition at line 427 of file xwidget.c.
References Widget_t::app, Widget_t::childlist, Childlist_t::childs, Xputty::dpy, Childlist_t::elem, Widget_t::flags, IS_TOOLTIP, Widget_t::widget, and widget_show().
void transparent_draw | ( | void * | wid, |
void * | user_data | ||
) |
transparent_draw - copy parent surface to child surface
you usaualy didn't need to call this, it's used automaticaly when a Widget_t have set the flag USE_TRANSPARENCY
this is the default setting for Widget_t
*wid | - pointer to the Widget_t receiving the event |
*user_data | - void pointer to attached user_data |
Definition at line 469 of file xwidget.c.
References _propagate_child_expose(), Widget_t::app, Widget_t::buffer, Widget_t::cr, Widget_t::crb, debug_print, Xputty::dpy, Func_t::expose_callback, Widget_t::flags, Widget_t::func, Widget_t::parent, USE_TRANSPARENCY, and Widget_t::widget.
void widget_event_loop | ( | void * | w_, |
void * | event, | ||
Xputty * | main, | ||
void * | user_data | ||
) |
widget_event_loop - the internal widget event loop
*w | - void pointer to the Widget_t receiving the event |
*event | - void pointer to the XEvent |
*main | - void pointer to the Xputty *main struct running the event loop |
*user_data | - void pointer to attached user_data |
Definition at line 497 of file xwidget.c.
References _button_press(), _check_enum(), _check_grab(), _check_keymap(), _has_pointer(), _hide_all_tooltips(), adj_set_motion_state(), Widget_t::app, Func_t::button_release_callback, Widget_t::childlist, childlist_has_child(), Childlist_t::childs, Func_t::configure_callback, debug_print, destroy_widget(), Xputty::dpy, Func_t::enter_callback, Widget_t::flags, Widget_t::func, HAS_FOCUS, HAS_POINTER, HAS_TOOLTIP, hide_tooltip(), Func_t::key_press_callback, Func_t::key_release_callback, Func_t::leave_callback, Func_t::motion_callback, NO_AUTOREPEAT, quit_widget(), show_tooltip(), Widget_t::state, transparent_draw(), and Widget_t::x.
void widget_hide | ( | Widget_t * | w | ) |
widget_hide - unmap/hide a Widget_t
*w | - pointer to the Widget_t to unmap |
Definition at line 396 of file xwidget.c.
References Widget_t::app, Widget_t::childlist, Childlist_t::childs, Xputty::dpy, Childlist_t::elem, Widget_t::func, Func_t::unmap_notify_callback, and Widget_t::widget.
void widget_reset_scale | ( | Widget_t * | w | ) |
widget_reset_scale - used to reset scaling mode after a image surface is drawn to the Widget_t surface with widget_set_scale()
*w | - pointer to the Widget_t sending the request |
Definition at line 137 of file xwidget.c.
References Widget_t::crb, Resize_t::cscale_x, Resize_t::cscale_y, and Widget_t::scale.
void widget_set_scale | ( | Widget_t * | w | ) |
widget_set_scale - set scaling mode to scale a image surface to the size of the Widget_t surface
*w | - pointer to the Widget_t sending the request |
Definition at line 141 of file xwidget.c.
References Widget_t::crb, Resize_t::rcscale_x, Resize_t::rcscale_y, and Widget_t::scale.
void widget_set_title | ( | Widget_t * | w, |
const char * | title | ||
) |
widget_set_title - set window title for a Widget_t
*w | - pointer to the Widget_t to set the title |
*title | - the title to store |
Definition at line 387 of file xwidget.c.
References Widget_t::app, Xputty::dpy, and Widget_t::widget.
void widget_show | ( | Widget_t * | w | ) |
widget_show - map/show widget
*w | - pointer to the Widget_t to map |
Definition at line 391 of file xwidget.c.
References Widget_t::app, Xputty::dpy, Widget_t::func, Func_t::map_notify_callback, and Widget_t::widget.
void widget_show_all | ( | Widget_t * | w | ) |
widget_show_all - map/show Widget_t with all childs
*w | - pointer to the Widget_t to map |
Definition at line 405 of file xwidget.c.
References Widget_t::app, Widget_t::childlist, Childlist_t::childs, Xputty::dpy, Childlist_t::elem, Widget_t::flags, Widget_t::func, IS_POPUP, IS_TOOLTIP, Func_t::map_notify_callback, and Widget_t::widget.