TabView.st
changeset 3902 ff89bd4a8992
parent 2531 2f38bbea4b36
child 4770 6634b540fea2
child 6045 c1e2a95ac169
--- a/TabView.st	Tue May 11 12:07:42 2010 +0200
+++ b/TabView.st	Tue May 11 13:43:14 2010 +0200
@@ -9,8 +9,6 @@
  other person.  No title to or ownership of the software is
  hereby transferred.
 "
-
-
 "{ Package: 'stx:libwidg2' }"
 
 NoteBookView subclass:#TabView
@@ -60,57 +58,42 @@
 examples
 "
     tabs at top of a view
-                                                                                [exBegin]                                      
-    |top tab view inset|
+                                                                                [exBegin]
+    |top tab|
 
-    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.                     '. 
-
+    top := StandardSystemView new label:'tabs at bottom'; extent:250@100.
+    tab := TabView origin:(0.0 @ 0.0) corner:(1.0 @ 0.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].
+    tab action:[:anIndex| Transcript showCR:anIndex ].
+    tab bottomInset:(tab preferredExtent y negated).
     top open.
                                                                                 [exEnd]
 
-    tabs at bottom of a view; changing widget to MAC style
+    tabs at bottom a view
                                                                                 [exBegin]                                      
-    |top tab view inset|
+    |top tab|
 
     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 := TabView origin:(0.0 @ 1.0) corner:(1.0 @ 1.0)in:top.
     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].
+    tab action:[:anIndex| Transcript showCR:anIndex ].
+    tab topInset:(tab preferredExtent y negated).
     top open.
                                                                                 [exEnd]
 
     tabs at right of a view
                                                                                 [exBegin]                                      
-    |top tab view inset|
+    |top tab|
 
     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.
+    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].
+    tab leftInset:(tab preferredExtent x negated).
     top open.
                                                                                 [exEnd]
 
@@ -119,102 +102,31 @@
     |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.
+    tab := TabView origin:0.0 @ 0.0 corner:0.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].
+    tab rightInset:(tab preferredExtent x negated).
     top open.
                                                                                 [exEnd]
 
-    changing default style( see TabWidget class ); useing index
-                                                                                [exBegin]                                      
-    |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.
-                                                                                [exEnd]
-
-
-    using images and text
+    using icons and text
                                                                                 [exBegin]
     |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.
-                                                                                [exEnd]
-
-    using images and text; MAC style
-                                                                                [exBegin]
-    |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.
-                                                                                [exEnd]
+    top := StandardSystemView new label:'using icons, text, ..'; extent:300@100.
+    tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 0.0 in:top.
+    list := OrderedCollection new.
+    list add:( LabelAndIcon icon:(ToolbarIconLibrary workspace24x24Icon2) string:'Workspace' ).
+    list add:( ToolbarIconLibrary workspace24x24Icon2 ).
+    list add:( 'Workspace' ).
+    list add:( 'Workspace' allBold ).
 
-    tabs at top of view dealing with other models
-
-                                                                                [exBegin]
-    |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].
+    tab list:list.
+    tab hasScrollButtons:true.
+    tab action:[:indexOrNil| Transcript showCR:indexOrNil ].
+    tab bottomInset:(tab preferredExtent y negated).
     top open.
                                                                                 [exEnd]
 "
@@ -235,5 +147,9 @@
 !TabView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.47 2003-07-01 08:51:51 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.48 2010-05-11 11:43:14 ca Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.48 2010-05-11 11:43:14 ca Exp $'
 ! !