TabView.st
author Jan Vrany <jan.vrany@labware.com>
Fri, 02 Sep 2022 11:25:39 +0100
branchjv
changeset 6261 9b7eb7159d29
parent 4770 6634b540fea2
permissions -rw-r--r--
Fix loong standing bug with some menus not being translated / resolved This has happened with browser "View" menu when sometimes it had the slice resolved and sometimes not. It turned out that it was because the code disabled resources (and therefore slices) resolution when processing shortcuts, so the menu was created and cached unresolved. This fixes the issue. eXept apparently run into the same problem.
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
4770
6634b540fea2 Added PluggableHierarchicalList to define ad-hoc tree models.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3902
diff changeset
    14
"{ NameSpace: Smalltalk }"
6634b540fea2 Added PluggableHierarchicalList to define ad-hoc tree models.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3902
diff changeset
    15
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1385
diff changeset
    16
NoteBookView subclass:#TabView
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1385
diff changeset
    17
	instanceVariableNames:''
550
f4c65aff6387 remove:
ca
parents: 548
diff changeset
    18
	classVariableNames:''
f4c65aff6387 remove:
ca
parents: 548
diff changeset
    19
	poolDictionaries:''
f4c65aff6387 remove:
ca
parents: 548
diff changeset
    20
	category:'Views-Interactors'
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    21
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    22
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    23
!TabView class methodsFor:'documentation'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    24
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    25
copyright
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    26
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    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
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    29
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    30
 This software is furnished under a license and may be used
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    35
 hereby transferred.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    36
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    37
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    38
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    39
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    40
documentation
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    41
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    42
    implements the tabs-view component of a noteBook.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    43
    May also be used on its own (without a surrounding noteBook).
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    44
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    45
    The functionality is basically the same as provided by a
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    46
    PopUpList or SelectionInListView, in that a valueHolder
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    47
    gets a value assigned corresponding to the selected tab
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    48
    from a list of possible tabs.
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    49
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    50
    [author:]
1118
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
    51
	Claus Atzkern
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    52
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    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
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    56
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    57
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    58
!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    59
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    60
examples
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    61
"
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    62
    tabs at top of a view
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    63
                                                                                [exBegin]
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    64
    |top tab|
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    65
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    66
    top := StandardSystemView new label:'tabs at bottom'; extent:250@100.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    67
    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
    68
    tab direction:#top.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    69
    tab list:#( 'Foo' 'Bar' 'Baz' ).
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    70
    tab action:[:anIndex| Transcript showCR:anIndex ].
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    71
    tab bottomInset:(tab preferredExtent y negated).
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    72
    top open.
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    73
                                                                                [exEnd]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    74
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    75
    tabs at bottom a view
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    76
                                                                                [exBegin]                                      
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    77
    |top tab|
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    78
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    79
    top := StandardSystemView new label:'tabs at bottom'; extent:250@100.
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    80
    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
    81
    tab direction:#bottom.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    82
    tab list:#( 'Foo' 'Bar' 'Baz' ).
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    83
    tab action:[:anIndex| Transcript showCR:anIndex ].
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    84
    tab topInset:(tab preferredExtent y negated).
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    85
    top open.
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    86
                                                                                [exEnd]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    87
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    88
    tabs at right of a view
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
    89
                                                                                [exBegin]                                      
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    90
    |top tab|
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    91
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    92
    top := StandardSystemView new label:'tabs at right'; extent:100@250.
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    93
    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
    94
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    95
    tab direction:#right.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    96
    tab list:#( 'Foo' 'Bar' 'Baz' ).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
    97
    tab action:[:aName|Transcript showCR:aName].
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
    98
    tab leftInset:(tab preferredExtent x negated).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
    99
    top open.
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
   100
                                                                                [exEnd]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   101
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   102
    tabs at left of a view
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
   103
                                                                                [exBegin]                                      
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   104
    |top tab view inset|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   105
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   106
    top := StandardSystemView new label:'tabs at left'; extent:100@250.
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   107
    tab := TabView origin:0.0 @ 0.0 corner:0.0 @ 1.0 in:top.
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   108
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   109
    tab direction:#left.
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   110
    tab list:#( 'Foo' 'Bar' 'Baz' ).
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   111
    tab action:[:aName|Transcript showCR:aName].
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   112
    tab rightInset:(tab preferredExtent x negated).
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   113
    top open.
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
   114
                                                                                [exEnd]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   115
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   116
    using icons and text
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
   117
                                                                                [exBegin]
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   118
    |top tab view list|
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   119
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   120
    top := StandardSystemView new label:'using icons, text, ..'; extent:300@100.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   121
    tab := TabView origin:0.0 @ 0.0 corner:1.0 @ 0.0 in:top.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   122
    list := OrderedCollection new.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   123
    list add:( LabelAndIcon icon:(ToolbarIconLibrary workspace24x24Icon2) string:'Workspace' ).
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   124
    list add:( ToolbarIconLibrary workspace24x24Icon2 ).
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   125
    list add:( 'Workspace' ).
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   126
    list add:( 'Workspace' allBold ).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   127
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   128
    tab list:list.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   129
    tab hasScrollButtons:true.
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   130
    tab action:[:indexOrNil| Transcript showCR:indexOrNil ].
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   131
    tab bottomInset:(tab preferredExtent y negated).
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   132
    top open.
2531
2f38bbea4b36 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1401
diff changeset
   133
                                                                                [exEnd]
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   134
"
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   135
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   136
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1385
diff changeset
   137
!TabView methodsFor:'initialization'!
387
5b7a8d0fe86e use index or label
ca
parents: 376
diff changeset
   138
1118
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   139
initStyle
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   140
    "setup style attributes
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   141
    "
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   142
a49afa5a9f10 fixed font setup in initStyle.
Claus Gittinger <cg@exept.de>
parents: 913
diff changeset
   143
    super initStyle.
1401
e92d55efca08 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1385
diff changeset
   144
    tabModus := true.
367
cff1a140978f tabs at top, bottom, left and right
ca
parents: 352
diff changeset
   145
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   146
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   147
! !
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   148
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   149
!TabView class methodsFor:'documentation'!
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   150
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   151
version
3902
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   152
    ^ '$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
   153
!
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   154
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   155
version_CVS
ff89bd4a8992 changed: #examples
ca
parents: 2531
diff changeset
   156
    ^ '$Header: /cvs/stx/stx/libwidg2/TabView.st,v 1.48 2010-05-11 11:43:14 ca Exp $'
4770
6634b540fea2 Added PluggableHierarchicalList to define ad-hoc tree models.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3902
diff changeset
   157
!
6634b540fea2 Added PluggableHierarchicalList to define ad-hoc tree models.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3902
diff changeset
   158
6634b540fea2 Added PluggableHierarchicalList to define ad-hoc tree models.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3902
diff changeset
   159
version_HG
6634b540fea2 Added PluggableHierarchicalList to define ad-hoc tree models.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3902
diff changeset
   160
6634b540fea2 Added PluggableHierarchicalList to define ad-hoc tree models.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3902
diff changeset
   161
    ^ '$Changeset: <not expanded> $'
343
dd49faa984ce intitial checkin
ca
parents:
diff changeset
   162
! !
4770
6634b540fea2 Added PluggableHierarchicalList to define ad-hoc tree models.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3902
diff changeset
   163