Roxen.git
/
server
/
modules
/
graphics
/
gbutton.pike
version
»
Context lines:
10
20
40
80
file
none
3
Roxen.git/server/modules/graphics/gbutton.pike:18:
// icon_src -- icon reference // icon_data -- inline icon data // align -- left|center|right text alignment // align_icon -- left|center_before|center_after|right icon alignment // >Button text</gbutton> // // Alignment restriction: when text alignment is either left or right, icons // must also be aligned left or right.
-
constant cvs_version = "$Id: gbutton.pike,v 1.
9
2000/01/
10
11
:
49
:
12
nilsson
Exp $";
+
constant cvs_version = "$Id: gbutton.pike,v 1.
10
2000/01/
19
19
:
04
:
44
noring
Exp $";
constant thread_safe = 1; #include <module.h> inherit "module"; inherit "roxenlib"; roxen.ImageCache button_cache; Image.Font button_font; Image.Image button_border;
Roxen.git/server/modules/graphics/gbutton.pike:146:
b_height = b->ysize(); // Get icon if (args->icn) icon = roxen.low_load_image(args->icn, id); else if (args->icd) icon = roxen.low_decode_image(args->icd); i_width = icon && (icon->img->xsize() + IMAGE_SPC); // Generate text
+
if (sizeof(text)) {
text_img = button_font->write(text)->scale(0, b_height - IMAGE_SPC); if (args->cnd) text_img = text_img->scale((int) round(text_img->xsize() * 0.8), text_img->ysize()); t_width = text_img->xsize();
-
+
}
// Compute text and icon placement req_width = t_width + b_width + i_width; if (args->wi && (req_width < args->wi)) req_width = args->wi; switch (lower_case(args->al)) { case "left": // Allow icon alignment: left, right switch (lower_case(args->ica)) { case "left":
Roxen.git/server/modules/graphics/gbutton.pike:245:
icon->alpha = icon->img->clone()->clear(({255,255,255})); if (args->dim) icon->alpha *= 0.3; button->paste_mask(icon->img, icon->alpha, icn_x, icn_y); } // Draw text if (args->dim) for (int i = 0; i < 3; i++) args->txt[i] = (args->txt[i] + args->bg[i]) / 2;
+
if(text_img)
button->paste_alpha_color(text_img, args->txt, txt_x, 2); return button; } mapping find_internal(string f, RequestID id) { return button_cache->http_file_answer(f, id); }