28 cairo_pattern_t *pat = cairo_pattern_create_linear (2, 2, width, 2);
29 cairo_pattern_add_color_stop_rgba(pat, 0.0, c->
base[0], c->
base[1], c->
base[2], c->
base[3]);
30 cairo_pattern_add_color_stop_rgba(pat, 0.5, 0.0, 0.0, 0.0, 0.0);
31 cairo_pattern_add_color_stop_rgba(pat, 1.0, c->
base[0], c->
base[1], c->
base[2], c->
base[3]);
32 cairo_set_source(w->
crb, pat);
33 cairo_pattern_destroy (pat);
39 cairo_pattern_t *pat = cairo_pattern_create_linear (2, 2, 2, height);
40 cairo_pattern_add_color_stop_rgba(pat, 0.0, c->
base[0], c->
base[1], c->
base[2], c->
base[3]);
41 cairo_pattern_add_color_stop_rgba(pat, 0.5, 0.0, 0.0, 0.0, 0.0);
42 cairo_pattern_add_color_stop_rgba(pat, 1.0, c->
base[0], c->
base[1], c->
base[2], c->
base[3]);
43 cairo_set_source(w->
crb, pat);
44 cairo_pattern_destroy (pat);
49 XWindowAttributes attrs;
50 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
51 int width = attrs.width-2;
52 int height = attrs.height-2;
53 float center = (float)width/2;
54 float upcenter = (float)width;
56 if (attrs.map_state != IsViewable)
return;
61 cairo_move_to (w->
crb, center, center);
62 cairo_line_to(w->
crb,center,height-center-10);
63 cairo_set_line_cap (w->
crb,CAIRO_LINE_CAP_ROUND);
64 cairo_set_line_width(w->
crb,center);
68 cairo_move_to (w->
crb, center, center);
69 cairo_line_to(w->
crb,center,height-center-10);
70 cairo_set_line_width(w->
crb,center/10);
74 cairo_arc(w->
crb,center, (height-center-10) -
75 ((height-10-upcenter) * sliderstate), center/2, 0, 2 * M_PI );
76 cairo_fill_preserve(w->
crb);
77 cairo_set_line_width(w->
crb,1);
82 cairo_arc(w->
crb,center, (height-center-10) -
83 ((height-10-upcenter) * sliderstate), center/3, 0, 2 * M_PI );
84 cairo_fill_preserve(w->
crb);
86 cairo_set_line_width(w->
crb,center/15);
88 cairo_new_path (w->
crb);
90 cairo_text_extents_t extents;
94 cairo_set_font_size (w->
crb, center/1.8);
95 cairo_text_extents(w->
crb,w->
label , &extents);
97 cairo_move_to (w->
crb, center-extents.width/2, height-center/2.1);
99 cairo_new_path (w->
crb);
102 const char* format[] = {
"%.1f",
"%.2f",
"%.3f"};
105 snprintf(s, 63,
"%d", (
int) value);
106 }
else if (fabs(w->
adj->
step)>0.09) {
107 snprintf(s, 63, format[1-1], value);
109 snprintf(s, 63, format[2-1], value);
111 cairo_text_extents(w->
crb,s , &extents);
112 cairo_move_to (w->
crb, center-extents.width/2, extents.height );
113 cairo_show_text(w->
crb, s);
114 cairo_new_path (w->
crb);
119 XWindowAttributes attrs;
120 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
121 int width = attrs.width-2;
122 int height = attrs.height-2;
123 float center = (float)height/2;
124 float upcenter = (float)height;
126 if (attrs.map_state != IsViewable)
return;
131 cairo_move_to (w->
crb, center, center);
132 cairo_line_to(w->
crb,width-center-10,center);
133 cairo_set_line_cap (w->
crb,CAIRO_LINE_CAP_ROUND);
134 cairo_set_line_width(w->
crb,center);
135 cairo_stroke(w->
crb);
138 cairo_move_to (w->
crb, center, center);
139 cairo_line_to(w->
crb,width-center-10,center);
140 cairo_set_line_width(w->
crb,center/10);
141 cairo_stroke(w->
crb);
144 cairo_arc(w->
crb, (center) +
145 ((width-10-upcenter) * sliderstate),center, center/2, 0, 2 * M_PI );
146 cairo_fill_preserve(w->
crb);
147 cairo_set_line_width(w->
crb,1);
148 cairo_stroke(w->
crb);
151 cairo_arc(w->
crb, (center) +
152 ((width-10-upcenter) * sliderstate),center, center/3, 0, 2 * M_PI );
153 cairo_fill_preserve(w->
crb);
155 cairo_set_line_width(w->
crb,center/15);
156 cairo_stroke(w->
crb);
157 cairo_new_path (w->
crb);
159 cairo_text_extents_t extents;
164 cairo_text_extents(w->
crb,w->
label , &extents);
166 cairo_move_to (w->
crb, width/2-extents.width/2, height );
168 cairo_new_path (w->
crb);
172 const char* format[] = {
"%.1f",
"%.2f",
"%.3f"};
175 snprintf(s, 63,
"%d", (
int) value);
176 }
else if (fabs(w->
adj->
step)>0.09) {
177 snprintf(s, 63, format[1-1], value);
179 snprintf(s, 63, format[2-1], value);
181 cairo_text_extents(w->
crb,s , &extents);
182 cairo_move_to (w->
crb, width/2-extents.width/2, extents.height );
183 cairo_show_text(w->
crb, s);
184 cairo_new_path (w->
crb);