31 for (src = dst = str; *src !=
'\0'; src++) {
46 XWindowAttributes attrs;
47 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
48 int width = attrs.width;
49 int height = attrs.height;
51 cairo_text_extents_t extents;
54 cairo_text_extents(w->
crb,
"A", &extents);
55 double lh = extents.height;
57 if (strstr(w->
label,
"_")) {
58 cairo_text_extents(w->
crb,
"--", &extents);
59 double underline = extents.width;
63 cairo_move_to (w->
crb, (width-extents.width)*0.5, (height+lh)*0.5);
65 cairo_set_line_width(w->
crb, 1.0);
66 cairo_move_to (w->
crb, (width-extents.width)*0.5 + (pos * underline), (height+lh)*0.55);
67 cairo_line_to(w->
crb,(width-extents.width)*0.5 + ((pos+1) * underline), (height+lh)*0.55);
70 cairo_text_extents(w->
crb,w->
label , &extents);
71 cairo_move_to (w->
crb, (width-extents.width)*0.5, (height+lh)*0.5);
75 cairo_new_path (w->
crb);
86 XUngrabPointer(w->
app->
dpy,CurrentTime);
99 XButtonEvent *xbutton = (XButtonEvent*)button_;
115 if (old_value == *(
int*)item_)
126 cairo_paint (w->
crb);
132 XWindowAttributes attrs;
133 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
134 int width = attrs.width;
135 int height = attrs.height;
136 if (attrs.map_state != IsViewable)
return;
139 cairo_rectangle(w->
crb, 0, 0, width , height);
142 }
else if(w->
state==2) {
144 }
else if(w->
state==3) {
147 cairo_fill_preserve(w->
crb);
148 cairo_set_line_width(w->
crb, 1.0);
150 cairo_stroke(w->
crb);
152 cairo_text_extents_t extents;
155 cairo_set_font_size (w->
crb, height/2);
156 cairo_text_extents(w->
crb,w->
label , &extents);
157 cairo_move_to (w->
crb, (width-extents.width)*0.5, (height+extents.height)*0.5);
159 cairo_new_path (w->
crb);
165 XWindowAttributes attrs;
166 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
167 int width = attrs.width;
168 int height = attrs.height;
169 if (attrs.map_state != IsViewable)
return;
172 cairo_rectangle(w->
crb, 0, 0, width , height);
175 }
else if(w->
state==2) {
177 }
else if(w->
state==3) {
180 cairo_fill_preserve(w->
crb);
181 cairo_set_line_width(w->
crb, 1.0);
183 cairo_stroke(w->
crb);
185 cairo_text_extents_t extents;
188 cairo_set_font_size (w->
crb, height/2);
190 if (strstr(w->
label,
"_")) {
191 cairo_text_extents(w->
crb,
"--", &extents);
192 double underline = extents.width;
196 cairo_move_to (w->
crb, (width-extents.width)*0.5, (height+extents.height)*0.5);
198 cairo_set_line_width(w->
crb, 1.0);
199 cairo_move_to (w->
crb, (width-extents.width)*0.5 + (pos * underline), (height+extents.height)*0.55);
200 cairo_line_to(w->
crb,(width-extents.width)*0.5 + ((pos+1) * underline), (height+extents.height)*0.55);
201 cairo_stroke(w->
crb);
203 cairo_text_extents(w->
crb,w->
label , &extents);
204 cairo_move_to (w->
crb, (width-extents.width)*0.5, (height+extents.height)*0.5);
207 cairo_new_path (w->
crb);
213 XWindowAttributes attrs;
214 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
215 int height = attrs.height;
217 cairo_arc(w->
crb, height/3, height/2, height/6, 0, 2 * M_PI );
219 cairo_rectangle(w->
crb, height/6, height/3, height/3 , height/3);
225 cairo_arc(w->
crb, height/3, height/2, height/6-2, 0, 2 * M_PI );
227 cairo_rectangle(w->
crb, height/6+1, height/3+1, height/3-2 , height/3-2);
238 XWindowAttributes attrs;
239 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
240 if (attrs.map_state != IsViewable)
return;
241 int width = attrs.width;
242 int height = attrs.height;
245 cairo_rectangle(w->
crb, width-5,0,5,height);
246 cairo_fill_preserve(w->
crb);
250 cairo_rectangle(w->
crb, width-5,(height-10)*sliderstate,5,10);
251 cairo_fill_preserve(w->
crb);
253 cairo_set_line_width(w->
crb,1);
254 cairo_stroke(w->
crb);
260 XWindowAttributes attrs;
262 int height = attrs.height;
284 XWindowAttributes attrs;
286 int height = attrs.height;
288 int posy = (above) ? parent->
height : 0;
290 XTranslateCoordinates( parent->
app->
dpy, parent->
widget, DefaultRootWindow(parent->
app->
dpy), 0, posy, &x1, &y1, &child );
291 int item_width = 1.0;
292 cairo_text_extents_t extents;
295 bool is_not_scrolable =
false;
298 is_not_scrolable =
true;
302 cairo_set_font_size (w->
crb, height/2);
303 cairo_text_extents(w->
crb,w->
label , &extents);
305 item_width =
max(item_width, (
int)extents.width+40);
309 if(item_width<parent->width)item_width = parent->
width;
311 XResizeWindow (menu->
app->
dpy, menu->
widget, item_width, height*elem);