1 # vim: foldmarker=<<<,>>>
4 inherit tlc::Mywidget tlc::Baselog
8 itk_option define -width width Width 120
9 itk_option define -pady padY PadY 20
13 variable activebackground
15 method addpanel {name {id ""}}
16 method panel_exists {id}
17 method additem {panel idinfo {image {}}}
27 method attach_signal {panel item signal {sense normal}}
33 variable open_panel ""
44 configbody tlc::Panelbar::activebackground { #<<<1
46 option add *$wdb*activeBackground $activebackground
50 body tlc::Panelbar::constructor {args} { #<<<1
54 tlc::Domino #auto dominos(need_redraw) -name "$w need_redraw"
56 itk_component add canv {
59 keep -borderwidth -relief -background
62 eval itk_initialize $args
64 $w.canv yview moveto 0.0
65 $w.canv xview moveto 0.0
68 $w.canv 1,1 -fill both -width $itk_option(-width)
70 bind $w.canv <Configure> [code $this redraw]
72 $dominos(need_redraw) attach_output [code $this _redraw]
76 body tlc::Panelbar::addpanel {name {id ""}} { #<<<1
82 set last [Panelbar_Panel ::#auto -parent $this \
83 -id $id -name $name -previous $last -canv $w.canv]
84 set panel_obj($id) $last
88 body tlc::Panelbar::panel_exists {id} { #<<<1
90 return [info exists panel_obj($id)]
94 body tlc::Panelbar::additem {panel idinfo {image {}}} { #<<<1
96 if {![info exists panel_obj($panel)]} {
97 #error "No such panel: ($panel)"
102 set image [$::tlc::theme get_icon default_panelbar_icon]
107 foreach {name id} $idinfo break
113 $panel_obj($panel) additem $name $id $image \
114 -pady $itk_option(-pady)
118 body tlc::Panelbar::open {id} { #<<<1
124 body tlc::Panelbar::width {} { #<<<1
126 return [expr {$itk_option(-width) - 4}]
127 return [expr {[winfo reqwidth $w.canv] - 2}]
131 body tlc::Panelbar::bottom_y {} { #<<<1
133 blt::table arrange $w
135 blt::table arrange $w
137 set ext_info [blt::table extents $w c1]
138 #if {[package vsatisfies $::blt_version 3.0]}
139 switch -- [llength $ext_info] {
140 6 {foreach {id foo x y wd ht} $ext_info break}
141 5 {foreach {id x y wd ht} $ext_info break}
142 default {error "Bad table extent format: ($ext_info)"}
145 return [expr {$ht - 1 - 4}]
149 body tlc::Panelbar::get_open {} { #<<<1
155 body tlc::Panelbar::new_open {obj} { #<<<1
157 #puts "tlc::Panelbar::new_open: ($obj)"
158 #foreach v {last_obj this_obj next_obj} {
159 # puts "$v: ([set $v])"
161 set last_obj $this_obj
169 body tlc::Panelbar::select {id} { #<<<1
171 if {$select_cb != ""} {
172 uplevel #0 $select_cb [list $id]
177 body tlc::Panelbar::redraw {} { #<<<1
179 $dominos(need_redraw) tip
183 body tlc::Panelbar::_redraw {} { #<<<1
185 foreach {key obj} [array get panel_obj] {
191 body tlc::Panelbar::attach_signal {panel item signal {sense normal}} { #<<<1
193 [$panel_obj($panel) item_ref $item] attach_signal $signal $sense