summaryrefslogtreecommitdiffstats
path: root/src/button.inc
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2009-01-27 17:30:08 +0000
committerPascal Rigaux <pixel@mandriva.com>2009-01-27 17:30:08 +0000
commit5ce8d30439463838f845c78bc926cc9b310a8743 (patch)
treebb1852dc58711c7baee31216a765067dfa49b65b /src/button.inc
parent10658e71475bd964263d09f1a661f24fadfaf496 (diff)
downloadbootloader-theme-5ce8d30439463838f845c78bc926cc9b310a8743.tar
bootloader-theme-5ce8d30439463838f845c78bc926cc9b310a8743.tar.gz
bootloader-theme-5ce8d30439463838f845c78bc926cc9b310a8743.tar.bz2
bootloader-theme-5ce8d30439463838f845c78bc926cc9b310a8743.tar.xz
bootloader-theme-5ce8d30439463838f845c78bc926cc9b310a8743.zip
imported openSUSE.tar.bz2 (from gfxboot-4.1.19-2.1.src.rpm)4.1.19.1
Diffstat (limited to 'src/button.inc')
-rw-r--r--src/button.inc116
1 files changed, 116 insertions, 0 deletions
diff --git a/src/button.inc b/src/button.inc
new file mode 100644
index 0000000..372ef54
--- /dev/null
+++ b/src/button.inc
@@ -0,0 +1,116 @@
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+%
+% button handling
+%
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Button templates.
+%
+% [ x y width height label selected hotkey action ]
+%
+/button.ok { [ 0 0 90 25 txt_ok false 0 0 ] } def
+/button.cancel { [ 0 0 90 25 txt_cancel false keyEsc 0 ] } def
+/button.reboot { [ 0 0 90 25 txt_reboot false 0 0 ] } def
+/button.continue { [ 0 0 90 25 txt_continue false 0 0 ] } def
+% /button.eject { [ 0 0 90 25 "Eject" false 0 0 ] } def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Set default button.
+%
+% ( button ) => ( button )
+%
+/button.default {
+ dup 5 true put
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Make it _not_ the default button.
+%
+% ( button ) => ( button )
+%
+/button.notdefault {
+ dup 5 false put
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Set button position.
+%
+% ( button x y ) ==> ( button )
+%
+/button.moveto {
+ rot dup 0 5 -1 roll put exch over 1 rot put
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Assign action to button.
+%
+% ( button action ) => ( button )
+%
+/button.setaction {
+ over 7 rot put
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Draw button.
+%
+% ( button ) ==> ( )
+%
+/button.show {
+ /bt.x over 0 get def
+ /bt.y over 1 get def
+ /bt.width over 2 get def
+ /bt.height over 3 get def
+ /bt.text over 4 get def
+ /bt.default exch 5 get def
+
+ bt.text strsize
+ bt.height sub neg 2 div /bt.y.textofs exch def
+ bt.width sub neg 2 div /bt.x.textofs exch def
+
+ bt.x bt.y moveto
+ currentpoint currentpoint currentpoint
+
+ currentpoint bt.width bt.height window.current .color.bg get setcolor fillrect moveto
+
+ bt.default {
+ black black
+ } {
+ window.current .color.bg get dup
+ } ifelse
+ bt.width bt.height drawborder
+ moveto 1 1 rmoveto white black bt.width 2 sub bt.height 2 sub drawborder
+ moveto
+ % 2 2 rmoveto white black bt.width 4 sub bt.height 4 sub drawborder
+
+ window.current .color.fg get setcolor
+ moveto bt.x.textofs bt.y.textofs rmoveto bt.text show
+} def
+
+
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+% Press button.
+%
+% ( button ) ==> ( )
+%
+/button.press {
+ /bt.x over 0 get def
+ /bt.y over 1 get def
+ /bt.width over 2 get def
+ /bt.height exch 3 get def
+
+ bt.x 3 add bt.y 3 add moveto
+ bt.width 7 sub bt.height 7 sub savescreen
+ 1 1 rmoveto dup restorescreen free
+
+ bt.x 1 add bt.y 1 add moveto black white bt.width 2 sub bt.height 2 sub drawborder
+ % bt.x 2 add bt.y 2 add moveto black white bt.width 4 sub bt.height 4 sub drawborder
+} def
+
+