|
libxputty
0.1
A damn tiny abstraction Layer to create X11 window/widgets with cairo surfaces
|
|
Go to the documentation of this file.
36 XWindowAttributes attrs;
37 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
38 int width = attrs.width;
39 int height = attrs.height;
40 if (attrs.map_state != IsViewable)
return;
43 int j = (int)listbox->adj->value;
48 cairo_rectangle(w->
crb, 0, 0, width , height);
51 }
else if(w->
state==2) {
53 }
else if(w->
state==3) {
56 cairo_fill_preserve(w->
crb);
57 cairo_set_line_width(w->
crb, 1.0);
60 cairo_text_extents_t extents;
63 cairo_set_font_size (w->
crb, height/2);
64 cairo_text_extents(w->
crb,w->
label , &extents);
66 cairo_move_to (w->
crb, (width-extents.width)/2., height - extents.height );
68 cairo_new_path (w->
crb);
69 if (extents.width > (
float)width) {
81 XWindowAttributes attrs;
82 XGetWindowAttributes(listbox->
app->
dpy, (Window)listbox->
widget, &attrs);
83 int height = attrs.height;
94 XWindowAttributes attrs;
95 XGetWindowAttributes(listbox->
app->
dpy, (Window)listbox->
widget, &attrs);
96 int width = attrs.width;
104 XWindowAttributes attrs;
105 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
106 if (attrs.map_state != IsViewable)
return;
107 int width = attrs.width;
108 int height = attrs.height;
111 cairo_rectangle(w->
crb, width-5,0,5,height);
112 cairo_fill_preserve(w->
crb);
116 cairo_rectangle(w->
crb, width-5,(height-10)*sliderstate,5,10);
117 cairo_fill_preserve(w->
crb);
119 cairo_set_line_width(w->
crb,1);
120 cairo_stroke(w->
crb);
126 XWindowAttributes attrs;
128 int height = attrs.height;
137 XButtonEvent *xbutton = (XButtonEvent*)button_;
138 if(xbutton->button == Button1) {
141 int old_value = (
int) listbox->
adj->
value;
144 if (xbutton->window == wid->
widget) {
146 float value = (float)i;
155 }
else if(xbutton->button == Button4) {
157 }
else if(xbutton->button == Button5) {
161 float value = view_port->
adj->
value + (view_port->
adj->
step * -direction);
163 if (value<view_port->adj->min_value) value = view_port->
adj->
min_value;
void use_text_color_scheme(Widget_t *w, Color_state st)
use_text_color_scheme - use text Colors to paint on Widget_t
float adj_get_state(Adjustment_t *adj)
adj_get_state - get the current state of the Adjustment_t
void _draw_listbox_item(void *w_, void *user_data)
_draw_listbox_item - draw item on expose call
Color_state get_color_state(Widget_t *wid)
get_color_state - get the Color_state to use in relation to the Widget_t state
float adj_get_value(Adjustment_t *adj)
adj_get_value - get the current value of the Adjustment_t
void use_fg_color_scheme(Widget_t *w, Color_state st)
use_fg_color_scheme - use forground Colors to paint on Widget_t
void use_bg_color_scheme(Widget_t *w, Color_state st)
use_bg_color_scheme - use background Colors to paint on Widget_t
void use_frame_color_scheme(Widget_t *w, Color_state st)
use_frame_color_scheme - use frame Colors to paint on Widget_t
void _set_listbox_viewpoint(void *w_, void *user_data)
_set_listbox_viewpoint - move the view_port to position
evfunc button_release_callback
void _draw_listbox(void *w_, void *user_data)
_draw_listbox - draw listbox on expose call
void adj_set_state(Adjustment_t *adj, float state)
adj_set_state - set the current state of the Adjustment_t
void _draw_listbox_viewslider(void *w_, void *user_data)
_draw_listbox_viewslider - draw a slider on the viewport to indicate the view point
void _reconfigure_listbox_viewport(void *w_, void *user_data)
_reconfigure_listbox_viewport - reconfigure the viewport adjustment on size changes
int childlist_has_child(Childlist_t *childlist)
childlist_has_child - check if a Widget_t Childlist_t contain a child
#define max(x, y)
max - set a minimal value (x) as return value
void _listbox_entry_released(void *w_, void *button_, void *user_data)
_listbox_entry_released - redraw the slider when buttob released
void use_base_color_scheme(Widget_t *w, Color_state st)
use_base_color_scheme - use base Colors to paint on Widget_t
void check_value_changed(Adjustment_t *adj, float *value)
check_value_changed - check if Adjustment_t value have changed and send value_changed_callback (VALUE...
void _configure_listbox(void *w_, void *user_data)
_configure_listbox - configure the viewport on mapping