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-data -- inline icon data // align -- left|center|right text alignment // align-icon -- left|center-before|center-after|right icon alignment // valign-icon -- above|middle|below icon vertical 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.
93
2001
/
10
/
09
16
:
58
:
44
nilsson
Exp $";
+
constant cvs_version = "$Id: gbutton.pike,v 1.
94
2002
/
04
/
15
08
:
53
:
48
jonasw
Exp $";
constant thread_safe = 1; #include <module.h> inherit "module"; roxen.ImageCache button_cache; int do_ext; constant module_type = MODULE_TAG; constant module_name = "Graphics: GButton";
Roxen.git/server/modules/graphics/gbutton.pike:381:
text_img = text_img->scale(0, text_height ); else { int o = text_img->ysize() - text_height; top -= o; middle -= o/2; } if (args->cnd) text_img = text_img->scale((int) round(text_img->xsize() * 0.8), text_img->ysize());
-
}
+
}
else
+
text_height = 0;
int t_width = text_img && text_img->xsize(); // Compute text and icon placement. Only incorporate icon width/spacing if // it's placed inline with the text. req_width = t_width + left + right; if ((args->icva || "middle") == "middle") req_width += i_width + i_spc; if (args->wi && (req_width < args->wi)) req_width = args->wi;
Roxen.git/server/modules/graphics/gbutton.pike:403:
int icn_x, icn_y, txt_x, txt_y; // Are text and icon lined up or on separate lines? switch (args->icva) { case "above": case "below": // Note: This requires _three_ guidelines! Icon and text can only be // horizontally centered icn_x = left + (req_width - right - left - i_width) / 2; txt_x = left + (req_width - right - left - t_width) / 2;
-
if (args->icva == "above") {
+
if (args->icva == "above"
|| !text_height
) {
txt_y = middle;
-
icn_y = top + (middle - top - i_height) / 2;
+
icn_y = top + (
(text_height ?
middle
: bottom)
- top - i_height) / 2;
} else { txt_y = top; icn_y = middle + (bottom - middle - i_height) / 2; } break; default: case "middle": // Center icon vertically on same line as text icn_y = icon && (frame->ysize() - icon->img->ysize()) / 2;