-
Notifications
You must be signed in to change notification settings - Fork 14
/
separator.tcl
76 lines (62 loc) · 2.53 KB
/
separator.tcl
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
# ------------------------------------------------------------------------------
# separator.tcl
# This file is part of Unifix BWidget Toolkit
# $Id: separator.tcl,v 1.41 2009/09/06 21:40:52 oberdorfer Exp $
# ------------------------------------------------------------------------------
# Index of commands:
# - Separator::create
# - Separator::configure
# - Separator::cget
# ------------------------------------------------------------------------------
namespace eval Separator {
Widget::define Separator separator
Widget::declare Separator {
{-background Color "SystemWindowFrame" 0}
{-cursor TkResource "" 0 frame}
{-relief Enum groove 0 {ridge groove}}
{-orient Enum horizontal 1 {horizontal vertical}}
{-bg Synonym -background}
}
Widget::addmap Separator "" :cmd { -background {} -cursor {} }
bind Separator <Destroy> [list Widget::destroy %W]
}
# ------------------------------------------------------------------------------
# Command Separator::create
# ------------------------------------------------------------------------------
proc Separator::create { path args } {
array set maps [list Separator {} :cmd {}]
array set maps [Widget::parseArgs Separator $args]
eval [list frame $path] $maps(:cmd) -class Separator
Widget::initFromODB Separator $path $maps(Separator)
if { [Widget::cget $path -orient] == "horizontal" } {
$path configure -borderwidth 1 -height 2
} else {
$path configure -borderwidth 1 -width 2
}
if { [string equal [Widget::cget $path -relief] "groove"] } {
$path configure -relief sunken
} else {
$path configure -relief raised
}
return [Widget::create Separator $path]
}
# ------------------------------------------------------------------------------
# Command Separator::configure
# ------------------------------------------------------------------------------
proc Separator::configure { path args } {
set res [Widget::configure $path $args]
if { [Widget::hasChanged $path -relief relief] } {
if { $relief == "groove" } {
$path:cmd configure -relief sunken
} else {
$path:cmd configure -relief raised
}
}
return $res
}
# ------------------------------------------------------------------------------
# Command Separator::cget
# ------------------------------------------------------------------------------
proc Separator::cget { path option } {
return [Widget::cget $path $option]
}