#
# Alternatively of icon, it may provide other arrangements for
# using the provided subwindow. Such a caller should call
-# applet::setup-subwindow WIDTH BORDER-COLOUR BORDER-WIDTH \
+# applet::setup-subwindow \
+# WIDTH HEIGHT DEFAULT-ORIENTATION BORDER-COLOUR BORDER-WIDTH \
# ON-DESTROYING ON-READY
# Then the main code will call ON-DESTROYING just before
-# destroying the inner window and recreating it, and ON-READY
+# destroying the inner window and recreating it, and
+# [concat ON-READY [list ORIENTATION]]
# just after. The inner window to use is called .i.i.b.
#
# The user of the subwindow machinery may call
#
# Alternatively, it may request that a subprocess be spawned
# repeatedly with the xid of a suitable window.
-# applet::setup-subproc WIDTH BORDER-COLOUR BORDER-WIDTH \
+# applet::setup-subproc \
+# WIDTH HEIGHT DEFAULT-ORIENTATION BORDER-COLOUR BORDER-WIDTH \
# GET-CMDLINE
-# Then the main code will call [concat GET_CMDLINE [list XID]]
+# Then the main code will call [concat GET_CMDLINE [list XID ORIENTATION]]
# to get the command line to run.
wm withdraw .
variable subwindow_on_ready
variable subwindow_border_colour
variable subwindow_border_width
+ variable subwindow_default_orientation
unset innerwindow_after
debug RESETUP
uplevel #0 $subwindow_on_destroying
catch { destroy .i.i.b }
+ set orientation [.i orientation]
+ debug "orientation $orientation"
+ if {![string compare $orientation unknown]} {
+ set orientation $subwindow_default_orientation
+ }
+ .i configure -image applet::innerwindow-ph-$orientation
+
frame .i.i.b -background darkblue -bd 1
pack .i.i.b -fill both -side left -expand 1
- uplevel #0 $subwindow_on_ready
+ uplevel #0 $subwindow_on_ready [list $orientation]
}
-proc setup-subwindow {w border_colour border_width on_destroying on_ready} {
- foreach v {border_width border_colour on_destroying on_ready} {
+proc setup-subwindow {
+ w h default_orientation border_colour border_width on_destroying on_ready
+} {
+ foreach v {
+ default_orientation border_width border_colour on_destroying on_ready
+ } {
variable subwindow_$v [set $v]
}
- image create photo applet::innerwindow-ph-dummy -width $w -height 2
- .i configure -image applet::innerwindow-ph-dummy
+ image create photo applet::innerwindow-ph-horizontal -width $w -height 2
+ image create photo applet::innerwindow-ph-vertical -width 2 -height $h
+ .i configure -image applet::innerwindow-ph-horizontal
destroy [frame .i.make-exist]
destroy [frame .i.i.make-exist]
variable subproc none
variable ratelimit {}
-proc setup-subproc {w border_colour border_width get_cmdline} {
+proc setup-subproc {w h deforient border_colour border_width get_cmdline} {
variable subproc_get_cmdline $get_cmdline
- setup-subwindow $w $border_colour $border_width \
+ setup-subwindow $w $h $deforient $border_colour $border_width \
applet::subproc-destroying applet::subproc-ready
}
}
}
-proc subproc-ready {} {
+proc subproc-ready {orientation} {
variable subproc
+ variable subproc_orientation $orientation
debug "READY $subproc"
frame .i.i.b.c -container 1 -background orange
variable subproc
variable ratelimit
variable subproc_get_cmdline
+ variable subproc_orientation
set id [winfo id .i.i.b.c]
- set cmd [uplevel #0 [concat [list $subproc_get_cmdline] $id]]
+ set cmd [uplevel #0 $subproc_get_cmdline [list $id $subproc_orientation]]
debug "RUN-CHILD $subproc"
set now [clock seconds]