SelListV.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Apr 1996 19:34:16 +0200
changeset 586 032b3245e53a
parent 554 92d1cbe0d92f
child 587 19deffec383d
permissions -rw-r--r--
documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
ListView subclass:#SelectionInListView
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    14
	instanceVariableNames:'selection actionBlock enabled hilightFgColor hilightBgColor
128
claus
parents: 125
diff changeset
    15
		halfIntensityFgColor doubleClickActionBlock selectConditionBlock
claus
parents: 125
diff changeset
    16
		listAttributes multipleSelectOk clickLine initialSelectionMsg
claus
parents: 125
diff changeset
    17
		printItems oneItem useIndex hilightLevel hilightFrameColor
claus
parents: 125
diff changeset
    18
		ignoreReselect arrowLevel smallArrow keyActionStyle
claus
parents: 125
diff changeset
    19
		returnKeyActionStyle toggleSelect strikeOut iSearchString items
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
    20
		doubleClickMsg hilightStyle'
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    21
	classVariableNames:'RightArrowShadowForm RightArrowLightForm RightArrowForm
128
claus
parents: 125
diff changeset
    22
		SmallRightArrowShadowForm SmallRightArrowLightForm
claus
parents: 125
diff changeset
    23
		DefaultForegroundColor DefaultBackgroundColor
claus
parents: 125
diff changeset
    24
		DefaultHilightForegroundColor DefaultHilightBackgroundColor
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
    25
		DefaultHilightFrameColor DefaultHilightLevel
128
claus
parents: 125
diff changeset
    26
		DefaultRightArrowStyle DefaultRightArrowLevel
claus
parents: 125
diff changeset
    27
		DefaultDisabledForegroundColor DefaultShadowColor
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
    28
		DefaultLightColor DefaultHilightStyle'
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    29
	poolDictionaries:''
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    30
	category:'Views-Text'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    31
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    32
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    33
!SelectionInListView class methodsFor:'documentation'!
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    34
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    35
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    36
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    37
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    38
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    39
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    40
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    41
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    42
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    43
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    44
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    45
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    46
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    47
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    48
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    49
documentation
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    50
"
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
    51
    this one is a ListView with a selected line (which is shown highlighted)
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    52
    If multipleSelectionsOk is true, it is also allowed to shift-click multiple 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    53
    entries.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    54
    If toggleSelect is true, clicking toggles (i.e. click on a seleted item
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    55
    will deselect).
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
    56
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    57
    Whenever the selection changes, an action-block is evaluated, passing the 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    58
    current selection as argument.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    59
    Currently, the selection can be nil, aNumber or a collection of numbers; 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    60
    this will change to be either nil or a collection, making selection handling 
70
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    61
    easier in the future. (this stupid behavior is due to the multiple
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    62
    select feature being added later - the first implementation used to support
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    63
    only single selections).
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    64
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    65
    The actionBlock is called with the current selection (single number or
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    66
    collection of numbers) as argument.
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    67
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    68
    Also, to support ST-80 MVC-style use, the model (if nonNil) is notified
155
claus
parents: 151
diff changeset
    69
    by the change mechanism (performs changeMsg) and vice versa, the view
claus
parents: 151
diff changeset
    70
    updates if the model changes (with aspect of either #list or #selectionIndex).
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    71
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    72
    Before actually adding entries to the the selection, a checkBlock (if non-nil) is evaluated 
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    73
    passing the number of the entry whch is about to be selected as argument.
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    74
    The select change operation is only done if this returns true. This allows
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    75
    interception of select, for example to query the user if he/she wants to save
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    76
    the old contents before (see uses in SystemBrowser and FileBrowser), or to
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    77
    disable individual entries.
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
    78
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    79
    It is also possible to select entries with the keyboard; use the cursor up/
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    80
    down keys to select prev/next, Home- and End-keys to select first/last. 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    81
    Use the return key to apply the double-click-action to the current selection.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    82
    Also, alphabetic keys will select the next entry starting with that key.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    83
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    84
    The keyboard behavior can be further controlled with the keyActionStyle
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    85
    instance variable (see SelectionInListView>>keyActionStyle:).
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    86
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    87
    Finally, ignoreReselect controls if pressing on an already selected item
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    88
    triggers the action or not. For some applications it is useful to allow
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    89
    reselects (for example, the SystemBrowsers method-list updates the
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    90
    source code in this case).
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    91
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    92
    Currently, some limited form of line attributes are supported. These
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    93
    are kept in the instance variable lineAttributes.
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    94
    This may change (using mechanisms similar to MultiColListEntry), so
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    95
    be prepared. (dont use the listAttributes instvar directly; if possible,
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    96
    use MultiColListEntry or subclasses of it.
120
claus
parents: 119
diff changeset
    97
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    98
    Although currently based on the listAttributes instVar, the implementation of
120
claus
parents: 119
diff changeset
    99
    text attributes will be changed in the near future (when Text/DisplayText are
claus
parents: 119
diff changeset
   100
    available). 
claus
parents: 119
diff changeset
   101
    However, the protocol will probably be kept for backward compatibility
claus
parents: 119
diff changeset
   102
    (i.e. use #attributeAt: / #attributeAt:put etc. - at least, these are easy to find
claus
parents: 119
diff changeset
   103
    when migrating to the new attributed text handling).
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   104
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   105
    [Instance variables:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   106
        selection               <misc>          the current selection. nil, a number or collection of numbers
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   107
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   108
        actionBlock             <Block>         block to be evaluated on selection changes
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   109
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   110
        enabled                 <Boolean>       true: selection changes allowed; false: ignore clicks
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   111
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   112
        hilightFgColor
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   113
        hilightBgColor          <Color>         how highlighted items are drawn
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   114
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   115
        halfIntensityColor      <Color>         foreground for disabled items
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   116
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   117
        selectConditionBlock    <Block>         if non-nil, this nlock can decide if selection is ok
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   118
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   119
        doubleClickActionBlock  <Block>         action to perform on double-click
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   120
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   121
        listAttributes                          dont use - will vanish
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   122
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   123
        hilightLevel            <Integer>       level to draw selections (i.e. for 3D effect)
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   124
        hilightFrameColor       <Color>         rectangle around highlighted items
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   125
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   126
        multipleSelectOk        <Boolean>       if true, multiple selections (with shift) are ok.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   127
                                                default: false
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   128
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   129
        ignoreReselect          <Boolean>       if true, selecting same again does not trigger action;
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   130
                                                if false, every select triggers it.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   131
                                                default: true
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   132
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   133
        toggleSelect            <Boolean>       if true, click toggles;
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   134
                                                if false, click selects.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   135
                                                default: false
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   136
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   137
        arrowLevel              <Integer>       level to draw right-arrows (for submenus etc.)
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   138
        smallArrow              <Boolean>       if true, uses a small arrow bitmap
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   139
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   140
        listMsg                                 if non-nil, use ST-80 style (model-access)
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   141
        initialSelectionMsg 
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   142
        printItems 
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   143
        oneItem
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   144
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   145
        keyActionStyle          <Symbol>        controls how to respond to keyboard selects
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   146
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   147
        returnKeyActionStyle    <Symbol>        controls how to respond to return key
125
claus
parents: 124
diff changeset
   148
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   149
    written spring/summer 89 by claus
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   150
    3D Jan 90 by claus
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
   151
    multiselect Jun 92 by claus
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
   152
    keyboard-select jun 94 by claus
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   153
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   154
    [author:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   155
        Claus Gittinger
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   156
"
119
claus
parents: 116
diff changeset
   157
!
claus
parents: 116
diff changeset
   158
claus
parents: 116
diff changeset
   159
examples
claus
parents: 116
diff changeset
   160
"
claus
parents: 116
diff changeset
   161
    SelectionInListView can be used both in the ST/X way, using action blocks
claus
parents: 116
diff changeset
   162
    or in the traditional mvc way.
claus
parents: 116
diff changeset
   163
    with actions:
claus
parents: 116
diff changeset
   164
125
claus
parents: 124
diff changeset
   165
      basic interface:
claus
parents: 124
diff changeset
   166
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   167
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   168
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   169
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   170
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   171
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   172
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   173
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   174
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   175
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   176
        slv list:#('one' 'two' 'three').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   177
        slv action:[:index | Transcript showCr:'selected ' , index printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   178
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   179
        top add:slv in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   180
        top open
125
claus
parents: 124
diff changeset
   181
claus
parents: 124
diff changeset
   182
claus
parents: 124
diff changeset
   183
      get element instead of index:
claus
parents: 124
diff changeset
   184
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   185
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   186
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   187
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   188
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   189
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   190
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   191
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   192
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   193
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   194
        slv list:#('one' 'two' 'three').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   195
        slv action:[:element | Transcript showCr:'selected ' , element printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   196
        slv useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   197
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   198
        top add:slv in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   199
        top open
125
claus
parents: 124
diff changeset
   200
claus
parents: 124
diff changeset
   201
claus
parents: 124
diff changeset
   202
      concrete example; show filenames:
claus
parents: 124
diff changeset
   203
      (notice: normally, you would use a FileSelectionList)
claus
parents: 124
diff changeset
   204
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   205
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   206
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   207
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   208
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   209
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   210
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   211
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   212
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   213
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   214
        slv list:(Filename currentDirectory directoryContents).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   215
        slv action:[:index | 
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   216
            Transcript showCr:'selected ' , index printString.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   217
            Transcript showCr:' the value is: ', slv selectionValue].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   218
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   219
        top add:slv in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   220
        top open
125
claus
parents: 124
diff changeset
   221
119
claus
parents: 116
diff changeset
   222
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   223
      add a scrollbar:
119
claus
parents: 116
diff changeset
   224
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   225
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   226
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   227
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   228
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   229
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   230
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   231
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   232
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   233
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   234
        slv list:(Filename currentDirectory directoryContents).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   235
        slv action:[:index | Transcript showCr:'selected ' , index printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   236
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   237
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   238
        top open
125
claus
parents: 124
diff changeset
   239
119
claus
parents: 116
diff changeset
   240
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   241
      allow reselect (clicking on already selected entry):
119
claus
parents: 116
diff changeset
   242
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   243
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   244
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   245
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   246
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   247
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   248
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   249
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   250
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   251
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   252
        slv list:(Filename currentDirectory directoryContents).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   253
        slv action:[:index | Transcript showCr:'selected ' , index printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   254
        slv ignoreReselect:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   255
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   256
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   257
        top open
125
claus
parents: 124
diff changeset
   258
119
claus
parents: 116
diff changeset
   259
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   260
      allow multiple selections:
119
claus
parents: 116
diff changeset
   261
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   262
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   263
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   264
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   265
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   266
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   267
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   268
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   269
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   270
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   271
        slv list:(Filename currentDirectory directoryContents).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   272
        slv action:[:indexList | Transcript showCr:'selected ' , indexList printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   273
        slv multipleSelectOk:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   274
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   275
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   276
        top open
125
claus
parents: 124
diff changeset
   277
claus
parents: 124
diff changeset
   278
claus
parents: 124
diff changeset
   279
      same, not using index:
claus
parents: 124
diff changeset
   280
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   281
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   282
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   283
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   284
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   285
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   286
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   287
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   288
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   289
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   290
        slv list:(Filename currentDirectory directoryContents).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   291
        slv action:[:indexList | Transcript showCr:'selected ' , indexList printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   292
        slv multipleSelectOk:true; useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   293
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   294
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   295
        top open
125
claus
parents: 124
diff changeset
   296
119
claus
parents: 116
diff changeset
   297
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   298
      strikeout mode (single):
119
claus
parents: 116
diff changeset
   299
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   300
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   301
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   302
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   303
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   304
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   305
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   306
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   307
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   308
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   309
        slv list:(Filename currentDirectory directoryContents).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   310
        slv action:[:index | Transcript showCr:'selected ' , index printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   311
        slv strikeOut:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   312
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   313
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   314
        top open
125
claus
parents: 124
diff changeset
   315
119
claus
parents: 116
diff changeset
   316
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   317
      strikeout mode (multiple):
119
claus
parents: 116
diff changeset
   318
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   319
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   320
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   321
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   322
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   323
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   324
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   325
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   326
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   327
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   328
        slv list:(Filename currentDirectory directoryContents).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   329
        slv action:[:index | Transcript showCr:'selected ' , index printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   330
        slv strikeOut:true; multipleSelectOk:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   331
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   332
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   333
        top open
125
claus
parents: 124
diff changeset
   334
119
claus
parents: 116
diff changeset
   335
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   336
      define what to do on double-click:
119
claus
parents: 116
diff changeset
   337
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   338
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   339
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   340
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   341
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   342
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   343
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   344
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   345
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   346
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   347
        slv list:(Filename currentDirectory directoryContents).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   348
        slv action:[:index | Transcript showCr:'selected ' , index printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   349
        slv doubleClickAction:[:index | Transcript showCr:'doubleclick on ' , index printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   350
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   351
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   352
        top open
119
claus
parents: 116
diff changeset
   353
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   354
119
claus
parents: 116
diff changeset
   355
    using a Model:
claus
parents: 116
diff changeset
   356
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   357
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   358
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   359
        model := Plug new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   360
        model respondTo:#getList with:[#('foo' 'bar' 'baz' 'hello')].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   361
        model respondTo:#initial with:[1].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   362
        model respondTo:#setSelection: with:[:arg | Transcript showCr:'model selected:', arg printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   363
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   364
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   365
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   366
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   367
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   368
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   369
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   370
        slv := SelectionInListView 
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   371
                   on:model
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   372
                   aspect:#someAspect
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   373
                   change:#setSelection:
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   374
                   list:#getList
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   375
                   initialSelection:#initial.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   376
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   377
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   378
        top open
119
claus
parents: 116
diff changeset
   379
claus
parents: 116
diff changeset
   380
      notice, that the ST-80 behavaior on reselect is to send a selection change
claus
parents: 116
diff changeset
   381
      with an index of 0.
claus
parents: 116
diff changeset
   382
claus
parents: 116
diff changeset
   383
125
claus
parents: 124
diff changeset
   384
    same, with useIndex false:
claus
parents: 124
diff changeset
   385
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   386
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   387
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   388
        model := Plug new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   389
        model respondTo:#getList with:[#('foo' 'bar' 'baz' 'hello')].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   390
        model respondTo:#initial with:['bar'].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   391
        model respondTo:#setSelection: with:[:arg | Transcript showCr:'model selected:', arg printString].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   392
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   393
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   394
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   395
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   396
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   397
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   398
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   399
        slv := SelectionInListView 
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   400
                   on:model
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   401
                   aspect:#someAspect
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   402
                   change:#setSelection:
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   403
                   list:#getList
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   404
                   initialSelection:#initial.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   405
        slv useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   406
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   407
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   408
        top open
125
claus
parents: 124
diff changeset
   409
claus
parents: 124
diff changeset
   410
155
claus
parents: 151
diff changeset
   411
    self changing list: 
claus
parents: 151
diff changeset
   412
    (selectionInListView updates itself when button changes initial selection):
claus
parents: 151
diff changeset
   413
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   414
        |top slv model sel changeButton|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   415
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   416
        sel := 'bar'.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   417
        model := Plug new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   418
        model respondTo:#getList with:['getList' printNL. #('foo' 'bar' 'baz' 'hello')].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   419
        model respondTo:#initial with:['initial' printNL. sel].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   420
        model respondTo:#setSelection: with:[:arg | ('model selected:', arg) printNL. sel := arg].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   421
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   422
        changeButton := Button label:'change selection'.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   423
        changeButton action:[sel := 'foo'. model changed:#initial].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   424
        changeButton open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   425
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   426
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   427
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   428
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   429
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   430
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   431
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   432
        slv := SelectionInListView 
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   433
                   on:model
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   434
                   aspect:#someAspect
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   435
                   change:#setSelection:
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   436
                   list:#getList
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   437
                   initialSelection:#initial.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   438
        slv useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   439
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   440
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   441
        top open
155
claus
parents: 151
diff changeset
   442
claus
parents: 151
diff changeset
   443
119
claus
parents: 116
diff changeset
   444
    using a SelectionInList-Model:
claus
parents: 116
diff changeset
   445
    (see how changes in the model (via list:...) are reflected in the view)
claus
parents: 116
diff changeset
   446
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   447
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   448
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   449
        model := SelectionInList with:#('foo' 'bar' 'baz' 'hello').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   450
        model selection:'bar'.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   451
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   452
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   453
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   454
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   455
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   456
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   457
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   458
        slv := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   459
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   460
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   461
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   462
449
725c26daf5d8 examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   463
        InspectorView openOn:model monitor:'selectionIndexHolder'
125
claus
parents: 124
diff changeset
   464
claus
parents: 124
diff changeset
   465
claus
parents: 124
diff changeset
   466
    two selectionInListViews on the same selectionInList model:
claus
parents: 124
diff changeset
   467
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   468
        |top1 slv1 top2 slv2 model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   469
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   470
        model := SelectionInList with:#('foo' 'bar' 'baz' 'hello').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   471
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   472
        top1 := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   473
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   474
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   475
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   476
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   477
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   478
        slv1 := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   479
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   480
        top1 add:(ScrollableView forView:slv1) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   481
        top1 open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   482
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   483
        top2 := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   484
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   485
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   486
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   487
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   488
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   489
        slv2 := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   490
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   491
        top2 add:(ScrollableView forView:slv2) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   492
        top2 open.
166
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   493
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   494
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   495
    a MultiSelectionInList model:
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   496
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   497
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   498
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   499
        model := MultiSelectionInList with:#('foo' 'bar' 'baz' 'hello').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   500
        model selection:#('foo' 'bar').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   501
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   502
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   503
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   504
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   505
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   506
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   507
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   508
        slv := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   509
        slv multipleSelectOk:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   510
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   511
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   512
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   513
449
725c26daf5d8 examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   514
        InspectorView openOn:model monitor:'selectionIndexHolder'
166
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   515
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   516
    with strikeOut:
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   517
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   518
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   519
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   520
        model := MultiSelectionInList with:#('foo' 'bar' 'baz' 'hello').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   521
        model selection:#('foo' 'bar').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   522
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   523
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   524
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   525
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   526
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   527
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   528
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   529
        slv := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   530
        slv multipleSelectOk:true; toggleSelect:true; strikeOut:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   531
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   532
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   533
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   534
449
725c26daf5d8 examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   535
        InspectorView openOn:model monitor:'selectionIndexHolder'
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   536
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   537
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   538
    two listViews on the same list, but separate selections
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   539
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   540
        |top top2 lv1 lv2 selInL1 selInL2 listHolder l1 l2|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   541
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   542
        top := StandardSystemView new extent:300@300.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   543
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   544
        lv1 := SelectionInListView origin:0.0@0.0 corner:1.0@0.5 in:top.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   545
        lv1 level:-1.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   546
        lv1 toggleSelect:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   547
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   548
        lv2 := SelectionInListView origin:0.0@0.5 corner:1.0@1.0 in:top.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   549
        lv2 level:-1.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   550
        lv2 toggleSelect:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   551
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   552
        selInL1 := SelectionInList new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   553
        selInL2 := SelectionInList new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   554
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   555
        listHolder := #('foo' 'bar' 'baz') asValue.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   556
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   557
        selInL1 listHolder:listHolder.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   558
        selInL2 listHolder:listHolder.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   559
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   560
        lv1 model:selInL1.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   561
        lv2 model:selInL2.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   562
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   563
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   564
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   565
        top2 := StandardSystemView new extent:100 @ 30.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   566
        l1 := Label origin:0.0@0.0 corner:0.5@1.0 in:top2.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   567
        l2 := Label origin:0.5@0.0 corner:1.0@1.0 in:top2.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   568
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   569
        l1 model:(BlockValue with:[:arg | arg value printString] argument:selInL1 selectionIndexHolder).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   570
        l2 model:(BlockValue with:[:arg | arg value printString] argument:selInL2 selectionIndexHolder).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   571
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   572
        l1 labelMessage:#value.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   573
        l2 labelMessage:#value.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   574
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   575
        top2 open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   576
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   577
        Delay waitForSeconds:2.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   578
        listHolder value:#('1' '2' '3' '4').
119
claus
parents: 116
diff changeset
   579
"
166
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   580
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   581
    "Modified: 26.10.1995 / 16:42:02 / cg"
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   582
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   583
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   584
!SelectionInListView class methodsFor:'instance creation'!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   585
125
claus
parents: 124
diff changeset
   586
on:aModel aspect:aspect change:change list:list initialSelection:initial
claus
parents: 124
diff changeset
   587
    ^ self on:aModel
claus
parents: 124
diff changeset
   588
	    printItems:true 
claus
parents: 124
diff changeset
   589
	    oneItem:false 
claus
parents: 124
diff changeset
   590
	    aspect:aspect
claus
parents: 124
diff changeset
   591
	    change:change 
claus
parents: 124
diff changeset
   592
	    list:list 
claus
parents: 124
diff changeset
   593
	    menu:nil 
claus
parents: 124
diff changeset
   594
	    initialSelection:initial 
claus
parents: 124
diff changeset
   595
	    useIndex:true 
claus
parents: 124
diff changeset
   596
!
claus
parents: 124
diff changeset
   597
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   598
on:aModel aspect:aspect change:change list:list menu:menu initialSelection:initial
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   599
    ^ self on:aModel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   600
	    printItems:true 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   601
	    oneItem:false 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   602
	    aspect:aspect
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   603
	    change:change 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   604
	    list:list 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   605
	    menu:menu
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   606
	    initialSelection:initial 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   607
	    useIndex:true 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   608
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   609
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   610
on:aModel printItems:print oneItem:one aspect:aspect
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   611
	      change:change list:list menu:menu initialSelection:initial
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   612
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   613
    "for ST-80 compatibility"
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   614
119
claus
parents: 116
diff changeset
   615
    ^ self on:aModel 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   616
	    printItems:print 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   617
	    oneItem:one 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   618
	    aspect:aspect
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   619
	    change:change 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   620
	    list:list 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   621
	    menu:menu
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   622
	    initialSelection:initial
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   623
	    useIndex:false 
119
claus
parents: 116
diff changeset
   624
!
claus
parents: 116
diff changeset
   625
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   626
on:aModel printItems:print oneItem:one aspect:aspect change:change 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   627
		list:list menu:menu initialSelection:initial useIndex:useIndex
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   628
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   629
    "for ST-80 compatibility"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   630
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   631
    ^ (self new) on:aModel 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   632
		 printItems:print 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   633
		 oneItem:one 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   634
		 aspect:aspect
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   635
		 change:change 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   636
		 list:list 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   637
		 menu:menu
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   638
		 initialSelection:initial
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   639
		 useIndex:useIndex
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   640
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   641
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   642
!SelectionInListView class methodsFor:'defaults'!
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   643
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   644
defaultAspectMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   645
    ^ nil
125
claus
parents: 124
diff changeset
   646
!
claus
parents: 124
diff changeset
   647
claus
parents: 124
diff changeset
   648
defaultChangeMessage
claus
parents: 124
diff changeset
   649
    ^ #selectionIndex: 
claus
parents: 124
diff changeset
   650
!
claus
parents: 124
diff changeset
   651
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   652
defaultListMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   653
    ^ #list 
125
claus
parents: 124
diff changeset
   654
!
claus
parents: 124
diff changeset
   655
claus
parents: 124
diff changeset
   656
defaultSelectionMessage
claus
parents: 124
diff changeset
   657
    ^ #selectionIndex 
claus
parents: 124
diff changeset
   658
!
claus
parents: 124
diff changeset
   659
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   660
rightArrowFormOn:aDevice
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   661
    "return the form used for the right arrow (non 3D)"
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   662
146
claus
parents: 133
diff changeset
   663
    |f bits|
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   664
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   665
    ((aDevice == Display) and:[RightArrowForm notNil]) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   666
	^ RightArrowForm
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   667
    ].
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   668
    f := Form fromFile:'RightArrow.xbm' resolution:100 on:aDevice.
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   669
    f isNil ifTrue:[
146
claus
parents: 133
diff changeset
   670
	DefaultRightArrowStyle == #solid ifTrue:[
claus
parents: 133
diff changeset
   671
	    bits := #[2r00000000 2r00000000 
claus
parents: 133
diff changeset
   672
		      2r00000000 2r00000000 
claus
parents: 133
diff changeset
   673
		      2r00000000 2r00000000 
claus
parents: 133
diff changeset
   674
		      2r00000010 2r00000000 
claus
parents: 133
diff changeset
   675
		      2r00000011 2r00000000 
claus
parents: 133
diff changeset
   676
		      2r00000011 2r10000000 
claus
parents: 133
diff changeset
   677
		      2r00000011 2r11000000 
claus
parents: 133
diff changeset
   678
		      2r00000011 2r11100000 
claus
parents: 133
diff changeset
   679
		      2r00000011 2r11110000 
claus
parents: 133
diff changeset
   680
		      2r00000011 2r11100000
claus
parents: 133
diff changeset
   681
		      2r00000011 2r11000000 
claus
parents: 133
diff changeset
   682
		      2r00000011 2r10000000 
claus
parents: 133
diff changeset
   683
		      2r00000011 2r00000000
claus
parents: 133
diff changeset
   684
		      2r00000010 2r00000000 
claus
parents: 133
diff changeset
   685
		      2r00000000 2r00000000 
claus
parents: 133
diff changeset
   686
		      2r00000000 2r00000000]
claus
parents: 133
diff changeset
   687
	] ifFalse:[
claus
parents: 133
diff changeset
   688
	    bits := #[2r00000000 2r00000000 
claus
parents: 133
diff changeset
   689
		      2r00000000 2r00000000 
claus
parents: 133
diff changeset
   690
		      2r00000000 2r00000000 
claus
parents: 133
diff changeset
   691
		      2r00000110 2r00000000 
claus
parents: 133
diff changeset
   692
		      2r00000101 2r00000000 
claus
parents: 133
diff changeset
   693
		      2r00000100 2r10000000 
claus
parents: 133
diff changeset
   694
		      2r00000100 2r01000000 
claus
parents: 133
diff changeset
   695
		      2r00000100 2r00100000 
claus
parents: 133
diff changeset
   696
		      2r00000100 2r00010000 
claus
parents: 133
diff changeset
   697
		      2r00000100 2r00100000
claus
parents: 133
diff changeset
   698
		      2r00000100 2r01000000 
claus
parents: 133
diff changeset
   699
		      2r00000100 2r10000000 
claus
parents: 133
diff changeset
   700
		      2r00000101 2r00000000
claus
parents: 133
diff changeset
   701
		      2r00000110 2r00000000 
claus
parents: 133
diff changeset
   702
		      2r00000000 2r00000000 
claus
parents: 133
diff changeset
   703
		      2r00000000 2r00000000]
claus
parents: 133
diff changeset
   704
	].
claus
parents: 133
diff changeset
   705
	f := Form width:16 height:16 fromArray:bits on:aDevice
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   706
    ].
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   707
    (aDevice == Display) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   708
	RightArrowForm := f
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   709
    ].
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   710
    ^ f
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   711
!
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   712
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   713
rightArrowLightFormOn:aDevice
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   714
    "return the form used for the right arrow light pixels (3D only)"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   715
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   716
    |f|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   717
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   718
    ((aDevice == Display) and:[RightArrowLightForm notNil]) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   719
	^ RightArrowLightForm
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   720
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   721
    f := Form fromFile:'RightArrowLight.xbm' resolution:100 on:aDevice.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   722
    f isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   723
	f := Form width:16 height:16 fromArray:#[2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   724
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   725
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   726
						 2r00000110 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   727
						 2r00000101 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   728
						 2r00000100 2r10000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   729
						 2r00000100 2r01000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   730
						 2r00000100 2r00100000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   731
						 2r00000100 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   732
						 2r00000100 2r00000000
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   733
						 2r00000100 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   734
						 2r00000100 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   735
						 2r00000100 2r00000000
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   736
						 2r00000100 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   737
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   738
						 2r00000000 2r00000000]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   739
					      on:aDevice
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   740
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   741
    (aDevice == Display) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   742
	RightArrowLightForm := f
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   743
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   744
    ^ f
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   745
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   746
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   747
rightArrowShadowFormOn:aDevice
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   748
    "return the form used for the right arrow light pixels (3D only)"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   749
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   750
    |f|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   751
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   752
    ((aDevice == Display) and:[RightArrowShadowForm notNil]) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   753
	^ RightArrowShadowForm
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   754
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   755
    f := Form fromFile:'RightArrowShadow.xbm' resolution:100 on:aDevice.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   756
    f isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   757
	f := Form width:16 height:16 fromArray:#[2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   758
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   759
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   760
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   761
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   762
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   763
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   764
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   765
						 2r00000000 2r00010000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   766
						 2r00000000 2r00100000
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   767
						 2r00000000 2r01000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   768
						 2r00000000 2r10000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   769
						 2r00000001 2r00000000
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   770
						 2r00000010 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   771
						 2r00000000 2r00000000 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   772
						 2r00000000 2r00000000]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   773
					      on:aDevice
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   774
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   775
    (aDevice == Display) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   776
	RightArrowShadowForm := f
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   777
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   778
    ^ f
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   779
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   780
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   781
smallRightArrowLightFormOn:aDevice
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   782
    "return the form used for the small right arrow light pixels (3D only)"
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   783
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   784
    |f|
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   785
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   786
    ((aDevice == Display) and:[SmallRightArrowLightForm notNil]) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   787
	^ SmallRightArrowLightForm
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   788
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   789
    f := Form fromFile:'SmallRightArrowLight.xbm' resolution:100 on:aDevice.
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   790
    f isNil ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   791
	f := Form width:9 height:9 fromArray:#[2r00000000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   792
					       2r01100000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   793
					       2r01011000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   794
					       2r01000110 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   795
					       2r01000000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   796
					       2r01000000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   797
					       2r01000000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   798
					       2r01000000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   799
					       2r00000000 2r00000000]
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   800
					      on:aDevice
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   801
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   802
    (aDevice == Display) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   803
	SmallRightArrowLightForm := f
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   804
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   805
    ^ f
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   806
!
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   807
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   808
smallRightArrowShadowFormOn:aDevice
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   809
    "return the form used for the small right arrow light pixels (3D only)"
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   810
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   811
    |f|
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   812
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   813
    ((aDevice == Display) and:[SmallRightArrowShadowForm notNil]) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   814
	^ SmallRightArrowShadowForm
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   815
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   816
    f := Form fromFile:'SmallRightArrowShadow.xbm' resolution:100 on:aDevice.
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   817
    f isNil ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   818
	f := Form width:9 height:9 fromArray:#[2r00000000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   819
					       2r00000000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   820
					       2r00000000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   821
					       2r00000000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   822
					       2r00000001 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   823
					       2r00000110 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   824
					       2r00011000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   825
					       2r00100000 2r00000000 
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   826
					       2r00000000 2r00000000]
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   827
					      on:aDevice
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   828
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   829
    (aDevice == Display) ifTrue:[
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   830
	SmallRightArrowShadowForm := f
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   831
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   832
    ^ f
125
claus
parents: 124
diff changeset
   833
!
claus
parents: 124
diff changeset
   834
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   835
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   836
    "extract values from the styleSheet and cache them in class variables"
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   837
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   838
    <resource: #style (#selectionDisabledForegroundColor
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   839
                       #selectionHilightForegroundColor #selectionHilightBackgroundColor
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   840
                       #selectionHilightFrameColor #selectionHilightLevel
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   841
                       #selectionRightArrowStyle #selectionRightArrowLevel
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   842
                       #selectionForegroundColor #selectionBackgroundColor
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   843
                       #selectionShadowColor #selectionLightColor
511
d8e810ae853e oops - typo
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
   844
                       #selectionFont #selectionHilightStyle)>
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   845
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   846
    DefaultDisabledForegroundColor := StyleSheet colorAt:'selectionDisabledForegroundColor'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   847
    DefaultHilightForegroundColor := StyleSheet colorAt:'selectionHilightForegroundColor'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   848
    DefaultHilightBackgroundColor := StyleSheet colorAt:'selectionHilightBackgroundColor'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   849
    DefaultHilightFrameColor := StyleSheet colorAt:'selectionHilightFrameColor'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   850
    DefaultHilightLevel := StyleSheet at:'selectionHilightLevel' default:0.
511
d8e810ae853e oops - typo
Claus Gittinger <cg@exept.de>
parents: 510
diff changeset
   851
    DefaultHilightStyle := StyleSheet at:'selectionHilightStyle' default:(StyleSheet name).
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   852
    DefaultRightArrowStyle := StyleSheet at:'selectionRightArrowStyle'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   853
    DefaultRightArrowLevel := StyleSheet at:'selectionRightArrowLevel'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   854
    DefaultForegroundColor := StyleSheet colorAt:'selectionForegroundColor'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   855
    DefaultBackgroundColor := StyleSheet colorAt:'selectionBackgroundColor'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   856
    DefaultShadowColor := StyleSheet colorAt:'selectionShadowColor'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   857
    DefaultLightColor := StyleSheet colorAt:'selectionLightColor'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   858
    DefaultFont := StyleSheet fontAt:'selectionFont'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   859
    RightArrowForm := nil.
125
claus
parents: 124
diff changeset
   860
claus
parents: 124
diff changeset
   861
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   862
     self updateStyleCache
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   863
    "
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
   864
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
   865
    "Modified: 21.3.1996 / 17:27:59 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   866
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   867
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   868
!SelectionInListView methodsFor:'accessing-actions'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   869
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   870
action:aBlock
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   871
    "set the action block to be performed on select"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   872
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   873
    actionBlock := aBlock
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   874
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   875
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   876
doubleClickAction:aOneArgBlock
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   877
    "set the double click action block.
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   878
     If non-nil, that one is evaluated on double click, passing the
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   879
     selection-line-number as argument."
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   880
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   881
    doubleClickActionBlock := aOneArgBlock
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   882
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   883
    "Modified: 24.2.1996 / 16:07:28 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   884
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   885
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   886
keyActionStyle:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   887
    "defines how the view should respond to alpha-keys pressed.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   888
     Possible values are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   889
	#select               -> will select next entry starting with that
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   890
				 character and perform the click-action
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   891
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   892
	#selectAndDoubleclick -> will select next & perform double-click action
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   893
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   894
	#pass                 -> will pass key to superclass (i.e. no special treatment)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   895
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   896
	nil                   -> will ignore key
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   897
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   898
     the default (set in #initialize) is #select
125
claus
parents: 124
diff changeset
   899
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   900
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   901
    keyActionStyle := aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   902
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   903
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   904
returnKeyActionStyle:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   905
    "defines how the view should respond to a return key pressed.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   906
     Possible values are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   907
	#doubleClick          -> perform double-click action
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   908
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   909
	#pass                 -> will pass key to superclass (i.e. no special treatment)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   910
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   911
	nil                   -> will ignore key
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   912
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   913
     the default (set in #initialize) is #doubleClick 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   914
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   915
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   916
    returnKeyActionStyle := aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   917
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   918
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   919
selectConditionBlock:aBlock
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   920
    "set the conditionBlock; this block is evaluated before a selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   921
     change is performed; the change will not be done, if the evaluation
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   922
     returns false. For example, this allows confirmation queries in
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   923
     the SystemBrowser"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   924
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   925
    selectConditionBlock := aBlock
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   926
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   927
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   928
useIndex:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   929
    "set/clear the useIndex flag. If set, both actionBlock and change-messages
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   930
     are passed the index(indices) of the selection as argument. 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   931
     If clear, the value(s) (i.e. the selected string) is passed.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   932
     Default is true."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   933
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   934
    useIndex := aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   935
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   936
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   937
!SelectionInListView methodsFor:'accessing-attributes'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   938
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   939
attributeAt:index
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   940
    "return the line attribute of list line index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   941
     currently supported are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   942
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   943
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   944
	 #bold
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   945
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   946
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   947
    listAttributes isNil ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   948
	(index > listAttributes size) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   949
	    ^ listAttributes at:index
125
claus
parents: 124
diff changeset
   950
	]
claus
parents: 124
diff changeset
   951
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   952
    ^ nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   953
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   954
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   955
attributeAt:index add:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   956
    "add to a lines attribute(s); 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   957
     currently supported are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   958
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   959
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   960
	 #bold 
125
claus
parents: 124
diff changeset
   961
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   962
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   963
    |current|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   964
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   965
    current := self attributeAt:index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   966
    current isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   967
	current := Set new.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   968
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   969
	current isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   970
	    current == aSymbolOrCollectionOfSymbols ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   971
	    current := Set with:current
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   972
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   973
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   974
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   975
    aSymbolOrCollectionOfSymbols isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   976
	current := current add:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   977
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   978
	(current includes:aSymbolOrCollectionOfSymbols) ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   979
	current addAll:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   980
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   981
    self attributeAt:index put:current
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   982
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   983
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   984
attributeAt:index put:aSymbolOrCollectionOfSymbolsOrNil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   985
    "set a lines attribute(s); 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   986
     currently supported are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   987
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   988
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   989
	 #bold 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   990
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   991
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   992
    (index > self size) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   993
	listAttributes isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   994
	    listAttributes := (OrderedCollection new:index) grow:index
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   995
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   996
	    (index > listAttributes size) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   997
		listAttributes grow:index
125
claus
parents: 124
diff changeset
   998
	    ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   999
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1000
	aSymbolOrCollectionOfSymbolsOrNil = (listAttributes at:index) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1001
	    listAttributes at:index put:aSymbolOrCollectionOfSymbolsOrNil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1002
	    self redrawLine:index
125
claus
parents: 124
diff changeset
  1003
	]
claus
parents: 124
diff changeset
  1004
    ]
claus
parents: 124
diff changeset
  1005
claus
parents: 124
diff changeset
  1006
!
claus
parents: 124
diff changeset
  1007
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1008
attributeAt:index remove:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1009
    "remove a line attribute; 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1010
     currently supported are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1011
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1012
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1013
	 #bold 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1014
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1015
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1016
    |current|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1017
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1018
    current := self attributeAt:index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1019
    current isNil ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1020
    current isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1021
	aSymbolOrCollectionOfSymbols isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1022
	    current == aSymbolOrCollectionOfSymbols ifTrue:[current := nil]
125
claus
parents: 124
diff changeset
  1023
	] ifFalse:[
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1024
	    (aSymbolOrCollectionOfSymbols includes:current) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1025
		current := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1026
	    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1027
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1028
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1029
	aSymbolOrCollectionOfSymbols isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1030
	    current := current remove:aSymbolOrCollectionOfSymbols ifAbsent:[]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1031
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1032
	    aSymbolOrCollectionOfSymbols removeAll:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1033
	]
125
claus
parents: 124
diff changeset
  1034
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1035
    self attributeAt:index put:current
125
claus
parents: 124
diff changeset
  1036
!
claus
parents: 124
diff changeset
  1037
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1038
line:lineNr hasAttribute:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1039
    "return true, if line nr has attribute, aSymbol; 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1040
     currently supported attributes are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1041
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1042
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1043
	 #bold 
125
claus
parents: 124
diff changeset
  1044
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1045
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1046
    |attr|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1047
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1048
    listAttributes isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1049
    (lineNr > listAttributes size) ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1050
    attr := listAttributes at:lineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1051
    attr isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1052
    attr isSymbol ifTrue:[^ attr == aSymbol].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1053
    ^ (attr includes:aSymbol)
125
claus
parents: 124
diff changeset
  1054
!
claus
parents: 124
diff changeset
  1055
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1056
setAttributes:aList
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1057
    "set the attribute list.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1058
     No redraw is done - the caller should make sure to redraw afterwards
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1059
     (or use this only before the view is visible)."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1060
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1061
    listAttributes := aList
125
claus
parents: 124
diff changeset
  1062
!
claus
parents: 124
diff changeset
  1063
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1064
strikeOut:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1065
    "turn on/off strikeOut mode"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1066
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1067
    strikeOut := aBoolean.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1068
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1069
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1070
!SelectionInListView methodsFor:'accessing-behavior'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1071
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1072
disable
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1073
    "disable the view - no selection changes are allowed"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1074
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1075
    enabled := false
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1076
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1077
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1078
enable
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1079
    "enable the view - selection changes are allowed"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1080
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1081
    enabled := true
125
claus
parents: 124
diff changeset
  1082
!
claus
parents: 124
diff changeset
  1083
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1084
ignoreReselect:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1085
    "set/clear the ignoreReselect flag - 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1086
     if set, a click on an already selected entry is ignored.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1087
     Otherwise the notification is done, even if no
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1088
     change in the selection occurs.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1089
     (for example, in browser to update a method).
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1090
     Setting ignoreReselect to false makes sense if data is shown
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1091
     which may change by itself (i.e. without the user doing anything)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1092
     For example, the inspector uses this, and redisplays the value,
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1093
     if the selection is the same.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1094
     The default is true, meaning that a click on an already selected
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1095
     does not lead to a notification via the actionBlock/change mechanism."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1096
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1097
    ignoreReselect := aBoolean
125
claus
parents: 124
diff changeset
  1098
!
claus
parents: 124
diff changeset
  1099
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1100
multipleSelectOk:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1101
    "allow/disallow multiple selections. If enabled, the
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1102
     user may select multiple entries in the list, and the program
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1103
     always gets a collection of selected items (indexes if useIndex is true,
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1104
     values otherwise). The default is false, for single selections."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1105
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1106
    multipleSelectOk := aBoolean.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1107
    aBoolean ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1108
	self enableButtonMotionEvents
125
claus
parents: 124
diff changeset
  1109
    ] ifFalse:[
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1110
	self disableButtonMotionEvents
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1111
    ] 
125
claus
parents: 124
diff changeset
  1112
!
claus
parents: 124
diff changeset
  1113
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1114
toggleSelect:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1115
    "turn on/off toggle select. If true, clicking on a selected entry
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1116
     unselects it and vice versa. The default is false, which means
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1117
     that clicking on an already selected entry does not change its
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1118
     select status (see also ignoreReselect:)."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1119
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1120
    toggleSelect := aBoolean.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1121
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1122
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1123
!SelectionInListView methodsFor:'accessing-contents'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1124
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1125
add:aValue beforeIndex:index
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1126
    "must recompute our current selections"
125
claus
parents: 124
diff changeset
  1127
claus
parents: 124
diff changeset
  1128
    selection notNil ifTrue:[
claus
parents: 124
diff changeset
  1129
	multipleSelectOk ifTrue:[
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1130
	    selection := selection collect:[ :sel |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1131
		sel >= index ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1132
		    sel + 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1133
		] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1134
		    sel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1135
		]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1136
	    ].
125
claus
parents: 124
diff changeset
  1137
	] ifFalse:[
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1138
	    selection >= index ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1139
		selection := selection + 1.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1140
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1141
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1142
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1143
    ^ super add:aValue beforeIndex:index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1144
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1145
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1146
contents:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1147
    "set the list - redefined, since setting the list implies unselecting
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1148
     and clearing attributes.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1149
     No redraw is done - the caller should make sure to redraw afterwards
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1150
     (or use this only before the view is visible)."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1151
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1152
    selection := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1153
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1154
    super contents:aCollection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1155
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1156
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1157
list:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1158
    "set the list - redefined, since setting the list implies unselecting
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1159
     and clearing attributes."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1160
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1161
    self list:aCollection keepSelection:false 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1162
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1163
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1164
list:aCollection keepSelection:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1165
    "set the list - redefined, since setting the list implies unselecting
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1166
     and clearing attributes."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1167
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1168
    |oldSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1169
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1170
    "somewhat of a kludge: if selection is first line,
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1171
     we have to remove the highlight frame by hand here"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1172
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1173
    (shown and:[hilightLevel ~~ 0]) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1174
	selection == firstLineShown ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1175
	   self paint:bgColor.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1176
	   self fillRectangleX:margin y:margin
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1177
			  width:(width - (margin * 2)) 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1178
			 height:(hilightLevel abs).
125
claus
parents: 124
diff changeset
  1179
	].
claus
parents: 124
diff changeset
  1180
    ].
claus
parents: 124
diff changeset
  1181
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1182
    aBoolean ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1183
	oldSelection := selection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1184
	selection := nil.
125
claus
parents: 124
diff changeset
  1185
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1186
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1187
    super list:aCollection expandTabs:printItems.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1188
    self selection:oldSelection. "/ nil if keep is false
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1189
!
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1190
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1191
printItems:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1192
    "set/clear the printItems flag. If set, items (as set via #list: or
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1193
     as returned from the model) are sent #printString to display them.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1194
     If false, items are assumed to be either strings, or know how to
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1195
     display themself in a GC (i.e. they are instances of ListEntry).
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1196
     The default is false.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1197
     Caveat: printString seems to be too specialized - I'd rather have
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1198
     a definable printSelector or - better - a printConverter.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1199
     This may be added in the future."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1200
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1201
    printItems := aBoolean
125
claus
parents: 124
diff changeset
  1202
!
claus
parents: 124
diff changeset
  1203
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1204
removeIndex:lineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1205
    "delete line - with redraw.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1206
     Redefined since we have to care for selection"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1207
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1208
    self checkRemovingSelection:lineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1209
    ^ super removeIndex:lineNr
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1210
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1211
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1212
removeIndexWithoutRedraw:lineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1213
    "delete line - no redraw;
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1214
     return true, if something was really deleted.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1215
     Redefined since we have to care for selection"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1216
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1217
    self checkRemovingSelection:lineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1218
    ^ super removeIndexWithoutRedraw:lineNr
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1219
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1220
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1221
setContents:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1222
    "set the list - redefined, since setting the list implies unselecting
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1223
     and clearing attributes.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1224
     No redraw is done - the caller should make sure to redraw afterwards
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1225
     (or use this only before the view is visible)."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1226
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1227
    selection := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1228
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1229
    super setContents:aCollection.
125
claus
parents: 124
diff changeset
  1230
!
claus
parents: 124
diff changeset
  1231
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1232
setList:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1233
    "set the list - redefined, since setting the list implies unselecting
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1234
     and clearing attributes.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1235
     No redraw is done - the caller should make sure to redraw afterwards
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1236
     (or use this only before the view is visible)."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1237
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1238
    selection := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1239
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1240
    super setList:aCollection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1241
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1242
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1243
!SelectionInListView methodsFor:'accessing-mvc'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1244
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1245
addModelInterfaceTo:aDictionary
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1246
    "see comment in View>>modelInterface"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1247
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1248
    super addModelInterfaceTo:aDictionary.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1249
    aDictionary at:#doubleClickMessage put:doubleClickMsg.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1250
    aDictionary at:#initialSelectionMessage put:initialSelectionMsg.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1251
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1252
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1253
     SelectionInListView new modelInterface 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1254
    "
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1255
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1256
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1257
doubleClick:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1258
    "set the symbol with which the model is informed about double-click.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1259
     OBSOLETE: please use #doubleClickMessage:"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1260
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1261
    self obsoleteMethodWarning:'please use #doubleClickMessage:'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1262
    doubleClickMsg := aSymbol
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1263
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1264
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1265
doubleClickMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1266
    "return the symbol with which the model (if any) is informed about 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1267
     double-click. If nil (which is the default), it is not informed."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1268
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1269
    ^ doubleClickMsg
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1270
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1271
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1272
doubleClickMessage:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1273
    "set the symbol with which the model (if any) is informed about double-click.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1274
     If nil (which is the default), it is not informed."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1275
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1276
    doubleClickMsg := aSymbol
119
claus
parents: 116
diff changeset
  1277
!
claus
parents: 116
diff changeset
  1278
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1279
initialSelectionMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1280
    "return the symbol by which the model informes me about a changed
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1281
     selectionIndex. This is used both in change notification and to
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1282
     actually aquire a new selection value."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1283
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1284
    ^ initialSelectionMsg
125
claus
parents: 124
diff changeset
  1285
!
claus
parents: 124
diff changeset
  1286
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1287
initialSelectionMessage:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1288
    "set the symbol by which the model informes me about a changed
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1289
     selectionIndex. This is used both in change notification and to
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1290
     actually aquire a new selection value."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1291
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1292
    initialSelectionMsg := aSymbol
125
claus
parents: 124
diff changeset
  1293
!
claus
parents: 124
diff changeset
  1294
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1295
on:aModel printItems:print oneItem:one aspect:aspectSymbol change:changeSymbol 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1296
		list:listSymbol menu:menuSymbol initialSelection:initialSymbol useIndex:use
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1297
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1298
    "ST-80 compatibility"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1299
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1300
    aspectMsg := aspectSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1301
    changeMsg := changeSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1302
    listMsg := listSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1303
    menuMsg := menuSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1304
    initialSelectionMsg := initialSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1305
    printItems := print.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1306
    oneItem := one.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1307
    useIndex := use.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1308
    ignoreReselect := false.    "/ ST80 behavior
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1309
    self model:aModel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1310
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1311
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1312
!SelectionInListView methodsFor:'accessing-selection'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1313
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1314
addElementToSelection:anObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1315
    "add the element with the same printstring as the argument, anObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1316
     to the selection. The entry is searched by comparing printStrings.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1317
     No scrolling is done. Returns true, if ok, false if no such entry
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1318
     was found."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1319
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1320
    |lineNo str|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1321
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1322
    str := anObject printString.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1323
    lineNo := list findFirst:[:entry | str = entry printString].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1324
    lineNo ~~ 0 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1325
	self addToSelection:lineNo.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1326
	^ true
125
claus
parents: 124
diff changeset
  1327
    ].
claus
parents: 124
diff changeset
  1328
    ^ false
claus
parents: 124
diff changeset
  1329
!
claus
parents: 124
diff changeset
  1330
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1331
addToSelection:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1332
    "add entry, aNumber to the selection. No scrolling is done."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1333
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1334
    (self isValidSelection:aNumber) ifFalse:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1335
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1336
    selection isNil ifTrue:[^ self selectWithoutScroll:aNumber].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1337
    selection isCollection ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1338
	(selection includes:aNumber) ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1339
	(selectConditionBlock notNil 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1340
		     and:[(selectConditionBlock value:aNumber) not]) ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1341
	selection add:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1342
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1343
	(aNumber == selection) ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1344
	(selectConditionBlock notNil 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1345
		     and:[(selectConditionBlock value:aNumber) not]) ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1346
	selection := OrderedCollection with:selection with:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1347
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1348
    self redrawElement:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1349
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1350
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1351
removeFromSelection:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1352
    "remove entry, aNumber from the selection."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1353
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1354
    selection isNil ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1355
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1356
    multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1357
	(selection includes:aNumber) ifFalse:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1358
	selection remove:aNumber.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1359
	selection size == 0 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1360
	    selection := nil
125
claus
parents: 124
diff changeset
  1361
	]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1362
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1363
	(aNumber == selection) ifFalse:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1364
	selection := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1365
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1366
    self redrawElement:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1367
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1368
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1369
!SelectionInListView methodsFor:'change & update'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1370
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1371
update:something with:aParameter from:changedObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1372
    changedObject == model ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1373
	something == aspectMsg ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1374
	    self getListFromModel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1375
	    self getSelectionFromModel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1376
	    ^ self
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1377
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1378
	something == listMsg ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1379
	    self getListFromModel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1380
	    ^ self
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1381
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1382
	something == initialSelectionMsg ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1383
	    self getSelectionFromModel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1384
	    ^ self
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1385
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1386
	something == #empty ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1387
	    self list:nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1388
	    ^ self
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1389
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1390
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1391
    ^ super update:something with:aParameter from:changedObject
125
claus
parents: 124
diff changeset
  1392
! !
claus
parents: 124
diff changeset
  1393
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1394
!SelectionInListView methodsFor:'drawing'!
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1395
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1396
drawRightArrowInVisibleLine:visLineNr
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1397
    "draw a right arrow (for submenus).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1398
     This method is not used here, but provided for subclasses such
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1399
     as menus or file-lists."
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1400
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1401
    |y x form form2 topLeftColor botRightColor t|
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1402
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1403
    x := width - 16.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1404
    y := (self yOfVisibleLine:visLineNr).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1405
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1406
    (device depth == 1 or:[arrowLevel == 0]) ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1407
	form := self class rightArrowFormOn:device.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1408
	form notNil ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1409
	    y := y + ((font height - form height) // 2).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1410
	    (self isInSelection:(self visibleLineToListLine:visLineNr)) ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1411
	        self foreground:hilightFgColor
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1412
	    ] ifFalse:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1413
	        self foreground:fgColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1414
	    ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1415
	    self displayForm:form x:x y:y.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1416
	]
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1417
    ] ifFalse:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1418
	smallArrow ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1419
	    form := self class smallRightArrowLightFormOn:device.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1420
	    form2 := self class smallRightArrowShadowFormOn:device.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1421
	] ifFalse:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1422
	    form := self class rightArrowLightFormOn:device.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1423
	    form2 := self class rightArrowShadowFormOn:device.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1424
	].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1425
	(form isNil or:[form2 isNil]) ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1426
	    "/ very bad conditions
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1427
	    ^ self
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1428
	].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1429
	y := y + ((font height - form height) // 2).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1430
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1431
	topLeftColor := lightColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1432
	botRightColor := shadowColor. 
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1433
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1434
	"openwin arrow stays down"
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1435
	styleSheet name ~~ #openwin ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1436
	    (self isInSelection:(self visibleLineToListLine:visLineNr)) ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1437
		t := topLeftColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1438
		topLeftColor := botRightColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1439
		botRightColor := t.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1440
	    ]
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1441
	].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1442
	arrowLevel < 0 ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1443
	    t := topLeftColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1444
	    topLeftColor := botRightColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1445
	    botRightColor := t.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1446
	].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1447
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1448
"/        self foreground:topLeftColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1449
self paint:topLeftColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1450
	self displayForm:form x:x y:y.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1451
"/        self foreground:botRightColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1452
self paint:botRightColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1453
	self displayForm:form2 x:x y:y.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1454
    ]
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1455
!
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1456
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1457
drawVisibleLineSelected:visLineNr
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1458
    "redraw a single line as selected."
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1459
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1460
    self drawVisibleLineSelected:visLineNr with:hilightFgColor and:hilightBgColor
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1461
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1462
    "Modified: 31.8.1995 / 19:24:09 / claus"
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1463
    "Modified: 28.2.1996 / 18:40:52 / cg"
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1464
!
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1465
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1466
drawVisibleLineSelected:visLineNr with:fg and:bg
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1467
    "redraw a single line as selected."
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1468
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1469
    |listLine 
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1470
     y  "{ Class: SmallInteger }" 
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1471
     y2 "{ Class: SmallInteger }" 
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1472
     wEdge|
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1473
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1474
    listLine := self visibleLineToListLine:visLineNr.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1475
    listLine notNil ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1476
        strikeOut ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1477
            self drawVisibleLine:visLineNr with:fgColor and:bgColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1478
            y := self yOfVisibleLine:visLineNr.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1479
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1480
            self paint:fgColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1481
            y := y + (fontHeight // 2).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1482
            self displayLineFromX:0 y:y toX:width y:y.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1483
            ^ self
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1484
        ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1485
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1486
        self drawVisibleLine:visLineNr with:fg and:bg.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1487
        y := (self yOfVisibleLine:visLineNr) - (lineSpacing//2).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1488
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1489
        "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1490
         a line above and below
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1491
        "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1492
        hilightFrameColor notNil ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1493
            hilightLevel == 0 ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1494
                self paint:hilightFrameColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1495
                self displayLineFromX:0 y:y toX:width y:y.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1496
                y2 := y + fontHeight - 1.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1497
                self displayLineFromX:0 y:y2 toX:width y:y2.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1498
                ^ self
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1499
            ]
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1500
        ] ifFalse:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1501
            hilightStyle == #motif ifTrue:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1502
                self paint:fg.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1503
                self displayLineFromX:0 y:y+1 toX:width y:y+1.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1504
                y2 := y + fontHeight - 1 - 1.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1505
                self displayLineFromX:0 y:y2 toX:width y:y2.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1506
            ]
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1507
        ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1508
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1509
        "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1510
         an edge it around
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1511
        "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1512
        (hilightLevel ~~ 0) ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1513
            "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1514
             let edge start at left, extending to the full width
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1515
             XXX: widthOfContents should be cached in ListView
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1516
                  (instead of recomputing all over)
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1517
            "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1518
            wEdge := width-(2 * margin).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1519
            includesNonStrings ifFalse:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1520
                wEdge := wEdge max:(self widthOfContents).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1521
            ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1522
            self drawEdgesForX:(margin - leftOffset) y:y 
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1523
                         width:wEdge+leftOffset height:fontHeight 
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1524
                         level:hilightLevel.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1525
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1526
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1527
        ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1528
        ^ self
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1529
    ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1530
    ^ super drawVisibleLine:visLineNr with:fg and:bg
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1531
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1532
    "Modified: 31.8.1995 / 19:24:09 / claus"
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1533
    "Created: 28.2.1996 / 18:40:21 / cg"
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1534
    "Modified: 21.3.1996 / 17:30:41 / cg"
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1535
! !
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1536
125
claus
parents: 124
diff changeset
  1537
!SelectionInListView methodsFor:'event handling'!
claus
parents: 124
diff changeset
  1538
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1539
buttonMotion:buttonMask x:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1540
    "mouse-move while button was pressed - handle selection changes"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1541
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1542
    |movedVisibleLine movedLine delta oldSelection oldSelCount|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1543
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1544
    "is it the select or 1-button ?"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1545
    (device buttonMotionMask:buttonMask includesButton:#select) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1546
	(device buttonMotionMask:buttonMask includesButton:1) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1547
	    ^ self
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1548
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1549
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1550
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1551
    clickLine isNil ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1552
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1553
    "if moved outside of view, start autoscroll"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1554
    (y < 0) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1555
	self compressMotionEvents:false.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1556
	self startAutoScrollUp:y.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1557
	^ self
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1558
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1559
    (y > height) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1560
	self compressMotionEvents:false.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1561
	self startAutoScrollDown:(y - height).
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1562
	^ self
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1563
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1564
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1565
    "move inside - stop autoscroll if any"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1566
    self stopAutoScroll.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1567
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1568
    movedVisibleLine := self visibleLineOfY:y.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1569
    movedLine := self visibleLineToAbsoluteLine:movedVisibleLine.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1570
    (movedLine == clickLine) ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1571
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1572
    multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1573
	delta := (clickLine < movedLine) ifTrue:[1] ifFalse:[-1].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1574
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1575
	oldSelection := selection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1576
	oldSelCount := selection size.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1577
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1578
	(clickLine+delta) to:movedLine by:delta do:[:line |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1579
	    (self isInSelection:line) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1580
		self removeFromSelection:line
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1581
	    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1582
		self addToSelection:line
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1583
	    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1584
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1585
	((selection ~= oldSelection)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1586
	 or:[selection size ~~ oldSelCount]) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1587
	    self selectionChangedFrom:oldSelection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1588
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1589
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1590
"/        self selectWithoutScroll:movedLine
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1591
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1592
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1593
    clickLine := movedLine
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1594
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1595
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1596
buttonMultiPress:button x:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1597
    ((button == 1) or:[button == #select]) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1598
"/        doubleClickActionBlock isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1599
"/            self buttonPress:button x:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1600
"/        ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1601
	self doubleClicked.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1602
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1603
	super buttonMultiPress:button x:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1604
    ]
125
claus
parents: 124
diff changeset
  1605
!
claus
parents: 124
diff changeset
  1606
claus
parents: 124
diff changeset
  1607
buttonPress:button x:x y:y
claus
parents: 124
diff changeset
  1608
    |oldSelection listLineNr|
claus
parents: 124
diff changeset
  1609
claus
parents: 124
diff changeset
  1610
    ((button == 1) or:[button == #select]) ifTrue:[
claus
parents: 124
diff changeset
  1611
	enabled ifTrue:[
claus
parents: 124
diff changeset
  1612
	    listLineNr := self visibleLineToListLine:(self visibleLineOfY:y).
claus
parents: 124
diff changeset
  1613
	    listLineNr notNil ifTrue:[
claus
parents: 124
diff changeset
  1614
		(toggleSelect 
claus
parents: 124
diff changeset
  1615
		and:[self isInSelection:listLineNr]) ifTrue:[
claus
parents: 124
diff changeset
  1616
		    oldSelection := selection copy.
claus
parents: 124
diff changeset
  1617
		    self removeFromSelection:listLineNr
claus
parents: 124
diff changeset
  1618
		] ifFalse:[
claus
parents: 124
diff changeset
  1619
		    (self line:listLineNr hasAttribute:#disabled) ifTrue:[^ self].
claus
parents: 124
diff changeset
  1620
claus
parents: 124
diff changeset
  1621
		    (selectConditionBlock notNil 
claus
parents: 124
diff changeset
  1622
		     and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self].
claus
parents: 124
diff changeset
  1623
claus
parents: 124
diff changeset
  1624
		    (toggleSelect and:[multipleSelectOk]) ifTrue:[
claus
parents: 124
diff changeset
  1625
			oldSelection := selection copy.
claus
parents: 124
diff changeset
  1626
			self addToSelection:listLineNr
claus
parents: 124
diff changeset
  1627
		    ] ifFalse:[
claus
parents: 124
diff changeset
  1628
			oldSelection := selection copy.
claus
parents: 124
diff changeset
  1629
			self selectWithoutScroll:listLineNr.
claus
parents: 124
diff changeset
  1630
		    ].
claus
parents: 124
diff changeset
  1631
		].
claus
parents: 124
diff changeset
  1632
		((ignoreReselect not and:[selection notNil])
claus
parents: 124
diff changeset
  1633
		 or:[selection ~= oldSelection]) ifTrue:[
claus
parents: 124
diff changeset
  1634
		    self selectionChangedFrom:oldSelection.
claus
parents: 124
diff changeset
  1635
		].
claus
parents: 124
diff changeset
  1636
		clickLine := listLineNr
claus
parents: 124
diff changeset
  1637
	    ].
claus
parents: 124
diff changeset
  1638
	]
claus
parents: 124
diff changeset
  1639
    ] ifFalse:[
claus
parents: 124
diff changeset
  1640
	super buttonPress:button x:x y:y
claus
parents: 124
diff changeset
  1641
    ]
claus
parents: 124
diff changeset
  1642
!
claus
parents: 124
diff changeset
  1643
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1644
buttonRelease:button x:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1645
    "stop any autoscroll"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1646
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1647
    self stopAutoScroll
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1648
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1649
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1650
buttonShiftPress:button x:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1651
    "add to the selection (if multipleSelectOk); otherwise,
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1652
     behave like normal select"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1653
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1654
    |oldSelection listLineNr|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1655
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1656
    ((button == 1) or:[button == #select]) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1657
	toggleSelect ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1658
	    ^ self buttonPress:button x:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1659
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1660
	enabled ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1661
	    listLineNr := self visibleLineToListLine:(self visibleLineOfY:y).
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1662
	    listLineNr notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1663
		(self line:listLineNr hasAttribute:#disabled) ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1664
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1665
		(selectConditionBlock notNil 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1666
		 and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self].
125
claus
parents: 124
diff changeset
  1667
	    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1668
	    oldSelection := selection copy.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1669
	    listLineNr notNil ifTrue: [
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1670
		multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1671
		    (self isInSelection:listLineNr) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1672
			self removeFromSelection:listLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1673
		    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1674
			self addToSelection:listLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1675
		    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1676
		] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1677
		    self selectWithoutScroll:listLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1678
		]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1679
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1680
	    ((ignoreReselect not and:[selection notNil])
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1681
	     or:[selection ~= oldSelection]) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1682
		self selectionChangedFrom:oldSelection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1683
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1684
	    clickLine := listLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1685
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1686
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1687
	super buttonShiftPress:button x:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1688
    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1689
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1690
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1691
doubleClicked
554
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1692
    |arg|
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1693
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1694
    selection isNil ifTrue:[
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1695
        "/ can only happen if claus modifies the selection within
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1696
        "/ the selectAction ....
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1697
        ^ self
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1698
    ].
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1699
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1700
    doubleClickActionBlock notNil ifTrue:[doubleClickActionBlock value:selection].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1701
    (model notNil and:[doubleClickMsg notNil]) ifTrue:[
554
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1702
        self sendChangeMessage:doubleClickMsg with:(self argForChangeMessage).
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1703
    ].
554
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1704
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  1705
    "Modified: 19.4.1996 / 18:23:14 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1706
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1707
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1708
key:key select:index x:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1709
    "select an entry by a keyboard action.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1710
     This is treated like a doubleClick on that entry"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1711
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1712
    |oldSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1713
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1714
    (selectConditionBlock isNil or:[selectConditionBlock value:index]) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1715
	keyActionStyle notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1716
	    keyActionStyle == #pass ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1717
		^ super keyPress:key x:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1718
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1719
	    oldSelection := selection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1720
	    self selection:index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1721
	    self selectionChangedFrom:oldSelection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1722
	    keyActionStyle == #selectAndDoubleClick ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1723
		self doubleClicked
125
claus
parents: 124
diff changeset
  1724
	    ]
claus
parents: 124
diff changeset
  1725
	]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1726
    ].
125
claus
parents: 124
diff changeset
  1727
!
claus
parents: 124
diff changeset
  1728
claus
parents: 124
diff changeset
  1729
keyPress:key x:x y:y
claus
parents: 124
diff changeset
  1730
    "handle keyboard input"
claus
parents: 124
diff changeset
  1731
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  1732
    <resource: #keyboard ( #CursorUp #CursorDown #BeginOfText #EndOfText
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  1733
                           #Return ) >
132
claus
parents: 131
diff changeset
  1734
210
f7d44c195776 search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  1735
    |index       
f7d44c195776 search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  1736
     searchIndex "{Class: SmallInteger}"
f7d44c195776 search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  1737
     startSearch "{Class: SmallInteger}"
f7d44c195776 search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  1738
     backSearch searchPrefix|
125
claus
parents: 124
diff changeset
  1739
claus
parents: 124
diff changeset
  1740
    (key == #CursorUp) ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1741
        index := self previousBeforeSelection.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1742
        self key:key select:index x:x y:y.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1743
        ^ self
125
claus
parents: 124
diff changeset
  1744
    ].
claus
parents: 124
diff changeset
  1745
    (key == #CursorDown) ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1746
        index := self nextAfterSelection.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1747
        self key:key select:index x:x y:y.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1748
        ^ self
125
claus
parents: 124
diff changeset
  1749
    ].
claus
parents: 124
diff changeset
  1750
    "/
claus
parents: 124
diff changeset
  1751
    "/ stupid: Home and End are cought in ScrollableView
claus
parents: 124
diff changeset
  1752
    "/ we normally do not get them ...
claus
parents: 124
diff changeset
  1753
    "/ (need to call handlesKey: from there ...
claus
parents: 124
diff changeset
  1754
    "/  ... and implement it here)
claus
parents: 124
diff changeset
  1755
    "/
132
claus
parents: 131
diff changeset
  1756
    (key == #BeginOfText) ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1757
        self key:key select:1 x:x y:y.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1758
        ^ self
125
claus
parents: 124
diff changeset
  1759
    ].
132
claus
parents: 131
diff changeset
  1760
    (key == #EndOfText) ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1761
        index := self size.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1762
        self key:key select:index x:x y:y.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1763
        ^ self
125
claus
parents: 124
diff changeset
  1764
    ].
claus
parents: 124
diff changeset
  1765
    key == #Return ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1766
        returnKeyActionStyle == #doubleClick ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1767
            selection notNil ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1768
                self doubleClicked
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1769
            ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1770
            ^ self
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1771
        ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1772
        returnKeyActionStyle ~~ #pass ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1773
            ^ self
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1774
        ].
125
claus
parents: 124
diff changeset
  1775
    ].
claus
parents: 124
diff changeset
  1776
claus
parents: 124
diff changeset
  1777
    "
claus
parents: 124
diff changeset
  1778
     alphabetic keys: search for next entry
claus
parents: 124
diff changeset
  1779
     starting with keys character. If shift is pressed, search backward
claus
parents: 124
diff changeset
  1780
    "
claus
parents: 124
diff changeset
  1781
    (self size > 0
claus
parents: 124
diff changeset
  1782
    and:[key isCharacter
claus
parents: 124
diff changeset
  1783
    and:[key isLetter]]) ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1784
        keyActionStyle isNil ifTrue:[^ self].
364
8f0d8e4088c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
  1785
"/        multipleSelectOk ifTrue:[^ self].
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1786
        keyActionStyle == #pass ifFalse:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1787
            searchPrefix := key asLowercase asString.
125
claus
parents: 124
diff changeset
  1788
claus
parents: 124
diff changeset
  1789
"/            ... isISearch... ifFalse:[
claus
parents: 124
diff changeset
  1790
"/                iSearchString := ''
claus
parents: 124
diff changeset
  1791
"/            ] ifTrue:[
claus
parents: 124
diff changeset
  1792
"/                iSearchString := iSearchString , searchPrefix.
claus
parents: 124
diff changeset
  1793
"/                searchPrefix := iSearchString
claus
parents: 124
diff changeset
  1794
"/            ].
claus
parents: 124
diff changeset
  1795
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1796
            backSearch := self sensor shiftDown.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1797
            backSearch ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1798
                selection notNil ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1799
                    selection size > 0 ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1800
                        startSearch := selection first - 1
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1801
                    ] ifFalse:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1802
                        startSearch := selection - 1
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1803
                    ]
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1804
                ] ifFalse:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1805
                    startSearch := self size
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1806
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1807
                startSearch < 1 ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1808
                    startSearch := self size.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1809
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1810
            ] ifFalse:[    
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1811
                selection notNil ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1812
                    selection size > 0 ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1813
                        startSearch := selection last + 1
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1814
                    ] ifFalse:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1815
                        startSearch := selection + 1
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1816
                    ]
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1817
                ] ifFalse:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1818
                    startSearch := 1
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1819
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1820
                startSearch > self size ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1821
                    startSearch := 1.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1822
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1823
            ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1824
            searchIndex := startSearch.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1825
            [true] whileTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1826
                (((self at:searchIndex) asString) withoutSeparators asLowercase startsWith:searchPrefix) ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1827
                    searchIndex = selection ifTrue:[^ self].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1828
                    ^ self key:key select:searchIndex x:x y:y
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1829
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1830
                backSearch ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1831
                    searchIndex := searchIndex - 1.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1832
                    searchIndex < 1 ifTrue:[searchIndex := self size]
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1833
                ] ifFalse:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1834
                    searchIndex := searchIndex + 1.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1835
                    searchIndex > self size ifTrue:[searchIndex := 1].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1836
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1837
                searchIndex == startSearch ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1838
                    ^ self
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1839
                ]
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1840
            ]
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1841
        ].
125
claus
parents: 124
diff changeset
  1842
    ].
claus
parents: 124
diff changeset
  1843
    ^ super keyPress:key x:x y:y
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  1844
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  1845
    "Modified: 7.3.1996 / 13:18:46 / cg"
125
claus
parents: 124
diff changeset
  1846
!
claus
parents: 124
diff changeset
  1847
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1848
sizeChanged:how
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1849
    "if there is a selection, make certain, its visible
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1850
     after the sizechange"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1851
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1852
    |first wasAtEnd|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1853
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1854
    wasAtEnd := (firstLineShown + nFullLinesShown) >= self size.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1855
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1856
    super sizeChanged:how.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1857
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1858
    shown ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1859
        selection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1860
            multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1861
                first := selection firstIfEmpty:nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1862
            ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1863
                first := selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1864
            ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1865
            first notNil ifTrue:[self makeLineVisible:first]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1866
        ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1867
            "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1868
             if we where at the end before, move to the end again.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1869
             Still to be seen, if this is better in real life ...
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1870
            "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1871
            wasAtEnd ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1872
                "at end"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1873
                self scrollToBottom
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1874
            ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1875
        ]
125
claus
parents: 124
diff changeset
  1876
    ]
claus
parents: 124
diff changeset
  1877
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1878
    "Modified: 6.2.1996 / 15:28:21 / cg"
155
claus
parents: 151
diff changeset
  1879
! !
claus
parents: 151
diff changeset
  1880
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1881
!SelectionInListView methodsFor:'initialization'!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1882
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1883
initCursor
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1884
    "set the cursor - a hand"
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1885
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1886
    cursor := Cursor hand
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1887
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1888
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1889
initStyle
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1890
    |nm|
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1891
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1892
    super initStyle.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1893
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
  1894
"/    DefaultFont notNil ifTrue:[font := DefaultFont on:device].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1895
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1896
    bgColor := viewBackground.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1897
    hilightFrameColor := nil.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1898
    hilightLevel := 0.
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1899
    hilightStyle := DefaultHilightStyle.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1900
    arrowLevel := 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1901
    smallArrow := false.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1902
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1903
    device hasGreyscales ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1904
        "
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1905
         must get rid of these hard codings
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1906
        "
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1907
        (hilightStyle == #next) ifTrue:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1908
            hilightFgColor := fgColor.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1909
            hilightBgColor := White.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1910
            hilightFrameColor := fgColor
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1911
        ] ifFalse:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1912
            (hilightStyle == #motif) ifTrue:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1913
                fgColor := White.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1914
                bgColor := Grey.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1915
                viewBackground := bgColor.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1916
                hilightFgColor := bgColor  "fgColor" "White".
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1917
                hilightBgColor := fgColor "bgColor lightened" "darkened".
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1918
            ] ifFalse:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1919
                (hilightStyle == #openwin) ifTrue:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1920
                    hilightFgColor := fgColor.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1921
                    hilightBgColor := Color grey.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1922
                    smallArrow := true.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1923
                ]
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1924
            ]
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1925
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1926
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1927
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1928
    hilightFgColor isNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1929
        hilightFgColor := bgColor.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1930
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1931
    hilightBgColor isNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1932
        hilightBgColor := fgColor.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1933
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1934
    DefaultForegroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1935
        fgColor := DefaultForegroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1936
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1937
    DefaultBackgroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1938
        bgColor := viewBackground := DefaultBackgroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1939
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1940
    DefaultHilightForegroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1941
        hilightFgColor := DefaultHilightForegroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1942
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1943
    DefaultHilightBackgroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1944
        hilightBgColor := DefaultHilightBackgroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1945
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1946
    DefaultHilightFrameColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1947
        hilightFrameColor := DefaultHilightFrameColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1948
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1949
    DefaultHilightLevel notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1950
        hilightLevel := DefaultHilightLevel
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1951
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1952
    DefaultRightArrowLevel notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1953
        arrowLevel := DefaultRightArrowLevel
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1954
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1955
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1956
    DefaultShadowColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1957
        shadowColor := DefaultShadowColor on:device
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1958
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1959
    DefaultLightColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1960
        lightColor := DefaultLightColor on:device
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1961
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1962
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1963
    (hilightLevel abs > 0) ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1964
        lineSpacing := 3
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1965
    ] ifFalse:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1966
        lineSpacing := 2
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1967
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1968
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1969
    hilightFgColor isNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1970
        hilightFgColor := bgColor.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1971
        hilightBgColor := fgColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1972
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1973
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1974
    DefaultDisabledForegroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1975
        halfIntensityFgColor := DefaultDisabledForegroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1976
    ] ifFalse:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1977
        halfIntensityFgColor := Color darkGrey.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1978
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1979
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1980
    fgColor := fgColor on:device.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1981
    bgColor := bgColor on:device.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1982
    halfIntensityFgColor := halfIntensityFgColor on:device.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1983
    hilightFrameColor notNil ifTrue:[hilightFrameColor := hilightFrameColor on:device].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1984
    hilightFgColor := hilightFgColor on:device.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1985
    hilightBgColor := hilightBgColor on:device.
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1986
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  1987
    "Modified: 21.3.1996 / 17:30:23 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1988
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1989
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1990
initialize
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1991
    super initialize.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1992
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1993
    fontHeight := font height + lineSpacing.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1994
    enabled := true.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1995
    ignoreReselect := true.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1996
    multipleSelectOk := toggleSelect := strikeOut := printItems := false.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1997
    useIndex := true.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1998
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1999
    keyActionStyle := #select.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2000
    returnKeyActionStyle := #doubleClick.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2001
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2002
    listMsg := self class defaultListMessage.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2003
    initialSelectionMsg := self class defaultSelectionMessage.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2004
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2005
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2006
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2007
realize
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2008
    super realize.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2009
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2010
"/    self getListFromModel.   -- not needed; superclass did it already
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2011
    self getSelectionFromModel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2012
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2013
    selection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2014
	selection isCollection ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2015
	    selection notEmpty ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2016
		self makeLineVisible:selection first
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2017
	    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2018
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2019
	    self makeLineVisible:selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2020
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2021
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2022
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2023
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2024
!SelectionInListView methodsFor:'private'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2025
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2026
argForChangeMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2027
    "return the argument for a selectionChange;
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2028
     depending on the setting of useIndex, this is either the numeric
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2029
     index of the selection or the value (i.e. the string)"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2030
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2031
    useIndex ~~ false ifTrue:[  "/ i.e. everything except false
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2032
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2033
	    selection isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2034
		^ #() 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2035
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2036
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2037
	^ selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2038
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2039
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2040
    printItems ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2041
	^ self selectionValue
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2042
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2043
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2044
    items notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2045
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2046
	    ^ selection collect:[:nr | items at:nr]
128
claus
parents: 125
diff changeset
  2047
	].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2048
	^ items at:selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2049
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2050
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2051
    ^ nil       "/ cannot happen
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2052
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2053
    "Modified: 26.10.1995 / 16:28:13 / cg"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2054
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2055
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2056
checkRemovingSelection:lineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2057
    "when a line is removed, we have to adjust selection"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2058
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2059
    |newSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2060
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2061
    selection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2062
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2063
	    newSelection := OrderedCollection new.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2064
	    selection do:[:sel |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2065
		sel < lineNr ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2066
		    newSelection add:sel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2067
		] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2068
		    sel > lineNr ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2069
			newSelection add:(sel - 1)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2070
		    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2071
		    "otherwise remove it from the selection"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2072
		]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2073
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2074
	    newSelection size == 0 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2075
		selection := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2076
	    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2077
		selection := newSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2078
	    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2079
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2080
	    selection == lineNr ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2081
		selection := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2082
	    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2083
		selection > lineNr ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2084
		    selection := selection - 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2085
		]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2086
	    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2087
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2088
    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2089
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2090
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2091
getListFromModel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2092
    "if I have a model and a listMsg, get my list from it"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2093
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2094
    |text|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2095
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2096
    model notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2097
	listMsg notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2098
	    items := model perform:listMsg.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2099
	    items notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2100
		printItems ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2101
		    text := items collect:[:element | element printString]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2102
		] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2103
		    text := items
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2104
		].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2105
"/                text notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2106
"/                    text := text asStringCollection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2107
"/                ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2108
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2109
	    self list:text keepSelection:true. "/ expandTabs:false
128
claus
parents: 125
diff changeset
  2110
	].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2111
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2112
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2113
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2114
getSelectionFromModel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2115
    "if I have a model and an initialSelectionMsg, get my selection from it"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2116
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2117
    |sel|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2118
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2119
    model notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2120
	initialSelectionMsg notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2121
	    sel := model perform:initialSelectionMsg.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2122
	    useIndex ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2123
		self selection:sel 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2124
	    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2125
		self selectElement:sel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2126
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2127
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2128
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2129
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2130
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2131
isValidSelection:aNumberOrCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2132
    "return true, if aNumber is ok as a selection index"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2133
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2134
    aNumberOrCollection isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2135
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2136
    (aNumberOrCollection isCollection) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2137
	multipleSelectOk ifFalse:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2138
	aNumberOrCollection do:[:index |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2139
	    (index between:1 and:self size) ifFalse:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2140
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2141
	^ true.
125
claus
parents: 124
diff changeset
  2142
    ] ifFalse:[
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2143
	^ (aNumberOrCollection between:1 and:self size).
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2144
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2145
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2146
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2147
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2148
positionToSelectionX:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2149
    "given a click position, return the selection lineNo"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2150
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2151
    |visibleLine|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2152
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2153
    (x between:0 and:width) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2154
	(y between:0 and:height) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2155
	    visibleLine := self visibleLineOfY:y.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2156
	    ^ self visibleLineToListLine:visibleLine
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2157
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2158
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2159
    ^ nil
125
claus
parents: 124
diff changeset
  2160
!
claus
parents: 124
diff changeset
  2161
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2162
scrollSelectDown
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2163
    "auto scroll action; scroll and reinstall timed-block"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2164
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2165
    self scrollDown.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2166
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2167
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2168
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2169
scrollSelectUp
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2170
    "auto scroll action; scroll and reinstall timed-block"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2171
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2172
    self scrollUp.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2173
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2174
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2175
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2176
visibleLineNeedsSpecialCare:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2177
    |listLine|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2178
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2179
    listLine := self visibleLineToListLine:visLineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2180
    listLine isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2181
    (self isInSelection:listLine) ifTrue:[^ true].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2182
    listAttributes notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2183
	(listLine <= listAttributes size) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2184
	    ^ (listAttributes at:listLine) notNil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2185
	]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2186
    ].
125
claus
parents: 124
diff changeset
  2187
    ^ false
claus
parents: 124
diff changeset
  2188
!
claus
parents: 124
diff changeset
  2189
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2190
widthForScrollBetween:start and:end
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2191
    "has to be redefined since WHOLE line is inverted/modified sometimes"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2192
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2193
    | anySelectionInRange |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2194
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2195
    selection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2196
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2197
	    anySelectionInRange := false.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2198
	    selection do:[:s |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2199
		(s between:start and:end) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2200
		    anySelectionInRange := true
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2201
		]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2202
	    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2203
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2204
	    anySelectionInRange := selection between:start and:end
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2205
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2206
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2207
	anySelectionInRange := false
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2208
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2209
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2210
    anySelectionInRange ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2211
	^ width
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2212
"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2213
	self is3D ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2214
	    ^ width 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2215
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2216
	( #(next openwin) includes:styleSheet name) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2217
	    ^ width 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2218
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2219
	viewBackground = background ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2220
	    ^ width 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2221
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2222
"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2223
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2224
    ^ super widthForScrollBetween:start and:end
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2225
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2226
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2227
!SelectionInListView methodsFor:'queries'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2228
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2229
specClass
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2230
    self class == SelectionInListView ifTrue:[^ SequenceViewSpec].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2231
    ^ nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2232
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2233
    "Modified: 5.9.1995 / 23:05:53 / claus"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2234
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2235
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2236
!SelectionInListView methodsFor:'redrawing'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2237
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2238
redrawElement:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2239
    "redraw an individual element"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2240
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2241
    ^ self redrawLine:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2242
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2243
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2244
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2245
    "redraw a range of lines.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2246
     Must check, if any is in the selection and handle this case.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2247
     Otherwise draw it en-bloque using supers method."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2248
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2249
    |special sel
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2250
     l1 "{ Class: SmallInteger }"
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2251
     l2 "{ Class: SmallInteger }"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2252
     selNo "{ Class: SmallInteger }" |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2253
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2254
    ((selection isCollection) or:[listAttributes notNil]) ifTrue:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2255
        l1 := startVisLineNr.
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2256
        l2 := endVisLineNr. 
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2257
        l1 to:l2 do:[:visLine |
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2258
            self redrawVisibleLine:visLine
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2259
        ].
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2260
        ^ self
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2261
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2262
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2263
"XXX only if -1/+1"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2264
"/    hilightLevel ~~ 0 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2265
"/     self paint:bgColor.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2266
"/     self fillRectangleX:0 y:(self yOfVisibleLine:startVisLineNr)-1 width:width height:1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2267
"/  ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2268
    special := true.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2269
    selection isNil ifTrue:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2270
        special := false
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2271
    ] ifFalse:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2272
        sel := self listLineToVisibleLine:selection.
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2273
        sel isNil ifTrue:[
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2274
            special := false
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2275
        ] ifFalse:[
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2276
            special := (sel between:startVisLineNr and:endVisLineNr)
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2277
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2278
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2279
    special ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2280
      ^ super redrawFromVisibleLine:startVisLineNr
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2281
                                 to:endVisLineNr
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2282
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2283
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2284
    selNo := sel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2285
    selNo > startVisLineNr ifTrue:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2286
        super redrawFromVisibleLine:startVisLineNr to:(selNo - 1)
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2287
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2288
    self redrawVisibleLine:selNo.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2289
    selNo < endVisLineNr ifTrue:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2290
        super redrawFromVisibleLine:(selNo + 1) to:endVisLineNr
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2291
    ]
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2292
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  2293
    "Modified: 24.2.1996 / 18:12:16 / cg"
125
claus
parents: 124
diff changeset
  2294
!
claus
parents: 124
diff changeset
  2295
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2296
redrawVisibleLine:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2297
    "redraw a single line.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2298
     Must check, if any is in the selection and handle this case.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2299
     Otherwise draw using supers method."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2300
437
b7d544102a9e oops - did not restore font (when boldifying)
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  2301
    |listLine fg bg newFont oldFont id|
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2302
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2303
    fg := fgColor.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2304
    bg := bgColor.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2305
    listLine := self visibleLineToListLine:visLineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2306
    listLine notNil ifTrue:[
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2307
        (self isInSelection:listLine) ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2308
            ^ self drawVisibleLineSelected:visLineNr
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2309
        ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2310
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2311
        listAttributes notNil ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2312
            (self line:listLine hasAttribute:#halfIntensity) ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2313
                fg := halfIntensityFgColor
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2314
            ] ifFalse:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2315
                (self line:listLine hasAttribute:#disabled) ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2316
                    fg := halfIntensityFgColor
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2317
                ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2318
            ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2319
            (self line:listLine hasAttribute:#bold) ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2320
                newFont := font asBold.
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2321
                (font bold 
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2322
                or:[id := (newFont on:device) fontId.
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2323
                    id isNil]) 
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2324
                ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2325
                    "
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2326
                     mhmh - what can be done, if the font is already bold ?
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2327
                     or no such font is available   
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2328
                    "
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2329
                    fgColor brightness > 0.5 ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2330
                        fg := fgColor darkened "darkened". 
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2331
                    ] ifFalse:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2332
                        fg := fgColor lightened "lightened"
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2333
                    ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2334
                    (fg brightness - bg brightness) abs < 0.25 ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2335
                        bgColor brightness > 0.5 ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2336
                            fg := fg darkened. 
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2337
                        ] ifFalse:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2338
                            fg := fg lightened
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2339
                        ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2340
                    ]
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2341
                ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2342
                id notNil ifTrue:[
437
b7d544102a9e oops - did not restore font (when boldifying)
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  2343
                    oldFont := font.
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2344
                    self basicFont:newFont.
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2345
                    self drawVisibleLine:visLineNr with:fg and:bg.
437
b7d544102a9e oops - did not restore font (when boldifying)
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  2346
                    self basicFont:oldFont.
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2347
                ] ifFalse:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2348
                    self drawVisibleLine:visLineNr with:fg and:bg.
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2349
                ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2350
                ^ self
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2351
            ]
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2352
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2353
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2354
    ^ self drawVisibleLine:visLineNr with:fg and:bg
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  2355
437
b7d544102a9e oops - did not restore font (when boldifying)
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  2356
    "Modified: 29.2.1996 / 16:20:07 / cg"
125
claus
parents: 124
diff changeset
  2357
!
claus
parents: 124
diff changeset
  2358
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2359
redrawVisibleLine:visLineNr col:colNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2360
    "redraw a single character.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2361
     Must check, if its in the selection and handle this case."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2362
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2363
    (self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2364
	^ self redrawVisibleLine:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2365
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2366
    super redrawVisibleLine:visLineNr col:colNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2367
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2368
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2369
redrawVisibleLine:visLineNr from:startCol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2370
    "redraw from a col to the right end.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2371
     Must check, if its in the selection and handle this case."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2372
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2373
    (self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2374
	^ self redrawVisibleLine:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2375
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2376
    super redrawVisibleLine:visLineNr from:startCol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2377
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2378
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2379
redrawVisibleLine:visLineNr from:startCol to:endCol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2380
    "redraw from a startCol to endCol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2381
     Must check, if its in the selection and handle this case."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2382
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2383
    (self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2384
	^ self redrawVisibleLine:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2385
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2386
    super redrawVisibleLine:visLineNr from:startCol to:endCol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2387
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2388
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2389
!SelectionInListView methodsFor:'selections'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2390
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2391
deselect
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2392
    "deselect"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2393
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2394
    self selection:nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2395
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2396
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2397
deselectWithoutRedraw
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2398
    "deselect - no redraw"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2399
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2400
    selection := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2401
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2402
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2403
hasSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2404
    "return true, if the view has a selection"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2405
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2406
    ^ selection notNil 
125
claus
parents: 124
diff changeset
  2407
!
claus
parents: 124
diff changeset
  2408
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2409
isInSelection:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2410
    "return true, if line, aNumber is in the selection"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2411
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2412
    selection isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2413
    multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2414
	^ (selection includes:aNumber)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2415
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2416
    ^ (aNumber == selection)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2417
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2418
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2419
makeSelectionVisible
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2420
    "scroll to make the selection line visible"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2421
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2422
    |line|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2423
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2424
    selection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2425
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2426
	    selection isEmpty ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2427
	    line := selection first.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2428
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2429
	    line := selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2430
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2431
	self makeLineVisible:line 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2432
    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2433
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2434
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2435
nextAfterSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2436
    "return the index of the next selectable entry after the selection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2437
     Wrap at end."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2438
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2439
    |next|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2440
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2441
    selection isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2442
	next := firstLineShown
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2443
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2444
	selection size ~~ 0 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2445
	    next := selection max + 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2446
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2447
	    next := selection + 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2448
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2449
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2450
    (self isValidSelection:next) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2451
	next > self size ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2452
	    next := 1.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2453
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2454
	    [next <= self size
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2455
	     and:[(self isValidSelection:next) not]] whileTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2456
		next := next + 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2457
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2458
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2459
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2460
    (self isValidSelection:next) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2461
	next := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2462
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2463
    ^ next
125
claus
parents: 124
diff changeset
  2464
!
claus
parents: 124
diff changeset
  2465
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2466
numberOfSelections
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2467
    "return the number of selected entries"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2468
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2469
    |sz|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2470
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2471
    selection isNil ifTrue:[^ 0].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2472
    sz := selection size.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2473
    sz > 0 ifTrue:[^ sz].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2474
    ^ 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2475
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2476
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2477
previousBeforeSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2478
    "return the index of the previous selectable entry before the selection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2479
     Wrap at beginning."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2480
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2481
    |prev|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2482
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2483
    selection isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2484
	prev := firstLineShown - 1 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2485
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2486
	selection size ~~ 0 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2487
	    prev := selection min - 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2488
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2489
	    prev := selection - 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2490
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2491
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2492
    (self isValidSelection:prev) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2493
	prev < 1 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2494
	    prev := self size.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2495
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2496
	    [prev >= 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2497
	     and:[(self isValidSelection:prev) not]] whileTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2498
		prev := prev - 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2499
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2500
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2501
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2502
    (self isValidSelection:prev) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2503
	prev := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2504
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2505
    ^ prev
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2506
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2507
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2508
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2509
selectAll
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2510
    "select all entries."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2511
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2512
    |oldSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2513
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2514
    multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2515
	oldSelection := selection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2516
	selection := OrderedCollection withAll:(1 to:self size).
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2517
	shown ifTrue:[self redraw].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2518
	self selectionChangedFrom:oldSelection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2519
    ]
125
claus
parents: 124
diff changeset
  2520
!
claus
parents: 124
diff changeset
  2521
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2522
selectElement:anObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2523
    "select the element with same printString as the argument, anObject.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2524
     Scroll to make the new selection visible."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2525
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2526
    |lineNo|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2527
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2528
    list notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2529
	items notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2530
	    lineNo := items indexOf:anObject ifAbsent:nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2531
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2532
	    lineNo := list indexOf:(anObject printString) ifAbsent:nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2533
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2534
	lineNo notNil ifTrue:[self selection:lineNo]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2535
    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2536
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2537
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2538
selectElementWithoutScroll:anObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2539
    "select the element with same printString as the argument, anObject.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2540
     Do not scroll."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2541
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2542
    |lineNo|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2543
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2544
    list notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2545
	items notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2546
	    lineNo := items indexOf:anObject ifAbsent:nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2547
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2548
	    lineNo := list indexOf:(anObject printString) ifAbsent:nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2549
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2550
	lineNo notNil ifTrue:[self selectWithoutScroll:lineNo]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2551
    ]
125
claus
parents: 124
diff changeset
  2552
!
claus
parents: 124
diff changeset
  2553
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2554
selectNext
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2555
    "select next line or first visible if there is currrently no selection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2556
     Wrap at end."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2557
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2558
    self selection:(self nextAfterSelection)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2559
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2560
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2561
selectPrevious
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2562
    "select previous line or previous visible if there is currently no selection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2563
     Wrap at beginning."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2564
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2565
    self selection:(self previousBeforeSelection).
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2566
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2567
    "Modified: 26.9.1995 / 09:41:16 / stefan"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2568
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2569
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2570
selectWithoutScroll:aNumberOrNilOrCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2571
    "select line, aNumber or deselect if argument is nil"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2572
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2573
    |prevSelection newSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2574
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2575
    newSelection := aNumberOrNilOrCollection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2576
    newSelection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2577
	(self isValidSelection:newSelection) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2578
	    newSelection := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2579
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2580
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2581
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2582
    (newSelection = selection) ifTrue: [^ self].
125
claus
parents: 124
diff changeset
  2583
claus
parents: 124
diff changeset
  2584
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2585
     redraw old selection unhighlighted
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2586
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2587
    selection notNil ifTrue: [
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2588
	prevSelection := selection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2589
	selection := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2590
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2591
	    prevSelection do:[:line |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2592
		self redrawElement:line
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2593
	    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2594
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2595
	    self redrawElement:prevSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2596
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2597
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2598
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2599
    selection := newSelection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2600
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2601
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2602
     redraw new selection unhighlighted
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2603
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2604
    newSelection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2605
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2606
	    newSelection isCollection ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2607
		selection := OrderedCollection with:newSelection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2608
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2609
	    selection do:[:line |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2610
		self redrawElement:line
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2611
	    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2612
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2613
	    self redrawElement:selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2614
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2615
    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2616
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2617
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2618
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2619
selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2620
    "return the selection index or collection of indices (if multipleSelect is on)"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2621
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2622
    ^ selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2623
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2624
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2625
selection:aNumberOrNil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2626
    "select line, aNumber or deselect if argument is nil;
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2627
     scroll to make the selected line visible"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2628
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2629
    self selectWithoutScroll:aNumberOrNil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2630
    selection notNil ifTrue:[self makeSelectionVisible]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2631
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2632
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2633
selectionAsCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2634
    "return the selection as a collection of line numbers.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2635
     This allows users of this class to enumerate independent of
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2636
     the multipleSelect style."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2637
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2638
    selection isNil ifTrue:[^ #()].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2639
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2640
"/    multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2641
"/        ^ (OrderedCollection new) add:selection; yourself.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2642
"/    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2643
    multipleSelectOk ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2644
	^ (OrderedCollection new) add:selection; yourself.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2645
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2646
    ^ selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2647
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2648
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2649
selectionChangedFrom:oldSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2650
    "selection has changed. Call actionblock and/or send changeMessage if defined"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2651
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2652
    |arg|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2653
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2654
    arg := self argForChangeMessage.
125
claus
parents: 124
diff changeset
  2655
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2656
     the ST/X way of doing things - perform actionBlock
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2657
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2658
    actionBlock notNil ifTrue:[actionBlock value:arg].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2659
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2660
     the MVC way of doing things - notify model via changeMsg
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2661
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2662
    multipleSelectOk ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2663
	"/ ST80 sends 0 as index, if the same selection is reselected ...
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2664
	selection == oldSelection ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2665
	    arg := 0
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2666
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2667
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2668
    self sendChangeMessageWith:arg
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2669
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2670
    "Modified: 26.10.1995 / 16:33:54 / cg"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2671
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2672
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2673
selectionDo:aBlock
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2674
    "perform aBlock for each nr in the selection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2675
     For single selection, it is called once for the items nr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2676
     For multiple selections, it is called for each."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2677
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2678
    selection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2679
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2680
	    selection do:aBlock
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2681
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2682
	    aBlock value:selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2683
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2684
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2685
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2686
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2687
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2688
selectionValue
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2689
    "return the selection value i.e. the text in the selected line.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2690
     For multiple selections a collection containing the entries is returned."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2691
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2692
    multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2693
	selection isNil ifTrue:[^ #()].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2694
	^ selection collect:[:nr | self at:nr]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2695
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2696
    selection isNil ifTrue:[^ nil].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2697
    ^ self at:selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2698
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2699
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2700
toggleSelection:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2701
    "toggle selection-state of entry, aNumber"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2702
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2703
    (self isInSelection:aNumber) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2704
	self removeFromSelection:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2705
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2706
	self addToSelection:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2707
    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2708
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2709
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2710
valueIsInSelection:someString
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2711
    "return true, if someString is in the selection"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2712
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2713
    |sel|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2714
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2715
    selection isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2716
    sel := self selectionValue.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2717
    self numberOfSelections > 1 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2718
	^ (sel includes:someString)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2719
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2720
    ^ (someString = sel)
125
claus
parents: 124
diff changeset
  2721
! !
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2722
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2723
!SelectionInListView class methodsFor:'documentation'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2724
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2725
version
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
  2726
    ^ '$Header: /cvs/stx/stx/libwidg/Attic/SelListV.st,v 1.65 1996-04-25 17:33:40 cg Exp $'
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2727
! !