|
|
Class: TabView
Object
|
+--GraphicsContext
|
+--DeviceGraphicsContext
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--NoteBookView
|
+--TabView
- Package:
- stx:libwidg2
- Category:
- Views-Interactors
- Version:
- rev:
1.47
date: 2003/07/01 08:51:51
- user: cg
- file: TabView.st directory: libwidg2
- module: stx stc-classLibrary: libwidg2
- Author:
- Claus Atzkern
implements the tabs-view component of a noteBook.
May also be used on its own (without a surrounding noteBook).
The functionality is basically the same as provided by a
PopUpList or SelectionInListView, in that a valueHolder
gets a value assigned corresponding to the selected tab
from a list of possible tabs.
NoteBookView
SelectionInListView
PopUpList
ValueHolder
TabWidget
initialization
-
initStyle
-
setup style attributes
tabs at top of a view
|top tab view inset|
top := StandardSystemView new label:'tabs at top'; extent:250@100.
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
' view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top. '.
tab direction:#top.
tab list:#( 'Foo' 'Bar' 'Baz' ).
' inset := tab preferredSizeXorY . '.
' tab bottomInset:(inset negated). '.
' view topInset:inset. '.
tab action:[:aName|Transcript showCR:aName].
top open.
|
tabs at bottom of a view; changing widget to MAC style
|top tab view inset|
top := StandardSystemView new label:'tabs at bottom'; extent:250@100.
view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
tab := TabView origin:0.0 @ 1.0 corner:1.0 @ 1.0 in:top.
view viewBackground:(tab styleAt:#selectedColor).
tab direction:#bottom.
tab tabWidget:#Mac.
tab list:#( 'Foo' 'Bar' 'Baz' ).
inset := tab preferredSizeXorY.
tab topInset:(inset negated).
view bottomInset:inset.
tab action:[:aName|Transcript showCR:aName].
top open.
|
tabs at right of a view
|top tab view inset|
top := StandardSystemView new label:'tabs at right'; extent:100@250.
view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
tab := TabView origin:1.0 @ 0.0 corner:1.0 @ 1.0 in:top.
view viewBackground:(tab styleAt:#selectedColor).
tab direction:#right.
tab list:#( 'Foo' 'Bar' 'Baz' ).
inset := tab preferredSizeXorY.
tab leftInset:(inset negated).
view rightInset:inset.
tab action:[:aName|Transcript showCR:aName].
top open.
|
tabs at left of a view
|top tab view inset|
top := StandardSystemView new label:'tabs at left'; extent:100@250.
tab := TabView origin:0.0 @ 0.0 corner:0.0 @ 1.0 in:top.
view := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
view viewBackground:(tab styleAt:#selectedColor).
tab direction:#left.
tab list:#( 'Foo' 'Bar' 'Baz' ).
inset := tab preferredSizeXorY.
tab rightInset:(inset negated).
view leftInset:inset.
tab action:[:aName|Transcript showCR:aName].
top open.
|
changing default style( see TabWidget class ); useing index
|top tab view|
top := StandardSystemView new label:'example'; extent:450@300.
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 40 in:top.
tab horizontalInset:10.
view := NoteBookFrameView origin:0.0 @ 40 corner:1.0 @ 1.0 in:top.
view horizontalInset:10.
view bottomInset:10.
view level:2.
view viewBackground:(Image fromFile:'bitmaps/gifImages/garfield.gif').
tab styleAt:#selectedColor put:(view viewBackground).
tab styleAt:#unselectedColor put:(Color grey:60).
tab styleAt:#expandSelection put:9@7.
tab list:#( 'Foo' 'Bar' 'Baz').
tab useIndex:true.
tab action:[:aName| Transcript showCR:aName ].
top open.
|
using images and text
|top tab view list|
top := StandardSystemView new label:'example'.
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
list := #( 'SBrowser' 'FBrowser' 'Debugger' ).
list := list collect:[:n | Image fromFile:'bitmaps/' , n , '.xbm'].
list add:'A Text'.
tab list:list.
tab action:[:indexOrNil| Transcript showCR:indexOrNil ].
top extent:(tab preferredExtent).
top open.
|
using images and text; MAC style
|top tab view list|
top := StandardSystemView new label:'example'.
tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
tab tabWidget:#Mac.
list := #( 'SBrowser' 'FBrowser' 'Debugger' ).
list := list collect:[:n | Image fromFile:'bitmaps/' , n , '.xbm'].
list add:'A Text'.
tab list:list.
tab action:[:indexOrNil| Transcript showCR:indexOrNil ].
top extent:(tab preferredExtent).
top open.
|
tabs at top of view dealing with other models
|top sel view l top2 s top3 p|
l := SelectionInList new.
l list:#('foo' 'bar' 'baz').
l selectionIndex:1.
top2 := StandardSystemView new.
top2 extent:100@100.
s := SelectionInListView origin:0.0@0.0 corner:1.0@1.0 in:top2.
s model:l.
top2 open.
top3 := StandardSystemView new.
top3 extent:100@100.
s := PopUpList in:top3.
s model:l.
top3 open.
top := StandardSystemView new label:'example'; extent:200@50.
sel := TabView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
sel useIndex:true.
sel model:(l selectionIndexHolder).
sel listHolder:(l listHolder).
sel action:[:indexOrNil|Transcript showCR:indexOrNil].
top open.
|
|