/usr/share/tcltk/bwidget1.9.7/titleframe.tcl is in bwidget 1.9.7-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | # ------------------------------------------------------------------------------
# titleframe.tcl
# This file is part of Unifix BWidget Toolkit
# ------------------------------------------------------------------------------
# Index of commands:
# - TitleFrame::create
# - TitleFrame::configure
# - TitleFrame::cget
# - TitleFrame::getframe
# - TitleFrame::_place
# ------------------------------------------------------------------------------
namespace eval TitleFrame {
Widget::define TitleFrame titleframe
Widget::declare TitleFrame {
{-relief TkResource groove 0 frame}
{-borderwidth TkResource 2 0 frame}
{-font TkResource "" 0 label}
{-foreground TkResource "" 0 label}
{-state TkResource "" 0 label}
{-background TkResource "" 0 frame}
{-text String "" 0}
{-ipad Int 4 0 "%d >=0"}
{-side Enum left 0 {left center right}}
{-baseline Enum center 0 {top center bottom}}
{-fg Synonym -foreground}
{-bg Synonym -background}
{-bd Synonym -borderwidth}
}
Widget::addmap TitleFrame "" :cmd {-background {}}
Widget::addmap TitleFrame "" .l {
-background {} -foreground {} -text {} -font {}
}
Widget::addmap TitleFrame "" .l {-state {}}
Widget::addmap TitleFrame "" .p {-background {}}
Widget::addmap TitleFrame "" .b {
-background {} -relief {} -borderwidth {}
}
Widget::addmap TitleFrame "" .b.p {-background {}}
Widget::addmap TitleFrame "" .f {-background {}}
}
# ------------------------------------------------------------------------------
# Command TitleFrame::create
# ------------------------------------------------------------------------------
proc TitleFrame::create { path args } {
Widget::init TitleFrame $path $args
set frame [eval [list frame $path] [Widget::subcget $path :cmd] \
-class TitleFrame -relief flat -bd 0 -highlightthickness 0]
set padtop [eval [list frame $path.p] [Widget::subcget $path :cmd] \
-relief flat -borderwidth 0]
set border [eval [list frame $path.b] [Widget::subcget $path .b] -highlightthickness 0]
set label [eval [list label $path.l] [Widget::subcget $path .l] \
-highlightthickness 0 \
-relief flat \
-bd 0 -padx 2 -pady 0]
set padbot [eval [list frame $border.p] [Widget::subcget $path .p] \
-relief flat -bd 0 -highlightthickness 0]
set frame [eval [list frame $path.f] [Widget::subcget $path .f] \
-relief flat -bd 0 -highlightthickness 0]
set height [winfo reqheight $label]
switch [Widget::getoption $path -side] {
left { set relx 0.0; set x 5; set anchor nw }
center { set relx 0.5; set x 0; set anchor n }
right { set relx 1.0; set x -5; set anchor ne }
}
set bd [Widget::getoption $path -borderwidth]
switch [Widget::getoption $path -baseline] {
top {
set y 0
set htop $height
set hbot 1
}
center {
set y 0
set htop [expr {$height/2}]
set hbot [expr {$height/2+$height%2+1}]
}
bottom {
set y [expr {$bd+1}]
set htop 1
set hbot $height
}
}
$padtop configure -height $htop
$padbot configure -height $hbot
set pad [Widget::getoption $path -ipad]
pack $padbot -side top -fill x
pack $frame -in $border -fill both -expand yes -padx $pad -pady $pad
pack $padtop -side top -fill x
pack $border -fill both -expand yes
place $label -relx $relx -x $x -anchor $anchor -y $y
bind $label <Configure> [list TitleFrame::_place $path]
bind $path <Destroy> [list Widget::destroy %W]
return [Widget::create TitleFrame $path]
}
# ------------------------------------------------------------------------------
# Command TitleFrame::configure
# ------------------------------------------------------------------------------
proc TitleFrame::configure { path args } {
set res [Widget::configure $path $args]
if { [Widget::hasChanged $path -ipad pad] } {
pack configure $path.f -padx $pad -pady $pad
}
if { [Widget::hasChanged $path -borderwidth val] |
[Widget::hasChanged $path -font val] |
[Widget::hasChanged $path -side val] |
[Widget::hasChanged $path -baseline val] } {
_place $path
}
return $res
}
# ------------------------------------------------------------------------------
# Command TitleFrame::cget
# ------------------------------------------------------------------------------
proc TitleFrame::cget { path option } {
return [Widget::cget $path $option]
}
# ------------------------------------------------------------------------------
# Command TitleFrame::getframe
# ------------------------------------------------------------------------------
proc TitleFrame::getframe { path } {
return $path.f
}
# ------------------------------------------------------------------------------
# Command TitleFrame::_place
# ------------------------------------------------------------------------------
proc TitleFrame::_place { path } {
set height [winfo height $path.l]
switch [Widget::getoption $path -side] {
left { set relx 0.0; set x 10; set anchor nw }
center { set relx 0.5; set x 0; set anchor n }
right { set relx 1.0; set x -10; set anchor ne }
}
set bd [Widget::getoption $path -borderwidth]
switch [Widget::getoption $path -baseline] {
top { set htop $height; set hbot 1; set y 0 }
center { set htop [expr {$height/2}]; set hbot [expr {$height/2+$height%2+1}]; set y 0 }
bottom { set htop 1; set hbot $height; set y [expr {$bd+1}] }
}
$path.p configure -height $htop
$path.b.p configure -height $hbot
place $path.l -relx $relx -x $x -anchor $anchor -y $y
}
|