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.
3
1999/11/15 16:
30
:
33
jonasw
Exp $";
+
constant cvs_version = "$Id: gbutton.pike,v 1.
4
1999/11/15 16:
42
:
40
per
Exp $";
constant thread_safe = 1; #include <module.h> inherit "module"; inherit "roxenlib"; roxen.ImageCache button_cache; object button_font = resolve_font("haru 32"); object button_border;
Roxen.git/server/modules/graphics/gbutton.pike:95:
mapping query_tag_callers() { return ([ ]); } mapping query_container_callers() {
-
return ([ "gbutton" : tag_button ]);
+
return ([ "gbutton" : tag_button
,
"gbutton-url" : tag_button
]);
} object(Image.Image)|mapping draw_button(mapping args, string text, object id) { Image.Image text_img, b, tmp, button; int req_width, b_width, b_height, t_width, i_width, icn_x, txt_x; mapping icon; // Colorize borders
Roxen.git/server/modules/graphics/gbutton.pike:271:
]); new_args->quant = args->quant || 128; foreach(glob("*-*", indices(args)), string n) new_args[n] = args[n]; string img_src = query_internal_location() + button_cache->store( ({ new_args, contents }), id);
+
if( tag == "gbutton-url" )
+
return img_src;
+
mapping img_attrs = ([ "src" : img_src, "alt" : args->alt || contents, "border" : args->border, "hspace" : args->hspace, "vspace" : args->vspace ]); if (mapping size = button_cache->metadata(new_args, id, 1)) { // Image in cache (1 above prevents generation on-the-fly, i.e. // first image will lack sizes). img_attrs->width = size->xsize; img_attrs->height = size->ysize; } // Make button clickable if not dimmed if (args->href && !args->dim) return make_container("a", ([ "href" : args->href ]), make_tag("img", img_attrs)); else return make_tag("img", img_attrs); }