27 cairo_move_to (cr, x, (y + height)/2);
28 cairo_curve_to (cr, x ,y, x, y, (x + width)/2, y);
29 cairo_curve_to (cr, width, y, width, y, width, (y + height)/2);
30 cairo_curve_to (cr, width, height, width, height, (width + x)/2, height);
31 cairo_curve_to (cr, x, height, x, height, x, (y + height)/2);
32 cairo_close_path (cr);
38 cairo_pattern_t *pat = cairo_pattern_create_linear (2, 2, 2, height);
40 cairo_pattern_add_color_stop_rgba(pat, 0.5, 0.0, 0.0, 0.0, 0.0);
42 cairo_set_source(w->
crb, pat);
43 cairo_pattern_destroy (pat);
49 cairo_pattern_t *pat = cairo_pattern_create_linear (2, 2, 2, height);
50 cairo_pattern_add_color_stop_rgba(pat, 0.0, 0.0, 0.0, 0.0, 0.0);
52 cairo_pattern_add_color_stop_rgba(pat, 1.0, 0.0, 0.0, 0.0, 0.0);
53 cairo_set_source(w->
crb, pat);
54 cairo_pattern_destroy (pat);
60 double half_width = (width/height >=2) ? width*0.5 : width;
61 double x = (double)width_t/(
double)(half_width);
62 double y = (double)height_t/(
double)height;
63 double x1 = (double)height/(
double)height_t;
64 double y1 = (double)(half_width)/(double)width_t;
65 double off_set = offset*x1;
67 int findex = (int)(((width/height)-1) * buttonstate) * (width/height >=2);
68 cairo_scale(w->
crb, x,y);
69 cairo_set_source_surface (w->
crb, w->
image, -height*findex+off_set, off_set);
70 cairo_rectangle(w->
crb,0, 0, height, height);
72 cairo_scale(w->
crb, x1,y1);
78 double x = (double)width_t/(
double)height;
79 double y = (double)height/(
double)width_t;
81 int findex = (int)(((width/height)-1) * buttonstate);
82 cairo_scale(w->
crb, x,x);
83 cairo_set_source_surface (w->
crb, w->
image, -height*findex, 0);
84 cairo_rectangle(w->
crb,0, 0, height, height);
86 cairo_scale(w->
crb, y,y);
87 cairo_text_extents_t extents;
92 }
else if(w->
state==1) {
94 }
else if(w->
state==2) {
96 }
else if(w->
state==3) {
104 cairo_move_to (w->
crb, (width_t*0.5)-(extents.width/2), height_t-(extents.height/4));
107 cairo_text_extents(w->
crb,w->
label , &extents);
108 cairo_move_to (w->
crb, (width_t*0.5)-(extents.width/2), height_t-(extents.height/4));
111 cairo_new_path (w->
crb);
119 int width = metrics.
width-2;
120 int height = metrics.
height-2;
122 if(strlen(w->
label)) {
139 cairo_set_line_width(w->
crb, 1.0);
141 cairo_fill_preserve(w->
crb);
143 }
else if(w->
state==1) {
145 cairo_fill_preserve(w->
crb);
146 cairo_set_line_width(w->
crb, 1.5);
148 }
else if(w->
state==2) {
150 cairo_fill_preserve(w->
crb);
151 cairo_set_line_width(w->
crb, 1.0);
153 }
else if(w->
state==3) {
155 cairo_fill_preserve(w->
crb);
156 cairo_set_line_width(w->
crb, 1.0);
159 cairo_stroke(w->
crb);
163 cairo_stroke(w->
crb);
165 cairo_stroke(w->
crb);
166 }
else if (w->
state==3) {
168 cairo_stroke(w->
crb);
178 for (src = dst = str; *src !=
'\0'; src++) {
196 int width = metrics.
width-2;
197 int height = metrics.
height-2;
203 }
else if(w->
state==1) {
205 }
else if(w->
state==2) {
207 }
else if(w->
state==3) {
212 if(strlen(w->
label)) {
225 int width = metrics.
width-2;
226 int height = metrics.
height-2;
233 }
else if(w->
state==1) {
235 }
else if(w->
state==2) {
237 }
else if(w->
state==3) {
241 if(strlen(w->
label)) {
248 cairo_text_extents_t extents;
252 if (strstr(w->
label,
"_")) {
253 cairo_text_extents(w->
crb,
"--", &extents);
254 double underline = extents.width;
259 int set_line = (extents.width/len) * pos;
260 cairo_move_to (w->
crb, (width-extents.width)*0.5 +offset, (height+extents.height)*0.5 +offset);
262 cairo_set_line_width(w->
crb, 1.0);
263 cairo_move_to (w->
crb, (width-extents.width)*0.5 +offset + set_line, (height+extents.height)*0.55 +offset);
264 cairo_line_to(w->
crb,(width-extents.width)*0.5 +offset + set_line + underline, (height+extents.height)*0.55 +offset);
265 cairo_stroke(w->
crb);
267 cairo_text_extents(w->
crb,w->
label , &extents);
268 cairo_move_to (w->
crb, (width-extents.width)*0.5 +offset, (height+extents.height)*0.5 +offset);
279 int width = metrics.
width-2;
280 int height = metrics.
height-2;
286 cairo_text_extents_t extents;
289 }
else if(w->
state==1) {
291 }
else if(w->
state==2) {
293 }
else if(w->
state==3) {
304 cairo_text_extents(w->
crb,w->
label , &extents);
305 if(IS_UTF8(w->
label[0])) {
307 cairo_text_extents(w->
crb,w->
label , &extents);
310 cairo_move_to (w->
crb, (width-extents.width)*0.5 +offset, (height+extents.height)*0.5 +offset);
312 cairo_new_path (w->
crb);
321 int width = metrics.
width-2;
322 int height = metrics.
height-2;
329 }
else if(w->
state==1) {
331 }
else if(w->
state==2) {
333 }
else if(w->
state==3) {
346 int width = metrics.
width-2;
347 int height = metrics.
height-2;
363 cairo_set_line_width(w->
crb, 2.5);
364 cairo_move_to(w->
crb, wa+offset, h+offset);
365 cairo_line_to(w->
crb, wa1+offset, h1+offset);
366 cairo_line_to(w->
crb, wa2+offset, h+offset);
367 cairo_stroke(w->
crb);
370 cairo_new_path (w->
crb);
379 int height = metrics.
height-2;
391 int wa1 = height/2.2;
393 int wa2 = height/2.8;
395 cairo_set_line_width(w->
crb, 2.5);
396 cairo_move_to(w->
crb, wa+offset, h+offset);
397 cairo_line_to(w->
crb, wa1+offset, h1+offset);
398 cairo_line_to(w->
crb, wa2+offset, h+offset);
399 cairo_stroke(w->
crb);
402 cairo_new_path (w->
crb);
404 cairo_text_extents_t extents;
407 cairo_text_extents(w->
crb,w->
label , &extents);
408 cairo_move_to (w->
crb, height+5 , (height+extents.height)*0.5 );
410 cairo_new_path (w->
crb);
447 if (xbutton->
button == Button1) value = value ?
Color_t - struct used to set cairo color for Widget_t.
Metrics_t - struct to receive window size, position & visibility Pass this struct to os_get_window_...
void adj_set_value(Adjustment_t *adj, float value)
adj_set_value - set the current value to the Adjustment_t
float adj_get_value(Adjustment_t *adj)
adj_get_value - get the current value of the Adjustment_t
float adj_get_state(Adjustment_t *adj)
adj_get_state - get the current state of the Adjustment_t
void use_frame_color_scheme(Widget_t *w, Color_state st)
use_frame_color_scheme - use frame Colors to paint on Widget_t
Color_state get_color_state(Widget_t *wid)
get_color_state - get the Color_state to use in relation to the Widget_t state
void use_text_color_scheme(Widget_t *w, Color_state st)
use_text_color_scheme - use text Colors to paint on Widget_t
void use_fg_color_scheme(Widget_t *w, Color_state st)
use_fg_color_scheme - use forground Colors to paint on Widget_t
Colors * get_color_scheme(Widget_t *wid, Color_state st)
get_color_scheme - get pointer to the Colors struct to use in relation to the Color_state
Color_state
Color_state - select color mode to use on Widget_t.