OSDN Git Service

Initial revision
[pf3gnuchains/pf3gnuchains3x.git] / tix / library / StdBBox.tcl
1 # StdBBox.tcl --
2 #
3 #       Standard Button Box, used in standard dialog boxes
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
12
13 tixWidgetClass tixStdButtonBox {
14     -classname TixStdButtonBox
15     -superclass tixButtonBox
16     -flag {
17         -applycmd -cancelcmd -helpcmd -okcmd
18     }
19     -configspec {
20         {-applycmd applyCmd ApplyCmd ""}
21         {-cancelcmd cancelCmd CancelCmd ""}
22         {-helpcmd helpCmd HelpCmd ""}
23         {-okcmd okCmd OkCmd ""}
24     }
25     -default {
26         {.borderWidth   1}
27         {.relief        raised}
28         {.padX          5}
29         {.padY          10}
30         {*Button.anchor c}
31         {*Button.padX   5}
32     }
33 }
34
35 proc tixStdButtonBox:ConstructWidget {w} {
36     upvar #0 $w data
37
38     tixChainMethod $w ConstructWidget
39
40     $w add ok     -text OK     -under 0 -width 6 -command $data(-okcmd)
41     $w add apply  -text Apply  -under 0 -width 6 -command $data(-applycmd)
42     $w add cancel -text Cancel -under 0 -width 6 -command $data(-cancelcmd)
43     $w add help   -text Help   -under 0 -width 6 -command $data(-helpcmd)
44 }
45
46 proc tixStdButtonBox:config {w flag value} {
47     upvar #0 $w data
48
49     case $flag {
50         -okcmd {
51             $data(w:ok)     config -command $value
52         }
53         -applycmd {
54             $data(w:apply)  config -command $value
55         }
56         -cancelcmd {
57             $data(w:cancel) config -command $value
58         }
59         -helpcmd {
60             $data(w:help)   config -command $value
61         }
62         default {
63             tixChainMethod $w config $flag $value
64         }
65     }
66 }