X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=chiark-tcl-applet.git;a=blobdiff_plain;f=example;h=b9f1c64a966cc614c720c41e90ba20b42fa46775;hp=fe9794341f67fdb751d7e7f7a2b7e12198a35b38;hb=8bb8186db142691bfb06753a00f2fb0ddc199e29;hpb=d6c1639412fcfd0e262af10918fe88da2b8029eb diff --git a/example b/example index fe97943..b9f1c64 100755 --- a/example +++ b/example @@ -1,49 +1,28 @@ -#!/usr/bin/wish8.4 +#!/usr/bin/wish8.4 -f +# -*- Tcl -*- -#----- general machinery ----- +source applet.tcl +source subproc.tcl -package require tktray - -wm withdraw . - -image create bitmap ims -file /usr/share/ghostscript/8.71/lib/gs_s.xbm - -tktray::icon .i -class example -.i configure -docked 1 - -set posted 0 +#----- menu ----- foreach b {1 3} { - menu .m$b -tearoff 0 + applet::setup-button-menu $b } -proc pressed {b x y} { - global posted - if {$posted == $b} { - puts "unpost $posted toggle" - .m$posted unpost - set posted 0 - } elseif {[winfo exists .m$b]} { - if {$posted} { - .m$posted unpost - puts "unpost $posted other" - } - puts "post $b" - set posted $b - .m$b post $x $y - } -} - -proc msel {} { - global posted - set posted 0 -} +.m1 add command -command { applet::msel; puts hi } -label hi +.m3 add command -command { applet::msel; puts boo } -label boo -bind .i { pressed %b %X %Y } +#image create bitmap ims -file gs_s.xbm +#image create bitmap ims -file /usr/share/ghostscript/8.71/lib/gs_s.xbm +#setimage ims +#setimage ims -#----- specifics ----- +applet::setup-tooltip { puts VIS } { puts INVIS } +applet::tooltip-set "line\nanother" -.i configure -image ims -.m1 add command -command { msel; puts hi } -label hi -.m3 add command -command { msel; puts boo } -label boo +proc cmdline {id} { + return [list xacpi-simple -into $id] +} +applet::setup-subproc 40 cmdline