_draw_valuedisplay - draw a valuedisplay on expose call
- Parameters
-
*w_ | - The Widget_t contain the valuedisplay |
*user_data | - attached user_data |
- Returns
- void
Definition at line 25 of file xvaluedisplay_private.c.
28 XWindowAttributes attrs;
29 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
30 int width = attrs.width-2;
31 int height = attrs.height-2;
32 if (attrs.map_state != IsViewable)
return;
34 cairo_rectangle(w->
crb,2.0, 2.0, width, height);
37 cairo_set_line_width(w->
crb, 1.0);
39 cairo_fill_preserve(w->
crb);
41 }
else if(w->
state==1) {
43 cairo_fill_preserve(w->
crb);
44 cairo_set_line_width(w->
crb, 1.5);
46 }
else if(w->
state==2) {
48 cairo_fill_preserve(w->
crb);
49 cairo_set_line_width(w->
crb, 1.0);
51 }
else if(w->
state==3) {
53 cairo_fill_preserve(w->
crb);
54 cairo_set_line_width(w->
crb, 1.0);
56 }
else if(w->
state==4) {
58 cairo_fill_preserve(w->
crb);
59 cairo_set_line_width(w->
crb, 1.0);
64 cairo_rectangle(w->
crb,4.0, 4.0, width, height);
66 cairo_rectangle(w->
crb,3.0, 3.0, width, height);
69 cairo_text_extents_t extents;
72 const char* format[] = {
"%.1f ",
"%.2f ",
"%. Hz"};
74 snprintf(s, 63, format[2-1], value);
79 cairo_set_font_size (w->
crb, font_size);
80 cairo_text_extents(w->
crb,s , &extents);
81 cairo_move_to (w->
crb, (width-extents.width)*0.5, (height+extents.height)*0.55);
82 cairo_show_text(w->
crb, s);
83 cairo_new_path (w->
crb);
References ACTIVE_, Widget_t::adj, adj_get_value(), Widget_t::app, Resize_t::ascale, Widget_t::crb, Xputty::dpy, get_color_state(), INSENSITIVE_, NORMAL_, Xputty::normal_font, PRELIGHT_, Widget_t::scale, SELECTED_, Widget_t::state, use_frame_color_scheme(), use_shadow_color_scheme(), use_text_color_scheme(), and Widget_t::widget.