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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [tix/] [library/] [ListNBk.tcl] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# ListNBk.tcl --
2
#
3
#       "List NoteBook" widget. Acts similarly to the notebook but uses a
4
#       HList widget to represent the pages.
5
#
6
# Copyright (c) 1996, Expert Interface Technologies
7
#
8
# See the file "license.terms" for information on usage and redistribution
9
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
10
#
11
 
12
tixWidgetClass tixListNoteBook {
13
    -classname TixListNoteBook
14
    -superclass tixVStack
15
    -method {
16
    }
17
    -flag {
18
        -height -width
19
    }
20
    -configspec {
21
        {-width width Width 0}
22
        {-height height Height 0}
23
    }
24
    -forcecall {
25
        -dynamicgeometry -width -height
26
    }
27
    -default {
28
        {*Orientation           horizontal}
29
    }
30
}
31
 
32
proc tixListNoteBook:ConstructWidget {w} {
33
    upvar #0 $w data
34
 
35
    tixChainMethod $w ConstructWidget
36
    set data(w_pane) [tixPanedWindow $w.pane -panerelief flat]
37
    set p1 [$data(w_pane) add p1 -expand 0]
38
    set p2 [$data(w_pane) add p2 -expand 1]
39
    set data(w_p2) $p2
40
    set data(w:shlist) [tixScrolledHList $p1.shlist]
41
    set data(w:hlist) [$data(w:shlist) subwidget hlist]
42
 
43
    if [tixStrEq [$data(w_pane) cget -orientation] vertical] {
44
        pack $data(w:shlist) -expand yes -fill both -padx 2 -pady 3
45
    } else {
46
        pack $data(w:shlist) -expand yes -fill both -padx 3 -pady 2
47
    }
48
 
49
    $data(w:hlist) config \
50
        -command   "tixListNoteBook:Choose $w"\
51
        -browsecmd "tixListNoteBook:Choose $w"\
52
        -selectmode single
53
 
54
    pack $data(w_pane) -expand yes -fill both
55
}
56
 
57
proc tixListNoteBook:add {w child args} {
58
    upvar #0 $w data
59
 
60
    if [string match *.* $child] {
61
        error "the name of the page cannot contain the \".\" character"
62
    }
63
    return [eval tixChainMethod $w add $child $args]
64
}
65
 
66
#----------------------------------------------------------------------
67
# Virtual Methods
68
#----------------------------------------------------------------------
69
proc tixListNoteBook:InitGeometryManager {w} {
70
    tixWidgetDoWhenIdle tixListNoteBook:InitialRaise $w
71
}
72
 
73
proc tixListNoteBook:InitialRaise {w} {
74
    upvar #0 $w data
75
 
76
    if ![string comp $data(topchild) ""] {
77
        set top [lindex $data(windows) 0]
78
    } else {
79
        set top $data(topchild)
80
    }
81
 
82
    if ![tixStrEq $top ""] {
83
        tixCallMethod $w raise $top
84
    }
85
}
86
 
87
proc tixListNoteBook:CreateChildFrame {w child} {
88
    upvar #0 $w data
89
 
90
    set f [frame $data(w_p2).$child]
91
 
92
    return $f
93
}
94
 
95
proc tixListNoteBook:RaiseChildFrame {w child} {
96
    upvar #0 $w data
97
 
98
    if [string comp $data(topchild) $child] {
99
        if [string comp $data(topchild) ""] {
100
            pack forget $data(w:$data(topchild))
101
        }
102
        pack $data(w:$child) -expand yes -fill both
103
    }
104
}
105
 
106
#
107
#----------------------------------------------------------------------
108
#
109
 
110
proc tixListNoteBook:config-dynamicgeometry {w value} {
111
    upvar #0 $w data
112
 
113
    $data(w_pane) config -dynamicgeometry $value
114
}
115
 
116
proc tixListNoteBook:config-width {w value} {
117
    upvar #0 $w data
118
 
119
    if {$value != 0} {
120
        $data(w_pane) config -width $value
121
    }
122
}
123
 
124
proc tixListNoteBook:config-height {w value} {
125
    upvar #0 $w data
126
 
127
    if {$value != 0} {
128
        $data(w_pane) config -height $value
129
    }
130
}
131
 
132
proc tixListNoteBook:raise {w child} {
133
    upvar #0 $w data
134
 
135
    $data(w:hlist) selection clear
136
    $data(w:hlist) selection set $child
137
    $data(w:hlist) anchor set $child
138
 
139
    tixChainMethod $w raise $child
140
}
141
 
142
proc tixListNoteBook:Choose {w args} {
143
    upvar #0 $w data
144
 
145
    set entry [tixEvent flag V]
146
 
147
    if {[lsearch $data(windows) $entry] != -1} {
148
        tixCallMethod $w raise $entry
149
    }
150
}

powered by: WebSVN 2.1.0

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