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.
76
2001/
02
/
02
13:
03
:
15
per
Exp $";
+
constant cvs_version = "$Id: gbutton.pike,v 1.
77
2001/
03
/
07
13:
40
:
43
kuntri
Exp $";
constant thread_safe = 1; #include <module.h> inherit "module"; roxen.ImageCache button_cache; constant module_type = MODULE_TAG; constant module_name = "GButton"; constant module_doc = "Provides the <tt><gbutton></tt> tag that is used to draw graphical " "buttons."; mapping tagdocumentation() { Stdio.File file=Stdio.File(); if(!file->open(__FILE__,"r")) return 0; string doc=compile_string("#define manual\n"+file->read())->gbuttonattr; string imagecache=button_cache->documentation();
-
return ([
"gbutton":"<desc cont><short>Creates graphical buttons.</short> </desc>"
+
return ([
-
+
"gbutton":#"<desc cont='cont'><p><short>
+
Creates graphical buttons.</short></p>
+
</desc>"
+
+doc +imagecache,
-
"gbutton-url":#"<desc><short>Generates an URI to the button.</short>
-
<tag>gbutton-url</tag> takes the same attributes as <
tag>
gbutton
</
tag>
-
including the image cache attributes.</desc>"
+
"gbutton-url":#"<desc
cont='cont'
><
p><
short>
+
Generates an URI to the button.</short>
<tag>gbutton-url</tag> takes
+
the same attributes as <
xref href='gbutton.
tag
'
/>
including the
+
image cache attributes.</
p>
+
</
desc>"
+doc +imagecache, ]); } #ifdef manual constant gbuttonattr=#"
-
<attr name='pagebgcolor' value='color'>
+
<attr name='pagebgcolor' value='color'>
<p></p>
</attr>
-
<attr name='bgcolor' value='color'>
-
Background color inside and outside button.
+
<attr name='bgcolor' value='color'>
<p>
+
Background color inside and outside button.
</p>
<ex> <gbutton bgcolor='lightblue'>Background</gbutton> </ex> </attr>
-
<attr name='textcolor' value='color'>
-
Button text color
+
<attr name='textcolor' value='color'>
<p>
+
Button text color
.</p>
<ex> <gbutton textcolor='#ff6600'>Text</gbutton> </ex> </attr>
-
<attr name=frame-image value='path'>
+
<attr name=
'
frame-image
'
value='path'>
<p>
Use this XCF-image as a frame for the button. The image is required to have at least the following layers: background, mask and frame. More information on how to create frame images can be found in the
-
Roxen documentation; Web Site Creator/Graphical tags section.
+
Roxen documentation; Web Site Creator/Graphical tags section.
</p>
<ex> <gbutton frame-image='internal-roxen-tabframe'>foo</gbutton> </ex> </attr>
-
<attr name='alt' value='string'>
-
Alternative button and alt text.
+
<attr name='alt' value='string'>
<p>
+
Alternative button and alt text.
</p>
</attr>
-
<attr name='href' value='uri'>
-
Button URI.
+
<attr name='href' value='uri'>
<p>
+
Button URI.
</p>
</attr>
-
<attr name='textstyle' value='normal|condensed'>
-
Set to <att>normal</att> or <att>condensed</att> to alter text style.
+
<attr name='textstyle' value='normal|condensed'>
<p>
+
Set to <att>normal</att> or <att>condensed</att> to alter text style.
</p>
</attr>
-
<attr name='width' value=''>
-
Minimum button width.
+
<attr name='width' value=''>
<p>
+
Minimum button width.
</p>
</attr>
-
<attr name='align' value='left|center|right'>
+
<attr name='align' value='left|center|right'>
<p>
Set text alignment. There are some alignment restrictions: when text alignment is either <att>left</att> or <att>right</att>, icons must
-
also be aligned <att>left</att> or <att>right</att>.
+
also be aligned <att>left</att> or <att>right</att>.
</p>
</attr>
-
<attr name='state' value='enabled|disabled'>
-
Set to <att>enabled</att> or <att>disabled</att> to select button state.
+
<attr name='state' value='enabled|disabled'>
<p>
+
Set to <att>enabled</att> or <att>disabled</att> to select button state.
</p>
</attr>
-
<attr name='icon-src' value='URI'>
-
Fetch the icon from this URI.
+
<attr name='icon-src' value='URI'>
<p>
+
Fetch the icon from this URI.
</p>
</attr>
-
<attr name='icon-data' value=''>
-
Inline icon data.
+
<attr name='icon-data' value=''>
<p>
+
Inline icon data.
</p>
</attr>
-
<attr name='align-icon' value='left|center-before|center-after|right'>
-
Set icon alignment.
+
<attr name='align-icon' value='left|center-before|center-after|right'>
<p>
+
Set icon alignment.
</p>
-
<
table
>
-
<
tr
><
td
>left</
td
><
td
>Place icon on the left side of the text.</
td
></
tr
>
-
<
tr
><
td
>center-before</
td
><
td
>Center the icon before the text.Requires the <att>align='center'</att> attribute.</
td
></
tr
>
-
<
tr
><
td
>center-after</
td
><
td
>Center the icon after the text. Requires the <att>align='center'</att> attribute.</
td
></
tr
>
-
<
tr
><
td
>right</
td
><
td
>Place icon on the right side of the text.</
td
></
tr
>
-
</
table
>
+
<
xtable
>
+
<
row
><
c
>left</
c
><
c
>Place icon on the left side of the text.</
c
></
row
>
+
<
row
><
c
>center-before</
c
><
c
>Center the icon before the text.
Requires the <att>align='center'</att> attribute.</
c
></
row
>
+
<
row
><
c
>center-after</
c
><
c
>Center the icon after the text. Requires the <att>align='center'</att> attribute.</
c
></
row
>
+
<
row
><
c
>right</
c
><
c
>Place icon on the right side of the text.</
c
></
row
>
+
</
xtable
>
<ex> <gbutton width='150' align-icon='center-before' icon-src='internal-roxen-help'>Roxen 2.0</gbutton> </ex> <ex> <gbutton width='150' align='center' align-icon='center-after' icon-src='internal-roxen-help'>Roxen 2.0</gbutton> </ex> </attr>
-
<attr name='valign-icon' value='above|middle|below'>
+
<attr name='valign-icon' value='above|middle|below'>
<p>
Set icon vertical alignment. Requires three horizontal guidelines in the frame image. If set to <att>above</att> the icon is placed between the first and second guidelines and the text between the second and third ones. If set to <att>below</att> the placement is reversed. Default value is
-
<att>middle</att>.
+
<att>middle</att>.
</p>
</attr>
-
<attr name='font' value='fontname'>
+
<attr name='font' value='fontname'>
<p></p>
-
</attr>
-
-
<attr name='extra-layers' value='[''],[first|last],[selected|unselected],[background|mask|frame|left|right]'>
-
-
</attr>
-
-
<attr name='extra-left-layers' value='[''],[first|last],[selected|unselected],[background|mask|frame|left|right]'>
-
-
</attr>
-
-
<attr name='extra-right-layers' value='[''],[first|last],[selected|unselected],[background|mask|frame|left|right]'>
-
-
</attr>
-
-
<attr name='extra-background-layers' value='[''],[first|last],[selected|unselected],[background|mask|frame|left|right]'>
-
-
</attr>
-
-
<attr name='extra-mask-layers' value='[''],[first|last],[selected|unselected],[background|mask|frame|left|right]'>
-
-
</attr>
-
-
<attr name='extra-frame-layers' value='[''],[first|last],[selected|unselected],[background|mask|frame|left|right]'>
-
-
<ex>
-
<gbutton frame-image='gbutton.xcf' alt='foo'>bu</gbutton>
-
</ex>
-
-
-
<ex>
-
<gbutton alt='Edit' bgcolor='#aeaeae'
-
extra-background-layers='unselected background,last unselected background,last background'
-
extra-frame-layers='unselected frame,last unselected frame,last frame'
-
extra-layers='unselected,last unselected,last'
-
extra-left-layers='unselected left,last unselected left,last left'
-
extra-mask-layers='unselected mask,last unselected mask,last mask'
-
extra-right-layers='unselected right,last unselected right,last right' >Buttontext
-
</gbutton>
-
</ex>
-
</attr>
-
-
<!-- <table>
-
<tr><td>A</td><td>B</td><td>C</td></tr>
-
<tr><td>''</td><td>''</td><td>''</td></tr>
-
<tr><td>'first'</td><td>'selected'</td><td>'background'</td></tr>
-
<tr><td>'last'</td><td>'unselected'</td><td>'mask'</td></tr>
-
<tr><td></td><td></td><td>'frame'</td></tr>
-
<tr><td></td><td></td><td>'left'</td></tr>
-
<tr><td></td><td></td><td>'right'</td></tr>
-
</table> -->
";
+
</attr>";
#endif function TIMER( function f ) { #if 0 return lambda(mixed ... args) { int h = gethrtime(); mixed res; werror("Drawing ... "); res = f( @args );