author | Claus Gittinger <cg@exept.de> |
Tue, 01 Jul 2003 10:51:51 +0200 | |
changeset 2531 | 2f38bbea4b36 |
parent 1401 | e92d55efca08 |
child 3902 | ff89bd4a8992 |
permissions | -rw-r--r-- |
343 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
3 |
All Rights Reserved |
343 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
2531 | 14 |
"{ Package: 'stx:libwidg2' }" |
15 |
||
1401 | 16 |
NoteBookView subclass:#TabView |
17 |
instanceVariableNames:'' |
|
550 | 18 |
classVariableNames:'' |
19 |
poolDictionaries:'' |
|
20 |
category:'Views-Interactors' |
|
343 | 21 |
! |
22 |
||
23 |
!TabView class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1997 by eXept Software AG |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
28 |
All Rights Reserved |
343 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
||
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
implements the tabs-view component of a noteBook. |
|
43 |
May also be used on its own (without a surrounding noteBook). |
|
44 |
||
45 |
The functionality is basically the same as provided by a |
|
46 |
PopUpList or SelectionInListView, in that a valueHolder |
|
47 |
gets a value assigned corresponding to the selected tab |
|
48 |
from a list of possible tabs. |
|
49 |
||
50 |
[author:] |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
51 |
Claus Atzkern |
343 | 52 |
|
53 |
[see also:] |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
54 |
NoteBookView |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
55 |
SelectionInListView PopUpList ValueHolder TabWidget |
343 | 56 |
" |
57 |
||
58 |
! |
|
59 |
||
60 |
examples |
|
61 |
" |
|
367 | 62 |
tabs at top of a view |
2531 | 63 |
[exBegin] |
367 | 64 |
|top tab view inset| |
65 |
||
66 |
top := StandardSystemView new label:'tabs at top'; extent:250@100. |
|
2531 | 67 |
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
68 |
' view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. '. |
|
367 | 69 |
|
70 |
tab direction:#top. |
|
71 |
tab list:#( 'Foo' 'Bar' 'Baz' ). |
|
2531 | 72 |
' inset := tab preferredSizeXorY . '. |
73 |
' tab bottomInset:(inset negated). '. |
|
74 |
' view topInset:inset. '. |
|
367 | 75 |
tab action:[:aName|Transcript showCR:aName]. |
76 |
top open. |
|
2531 | 77 |
[exEnd] |
343 | 78 |
|
367 | 79 |
tabs at bottom of a view; changing widget to MAC style |
2531 | 80 |
[exBegin] |
367 | 81 |
|top tab view inset| |
82 |
||
83 |
top := StandardSystemView new label:'tabs at bottom'; extent:250@100. |
|
499 | 84 |
view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
85 |
tab := TabView origin:0.0 @ 1.0 corner:1.0 @ 1.0 in:top. |
|
343 | 86 |
|
367 | 87 |
view viewBackground:(tab styleAt:#selectedColor). |
88 |
tab direction:#bottom. |
|
89 |
tab tabWidget:#Mac. |
|
343 | 90 |
|
367 | 91 |
tab list:#( 'Foo' 'Bar' 'Baz' ). |
92 |
inset := tab preferredSizeXorY. |
|
93 |
tab topInset:(inset negated). |
|
94 |
view bottomInset:inset. |
|
95 |
tab action:[:aName|Transcript showCR:aName]. |
|
96 |
top open. |
|
2531 | 97 |
[exEnd] |
343 | 98 |
|
367 | 99 |
tabs at right of a view |
2531 | 100 |
[exBegin] |
367 | 101 |
|top tab view inset| |
102 |
||
103 |
top := StandardSystemView new label:'tabs at right'; extent:100@250. |
|
499 | 104 |
view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
105 |
tab := TabView origin:1.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
367 | 106 |
|
107 |
view viewBackground:(tab styleAt:#selectedColor). |
|
108 |
tab direction:#right. |
|
109 |
tab list:#( 'Foo' 'Bar' 'Baz' ). |
|
110 |
inset := tab preferredSizeXorY. |
|
111 |
tab leftInset:(inset negated). |
|
112 |
view rightInset:inset. |
|
113 |
tab action:[:aName|Transcript showCR:aName]. |
|
343 | 114 |
top open. |
2531 | 115 |
[exEnd] |
343 | 116 |
|
367 | 117 |
tabs at left of a view |
2531 | 118 |
[exBegin] |
367 | 119 |
|top tab view inset| |
120 |
||
121 |
top := StandardSystemView new label:'tabs at left'; extent:100@250. |
|
499 | 122 |
tab := TabView origin:0.0 @ 0.0 corner:0.0 @ 1.0 in:top. |
123 |
view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
343 | 124 |
|
367 | 125 |
view viewBackground:(tab styleAt:#selectedColor). |
126 |
tab direction:#left. |
|
127 |
tab list:#( 'Foo' 'Bar' 'Baz' ). |
|
128 |
inset := tab preferredSizeXorY. |
|
129 |
tab rightInset:(inset negated). |
|
130 |
view leftInset:inset. |
|
131 |
tab action:[:aName|Transcript showCR:aName]. |
|
132 |
top open. |
|
2531 | 133 |
[exEnd] |
343 | 134 |
|
367 | 135 |
changing default style( see TabWidget class ); useing index |
2531 | 136 |
[exBegin] |
367 | 137 |
|top tab view| |
138 |
||
139 |
top := StandardSystemView new label:'example'; extent:450@300. |
|
499 | 140 |
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 40 in:top. |
367 | 141 |
tab horizontalInset:10. |
142 |
view := NoteBookFrameView origin:0.0 @ 40 corner:1.0 @ 1.0 in:top. |
|
343 | 143 |
view horizontalInset:10. |
144 |
view bottomInset:10. |
|
145 |
view level:2. |
|
146 |
view viewBackground:(Image fromFile:'bitmaps/gifImages/garfield.gif'). |
|
147 |
||
367 | 148 |
tab styleAt:#selectedColor put:(view viewBackground). |
149 |
tab styleAt:#unselectedColor put:(Color grey:60). |
|
150 |
tab styleAt:#expandSelection put:9@7. |
|
343 | 151 |
|
367 | 152 |
tab list:#( 'Foo' 'Bar' 'Baz'). |
153 |
tab useIndex:true. |
|
154 |
tab action:[:aName| Transcript showCR:aName ]. |
|
352 | 155 |
|
343 | 156 |
top open. |
2531 | 157 |
[exEnd] |
343 | 158 |
|
159 |
||
367 | 160 |
using images and text |
2531 | 161 |
[exBegin] |
367 | 162 |
|top tab view list| |
163 |
||
164 |
top := StandardSystemView new label:'example'. |
|
499 | 165 |
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
367 | 166 |
list := #( 'SBrowser' 'FBrowser' 'Debugger' ). |
167 |
list := list collect:[:n | Image fromFile:'bitmaps/' , n , '.xbm']. |
|
168 |
list add:'A Text'. |
|
169 |
tab list:list. |
|
170 |
tab action:[:indexOrNil| Transcript showCR:indexOrNil ]. |
|
171 |
top extent:(tab preferredExtent). |
|
172 |
top open. |
|
2531 | 173 |
[exEnd] |
343 | 174 |
|
367 | 175 |
using images and text; MAC style |
2531 | 176 |
[exBegin] |
367 | 177 |
|top tab view list| |
178 |
||
179 |
top := StandardSystemView new label:'example'. |
|
499 | 180 |
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
367 | 181 |
tab tabWidget:#Mac. |
182 |
list := #( 'SBrowser' 'FBrowser' 'Debugger' ). |
|
183 |
list := list collect:[:n | Image fromFile:'bitmaps/' , n , '.xbm']. |
|
184 |
list add:'A Text'. |
|
185 |
tab list:list. |
|
186 |
tab action:[:indexOrNil| Transcript showCR:indexOrNil ]. |
|
187 |
top extent:(tab preferredExtent). |
|
343 | 188 |
top open. |
2531 | 189 |
[exEnd] |
343 | 190 |
|
367 | 191 |
tabs at top of view dealing with other models |
192 |
||
2531 | 193 |
[exBegin] |
352 | 194 |
|top sel view l top2 s top3 p| |
343 | 195 |
|
196 |
l := SelectionInList new. |
|
197 |
l list:#('foo' 'bar' 'baz'). |
|
198 |
l selectionIndex:1. |
|
199 |
||
200 |
top2 := StandardSystemView new. |
|
367 | 201 |
top2 extent:100@100. |
343 | 202 |
s := SelectionInListView origin:0.0@0.0 corner:1.0@1.0 in:top2. |
203 |
s model:l. |
|
204 |
top2 open. |
|
205 |
||
206 |
top3 := StandardSystemView new. |
|
367 | 207 |
top3 extent:100@100. |
343 | 208 |
s := PopUpList in:top3. |
209 |
s model:l. |
|
210 |
top3 open. |
|
211 |
||
499 | 212 |
top := StandardSystemView new label:'example'; extent:200@50. |
213 |
sel := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. |
|
367 | 214 |
sel useIndex:true. |
343 | 215 |
sel model:(l selectionIndexHolder). |
216 |
sel listHolder:(l listHolder). |
|
367 | 217 |
sel action:[:indexOrNil|Transcript showCR:indexOrNil]. |
343 | 218 |
top open. |
2531 | 219 |
[exEnd] |
343 | 220 |
" |
221 |
! ! |
|
222 |
||
1401 | 223 |
!TabView methodsFor:'initialization'! |
387 | 224 |
|
1118
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
225 |
initStyle |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
226 |
"setup style attributes |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
227 |
" |
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
228 |
|
a49afa5a9f10
fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents:
913
diff
changeset
|
229 |
super initStyle. |
1401 | 230 |
tabModus := true. |
367 | 231 |
|
343 | 232 |
|
233 |
! ! |
|
234 |
||
235 |
!TabView class methodsFor:'documentation'! |
|
236 |
||
237 |
version |
|
2531 | 238 |
^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.47 2003-07-01 08:51:51 cg Exp $' |
343 | 239 |
! ! |