|
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 if (attrs.map_state != IsViewable)
return;
39 int width = attrs.width;
40 int height = attrs.height;
44 int sub = (v<=0) ? 0 : 5;
46 cairo_rectangle(w->
crb, 0, 0, width-sub , height);
61 cairo_rectangle(w->
crb, 0, i*25, width-sub , 25);
62 cairo_fill_preserve(w->
crb);
63 cairo_set_line_width(w->
crb, 1.0);
66 cairo_text_extents_t extents;
76 cairo_set_font_size (w->
crb, 12);
77 cairo_text_extents(w->
crb,filelist->
list_names[i] , &extents);
79 cairo_move_to (w->
crb, (width-extents.width)/2., (25*(i+1)) - extents.height );
81 cairo_new_path (w->
crb);
82 if (i == filelist->
prelight_item && extents.width > (
float)width-20) {
96 XMotionEvent *xmotion = (XMotionEvent*)xmotion_;
97 XWindowAttributes attrs;
98 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
99 int height = attrs.height;
100 int _items = height/(height/25);
101 int prelight_item = xmotion->y/_items;
110 XKeyEvent *xkey = (XKeyEvent*)xkey_;
112 XWindowAttributes attrs;
113 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
114 int height = attrs.height;
115 int _items = height/(height/25);
138 XButtonEvent *xbutton = (XButtonEvent*)button_;
139 XWindowAttributes attrs;
140 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
141 int height = attrs.height;
142 int _items = height/(height/25);
143 int prelight_item = xbutton->y/_items;
144 if(xbutton->button == Button4) {
145 prelight_item = (xbutton->y-24)/_items;
149 }
else if (xbutton->button == Button5) {
150 prelight_item = (xbutton->y+24)/_items;
154 }
else if(xbutton->button == Button1) {
174 XWindowAttributes attrs;
175 XGetWindowAttributes(listview->
app->
dpy, (Window)listview->
widget, &attrs);
176 int height = attrs.height;
177 filelist->show_items = height/25;
178 w->
adj->
max_value = filelist->list_size-filelist->show_items;
186 XWindowAttributes attrs;
187 XGetWindowAttributes(listview->
app->
dpy, (Window)listview->
widget, &attrs);
188 int width = attrs.width;
189 XResizeWindow (w->
app->
dpy, w->
widget, width, 25*(
max(1,filelist->list_size)));
196 XWindowAttributes attrs;
197 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
198 if (attrs.map_state != IsViewable)
return;
199 int width = attrs.width;
200 int height = attrs.height;
203 cairo_rectangle(w->
crb, width-5,0,5,height);
204 cairo_fill_preserve(w->
crb);
208 cairo_rectangle(w->
crb, width-5,(height-10)*sliderstate,5,10);
209 cairo_fill_preserve(w->
crb);
211 cairo_set_line_width(w->
crb,1);
212 cairo_stroke(w->
crb);
void _leave_list(void *w_, void *user_data)
_leave_list - draw list on pointer leave
void use_text_color_scheme(Widget_t *w, Color_state st)
use_text_color_scheme - use text Colors to paint on Widget_t
void _configure_listview(void *w_, void *user_data)
_configure_listview - configure the viewport on mapping
float adj_get_state(Adjustment_t *adj)
adj_get_state - get the current state of the Adjustment_t
void use_shadow_color_scheme(Widget_t *w, Color_state st)
use_shadow_color_scheme - use shadow Colors to paint on Widget_t
void _list_motion(void *w_, void *xmotion_, void *user_data)
_list_motion - follow mouse pointer to set prelight item
float adj_get_value(Adjustment_t *adj)
adj_get_value - get the current value of the Adjustment_t
void adj_set_value(Adjustment_t *adj, float value)
adj_set_value - set the current value to 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 _draw_list(void *w_, void *user_data)
_draw_list - draw list on expose call
void _reconfigure_listview_viewport(void *w_, void *user_data)
_reconfigure_listview_viewport - reconfigure the viewport adjustment on size changes
void _list_entry_released(void *w_, void *button_, void *user_data)
_list_entry_released - move listview or set active entry
void _list_key_pressed(void *w_, void *xkey_, void *user_data)
_list_key_pressed - move listview or set active entry
void use_frame_color_scheme(Widget_t *w, Color_state st)
use_frame_color_scheme - use frame Colors to paint on Widget_t
void _draw_listview_viewslider(void *w_, void *user_data)
_draw_listview_viewslider - draw a slider on the viewport to indicate the view point
void adj_set_state(Adjustment_t *adj, float state)
adj_set_state - set the current state of the Adjustment_t
void set_pattern(Widget_t *w, Colors *from, Colors *to, Color_mod mod)
set_pattern - set pattern for the selected Colors
void _draw_listview(void *w_, void *user_data)
_draw_listview - draw listview on expose call
void _set_listview_viewpoint(void *w_, void *user_data)
_set_listview_viewpoint - move the view_port to position
#define max(x, y)
max - set a minimal value (x) as return value
ViewList_t - struct to hold information for the listview.
void use_base_color_scheme(Widget_t *w, Color_state st)
use_base_color_scheme - use base Colors to paint on Widget_t