OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [library/] [BtnBox.tcl] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# BtnBox.tcl --
2
#
3
#       Implements the tixButtonBox widget
4
#
5
# Copyright (c) 1996, Expert Interface Technologies
6
#
7
# See the file "license.terms" for information on usage and redistribution
8
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
9
#
10
 
11
tixWidgetClass tixButtonBox {
12
    -superclass tixPrimitive
13
    -classname  TixButtonBox
14
    -method {
15
        add invoke button buttons
16
    }
17
    -flag {
18
        -orientation -orient -padx -pady -state
19
    }
20
    -static {
21
        -orientation
22
    }
23
    -configspec {
24
        {-orientation orientation Orientation horizontal}
25
        {-padx padX Pad 0}
26
        {-pady padY Pad 0}
27
        {-state state State normal}
28
    }
29
    -alias {
30
        {-orient -orientation}
31
    }
32
    -default {
33
        {.borderWidth           1}
34
        {.relief                raised}
35
        {.padX                  5}
36
        {.padY                  10}
37
        {*Button.anchor         c}
38
        {*Button.padX           5}
39
    }
40
}
41
 
42
proc tixButtonBox:InitWidgetRec {w} {
43
    upvar #0 $w data
44
 
45
    tixChainMethod $w InitWidgetRec
46
 
47
    set data(g:buttons) ""
48
}
49
 
50
#----------------------------------------------------------------------
51
#                           CONFIG OPTIONS
52
#----------------------------------------------------------------------
53
proc tixButtonBox:config-padx {w arg} {
54
    upvar #0 $w data
55
 
56
    foreach item $data(g:buttons) {
57
        pack configure $w.$item -padx $arg
58
    }
59
}
60
 
61
proc tixButtonBox:config-pady {w arg} {
62
    upvar #0 $w data
63
 
64
    foreach item $data(g:buttons) {
65
        pack configure $w.$item -pady $arg
66
    }
67
}
68
 
69
proc tixButtonBox:config-state {w arg} {
70
    upvar #0 $w data
71
 
72
    foreach item $data(g:buttons) {
73
        $w.$item config -state $arg
74
    }
75
}
76
 
77
#----------------------------------------------------------------------
78
# Methods
79
#                     WIDGET COMMANDS
80
#----------------------------------------------------------------------
81
proc tixButtonBox:add {w name args} {
82
    upvar #0 $w data
83
 
84
    eval button $w.$name $args
85
    if {$data(-orientation) == "horizontal"} {
86
        pack $w.$name -side left -expand yes -fill y\
87
            -padx $data(-padx) -pady $data(-pady)
88
    } else {
89
        pack $w.$name -side top -expand yes  -fill x\
90
            -padx $data(-padx) -pady $data(-pady)
91
    }
92
 
93
    # allow for subwidget access
94
    #
95
    lappend data(g:buttons) $name
96
    set data(w:$name) $w.$name
97
 
98
    return $w.$name
99
}
100
 
101
proc tixButtonBox:button {w name args} {
102
    return [eval tixCallMethod $w subwidget $name $args]
103
}
104
 
105
proc tixButtonBox:buttons {w args} {
106
    return [eval tixCallMethod $w subwidgets -group buttons $args]
107
}
108
 
109
#
110
# call the command
111
proc tixButtonBox:invoke {w name} {
112
    upvar #0 $w data
113
 
114
    $w.$name invoke
115
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.