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