SelectionInListView.st
author Claus Gittinger <cg@exept.de>
Tue, 21 Mar 2000 11:48:00 +0100
changeset 2169 73fc6ae6e33c
parent 2165 6c4bfa91517f
child 2187 b5bfc9d40650
permissions -rw-r--r--
do not (always) scroll when the selection changes
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
2140
3430f3f75cb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    15
		halfIntensityFgColor doubleClickActionBlock listAttributes
3430f3f75cb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    16
		multipleSelectOk clickLine initialSelectionMsg printItems oneItem
3430f3f75cb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    17
		useIndex hilightLevel hilightFrameColor ignoreReselect arrowLevel
3430f3f75cb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    18
		smallArrow keyActionStyle returnKeyActionStyle toggleSelect
3430f3f75cb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    19
		strikeOut iSearchString items doubleClickMsg hilightStyle
3430f3f75cb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    20
		clickPosition allowDrag dragObjectConverter dragIsActive
3430f3f75cb7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2139
diff changeset
    21
		endDragAction dropTarget dropSource visualBlock
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
    22
		selectedVisualBlock selectConditionBlock'
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    23
	classVariableNames:'RightArrowShadowForm RightArrowLightForm RightArrowForm
128
claus
parents: 125
diff changeset
    24
		SmallRightArrowShadowForm SmallRightArrowLightForm
claus
parents: 125
diff changeset
    25
		DefaultForegroundColor DefaultBackgroundColor
claus
parents: 125
diff changeset
    26
		DefaultHilightForegroundColor DefaultHilightBackgroundColor
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
    27
		DefaultHilightFrameColor DefaultHilightLevel
128
claus
parents: 125
diff changeset
    28
		DefaultRightArrowStyle DefaultRightArrowLevel
claus
parents: 125
diff changeset
    29
		DefaultDisabledForegroundColor DefaultShadowColor
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
    30
		DefaultLightColor DefaultHilightStyle'
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    31
	poolDictionaries:''
1771
c1bccfce48cd category change
Claus Gittinger <cg@exept.de>
parents: 1745
diff changeset
    32
	category:'Views-Lists'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    33
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    34
869
4b09e6fe33b6 allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
    35
!SelectionInListView class methodsFor:'documentation'!
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    36
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    37
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    38
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    39
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    40
	      All Rights Reserved
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    41
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    42
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    43
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    44
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    45
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    46
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    47
 hereby transferred.
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
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    50
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    51
documentation
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    52
"
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
    53
    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
    54
    If multipleSelectionsOk is true, it is also allowed to shift-click multiple 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    55
    entries.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    56
    If toggleSelect is true, clicking toggles (i.e. click on a seleted item
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    57
    will deselect).
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
    58
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    59
    Whenever the selection changes, an action-block is evaluated, passing the 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    60
    current selection as argument.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    61
    Currently, the selection can be nil, aNumber or a collection of numbers; 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    62
    this will change to be either nil or a collection, making selection handling 
70
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    63
    easier in the future. (this stupid behavior is due to the multiple
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    64
    select feature being added later - the first implementation used to support
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    65
    only single selections).
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    66
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    67
    The actionBlock is called with the current selection (single number or
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    68
    collection of numbers) as argument.
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    69
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    70
    Also, to support ST-80 MVC-style use, the model (if nonNil) is notified
155
claus
parents: 151
diff changeset
    71
    by the change mechanism (performs changeMsg) and vice versa, the view
claus
parents: 151
diff changeset
    72
    updates if the model changes (with aspect of either #list or #selectionIndex).
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    73
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    74
    Before actually adding entries to the the selection, a checkBlock (if non-nil) is evaluated 
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    75
    passing the number of the entry whch is about to be selected as argument.
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    76
    The select change operation is only done if this returns true. This allows
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    77
    interception of select, for example to query the user if he/she wants to save
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    78
    the old contents before (see uses in SystemBrowser and FileBrowser), or to
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    79
    disable individual entries.
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
    80
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    81
    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
    82
    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
    83
    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
    84
    Also, alphabetic keys will select the next entry starting with that key.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    85
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    86
    The keyboard behavior can be further controlled with the keyActionStyle
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    87
    instance variable (see SelectionInListView>>keyActionStyle:).
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    88
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    89
    Finally, ignoreReselect controls if pressing on an already selected item
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    90
    triggers the action or not. For some applications it is useful to allow
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    91
    reselects (for example, the SystemBrowsers method-list updates the
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    92
    source code in this case).
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    93
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    94
    Currently, some limited form of line attributes are supported. These
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    95
    are kept in the instance variable lineAttributes.
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    96
    This may change (using mechanisms similar to MultiColListEntry), so
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    97
    be prepared. (dont use the listAttributes instvar directly; if possible,
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    98
    use MultiColListEntry or subclasses of it.
120
claus
parents: 119
diff changeset
    99
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   100
    Although currently based on the listAttributes instVar, the implementation of
120
claus
parents: 119
diff changeset
   101
    text attributes will be changed in the near future (when Text/DisplayText are
claus
parents: 119
diff changeset
   102
    available). 
claus
parents: 119
diff changeset
   103
    However, the protocol will probably be kept for backward compatibility
claus
parents: 119
diff changeset
   104
    (i.e. use #attributeAt: / #attributeAt:put etc. - at least, these are easy to find
claus
parents: 119
diff changeset
   105
    when migrating to the new attributed text handling).
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   106
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   107
    [Instance variables:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   108
        selection               <misc>          the current selection. nil, a number or collection of numbers
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   109
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   110
        actionBlock             <Block>         block to be evaluated on selection changes
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
   111
                                                (1-arg blocks gets selectionIndex or selectionValue
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
   112
                                                 as arg - depending upon the useIndex setting)
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
   113
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
   114
        useIndex                <Boolean>       if true, the index of a selection is passed to
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
   115
                                                the actionBlock or stuffed into the selection valueHolder;
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
   116
                                                if false, the seelction-value is passed.
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   117
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   118
        enabled                 <Boolean>       true: selection changes allowed; false: ignore clicks
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   119
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   120
        hilightFgColor
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   121
        hilightBgColor          <Color>         how highlighted items are drawn
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   122
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   123
        halfIntensityColor      <Color>         foreground for disabled items
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   124
2139
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   125
        selectCondition         <Block>         if non-nil, this block can decide if selection is ok.
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   126
                                or              its invoked with the itemNr of the
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   127
                                <ValueHolder>   'to-be-selected' item.
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
   128
                                                If the block returns true, the item is selected
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
   129
                                                (or added to the selection); if false is returned,
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
   130
                                                no action is taken.
2139
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   131
        selectionChangeCondition
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
   132
                                <Block>         much like above, but invoked without argument,
2139
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   133
                                or              on any change of the selection (i.e. also when items
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   134
                                <ValueHolder>   are deselected).
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
   135
                                                Can return false to suppress change.
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   136
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   137
        doubleClickActionBlock  <Block>         action to perform on double-click
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
   138
                                                (1-arg blocks gets selectionIndex or selectionValue
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
   139
                                                 as arg - depending upon the useIndex setting)
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   140
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   141
        listAttributes                          dont use - will vanish
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   142
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   143
        hilightLevel            <Integer>       level to draw selections (i.e. for 3D effect)
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   144
        hilightFrameColor       <Color>         rectangle around highlighted items
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   145
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   146
        multipleSelectOk        <Boolean>       if true, multiple selections (with shift) are ok.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   147
                                                default: false
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   148
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   149
        ignoreReselect          <Boolean>       if true, selecting same again does not trigger action;
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   150
                                                if false, every select triggers it.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   151
                                                default: true
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   152
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   153
        toggleSelect            <Boolean>       if true, click toggles;
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   154
                                                if false, click selects.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   155
                                                default: false
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   156
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   157
        arrowLevel              <Integer>       level to draw right-arrows (for submenus etc.)
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   158
        smallArrow              <Boolean>       if true, uses a small arrow bitmap
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   159
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   160
        listMsg                                 if non-nil, use ST-80 style (model-access)
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   161
        initialSelectionMsg 
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   162
        printItems 
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   163
        oneItem
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   164
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   165
        keyActionStyle          <Symbol>        controls how to respond to keyboard selects
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   166
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   167
        returnKeyActionStyle    <Symbol>        controls how to respond to return key
125
claus
parents: 124
diff changeset
   168
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   169
    written spring/summer 89 by claus
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   170
    3D Jan 90 by claus
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
   171
    multiselect Jun 92 by claus
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
   172
    keyboard-select jun 94 by claus
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   173
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   174
    [author:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   175
        Claus Gittinger
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   176
"
119
claus
parents: 116
diff changeset
   177
!
claus
parents: 116
diff changeset
   178
claus
parents: 116
diff changeset
   179
examples
claus
parents: 116
diff changeset
   180
"
claus
parents: 116
diff changeset
   181
    SelectionInListView can be used both in the ST/X way, using action blocks
claus
parents: 116
diff changeset
   182
    or in the traditional mvc way.
claus
parents: 116
diff changeset
   183
    with actions:
claus
parents: 116
diff changeset
   184
125
claus
parents: 124
diff changeset
   185
      basic interface:
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:[:index | Transcript showCR:'selected ' , index printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   198
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   199
        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
   200
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   201
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   202
claus
parents: 124
diff changeset
   203
claus
parents: 124
diff changeset
   204
      get element instead of index:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   205
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   206
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   207
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   208
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   209
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   210
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   211
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   212
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   213
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   214
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   215
        slv list:#('one' 'two' 'three').
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   216
        slv action:[:element | Transcript showCR:'selected ' , element printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   217
        slv useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   218
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   219
        top add:slv in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   220
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   221
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   222
claus
parents: 124
diff changeset
   223
claus
parents: 124
diff changeset
   224
      concrete example; show filenames:
claus
parents: 124
diff changeset
   225
      (notice: normally, you would use a FileSelectionList)
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   226
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   227
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   228
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   229
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   230
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   231
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   232
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   233
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   234
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   235
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   236
        slv list:(Filename currentDirectory directoryContents).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   237
        slv action:[:index | 
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   238
            Transcript showCR:'selected ' , index printString.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   239
            Transcript showCR:' the value is: ', slv selectionValue].
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: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
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   246
      add a scrollbar:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   247
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   248
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   249
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   250
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   251
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   252
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   253
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   254
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   255
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   256
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   257
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   258
        slv action:[:index | Transcript showCR:'selected ' , index printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   259
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   260
        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
   261
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   262
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   263
119
claus
parents: 116
diff changeset
   264
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   265
      allow reselect
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   266
      (clicking on already selected entry 
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   267
       triggers action/changeNotification again):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   268
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   269
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   270
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   271
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   272
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   273
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   274
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   275
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   276
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   277
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   278
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   279
        slv action:[:index | Transcript showCR:'selected ' , index printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   280
        slv ignoreReselect:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   281
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   282
        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
   283
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   284
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   285
119
claus
parents: 116
diff changeset
   286
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   287
      allow multiple selections (shift-select):
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.
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
claus
parents: 124
diff changeset
   306
      same, not using index:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   307
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   308
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   309
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   310
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   311
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   312
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   313
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   314
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   315
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   316
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   317
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   318
        slv action:[:indexList | Transcript showCR:'selected ' , indexList printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   319
        slv multipleSelectOk:true; useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   320
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   321
        top 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
   322
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   323
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   324
119
claus
parents: 116
diff changeset
   325
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   326
      strikeout mode (single):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   327
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   328
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   329
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   330
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   331
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   332
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   333
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   334
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   335
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   336
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   337
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   338
        slv action:[:index | Transcript showCR:'selected ' , index printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   339
        slv strikeOut:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   340
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   341
        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
   342
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   343
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   344
119
claus
parents: 116
diff changeset
   345
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   346
      strikeout mode (multiple):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   347
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   348
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   349
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   350
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   351
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   352
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   353
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   354
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   355
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   356
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
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].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   359
        slv strikeOut:true; multipleSelectOk:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   360
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   361
        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
   362
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   363
                                                                        [exEnd]
119
claus
parents: 116
diff changeset
   364
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   365
      toggleSelect mode (clicking on selected entry deselects it):
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   366
                                                                        [exBegin]
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   367
        |top slv|
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   368
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   369
        top := StandardSystemView new
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   370
                label:'select';
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   371
                minExtent:100@100;
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   372
                maxExtent:300@400;
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   373
                extent:200@200.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   374
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   375
        slv := SelectionInListView new.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
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].
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   378
        slv toggleSelect:true.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   379
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   380
        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
   381
        top open
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   382
                                                                        [exEnd]
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   383
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   384
      define what to do on double-click:
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|
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
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   389
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   390
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   391
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   392
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   393
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   394
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   395
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   396
        slv action:[:index | Transcript showCR:'selected ' , index printString].
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   397
        slv doubleClickAction:[:index | Transcript showCR:'doubleclick on ' , index printString].
401
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
        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
   400
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   401
                                                                        [exEnd]
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   402
1163
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   403
      enable / disable:
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   404
                                                                        [exBegin]
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   405
        |top slv|
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   406
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   407
        top := StandardSystemView new
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   408
                label:'select';
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   409
                minExtent:100@100;
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   410
                maxExtent:300@400;
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   411
                extent:200@200.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   412
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   413
        slv := SelectionInListView new.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   414
        slv list:(Filename currentDirectory directoryContents).
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   415
        slv action:[:index | Transcript showCR:'selected ' , index printString].
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   416
        slv disable.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   417
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   418
        top open.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   419
        Delay waitForSeconds:5. 
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   420
        slv enable.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   421
                                                                        [exEnd]
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   422
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   423
      enable / disable via a channel:
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   424
                                                                        [exBegin]
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   425
        |top slv enableChannel t|
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   426
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   427
        enableChannel := true asValue.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   428
        t := Toggle label:'enable'.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   429
        t model:enableChannel.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   430
        t open.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   431
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   432
        top := StandardSystemView new
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   433
                label:'select';
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   434
                minExtent:100@100;
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   435
                maxExtent:300@400;
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   436
                extent:200@200.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   437
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   438
        slv := SelectionInListView new.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   439
        slv list:(Filename currentDirectory directoryContents).
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   440
        slv action:[:index | Transcript showCR:'selected ' , index printString].
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   441
        slv enableChannel:enableChannel.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   442
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   443
        top open.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   444
                                                                        [exEnd]
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   445
119
claus
parents: 116
diff changeset
   446
    using a Model:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   447
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   448
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   449
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   450
        model := Plug new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   451
        model respondTo:#getList with:[#('foo' 'bar' 'baz' 'hello')].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   452
        model respondTo:#initial with:[1].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   453
        model respondTo:#setSelection: with:[:arg | Transcript showCR:'model selected:', arg printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   454
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   455
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   456
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   457
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   458
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   459
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   460
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   461
        slv := SelectionInListView 
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   462
                   on:model
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   463
                   aspect:#someAspect
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   464
                   change:#setSelection:
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   465
                   list:#getList
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   466
                   initialSelection:#initial.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   467
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   468
        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
   469
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   470
                                                                        [exEnd]
119
claus
parents: 116
diff changeset
   471
claus
parents: 116
diff changeset
   472
      notice, that the ST-80 behavaior on reselect is to send a selection change
claus
parents: 116
diff changeset
   473
      with an index of 0.
claus
parents: 116
diff changeset
   474
125
claus
parents: 124
diff changeset
   475
    same, with useIndex false:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   476
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   477
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   478
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   479
        model := Plug new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   480
        model respondTo:#getList with:[#('foo' 'bar' 'baz' 'hello')].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   481
        model respondTo:#initial with:['bar'].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   482
        model respondTo:#setSelection: with:[:arg | Transcript showCR:'model selected:', arg printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   483
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   484
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   485
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   486
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   487
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   488
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   489
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   490
        slv := SelectionInListView 
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   491
                   on:model
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   492
                   aspect:#someAspect
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   493
                   change:#setSelection:
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   494
                   list:#getList
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   495
                   initialSelection:#initial.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   496
        slv useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   497
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   498
        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
   499
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   500
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   501
claus
parents: 124
diff changeset
   502
155
claus
parents: 151
diff changeset
   503
    self changing list: 
claus
parents: 151
diff changeset
   504
    (selectionInListView updates itself when button changes initial selection):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   505
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   506
        |top slv model sel changeButton|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   507
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   508
        sel := 'bar'.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   509
        model := Plug new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   510
        model respondTo:#getList with:['getList' printNL. #('foo' 'bar' 'baz' 'hello')].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   511
        model respondTo:#initial with:['initial' printNL. sel].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   512
        model respondTo:#setSelection: with:[:arg | ('model selected:', arg) printNL. sel := arg].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   513
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   514
        changeButton := Button label:'change selection'.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   515
        changeButton action:[sel := 'foo'. model changed:#initial].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   516
        changeButton open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   517
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   518
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   519
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   520
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   521
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   522
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   523
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   524
        slv := SelectionInListView 
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   525
                   on:model
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   526
                   aspect:#someAspect
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   527
                   change:#setSelection:
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   528
                   list:#getList
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   529
                   initialSelection:#initial.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   530
        slv useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   531
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   532
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   533
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   534
                                                                        [exEnd]
155
claus
parents: 151
diff changeset
   535
claus
parents: 151
diff changeset
   536
119
claus
parents: 116
diff changeset
   537
    using a SelectionInList-Model:
claus
parents: 116
diff changeset
   538
    (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
   539
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   540
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   541
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   542
        model := SelectionInList with:#('foo' 'bar' 'baz' 'hello').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   543
        model selection:'bar'.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   544
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   545
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   546
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   547
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   548
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   549
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   550
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   551
        slv := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   552
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   553
        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
   554
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   555
449
725c26daf5d8 examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   556
        InspectorView openOn:model monitor:'selectionIndexHolder'
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   557
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   558
claus
parents: 124
diff changeset
   559
claus
parents: 124
diff changeset
   560
    two selectionInListViews on the same selectionInList model:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   561
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   562
        |top1 slv1 top2 slv2 model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   563
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   564
        model := SelectionInList with:#('foo' 'bar' 'baz' 'hello').
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
        top1 := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   567
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   568
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   569
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   570
                extent:200@200.
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
        slv1 := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   573
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   574
        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
   575
        top1 open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   576
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   577
        top2 := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   578
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   579
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   580
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   581
                extent:200@200.
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
        slv2 := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   584
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   585
        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
   586
        top2 open.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   587
                                                                        [exEnd]
166
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   588
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   589
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   590
    a MultiSelectionInList model:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   591
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   592
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   593
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   594
        model := MultiSelectionInList with:#('foo' 'bar' 'baz' 'hello').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   595
        model selection:#('foo' 'bar').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   596
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   597
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   598
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   599
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   600
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   601
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   602
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   603
        slv := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   604
        slv multipleSelectOk:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   605
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   606
        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
   607
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   608
449
725c26daf5d8 examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   609
        InspectorView openOn:model monitor:'selectionIndexHolder'
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   610
                                                                        [exEnd]
166
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   611
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   612
    with strikeOut:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   613
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   614
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   615
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   616
        model := MultiSelectionInList with:#('foo' 'bar' 'baz' 'hello').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   617
        model selection:#('foo' 'bar').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   618
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   619
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   620
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   621
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   622
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   623
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   624
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   625
        slv := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   626
        slv multipleSelectOk:true; toggleSelect:true; strikeOut:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   627
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   628
        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
   629
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   630
449
725c26daf5d8 examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   631
        InspectorView openOn:model monitor:'selectionIndexHolder'
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   632
                                                                        [exEnd]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   633
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   634
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   635
    two listViews on the same list, but separate selections
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   636
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   637
        |top top2 lv1 lv2 selInL1 selInL2 listHolder l1 l2|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   638
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   639
        top := StandardSystemView new extent:300@300.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   640
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   641
        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
   642
        lv1 level:-1.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   643
        lv1 toggleSelect:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   644
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   645
        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
   646
        lv2 level:-1.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   647
        lv2 toggleSelect:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   648
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   649
        selInL1 := SelectionInList new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   650
        selInL2 := SelectionInList new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   651
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   652
        listHolder := #('foo' 'bar' 'baz') asValue.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   653
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   654
        selInL1 listHolder:listHolder.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   655
        selInL2 listHolder:listHolder.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   656
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   657
        lv1 model:selInL1.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   658
        lv2 model:selInL2.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   659
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   660
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   661
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   662
        top2 := StandardSystemView new extent:100 @ 30.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   663
        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
   664
        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
   665
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   666
        l1 model:(BlockValue with:[:arg | arg value printString] argument:selInL1 selectionIndexHolder).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   667
        l2 model:(BlockValue with:[:arg | arg value printString] argument:selInL2 selectionIndexHolder).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   668
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   669
        l1 labelMessage:#value.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   670
        l2 labelMessage:#value.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   671
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   672
        top2 open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   673
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   674
        Delay waitForSeconds:2.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   675
        listHolder value:#('1' '2' '3' '4').
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   676
                                                                        [exEnd]
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   677
    non-string entries (text)
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   678
                                                                        [exBegin]
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   679
        |top l slv|
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   680
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   681
        top := StandardSystemView new
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   682
                label:'select';
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   683
                minExtent:100@100;
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   684
                maxExtent:300@400;
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   685
                extent:200@200.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   686
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   687
        slv := SelectionInListView new.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   688
        l := OrderedCollection new.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   689
        l add:(Text string:'red' emphasis:(#color->Color red)).
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   690
        l add:(Text string:'green' emphasis:(#color->Color green)).
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   691
        l add:(Text string:'blue' emphasis:(#color->Color blue)).
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   692
        slv list:l.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   693
        slv action:[:index | Transcript showCR:'selected ' , index printString].
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   694
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   695
        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
   696
        top open
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   697
                                                                        [exEnd]
838
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   698
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   699
      non string entries
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   700
                                                                        [exBegin]
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   701
        |top slv wrapper l fileImage dirImage m|
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   702
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   703
        dirImage := Image fromFile:'DirObj.xbm'.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   704
        fileImage := Image fromFile:'FileObj.xbm'.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   705
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   706
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   707
        l := OrderedCollection new.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   708
        Filename currentDirectory directoryContents do:[:s |
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   709
            s asFilename isDirectory ifTrue:[
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   710
                l add:(LabelAndIcon icon:dirImage string:s)
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   711
            ] ifFalse:[
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   712
                l add:(LabelAndIcon icon:fileImage string:s)
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   713
            ]
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   714
        ].
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   715
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   716
        m := SelectionInList new.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   717
        m list:l.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   718
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   719
        slv := SelectionInListView new.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   720
        slv model:m.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   721
        wrapper := HVScrollableView forView:slv miniScrollerH:true.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   722
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   723
        top := StandardSystemView extent:150@200.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   724
        top add:wrapper in:(0.0@0.0 corner:1.0@1.0).
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   725
        top open.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   726
                                                                        [exEnd]
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   727
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   728
                                                                        [exBegin]
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   729
        |top slv|
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   730
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   731
        top := StandardSystemView new
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   732
                label:'select';
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   733
                minExtent:100@100;
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   734
                maxExtent:300@400;
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   735
                extent:200@200.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   736
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   737
        slv := SelectionInListView new.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   738
        slv list:#('one' 'two' 'three').
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   739
        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
   740
        slv multipleSelectOk:true.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   741
        slv allowDrag:true.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   742
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   743
        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
   744
        top open
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   745
                                                                        [exEnd]
119
claus
parents: 116
diff changeset
   746
"
166
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   747
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   748
    "Modified: 26.10.1995 / 16:42:02 / cg"
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   749
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   750
869
4b09e6fe33b6 allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   751
!SelectionInListView class methodsFor:'instance creation'!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   752
125
claus
parents: 124
diff changeset
   753
on:aModel aspect:aspect change:change list:list initialSelection:initial
claus
parents: 124
diff changeset
   754
    ^ self on:aModel
claus
parents: 124
diff changeset
   755
	    printItems:true 
claus
parents: 124
diff changeset
   756
	    oneItem:false 
claus
parents: 124
diff changeset
   757
	    aspect:aspect
claus
parents: 124
diff changeset
   758
	    change:change 
claus
parents: 124
diff changeset
   759
	    list:list 
claus
parents: 124
diff changeset
   760
	    menu:nil 
claus
parents: 124
diff changeset
   761
	    initialSelection:initial 
claus
parents: 124
diff changeset
   762
	    useIndex:true 
claus
parents: 124
diff changeset
   763
!
claus
parents: 124
diff changeset
   764
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   765
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
   766
    ^ self on:aModel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   767
	    printItems:true 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   768
	    oneItem:false 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   769
	    aspect:aspect
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   770
	    change:change 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   771
	    list:list 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   772
	    menu:menu
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   773
	    initialSelection:initial 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   774
	    useIndex:true 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   775
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   776
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   777
on:aModel printItems:print oneItem:one aspect:aspect
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   778
	      change:change list:list menu:menu initialSelection:initial
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   779
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   780
    "for ST-80 compatibility"
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   781
119
claus
parents: 116
diff changeset
   782
    ^ self on:aModel 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   783
	    printItems:print 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   784
	    oneItem:one 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   785
	    aspect:aspect
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   786
	    change:change 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   787
	    list:list 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   788
	    menu:menu
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   789
	    initialSelection:initial
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   790
	    useIndex:false 
119
claus
parents: 116
diff changeset
   791
!
claus
parents: 116
diff changeset
   792
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   793
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
   794
		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
   795
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   796
    "for ST-80 compatibility"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   797
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   798
    ^ (self new) on:aModel 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   799
		 printItems:print 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   800
		 oneItem:one 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   801
		 aspect:aspect
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   802
		 change:change 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   803
		 list:list 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   804
		 menu:menu
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   805
		 initialSelection:initial
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   806
		 useIndex:useIndex
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   807
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   808
869
4b09e6fe33b6 allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   809
!SelectionInListView class methodsFor:'defaults'!
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   810
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   811
defaultAspectMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   812
    ^ nil
125
claus
parents: 124
diff changeset
   813
!
claus
parents: 124
diff changeset
   814
claus
parents: 124
diff changeset
   815
defaultChangeMessage
claus
parents: 124
diff changeset
   816
    ^ #selectionIndex: 
claus
parents: 124
diff changeset
   817
!
claus
parents: 124
diff changeset
   818
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   819
defaultListMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   820
    ^ #list 
125
claus
parents: 124
diff changeset
   821
!
claus
parents: 124
diff changeset
   822
claus
parents: 124
diff changeset
   823
defaultSelectionMessage
claus
parents: 124
diff changeset
   824
    ^ #selectionIndex 
claus
parents: 124
diff changeset
   825
!
claus
parents: 124
diff changeset
   826
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   827
rightArrowFormOn:aDevice
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   828
    "return the form used for the right arrow (non 3D)"
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   829
1636
6f75bcabf092 oops - resource spec was incompatible with stc.
Claus Gittinger <cg@exept.de>
parents: 1634
diff changeset
   830
    <resource: #style (#'selection.rightArrowForm' #'selection.rightArrowFormFile')>
1204
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   831
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   832
    |f fn bits|
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   833
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   834
    ((aDevice == Display) and:[RightArrowForm notNil]) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   835
        ^ RightArrowForm
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   836
    ].
1204
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   837
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   838
    f := StyleSheet at:#'selection.rightArrowForm'.
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   839
    f isNil ifTrue:[
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   840
        fn := StyleSheet at:#'selection.rightArrowFormFile' default:'RightArrow.xbm'.
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2070
diff changeset
   841
        f := Smalltalk imageFromFileNamed:fn forClass:self.
2062
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   842
        f notNil ifTrue:[
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   843
            f := f onDevice:aDevice.
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   844
        ] ifFalse:[
1204
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   845
            DefaultRightArrowStyle == #solid ifTrue:[
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   846
                bits := #[2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   847
                          2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   848
                          2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   849
                          2r00000010 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   850
                          2r00000011 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   851
                          2r00000011 2r10000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   852
                          2r00000011 2r11000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   853
                          2r00000011 2r11100000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   854
                          2r00000011 2r11110000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   855
                          2r00000011 2r11100000
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   856
                          2r00000011 2r11000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   857
                          2r00000011 2r10000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   858
                          2r00000011 2r00000000
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   859
                          2r00000010 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   860
                          2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   861
                          2r00000000 2r00000000]
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   862
            ] ifFalse:[
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   863
                bits := #[2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   864
                          2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   865
                          2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   866
                          2r00000110 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   867
                          2r00000101 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   868
                          2r00000100 2r10000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   869
                          2r00000100 2r01000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   870
                          2r00000100 2r00100000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   871
                          2r00000100 2r00010000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   872
                          2r00000100 2r00100000
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   873
                          2r00000100 2r01000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   874
                          2r00000100 2r10000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   875
                          2r00000101 2r00000000
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   876
                          2r00000110 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   877
                          2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   878
                          2r00000000 2r00000000]
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   879
            ].
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   880
            f := Form width:16 height:16 fromArray:bits on:aDevice
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   881
        ]
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   882
    ].
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   883
    (aDevice == Display) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   884
        RightArrowForm := f
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   885
    ].
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   886
    ^ f
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   887
1634
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
   888
    "Modified: / 5.8.1998 / 00:04:40 / cg"
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   889
!
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   890
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   891
rightArrowLightFormOn:aDevice
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   892
    "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
   893
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   894
    |f|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   895
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   896
    ((aDevice == Display) and:[RightArrowLightForm notNil]) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   897
        ^ RightArrowLightForm
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   898
    ].
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2070
diff changeset
   899
    f := Smalltalk imageFromFileNamed:'RightArrowLight.xbm' forClass:self.
2062
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   900
    f notNil ifTrue:[
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   901
        f := f onDevice:aDevice.
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   902
    ] ifFalse:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   903
        f := Form width:16 height:16 fromArray:#[2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   904
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   905
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   906
                                                 2r00000110 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   907
                                                 2r00000101 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   908
                                                 2r00000100 2r10000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   909
                                                 2r00000100 2r01000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   910
                                                 2r00000100 2r00100000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   911
                                                 2r00000100 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   912
                                                 2r00000100 2r00000000
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   913
                                                 2r00000100 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   914
                                                 2r00000100 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   915
                                                 2r00000100 2r00000000
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   916
                                                 2r00000100 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   917
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   918
                                                 2r00000000 2r00000000]
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   919
                                              on:aDevice
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   920
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   921
    (aDevice == Display) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   922
        RightArrowLightForm := f
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   923
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   924
    ^ f
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   925
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   926
    "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
   927
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   928
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   929
rightArrowShadowFormOn:aDevice
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   930
    "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
   931
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   932
    |f|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   933
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   934
    ((aDevice == Display) and:[RightArrowShadowForm notNil]) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   935
        ^ RightArrowShadowForm
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   936
    ].
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2070
diff changeset
   937
    f := Smalltalk imageFromFileNamed:'RightArrowShadow.xbm' forClass:self.
2062
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   938
    f notNil ifTrue:[
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   939
        f := f onDevice:aDevice.
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   940
    ] ifFalse:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   941
        f := Form width:16 height:16 fromArray:#[2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   942
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   943
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   944
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   945
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   946
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   947
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   948
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   949
                                                 2r00000000 2r00010000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   950
                                                 2r00000000 2r00100000
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   951
                                                 2r00000000 2r01000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   952
                                                 2r00000000 2r10000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   953
                                                 2r00000001 2r00000000
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   954
                                                 2r00000010 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   955
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   956
                                                 2r00000000 2r00000000]
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   957
                                              on:aDevice
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   958
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   959
    (aDevice == Display) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   960
        RightArrowShadowForm := f
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   961
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   962
    ^ f
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   963
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   964
    "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
   965
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   966
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   967
smallRightArrowLightFormOn:aDevice
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   968
    "return the form used for the small right arrow light pixels (3D only)"
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   969
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   970
    |f|
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   971
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   972
    ((aDevice == Display) and:[SmallRightArrowLightForm notNil]) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   973
        ^ SmallRightArrowLightForm
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   974
    ].
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2070
diff changeset
   975
    f := Smalltalk imageFromFileNamed:'SmallRightArrowLight.xbm' forClass:self.
2062
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   976
    f notNil ifTrue:[
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   977
        f := f onDevice:aDevice.
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   978
    ] ifFalse:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   979
        f := Form width:9 height:9 fromArray:#[2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   980
                                               2r01100000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   981
                                               2r01011000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   982
                                               2r01000110 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   983
                                               2r01000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   984
                                               2r01000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   985
                                               2r01000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   986
                                               2r01000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   987
                                               2r00000000 2r00000000]
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   988
                                              on:aDevice
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   989
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   990
    (aDevice == Display) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   991
        SmallRightArrowLightForm := f
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   992
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   993
    ^ f
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   994
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   995
    "Modified: 19.12.1996 / 14:10:59 / cg"
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   996
!
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   997
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   998
smallRightArrowShadowFormOn:aDevice
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   999
    "return the form used for the small right arrow light pixels (3D only)"
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1000
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1001
    |f|
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1002
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1003
    ((aDevice == Display) and:[SmallRightArrowShadowForm notNil]) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1004
        ^ SmallRightArrowShadowForm
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1005
    ].
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2070
diff changeset
  1006
    f := Smalltalk imageFromFileNamed:'SmallRightArrowShadow.xbm' forClass:self.
2062
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
  1007
    f notNil ifTrue:[
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
  1008
        f := f onDevice:aDevice.
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
  1009
    ] ifFalse:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1010
        f := Form width:9 height:9 fromArray:#[2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1011
                                               2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1012
                                               2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1013
                                               2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1014
                                               2r00000001 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1015
                                               2r00000110 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1016
                                               2r00011000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1017
                                               2r00100000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1018
                                               2r00000000 2r00000000]
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1019
                                              on:aDevice
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1020
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1021
    (aDevice == Display) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1022
        SmallRightArrowShadowForm := f
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1023
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1024
    ^ f
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1025
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1026
    "Modified: 19.12.1996 / 14:11:10 / cg"
125
claus
parents: 124
diff changeset
  1027
!
claus
parents: 124
diff changeset
  1028
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1029
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1030
    "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
  1031
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1032
    <resource: #style (#'selection.disabledForegroundColor'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1033
                       #'selection.hilightForegroundColor' #'selection.hilightBackgroundColor'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1034
                       #'selection.hilightFrameColor' #'selection.hilightLevel'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1035
                       #'selection.rightArrowStyle' #'selection.rightArrowLevel'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1036
                       #'selection.foregroundColor' #'selection.backgroundColor'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1037
                       #'selection.shadowColor' #'selection.lightColor'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1038
                       #'selection.font' #'selection.hilightStyle')>
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1039
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1040
    DefaultDisabledForegroundColor := StyleSheet colorAt:#'selection.disabledForegroundColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1041
    DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1042
    DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1043
    DefaultHilightFrameColor := StyleSheet colorAt:#'selection.hilightFrameColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1044
    DefaultHilightLevel := StyleSheet at:#'selection.hilightLevel' default:0.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1045
    DefaultHilightStyle := StyleSheet at:#'selection.hilightStyle' default:(StyleSheet name).
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1046
    DefaultRightArrowStyle := StyleSheet at:#'selection.rightArrowStyle'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1047
    DefaultRightArrowLevel := StyleSheet at:#'selection.rightArrowLevel'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1048
    DefaultForegroundColor := StyleSheet colorAt:#'selection.foregroundColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1049
    DefaultBackgroundColor := StyleSheet colorAt:#'selection.backgroundColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1050
    DefaultShadowColor := StyleSheet colorAt:#'selection.shadowColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1051
    DefaultLightColor := StyleSheet colorAt:#'selection.lightColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1052
    DefaultFont := StyleSheet fontAt:#'selection.font'.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1053
    RightArrowForm := nil.
125
claus
parents: 124
diff changeset
  1054
claus
parents: 124
diff changeset
  1055
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1056
     self updateStyleCache
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1057
    "
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1058
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1059
    "Modified: 20.10.1997 / 14:04:26 / cg"
320
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
2102
e2c4ed880dbc category renamining
Claus Gittinger <cg@exept.de>
parents: 2075
diff changeset
  1062
!SelectionInListView methodsFor:'Compatibility ST80'!
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1063
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1064
sequence
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1065
    "same as #list - for ST80 compatibility"
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1066
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1067
    ^ self list
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1068
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1069
    "Created: / 21.6.1998 / 02:46:50 / cg"
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1070
!
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1071
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1072
setValidTargetIndex:index
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1073
    "ignored for now - for ST80 compatibility"
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1074
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1075
    ^ self
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1076
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1077
    "Created: / 4.2.2000 / 00:07:14 / cg"
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1078
! !
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1079
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1080
!SelectionInListView methodsFor:'accessing-actions'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1081
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1082
action:aBlock
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  1083
    "set the action block to be performed on select.
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  1084
     With useIndex==true, the block gets the selectionIndex as arg,
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  1085
     otherwise, it gets the selectionValue."
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1086
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1087
    actionBlock := aBlock
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
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1090
doubleClickAction:aOneArgBlock
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1091
    "set the double click action block.
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1092
     If non-nil, that one is evaluated on double click, passing the
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  1093
     selection-line-number (useIndex==true) or selectionValue (useIndex==false) as argument."
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1094
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1095
    doubleClickActionBlock := aOneArgBlock
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1096
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1097
    "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
  1098
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1099
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1100
keyActionStyle:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1101
    "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
  1102
     Possible values are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1103
	#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
  1104
				 character and perform the click-action
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
	#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
  1107
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1108
	#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
  1109
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1110
	nil                   -> will ignore key
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1111
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1112
     the default (set in #initialize) is #select
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
    keyActionStyle := aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1116
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1117
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1118
returnKeyActionStyle:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1119
    "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
  1120
     Possible values are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1121
	#doubleClick          -> perform double-click action
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1122
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1123
	#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
  1124
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1125
	nil                   -> will ignore key
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1126
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1127
     the default (set in #initialize) is #doubleClick 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1128
    "
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
    returnKeyActionStyle := aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1131
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1132
2139
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  1133
selectConditionBlock:aBlock
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  1134
    "set the select-conditionBlock; this block is evaluated before 
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  1135
     any selection change is performed (passing the to-be-changed item index as arg).
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1136
     The change will not be done, if the block returns false. 
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1137
     For example, this allows confirmation queries in the SystemBrowser"
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1138
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  1139
    selectConditionBlock := aBlock
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1140
!
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1141
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1142
useIndex
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1143
    "set/clear the useIndex flag. If set, both actionBlock and change-messages
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1144
     are passed the index(indices) of the selection as argument. 
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1145
     If clear, the value(s) (i.e. the selected string) is passed.
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1146
     Default is true."
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1147
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1148
    ^ useIndex
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1149
!
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1150
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1151
useIndex:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1152
    "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
  1153
     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
  1154
     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
  1155
     Default is true."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1156
1235
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1157
    useIndex ~~ aBoolean ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1158
        useIndex := aBoolean.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1159
        useIndex ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1160
            changeMsg == #selection: ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1161
                changeMsg := #selectionIndex:.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1162
                aspectMsg := #selectionIndex.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1163
            ]
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1164
        ] ifFalse:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1165
            changeMsg == #selectionIndex: ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1166
                changeMsg := #selection:.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1167
                aspectMsg := #selection.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1168
            ]
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1169
        ].
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1170
    ].
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1171
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1172
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1173
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1174
!SelectionInListView methodsFor:'accessing-attributes'!
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
attributeAt:index
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1177
    "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
  1178
     currently supported are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1179
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1180
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1181
	 #bold
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1182
    "
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
    listAttributes isNil ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1185
	(index > listAttributes size) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1186
	    ^ listAttributes at:index
125
claus
parents: 124
diff changeset
  1187
	]
claus
parents: 124
diff changeset
  1188
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1189
    ^ nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1190
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1191
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1192
attributeAt:index add:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1193
    "add to a lines attribute(s); 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1194
     currently supported are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1195
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1196
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1197
	 #bold 
125
claus
parents: 124
diff changeset
  1198
    "
320
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
    |current|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1201
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1202
    current := self attributeAt:index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1203
    current isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1204
	current := Set new.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1205
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1206
	current isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1207
	    current == aSymbolOrCollectionOfSymbols ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1208
	    current := Set with:current
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1209
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1210
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1211
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1212
    aSymbolOrCollectionOfSymbols isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1213
	current := current add:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1214
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1215
	(current includes:aSymbolOrCollectionOfSymbols) ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1216
	current addAll:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1217
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1218
    self attributeAt:index put:current
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1219
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1220
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1221
attributeAt:index put:aSymbolOrCollectionOfSymbolsOrNil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1222
    "set a lines attribute(s); 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1223
     currently supported are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1224
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1225
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1226
	 #bold 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1227
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1228
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1229
    (index > self size) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1230
	listAttributes isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1231
	    listAttributes := (OrderedCollection new:index) grow:index
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1232
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1233
	    (index > listAttributes size) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1234
		listAttributes grow:index
125
claus
parents: 124
diff changeset
  1235
	    ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1236
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1237
	aSymbolOrCollectionOfSymbolsOrNil = (listAttributes at:index) ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1238
	    listAttributes at:index put:aSymbolOrCollectionOfSymbolsOrNil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1239
	    self redrawLine:index
125
claus
parents: 124
diff changeset
  1240
	]
claus
parents: 124
diff changeset
  1241
    ]
claus
parents: 124
diff changeset
  1242
claus
parents: 124
diff changeset
  1243
!
claus
parents: 124
diff changeset
  1244
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1245
attributeAt:index remove:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1246
    "remove a line attribute; 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1247
     currently supported are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1248
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1249
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1250
	 #bold 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1251
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1252
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1253
    |current|
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
    current := self attributeAt:index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1256
    current isNil ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1257
    current isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1258
	aSymbolOrCollectionOfSymbols isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1259
	    current == aSymbolOrCollectionOfSymbols ifTrue:[current := nil]
125
claus
parents: 124
diff changeset
  1260
	] ifFalse:[
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1261
	    (aSymbolOrCollectionOfSymbols includes:current) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1262
		current := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1263
	    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1264
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1265
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1266
	aSymbolOrCollectionOfSymbols isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1267
	    current := current remove:aSymbolOrCollectionOfSymbols ifAbsent:[]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1268
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1269
	    aSymbolOrCollectionOfSymbols removeAll:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1270
	]
125
claus
parents: 124
diff changeset
  1271
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1272
    self attributeAt:index put:current
125
claus
parents: 124
diff changeset
  1273
!
claus
parents: 124
diff changeset
  1274
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1275
line:lineNr hasAttribute:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1276
    "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
  1277
     currently supported attributes are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1278
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1279
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1280
	 #bold 
125
claus
parents: 124
diff changeset
  1281
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1282
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1283
    |attr|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1284
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1285
    listAttributes isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1286
    (lineNr > listAttributes size) ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1287
    attr := listAttributes at:lineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1288
    attr isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1289
    attr isSymbol ifTrue:[^ attr == aSymbol].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1290
    ^ (attr includes:aSymbol)
125
claus
parents: 124
diff changeset
  1291
!
claus
parents: 124
diff changeset
  1292
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1293
setAttributes:aList
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1294
    "set the attribute list.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1295
     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
  1296
     (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
  1297
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1298
    listAttributes := aList
125
claus
parents: 124
diff changeset
  1299
!
claus
parents: 124
diff changeset
  1300
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1301
strikeOut:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1302
    "turn on/off strikeOut mode"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1303
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1304
    strikeOut := aBoolean.
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
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1307
!SelectionInListView methodsFor:'accessing-behavior'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1308
1181
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1309
dragObjectConverter:aBlock
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1310
    "set an optional dragObject converter;
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1311
     if non-nil, this one will be evaluated on a drag-start,
1182
b8af34a9be46 allow a dropConverter to return nil (ignore on drop)
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  1312
     for each dropItem as argument, and supposed
b8af34a9be46 allow a dropConverter to return nil (ignore on drop)
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  1313
     to convert it into a dragObject and return it.
b8af34a9be46 allow a dropConverter to return nil (ignore on drop)
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  1314
     If it returns nil, the object will not be dropped.
1181
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1315
     Useful, if the receiver view represents fileNames or other
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1316
     names of the actual objects to be dragged."
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1317
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1318
    dragObjectConverter := aBlock
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1319
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1320
    "Created: 6.4.1997 / 12:16:11 / cg"
1182
b8af34a9be46 allow a dropConverter to return nil (ignore on drop)
Claus Gittinger <cg@exept.de>
parents: 1181
diff changeset
  1321
    "Modified: 6.4.1997 / 14:12:45 / cg"
1181
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1322
!
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1323
987
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1324
enabled
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1325
   "return true if selections are possible"
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1326
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1327
   ^ enabled.
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1328
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1329
    "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
  1330
!
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1331
1831
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1332
enabled:aBoolean
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1333
    "enable/disable the view - selection changes are allowed/disallowed"
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1334
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1335
    enabled := aBoolean
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1336
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1337
    "Modified: / 30.3.1999 / 15:26:10 / stefan"
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1338
!
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1339
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1340
ignoreReselect:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1341
    "set/clear the ignoreReselect flag - 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1342
     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
  1343
     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
  1344
     change in the selection occurs.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1345
     (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
  1346
     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
  1347
     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
  1348
     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
  1349
     if the selection is the same.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1350
     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
  1351
     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
  1352
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  1353
"ca: 
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  1354
    multiple selection on: the ignoreReselect will have no influence
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  1355
"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1356
    ignoreReselect := aBoolean
125
claus
parents: 124
diff changeset
  1357
!
claus
parents: 124
diff changeset
  1358
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1359
multipleSelectOk:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1360
    "allow/disallow multiple selections. If enabled, the
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1361
     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
  1362
     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
  1363
     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
  1364
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1365
    multipleSelectOk := aBoolean.
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  1366
125
claus
parents: 124
diff changeset
  1367
!
claus
parents: 124
diff changeset
  1368
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1369
toggleSelect:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1370
    "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
  1371
     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
  1372
     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
  1373
     select status (see also ignoreReselect:)."
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
    toggleSelect := aBoolean.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1376
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1377
1163
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1378
!SelectionInListView methodsFor:'accessing-channels'!
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1379
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1380
listHolder
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1381
    ^ listChannel
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1382
!
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1383
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1384
listHolder:aListHolder
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1385
    listChannel notNil ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1386
        listChannel removeDependent:self
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1387
    ].
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1388
    (listChannel := aListHolder) notNil ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1389
        listChannel addDependent:self
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1390
    ].
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1391
    self getListFromModel
1163
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1392
! !
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1393
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1394
!SelectionInListView methodsFor:'accessing-contents'!
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
add:aValue beforeIndex:index
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1397
    "must recompute our current selections"
125
claus
parents: 124
diff changeset
  1398
claus
parents: 124
diff changeset
  1399
    selection notNil ifTrue:[
claus
parents: 124
diff changeset
  1400
	multipleSelectOk ifTrue:[
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1401
	    selection := selection collect:[ :sel |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1402
		sel >= index ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1403
		    sel + 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1404
		] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1405
		    sel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1406
		]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1407
	    ].
125
claus
parents: 124
diff changeset
  1408
	] ifFalse:[
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1409
	    selection >= index ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1410
		selection := selection + 1.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1411
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1412
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1413
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1414
    ^ super add:aValue beforeIndex:index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1415
!
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
contents:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1418
    "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
  1419
     and clearing attributes.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1420
     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
  1421
     (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
  1422
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1423
    selection := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1424
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1425
    super contents:aCollection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1426
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1427
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1428
list:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1429
    "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
  1430
     and clearing attributes."
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
    self list:aCollection keepSelection:false 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1433
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1434
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1435
list:aCollection keepSelection:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1436
    "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
  1437
     and clearing attributes."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1438
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1439
    |oldSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1440
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1441
    "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
  1442
     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
  1443
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1444
    (shown and:[hilightLevel ~~ 0]) ifTrue:[
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1445
        selection == firstLineShown ifTrue:[
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1446
           self paint:bgColor.
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1447
           self fillRectangleX:margin y:margin
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1448
                          width:(width - (margin * 2)) 
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1449
                         height:(hilightLevel abs).
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1450
        ].
125
claus
parents: 124
diff changeset
  1451
    ].
claus
parents: 124
diff changeset
  1452
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1453
    aBoolean ifTrue:[
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1454
        oldSelection := selection.
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1455
        selection := nil.
125
claus
parents: 124
diff changeset
  1456
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1457
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1458
    super list:aCollection expandTabs:printItems.
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1459
    self setSelection:oldSelection. "/ nil if keep is false
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1460
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1461
    "Modified: 25.5.1996 / 16:31:13 / cg"
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1462
!
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1463
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1464
printItems:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1465
    "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
  1466
     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
  1467
     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
  1468
     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
  1469
     The default is false.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1470
     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
  1471
     a definable printSelector or - better - a printConverter.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1472
     This may be added in the future."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1473
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1474
    printItems := aBoolean
125
claus
parents: 124
diff changeset
  1475
!
claus
parents: 124
diff changeset
  1476
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1477
removeIndexWithoutRedraw:lineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1478
    "delete line - no redraw;
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1479
     return true, if something was really deleted.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1480
     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
  1481
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1482
    self checkRemovingSelection:lineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1483
    ^ super removeIndexWithoutRedraw:lineNr
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1484
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1485
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1486
setContents:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1487
    "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
  1488
     and clearing attributes.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1489
     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
  1490
     (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
  1491
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1492
    selection := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1493
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1494
    super setContents:aCollection.
125
claus
parents: 124
diff changeset
  1495
!
claus
parents: 124
diff changeset
  1496
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1497
setList:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1498
    "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
  1499
     and clearing attributes.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1500
     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
  1501
     (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
  1502
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1503
    selection := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1504
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1505
    super setList:aCollection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1506
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1507
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1508
!SelectionInListView methodsFor:'accessing-look'!
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1509
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1510
selectedVisualBlock:aBlock
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1511
    "ST-80 compatibility - dummy for now"
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1512
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1513
    selectedVisualBlock := aBlock
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1514
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1515
    "Created: / 27.10.1997 / 19:50:58 / cg"
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1516
    "Modified: / 21.6.1998 / 02:40:46 / cg"
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1517
!
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1518
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1519
visualBlock:aBlock
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1520
    "ST-80 compatibility - dummy for now"
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1521
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1522
    visualBlock := aBlock
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1523
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1524
    "Modified: / 21.6.1998 / 02:40:57 / cg"
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1525
! !
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1526
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1527
!SelectionInListView methodsFor:'accessing-mvc'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1528
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1529
addModelInterfaceTo:aDictionary
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1530
    "see comment in View>>modelInterface"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1531
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1532
    super addModelInterfaceTo:aDictionary.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1533
    aDictionary at:#doubleClickMessage put:doubleClickMsg.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1534
    aDictionary at:#initialSelectionMessage put:initialSelectionMsg.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1535
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1536
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1537
     SelectionInListView new modelInterface 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1538
    "
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1539
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1540
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1541
doubleClick:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1542
    "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
  1543
     OBSOLETE: please use #doubleClickMessage:"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1544
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1545
    self obsoleteMethodWarning:'please use #doubleClickMessage:'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1546
    doubleClickMsg := aSymbol
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1547
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1548
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1549
doubleClickMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1550
    "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
  1551
     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
  1552
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1553
    ^ doubleClickMsg
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1554
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1555
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1556
doubleClickMessage:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1557
    "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
  1558
     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
  1559
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1560
    doubleClickMsg := aSymbol
119
claus
parents: 116
diff changeset
  1561
!
claus
parents: 116
diff changeset
  1562
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1563
initialSelectionMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1564
    "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
  1565
     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
  1566
     actually aquire a new selection value."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1567
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1568
    ^ initialSelectionMsg
125
claus
parents: 124
diff changeset
  1569
!
claus
parents: 124
diff changeset
  1570
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1571
initialSelectionMessage:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1572
    "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
  1573
     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
  1574
     actually aquire a new selection value."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1575
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1576
    initialSelectionMsg := aSymbol
125
claus
parents: 124
diff changeset
  1577
!
claus
parents: 124
diff changeset
  1578
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1579
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
  1580
		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
  1581
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1582
    "ST-80 compatibility"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1583
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1584
    aspectMsg := aspectSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1585
    changeMsg := changeSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1586
    listMsg := listSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1587
    menuMsg := menuSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1588
    initialSelectionMsg := initialSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1589
    printItems := print.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1590
    oneItem := one.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1591
    useIndex := use.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1592
    ignoreReselect := false.    "/ ST80 behavior
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1593
    self model:aModel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1594
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1595
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1596
!SelectionInListView methodsFor:'accessing-selection'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1597
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1598
addElementToSelection:anObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1599
    "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
  1600
     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
  1601
     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
  1602
     was found.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1603
     *** 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
  1604
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1605
    |lineNo str|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1606
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1607
    str := anObject printString.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1608
    lineNo := list findFirst:[:entry | str = entry printString].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1609
    lineNo ~~ 0 ifTrue:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1610
        self addToSelection:lineNo.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1611
        ^ true
125
claus
parents: 124
diff changeset
  1612
    ].
claus
parents: 124
diff changeset
  1613
    ^ false
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1614
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1615
    "Modified: 15.11.1996 / 16:59:43 / cg"
125
claus
parents: 124
diff changeset
  1616
!
claus
parents: 124
diff changeset
  1617
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1618
addToSelection:aNumber
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1619
    "add entry, aNumber to the selection. No scrolling is done.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1620
     *** 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
  1621
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1622
    (self isValidSelection:aNumber) ifFalse:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1623
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1624
    "/ this item selectable ?
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  1625
    (selectConditionBlock notNil 
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  1626
     and:[(selectConditionBlock value:aNumber) not]) ifTrue:[^ self].
1409
a188f69b125f bug fix:
ca
parents: 1402
diff changeset
  1627
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1628
    selection isNil ifTrue:[^ self selectWithoutScroll:aNumber].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1629
    selection isCollection ifTrue:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1630
        (selection includes:aNumber) ifTrue:[^ self].
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1631
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1632
        "/ to enforce the change-message (value is identical to oldValue)
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1633
        selection isList ifTrue:[
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1634
            selection add:aNumber
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1635
        ] ifFalse:[
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1636
            selection := selection asOrderedCollection.
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1637
            selection := selection copyWith:aNumber
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1638
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1639
    ] ifFalse:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1640
        (aNumber == selection) ifTrue:[^ self].
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1641
        selection := OrderedCollection with:selection with:aNumber
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1642
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1643
    self redrawElement:aNumber
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1644
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1645
    "Modified: / 11.2.2000 / 01:38:45 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1646
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1647
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1648
removeFromSelection:aNumber
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1649
    "remove entry, aNumber from the selection.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1650
     *** 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
  1651
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1652
    selection isNil ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1653
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1654
    multipleSelectOk ifTrue:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1655
        (selection includes:aNumber) ifFalse:[^ self].
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1656
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1657
        selection isList ifTrue:[
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1658
            selection remove:aNumber ifAbsent:nil
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1659
        ] ifFalse:[
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1660
            "/ to enforce the change-message (value is identical to oldValue)
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1661
            selection := selection asOrderedCollection.
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1662
            selection := selection copyWithout:aNumber
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1663
        ].
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1664
        selection size == 0 ifTrue:[
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1665
            selection := #()
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1666
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1667
    ] ifFalse:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1668
        (aNumber == selection) ifFalse:[^ self].
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1669
        selection := nil
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1670
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1671
    self redrawElement:aNumber
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1672
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1673
    "Modified: / 11.2.2000 / 01:41:24 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1674
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1675
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1676
!SelectionInListView methodsFor:'change & update'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1677
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1678
update:something with:aParameter from:changedObject
1844
a76a2ba85a4b list change notification #at:
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  1679
    |list start stop size idx|
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1680
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1681
    changedObject == model ifTrue:[
1235
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1682
        something == aspectMsg ifTrue:[
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  1683
            listChannel isNil ifTrue:[
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  1684
                self getListFromModel
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  1685
            ].
1235
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1686
            self getSelectionFromModel.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1687
            ^ self
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1688
        ].
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1689
        something == listMsg ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1690
            self getListFromModel.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1691
            ^ self
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1692
        ].
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1693
        something == initialSelectionMsg ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1694
            self getSelectionFromModel.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1695
            ^ self
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1696
        ].
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1697
        something == #empty ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1698
            self list:nil.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1699
            ^ self
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1700
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1701
    ].
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1702
    changedObject == listChannel ifFalse:[
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1703
        ^ super update:something with:aParameter from:changedObject
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1704
    ].
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1705
    list := listChannel value.
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1706
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1707
    something == #at: ifTrue:[
1844
a76a2ba85a4b list change notification #at:
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  1708
        idx := aParameter isCollection ifTrue:[aParameter at:1]
a76a2ba85a4b list change notification #at:
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  1709
                                      ifFalse:[aParameter].
a76a2ba85a4b list change notification #at:
Claus Gittinger <cg@exept.de>
parents: 1831
diff changeset
  1710
        ^ self at:aParameter put:(list at:idx).
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1711
    ].
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1712
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1713
    something == #insert: ifTrue:[
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1714
        ^ self add:(list at:aParameter) beforeIndex:aParameter
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1715
    ].
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1716
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1717
    something == #remove: ifTrue:[
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1718
        ^ self removeIndex:aParameter
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1719
    ].
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1720
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1721
    something == #insertCollection: ifTrue:[
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1722
        (size := aParameter last) ~~ 0 ifTrue:[
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1723
            self size == 0 ifTrue:[
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1724
                self getListFromModel
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1725
            ] ifFalse:[
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1726
                start := aParameter first.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1727
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1728
                size timesRepeat:[
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1729
                    self add:(list at:start) beforeIndex:start.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1730
                    start := start + 1
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1731
                ]
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  1732
            ]
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1733
        ].
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1734
        ^ self
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1735
    ].
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1736
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1737
    something == #removeFrom: ifTrue:[
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1738
        start := aParameter first.
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1739
        stop  := aParameter last.
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1740
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1741
        (start == 1 and:[stop == self size]) ifTrue:[
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1742
            self getListFromModel
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1743
        ] ifFalse:[
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1744
            (stop - start + 1) timesRepeat:[
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1745
                self removeIndex:start
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1746
            ]
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1747
        ].
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1748
        ^ self
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1749
    ].
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1750
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1751
    something == #replace: ifTrue:[
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1752
        start := aParameter first.
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1753
        stop  := aParameter last.
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1754
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1755
        start to:stop do:[:anIndex|
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1756
            self at:anIndex put:(list at:anIndex)
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1757
        ].
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1758
        ^ self
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1759
    ].
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1760
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1761
    self getListFromModel.
1400
056494ffbda0 release channels on destroy
Claus Gittinger <cg@exept.de>
parents: 1379
diff changeset
  1762
056494ffbda0 release channels on destroy
Claus Gittinger <cg@exept.de>
parents: 1379
diff changeset
  1763
    "Modified: / 14.11.1997 / 13:51:04 / cg"
1831
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1764
    "Modified: / 30.3.1999 / 14:27:42 / stefan"
125
claus
parents: 124
diff changeset
  1765
! !
claus
parents: 124
diff changeset
  1766
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1767
!SelectionInListView methodsFor:'drag & drop - new'!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1768
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1769
canDrag
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1770
    "returns true if dragging is enabled
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1771
    "
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1772
    ^ (allowDrag or:[dropSource notNil])
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1773
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1774
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1775
dropSource
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1776
    "returns the dropSource or nil
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1777
    "
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1778
    ^ dropSource
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1779
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1780
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1781
dropSource:aDropSourceOrNil
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1782
    "set the dropSource or nil
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1783
    "
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1784
    dropSource := aDropSourceOrNil.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1785
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1786
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1787
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1788
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1789
dropTarget
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1790
    "returns the dropTarget or nil
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1791
    "
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1792
    ^ dropTarget
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1793
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1794
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1795
dropTarget:aDropTragetOrNil
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1796
    "set the dropTarget or nil
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1797
    "
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1798
    dropTarget := aDropTragetOrNil.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1799
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1800
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1801
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1802
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1803
startDragAt:aPoint
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1804
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1805
    dropSource isNil ifTrue:[
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1806
        self startDragX:aPoint x y:aPoint y
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1807
    ] ifFalse:[
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1808
        dropSource startDragIn:self at:aPoint
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1809
    ]
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1810
! !
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1811
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1812
!SelectionInListView methodsFor:'drag & drop - old'!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1813
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1814
allowDrag:aBoolean
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1815
    "enable/disable dragging support"
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1816
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1817
    allowDrag := aBoolean
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1818
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1819
    "Created: 14.11.1996 / 15:12:58 / cg"
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1820
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1821
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1822
collectionOfDragObjects
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1823
    "returns collection of dragable objects assigned to selection
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1824
     Here, by default, a collection of text-dragObjects is generated;
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1825
     however, if a dragObjectConverter is defined, that one gets a chance
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1826
     to convert as appropriate."
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1827
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1828
    |collection converted|
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1829
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1830
    collection := OrderedCollection new.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1831
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1832
    self selectionDo:[:aNumber||text|
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1833
        text := self at:aNumber.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1834
        collection add:(DropObject newText:text)
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1835
    ].
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1836
    dragObjectConverter notNil ifTrue:[
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1837
        converted := OrderedCollection new.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1838
        collection do:[:o | 
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1839
                                |convertedObject|
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1840
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1841
                                convertedObject := dragObjectConverter value:o.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1842
                                convertedObject notNil ifTrue:[
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1843
                                    converted add:convertedObject
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1844
                                ]
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1845
                      ].
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1846
        collection := converted
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1847
    ].
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1848
    ^ collection.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1849
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1850
    "Modified: 6.4.1997 / 14:14:30 / cg"
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1851
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1852
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1853
endDragAction:aFourArgBlock
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1854
    "if dragging is enabled, this block will be evaluated
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1855
     at drag end time.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1856
     It gets 4 args passed (see DragAndDropManager>>endDragAt:):
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1857
        - the targetView            (if its a smalltalk view)
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1858
        - the targetViews windowID  (useful, if its an alien view)
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1859
        - the dropPosition in screen coordinates
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1860
        - the dropPosition within the target view
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1861
    "
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1862
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1863
    endDragAction := aFourArgBlock
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1864
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1865
    "Created: 14.11.1996 / 15:42:38 / cg"
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1866
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1867
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1868
showDraggingIn:aView at:p
1697
b2a2f80de0ec care for empty selection in #showDragging:.
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  1869
    |nItems items offs|
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1870
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1871
    items := self selectionValueAsCollection.
1697
b2a2f80de0ec care for empty selection in #showDragging:.
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  1872
    (nItems := items size) > 1 ifTrue:[
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1873
        offs := 0.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1874
        items do:[:item |
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1875
            item displayOn:aView at:p + (0@offs).
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1876
            offs := offs + (item heightOn:self)
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1877
        ]
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1878
    ] ifFalse:[
1697
b2a2f80de0ec care for empty selection in #showDragging:.
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  1879
        nItems ~~ 0 ifTrue:[
b2a2f80de0ec care for empty selection in #showDragging:.
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  1880
            items first displayOn:aView at:p.
b2a2f80de0ec care for empty selection in #showDragging:.
Claus Gittinger <cg@exept.de>
parents: 1676
diff changeset
  1881
        ]
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1882
    ]
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1883
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1884
    "Created: 14.11.1996 / 15:31:31 / cg"
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1885
    "Modified: 14.11.1996 / 16:32:00 / cg"
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1886
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1887
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1888
startDragX:x y:y
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1889
    |xOffset w h dragAndDropMgr|
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1890
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1891
    dragIsActive := true.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1892
    xOffset      := x.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1893
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1894
    h := 0.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1895
    w := 0.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1896
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1897
    self selectionDo:[:aNumber||e|
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1898
        e := self at:aNumber.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1899
        h := h  +  (e heightOn:self).
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1900
        w := w max:(e widthOn:self).
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1901
    ].
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1902
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1903
    DragAndDropManager startDrag:(self collectionOfDragObjects)
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1904
                            from:self
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1905
                          offset:0 @ 0
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1906
                           atEnd:endDragAction
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1907
                         display:(self selectionValue).
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1908
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1909
"/    dragAndDropMgr := DragAndDropManager new.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1910
"/    dragAndDropMgr dropObjects:(self collectionOfDragObjects).
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1911
"/
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1912
"/    dragAndDropMgr 
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1913
"/        startOpaqueDrag:[:aPoint :aView | 
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1914
"/                            self 
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1915
"/                                showDraggingIn:aView 
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1916
"/                                at:aPoint - (xOffset@0)
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1917
"/                        ]
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1918
"/        offset:(xOffset @ h)
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1919
"/        extent:(w*5)@(h*2)
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1920
"/        in:self
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1921
"/        at:(x@y)
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1922
"/        atEnd:endDragAction.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1923
"/
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1924
"/    "Modified: 19.4.1997 / 10:00:16 / cg"
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1925
"/
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1926
"/
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1927
"/
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1928
! !
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1929
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1930
!SelectionInListView methodsFor:'drawing'!
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1931
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1932
drawRightArrowInVisibleLine:visLineNr
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1933
    "draw a right arrow (for submenus).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1934
     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
  1935
     as menus or file-lists."
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1936
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1937
    |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
  1938
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1939
    x := width - 16.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1940
    y := (self yOfVisibleLine:visLineNr).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1941
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1942
    listLine := self visibleLineToListLine:visLineNr.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1943
    item := self at:listLine.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1944
    item isNil ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1945
        itemHeight := fontHeight
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1946
    ] ifFalse:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1947
        itemHeight := item heightOn:self.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1948
    ].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1949
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1950
    (device depth == 1 or:[arrowLevel == 0]) ifTrue:[
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1951
        form := self class rightArrowFormOn:device.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1952
        form notNil ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1953
            y := y + ((itemHeight - form height) // 2).
2037
3d3eebdbed6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1954
            self foreground:(
3d3eebdbed6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1955
                    (self isInSelection:listLine) 
3d3eebdbed6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1956
                        ifTrue:[hilightFgColor] 
3d3eebdbed6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  1957
                        ifFalse:[fgColor]).
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1958
            self displayForm:form x:x y:y.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1959
        ]
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1960
    ] ifFalse:[
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1961
        smallArrow ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1962
            form := self class smallRightArrowLightFormOn:device.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1963
            form2 := self class smallRightArrowShadowFormOn:device.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1964
        ] ifFalse:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1965
            form := self class rightArrowLightFormOn:device.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1966
            form2 := self class rightArrowShadowFormOn:device.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1967
        ].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1968
        (form isNil or:[form2 isNil]) ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1969
            "/ very bad conditions
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1970
            ^ self
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1971
        ].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1972
        y := y + ((itemHeight - form height) // 2).
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1973
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1974
        topLeftColor := lightColor.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1975
        botRightColor := shadowColor. 
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1976
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1977
        "openwin arrow stays down"
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1978
        styleSheet name ~~ #openwin ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1979
            (self isInSelection:listLine) ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1980
                t := topLeftColor.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1981
                topLeftColor := botRightColor.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1982
                botRightColor := t.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1983
            ]
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1984
        ].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1985
        arrowLevel < 0 ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1986
            t := topLeftColor.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1987
            topLeftColor := botRightColor.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1988
            botRightColor := t.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1989
        ].
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1990
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1991
"/        self foreground:topLeftColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1992
self paint:topLeftColor.
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1993
        self displayForm:form x:x y:y.
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1994
"/        self foreground:botRightColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1995
self paint:botRightColor.
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  1996
        self displayForm:form2 x:x y:y.
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1997
    ]
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1998
!
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  1999
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2000
drawVisibleLineSelected:visLineNr
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2001
    "redraw a single line as selected."
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2002
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2003
    self drawVisibleLineSelected:visLineNr with:hilightFgColor and:hilightBgColor
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2004
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2005
    "Modified: / 31.8.1995 / 19:24:09 / claus"
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2006
    "Modified: / 21.6.1998 / 03:12:56 / cg"
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2007
!
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2008
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2009
drawVisibleLineSelected:visLineNr with:fg and:bg
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2010
    "redraw a single line as selected."
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2011
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2012
    |listLine 
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2013
     y  "{ Class: SmallInteger }" 
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2014
     y2 "{ Class: SmallInteger }" 
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2015
     wEdge dObj|
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2016
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2017
    listLine := self visibleLineToListLine:visLineNr.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2018
    listLine notNil ifTrue:[
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2019
        selectedVisualBlock notNil ifTrue:[
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2020
            dObj := selectedVisualBlock value:self value:listLine.
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2021
            y := (self yOfVisibleLine:visLineNr) + font ascent.
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2022
            self paint:bg on:fg.
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2023
            dObj displayOn:self x:0 y:y opaque:true.
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2024
            ^ self
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2025
        ].
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2026
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2027
        strikeOut ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2028
            self drawVisibleLine:visLineNr with:fgColor and:bgColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2029
            y := self yOfVisibleLine:visLineNr.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2030
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2031
            self paint:fgColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2032
            y := y + (fontHeight // 2).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2033
            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
  2034
            ^ self
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2035
        ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2036
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2037
        self drawVisibleLine:visLineNr with:fg and:bg.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2038
        y := (self yOfVisibleLine:visLineNr) - (lineSpacing//2).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2039
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2040
        "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2041
         a line above and below
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2042
        "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2043
        hilightFrameColor notNil ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2044
            hilightLevel == 0 ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2045
                self paint:hilightFrameColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2046
                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
  2047
                y2 := y + fontHeight - 1.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2048
                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
  2049
                ^ self
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2050
            ]
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2051
        ] ifFalse:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2052
            hilightStyle == #motif ifTrue:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2053
                self paint:fg.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2054
                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
  2055
                y2 := y + fontHeight - 1 - 1.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2056
                self displayLineFromX:0 y:y2 toX:width y:y2.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2057
            ]
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2058
        ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2059
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2060
        "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2061
         an edge it around
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2062
        "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2063
        (hilightLevel ~~ 0) ifTrue:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2064
            "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2065
             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
  2066
             XXX: widthOfContents should be cached in ListView
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2067
                  (instead of recomputing all over)
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2068
            "
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2069
            wEdge := width-(2 * margin).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2070
            includesNonStrings ifFalse:[
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2071
                wEdge := wEdge max:(self widthOfContents).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2072
            ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2073
            self drawEdgesForX:(margin - leftOffset) y:y 
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2074
                         width:wEdge+leftOffset height:fontHeight 
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2075
                         level:hilightLevel.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2076
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2077
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2078
        ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2079
        ^ self
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2080
    ].
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2081
    ^ super drawVisibleLine:visLineNr with:fg and:bg
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2082
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2083
    "Modified: / 31.8.1995 / 19:24:09 / claus"
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2084
    "Created: / 28.2.1996 / 18:40:21 / cg"
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2085
    "Modified: / 21.6.1998 / 03:51:04 / cg"
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2086
! !
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2087
125
claus
parents: 124
diff changeset
  2088
!SelectionInListView methodsFor:'event handling'!
claus
parents: 124
diff changeset
  2089
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2090
buttonControlPress:button x:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2091
    "if multipleSelectOk: add to the selection; 
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2092
     otherwise, behave like normal select"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2093
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2094
    |oldSelection listLineNr|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2095
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2096
    ((button == 1) or:[button == #select]) ifTrue:[
1299
27f3fc6dee3d buttonControlPress:button x:x y:y
ca
parents: 1278
diff changeset
  2097
"/        toggleSelect ifTrue:[
27f3fc6dee3d buttonControlPress:button x:x y:y
ca
parents: 1278
diff changeset
  2098
"/           ^ self buttonPress:button x:x y:y
27f3fc6dee3d buttonControlPress:button x:x y:y
ca
parents: 1278
diff changeset
  2099
"/        ].
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2100
        enabled ifTrue:[
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2101
            listLineNr := self visibleLineToListLine:(self visibleLineOfY:y).
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2102
            listLineNr notNil ifTrue:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2103
                (self lineIsEnabled:listLineNr) ifFalse:[^ self].
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2104
            ].
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2105
            oldSelection := selection copy.
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2106
            listLineNr notNil ifTrue: [
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2107
                "/ this item selectable ?
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2108
                (selectConditionBlock notNil 
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2109
                 and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self].
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2110
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2111
                multipleSelectOk ifTrue:[
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2112
                    (self isInSelection:listLineNr) ifTrue:[
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2113
                        self removeFromSelection:listLineNr
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2114
                    ] ifFalse:[
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2115
                        self addToSelection:listLineNr
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2116
                    ]
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2117
                ] ifFalse:[
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2118
                    self selectWithoutScroll:listLineNr
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2119
                ]
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2120
            ].
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2121
            ((ignoreReselect not and:[selection notNil])
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2122
             or:[selection ~= oldSelection]) ifTrue:[
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2123
                self selectionChangedFrom:oldSelection.
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2124
            ].
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2125
            clickLine := listLineNr
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2126
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2127
    ] ifFalse:[
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2128
        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
  2129
    ]
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2130
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2131
    "Created: / 14.11.1996 / 15:51:41 / cg"
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2132
    "Modified: / 8.8.1998 / 03:24:03 / cg"
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2133
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2134
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2135
buttonMotion:buttonMask x:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2136
    "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
  2137
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2138
    (enabled not or:[dragIsActive]) ifTrue:[
987
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  2139
        ^ self
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  2140
    ].
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  2141
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2142
    "is it the select or 1-button ?"
1620
47983c461af0 use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  2143
    self sensor leftButtonPressed ifFalse:[^ self].
47983c461af0 use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  2144
"/    (device buttonMotionMask:buttonMask includesButton:#select) ifFalse:[
47983c461af0 use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  2145
"/        (device buttonMotionMask:buttonMask includesButton:1) ifFalse:[
47983c461af0 use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  2146
"/            ^ self
47983c461af0 use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  2147
"/        ].
47983c461af0 use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  2148
"/    ].
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2149
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2150
    clickLine isNil ifTrue:[^ self].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2151
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2152
    (self canDrag and:[clickPosition notNil]) ifTrue:[     "mouse pressed but not released"
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2153
        (clickPosition dist:(x@y)) > 5.0 ifTrue:[
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2154
            ^ self startDragAt:clickPosition
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2155
        ].
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2156
        ^ self
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2157
    ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2158
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2159
    "if moved outside of view, start autoscroll"
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2160
    (y < 0) ifTrue:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2161
        self compressMotionEvents:false.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2162
        self startAutoScrollUp:y.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2163
        ^ self
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2164
    ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2165
    (y > height) ifTrue:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2166
        self compressMotionEvents:false.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2167
        self startAutoScrollDown:(y - height).
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2168
        ^ self
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2169
    ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2170
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2171
    (self canDrag and:[x < -5]) ifTrue:[           "visible and left out of view"
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2172
        ^ self startDragAt:(0 @ y)
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2173
    ].
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2174
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2175
    "move inside - stop autoscroll if any"
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2176
    self stopAutoScroll.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2177
2161
d80ba1bf9bb4 motion event compression
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  2178
    (self sensor hasButtonMotionEventFor:self) ifFalse:[
d80ba1bf9bb4 motion event compression
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  2179
        self expandSelectionToX:x y:y.
d80ba1bf9bb4 motion event compression
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  2180
    ].
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2181
1620
47983c461af0 use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  2182
    "Modified: / 29.1.1997 / 12:15:31 / stefan"
2161
d80ba1bf9bb4 motion event compression
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  2183
    "Modified: / 23.2.2000 / 12:03:35 / cg"
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2184
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2185
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2186
buttonMultiPress:button x:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2187
    ((button == 1) or:[button == #select]) ifTrue:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2188
"/        doubleClickActionBlock isNil ifTrue:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2189
"/            self buttonPress:button x:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2190
"/        ].
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2191
        enabled ifFalse:[
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2192
            ^ self
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2193
        ].
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2194
        self doubleClicked.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2195
    ] ifFalse:[
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2196
        super buttonMultiPress:button x:x y:y
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2197
    ]
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2198
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2199
    "Modified: / 26.10.1997 / 18:50:58 / cg"
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2200
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2201
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2202
buttonPress:button x:x y:y
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2203
    |sensor lineNr|
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2204
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2205
    ((button == 1) or:[button == #select]) ifFalse:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2206
        ^ super buttonPress:button x:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2207
    ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2208
    enabled ifFalse:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2209
        ^ self
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2210
    ].
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2211
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2212
    dragIsActive  := false.
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2213
    clickPosition := nil.
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2214
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2215
    sensor := self sensor.
1513
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2216
    sensor notNil ifTrue:[
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2217
        sensor ctrlDown ifTrue:[
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2218
            ^ self buttonControlPress:button x:x y:y
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2219
        ].
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2220
        sensor shiftDown ifTrue:[
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2221
            ^ self expandSelectionToX:x y:y
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2222
        ]
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2223
    ].
1181
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  2224
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2225
    self canDrag ifTrue:[
1181
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  2226
        "/ clicked into the selection ?
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  2227
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2228
        lineNr := self visibleLineToListLine:(self visibleLineOfY:y).
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2229
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2230
        (self isInSelection:lineNr) ifTrue:[
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2231
            "wait for release button
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2232
            "
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2233
            clickPosition := x@y.
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2234
            clickLine     := lineNr.
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2235
          ^ self
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2236
        ]
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2237
    ].
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2238
    self selectOrToggleAtX:x y:y
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2239
1513
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2240
    "Modified: / 7.5.1998 / 02:02:20 / cg"
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2241
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2242
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2243
buttonRelease:button x:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2244
    "stop any autoscroll"
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2245
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2246
    self stopAutoScroll.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2247
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2248
    dragIsActive ifTrue:[
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2249
        dragIsActive := false
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2250
    ] ifFalse:[
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2251
        clickPosition notNil ifTrue:[
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2252
            enabled ifFalse:[
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2253
                ^ self
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2254
            ].
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2255
            self selectOrToggleAtX:(clickPosition x) y:(clickPosition y).
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2256
        ]
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2257
    ].
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2258
    clickPosition := nil.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2259
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2260
    "Modified: / 26.10.1997 / 18:51:14 / cg"
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2261
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2262
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2263
buttonShiftPress:button x:x y:y
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2264
    "expand selection
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2265
    "
1252
10e987a9ae7a removed debugHalts
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  2266
    self halt.      "/ never called
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2267
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2268
    self expandSelectionToX:x y:y
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2269
1252
10e987a9ae7a removed debugHalts
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  2270
    "Modified: 17.6.1997 / 18:03:24 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2271
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2272
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2273
doubleClicked
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  2274
    |actionArg|
1457
818a2d65cf02 reset clickLine
ca
parents: 1409
diff changeset
  2275
818a2d65cf02 reset clickLine
ca
parents: 1409
diff changeset
  2276
    clickLine := nil.
818a2d65cf02 reset clickLine
ca
parents: 1409
diff changeset
  2277
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2278
    enabled ifFalse:[
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2279
        ^ self
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2280
    ].
554
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2281
    selection isNil ifTrue:[
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2282
        "/ can only happen if claus modifies the selection within
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2283
        "/ the selectAction ....
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2284
        ^ self
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2285
    ].
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2286
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  2287
    actionArg := self argForChangeMessage.
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  2288
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2289
    "/
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2290
    "/ the ST-80 way of notifying the model
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2291
    "/
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2292
    (model notNil and:[doubleClickMsg notNil]) ifTrue:[
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  2293
        self sendChangeMessage:doubleClickMsg with:actionArg.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2294
    ].
554
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2295
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2296
    "/
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2297
    "/ ST/X action blocks
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2298
    "/
1744
f7d712e4b79e support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents: 1725
diff changeset
  2299
    doubleClickActionBlock notNil ifTrue:[
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  2300
        (doubleClickActionBlock numArgs == 1) ifTrue:[
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  2301
            doubleClickActionBlock value:actionArg
1744
f7d712e4b79e support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents: 1725
diff changeset
  2302
        ] ifFalse:[
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  2303
            doubleClickActionBlock value
1744
f7d712e4b79e support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents: 1725
diff changeset
  2304
        ]
f7d712e4b79e support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents: 1725
diff changeset
  2305
    ].
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2306
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2307
    "Modified: / 26.10.1997 / 18:51:39 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2308
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2309
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2310
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
  2311
    "select an entry by a keyboard action.
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2312
     This is treated like a doubleClick on that entry,
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2313
     except if shift is down, and multiple selections are
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2314
     allowed, this adds/removes the new item to the selection."
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2315
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2316
    |oldSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2317
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2318
    enabled ifFalse:[
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2319
        ^ self
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2320
    ].
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2321
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2322
    keyActionStyle notNil ifTrue:[
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2323
        "/ this item selectable ?
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2324
        (selectConditionBlock notNil 
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2325
         and:[(selectConditionBlock value:index) not]) ifTrue:[^ self].
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2326
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2327
        keyActionStyle == #pass ifTrue:[
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2328
            ^ super keyPress:key x:x y:y
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2329
        ].
2156
77515ef62950 selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  2330
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2331
        (multipleSelectOk and:[self sensor shiftDown]) ifTrue:[
2156
77515ef62950 selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  2332
            oldSelection := selection copy.
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2333
            (self isInSelection:index) ifTrue:[
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2334
                self removeFromSelection:index
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2335
            ] ifFalse:[
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2336
                self addToSelection:index
2156
77515ef62950 selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  2337
            ].
77515ef62950 selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  2338
            (selection ~= oldSelection) ifTrue:[
77515ef62950 selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  2339
                self selectionChangedFrom:oldSelection.
77515ef62950 selectionChange notification, if expanded via shift-click,
Claus Gittinger <cg@exept.de>
parents: 2148
diff changeset
  2340
            ].
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2341
        ] ifFalse:[
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2342
            self selection:index.
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2343
    
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2344
            keyActionStyle == #selectAndDoubleClick ifTrue:[
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2345
                self doubleClicked
885
7a53a92aa4c2 oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
  2346
            ]
7a53a92aa4c2 oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
  2347
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2348
    ].
885
7a53a92aa4c2 oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
  2349
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2350
    "Modified: / 4.2.2000 / 14:51:25 / cg"
125
claus
parents: 124
diff changeset
  2351
!
claus
parents: 124
diff changeset
  2352
claus
parents: 124
diff changeset
  2353
keyPress:key x:x y:y
claus
parents: 124
diff changeset
  2354
    "handle keyboard input"
claus
parents: 124
diff changeset
  2355
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  2356
    <resource: #keyboard ( #CursorUp #CursorDown #BeginOfText #EndOfText
1676
a85936a2064c treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
  2357
                           #BeginOfLine #EndOfLine
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  2358
                           #Return ) >
132
claus
parents: 131
diff changeset
  2359
210
f7d44c195776 search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  2360
    |index       
f7d44c195776 search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  2361
     searchIndex "{Class: SmallInteger}"
f7d44c195776 search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  2362
     startSearch "{Class: SmallInteger}"
1323
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2363
     backSearch searchPrefix item
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2364
     mySize sensor s|
125
claus
parents: 124
diff changeset
  2365
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2366
    enabled ifFalse:[
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2367
        ^ self
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2368
    ].
125
claus
parents: 124
diff changeset
  2369
    (key == #CursorUp) ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2370
        index := self previousBeforeSelection.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2371
        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
  2372
        ^ self
125
claus
parents: 124
diff changeset
  2373
    ].
claus
parents: 124
diff changeset
  2374
    (key == #CursorDown) ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2375
        index := self nextAfterSelection.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2376
        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
  2377
        ^ self
125
claus
parents: 124
diff changeset
  2378
    ].
claus
parents: 124
diff changeset
  2379
    "/
1249
Claus Gittinger <cg@exept.de>
parents: 1244
diff changeset
  2380
    "/ stupid: Home and End are caught in ScrollableView
125
claus
parents: 124
diff changeset
  2381
    "/ we normally do not get them ...
claus
parents: 124
diff changeset
  2382
    "/ (need to call handlesKey: from there ...
claus
parents: 124
diff changeset
  2383
    "/  ... and implement it here)
claus
parents: 124
diff changeset
  2384
    "/
1676
a85936a2064c treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
  2385
    ((key == #BeginOfText) or:[key == #BeginOfLine]) ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2386
        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
  2387
        ^ self
125
claus
parents: 124
diff changeset
  2388
    ].
1676
a85936a2064c treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
  2389
    ((key == #EndOfText) or:[key == #EndOfLine]) ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2390
        index := self size.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2391
        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
  2392
        ^ self
125
claus
parents: 124
diff changeset
  2393
    ].
claus
parents: 124
diff changeset
  2394
    key == #Return ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2395
        returnKeyActionStyle == #doubleClick ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2396
            selection notNil ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2397
                self doubleClicked
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2398
            ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2399
            ^ self
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2400
        ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2401
        returnKeyActionStyle ~~ #pass ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2402
            ^ self
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2403
        ].
125
claus
parents: 124
diff changeset
  2404
    ].
2142
2015adfc6096 selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2405
    (key == #SelectAll) ifTrue:[
2015adfc6096 selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2406
        multipleSelectOk ifTrue:[
2015adfc6096 selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2407
            self selectAll. 
2015adfc6096 selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2408
        ].
2015adfc6096 selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2409
        ^ self
2015adfc6096 selectAll shortKey (shift-Cmd-A)
Claus Gittinger <cg@exept.de>
parents: 2141
diff changeset
  2410
    ].
125
claus
parents: 124
diff changeset
  2411
1323
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2412
    mySize := self size.
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2413
125
claus
parents: 124
diff changeset
  2414
    "
claus
parents: 124
diff changeset
  2415
     alphabetic keys: search for next entry
claus
parents: 124
diff changeset
  2416
     starting with keys character. If shift is pressed, search backward
claus
parents: 124
diff changeset
  2417
    "
1323
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2418
    (mySize > 0
125
claus
parents: 124
diff changeset
  2419
    and:[key isCharacter
claus
parents: 124
diff changeset
  2420
    and:[key isLetter]]) ifTrue:[
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2421
        keyActionStyle isNil ifTrue:[^ self].
364
8f0d8e4088c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 358
diff changeset
  2422
"/        multipleSelectOk ifTrue:[^ self].
1323
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2423
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2424
        keyActionStyle == #pass ifFalse:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2425
            searchPrefix := key asLowercase asString.
125
claus
parents: 124
diff changeset
  2426
claus
parents: 124
diff changeset
  2427
"/            ... isISearch... ifFalse:[
claus
parents: 124
diff changeset
  2428
"/                iSearchString := ''
claus
parents: 124
diff changeset
  2429
"/            ] ifTrue:[
claus
parents: 124
diff changeset
  2430
"/                iSearchString := iSearchString , searchPrefix.
claus
parents: 124
diff changeset
  2431
"/                searchPrefix := iSearchString
claus
parents: 124
diff changeset
  2432
"/            ].
claus
parents: 124
diff changeset
  2433
1513
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2434
            backSearch := false.
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2435
            sensor := self sensor.
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2436
            sensor notNil ifTrue:[
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2437
                backSearch := sensor shiftDown.
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2438
            ].
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2439
            backSearch ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2440
                selection notNil ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2441
                    selection size > 0 ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2442
                        startSearch := selection first - 1
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2443
                    ] ifFalse:[
1323
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2444
                        selection isCollection ifTrue:[
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2445
                            startSearch := mySize
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2446
                        ] ifFalse:[
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2447
                            startSearch := selection - 1
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2448
                        ]
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2449
                    ]
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2450
                ] ifFalse:[
1323
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2451
                    startSearch := mySize
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2452
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2453
                startSearch < 1 ifTrue:[
1323
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2454
                    startSearch := mySize.
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2455
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2456
            ] ifFalse:[    
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2457
                selection notNil ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2458
                    selection size > 0 ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2459
                        startSearch := selection last + 1
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2460
                    ] ifFalse:[
1323
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2461
                        selection isCollection ifTrue:[
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2462
                            startSearch := 1
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2463
                        ] ifFalse:[
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2464
                            startSearch := selection + 1
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2465
                        ]
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2466
                    ]
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2467
                ] ifFalse:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2468
                    startSearch := 1
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2469
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2470
                startSearch > self size ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2471
                    startSearch := 1.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2472
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2473
            ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2474
            searchIndex := startSearch.
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2475
            [true] whileTrue:[
1256
13ff2ef827e5 care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
  2476
                item := self at:searchIndex.
13ff2ef827e5 care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
  2477
                item notNil ifTrue:[
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2478
                    (Object errorSignal catch:[s := item asString])
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2479
                    ifTrue:[s := item displayString].
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2480
                    (s withoutSeparators asLowercase startsWith:searchPrefix) ifTrue:[
1256
13ff2ef827e5 care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
  2481
                        searchIndex = selection ifTrue:[^ self].
13ff2ef827e5 care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
  2482
                        ^ self key:key select:searchIndex x:x y:y
13ff2ef827e5 care for nil entries when searching via key-click
Claus Gittinger <cg@exept.de>
parents: 1252
diff changeset
  2483
                    ].
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2484
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2485
                backSearch ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2486
                    searchIndex := searchIndex - 1.
1323
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2487
                    searchIndex < 1 ifTrue:[searchIndex := mySize]
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2488
                ] ifFalse:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2489
                    searchIndex := searchIndex + 1.
1323
86b03205acc9 care for empty multi-selection in character-search
Claus Gittinger <cg@exept.de>
parents: 1310
diff changeset
  2490
                    searchIndex > mySize ifTrue:[searchIndex := 1].
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2491
                ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2492
                searchIndex == startSearch ifTrue:[
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2493
                    ^ self
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2494
                ]
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2495
            ]
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2496
        ].
125
claus
parents: 124
diff changeset
  2497
    ].
claus
parents: 124
diff changeset
  2498
    ^ 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
  2499
1676
a85936a2064c treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
  2500
    "Modified: / 15.9.1998 / 18:22:31 / cg"
125
claus
parents: 124
diff changeset
  2501
!
claus
parents: 124
diff changeset
  2502
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2503
sizeChanged:how
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2504
    "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
  2505
     after the sizechange"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2506
1725
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2507
    |first wasAtEnd selectionWasWisible|
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2508
1973
a55fbd12d9bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
  2509
    widthOfWidestLine := nil.
a55fbd12d9bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
  2510
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2511
    wasAtEnd := (firstLineShown + nFullLinesShown) >= self size.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2512
1725
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2513
    selectionWasWisible := false.
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2514
    selection notNil ifTrue:[
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2515
        multipleSelectOk ifTrue:[
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2516
            first := selection firstIfEmpty:nil
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2517
        ] ifFalse:[
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2518
            first := selection
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2519
        ].
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2520
        first notNil ifTrue:[
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2521
            selectionWasWisible := (first between:firstLineShown and:(firstLineShown + nFullLinesShown)).
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2522
        ]
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2523
    ].
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2524
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2525
    super sizeChanged:how.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2526
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2527
    shown ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2528
        selection notNil ifTrue:[
1725
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2529
            selectionWasWisible ifTrue:[
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2530
                multipleSelectOk ifTrue:[
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2531
                    first := selection firstIfEmpty:nil
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2532
                ] ifFalse:[
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2533
                    first := selection
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2534
                ].
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2535
                first notNil ifTrue:[self makeLineVisible:first]
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2536
            ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2537
        ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2538
            "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2539
             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
  2540
             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
  2541
            "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2542
            wasAtEnd ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2543
                "at end"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2544
                self scrollToBottom
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2545
            ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2546
        ]
125
claus
parents: 124
diff changeset
  2547
    ]
claus
parents: 124
diff changeset
  2548
1725
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2549
    "Modified: / 1.12.1998 / 23:27:27 / cg"
155
claus
parents: 151
diff changeset
  2550
! !
claus
parents: 151
diff changeset
  2551
1918
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2552
!SelectionInListView methodsFor:'focus handling'!
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2553
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2554
wantsFocusWithPointerEnter
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2555
    "return true, if I want the focus when
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2556
     the mouse pointer enters"
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2557
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2558
    |pref|
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2559
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2560
    pref := UserPreferences current focusFollowsMouse.
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2561
    (pref ~~ false
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2562
    and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true)
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2563
    ]) ifTrue:[
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2564
        ^ true
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2565
    ].
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2566
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2567
    ^ false
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2568
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2569
! !
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2570
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2571
!SelectionInListView methodsFor:'initialization'!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2572
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2573
fetchDeviceResources
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2574
    "fetch device colors, to avoid reallocation at redraw time"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2575
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2576
    super fetchDeviceResources.
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2577
1988
55184833642a #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1973
diff changeset
  2578
    hilightFgColor notNil ifTrue:[hilightFgColor := hilightFgColor onDevice:device].
55184833642a #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1973
diff changeset
  2579
    hilightBgColor notNil ifTrue:[hilightBgColor := hilightBgColor onDevice:device].
55184833642a #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1973
diff changeset
  2580
    halfIntensityFgColor notNil ifTrue:[halfIntensityFgColor := halfIntensityFgColor onDevice:device].
55184833642a #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1973
diff changeset
  2581
    hilightFrameColor notNil ifTrue:[hilightFrameColor := hilightFrameColor onDevice:device].
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2582
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2583
    "Created: 14.1.1997 / 00:11:13 / cg"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2584
!
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2585
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2586
initCursor
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2587
    "set the cursor - a hand"
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2588
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2589
    cursor := Cursor hand
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2590
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2591
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2592
initStyle
968
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
  2593
    "setup viewStyle specifics"
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
  2594
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2595
    super initStyle.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2596
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
  2597
"/    DefaultFont notNil ifTrue:[font := DefaultFont on:device].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2598
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2599
    bgColor := viewBackground.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2600
    hilightFrameColor := nil.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2601
    hilightLevel := 0.
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2602
    hilightStyle := DefaultHilightStyle.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2603
    arrowLevel := 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2604
    smallArrow := false.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2605
709
a738bd76ace4 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 705
diff changeset
  2606
    device hasGrayscales ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2607
        "
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2608
         must get rid of these hard codings
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2609
        "
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2610
        (hilightStyle == #next) ifTrue:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2611
            hilightFgColor := fgColor.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2612
            hilightBgColor := White.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2613
            hilightFrameColor := fgColor
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2614
        ] ifFalse:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2615
            (hilightStyle == #motif) ifTrue:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2616
                fgColor := White.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2617
                bgColor := Grey.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2618
                viewBackground := bgColor.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2619
                hilightFgColor := bgColor  "fgColor" "White".
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2620
                hilightBgColor := fgColor "bgColor lightened" "darkened".
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2621
            ] ifFalse:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2622
                (hilightStyle == #openwin) ifTrue:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2623
                    hilightFgColor := fgColor.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2624
                    hilightBgColor := Color grey.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2625
                    smallArrow := true.
1634
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
  2626
                ] ifFalse:[
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
  2627
                    (hilightStyle == #win95) ifTrue:[
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
  2628
                        smallArrow := true.
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
  2629
                    ]
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2630
                ]
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2631
            ]
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2632
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2633
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2634
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2635
    hilightFgColor isNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2636
        hilightFgColor := bgColor.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2637
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2638
    hilightBgColor isNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2639
        hilightBgColor := fgColor.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2640
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2641
    DefaultForegroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2642
        fgColor := DefaultForegroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2643
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2644
    DefaultBackgroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2645
        bgColor := viewBackground := DefaultBackgroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2646
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2647
    DefaultHilightForegroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2648
        hilightFgColor := DefaultHilightForegroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2649
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2650
    DefaultHilightBackgroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2651
        hilightBgColor := DefaultHilightBackgroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2652
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2653
    DefaultHilightFrameColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2654
        hilightFrameColor := DefaultHilightFrameColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2655
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2656
    DefaultHilightLevel notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2657
        hilightLevel := DefaultHilightLevel
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2658
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2659
    DefaultRightArrowLevel notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2660
        arrowLevel := DefaultRightArrowLevel
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2661
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2662
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2663
    DefaultShadowColor notNil ifTrue:[
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2664
        shadowColor := DefaultShadowColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2665
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2666
    DefaultLightColor notNil ifTrue:[
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2667
        lightColor := DefaultLightColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2668
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2669
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2670
    (hilightLevel abs > 0) ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2671
        lineSpacing := 3
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2672
    ] ifFalse:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2673
        lineSpacing := 2
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2674
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2675
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2676
    hilightFgColor isNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2677
        hilightFgColor := bgColor.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2678
        hilightBgColor := fgColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2679
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2680
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2681
    DefaultDisabledForegroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2682
        halfIntensityFgColor := DefaultDisabledForegroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2683
    ] ifFalse:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
  2684
        halfIntensityFgColor := Color darkGray.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2685
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2686
1634
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
  2687
    "Modified: / 5.8.1998 / 00:00:00 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2688
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2689
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2690
initialize
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2691
    super initialize.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2692
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2693
    fontHeight := font height + lineSpacing.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2694
    enabled := true.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2695
    ignoreReselect := true.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2696
    multipleSelectOk := toggleSelect := strikeOut := printItems := false.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2697
    useIndex := true.
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2698
    dragIsActive := allowDrag := false.
320
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
    keyActionStyle := #select.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2701
    returnKeyActionStyle := #doubleClick.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2702
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2703
    listMsg := self class defaultListMessage.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2704
    initialSelectionMsg := self class defaultSelectionMessage.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2705
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2706
    "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
  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
realize
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2710
    super realize.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2711
1068
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2712
    model notNil ifTrue:[
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2713
        self getSelectionFromModel.
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2714
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2715
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2716
    selection notNil ifTrue:[
1068
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2717
        selection isCollection ifTrue:[
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2718
            selection notEmpty ifTrue:[
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2719
                self makeLineVisible:selection first
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2720
            ]
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2721
        ] ifFalse:[
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2722
            self makeLineVisible:selection
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2723
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2724
    ].
1068
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2725
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  2726
    "Modified: 27.2.1997 / 14:23:40 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2727
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2728
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2729
!SelectionInListView methodsFor:'private'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2730
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2731
argForChangeMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2732
    "return the argument for a selectionChange;
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2733
     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
  2734
     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
  2735
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2736
    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
  2737
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2738
	    selection isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2739
		^ #() 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2740
	    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2741
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2742
	^ selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2743
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2744
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2745
    printItems ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2746
	^ self selectionValue
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2747
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2748
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2749
    items notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2750
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2751
	    ^ selection collect:[:nr | items at:nr]
128
claus
parents: 125
diff changeset
  2752
	].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2753
	^ items at:selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2754
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2755
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2756
    ^ nil       "/ cannot happen
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2757
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2758
    "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
  2759
!
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
checkRemovingSelection:lineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2762
    "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
  2763
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2764
    |newSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2765
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2766
    selection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2767
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2768
	    newSelection := OrderedCollection new.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2769
	    selection do:[:sel |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2770
		sel < lineNr ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2771
		    newSelection add:sel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2772
		] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2773
		    sel > lineNr ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2774
			newSelection add:(sel - 1)
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
		    "otherwise remove it from the selection"
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
	    newSelection size == 0 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2780
		selection := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2781
	    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2782
		selection := newSelection
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
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2785
	    selection == lineNr ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2786
		selection := nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2787
	    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2788
		selection > lineNr ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2789
		    selection := selection - 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2790
		]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2791
	    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2792
	]
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
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2796
getListFromModel
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2797
    "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
  2798
     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
  2799
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2800
    |text msg|
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2801
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2802
    listChannel notNil ifTrue:[
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  2803
        items := listChannel value copy
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2804
    ] ifFalse:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2805
        (model isNil or:[(msg := listMsg) isNil and:[(msg := aspectMsg) isNil]]) ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2806
            ^ self
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2807
        ].
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2808
        items := model perform:msg.
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2809
    ].
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2810
    items notNil ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2811
        printItems ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2812
            text := items collect:[:element | element printString]
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2813
        ] ifFalse:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2814
            text := items
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  2815
        ].
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2816
        text notNil ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2817
            text isSequenceable ifFalse:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2818
                text := text asOrderedCollection
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2819
            ]
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2820
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2821
    ].
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2822
    self list:text keepSelection:true. "/ expandTabs:false
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2823
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2824
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2825
getSelectionFromModel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2826
    "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
  2827
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2828
    |sel|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2829
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2830
    model notNil ifTrue:[
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2831
        listChannel notNil ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2832
            sel := model value.
1813
7f51dc0341a6 oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  2833
            sel isNil ifTrue:[
7f51dc0341a6 oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  2834
                self deselect.
7f51dc0341a6 oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  2835
                ^ self
7f51dc0341a6 oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  2836
            ]
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2837
        ] ifFalse:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2838
            initialSelectionMsg isNil ifTrue:[^ self].
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  2839
            sel := model perform:initialSelectionMsg.
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2840
        ].
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2841
        (useIndex or:[sel isNumber]) ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2842
            self setSelection:sel 
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2843
        ] ifFalse:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  2844
            self setSelectElement:sel.
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  2845
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2846
    ].
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  2847
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  2848
    "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
  2849
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2850
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2851
isValidSelection:aNumberOrCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2852
    "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
  2853
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2854
    |sz|
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2855
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2856
    aNumberOrCollection isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2857
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2858
    sz := self size.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2859
    (aNumberOrCollection isCollection) ifTrue:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2860
        multipleSelectOk ifFalse:[^ false].
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2861
        aNumberOrCollection do:[:index |
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2862
            (index between:1 and:sz) ifFalse:[^ false].
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2863
            (self lineIsEnabled:index) ifFalse:[^ false].
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2864
        ].
125
claus
parents: 124
diff changeset
  2865
    ] ifFalse:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2866
        (aNumberOrCollection between:1 and:sz) ifFalse:[^ false].
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2867
        (self lineIsEnabled:aNumberOrCollection) ifFalse:[^ false].
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  2868
    ].
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2869
    ^ true.
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2870
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2871
    "Modified: / 8.8.1998 / 03:34:27 / cg"
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2872
!
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2873
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2874
lineIsEnabled:lineNr
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2875
    ^ (self line:lineNr hasAttribute:#disabled) not
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2876
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2877
    "Modified: / 8.8.1998 / 03:22:50 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2878
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2879
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2880
positionToSelectionX:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2881
    "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
  2882
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2883
    |visibleLine|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2884
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2885
    (x between:0 and:width) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2886
	(y between:0 and:height) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2887
	    visibleLine := self visibleLineOfY:y.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2888
	    ^ self visibleLineToListLine:visibleLine
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2889
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2890
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2891
    ^ nil
125
claus
parents: 124
diff changeset
  2892
!
claus
parents: 124
diff changeset
  2893
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2894
scrollSelectDown
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2895
    "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
  2896
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2897
    self scrollDown.
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2898
    self invalidate.
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2899
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2900
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2901
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2902
    "Modified: / 3.2.2000 / 22:41:59 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2903
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2904
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2905
scrollSelectUp
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2906
    "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
  2907
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2908
    self scrollUp.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2909
    Processor addTimedBlock:autoScrollBlock afterSeconds:autoScrollDeltaT.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2910
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2911
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2912
selectOrToggleAtX:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2913
    |oldSelection listLineNr|
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2914
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2915
    listLineNr := self visibleLineToListLine:(self visibleLineOfY:y).
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2916
    listLineNr notNil ifTrue:[
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2917
        "/ this item selectable ?
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2918
        (selectConditionBlock notNil 
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2919
         and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ self].
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2920
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2921
        (toggleSelect 
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2922
        and:[self isInSelection:listLineNr]) ifTrue:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2923
            oldSelection := selection copy.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2924
            self removeFromSelection:listLineNr
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2925
        ] ifFalse:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2926
            (self lineIsEnabled:listLineNr) ifFalse:[^ self].
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2927
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2928
            oldSelection := selection copy.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2929
            (toggleSelect and:[multipleSelectOk]) ifTrue:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2930
                self addToSelection:listLineNr
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2931
            ] ifFalse:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2932
                self selectWithoutScroll:listLineNr.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2933
            ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2934
        ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2935
        ((ignoreReselect not and:[selection notNil])
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2936
         or:[selection ~= oldSelection]) ifTrue:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2937
            self selectionChangedFrom:oldSelection.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2938
        ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2939
        clickLine := listLineNr
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2940
    ]
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2941
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2942
    "Created: / 14.11.1996 / 16:27:17 / cg"
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2943
    "Modified: / 8.8.1998 / 03:22:26 / cg"
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2944
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2945
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2946
visibleLineNeedsSpecialCare:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2947
    |listLine|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2948
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2949
    listLine := self visibleLineToListLine:visLineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2950
    listLine isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2951
    (self isInSelection:listLine) ifTrue:[^ true].
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2952
    visualBlock notNil ifTrue:[^true].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2953
    listAttributes notNil ifTrue:[
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2954
        (listLine <= listAttributes size) ifTrue:[
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2955
            ^ (listAttributes at:listLine) notNil
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2956
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2957
    ].
125
claus
parents: 124
diff changeset
  2958
    ^ false
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2959
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  2960
    "Modified: / 21.6.1998 / 02:43:02 / cg"
125
claus
parents: 124
diff changeset
  2961
!
claus
parents: 124
diff changeset
  2962
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2963
widthForScrollBetween:start and:end
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2964
    "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
  2965
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2966
    | anySelectionInRange |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2967
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2968
    selection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2969
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2970
	    anySelectionInRange := false.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2971
	    selection do:[:s |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2972
		(s between:start and:end) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2973
		    anySelectionInRange := true
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2974
		]
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
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2977
	    anySelectionInRange := selection between:start and:end
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
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2980
	anySelectionInRange := false
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2981
    ].
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
    anySelectionInRange ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2984
	^ width
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
	self is3D ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2987
	    ^ width 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2988
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2989
	( #(next openwin) includes:styleSheet name) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2990
	    ^ width 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2991
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2992
	viewBackground = background ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2993
	    ^ width 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2994
	]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2995
"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2996
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2997
    ^ super widthForScrollBetween:start and:end
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2998
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2999
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3000
!SelectionInListView methodsFor:'queries'!
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
specClass
1379
04a05ed3f02e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  3003
    "redefined, since the name of my specClass is nonStandard (i.e. not SelectionInListSpec)"
04a05ed3f02e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  3004
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3005
    self class == SelectionInListView ifTrue:[^ SequenceViewSpec].
1045
a70450ed4d7d specClass query
ca
parents: 1010
diff changeset
  3006
    ^ super specClass
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3007
1379
04a05ed3f02e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  3008
    "Modified: / 5.9.1995 / 23:05:53 / claus"
04a05ed3f02e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  3009
    "Modified: / 31.10.1997 / 19:48:44 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3010
! !
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
!SelectionInListView methodsFor:'redrawing'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3013
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3014
redrawElement:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3015
    "redraw an individual element"
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
    ^ self redrawLine:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3018
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3019
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3020
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3021
    "redraw a range of lines.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3022
     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
  3023
     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
  3024
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3025
    |special sel
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3026
     l1 "{ Class: SmallInteger }"
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3027
     l2 "{ Class: SmallInteger }"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3028
     selNo "{ Class: SmallInteger }" |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3029
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3030
    ((selection isCollection) 
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3031
    or:[listAttributes notNil
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3032
    or:[visualBlock notNil
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3033
    or:[selectedVisualBlock notNil]]]) ifTrue:[
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3034
        "/ cannot do bulk-redraw ...
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3035
        l1 := startVisLineNr.
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3036
        l2 := endVisLineNr. 
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3037
        l1 to:l2 do:[:visLine |
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3038
            self redrawVisibleLine:visLine
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3039
        ].
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3040
        ^ self
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3041
    ].
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
"XXX only if -1/+1"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3044
"/    hilightLevel ~~ 0 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3045
"/     self paint:bgColor.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3046
"/     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
  3047
"/  ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3048
    special := true.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3049
    selection isNil ifTrue:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3050
        special := false
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3051
    ] ifFalse:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3052
        sel := self listLineToVisibleLine:selection.
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3053
        sel isNil ifTrue:[
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3054
            special := false
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3055
        ] ifFalse:[
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3056
            special := (sel between:startVisLineNr and:endVisLineNr)
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3057
        ]
320
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
    special ifFalse:[
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3060
      ^ super redrawFromVisibleLine:startVisLineNr to:endVisLineNr
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3061
    ].
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
    selNo := sel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3064
    selNo > startVisLineNr ifTrue:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3065
        super redrawFromVisibleLine:startVisLineNr to:(selNo - 1)
320
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
    self redrawVisibleLine:selNo.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3068
    selNo < endVisLineNr ifTrue:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3069
        super redrawFromVisibleLine:(selNo + 1) to:endVisLineNr
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3070
    ]
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3071
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3072
    "Modified: / 21.6.1998 / 02:42:17 / cg"
125
claus
parents: 124
diff changeset
  3073
!
claus
parents: 124
diff changeset
  3074
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3075
redrawVisibleLine:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3076
    "redraw a single line.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3077
     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
  3078
     Otherwise draw using supers method."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3079
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3080
    |listLine fg bg newFont oldFont id dObj y|
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3081
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3082
    fg := fgColor.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3083
    bg := bgColor.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3084
    listLine := self visibleLineToListLine:visLineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3085
    listLine notNil ifTrue:[
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3086
        (self isInSelection:listLine) ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3087
            ^ self drawVisibleLineSelected:visLineNr
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3088
        ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3089
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3090
        visualBlock notNil ifTrue:[
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3091
            dObj := visualBlock value:self value:listLine.
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3092
            y := (self yOfVisibleLine:visLineNr) + font ascent.
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3093
            self paint:fg on:bg.
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3094
            dObj displayOn:self x:0 y:y opaque:true.
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3095
            ^ self
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3096
        ].
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3097
        listAttributes notNil ifTrue:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3098
            ((self line:listLine hasAttribute:#halfIntensity) 
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3099
            or:[ (self lineIsEnabled:listLine) not ]) ifTrue:[
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3100
                fg := halfIntensityFgColor
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3101
            ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3102
            (self line:listLine hasAttribute:#bold) ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3103
                newFont := font asBold.
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3104
                (font bold 
1988
55184833642a #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1973
diff changeset
  3105
                or:[id := (newFont onDevice:device) fontId.
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3106
                    id isNil]) 
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3107
                ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3108
                    "
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3109
                     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
  3110
                     or no such font is available   
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3111
                    "
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3112
                    fgColor brightness > 0.5 ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3113
                        fg := fgColor darkened "darkened". 
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3114
                    ] ifFalse:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3115
                        fg := fgColor lightened "lightened"
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3116
                    ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3117
                    (fg brightness - bg brightness) abs < 0.25 ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3118
                        bgColor brightness > 0.5 ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3119
                            fg := fg darkened. 
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3120
                        ] ifFalse:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3121
                            fg := fg lightened
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3122
                        ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3123
                    ]
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3124
                ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3125
                id notNil ifTrue:[
437
b7d544102a9e oops - did not restore font (when boldifying)
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  3126
                    oldFont := font.
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3127
                    self basicFont:newFont.
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3128
                    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
  3129
                    self basicFont:oldFont.
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3130
                ] ifFalse:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3131
                    self drawVisibleLine:visLineNr with:fg and:bg.
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3132
                ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3133
                ^ self
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3134
            ]
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3135
        ]
320
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
    ^ self drawVisibleLine:visLineNr with:fg and:bg
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3138
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3139
    "Modified: / 8.8.1998 / 03:42:13 / cg"
125
claus
parents: 124
diff changeset
  3140
!
claus
parents: 124
diff changeset
  3141
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3142
redrawVisibleLine:visLineNr col:colNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3143
    "redraw a single character.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3144
     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
  3145
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3146
    (self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3147
	^ self redrawVisibleLine:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3148
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3149
    super redrawVisibleLine:visLineNr col:colNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3150
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3151
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3152
redrawVisibleLine:visLineNr from:startCol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3153
    "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
  3154
     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
  3155
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3156
    (self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3157
	^ self redrawVisibleLine:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3158
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3159
    super redrawVisibleLine:visLineNr from:startCol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3160
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3161
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3162
redrawVisibleLine:visLineNr from:startCol to:endCol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3163
    "redraw from a startCol to endCol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3164
     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
  3165
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3166
    (self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3167
	^ self redrawVisibleLine:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3168
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3169
    super redrawVisibleLine:visLineNr from:startCol to:endCol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3170
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3171
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3172
!SelectionInListView methodsFor:'selections'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3173
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3174
deselect
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3175
    "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
  3176
     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
  3177
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3178
    self selection:nil
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3179
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3180
    "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
  3181
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3182
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3183
deselectWithoutRedraw
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3184
    "deselect without redraw or notifications.
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3185
     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
  3186
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3187
    selection := nil
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3188
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3189
    "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
  3190
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3191
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3192
expandSelectionToX:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3193
    "used with button-motion and shift-press;
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3194
     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
  3195
     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
  3196
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3197
    |movedLine delta oldSel|
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3198
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3199
    clickLine isNil ifTrue:[^ self].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3200
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3201
    movedLine := self visibleLineToAbsoluteLine:(self visibleLineOfY:y).
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3202
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3203
    multipleSelectOk ifTrue:[
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3204
        movedLine == clickLine ifFalse:[
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3205
            delta  := (clickLine < movedLine) ifTrue:[1] ifFalse:[-1].
2125
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3206
            "/ oldSel := selection copy.
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3207
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3208
            (clickLine+delta) to:movedLine by:delta do:[:ln |
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  3209
                (self isInSelection:ln) ifTrue:[
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  3210
                    self removeFromSelection:ln
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  3211
                ] ifFalse:[
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  3212
                    self addToSelection:ln
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  3213
                ]
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3214
            ].
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3215
            self selectionChangedFrom:oldSel
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3216
        ]
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3217
    ].
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3218
    clickLine := movedLine.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3219
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  3220
    "Created: / 14.11.1996 / 15:48:10 / cg"
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  3221
    "Modified: / 3.2.2000 / 22:13:50 / cg"
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3222
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3223
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3224
hasSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3225
    "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
  3226
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3227
    ^ selection notNil 
125
claus
parents: 124
diff changeset
  3228
!
claus
parents: 124
diff changeset
  3229
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3230
isInSelection:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3231
    "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
  3232
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3233
    selection isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3234
    multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3235
	^ (selection includes:aNumber)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3236
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3237
    ^ (aNumber == selection)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3238
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3239
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3240
makeSelectionVisible
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3241
    "scroll to make the selection line visible"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3242
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3243
    |line|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3244
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3245
    selection notNil ifTrue:[
2148
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3246
        multipleSelectOk ifTrue:[
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3247
            selection isEmpty ifTrue:[^ self].
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3248
            "/ dont move, if any in the selection isVisible
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3249
            selection do:[:aSelectedLine |
2165
6c4bfa91517f ensure fullyVisible in #makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2161
diff changeset
  3250
                (self lineIsFullyVisible:aSelectedLine) ifTrue:[
2148
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3251
                    ^ self
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3252
                ]
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3253
            ].
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3254
            line := selection first.
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3255
        ] ifFalse:[
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3256
            line := selection
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3257
        ].
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3258
        self makeLineVisible:line 
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3259
    ]
2148
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3260
2165
6c4bfa91517f ensure fullyVisible in #makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2161
diff changeset
  3261
    "Modified: / 24.2.2000 / 17:48:00 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3262
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3263
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3264
nextAfterSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3265
    "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
  3266
     Wrap at end."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3267
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3268
    |next sz|
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3269
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3270
    selection isNil ifTrue:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3271
        next := firstLineShown
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3272
    ] ifFalse:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3273
        selection isCollection ifTrue:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3274
            selection size == 0 ifTrue:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3275
                next := firstLineShown
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3276
            ] ifFalse:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3277
                next := selection max + 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3278
            ]
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3279
        ] ifFalse:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3280
            next := selection + 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3281
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3282
    ].
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3283
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3284
    (self isValidSelection:next) ifFalse:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3285
        sz := self size.
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3286
        next > sz ifTrue:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3287
            next := 1.
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3288
        ] ifFalse:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3289
            [next <= sz
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3290
             and:[(self isValidSelection:next) not ]] whileTrue:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3291
                next := next + 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3292
            ].
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3293
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3294
    ].
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3295
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3296
    (self isValidSelection:next) ifFalse:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3297
        next := nil
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3298
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3299
    ^ next
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3300
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3301
    "Modified: / 8.8.1998 / 03:36:55 / cg"
125
claus
parents: 124
diff changeset
  3302
!
claus
parents: 124
diff changeset
  3303
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3304
numberOfSelections
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3305
    "return the number of selected entries"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3306
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3307
    |sz|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3308
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3309
    selection isNil ifTrue:[^ 0].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3310
    sz := selection size.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3311
    sz > 0 ifTrue:[^ sz].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3312
    ^ 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3313
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3314
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3315
previousBeforeSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3316
    "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
  3317
     Wrap at beginning."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3318
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3319
    |prev|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3321
    selection isNil ifTrue:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3322
        prev := firstLineShown - 1 
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3323
    ] ifFalse:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3324
        selection isCollection ifTrue:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3325
            selection size == 0 ifTrue:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3326
                prev := firstLineShown - 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3327
            ] ifFalse:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3328
                prev := selection min - 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3329
            ]
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3330
        ] ifFalse:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3331
            prev := selection - 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3332
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3333
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3334
    (self isValidSelection:prev) ifFalse:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3335
        prev < 1 ifTrue:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3336
            prev := self size.
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3337
        ] ifFalse:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3338
            [prev >= 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3339
             and:[(self isValidSelection:prev) not]] whileTrue:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3340
                prev := prev - 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3341
            ].
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3342
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3343
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3344
    (self isValidSelection:prev) ifFalse:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3345
        prev := nil
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3346
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3347
    ^ prev
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3348
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3349
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3350
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3351
selectAll
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3352
    "select all entries. 
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3353
     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
  3354
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3355
    |oldSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3356
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3357
    multipleSelectOk ifTrue:[
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3358
        oldSelection := selection.
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3359
        selection := OrderedCollection withAll:(1 to:self size).
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  3360
        self invalidate.
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3361
        self selectionChangedFrom:oldSelection.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3362
    ]
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3363
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3364
    "Modified: 15.11.1996 / 17:00:26 / cg"
125
claus
parents: 124
diff changeset
  3365
!
claus
parents: 124
diff changeset
  3366
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3367
selectElement:anObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3368
    "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
  3369
     Scroll to make the new selection visible.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3370
     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
  3371
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3372
    |lineNo|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3373
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3374
    list notNil ifTrue:[
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3375
        items notNil ifTrue:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3376
            lineNo := items indexOf:anObject ifAbsent:nil
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3377
        ] ifFalse:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3378
            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
  3379
        ].
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3380
        lineNo notNil ifTrue:[self selection:lineNo]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3381
    ]
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3382
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3383
    "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
  3384
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3385
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3386
selectElementWithoutScroll:anObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3387
    "select the element with same printString as the argument, anObject.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3388
     Do not scroll.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3389
     *** 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
  3390
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3391
    |lineNo|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3392
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3393
    list notNil ifTrue:[
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3394
        items notNil ifTrue:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3395
            lineNo := items indexOf:anObject ifAbsent:nil
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3396
        ] ifFalse:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3397
            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
  3398
        ].
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3399
        lineNo notNil ifTrue:[self selectWithoutScroll:lineNo]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3400
    ]
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3401
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3402
    "Modified: 15.11.1996 / 17:01:17 / cg"
125
claus
parents: 124
diff changeset
  3403
!
claus
parents: 124
diff changeset
  3404
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3405
selectNext
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3406
    "select next line or first visible if there is currrently no selection.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3407
     Wrap at end. 
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3408
     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
  3409
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3410
    self selection:(self nextAfterSelection)
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3411
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3412
    "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
  3413
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3414
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3415
selectPrevious
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3416
    "select previous line or previous visible if there is currently no selection.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3417
     Wrap at beginning. 
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3418
     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
  3419
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3420
    self selection:(self previousBeforeSelection).
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3421
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3422
    "Modified: 26.9.1995 / 09:41:16 / stefan"
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3423
    "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
  3424
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3425
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3426
selectWithoutScroll:aNumberOrNilOrCollection
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3427
    "select line, aNumber or deselect if argument is nil.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3428
     *** 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
  3429
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3430
    |prevSelection newSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3431
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3432
    newSelection := aNumberOrNilOrCollection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3433
    newSelection notNil ifTrue:[
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3434
        (self isValidSelection:newSelection) ifFalse:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3435
            newSelection := nil
1484
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3436
        ].
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3437
        newSelection == 0 ifTrue:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3438
            newSelection := nil
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3439
        ] ifFalse:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3440
            (newSelection isCollection
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3441
            and:[newSelection size == 0]) ifTrue:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3442
                newSelection := nil
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3443
            ]
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3444
        ].
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3445
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3446
        newSelection notNil ifTrue:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3447
            multipleSelectOk ifTrue:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3448
                newSelection isCollection ifFalse:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3449
                    newSelection := OrderedCollection with:newSelection
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3450
                ]
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3451
            ]
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3452
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3453
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3454
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3455
    (newSelection = selection) ifTrue: [^ self].
125
claus
parents: 124
diff changeset
  3456
claus
parents: 124
diff changeset
  3457
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3458
     redraw old selection unhighlighted
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3459
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3460
    selection notNil ifTrue: [
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3461
        prevSelection := selection.
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3462
        selection := nil.
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3463
        multipleSelectOk ifTrue:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3464
            prevSelection do:[:line |
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3465
                self redrawElement:line
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3466
            ]
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3467
        ] ifFalse:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3468
            self redrawElement:prevSelection
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3469
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3470
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3471
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3472
    selection := newSelection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3473
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3474
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3475
     redraw new selection unhighlighted
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3476
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3477
    newSelection notNil ifTrue:[
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3478
        multipleSelectOk ifTrue:[
1484
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3479
"/            newSelection isCollection ifFalse:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3480
"/                selection := OrderedCollection with:newSelection.
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  3481
"/            ].
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3482
            selection do:[:line |
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3483
                self redrawElement:line
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3484
            ]
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3485
        ] ifFalse:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3486
            self redrawElement:selection
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3487
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3488
    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3489
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3490
    "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
  3491
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3492
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3493
selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3494
    "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
  3495
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3496
    ^ selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3497
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3498
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3499
selection:aNumberOrNil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3500
    "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
  3501
     scroll to make the selected line visible.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3502
     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
  3503
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3504
    |oldSelection|
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3505
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3506
    oldSelection := selection.
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3507
    self setSelection:aNumberOrNil.
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3508
    selection ~= oldSelection ifTrue:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3509
        self selectionChangedFrom:oldSelection
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3510
    ]
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3511
1638
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  3512
    "Modified: / 7.8.1998 / 13:36:34 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3513
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3514
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3515
selectionAsCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3516
    "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
  3517
     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
  3518
     the multipleSelect style."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3519
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3520
    selection isNil ifTrue:[^ #()].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3521
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3522
"/    multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3523
"/        ^ (OrderedCollection new) add:selection; yourself.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3524
"/    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3525
    multipleSelectOk ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3526
	^ (OrderedCollection new) add:selection; yourself.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3527
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3528
    ^ selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3529
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3530
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3531
selectionChangedFrom:oldSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3532
    "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
  3533
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  3534
    |changeArg actionArg nA|
970
188efaece4a0 ST-80 model notifications require 0 for reselect;
ca
parents: 968
diff changeset
  3535
188efaece4a0 ST-80 model notifications require 0 for reselect;
ca
parents: 968
diff changeset
  3536
    changeArg := actionArg := self argForChangeMessage.
965
ff8e6542eb13 when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  3537
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  3538
    "/
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  3539
    "/ the MVC way of doing things - notify model via changeMsg
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  3540
    "/
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3541
    multipleSelectOk ifFalse:[
965
ff8e6542eb13 when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  3542
        "/ 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
  3543
        selection == oldSelection ifTrue:[
970
188efaece4a0 ST-80 model notifications require 0 for reselect;
ca
parents: 968
diff changeset
  3544
            changeArg := 0
965
ff8e6542eb13 when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  3545
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3546
    ].
2125
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3547
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3548
    "/ must take care, if model is == to the selection-collection
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3549
    "/ in this case, we must force a change on the model
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3550
    "/ (valueHolder would not send a change in the == case)
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3551
    "/ Q: should this be done in #sendChangeMessage ?
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3552
    model isValueModel ifTrue:[
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3553
        model value == changeArg ifTrue:[
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3554
            model setValue:nil.
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3555
        ]
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  3556
    ].
970
188efaece4a0 ST-80 model notifications require 0 for reselect;
ca
parents: 968
diff changeset
  3557
    self sendChangeMessageWith:changeArg.
965
ff8e6542eb13 when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  3558
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  3559
    "/
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  3560
    "/ the ST/X way of doing things - perform the actionBlock
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  3561
    "/
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  3562
    actionBlock notNil ifTrue:[
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  3563
        (actionBlock numArgs) == 1 ifTrue:[
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  3564
            actionBlock value:actionArg
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  3565
        ] ifFalse:[
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  3566
            actionBlock value
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  3567
        ]
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  3568
    ].
965
ff8e6542eb13 when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  3569
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  3570
    "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
  3571
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3572
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3573
selectionDo:aBlock
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3574
    "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
  3575
     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
  3576
     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
  3577
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3578
    selection notNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3579
	multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3580
	    selection do:aBlock
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3581
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3582
	    aBlock value:selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3583
	].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3584
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3585
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3586
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3587
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3588
selectionValue
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3589
    "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
  3590
     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
  3591
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3592
    multipleSelectOk ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3593
	selection isNil ifTrue:[^ #()].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3594
	^ selection collect:[:nr | self at:nr]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3595
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3596
    selection isNil ifTrue:[^ nil].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3597
    ^ self at:selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3598
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3599
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3600
selectionValueAsCollection
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3601
    "return the selection values as a collection - allows selectionValues to
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3602
     be enumerated independent of the multiSelect settings"
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3603
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3604
    selection isNil ifTrue:[^ #()].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3605
    multipleSelectOk ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3606
        ^ selection collect:[:nr | self at:nr]
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3607
    ].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3608
    ^ Array with:(self at:selection)
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3609
!
a399056aec3b center arrows
ca
parents: 987
diff changeset
  3610
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3611
setSelectElement:anObject 
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  3612
    "select the element with same printString as the argument, anObject.
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  3613
     Scroll to make the new selection visible.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3614
     *** No model and/or actionBlock notification is done here."
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  3615
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3616
    |size lineNo coll s|
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3617
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3618
    list isNil ifTrue:[
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3619
        ^ self
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3620
    ].
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3621
    multipleSelectOk ifTrue:[
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3622
        (size := anObject size) == 0 ifTrue:[
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3623
            ^ self setSelection:nil
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  3624
        ].
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3625
        coll := OrderedCollection new:size.
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3626
        anObject do:[:o | 
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3627
            items notNil ifTrue:[
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3628
                lineNo := items findFirst:[:el | o = el]
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3629
            ] ifFalse:[
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3630
                lineNo := list findFirst:[:el | o string = el string]
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3631
            ].
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3632
            lineNo ~~ 0 ifTrue:[
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3633
                coll add:lineNo
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3634
            ]
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3635
        ].
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3636
        ^ self setSelection:coll
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3637
    ].
2124
b4123a418b82 oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  3638
    anObject isNil ifTrue:[
b4123a418b82 oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  3639
        ^ self setSelection:nil
b4123a418b82 oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  3640
    ].
b4123a418b82 oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  3641
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3642
    items notNil ifTrue:[
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3643
        lineNo := items findFirst:[:el | anObject = el]
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3644
    ] ifFalse:[
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3645
        s := anObject string.
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3646
        lineNo := list findFirst:[:el | s = el string]
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  3647
    ].
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3648
    lineNo ~~ 0 ifTrue:[
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3649
        self setSelection:lineNo
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  3650
    ]
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  3651
!
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  3652
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3653
setSelection:aNumberOrNil
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3654
    "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
  3655
     scroll to make the selected line visible.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3656
     *** 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
  3657
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3658
    self selectWithoutScroll:aNumberOrNil.
2169
73fc6ae6e33c do not (always) scroll when the selection changes
Claus Gittinger <cg@exept.de>
parents: 2165
diff changeset
  3659
    ((multipleSelectOk and:[selection size > 0])
73fc6ae6e33c do not (always) scroll when the selection changes
Claus Gittinger <cg@exept.de>
parents: 2165
diff changeset
  3660
    or:[multipleSelectOk not and:[selection notNil]]) ifTrue:[
1638
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  3661
        self makeSelectionVisible
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  3662
    ]
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  3663
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  3664
    "Created: / 25.5.1996 / 12:23:18 / cg"
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  3665
    "Modified: / 7.8.1998 / 13:36:42 / cg"
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3666
!
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3667
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3668
toggleSelection:aNumber
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3669
    "toggle selection-state of entry, aNumber.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3670
     *** 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
  3671
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3672
    (self isInSelection:aNumber) ifTrue:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3673
        self removeFromSelection:aNumber
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3674
    ] ifFalse:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3675
        self addToSelection:aNumber
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3676
    ]
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3677
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3678
    "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
  3679
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3680
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3681
valueIsInSelection:someString
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3682
    "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
  3683
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3684
    |sel|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3685
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3686
    selection isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3687
    sel := self selectionValue.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3688
    self numberOfSelections > 1 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3689
	^ (sel includes:someString)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3690
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3691
    ^ (someString = sel)
125
claus
parents: 124
diff changeset
  3692
! !
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3693
869
4b09e6fe33b6 allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
  3694
!SelectionInListView class methodsFor:'documentation'!
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3695
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3696
version
2169
73fc6ae6e33c do not (always) scroll when the selection changes
Claus Gittinger <cg@exept.de>
parents: 2165
diff changeset
  3697
    ^ '$Header: /cvs/stx/stx/libwidg/SelectionInListView.st,v 1.170 2000-03-21 10:48:00 cg Exp $'
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3698
! !