TabView.st
author ca
Tue, 11 May 2010 13:43:14 +0200
changeset 3902 ff89bd4a8992
parent 2531 2f38bbea4b36
child 4770 6634b540fea2
child 6045 c1e2a95ac169
permissions -rw-r--r--
changed: #examples
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     1
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     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
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     4
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     5
 This software is furnished under a license and may be used
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
dd49faa984ce intitial checkin
ca
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    10
 hereby transferred.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    11
"
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    13
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1385
diff changeset
    14
NoteBookView subclass:#TabView
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1385
diff changeset
    15
	instanceVariableNames:''
550
f4c65aff6387 remove:
ca
parents: 548
diff changeset
    16
	classVariableNames:''
f4c65aff6387 remove:
ca
parents: 548
diff changeset
    17
	poolDictionaries:''
f4c65aff6387 remove:
ca
parents: 548
diff changeset
    18
	category:'Views-Interactors'
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    19
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    20
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    21
!TabView class methodsFor:'documentation'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    22
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    23
copyright
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    24
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    25
 COPYRIGHT (c) 1997 by eXept Software AG
1118
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
    26
	      All Rights Reserved
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    27
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    28
 This software is furnished under a license and may be used
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    33
 hereby transferred.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    34
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    35
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    36
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    37
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    38
documentation
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    39
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    40
    implements the tabs-view component of a noteBook.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    41
    May also be used on its own (without a surrounding noteBook).
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    42
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    43
    The functionality is basically the same as provided by a
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    44
    PopUpList or SelectionInListView, in that a valueHolder
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    45
    gets a value assigned corresponding to the selected tab
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    46
    from a list of possible tabs.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    47
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    48
    [author:]
1118
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
    49
	Claus Atzkern
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    50
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    51
    [see also:]
1118
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
    52
	NoteBookView
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
    53
	SelectionInListView PopUpList ValueHolder TabWidget
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    54
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    55
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    56
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    57
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    58
examples
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    59
"
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    60
    tabs at top of a view
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    61
                                                                                [exBegin]
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    62
    |top tab|
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    63
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    64
    top := StandardSystemView new label:'tabs at bottom'; extent:250@100.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    65
    tab := TabView origin:(0.0 @ 0.0) corner:(1.0 @ 0.0)in:top.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    66
    tab direction:#top.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    67
    tab list:#( 'Foo' 'Bar' 'Baz' ).
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    68
    tab action:[:anIndex| Transcript showCR:anIndex ].
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    69
    tab bottomInset:(tab preferredExtent y negated).
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    70
    top open.
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    71
                                                                                [exEnd]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    72
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    73
    tabs at bottom a view
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    74
                                                                                [exBegin]                                      
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    75
    |top tab|
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    76
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    77
    top := StandardSystemView new label:'tabs at bottom'; extent:250@100.
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    78
    tab := TabView origin:(0.0 @ 1.0) corner:(1.0 @ 1.0)in:top.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    79
    tab direction:#bottom.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    80
    tab list:#( 'Foo' 'Bar' 'Baz' ).
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    81
    tab action:[:anIndex| Transcript showCR:anIndex ].
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    82
    tab topInset:(tab preferredExtent y negated).
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    83
    top open.
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    84
                                                                                [exEnd]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    85
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    86
    tabs at right of a view
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    87
                                                                                [exBegin]                                      
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    88
    |top tab|
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    89
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    90
    top := StandardSystemView new label:'tabs at right'; extent:100@250.
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    91
    tab := TabView origin:1.0 @ 0.0 corner:1.0 @ 1.0 in:top.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    92
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    93
    tab direction:#right.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    94
    tab list:#( 'Foo' 'Bar' 'Baz' ).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    95
    tab action:[:aName|Transcript showCR:aName].
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    96
    tab leftInset:(tab preferredExtent x negated).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    97
    top open.
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    98
                                                                                [exEnd]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    99
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   100
    tabs at left of a view
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
   101
                                                                                [exBegin]                                      
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   102
    |top tab view inset|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   103
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   104
    top := StandardSystemView new label:'tabs at left'; extent:100@250.
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   105
    tab := TabView origin:0.0 @ 0.0 corner:0.0 @ 1.0 in:top.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   106
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   107
    tab direction:#left.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   108
    tab list:#( 'Foo' 'Bar' 'Baz' ).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   109
    tab action:[:aName|Transcript showCR:aName].
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   110
    tab rightInset:(tab preferredExtent x negated).
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   111
    top open.
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
   112
                                                                                [exEnd]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   113
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   114
    using icons and text
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
   115
                                                                                [exBegin]
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   116
    |top tab view list|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   117
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   118
    top := StandardSystemView new label:'using icons, text, ..'; extent:300@100.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   119
    tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 0.0 in:top.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   120
    list := OrderedCollection new.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   121
    list add:( LabelAndIcon icon:(ToolbarIconLibrary workspace24x24Icon2) string:'Workspace' ).
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   122
    list add:( ToolbarIconLibrary workspace24x24Icon2 ).
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   123
    list add:( 'Workspace' ).
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   124
    list add:( 'Workspace' allBold ).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   125
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   126
    tab list:list.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   127
    tab hasScrollButtons:true.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   128
    tab action:[:indexOrNil| Transcript showCR:indexOrNil ].
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   129
    tab bottomInset:(tab preferredExtent y negated).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   130
    top open.
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
   131
                                                                                [exEnd]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   132
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   133
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   134
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1385
diff changeset
   135
!TabView methodsFor:'initialization'!
387
5b7a8d0fe86e use index or label
ca
parents: 376
diff changeset
   136
1118
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   137
initStyle
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   138
    "setup style attributes
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   139
    "
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   140
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   141
    super initStyle.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1385
diff changeset
   142
    tabModus := true.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   143
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   144
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   145
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   146
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   147
!TabView class methodsFor:'documentation'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   148
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   149
version
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   150
    ^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.48 2010-05-11 11:43:14 ca Exp $'
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   151
!
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   152
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   153
version_CVS
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   154
    ^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.48 2010-05-11 11:43:14 ca Exp $'
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   155
! !