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

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [insight/] [tix/] [demos/] [MkScroll.tcl] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
# MkScroll.tcl --
2
#
3
#       This file implements the "Scrolled Widgets" page in the widget demo
4
#
5
#       This file has not been properly documented. It is NOT intended
6
#       to be used as an introductory demo program about Tix
7
#       programming. For such demos, please see the files in the
8
#       demos/samples directory or go to the "Samples" page in the
9
#       "widget demo"
10
#
11
#
12
# Copyright (c) 1996, Expert Interface Technologies
13
#
14
# See the file "license.terms" for information on usage and redistribution
15
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
16
#
17
 
18
proc MkScroll {nb page} {
19
    set w [$nb subwidget $page]
20
 
21
    set name [tixOptionName $w]
22
    option add *$name*TixLabelFrame*label.padX 4
23
 
24
    tixLabelFrame $w.sls -label "tixScrolledListBox"
25
    tixLabelFrame $w.swn -label "tixScrolledWindow"
26
    tixLabelFrame $w.stx -label "tixScrolledText"
27
    MkSList   [$w.sls subwidget frame]
28
 
29
    MkSText   [$w.stx subwidget frame]
30
    MkSWindow [$w.swn subwidget frame]
31
 
32
    tixForm $w.sls -top 0 -left 0 -right %33 -bottom -1
33
    tixForm $w.swn -top 0 -left $w.sls -right %66 -bottom -1
34
    tixForm $w.stx -top 0 -left $w.swn -right -1 -bottom -1
35
}
36
 
37
#----------------------------------------------------------------------
38
# ScrolledListBox
39
#----------------------------------------------------------------------
40
proc MkSList {w} {
41
    frame $w.top -width 300 -height 330
42
    frame $w.bot
43
 
44
    message $w.top.msg -font -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*\
45
        -relief flat -width 200 -anchor n\
46
        -text {This TixScrolledListBox is configured so that it uses\
47
scrollbars only when it is necessary. Use the handles to\
48
resize the listbox and watch the scrollbars automatically\
49
appear and disappear.}
50
 
51
    set list [tixScrolledListBox $w.top.list -scrollbar auto]
52
    place $list -x 50 -y 150 -width 120 -height 80
53
    $list subwidget listbox insert end Alabama
54
    $list subwidget listbox insert end California
55
    $list subwidget listbox insert end Montana
56
    $list subwidget listbox insert end "New Jersy"
57
    $list subwidget listbox insert end "New York"
58
    $list subwidget listbox insert end Pennsylvania
59
    $list subwidget listbox insert end Washington
60
 
61
    set rh [tixResizeHandle $w.top.r -bg #202060 -relief raised \
62
            -handlesize 8 -gridded true -minwidth 50 -minheight 30]
63
 
64
    button $w.bot.btn -text Reset -command "SList:Reset $rh $list"
65
    pack propagate $w.top 0
66
    pack $w.top.msg -fill x
67
    pack $w.bot.btn -anchor c
68
    pack $w.top -expand yes -fill both
69
    pack $w.bot -fill both
70
 
71
    bind $list <Map> "tixDoWhenIdle $rh attachwidget $list"
72
}
73
 
74
proc SList:Reset {rh list} {
75
    place $list -x 50 -y 150 -width 120 -height 80
76
    update
77
    $rh attachwidget $list
78
}
79
 
80
#----------------------------------------------------------------------
81
# ScrolledWindow
82
#----------------------------------------------------------------------
83
proc MkSWindow {w} {
84
    global demo_dir
85
    frame $w.top -width 330 -height 330
86
    frame $w.bot
87
 
88
    message $w.top.msg -font -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*\
89
        -relief flat -width 200 -anchor n\
90
        -text {The TixScrolledWindow widget allows you\
91
to scroll any kind of TK widget. It is more versatile\
92
than a scrolled canvas widget}
93
 
94
    set win [tixScrolledWindow $w.top.win -scrollbar auto]
95
    set f [$win subwidget window]
96
    set image [image create photo -file $demo_dir/bitmaps/tix.gif]
97
 
98
    label $f.b1 -image $image
99
 
100
    pack $f.b1 -expand yes -fill both
101
 
102
    place $win -x 30 -y 150 -width 190 -height 120
103
    set rh [tixResizeHandle $w.top.r -bg #202060 -relief raised \
104
            -handlesize 8 -gridded true -minwidth 50 -minheight 30]
105
 
106
    button $w.bot.btn -text Reset -command "SWindow:Reset $rh $win"
107
    pack propagate $w.top 0
108
    pack $w.top.msg -fill x
109
    pack $w.bot.btn -anchor c
110
    pack $w.top -expand yes -fill both
111
    pack $w.bot -fill both
112
 
113
    bind $win <Map> "tixDoWhenIdle $rh attachwidget $win"
114
}
115
 
116
proc SWindow:Reset {rh win} {
117
    place $win -x 30 -y 150 -width 190 -height 120
118
    update
119
    $rh attachwidget $win
120
}
121
 
122
#----------------------------------------------------------------------
123
# ScrolledText
124
#----------------------------------------------------------------------
125
proc MkSText {w} {
126
    frame $w.top -width 330 -height 330
127
    frame $w.bot
128
 
129
    message $w.top.msg -font -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-*-*\
130
        -relief flat -width 200 -anchor n\
131
        -text {The TixScrolledWindow widget allows you\
132
to scroll any kind of TK widget. It is more versatile\
133
than a scrolled canvas widget}
134
 
135
    set win [tixScrolledText $w.top.win -scrollbar both]
136
    $win subwidget text config -wrap none
137
 
138
    place $win -x 30 -y 150 -width 190 -height 100
139
    set rh [tixResizeHandle $w.top.r -bg #202060 -relief raised \
140
            -handlesize 8 -gridded true -minwidth 50 -minheight 30]
141
 
142
    button $w.bot.btn -text Reset -command "SText:Reset $rh $win"
143
    pack propagate $w.top 0
144
    pack $w.top.msg -fill x
145
    pack $w.bot.btn -anchor c
146
    pack $w.top -expand yes -fill both
147
    pack $w.bot -fill both
148
 
149
    bind $win <Map> "tixDoWhenIdle $rh attachwidget $win"
150
}
151
 
152
proc SText:Reset {rh win} {
153
    place $win -x 30 -y 150 -width 190 -height 100
154
    update
155
    $rh attachwidget $win
156
}

powered by: WebSVN 2.1.0

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