SelectionInListView.st
author Claus Gittinger <cg@exept.de>
Fri, 06 Mar 2020 21:56:26 +0100
changeset 6843 6c5e543e903e
parent 6821 cc88f681757a
permissions -rw-r--r--
#OTHER by cg class: SimpleView added: #isWarningBox
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6753
a29d982ad405 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6716
diff changeset
     1
"{ Encoding: utf8 }"
a29d982ad405 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6716
diff changeset
     2
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     3
"
5
claus
parents: 3
diff changeset
     4
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
     5
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    13
"
2187
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
    14
"{ Package: 'stx:libwidg' }"
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
    15
5237
0207715b9750 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5208
diff changeset
    16
"{ NameSpace: Smalltalk }"
0207715b9750 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5208
diff changeset
    17
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
ListView subclass:#SelectionInListView
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    19
	instanceVariableNames:'selection actionBlock enabled hilightFgColor hilightBgColor
3423
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
    20
		hilightFgColorNoFocus hilightBgColorNoFocus halfIntensityFgColor
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
    21
		doubleClickActionBlock listAttributes multipleSelectOk clickLine
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
    22
		selectMode selectionAtClickTime initialSelectionMsg printItems
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
    23
		oneItem useIndex hilightLevel hilightFrameColor ignoreReselect
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
    24
		arrowLevel smallArrow keyActionStyle returnKeyActionStyle
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
    25
		toggleSelect strikeOut iSearchString items doubleClickMsg
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
    26
		hilightStyle clickPosition allowDrag dragObjectConverter
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
    27
		dragIsActive endDragAction dropSource visualBlock
3466
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
    28
		selectedVisualBlock selectConditionBlock isButtonPressActive'
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    29
	classVariableNames:'RightArrowShadowForm RightArrowLightForm RightArrowForm
128
claus
parents: 125
diff changeset
    30
		SmallRightArrowShadowForm SmallRightArrowLightForm
claus
parents: 125
diff changeset
    31
		DefaultForegroundColor DefaultBackgroundColor
claus
parents: 125
diff changeset
    32
		DefaultHilightForegroundColor DefaultHilightBackgroundColor
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 384
diff changeset
    33
		DefaultHilightFrameColor DefaultHilightLevel
128
claus
parents: 125
diff changeset
    34
		DefaultRightArrowStyle DefaultRightArrowLevel
claus
parents: 125
diff changeset
    35
		DefaultDisabledForegroundColor DefaultShadowColor
5100
9353eebbe50f class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4971
diff changeset
    36
		DefaultLightColor DefaultHilightStyle
9353eebbe50f class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4971
diff changeset
    37
		DefaultHilightForegroundColorNoFocus
9353eebbe50f class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4971
diff changeset
    38
		DefaultHilightBackgroundColorNoFocus'
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
    39
	poolDictionaries:''
1771
c1bccfce48cd category change
Claus Gittinger <cg@exept.de>
parents: 1745
diff changeset
    40
	category:'Views-Lists'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    41
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    42
869
4b09e6fe33b6 allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
    43
!SelectionInListView class methodsFor:'documentation'!
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    44
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    45
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    46
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    47
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    48
	      All Rights Reserved
38
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
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    51
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    52
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    53
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    54
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    55
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    56
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    57
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    58
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    59
documentation
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    60
"
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
    61
    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
    62
    If multipleSelectionsOk is true, it is also allowed to shift-click multiple 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    63
    entries.
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    64
    If toggleSelect is true, clicking toggles (i.e. click on a seleted item
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
    65
    will deselect).
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
    66
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    67
    Whenever the selection changes, an action-block is evaluated, passing the 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    68
    current selection as argument.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    69
    Currently, the selection can be nil, aNumber or a collection of numbers; 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    70
    this will change to be either nil or a collection, making selection handling 
70
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    71
    easier in the future. (this stupid behavior is due to the multiple
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    72
    select feature being added later - the first implementation used to support
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    73
    only single selections).
14443a9ea4ec *** empty log message ***
claus
parents: 65
diff changeset
    74
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    75
    The actionBlock is called with the current selection (single number or
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    76
    collection of numbers) as argument.
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    77
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    78
    Also, to support ST-80 MVC-style use, the model (if nonNil) is notified
155
claus
parents: 151
diff changeset
    79
    by the change mechanism (performs changeMsg) and vice versa, the view
claus
parents: 151
diff changeset
    80
    updates if the model changes (with aspect of either #list or #selectionIndex).
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    81
5807
fdfb746e2499 #OTHER by mawalch
mawalch
parents: 5779
diff changeset
    82
    Before actually adding entries to the selection, a checkBlock (if non-nil) is evaluated 
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    83
    passing the number of the entry whch is about to be selected as argument.
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    84
    The select change operation is only done if this returns true. This allows
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    85
    interception of select, for example to query the user if he/she wants to save
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    86
    the old contents before (see uses in SystemBrowser and FileBrowser), or to
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
    87
    disable individual entries.
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
    88
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    89
    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
    90
    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
    91
    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
    92
    Also, alphabetic keys will select the next entry starting with that key.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    93
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    94
    The keyboard behavior can be further controlled with the keyActionStyle
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    95
    instance variable (see SelectionInListView>>keyActionStyle:).
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
    96
59
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    97
    Finally, ignoreReselect controls if pressing on an already selected item
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    98
    triggers the action or not. For some applications it is useful to allow
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
    99
    reselects (for example, the SystemBrowsers method-list updates the
450ce95a72a4 *** empty log message ***
claus
parents: 51
diff changeset
   100
    source code in this case).
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
   101
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   102
    Currently, some limited form of line attributes are supported. These
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   103
    are kept in the instance variable lineAttributes.
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   104
    This may change (using mechanisms similar to MultiColListEntry), so
5956
649159a0d63a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5864
diff changeset
   105
    be prepared. (don't use the listAttributes instvar directly; if possible,
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   106
    use MultiColListEntry or subclasses of it.
120
claus
parents: 119
diff changeset
   107
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
   108
    Although currently based on the listAttributes instVar, the implementation of
120
claus
parents: 119
diff changeset
   109
    text attributes will be changed in the near future (when Text/DisplayText are
claus
parents: 119
diff changeset
   110
    available). 
claus
parents: 119
diff changeset
   111
    However, the protocol will probably be kept for backward compatibility
claus
parents: 119
diff changeset
   112
    (i.e. use #attributeAt: / #attributeAt:put etc. - at least, these are easy to find
claus
parents: 119
diff changeset
   113
    when migrating to the new attributed text handling).
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   114
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   115
    [Instance variables:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   116
        selection               <misc>          the current selection. nil, a number or collection of numbers
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   117
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   118
        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
   119
                                                (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
   120
                                                 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
   121
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
   122
        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
   123
                                                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
   124
                                                if false, the seelction-value is passed.
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   125
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   126
        enabled                 <Boolean>       true: selection changes allowed; false: ignore clicks
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   127
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   128
        hilightFgColor
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   129
        hilightBgColor          <Color>         how highlighted items are drawn
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   130
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   131
        halfIntensityColor      <Color>         foreground for disabled items
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   132
2139
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   133
        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
   134
                                or              its invoked with the itemNr of the
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   135
                                <ValueHolder>   'to-be-selected' item.
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
   136
                                                If the block returns true, the item is selected
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
   137
                                                (or added to the selection); if false is returned,
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
   138
                                                no action is taken.
2139
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   139
        selectionChangeCondition
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
   140
                                <Block>         much like above, but invoked without argument,
2139
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
   141
                                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
   142
                                <ValueHolder>   are deselected).
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
   143
                                                Can return false to suppress change.
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   144
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   145
        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
   146
                                                (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
   147
                                                 as arg - depending upon the useIndex setting)
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   148
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   149
        listAttributes                          dont use - will vanish
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   150
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   151
        hilightLevel            <Integer>       level to draw selections (i.e. for 3D effect)
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   152
        hilightFrameColor       <Color>         rectangle around highlighted items
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   153
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   154
        multipleSelectOk        <Boolean>       if true, multiple selections (with shift) are ok.
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
        ignoreReselect          <Boolean>       if true, selecting same again does not trigger action;
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   158
                                                if false, every select triggers it.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   159
                                                default: true
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   160
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   161
        toggleSelect            <Boolean>       if true, click toggles;
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   162
                                                if false, click selects.
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   163
                                                default: false
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   164
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   165
        arrowLevel              <Integer>       level to draw right-arrows (for submenus etc.)
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   166
        smallArrow              <Boolean>       if true, uses a small arrow bitmap
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   167
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   168
        listMsg                                 if non-nil, use ST-80 style (model-access)
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   169
        initialSelectionMsg 
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   170
        printItems 
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   171
        oneItem
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   172
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   173
        keyActionStyle          <Symbol>        controls how to respond to keyboard selects
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   174
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   175
        returnKeyActionStyle    <Symbol>        controls how to respond to return key
125
claus
parents: 124
diff changeset
   176
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   177
    written spring/summer 89 by claus
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   178
    3D Jan 90 by claus
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
   179
    multiselect Jun 92 by claus
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 31
diff changeset
   180
    keyboard-select jun 94 by claus
586
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   181
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   182
    [author:]
032b3245e53a documentation
Claus Gittinger <cg@exept.de>
parents: 554
diff changeset
   183
        Claus Gittinger
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   184
"
119
claus
parents: 116
diff changeset
   185
!
claus
parents: 116
diff changeset
   186
claus
parents: 116
diff changeset
   187
examples
claus
parents: 116
diff changeset
   188
"
claus
parents: 116
diff changeset
   189
    SelectionInListView can be used both in the ST/X way, using action blocks
claus
parents: 116
diff changeset
   190
    or in the traditional mvc way.
claus
parents: 116
diff changeset
   191
    with actions:
claus
parents: 116
diff changeset
   192
125
claus
parents: 124
diff changeset
   193
      basic interface:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   194
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   195
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   196
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   197
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   198
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   199
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   200
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   201
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   202
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   203
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   204
        slv list:#('one' 'two' 'three').
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   205
        slv action:[:index | Transcript showCR:'selected ' , index printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   206
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   207
        top add:slv in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   208
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   209
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   210
claus
parents: 124
diff changeset
   211
claus
parents: 124
diff changeset
   212
      get element instead of index:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   213
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   214
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   215
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   216
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   217
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   218
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   219
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   220
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   221
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   222
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   223
        slv list:#('one' 'two' 'three').
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   224
        slv action:[:element | Transcript showCR:'selected ' , element printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   225
        slv useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   226
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   227
        top add:slv in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   228
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   229
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   230
claus
parents: 124
diff changeset
   231
claus
parents: 124
diff changeset
   232
      concrete example; show filenames:
claus
parents: 124
diff changeset
   233
      (notice: normally, you would use a FileSelectionList)
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   234
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   235
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   236
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   237
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   238
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   239
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   240
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   241
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   242
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   243
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   244
        slv list:(Filename currentDirectory directoryContents).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   245
        slv action:[:index | 
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   246
            Transcript showCR:'selected ' , index printString.
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   247
            Transcript showCR:' the value is: ', slv selectionValue].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   248
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   249
        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
   250
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   251
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   252
119
claus
parents: 116
diff changeset
   253
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   254
      add a scrollbar:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   255
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   256
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   257
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   258
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   259
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   260
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   261
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   262
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   263
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   264
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   265
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   266
        slv action:[:index | Transcript showCR:'selected ' , index printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   267
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   268
        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
   269
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   270
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   271
119
claus
parents: 116
diff changeset
   272
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   273
      allow reselect
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   274
      (clicking on already selected entry 
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   275
       triggers action/changeNotification again):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   276
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   277
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   278
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   279
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   280
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   281
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   282
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   283
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   284
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   285
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   286
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   287
        slv action:[:index | Transcript showCR:'selected ' , index printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   288
        slv ignoreReselect:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   289
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   290
        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
   291
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   292
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   293
119
claus
parents: 116
diff changeset
   294
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   295
      allow multiple selections (shift-select):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   296
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   297
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   298
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   299
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   300
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   301
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   302
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   303
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   304
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   305
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   306
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   307
        slv action:[:indexList | Transcript showCR:'selected ' , indexList printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   308
        slv multipleSelectOk:true.
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 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
   311
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   312
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   313
claus
parents: 124
diff changeset
   314
      same, not using index:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   315
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   316
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   317
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   318
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   319
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   320
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   321
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   322
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   323
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   324
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   325
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   326
        slv action:[:indexList | Transcript showCR:'selected ' , indexList printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   327
        slv multipleSelectOk:true; useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   328
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   329
        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
   330
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   331
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   332
119
claus
parents: 116
diff changeset
   333
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   334
      strikeout mode (single):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   335
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   336
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   337
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   338
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   339
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   340
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   341
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   342
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   343
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   344
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   345
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   346
        slv action:[:index | Transcript showCR:'selected ' , index printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   347
        slv strikeOut:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   348
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   349
        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
   350
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   351
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   352
119
claus
parents: 116
diff changeset
   353
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   354
      strikeout mode (multiple):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   355
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   356
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   357
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   358
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   359
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   360
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   361
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   362
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   363
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   364
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   365
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   366
        slv action:[:index | Transcript showCR:'selected ' , index printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   367
        slv strikeOut:true; multipleSelectOk:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   368
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   369
        top 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
   370
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   371
                                                                        [exEnd]
119
claus
parents: 116
diff changeset
   372
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   373
      toggleSelect mode (clicking on selected entry deselects it):
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   374
                                                                        [exBegin]
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   375
        |top slv|
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   376
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   377
        top := StandardSystemView new
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   378
                label:'select';
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   379
                minExtent:100@100;
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   380
                maxExtent:300@400;
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   381
                extent:200@200.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   382
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   383
        slv := SelectionInListView new.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   384
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   385
        slv action:[:index | Transcript showCR:'selected ' , index printString].
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   386
        slv toggleSelect:true.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   387
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   388
        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
   389
        top open
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   390
                                                                        [exEnd]
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   391
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   392
      define what to do on double-click:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   393
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   394
        |top slv|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   395
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   396
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   397
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   398
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   399
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   400
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   402
        slv := SelectionInListView new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   403
        slv list:(Filename currentDirectory directoryContents).
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   404
        slv action:[:index | Transcript showCR:'selected ' , index printString].
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   405
        slv doubleClickAction:[:index | Transcript showCR:'doubleclick on ' , index printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   406
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   407
        top add:(ScrollableView forView:slv) in:(0.0@0.0 corner:1.0@1.0).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   408
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   409
                                                                        [exEnd]
124
7abd3a234296 last version before changing to collection in multipleSelect mode
claus
parents: 120
diff changeset
   410
1163
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   411
      enable / disable:
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   412
                                                                        [exBegin]
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   413
        |top slv|
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   414
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   415
        top := StandardSystemView new
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   416
                label:'select';
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   417
                minExtent:100@100;
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   418
                maxExtent:300@400;
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   419
                extent:200@200.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   420
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   421
        slv := SelectionInListView new.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   422
        slv list:(Filename currentDirectory directoryContents).
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   423
        slv action:[:index | Transcript showCR:'selected ' , index printString].
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   424
        slv disable.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   425
        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
   426
        top open.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   427
        Delay waitForSeconds:5. 
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   428
        slv enable.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   429
                                                                        [exEnd]
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   430
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   431
      enable / disable via a channel:
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   432
                                                                        [exBegin]
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   433
        |top slv enableChannel t|
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   434
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   435
        enableChannel := true asValue.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   436
        t := Toggle label:'enable'.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   437
        t model:enableChannel.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   438
        t open.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   439
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   440
        top := StandardSystemView new
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   441
                label:'select';
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   442
                minExtent:100@100;
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   443
                maxExtent:300@400;
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   444
                extent:200@200.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   445
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   446
        slv := SelectionInListView new.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   447
        slv list:(Filename currentDirectory directoryContents).
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   448
        slv action:[:index | Transcript showCR:'selected ' , index printString].
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   449
        slv enableChannel:enableChannel.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   450
        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
   451
        top open.
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   452
                                                                        [exEnd]
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   453
119
claus
parents: 116
diff changeset
   454
    using a Model:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   455
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   456
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   457
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   458
        model := Plug new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   459
        model respondTo:#getList with:[#('foo' 'bar' 'baz' 'hello')].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   460
        model respondTo:#initial with:[1].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   461
        model respondTo:#setSelection: with:[:arg | Transcript showCR:'model selected:', arg printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   462
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   463
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   464
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   465
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   466
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   467
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   468
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   469
        slv := SelectionInListView 
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   470
                   on:model
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   471
                   aspect:#someAspect
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   472
                   change:#setSelection:
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   473
                   list:#getList
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   474
                   initialSelection:#initial.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   475
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   476
        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
   477
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   478
                                                                        [exEnd]
119
claus
parents: 116
diff changeset
   479
claus
parents: 116
diff changeset
   480
      notice, that the ST-80 behavaior on reselect is to send a selection change
claus
parents: 116
diff changeset
   481
      with an index of 0.
claus
parents: 116
diff changeset
   482
125
claus
parents: 124
diff changeset
   483
    same, with useIndex false:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   484
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   485
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   486
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   487
        model := Plug new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   488
        model respondTo:#getList with:[#('foo' 'bar' 'baz' 'hello')].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   489
        model respondTo:#initial with:['bar'].
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   490
        model respondTo:#setSelection: with:[:arg | Transcript showCR:'model selected:', arg printString].
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   491
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   492
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   493
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   494
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   495
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   496
                extent:200@200.
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
        slv := SelectionInListView 
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   499
                   on:model
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   500
                   aspect:#someAspect
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   501
                   change:#setSelection:
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   502
                   list:#getList
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   503
                   initialSelection:#initial.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   504
        slv useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   505
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   506
        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
   507
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   508
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   509
claus
parents: 124
diff changeset
   510
155
claus
parents: 151
diff changeset
   511
    self changing list: 
claus
parents: 151
diff changeset
   512
    (selectionInListView updates itself when button changes initial selection):
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   513
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   514
        |top slv model sel changeButton|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   515
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   516
        sel := 'bar'.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   517
        model := Plug new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   518
        model respondTo:#getList with:['getList' printNL. #('foo' 'bar' 'baz' 'hello')].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   519
        model respondTo:#initial with:['initial' printNL. sel].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   520
        model respondTo:#setSelection: with:[:arg | ('model selected:', arg) printNL. sel := arg].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   521
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   522
        changeButton := Button label:'change selection'.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   523
        changeButton action:[sel := 'foo'. model changed:#initial].
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   524
        changeButton open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   525
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   526
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   527
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   528
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   529
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   530
                extent:200@200.
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
        slv := SelectionInListView 
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   533
                   on:model
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   534
                   aspect:#someAspect
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   535
                   change:#setSelection:
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   536
                   list:#getList
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   537
                   initialSelection:#initial.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   538
        slv useIndex:false.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   539
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   540
        top 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
   541
        top open
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   542
                                                                        [exEnd]
155
claus
parents: 151
diff changeset
   543
claus
parents: 151
diff changeset
   544
119
claus
parents: 116
diff changeset
   545
    using a SelectionInList-Model:
claus
parents: 116
diff changeset
   546
    (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
   547
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   548
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   549
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   550
        model := SelectionInList with:#('foo' 'bar' 'baz' 'hello').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   551
        model selection:'bar'.
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 := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   554
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   555
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   556
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   557
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   558
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   559
        slv := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   560
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   561
        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
   562
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   563
449
725c26daf5d8 examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   564
        InspectorView openOn:model monitor:'selectionIndexHolder'
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   565
                                                                        [exEnd]
125
claus
parents: 124
diff changeset
   566
claus
parents: 124
diff changeset
   567
claus
parents: 124
diff changeset
   568
    two selectionInListViews on the same selectionInList model:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   569
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   570
        |top1 slv1 top2 slv2 model|
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
        model := SelectionInList with:#('foo' 'bar' 'baz' 'hello').
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 := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   575
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   576
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   577
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   578
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   579
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   580
        slv1 := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   581
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   582
        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
   583
        top1 open.
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 := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   586
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   587
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   588
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   589
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   590
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   591
        slv2 := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   592
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   593
        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
   594
        top2 open.
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   595
                                                                        [exEnd]
166
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   596
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   597
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   598
    a MultiSelectionInList model:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   599
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   600
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   601
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   602
        model := MultiSelectionInList with:#('foo' 'bar' 'baz' 'hello').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   603
        model selection:#('foo' 'bar').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   604
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   605
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   606
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   607
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   608
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   609
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   610
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   611
        slv := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   612
        slv multipleSelectOk:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   613
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   614
        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
   615
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   616
449
725c26daf5d8 examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   617
        InspectorView openOn:model monitor:'selectionIndexHolder'
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   618
                                                                        [exEnd]
166
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   619
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   620
    with strikeOut:
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   621
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   622
        |top slv model|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   623
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   624
        model := MultiSelectionInList with:#('foo' 'bar' 'baz' 'hello').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   625
        model selection:#('foo' 'bar').
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   626
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   627
        top := StandardSystemView new
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   628
                label:'select';
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   629
                minExtent:100@100;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   630
                maxExtent:300@400;
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   631
                extent:200@200.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   632
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   633
        slv := SelectionInListView on:model.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   634
        slv multipleSelectOk:true; toggleSelect:true; strikeOut:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   635
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   636
        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
   637
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   638
449
725c26daf5d8 examples (use new monitoringInspector)
Claus Gittinger <cg@exept.de>
parents: 441
diff changeset
   639
        InspectorView openOn:model monitor:'selectionIndexHolder'
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   640
                                                                        [exEnd]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   641
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   642
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   643
    two listViews on the same list, but separate selections
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   644
                                                                        [exBegin]
401
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   645
        |top top2 lv1 lv2 selInL1 selInL2 listHolder l1 l2|
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   646
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   647
        top := StandardSystemView new extent:300@300.
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
        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
   650
        lv1 level:-1.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   651
        lv1 toggleSelect:true.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   652
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   653
        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
   654
        lv2 level:-1.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   655
        lv2 toggleSelect:true.
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
        selInL1 := SelectionInList new.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   658
        selInL2 := SelectionInList new.
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
        listHolder := #('foo' 'bar' 'baz') asValue.
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
        selInL1 listHolder:listHolder.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   663
        selInL2 listHolder:listHolder.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   664
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   665
        lv1 model:selInL1.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   666
        lv2 model:selInL2.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   667
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   668
        top open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   669
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   670
        top2 := StandardSystemView new extent:100 @ 30.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   671
        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
   672
        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
   673
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   674
        l1 model:(BlockValue with:[:arg | arg value printString] argument:selInL1 selectionIndexHolder).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   675
        l2 model:(BlockValue with:[:arg | arg value printString] argument:selInL2 selectionIndexHolder).
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   676
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   677
        l1 labelMessage:#value.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   678
        l2 labelMessage:#value.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   679
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   680
        top2 open.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   681
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   682
        Delay waitForSeconds:2.
d20b106029a0 another examples
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   683
        listHolder value:#('1' '2' '3' '4').
594
b9c5a5e5f905 examples
Claus Gittinger <cg@exept.de>
parents: 587
diff changeset
   684
                                                                        [exEnd]
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   685
    non-string entries (text)
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   686
                                                                        [exBegin]
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   687
        |top l slv|
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   688
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   689
        top := StandardSystemView new
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   690
                label:'select';
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   691
                minExtent:100@100;
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   692
                maxExtent:300@400;
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   693
                extent:200@200.
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
        slv := SelectionInListView new.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   696
        l := OrderedCollection new.
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   697
        l add:(Text string:'red' emphasis:(#color->Color red)).
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   698
        l add:(Text string:'green' emphasis:(#color->Color green)).
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   699
        l add:(Text string:'blue' emphasis:(#color->Color blue)).
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   700
        slv list:l.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 628
diff changeset
   701
        slv action:[:index | Transcript showCR:'selected ' , index printString].
628
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   702
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   703
        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
   704
        top open
c790cf65fdcb Text example
Claus Gittinger <cg@exept.de>
parents: 622
diff changeset
   705
                                                                        [exEnd]
838
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   706
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   707
      non string entries
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   708
                                                                        [exBegin]
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   709
        |top slv wrapper l fileImage dirImage m|
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   710
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   711
        dirImage := Image fromFile:'DirObj.xbm'.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   712
        fileImage := Image fromFile:'FileObj.xbm'.
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
        l := OrderedCollection new.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   716
        Filename currentDirectory directoryContents do:[:s |
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   717
            s asFilename isDirectory ifTrue:[
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   718
                l add:(LabelAndIcon icon:dirImage string:s)
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   719
            ] ifFalse:[
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   720
                l add:(LabelAndIcon icon:fileImage string:s)
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   721
            ]
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   722
        ].
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   723
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   724
        m := SelectionInList new.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   725
        m list:l.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   726
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   727
        slv := SelectionInListView new.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   728
        slv model:m.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   729
        wrapper := HVScrollableView forView:slv miniScrollerH:true.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   730
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   731
        top := StandardSystemView extent:150@200.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   732
        top add:wrapper in:(0.0@0.0 corner:1.0@1.0).
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   733
        top open.
d79133b1b409 example
Claus Gittinger <cg@exept.de>
parents: 816
diff changeset
   734
                                                                        [exEnd]
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   735
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   736
                                                                        [exBegin]
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   737
        |top slv|
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   738
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   739
        top := StandardSystemView new
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   740
                label:'select';
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   741
                minExtent:100@100;
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   742
                maxExtent:300@400;
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   743
                extent:200@200.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   744
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   745
        slv := SelectionInListView new.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   746
        slv list:#('one' 'two' 'three').
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   747
        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
   748
        slv multipleSelectOk:true.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   749
        slv allowDrag:true.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   750
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   751
        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
   752
        top open
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
   753
                                                                        [exEnd]
119
claus
parents: 116
diff changeset
   754
"
166
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   755
Claus Gittinger <cg@exept.de>
parents: 164
diff changeset
   756
    "Modified: 26.10.1995 / 16:42:02 / cg"
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
   757
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   758
869
4b09e6fe33b6 allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   759
!SelectionInListView class methodsFor:'instance creation'!
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   760
125
claus
parents: 124
diff changeset
   761
on:aModel aspect:aspect change:change list:list initialSelection:initial
claus
parents: 124
diff changeset
   762
    ^ self on:aModel
claus
parents: 124
diff changeset
   763
	    printItems:true 
claus
parents: 124
diff changeset
   764
	    oneItem:false 
claus
parents: 124
diff changeset
   765
	    aspect:aspect
claus
parents: 124
diff changeset
   766
	    change:change 
claus
parents: 124
diff changeset
   767
	    list:list 
claus
parents: 124
diff changeset
   768
	    menu:nil 
claus
parents: 124
diff changeset
   769
	    initialSelection:initial 
claus
parents: 124
diff changeset
   770
	    useIndex:true 
claus
parents: 124
diff changeset
   771
!
claus
parents: 124
diff changeset
   772
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   773
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
   774
    ^ self on:aModel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   775
	    printItems:true 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   776
	    oneItem:false 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   777
	    aspect:aspect
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   778
	    change:change 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   779
	    list:list 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   780
	    menu:menu
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   781
	    initialSelection:initial 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   782
	    useIndex:true 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   783
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   784
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   785
on:aModel printItems:print oneItem:one aspect:aspect
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   786
	      change:change list:list menu:menu initialSelection:initial
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   787
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   788
    "for ST-80 compatibility"
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   789
119
claus
parents: 116
diff changeset
   790
    ^ self on:aModel 
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   791
	    printItems:print 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   792
	    oneItem:one 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   793
	    aspect:aspect
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   794
	    change:change 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   795
	    list:list 
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   796
	    menu:menu
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   797
	    initialSelection:initial
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   798
	    useIndex:false 
119
claus
parents: 116
diff changeset
   799
!
claus
parents: 116
diff changeset
   800
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   801
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
   802
		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
   803
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   804
    "for ST-80 compatibility"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   805
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   806
    ^ (self new) on:aModel 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   807
		 printItems:print 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   808
		 oneItem:one 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   809
		 aspect:aspect
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   810
		 change:change 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   811
		 list:list 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   812
		 menu:menu
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   813
		 initialSelection:initial
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   814
		 useIndex:useIndex
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   815
! !
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
   816
869
4b09e6fe33b6 allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   817
!SelectionInListView class methodsFor:'defaults'!
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   818
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   819
defaultAspectMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   820
    ^ nil
125
claus
parents: 124
diff changeset
   821
!
claus
parents: 124
diff changeset
   822
4050
b9916b17ff56 added: #defaultBackgroundColor
Claus Gittinger <cg@exept.de>
parents: 4014
diff changeset
   823
defaultBackgroundColor
b9916b17ff56 added: #defaultBackgroundColor
Claus Gittinger <cg@exept.de>
parents: 4014
diff changeset
   824
    ^ DefaultBackgroundColor
b9916b17ff56 added: #defaultBackgroundColor
Claus Gittinger <cg@exept.de>
parents: 4014
diff changeset
   825
!
b9916b17ff56 added: #defaultBackgroundColor
Claus Gittinger <cg@exept.de>
parents: 4014
diff changeset
   826
125
claus
parents: 124
diff changeset
   827
defaultChangeMessage
claus
parents: 124
diff changeset
   828
    ^ #selectionIndex: 
claus
parents: 124
diff changeset
   829
!
claus
parents: 124
diff changeset
   830
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   831
defaultListMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   832
    ^ #list 
125
claus
parents: 124
diff changeset
   833
!
claus
parents: 124
diff changeset
   834
claus
parents: 124
diff changeset
   835
defaultSelectionMessage
claus
parents: 124
diff changeset
   836
    ^ #selectionIndex 
claus
parents: 124
diff changeset
   837
!
claus
parents: 124
diff changeset
   838
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   839
rightArrowFormOn:aDevice
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   840
    "return the form used for the right arrow (non 3D)"
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   841
1636
6f75bcabf092 oops - resource spec was incompatible with stc.
Claus Gittinger <cg@exept.de>
parents: 1634
diff changeset
   842
    <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
   843
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   844
    |f fn bits|
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   845
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   846
    ((aDevice == Display) and:[RightArrowForm notNil]) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   847
        ^ RightArrowForm
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   848
    ].
1204
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   849
2785
ac6eb18aa58e stylesheet access
Claus Gittinger <cg@exept.de>
parents: 2770
diff changeset
   850
    f := self styleSheet at:#'selection.rightArrowForm'.
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   851
    f isNil ifTrue:[
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   852
        fn := StyleSheet at:#'selection.rightArrowFormFile' default:'RightArrow.xbm'.
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2070
diff changeset
   853
        f := Smalltalk imageFromFileNamed:fn forClass:self.
2062
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   854
        f notNil ifTrue:[
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   855
            f := f onDevice:aDevice.
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   856
        ] ifFalse:[
1204
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   857
            DefaultRightArrowStyle == #solid ifTrue:[
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   858
                bits := #[2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   859
                          2r00000000 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
                          2r00000010 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   862
                          2r00000011 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   863
                          2r00000011 2r10000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   864
                          2r00000011 2r11000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   865
                          2r00000011 2r11100000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   866
                          2r00000011 2r11110000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   867
                          2r00000011 2r11100000
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   868
                          2r00000011 2r11000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   869
                          2r00000011 2r10000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   870
                          2r00000011 2r00000000
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   871
                          2r00000010 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   872
                          2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   873
                          2r00000000 2r00000000]
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   874
            ] ifFalse:[
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   875
                bits := #[2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   876
                          2r00000000 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
                          2r00000110 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   879
                          2r00000101 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   880
                          2r00000100 2r10000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   881
                          2r00000100 2r01000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   882
                          2r00000100 2r00100000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   883
                          2r00000100 2r00010000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   884
                          2r00000100 2r00100000
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   885
                          2r00000100 2r01000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   886
                          2r00000100 2r10000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   887
                          2r00000101 2r00000000
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   888
                          2r00000110 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   889
                          2r00000000 2r00000000 
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   890
                          2r00000000 2r00000000]
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   891
            ].
3487
3af04d90ebe9 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 3466
diff changeset
   892
            f := Form width:16 height:16 fromArray:bits onDevice:aDevice
1204
8cbd65c6ddac allow right-arrow form to be defined in style-sheet.
Claus Gittinger <cg@exept.de>
parents: 1202
diff changeset
   893
        ]
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   894
    ].
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   895
    (aDevice == Display) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   896
        RightArrowForm := f
22
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   897
    ].
ac872628ef2d *** empty log message ***
claus
parents: 15
diff changeset
   898
    ^ f
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   899
1634
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
   900
    "Modified: / 5.8.1998 / 00:04:40 / cg"
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   901
!
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   902
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   903
rightArrowLightFormOn:aDevice
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   904
    "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
   905
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   906
    |f|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   907
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   908
    ((aDevice == Display) and:[RightArrowLightForm notNil]) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   909
        ^ RightArrowLightForm
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   910
    ].
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2070
diff changeset
   911
    f := Smalltalk imageFromFileNamed:'RightArrowLight.xbm' forClass:self.
2062
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   912
    f notNil ifTrue:[
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   913
        f := f onDevice:aDevice.
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   914
    ] ifFalse:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   915
        f := Form width:16 height:16 fromArray:#[2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   916
                                                 2r00000000 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
                                                 2r00000110 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   919
                                                 2r00000101 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   920
                                                 2r00000100 2r10000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   921
                                                 2r00000100 2r01000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   922
                                                 2r00000100 2r00100000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   923
                                                 2r00000100 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   924
                                                 2r00000100 2r00000000
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   925
                                                 2r00000100 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   926
                                                 2r00000100 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   927
                                                 2r00000100 2r00000000
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   928
                                                 2r00000100 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   929
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   930
                                                 2r00000000 2r00000000]
3487
3af04d90ebe9 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 3466
diff changeset
   931
                                              onDevice:aDevice
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   932
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   933
    (aDevice == Display) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   934
        RightArrowLightForm := f
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   935
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   936
    ^ f
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   937
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   938
    "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
   939
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   940
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   941
rightArrowShadowFormOn:aDevice
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   942
    "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
   943
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   944
    |f|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   945
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   946
    ((aDevice == Display) and:[RightArrowShadowForm notNil]) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   947
        ^ RightArrowShadowForm
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   948
    ].
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2070
diff changeset
   949
    f := Smalltalk imageFromFileNamed:'RightArrowShadow.xbm' forClass:self.
2062
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   950
    f notNil ifTrue:[
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   951
        f := f onDevice:aDevice.
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   952
    ] ifFalse:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   953
        f := Form width:16 height:16 fromArray:#[2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   954
                                                 2r00000000 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
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   958
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   959
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   960
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   961
                                                 2r00000000 2r00010000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   962
                                                 2r00000000 2r00100000
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   963
                                                 2r00000000 2r01000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   964
                                                 2r00000000 2r10000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   965
                                                 2r00000001 2r00000000
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   966
                                                 2r00000010 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   967
                                                 2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   968
                                                 2r00000000 2r00000000]
3487
3af04d90ebe9 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 3466
diff changeset
   969
                                              onDevice:aDevice
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   970
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   971
    (aDevice == Display) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   972
        RightArrowShadowForm := f
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   973
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   974
    ^ f
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   975
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   976
    "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
   977
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
   978
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   979
smallRightArrowLightFormOn:aDevice
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   980
    "return the form used for the small right arrow light pixels (3D only)"
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   981
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   982
    |f|
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   983
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   984
    ((aDevice == Display) and:[SmallRightArrowLightForm notNil]) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   985
        ^ SmallRightArrowLightForm
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
   986
    ].
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2070
diff changeset
   987
    f := Smalltalk imageFromFileNamed:'SmallRightArrowLight.xbm' forClass:self.
2062
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   988
    f notNil ifTrue:[
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   989
        f := f onDevice:aDevice.
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
   990
    ] ifFalse:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   991
        f := Form width:9 height:9 fromArray:#[2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   992
                                               2r01100000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   993
                                               2r01011000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   994
                                               2r01000110 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   995
                                               2r01000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   996
                                               2r01000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   997
                                               2r01000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   998
                                               2r01000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
   999
                                               2r00000000 2r00000000]
3487
3af04d90ebe9 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 3466
diff changeset
  1000
                                              onDevice:aDevice
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1001
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1002
    (aDevice == Display) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1003
        SmallRightArrowLightForm := f
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1004
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1005
    ^ f
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1006
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1007
    "Modified: 19.12.1996 / 14:10:59 / cg"
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1008
!
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1009
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1010
smallRightArrowShadowFormOn:aDevice
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1011
    "return the form used for the small right arrow light pixels (3D only)"
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1012
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1013
    |f|
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1014
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1015
    ((aDevice == Display) and:[SmallRightArrowShadowForm notNil]) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1016
        ^ SmallRightArrowShadowForm
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1017
    ].
2075
005c01e3f259 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2070
diff changeset
  1018
    f := Smalltalk imageFromFileNamed:'SmallRightArrowShadow.xbm' forClass:self.
2062
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
  1019
    f notNil ifTrue:[
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
  1020
        f := f onDevice:aDevice.
1af54949ac53 try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 2037
diff changeset
  1021
    ] ifFalse:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1022
        f := Form width:9 height:9 fromArray:#[2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1023
                                               2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1024
                                               2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1025
                                               2r00000000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1026
                                               2r00000001 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1027
                                               2r00000110 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1028
                                               2r00011000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1029
                                               2r00100000 2r00000000 
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1030
                                               2r00000000 2r00000000]
3487
3af04d90ebe9 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 3466
diff changeset
  1031
                                              onDevice:aDevice
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1032
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1033
    (aDevice == Display) ifTrue:[
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1034
        SmallRightArrowShadowForm := f
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1035
    ].
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1036
    ^ f
898
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1037
5a61224fecbc use Image instead of Form
Claus Gittinger <cg@exept.de>
parents: 886
diff changeset
  1038
    "Modified: 19.12.1996 / 14:11:10 / cg"
125
claus
parents: 124
diff changeset
  1039
!
claus
parents: 124
diff changeset
  1040
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1041
updateStyleCache
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1042
    "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
  1043
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1044
    <resource: #style (#'selection.disabledForegroundColor'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1045
                       #'selection.hilightForegroundColor' #'selection.hilightBackgroundColor'
5100
9353eebbe50f class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4971
diff changeset
  1046
                       #'selection.hilightForegroundColorNoFocus' #'selection.hilightBackgroundColorNoFocus'
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1047
                       #'selection.hilightFrameColor' #'selection.hilightLevel'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1048
                       #'selection.rightArrowStyle' #'selection.rightArrowLevel'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1049
                       #'selection.foregroundColor' #'selection.backgroundColor'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1050
                       #'selection.shadowColor' #'selection.lightColor'
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1051
                       #'selection.font' #'selection.hilightStyle')>
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1052
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1053
    DefaultDisabledForegroundColor := StyleSheet colorAt:#'selection.disabledForegroundColor'.
6785
0c9377055234 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
  1054
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1055
    DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1056
    DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor'.
5100
9353eebbe50f class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4971
diff changeset
  1057
    DefaultHilightForegroundColorNoFocus := StyleSheet colorAt:#'selection.hilightForegroundColorNoFocus'.
9353eebbe50f class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4971
diff changeset
  1058
    DefaultHilightBackgroundColorNoFocus := StyleSheet colorAt:#'selection.hilightBackgroundColorNoFocus'.
6785
0c9377055234 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
  1059
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1060
    DefaultHilightFrameColor := StyleSheet colorAt:#'selection.hilightFrameColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1061
    DefaultHilightLevel := StyleSheet at:#'selection.hilightLevel' default:0.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1062
    DefaultHilightStyle := StyleSheet at:#'selection.hilightStyle' default:(StyleSheet name).
6785
0c9377055234 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
  1063
1870
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1064
    DefaultRightArrowStyle := StyleSheet at:#'selection.rightArrowStyle'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1065
    DefaultRightArrowLevel := StyleSheet at:#'selection.rightArrowLevel'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1066
    DefaultForegroundColor := StyleSheet colorAt:#'selection.foregroundColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1067
    DefaultBackgroundColor := StyleSheet colorAt:#'selection.backgroundColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1068
    DefaultShadowColor := StyleSheet colorAt:#'selection.shadowColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1069
    DefaultLightColor := StyleSheet colorAt:#'selection.lightColor'.
9bce9ea89db3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
  1070
    DefaultFont := StyleSheet fontAt:#'selection.font'.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1071
    RightArrowForm := nil.
125
claus
parents: 124
diff changeset
  1072
claus
parents: 124
diff changeset
  1073
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1074
     self updateStyleCache
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1075
    "
441
e170bca66a78 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 437
diff changeset
  1076
1354
c260c896ea66 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1345
diff changeset
  1077
    "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
  1078
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1079
2744
cb920467a4b4 method category rename
Claus Gittinger <cg@exept.de>
parents: 2741
diff changeset
  1080
!SelectionInListView methodsFor:'Compatibility-ST80'!
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1081
2597
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  1082
isSingleSelect:aBool
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  1083
    self multipleSelectOk:aBool not
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  1084
!
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  1085
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1086
sequence
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1087
    "same as #list - for ST80 compatibility"
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1088
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1089
    ^ self list
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1090
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1091
    "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
  1092
!
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1093
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1094
setValidTargetIndex:index
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1095
    "ignored for now - for ST80 compatibility"
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1096
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1097
    ^ self
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1098
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  1099
    "Created: / 4.2.2000 / 00:07:14 / cg"
2401
296ed4051b86 VW compatibility: #targetIndex:
Claus Gittinger <cg@exept.de>
parents: 2369
diff changeset
  1100
!
296ed4051b86 VW compatibility: #targetIndex:
Claus Gittinger <cg@exept.de>
parents: 2369
diff changeset
  1101
296ed4051b86 VW compatibility: #targetIndex:
Claus Gittinger <cg@exept.de>
parents: 2369
diff changeset
  1102
targetIndex:index
296ed4051b86 VW compatibility: #targetIndex:
Claus Gittinger <cg@exept.de>
parents: 2369
diff changeset
  1103
    self selection:index
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1104
! !
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1105
2227
58426f7611f2 category changes
Claus Gittinger <cg@exept.de>
parents: 2211
diff changeset
  1106
!SelectionInListView methodsFor:'accessing-actions'!
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1107
2334
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1108
action
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1109
    "return the action block to be performed on select.
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1110
     With useIndex==true, the block gets the selectionIndex as arg,
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1111
     otherwise, it gets the selectionValue."
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1112
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1113
    ^ actionBlock
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1114
!
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1115
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1116
action:aBlock
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  1117
    "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
  1118
     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
  1119
     otherwise, it gets the selectionValue."
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1120
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1121
    actionBlock := aBlock
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
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1124
doubleClickAction:aOneArgBlock
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1125
    "set the double click action block.
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1126
     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
  1127
     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
  1128
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1129
    doubleClickActionBlock := aOneArgBlock
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1130
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  1131
    "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
  1132
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1133
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1134
keyActionStyle:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1135
    "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
  1136
     Possible values are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1137
	#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
  1138
				 character and perform the click-action
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1139
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1140
	#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
  1141
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1142
	#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
  1143
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1144
	nil                   -> will ignore key
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1145
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1146
     the default (set in #initialize) is #select
125
claus
parents: 124
diff changeset
  1147
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1148
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1149
    keyActionStyle := aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1150
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1151
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1152
returnKeyActionStyle:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1153
    "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
  1154
     Possible values are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1155
	#doubleClick          -> perform double-click action
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1156
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1157
	#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
  1158
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1159
	nil                   -> will ignore key
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1160
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1161
     the default (set in #initialize) is #doubleClick 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1162
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1163
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1164
    returnKeyActionStyle := aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1165
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1166
4296
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1167
selectConditionBlock
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1168
    "get the select-conditionBlock; this block is evaluated before 
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1169
     any selection change is performed (passing the to-be-changed item index as arg).
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1170
     The change will not be done, if the block returns false. 
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1171
     For example, this allows confirmation queries in the SystemBrowser"
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1172
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1173
    ^ selectConditionBlock
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1174
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1175
    "Created: / 29-07-2011 / 13:16:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1176
!
ded54b6d30a1 added: #selectConditionBlock
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4153
diff changeset
  1177
2139
a7444d2da356 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2138
diff changeset
  1178
selectConditionBlock:aBlock
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  1179
    "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
  1180
     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
  1181
     The change will not be done, if the block returns false. 
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1182
     For example, this allows confirmation queries in the SystemBrowser"
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1183
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  1184
    selectConditionBlock := aBlock
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1185
!
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1186
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1187
useIndex
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1188
    "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
  1189
     are passed the index(indices) of the selection as argument. 
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1190
     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
  1191
     Default is true."
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1192
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1193
    ^ useIndex
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1194
!
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1195
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1196
useIndex:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1197
    "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
  1198
     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
  1199
     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
  1200
     Default is true."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1201
1235
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1202
    useIndex ~~ aBoolean ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1203
        useIndex := aBoolean.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1204
        useIndex ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1205
            changeMsg == #selection: ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1206
                changeMsg := #selectionIndex:.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1207
                aspectMsg := #selectionIndex.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1208
            ]
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1209
        ] ifFalse:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1210
            changeMsg == #selectionIndex: ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1211
                changeMsg := #selection:.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1212
                aspectMsg := #selection.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1213
            ]
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1214
        ].
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1215
    ].
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1216
320
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
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1219
!SelectionInListView methodsFor:'accessing-attributes'!
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
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1222
    "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
  1223
     currently supported are:
4622
2437d61dd817 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4601
diff changeset
  1224
         #halfIntensity
2437d61dd817 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4601
diff changeset
  1225
         #disabled
2437d61dd817 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4601
diff changeset
  1226
         #bold
320
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
4622
2437d61dd817 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4601
diff changeset
  1229
    listAttributes notNil ifTrue:[
2437d61dd817 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4601
diff changeset
  1230
        (index > listAttributes size) ifFalse:[
2437d61dd817 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4601
diff changeset
  1231
            ^ listAttributes at:index
2437d61dd817 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4601
diff changeset
  1232
        ]
125
claus
parents: 124
diff changeset
  1233
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1234
    ^ nil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1235
!
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
attributeAt:index add:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1238
    "add to a lines attribute(s); 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1239
     currently supported are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1240
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1241
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1242
	 #bold 
125
claus
parents: 124
diff changeset
  1243
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1244
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1245
    |current|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1246
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1247
    current := self attributeAt:index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1248
    current isNil ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1249
	current := Set new.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1250
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1251
	current isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1252
	    current == aSymbolOrCollectionOfSymbols ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1253
	    current := Set with: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
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1256
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1257
    aSymbolOrCollectionOfSymbols isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1258
	current := current add:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1259
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1260
	(current includes:aSymbolOrCollectionOfSymbols) ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1261
	current addAll:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1262
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1263
    self attributeAt:index put:current
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
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1266
attributeAt:index put:aSymbolOrCollectionOfSymbolsOrNil
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1267
    "set a lines attribute(s); 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1268
     currently supported are:
3259
a75ffd181625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
  1269
         #halfIntensity
a75ffd181625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
  1270
         #disabled
a75ffd181625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
  1271
         #bold 
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1272
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1273
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1274
    (index > self size) ifFalse:[
3259
a75ffd181625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
  1275
        listAttributes isNil ifTrue:[
5108
b3bdbd920121 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1276
            listAttributes := OrderedCollection newWithSize:index
3259
a75ffd181625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
  1277
        ] ifFalse:[
5354
457cb908b288 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5317
diff changeset
  1278
            listAttributes ensureSizeAtLeast:index.
3259
a75ffd181625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
  1279
        ].
a75ffd181625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
  1280
        aSymbolOrCollectionOfSymbolsOrNil = (listAttributes at:index) ifFalse:[
a75ffd181625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
  1281
            listAttributes at:index put:aSymbolOrCollectionOfSymbolsOrNil.
a75ffd181625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
  1282
            self redrawLine:index
a75ffd181625 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3246
diff changeset
  1283
        ]
125
claus
parents: 124
diff changeset
  1284
    ]
claus
parents: 124
diff changeset
  1285
!
claus
parents: 124
diff changeset
  1286
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1287
attributeAt:index remove:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1288
    "remove a line attribute; 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1289
     currently supported are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1290
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1291
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1292
	 #bold 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1293
    "
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1294
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1295
    |current|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1296
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1297
    current := self attributeAt:index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1298
    current isNil ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1299
    current isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1300
	aSymbolOrCollectionOfSymbols isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1301
	    current == aSymbolOrCollectionOfSymbols ifTrue:[current := nil]
125
claus
parents: 124
diff changeset
  1302
	] ifFalse:[
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1303
	    (aSymbolOrCollectionOfSymbols includes:current) ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1304
		current := nil
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
    ] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1308
	aSymbolOrCollectionOfSymbols isSymbol ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1309
	    current := current remove:aSymbolOrCollectionOfSymbols ifAbsent:[]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1310
	] ifFalse:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1311
	    aSymbolOrCollectionOfSymbols removeAll:aSymbolOrCollectionOfSymbols
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1312
	]
125
claus
parents: 124
diff changeset
  1313
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1314
    self attributeAt:index put:current
125
claus
parents: 124
diff changeset
  1315
!
claus
parents: 124
diff changeset
  1316
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1317
line:lineNr hasAttribute:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1318
    "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
  1319
     currently supported attributes are:
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1320
	 #halfIntensity
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1321
	 #disabled
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1322
	 #bold 
125
claus
parents: 124
diff changeset
  1323
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1324
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1325
    |attr|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1326
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1327
    listAttributes isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1328
    (lineNr > listAttributes size) ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1329
    attr := listAttributes at:lineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1330
    attr isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1331
    attr isSymbol ifTrue:[^ attr == aSymbol].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1332
    ^ (attr includes:aSymbol)
125
claus
parents: 124
diff changeset
  1333
!
claus
parents: 124
diff changeset
  1334
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1335
setAttributes:aList
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1336
    "set the attribute list.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1337
     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
  1338
     (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
  1339
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1340
    listAttributes := aList
125
claus
parents: 124
diff changeset
  1341
!
claus
parents: 124
diff changeset
  1342
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1343
strikeOut:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1344
    "turn on/off strikeOut mode"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1345
2977
b2233d8126cb Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2948
diff changeset
  1346
    <resource:#obsolete>
2516
84fd31ffad4c strikeOut -> strikeout
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  1347
    self obsoleteMethodWarning:'use #strikeout:'.
84fd31ffad4c strikeOut -> strikeout
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  1348
    strikeOut := aBoolean.
84fd31ffad4c strikeOut -> strikeout
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  1349
!
84fd31ffad4c strikeOut -> strikeout
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  1350
84fd31ffad4c strikeOut -> strikeout
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  1351
strikeout:aBoolean
84fd31ffad4c strikeOut -> strikeout
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  1352
    "turn on/off strikeOut mode"
84fd31ffad4c strikeOut -> strikeout
Claus Gittinger <cg@exept.de>
parents: 2503
diff changeset
  1353
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1354
    strikeOut := aBoolean.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1355
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1356
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1357
!SelectionInListView methodsFor:'accessing-behavior'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1358
1181
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1359
dragObjectConverter:aBlock
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1360
    "set an optional dragObject converter;
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1361
     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
  1362
     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
  1363
     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
  1364
     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
  1365
     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
  1366
     names of the actual objects to be dragged."
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1367
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1368
    dragObjectConverter := aBlock
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1369
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1370
    "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
  1371
    "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
  1372
!
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  1373
987
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1374
enabled
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1375
   "return true if selections are possible"
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1376
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1377
   ^ enabled.
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1378
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1379
    "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
  1380
!
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  1381
1831
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1382
enabled:aBoolean
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1383
    "enable/disable the view - selection changes are allowed/disallowed"
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1384
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1385
    enabled := aBoolean
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1386
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1387
    "Modified: / 30.3.1999 / 15:26:10 / stefan"
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1388
!
c1dd74b063a7 Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1826
diff changeset
  1389
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1390
ignoreReselect:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1391
    "set/clear the ignoreReselect flag - 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1392
     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
  1393
     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
  1394
     change in the selection occurs.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1395
     (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
  1396
     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
  1397
     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
  1398
     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
  1399
     if the selection is the same.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1400
     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
  1401
     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
  1402
5864
2b97dee5149e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5852
diff changeset
  1403
    "note by ca: 
2b97dee5149e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5852
diff changeset
  1404
        multiple selection on: the ignoreReselect will have no influence
2b97dee5149e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5852
diff changeset
  1405
    "
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1406
    ignoreReselect := aBoolean
125
claus
parents: 124
diff changeset
  1407
!
claus
parents: 124
diff changeset
  1408
2329
fbd74f921872 multipleSelect query
ps
parents: 2318
diff changeset
  1409
multipleSelectOk
fbd74f921872 multipleSelect query
ps
parents: 2318
diff changeset
  1410
    ^ multipleSelectOk
fbd74f921872 multipleSelect query
ps
parents: 2318
diff changeset
  1411
!
fbd74f921872 multipleSelect query
ps
parents: 2318
diff changeset
  1412
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1413
multipleSelectOk:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1414
    "allow/disallow multiple selections. If enabled, the
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1415
     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
  1416
     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
  1417
     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
  1418
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1419
    multipleSelectOk := aBoolean.
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  1420
125
claus
parents: 124
diff changeset
  1421
!
claus
parents: 124
diff changeset
  1422
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1423
toggleSelect:aBoolean
5864
2b97dee5149e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5852
diff changeset
  1424
    "turn on/off toggle select. 
2b97dee5149e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5852
diff changeset
  1425
     If true, clicking on a selected entry unselects it and vice versa. 
2b97dee5149e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5852
diff changeset
  1426
     The default is false, which means
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1427
     that clicking on an already selected entry does not change its
5864
2b97dee5149e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5852
diff changeset
  1428
     select status (see also ignoreReselect:, which has higher prio and is checked first)."
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1429
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1430
    toggleSelect := aBoolean.
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
1163
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1433
!SelectionInListView methodsFor:'accessing-channels'!
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1434
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1435
listHolder
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1436
    ^ listChannel
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1437
!
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1438
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1439
listHolder:aListHolder
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1440
    listChannel notNil ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1441
        listChannel removeDependent:self
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1442
    ].
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1443
    (listChannel := aListHolder) notNil ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1444
        listChannel addDependent:self
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1445
    ].
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  1446
    self getListFromModel
1163
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1447
! !
05ec30ba9b17 added enableChannel & example.
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1448
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1449
!SelectionInListView methodsFor:'accessing-contents'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1450
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1451
add:aValue beforeIndex:index
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1452
    "must recompute our current selections"
125
claus
parents: 124
diff changeset
  1453
claus
parents: 124
diff changeset
  1454
    selection notNil ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1455
        self multipleSelectOk ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1456
            selection := selection collect:[ :sel |
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1457
                sel >= index ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1458
                    sel + 1
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1459
                ] ifFalse:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1460
                    sel
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1461
                ]
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1462
            ].
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1463
        ] ifFalse:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1464
            selection >= index ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1465
                selection := selection + 1.
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1466
            ].
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1467
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1468
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1469
    ^ super add:aValue beforeIndex:index.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1470
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1471
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1472
contents:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1473
    "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
  1474
     and clearing attributes.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1475
     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
  1476
     (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
  1477
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1478
    selection := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1479
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1480
    super contents:aCollection.
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
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1483
list:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1484
    "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
  1485
     and clearing attributes."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1486
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1487
    self list:aCollection keepSelection:false 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1488
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1489
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1490
list:aCollection keepSelection:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1491
    "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
  1492
     and clearing attributes."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1493
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1494
    |oldSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1495
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1496
    "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
  1497
     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
  1498
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1499
    (shown and:[hilightLevel ~~ 0]) ifTrue:[
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1500
        selection == firstLineShown ifTrue:[
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  1501
           gc paint:bgColor.
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  1502
           gc fillRectangleX:margin y:margin
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  1503
              width:(width - (margin * 2)) height:(hilightLevel abs).
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1504
        ].
125
claus
parents: 124
diff changeset
  1505
    ].
claus
parents: 124
diff changeset
  1506
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1507
    aBoolean ifTrue:[
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1508
        oldSelection := selection.
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1509
        selection := nil.
125
claus
parents: 124
diff changeset
  1510
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1511
    listAttributes := nil.
3823
1525064c99d2 changed #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents: 3711
diff changeset
  1512
    self list:aCollection expandTabs:printItems.
2948
c1a14c2a9744 invalidate view if list changed
ca
parents: 2820
diff changeset
  1513
    shown ifTrue:[self invalidate].
c1a14c2a9744 invalidate view if list changed
ca
parents: 2820
diff changeset
  1514
4467
746be61eb7f2 changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents: 4324
diff changeset
  1515
    useIndex == true ifTrue:[
746be61eb7f2 changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents: 4324
diff changeset
  1516
        scrollWhenUpdating == #keep ifTrue:[
746be61eb7f2 changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents: 4324
diff changeset
  1517
            self selectWithoutScroll:oldSelection
746be61eb7f2 changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents: 4324
diff changeset
  1518
        ] ifFalse:[
746be61eb7f2 changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents: 4324
diff changeset
  1519
            self setSelection:oldSelection. "/ nil if keep is false
746be61eb7f2 changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents: 4324
diff changeset
  1520
        ].
3432
1db93a93342d care for \"do-not-scroll-when-updating\" flag.
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1521
    ] ifFalse:[
4467
746be61eb7f2 changed: #list:keepSelection:
Claus Gittinger <cg@exept.de>
parents: 4324
diff changeset
  1522
        self getSelectionFromModel.
3432
1db93a93342d care for \"do-not-scroll-when-updating\" flag.
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1523
    ].
1db93a93342d care for \"do-not-scroll-when-updating\" flag.
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1524
2232
b65df4a6af2d when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  1525
    selection ~= oldSelection ifTrue:[
b65df4a6af2d when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  1526
        "/ cannot keep the selection (items removed)
b65df4a6af2d when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  1527
        "/ must tell the model if there is one ....
b65df4a6af2d when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  1528
        self selectionChangedFrom:oldSelection
b65df4a6af2d when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  1529
    ].
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  1530
3432
1db93a93342d care for \"do-not-scroll-when-updating\" flag.
Claus Gittinger <cg@exept.de>
parents: 3424
diff changeset
  1531
    "Modified: / 10-01-2007 / 18:21:31 / cg"
31
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1532
!
2224b4d173f7 *** empty log message ***
claus
parents: 24
diff changeset
  1533
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1534
printItems:aBoolean
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1535
    "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
  1536
     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
  1537
     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
  1538
     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
  1539
     The default is false.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1540
     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
  1541
     a definable printSelector or - better - a printConverter.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1542
     This may be added in the future."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1543
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1544
    printItems := aBoolean
125
claus
parents: 124
diff changeset
  1545
!
claus
parents: 124
diff changeset
  1546
2255
0bd7f58945b7 oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents: 2247
diff changeset
  1547
removeFromIndex:startLineNr toIndex:endLineNr
0bd7f58945b7 oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents: 2247
diff changeset
  1548
    "must recompute our current selections"
0bd7f58945b7 oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents: 2247
diff changeset
  1549
2256
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1550
    |oldSelection|
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1551
2255
0bd7f58945b7 oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents: 2247
diff changeset
  1552
    selection notNil ifTrue:[
2256
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1553
        oldSelection := selection copy.
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1554
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1555
        "/ a kludge - if the first line is in the selection,
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1556
        "/ and the selection is drawn with an extra inverted area around,
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1557
        "/ we must invalidate the line before as well.
2633
96d7e5d626ae redraw bug fix (highlightFrame leftover when deleting lines)
Claus Gittinger <cg@exept.de>
parents: 2597
diff changeset
  1558
        (hilightFrameColor notNil or:[hilightStyle == #motif]) ifTrue:[
2256
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1559
            (self isInSelection:startLineNr) ifTrue:[
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1560
                startLineNr > 1 ifTrue:[
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1561
                    self invalidateLine:(startLineNr - 1)
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1562
                ]
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1563
            ].
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1564
        ].
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1565
4478
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  1566
        self checkRemovingSelectionFrom:startLineNr to:endLineNr.
2256
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1567
        oldSelection ~= selection ifTrue:[
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1568
            "/ cannot keep the selection (items removed)
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1569
            "/ must tell the model if there is one ....
2334
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1570
            model notNil ifTrue:[model removeDependent:self].
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1571
            [
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1572
                self selectionChangedFrom:oldSelection
2519
a088ad3bb1e5 #valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents: 2516
diff changeset
  1573
            ] ensure:[
2334
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1574
                model notNil ifTrue:[model addDependent:self].
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1575
            ].
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1576
        ].
2255
0bd7f58945b7 oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents: 2247
diff changeset
  1577
    ].
0bd7f58945b7 oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents: 2247
diff changeset
  1578
    super removeFromIndex:startLineNr toIndex:endLineNr.
0bd7f58945b7 oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents: 2247
diff changeset
  1579
!
0bd7f58945b7 oops - must care for selection when doing bulk-removes
Claus Gittinger <cg@exept.de>
parents: 2247
diff changeset
  1580
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1581
removeIndexWithoutRedraw:lineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1582
    "delete line - no redraw;
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1583
     return true, if something was really deleted.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1584
     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
  1585
2256
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1586
    |oldSelection|
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1587
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1588
    selection notNil ifTrue:[
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1589
        oldSelection := selection copy.
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1590
        self checkRemovingSelection:lineNr.
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1591
        oldSelection ~= selection ifTrue:[
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1592
            "/ cannot keep the selection (items removed)
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1593
            "/ must tell the model if there is one ....
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1594
            self selectionChangedFrom:oldSelection
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1595
        ]
9ec077cb8d25 redraw fix
Claus Gittinger <cg@exept.de>
parents: 2255
diff changeset
  1596
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1597
    ^ super removeIndexWithoutRedraw:lineNr
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1598
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1599
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1600
setContents:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1601
    "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
  1602
     and clearing attributes.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1603
     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
  1604
     (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
  1605
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1606
    selection := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1607
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1608
    super setContents:aCollection.
125
claus
parents: 124
diff changeset
  1609
!
claus
parents: 124
diff changeset
  1610
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1611
setList:aCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1612
    "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
  1613
     and clearing attributes.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1614
     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
  1615
     (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
  1616
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1617
    selection := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1618
    listAttributes := nil.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1619
    super setList:aCollection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1620
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1621
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1622
!SelectionInListView methodsFor:'accessing-look'!
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1623
3711
e8d1ab008312 #noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents: 3699
diff changeset
  1624
noHighlighting
e8d1ab008312 #noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents: 3699
diff changeset
  1625
    "switch off higlighting of selected lines"
e8d1ab008312 #noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents: 3699
diff changeset
  1626
e8d1ab008312 #noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents: 3699
diff changeset
  1627
    hilightFgColor := fgColor.
e8d1ab008312 #noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents: 3699
diff changeset
  1628
    hilightBgColor := bgColor.
e8d1ab008312 #noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents: 3699
diff changeset
  1629
    hilightFrameColor := nil.
e8d1ab008312 #noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents: 3699
diff changeset
  1630
    hilightFgColorNoFocus := fgColor.
e8d1ab008312 #noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents: 3699
diff changeset
  1631
    hilightBgColorNoFocus := bgColor.
e8d1ab008312 #noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents: 3699
diff changeset
  1632
!
e8d1ab008312 #noHighlighting to switch off highlighting of selected lines
Stefan Vogel <sv@exept.de>
parents: 3699
diff changeset
  1633
4971
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  1634
selectedVisualBlock
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  1635
    ^ selectedVisualBlock
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  1636
!
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  1637
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1638
selectedVisualBlock:aBlock
2290
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  1639
    "ST-80 compatibility: provide a block, which returns a displayObject to be drawn for
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  1640
     selected items."
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1641
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1642
    selectedVisualBlock := aBlock
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1643
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1644
    "Created: / 27.10.1997 / 19:50:58 / cg"
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1645
    "Modified: / 21.6.1998 / 02:40:46 / cg"
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1646
!
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1647
4971
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  1648
visualBlock
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  1649
    ^ visualBlock
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  1650
!
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  1651
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1652
visualBlock:aBlock
2290
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  1653
    "ST-80 compatibility: provide a block, which returns a displayObject to be drawn for
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  1654
     unselected items."
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1655
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1656
    visualBlock := aBlock
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1657
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  1658
    "Modified: / 21.6.1998 / 02:40:57 / cg"
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1659
! !
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  1660
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1661
!SelectionInListView methodsFor:'accessing-mvc'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1662
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1663
addModelInterfaceTo:aDictionary
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1664
    "see comment in View>>modelInterface"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1665
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1666
    super addModelInterfaceTo:aDictionary.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1667
    aDictionary at:#doubleClickMessage put:doubleClickMsg.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1668
    aDictionary at:#initialSelectionMessage put:initialSelectionMsg.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1669
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
     SelectionInListView new modelInterface 
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1672
    "
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1673
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1674
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1675
doubleClick:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1676
    "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
  1677
     OBSOLETE: please use #doubleClickMessage:"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1678
2369
95fc0483637f Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 2339
diff changeset
  1679
    <resource:#obsolete>
95fc0483637f Use <resource:#obsolete>
Stefan Vogel <sv@exept.de>
parents: 2339
diff changeset
  1680
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1681
    self obsoleteMethodWarning:'please use #doubleClickMessage:'.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1682
    doubleClickMsg := aSymbol
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1683
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  1684
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1685
doubleClickMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1686
    "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
  1687
     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
  1688
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1689
    ^ doubleClickMsg
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1690
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1691
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1692
doubleClickMessage:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1693
    "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
  1694
     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
  1695
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1696
    doubleClickMsg := aSymbol
119
claus
parents: 116
diff changeset
  1697
!
claus
parents: 116
diff changeset
  1698
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1699
initialSelectionMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1700
    "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
  1701
     selectionIndex. This is used both in change notification and to
5779
cddfa7b8e2a5 #OTHER by mawalch
mawalch
parents: 5720
diff changeset
  1702
     actually acquire a new selection value."
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1703
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1704
    ^ initialSelectionMsg
125
claus
parents: 124
diff changeset
  1705
!
claus
parents: 124
diff changeset
  1706
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1707
initialSelectionMessage:aSymbol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1708
    "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
  1709
     selectionIndex. This is used both in change notification and to
5779
cddfa7b8e2a5 #OTHER by mawalch
mawalch
parents: 5720
diff changeset
  1710
     actually acquire a new selection value."
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1711
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1712
    initialSelectionMsg := aSymbol
125
claus
parents: 124
diff changeset
  1713
!
claus
parents: 124
diff changeset
  1714
4014
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  1715
on:aModel aspect:aspectSymbol change:changeSymbol list:listSymbol menu:menuSymbol
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  1716
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  1717
    "ST-80 compatibility"
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  1718
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  1719
    super on:aModel aspect:aspectSymbol change:changeSymbol list:listSymbol menu:menuSymbol.
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  1720
    initialSelectionMsg := aspectMsg.
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  1721
!
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  1722
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1723
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
  1724
		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
  1725
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1726
    "ST-80 compatibility"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1727
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1728
    aspectMsg := aspectSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1729
    changeMsg := changeSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1730
    listMsg := listSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1731
    menuMsg := menuSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1732
    initialSelectionMsg := initialSymbol.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1733
    printItems := print.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1734
    oneItem := one.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1735
    useIndex := use.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1736
    ignoreReselect := false.    "/ ST80 behavior
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1737
    self model:aModel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1738
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1739
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1740
!SelectionInListView methodsFor:'accessing-selection'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1741
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1742
addElementToSelection:anObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1743
    "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
  1744
     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
  1745
     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
  1746
     was found.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1747
     *** 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
  1748
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1749
    |lineNo str|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1750
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1751
    str := anObject printString.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1752
    lineNo := list findFirst:[:entry | str = entry printString].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1753
    lineNo ~~ 0 ifTrue:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1754
        self addToSelection:lineNo.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1755
        ^ true
125
claus
parents: 124
diff changeset
  1756
    ].
claus
parents: 124
diff changeset
  1757
    ^ false
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1758
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1759
    "Modified: 15.11.1996 / 16:59:43 / cg"
125
claus
parents: 124
diff changeset
  1760
!
claus
parents: 124
diff changeset
  1761
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1762
addToSelection:aNumber
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1763
    "add entry, aNumber to the selection. No scrolling is done.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1764
     *** 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
  1765
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1766
    (self isValidSelection:aNumber) ifFalse:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1767
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  1768
    "/ this item selectable ?
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  1769
    (selectConditionBlock notNil 
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  1770
     and:[(selectConditionBlock value:aNumber) not]) ifTrue:[^ self].
1409
a188f69b125f bug fix:
ca
parents: 1402
diff changeset
  1771
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1772
    selection isNil ifTrue:[^ self selectWithoutScroll:aNumber].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1773
    selection isCollection ifTrue:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1774
        (selection includes:aNumber) ifTrue:[^ self].
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1775
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1776
        "/ 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
  1777
        selection isList ifTrue:[
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1778
            selection add:aNumber
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1779
        ] ifFalse:[
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1780
            selection := selection asOrderedCollection.
2684
91ac286733ac when adding to a selection, make sure that a new collection is
Claus Gittinger <cg@exept.de>
parents: 2670
diff changeset
  1781
            selection := selection copyWith:aNumber.
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1782
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1783
    ] ifFalse:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1784
        (aNumber == selection) ifTrue:[^ self].
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1785
        selection := OrderedCollection with:selection with:aNumber
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1786
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1787
    self redrawElement:aNumber
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1788
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1789
    "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
  1790
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1791
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1792
removeFromSelection:aNumber
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1793
    "remove entry, aNumber from the selection.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1794
     *** 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
  1795
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1796
    selection isNil ifTrue:[^ self].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1797
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  1798
    self multipleSelectOk ifTrue:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1799
        (selection includes:aNumber) ifFalse:[^ self].
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1800
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1801
        selection isList ifTrue:[
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1802
            selection remove:aNumber ifAbsent:nil
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1803
        ] ifFalse:[
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1804
            "/ 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
  1805
            selection := selection asOrderedCollection.
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1806
            selection := selection copyWithout:aNumber
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1807
        ].
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1808
        selection size == 0 ifTrue:[
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1809
            selection := #()
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1810
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1811
    ] ifFalse:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1812
        (aNumber == selection) ifFalse:[^ self].
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1813
        selection := nil
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1814
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1815
    self redrawElement:aNumber
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  1816
2136
eb816448daec care for multiSelect into a non-list;
Claus Gittinger <cg@exept.de>
parents: 2125
diff changeset
  1817
    "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
  1818
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1819
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1820
!SelectionInListView methodsFor:'change & update'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1821
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1822
update:something with:aParameter from:changedObject
2246
d89a4611e5b2 *** empty log message ***
Stefan Vogel <sv@exept.de>
parents: 2235
diff changeset
  1823
    |listValue start stop size idx|
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1824
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1825
    changedObject == model ifTrue:[
1235
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1826
        something == aspectMsg ifTrue:[
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  1827
            listChannel isNil ifTrue:[
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  1828
                self getListFromModel
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  1829
            ].
1235
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1830
            self getSelectionFromModel.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1831
            ^ self
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1832
        ].
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1833
        something == listMsg ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1834
            self getListFromModel.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1835
            ^ self
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1836
        ].
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1837
        something == initialSelectionMsg ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1838
            self getSelectionFromModel.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1839
            ^ self
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1840
        ].
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1841
        something == #empty ifTrue:[
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1842
            self list:nil.
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1843
            ^ self
23748485375c useIndex:
ca
parents: 1217
diff changeset
  1844
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  1845
    ].
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1846
    changedObject == listChannel ifFalse:[
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1847
        ^ super update:something with:aParameter from:changedObject
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1848
    ].
3424
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1849
3451
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1850
    something == #remove: ifTrue:[
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1851
        self removeIndex:aParameter.
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1852
        ^ self
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1853
    ].
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1854
    something == #removeFrom: ifTrue:[
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1855
        start := aParameter first.
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1856
        stop  := aParameter last.
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1857
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1858
        (start == 1 and:[stop == self size]) ifTrue:[
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1859
            self getListFromModel
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1860
        ] ifFalse:[
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1861
            self removeFromIndex:start toIndex:stop.
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1862
        ].
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1863
        ^ self
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1864
    ].
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1865
3424
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1866
    "/ ca's "optimizations" are only correct if we do not have items
4135
82706776fa84 changed: #update:with:from:
Claus Gittinger <cg@exept.de>
parents: 4050
diff changeset
  1867
    (items isNil or:[printItems not]) ifTrue:[
3424
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1868
        listValue := listChannel value.
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1869
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1870
        something == #at: ifTrue:[
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1871
            idx := aParameter isCollection ifTrue:[aParameter at:1]
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1872
                                          ifFalse:[aParameter].
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1873
            self at:aParameter put:(listValue at:idx).
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1874
            ^ self
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1875
        ].
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1876
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1877
        something == #insert: ifTrue:[
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1878
            listValue == list ifTrue:[self halt:'should not happen'].
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1879
            self add:(listValue at:aParameter) beforeIndex:aParameter.
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1880
            ^ self
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1881
        ].
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1882
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1883
        something == #insertCollection: ifTrue:[
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1884
            (size := aParameter last) ~~ 0 ifTrue:[
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1885
                (self size == 0 or:[size > 50]) ifTrue:[
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1886
                    self getListFromModel
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1887
                ] ifFalse:[
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1888
                    listValue == list ifTrue:[self halt:'should not happen'].
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1889
                    start := aParameter first.
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1890
                    "/ self addAll:(listValue copyFrom:start to:start+size-1) beforeIndex:start.
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1891
                    size timesRepeat:[
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1892
                        self add:(listValue at:start) beforeIndex:start.
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1893
                        start := start + 1
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1894
                    ]
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1895
                ]
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1896
            ].
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1897
            ^ self
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1898
        ].
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1899
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1900
        something == #replace: ifTrue:[
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1901
            start := aParameter first.
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1902
            stop  := aParameter last.
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1903
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1904
            list size = listValue size ifTrue:[
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1905
                self replaceFrom:start to:stop with:listValue startingAt:start.
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1906
                ^ self
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1907
            ].
2334
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  1908
        ].
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1909
    ].
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1910
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  1911
    self getListFromModel.
1400
056494ffbda0 release channels on destroy
Claus Gittinger <cg@exept.de>
parents: 1379
diff changeset
  1912
3424
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  1913
    "Modified: / 30-03-1999 / 14:27:42 / stefan"
3451
a21361ac90d2 care for selection-indices when list changes due to a remove operation.
Claus Gittinger <cg@exept.de>
parents: 3432
diff changeset
  1914
    "Modified: / 21-02-2007 / 15:20:44 / cg"
125
claus
parents: 124
diff changeset
  1915
! !
claus
parents: 124
diff changeset
  1916
2563
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  1917
!SelectionInListView methodsFor:'drag & drop'!
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  1918
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  1919
allowDrag:aBoolean
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  1920
    "enable/disable dragging support"
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  1921
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  1922
    allowDrag := aBoolean
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  1923
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  1924
    "Created: 14.11.1996 / 15:12:58 / cg"
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  1925
!
1473
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
canDrag
3246
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1928
    "returns true if dragging is enabled"
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1929
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1930
    ^ (allowDrag or:[dropSource notNil])
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1931
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1932
3527
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1933
dragAutoScroll:aDropContext
2820
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1934
    "called by the DragAndDropManager to scroll during a drag/drop operation
6338
05cd9b440af9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6333
diff changeset
  1935
     if required (decided by the widget itself). 
05cd9b440af9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6333
diff changeset
  1936
     If a scroll was done, return true;
05cd9b440af9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6333
diff changeset
  1937
     otherwise false (used to restore the background)"
3246
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1938
3527
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1939
    |point y dist visLnNr absLnNr nLines scrollUp|
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1940
6344
ecc5036481e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  1941
    (super dragAutoScroll:aDropContext) ifTrue:[^ true].
ecc5036481e9 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 6338
diff changeset
  1942
    
6347
c96cfb1051c5 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6344
diff changeset
  1943
    point := aDropContext targetPointInDeviceCoordinates.
3527
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1944
    y := point y.
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1945
    visLnNr := self visibleLineOfY:y.
2820
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1946
    absLnNr := self visibleLineToAbsoluteLine: visLnNr.
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1947
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1948
    visLnNr == 1 ifTrue:[
3527
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1949
        scrollUp := true.
2820
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1950
        absLnNr == 1 ifTrue:[ ^ false ].
3527
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1951
        dist := y.
2820
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1952
    ] ifFalse:[
3527
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1953
        scrollUp := false.
2820
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1954
        absLnNr < self size ifFalse:[ ^ false ].
6646
e2c1a572a33e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6552
diff changeset
  1955
        (self isLineFullyVisible: absLnNr + 1) ifTrue:[ ^ false ].
3527
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1956
        dist := height-y.
2820
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1957
    ].
3527
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1958
    aDropContext contentsWillChange.
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1959
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1960
    nLines := 1.
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1961
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1962
    #(2 4 8) do:[:fraction |
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1963
        dist <= (fontHeight / fraction) ifTrue:[
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1964
            nLines := fraction.
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1965
        ]
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1966
    ].
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1967
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1968
    scrollUp ifTrue:[ 
6338
05cd9b440af9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6333
diff changeset
  1969
        self scrollUpLines:nLines 
3527
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1970
    ] ifFalse:[ 
6338
05cd9b440af9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6333
diff changeset
  1971
        self scrollDownLines:nLines 
3527
da7213ab94dc dragAutoScroll: become faster when near the boundary
Claus Gittinger <cg@exept.de>
parents: 3487
diff changeset
  1972
    ].
2820
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1973
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1974
    ^ true
6338
05cd9b440af9 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6333
diff changeset
  1975
6646
e2c1a572a33e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6552
diff changeset
  1976
    "Modified: / 20-07-2019 / 07:51:03 / Claus Gittinger"
2820
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1977
!
6ffb79df741b support autoScroll during drag operation
ca
parents: 2785
diff changeset
  1978
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1979
dropSource
3246
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1980
    "returns the dropSource or nil"
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1981
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1982
    ^ dropSource
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1983
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1984
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1985
dropSource:aDropSourceOrNil
3246
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1986
    "set the dropSource or nil"
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1987
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1988
    dropSource := aDropSourceOrNil.
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1989
!
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1990
3246
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1991
startDragAt:aPoint 
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  1992
    dropSource isNil ifTrue:[
2563
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  1993
        dragIsActive := true.
3246
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1994
        DragAndDropManager 
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1995
            startDrag:(self collectionOfDragObjects)
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1996
            from:self
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1997
            offset:0 @ 0
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1998
            atEnd:endDragAction
d6a161e4c6b4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3241
diff changeset
  1999
            display:(self selectionValue).
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2000
    ] ifFalse:[
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2001
        dropSource startDragIn:self at:aPoint
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2002
    ]
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2003
! !
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2004
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2005
!SelectionInListView methodsFor:'drawing'!
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2006
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2007
drawRightArrowInVisibleLine:visLineNr
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2008
    "draw a right arrow (for submenus).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2009
     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
  2010
     as menus or file-lists."
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2011
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2012
    |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
  2013
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2014
    x := width - 16.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2015
    y := (self yOfVisibleLine:visLineNr).
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2016
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2017
    listLine := self visibleLineToListLine:visLineNr.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2018
    item := self at:listLine.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2019
    item isNil ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2020
        itemHeight := fontHeight
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2021
    ] ifFalse:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2022
        itemHeight := item heightOn:self.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2023
    ].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2024
5639
d1d2cc8baa30 device access
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
  2025
    (device depth == 1 or:[arrowLevel == 0]) ifTrue:[
d1d2cc8baa30 device access
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
  2026
        form := self class rightArrowFormOn:device.
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2027
        form notNil ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2028
            y := y + ((itemHeight - form height) // 2).
2037
3d3eebdbed6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  2029
            self foreground:(
3d3eebdbed6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  2030
                    (self isInSelection:listLine) 
3d3eebdbed6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  2031
                        ifTrue:[hilightFgColor] 
3d3eebdbed6c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1988
diff changeset
  2032
                        ifFalse:[fgColor]).
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2033
            self displayForm:form x:x y:y.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2034
        ]
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2035
    ] ifFalse:[
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2036
        smallArrow ifTrue:[
5639
d1d2cc8baa30 device access
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
  2037
            form := self class smallRightArrowLightFormOn:device.
d1d2cc8baa30 device access
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
  2038
            form2 := self class smallRightArrowShadowFormOn:device.
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2039
        ] ifFalse:[
5639
d1d2cc8baa30 device access
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
  2040
            form := self class rightArrowLightFormOn:device.
d1d2cc8baa30 device access
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
  2041
            form2 := self class rightArrowShadowFormOn:device.
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2042
        ].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2043
        (form isNil or:[form2 isNil]) ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2044
            "/ very bad conditions
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2045
            ^ self
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2046
        ].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2047
        y := y + ((itemHeight - form height) // 2).
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2048
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2049
        topLeftColor := lightColor.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2050
        botRightColor := shadowColor. 
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2051
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2052
        "openwin arrow stays down"
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2053
        styleSheet name ~~ #openwin ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2054
            (self isInSelection:listLine) ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2055
                t := topLeftColor.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2056
                topLeftColor := botRightColor.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2057
                botRightColor := t.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2058
            ]
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2059
        ].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2060
        arrowLevel < 0 ifTrue:[
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2061
            t := topLeftColor.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2062
            topLeftColor := botRightColor.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2063
            botRightColor := t.
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2064
        ].
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2065
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2066
"/        self foreground:topLeftColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2067
self paint:topLeftColor.
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2068
        self displayForm:form x:x y:y.
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2069
"/        self foreground:botRightColor.
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2070
self paint:botRightColor.
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  2071
        self displayForm:form2 x:x y:y.
429
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
!
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2074
5207
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2075
drawSelectionHighlightFrameForItemAtY:yLine with:fg
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2076
    |wEdge y y2|
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2077
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2078
    y := yLine - (lineSpacing//2).
5199
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2079
    hilightFrameColor notNil ifTrue:[
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2080
        hilightLevel == 0 ifTrue:[
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2081
            "
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2082
             a line above and below
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2083
            "
6785
0c9377055234 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
  2084
            self hasFocus ifTrue:[
0c9377055234 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
  2085
                gc paint:hilightFrameColor.
0c9377055234 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
  2086
            ] ifFalse:[
0c9377055234 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
  2087
                gc paint:(hilightBgColorNoFocus ? hilightBgColor)
0c9377055234 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6753
diff changeset
  2088
            ].
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2089
            gc displayLineFromX:0 y:y toX:width y:y.
5199
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2090
            y2 := y + fontHeight - 1.
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2091
            gc displayLineFromX:0 y:y2 toX:width y:y2.
5199
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2092
            ^ self
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2093
        ]
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2094
    ] ifFalse:[
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2095
        hilightStyle == #motif ifTrue:[
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2096
            "/ an additional line, inset by one pixel
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2097
            gc paint:fg.
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2098
            gc displayLineFromX:0 y:y+1 toX:width y:y+1.
5199
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2099
            y2 := y + fontHeight - 1 - 1.
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2100
            gc displayLineFromX:0 y:y2 toX:width y:y2.
5199
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2101
        ] ifFalse:[
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2102
            hilightStyle == #macosx ifTrue:[
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2103
                "/ an additional line, at the bottom
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2104
                gc paint:viewBackground.
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2105
                y2 := y + fontHeight - 1.
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2106
                gc displayLineFromX:0 y:y2 toX:width y:y2.
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2107
            ]
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2108
        ].
5199
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2109
    ].
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2110
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2111
    "
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2112
     an edge it around
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2113
    "
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2114
    (hilightLevel ~~ 0) ifTrue:[
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2115
        "
5199
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2116
         let edge start at left, extending to the full width
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2117
         XXX: widthOfContents should be cached in ListView
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2118
              (instead of recomputing all over)
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2119
        "
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2120
        wEdge := width-(2 * margin).
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2121
        includesNonStrings ifFalse:[
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2122
            wEdge := wEdge max:(self widthOfContents).
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2123
        ].
5199
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2124
        self drawEdgesForX:(margin - viewOrigin x) y:y 
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2125
                     width:wEdge+viewOrigin x height:fontHeight 
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2126
                     level:hilightLevel.
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2127
    ].
5207
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2128
!
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2129
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2130
drawVisibleLineSelected:visLineNr
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2131
    "redraw a single line as selected."
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2132
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2133
    |fg bg|
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2134
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2135
    self hasFocus ifTrue:[
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2136
        fg := hilightFgColor.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2137
        bg := hilightBgColor.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2138
    ] ifFalse:[
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2139
        fg := hilightFgColorNoFocus.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2140
        bg := hilightBgColorNoFocus.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2141
    ].
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2142
    self drawVisibleLineSelected:visLineNr with:fg and:bg
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2143
6470
bf8450905cb8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6448
diff changeset
  2144
    "Modified: / 31-08-1995 / 19:24:09 / claus"
bf8450905cb8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6448
diff changeset
  2145
    "Modified: / 21-06-1998 / 03:12:56 / cg"
bf8450905cb8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6448
diff changeset
  2146
    "Modified (format): / 26-10-2018 / 21:44:49 / Claus Gittinger"
5207
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2147
!
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2148
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2149
drawVisibleLineSelected:visLineNr with:fg and:bg
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2150
    "redraw a single line as selected."
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2151
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2152
    |listLine 
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2153
     y  "{ Class: SmallInteger }" 
5208
c3639557ee1a class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
  2154
     dObj item t|
5207
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2155
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2156
    listLine := self visibleLineToListLine:visLineNr.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2157
    listLine isNil ifTrue:[
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2158
        super drawVisibleLine:visLineNr with:fg and:bg.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2159
        ^ self.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2160
    ].
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2161
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2162
    y := self yOfVisibleLine:visLineNr.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2163
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2164
    "/ if an explicit drawing block has been defined - let it do it.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2165
    selectedVisualBlock notNil ifTrue:[
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2166
        backgroundAlreadyClearedColor == bg ifFalse:[
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2167
            gc paint:bg.
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2168
            gc fillRectangleX:margin y:y - (lineSpacing//2)
5207
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2169
                          width:(width - (2 * margin)) 
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2170
                         height:fontHeight.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2171
        ].
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2172
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2173
        dObj := selectedVisualBlock value:self value:listLine.
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2174
        gc paint:fg on:bg.
5207
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2175
        dObj displayOn:self x:(textStartLeft-viewOrigin x) y:y + gc font ascent opaque:true.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2176
        
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2177
        self drawSelectionHighlightFrameForItemAtY:y with:fg.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2178
        ^ self.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2179
    ].
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2180
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2181
    strikeOut ifTrue:[
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2182
        self drawVisibleLine:visLineNr with:fgColor and:bgColor.
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2183
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2184
        gc paint:fgColor.
5207
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2185
        y := y + (fontHeight // 2).
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  2186
        gc displayLineFromX:0 y:y toX:width y:y.
5207
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2187
        ^ self
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2188
    ].
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2189
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2190
    "/ kludge:
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2191
    "/ care for text objects with a color
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2192
    "/ if the contrast between the fg-color and the selection-bg is too small,
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2193
    "/ the item is not readable anymore ...
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2194
    item := list at:listLine.
6470
bf8450905cb8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6448
diff changeset
  2195
    (item isString and:[item hasChangeOfEmphasis not]) ifTrue:[ 
bf8450905cb8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6448
diff changeset
  2196
        self drawVisibleLine:visLineNr with:fg and:bg.
bf8450905cb8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6448
diff changeset
  2197
    ] ifFalse:[    
bf8450905cb8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6448
diff changeset
  2198
        t := item perform:#withoutAnyColorEmphasis ifNotUnderstood:[item].
5207
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2199
        self
6470
bf8450905cb8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6448
diff changeset
  2200
            drawLine:t atX:(textStartLeft - viewOrigin x) 
5207
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2201
            inVisible:visLineNr 
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2202
            with:fg and:bg
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2203
    ].
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2204
9cbe8ff9d1e7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5199
diff changeset
  2205
    self drawSelectionHighlightFrameForItemAtY:y with:fg.
6073
511a25603e1c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6054
diff changeset
  2206
511a25603e1c #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6054
diff changeset
  2207
    "Modified: / 04-02-2017 / 22:12:01 / cg"
6470
bf8450905cb8 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6448
diff changeset
  2208
    "Modified: / 27-10-2018 / 10:18:09 / Claus Gittinger"
3423
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2209
!
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2210
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2211
invalidateLine:aLineNr
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2212
    |visibleLine y|
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2213
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2214
    visibleLine := self listLineToVisibleLine:aLineNr.
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2215
    visibleLine notNil ifTrue:[
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2216
        y := self yOfVisibleLine:visibleLine.
5199
3e7e69f91e15 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5195
diff changeset
  2217
        self invalidate:(Rectangle origin:(0@y-(lineSpacing//2)) extent:(width@fontHeight+lineSpacing))
3423
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2218
    ].
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2219
!
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2220
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2221
invalidateSelection
5827
fbf66c32dd9f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5807
diff changeset
  2222
    "invalidate (force async redraw) the current selection"
fbf66c32dd9f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5807
diff changeset
  2223
3423
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2224
    shown ifTrue:[
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2225
        self selectionDo:[:lineNr| self invalidateLine:lineNr ].
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2226
    ].
429
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2227
! !
678f8d820c0f fixed round-edge drawing; slight rewrite
Claus Gittinger <cg@exept.de>
parents: 401
diff changeset
  2228
125
claus
parents: 124
diff changeset
  2229
!SelectionInListView methodsFor:'event handling'!
claus
parents: 124
diff changeset
  2230
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2231
buttonControlPress:button x:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2232
    "if multipleSelectOk: add to the selection; 
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2233
     otherwise, behave like normal select"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2234
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2235
    |oldSelection listLineNr|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2236
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2237
    (button == 1) ifTrue:[
1299
27f3fc6dee3d buttonControlPress:button x:x y:y
ca
parents: 1278
diff changeset
  2238
"/        toggleSelect ifTrue:[
27f3fc6dee3d buttonControlPress:button x:x y:y
ca
parents: 1278
diff changeset
  2239
"/           ^ self buttonPress:button x:x y:y
27f3fc6dee3d buttonControlPress:button x:x y:y
ca
parents: 1278
diff changeset
  2240
"/        ].
2318
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2241
        selectionAtClickTime := nil.
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2242
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2243
        enabled ifTrue:[
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  2244
            listLineNr := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2245
            listLineNr notNil ifTrue:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2246
                (self lineIsEnabled:listLineNr) ifFalse:[^ self].
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2247
            ].
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2248
            oldSelection := selection copy.
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2249
            listLineNr notNil ifTrue: [
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2250
                "/ this item selectable ?
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2251
                (selectConditionBlock notNil 
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  2252
                 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
  2253
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2254
                self multipleSelectOk ifTrue:[
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2255
                    (self isInSelection:listLineNr) ifTrue:[
2318
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2256
                        self removeFromSelection:listLineNr.
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2257
                        selectMode := false.
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2258
                    ] ifFalse:[
2318
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2259
                        self addToSelection:listLineNr.
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2260
                        selectMode := true.
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2261
                    ]
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2262
                ] ifFalse:[
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2263
                    self selectWithoutScroll:listLineNr
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2264
                ]
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2265
            ].
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2266
            ((ignoreReselect not and:[selection notNil])
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2267
             or:[selection ~= oldSelection]) ifTrue:[
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2268
                self selectionChangedFrom:oldSelection.
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2269
            ].
2318
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2270
            clickLine := listLineNr.
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2271
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2272
    ] ifFalse:[
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2273
        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
  2274
    ]
816
8ed221c75ac5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 812
diff changeset
  2275
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  2276
    "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
  2277
    "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
  2278
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2279
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 2998
diff changeset
  2280
buttonMotion:buttonState x:x y:y
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2281
    "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
  2282
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2283
    (enabled not or:[dragIsActive]) ifTrue:[
987
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  2284
        ^ self
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  2285
    ].
611244bb2e1d Disable must ignore buttonMotion events for multiSelections.
Stefan Vogel <sv@exept.de>
parents: 970
diff changeset
  2286
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2287
    "is it the select or 1-button ?"
3040
f5e9092f3312 buttonState handling sensor bug workaround
Claus Gittinger <cg@exept.de>
parents: 2998
diff changeset
  2288
    buttonState == 0 ifTrue:[^ self].
1620
47983c461af0 use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  2289
    self sensor leftButtonPressed ifFalse:[^ self].
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2290
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2291
    clickLine isNil ifTrue:[^ self].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2292
3565
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2293
    self canDrag ifTrue:[
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2294
"/        UserPreferences current expandSelectionOnMouseMoveWithButtonPressed not ifTrue:[
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2295
"/            clickPosition isNil ifTrue:[
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2296
"/                clickPosition := x@y
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2297
"/            ]
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2298
"/        ].
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2299
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2300
        (clickPosition notNil) ifTrue:[     "mouse pressed but not released"
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2301
            (clickPosition dist:(x@y)) > (UserPreferences current motionDistanceToStartDrag) ifTrue:[
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2302
                ^ self startDragAt:clickPosition
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2303
            ].
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2304
            ^ self
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2305
        ]
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2306
    ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2307
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2308
    "if moved outside of view, start autoscroll"
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2309
    (y < 0) ifTrue:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2310
        self compressMotionEvents:false.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2311
        self startAutoScrollUp:y.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2312
        ^ self
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2313
    ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2314
    (y > height) ifTrue:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2315
        self compressMotionEvents:false.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2316
        self startAutoScrollDown:(y - height).
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2317
        ^ self
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2318
    ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2319
3132
7cbaaa576f28 selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 3124
diff changeset
  2320
    (self canDrag 
7cbaaa576f28 selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 3124
diff changeset
  2321
    and:[x < -5 or:[x > (width+5)]]) ifTrue:[           "visible and out of view"
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2322
        ^ self startDragAt:(0 @ y)
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2323
    ].
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2324
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2325
    "move inside - stop autoscroll if any"
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2326
    self stopAutoScroll.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2327
3565
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2328
    UserPreferences current expandSelectionOnMouseMoveWithButtonPressed ifTrue:[
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2329
        (self sensor hasButtonMotionEventFor:self) ifFalse:[
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2330
            self expandSelectionToX:x y:y.
7471c37e703e expandSelectionOnMouseMoveWithButtonPressed
Claus Gittinger <cg@exept.de>
parents: 3527
diff changeset
  2331
        ].
2161
d80ba1bf9bb4 motion event compression
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  2332
    ].
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2333
1620
47983c461af0 use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1600
diff changeset
  2334
    "Modified: / 29.1.1997 / 12:15:31 / stefan"
2161
d80ba1bf9bb4 motion event compression
Claus Gittinger <cg@exept.de>
parents: 2156
diff changeset
  2335
    "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
  2336
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2337
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2338
buttonMultiPress:button x:x y:y
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2339
    (button == 1) ifTrue:[
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2340
"/        doubleClickActionBlock isNil ifTrue:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2341
"/            self buttonPress:button x:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2342
"/        ].
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2343
        enabled ifFalse:[
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2344
            ^ self
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2345
        ].
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2346
        self doubleClicked.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2347
    ] ifFalse:[
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2348
        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
  2349
    ]
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2350
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2351
    "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
  2352
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2353
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2354
buttonPress:button x:x y:y
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2355
    |sensor lineNr|
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2356
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2357
    (button == 1) ifFalse:[
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2358
        (button == 2) ifTrue:[
3838
48bcc71b4413 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  2359
            UserPreferences current selectOnRightClick ifTrue:[
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2360
                self selectOrToggleAtX:x y:y forRightClickMenu:true.
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2361
                UserPreferences current showRightButtonMenuOnRelease ifFalse:[
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2362
                    self pushEvent:#activateMenu.
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2363
                ].
3838
48bcc71b4413 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  2364
                ^ self.
48bcc71b4413 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3823
diff changeset
  2365
            ].
2998
6f1925bccf54 selectOnRightClick as in win32 - experimental
Claus Gittinger <cg@exept.de>
parents: 2977
diff changeset
  2366
        ].
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2367
        ^ super buttonPress:button x:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2368
    ].
2318
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2369
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2370
    selectionAtClickTime := nil.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2371
    enabled ifFalse:[
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2372
        ^ self
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2373
    ].
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2374
3466
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  2375
    dragIsActive        := false.
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  2376
    clickPosition       := nil.
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  2377
    isButtonPressActive := true.
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2378
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2379
    sensor := self sensor.
2730
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2702
diff changeset
  2380
    sensor ctrlDown ifTrue:[
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2702
diff changeset
  2381
        ^ self buttonControlPress:button x:x y:y
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2702
diff changeset
  2382
    ].
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2702
diff changeset
  2383
    sensor shiftDown ifTrue:[
61a2f1981ac6 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2702
diff changeset
  2384
        ^ self expandSelectionToX:x y:y
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2385
    ].
1181
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  2386
1473
c738bb7d8c66 support of Drag & Drop (new functionality)
ca
parents: 1457
diff changeset
  2387
    self canDrag ifTrue:[
1181
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  2388
        "/ clicked into the selection ?
ad5004cb2969 allow an optional converter for dropObjects
Claus Gittinger <cg@exept.de>
parents: 1163
diff changeset
  2389
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  2390
        lineNr := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2391
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2392
        (self isInSelection:lineNr) ifTrue:[
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2393
            "wait for release button
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2394
            "
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2395
            clickPosition := x@y.
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2396
            clickLine     := lineNr.
3124
4dc312205681 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3040
diff changeset
  2397
            ^ self
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2398
        ]
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2399
    ].
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2400
    self selectOrToggleAtX:x y:y
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2401
1513
e2b793cd4f9f care for nil sensor
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2402
    "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
  2403
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2404
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2405
buttonRelease:button x:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2406
    "stop any autoscroll"
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2407
2318
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2408
    selectionAtClickTime := nil.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2409
    self stopAutoScroll.
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2410
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2411
    button == 2 ifTrue:[
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2412
        super buttonRelease:button x:x y:y.
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2413
        ^ self.
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2414
    ].
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  2415
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2416
    dragIsActive ifTrue:[
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2417
        dragIsActive := false
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2418
    ] ifFalse:[
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2419
        clickPosition notNil ifTrue:[
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2420
            enabled ifFalse:[
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2421
                ^ self
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2422
            ].
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2423
            self selectOrToggleAtX:(clickPosition x) y:(clickPosition y).
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2424
        ]
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2425
    ].
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2426
    clickPosition := nil.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2427
3466
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  2428
    isButtonPressActive ifTrue:[
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  2429
        isButtonPressActive := false.
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  2430
        self hasSelection ifTrue:[
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  2431
            self makeSelectionVisible.
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  2432
        ].
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  2433
    ].
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  2434
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2435
    "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
  2436
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2437
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2438
buttonShiftPress:button x:x y:y
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2439
    "expand selection
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2440
    "
2264
f5cd15f186f8 care for nil selectable-index in cursorUp/down
Claus Gittinger <cg@exept.de>
parents: 2256
diff changeset
  2441
    self halt:'obsolete method called'.      "/ never called
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2442
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  2443
    self expandSelectionToX:x y:y
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  2444
1252
10e987a9ae7a removed debugHalts
Claus Gittinger <cg@exept.de>
parents: 1249
diff changeset
  2445
    "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
  2446
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2447
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2448
doubleClicked
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  2449
    |actionArg|
1457
818a2d65cf02 reset clickLine
ca
parents: 1409
diff changeset
  2450
818a2d65cf02 reset clickLine
ca
parents: 1409
diff changeset
  2451
    clickLine := nil.
2318
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  2452
    selectionAtClickTime := nil.
1457
818a2d65cf02 reset clickLine
ca
parents: 1409
diff changeset
  2453
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2454
    enabled ifFalse:[
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2455
        ^ self
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2456
    ].
554
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2457
    selection isNil ifTrue:[
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2458
        "/ can only happen if claus modifies the selection within
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2459
        "/ the selectAction ....
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2460
        ^ self
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2461
    ].
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2462
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  2463
    actionArg := self argForChangeMessage.
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  2464
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2465
    "/
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2466
    "/ the ST-80 way of notifying the model
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2467
    "/
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2468
    (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
  2469
        self sendChangeMessage:doubleClickMsg with:actionArg.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2470
    ].
554
92d1cbe0d92f klusge for claus
Claus Gittinger <cg@exept.de>
parents: 511
diff changeset
  2471
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2472
    "/
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2473
    "/ ST/X action blocks
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2474
    "/
1744
f7d712e4b79e support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents: 1725
diff changeset
  2475
    doubleClickActionBlock notNil ifTrue:[
2503
05307dff92f1 use new #valueWithOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  2476
        doubleClickActionBlock valueWithOptionalArgument:actionArg
1744
f7d712e4b79e support 0, 1 or 2-arg doubleClickActionBlock.
Claus Gittinger <cg@exept.de>
parents: 1725
diff changeset
  2477
    ].
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  2478
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2479
    "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
  2480
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2481
2204
53a4c702b4df multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  2482
key:key select:index x:x y:y shifted:shifted
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2483
    "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
  2484
     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
  2485
     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
  2486
     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
  2487
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2488
    |oldSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2489
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2490
    enabled ifFalse:[
5664
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2491
        ^ false
1361
139f8063319c added dummy #visualBlock: and #selectedVisualBlock:
Claus Gittinger <cg@exept.de>
parents: 1358
diff changeset
  2492
    ].
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2493
5664
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2494
    keyActionStyle isNil ifTrue:[^ false].
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2495
    
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2496
    "/ this item selectable ?
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2497
    (selectConditionBlock notNil 
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2498
     and:[(selectConditionBlock value:index) not]) ifTrue:[^ false].
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2499
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2500
    keyActionStyle == #pass ifTrue:[
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2501
        super keyPress:key x:x y:y.
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2502
        ^ false.
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2503
    ].
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2504
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2505
    (self multipleSelectOk and:[shifted]) ifTrue:[
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2506
        oldSelection := selection copy.
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2507
        (self isInSelection:index) ifTrue:[
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2508
            self removeFromSelection:index
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2509
        ] ifFalse:[
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2510
            self addToSelection:index.
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2511
            self makeLineVisible:index.
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2512
        ].
5664
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2513
        (selection ~= oldSelection) ifTrue:[
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2514
            self selectionChangedFrom:oldSelection.
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2515
        ].
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2516
    ] ifFalse:[
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2517
        self multipleSelectOk ifTrue:[
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2518
            self selection:(OrderedCollection with:index)
2138
a634610a37de added a selectionChangeConditionBlock,
Claus Gittinger <cg@exept.de>
parents: 2136
diff changeset
  2519
        ] ifFalse:[
5664
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2520
            self selection:index.
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2521
        ].    
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2522
        keyActionStyle == #selectAndDoubleClick ifTrue:[
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2523
            self doubleClicked
885
7a53a92aa4c2 oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
  2524
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2525
    ].
5664
a8ecef1ff7e2 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5663
diff changeset
  2526
    ^ true
885
7a53a92aa4c2 oops - did changeNotification twice.
Claus Gittinger <cg@exept.de>
parents: 882
diff changeset
  2527
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  2528
    "Modified: / 4.2.2000 / 14:51:25 / cg"
125
claus
parents: 124
diff changeset
  2529
!
claus
parents: 124
diff changeset
  2530
claus
parents: 124
diff changeset
  2531
keyPress:key x:x y:y
claus
parents: 124
diff changeset
  2532
    "handle keyboard input"
claus
parents: 124
diff changeset
  2533
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  2534
    <resource: #keyboard ( #CursorUp #CursorDown #BeginOfText #EndOfText
1676
a85936a2064c treat BeginOfLine key like BeginOfText;
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
  2535
                           #BeginOfLine #EndOfLine
490
08e8adfb783c resources
Claus Gittinger <cg@exept.de>
parents: 449
diff changeset
  2536
                           #Return ) >
132
claus
parents: 131
diff changeset
  2537
210
f7d44c195776 search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  2538
    |index       
f7d44c195776 search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  2539
     searchIndex "{Class: SmallInteger}"
f7d44c195776 search fixed for lines which start with a separator
Claus Gittinger <cg@exept.de>
parents: 191
diff changeset
  2540
     startSearch "{Class: SmallInteger}"
4601
1fafc57c47f4 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4599
diff changeset
  2541
     backSearch searchPrefix shifted
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  2542
     mySize sensor s index0 stillSearching|
125
claus
parents: 124
diff changeset
  2543
6191
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2544
    enabled ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2545
        sensor := self sensor.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2546
        shifted := sensor notNil and:[sensor shiftDown].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2547
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2548
        (key == #CursorUp) ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2549
            index0 := self firstInSelection.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2550
            index := self previousSelectableBefore:selection.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2551
            stillSearching := true.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2552
            [stillSearching
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2553
             and:[selectConditionBlock notNil 
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2554
                  and:[(selectConditionBlock value:index) not]]] whileTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2555
                index := self previousSelectableBefore:index.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2556
                stillSearching := index0 notNil and:[index ~= index0]
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2557
            ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2558
            (index0 notNil and:[index isNil or:[index > index0]]) ifTrue:[
6267
ff6b7f55bc99 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6260
diff changeset
  2559
                self beepInEditor
6191
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2560
            ].   
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2561
            self key:key select:index x:x y:y shifted:shifted.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2562
            ^ self
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  2563
        ].
6191
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2564
        (key == #CursorDown) ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2565
            index0 := self lastInSelection.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2566
            index := self nextSelectableAfter:selection.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2567
            stillSearching := true.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2568
            [stillSearching
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2569
             and:[selectConditionBlock notNil 
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2570
                  and:[(selectConditionBlock value:index) not]]] whileTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2571
                index := self nextSelectableAfter:index.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2572
                stillSearching := index0 notNil and:[index ~= index0]
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2573
            ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2574
            (index0 notNil and:[index isNil or:[index < index0]]) ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2575
                UserPreferences current beepInEditor ifTrue:[                
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2576
                    self beep      "/ wrapped
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2577
                ].  
3879
ffee9fd5e77d beepInEditor flag
Claus Gittinger <cg@exept.de>
parents: 3838
diff changeset
  2578
            ].  
6191
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2579
            self key:key select:index x:x y:y shifted:shifted.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2580
            ^ self
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2581
        ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2582
        "/
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2583
        "/ stupid: Home and End are caught in ScrollableView
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2584
        "/ we normally do not get them ...
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2585
        "/ (need to call handlesKey: from there ...
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2586
        "/  ... and implement it here)
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2587
        "/
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2588
        ((key == #BeginOfText) or:[key == #BeginOfLine]) ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2589
            self key:key select:1 x:x y:y shifted:shifted.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2590
            ^ self
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  2591
        ].
6191
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2592
        ((key == #EndOfText) or:[key == #EndOfLine]) ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2593
            index := self size.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2594
            self key:key select:index x:x y:y shifted:shifted.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2595
            ^ self
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2596
        ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2597
        key == #Return ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2598
            returnKeyActionStyle == #doubleClick ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2599
                selection notNil ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2600
                    self doubleClicked
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2601
                ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2602
                ^ self
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2603
            ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2604
            returnKeyActionStyle ~~ #pass ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2605
                ^ self
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2606
            ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2607
        ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2608
        (key == #SelectAll) ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2609
            self multipleSelectOk ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2610
                self selectAll. 
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2611
            ].
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2612
            ^ self
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2613
        ].
6191
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2614
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2615
        mySize := self size.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2616
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2617
        "
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2618
         alphabetic keys: search for next entry
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2619
         starting with key's character. If shift is pressed, search backward
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2620
        "
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2621
        (mySize > 0
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2622
        and:[key isCharacter
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2623
        and:[key isLetter]]) ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2624
            keyActionStyle isNil ifTrue:[^ self].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2625
            "/        self multipleSelectOk ifTrue:[^ self].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2626
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2627
            keyActionStyle == #pass ifFalse:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2628
                searchPrefix := key asLowercase asString.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2629
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2630
                "/            ... isISearch... ifFalse:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2631
                "/                iSearchString := ''
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2632
                "/            ] ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2633
                "/                iSearchString := iSearchString , searchPrefix.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2634
                "/                searchPrefix := iSearchString
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2635
                "/            ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2636
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2637
                backSearch := shifted.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2638
                backSearch ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2639
                    selection notNil ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2640
                        startSearch := self firstInSelection - 1.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2641
                        "/                    selection size > 0 ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2642
                        "/                        startSearch := selection first - 1
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2643
                        "/                    ] ifFalse:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2644
                        "/                        selection isCollection ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2645
                        "/                            startSearch := mySize
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2646
                        "/                        ] ifFalse:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2647
                        "/                            startSearch := selection - 1
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2648
                        "/                        ]
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2649
                        "/                    ]
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2650
                    ] ifFalse:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2651
                        startSearch := mySize
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2652
                    ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2653
                    startSearch < 1 ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2654
                        startSearch := mySize.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2655
                    ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2656
                ] ifFalse:[    
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2657
                    selection notNil ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2658
                        startSearch := self lastInSelection + 1.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2659
                        "/                    selection size > 0 ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2660
                        "/                        startSearch := selection last + 1
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2661
                        "/                    ] ifFalse:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2662
                        "/                        selection isCollection ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2663
                        "/                            startSearch := 1
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2664
                        "/                        ] ifFalse:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2665
                        "/                            startSearch := selection + 1
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2666
                        "/                        ]
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2667
                        "/                    ]
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2668
                    ] ifFalse:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2669
                        startSearch := 1
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2670
                    ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2671
                    startSearch > self size ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2672
                        startSearch := 1.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2673
                    ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2674
                ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2675
                searchIndex := startSearch.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2676
                [true] whileTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2677
                    s := self characterSearchItemStringAt:searchIndex.
6322
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2678
                    (s notNil and:[s string withoutSeparators asLowercase startsWith:searchPrefix]) ifTrue:[
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2679
                        |selectable didAskInteractively|
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2680
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2681
                        searchIndex = selection ifTrue:[^ self].
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2682
                        self class aboutToOpenBoxNotificationSignal
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2683
                            handle:[:ex |
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2684
                                didAskInteractively := true.
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2685
                                selectable := false.
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2686
                            ] do:[    
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2687
                                didAskInteractively := false.
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2688
                                selectable := selectConditionBlock isNil or:[selectConditionBlock value:searchIndex].
6191
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2689
                            ].
6322
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2690
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2691
                        selectable ifTrue:[
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2692
                            ^ self key:key select:searchIndex x:x y:y shifted:false
6191
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2693
                        ].
6322
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2694
                        didAskInteractively ifTrue:[^ self]. "/ ignore
6191
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2695
                    ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2696
                    backSearch ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2697
                        searchIndex := searchIndex - 1.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2698
                        searchIndex < 1 ifTrue:[searchIndex := mySize]
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2699
                    ] ifFalse:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2700
                        searchIndex := searchIndex + 1.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2701
                        searchIndex > mySize ifTrue:[searchIndex := 1].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2702
                    ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2703
                    searchIndex == startSearch ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2704
                        |prefix|
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2705
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2706
                        "/ none found.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2707
                        searchPrefix size == 1 ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2708
                            "/ if all start with the same prefix, use the char after the prefix
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2709
                            prefix := (self list collect:[:l | (l ? '')string]) longestCommonPrefixCaseSensitive:false.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2710
                            prefix isEmptyOrNil ifTrue:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2711
                                ^ self
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2712
                            ].
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2713
                            searchPrefix := prefix , searchPrefix.
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2714
                        ] ifFalse:[
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2715
                            ^ self
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2716
                        ]
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2717
                    ]
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2718
                ]
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2719
            ].
326
f04c328526c4 use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 320
diff changeset
  2720
        ].
125
claus
parents: 124
diff changeset
  2721
    ].
6191
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2722
    
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2723
    super keyPress:key x:x y:y
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2724
315e21126832 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6185
diff changeset
  2725
    "Modified: / 17-08-2017 / 09:42:06 / cg"
6322
d6cd7f125437 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 6285
diff changeset
  2726
    "Modified: / 16-05-2018 / 09:00:35 / stefan"
125
claus
parents: 124
diff changeset
  2727
!
claus
parents: 124
diff changeset
  2728
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2729
sizeChanged:how
5992
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2730
    self sizeChanged:how from:nil
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2731
!
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2732
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2733
sizeChanged:how from:oldExtent
4758
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  2734
    "if there is a selection, make certain, it is visible
5992
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2735
     after the sizechange."
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2736
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2737
    |first wasAtEnd selectionWasVisible oldFirst|
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2738
1973
a55fbd12d9bf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1918
diff changeset
  2739
    widthOfWidestLine := nil.
2204
53a4c702b4df multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  2740
    oldFirst := firstLineShown.
4758
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  2741
    wasAtEnd := (nFullLinesShown < list size) and:[ (firstLineShown + nFullLinesShown) >= list size ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2742
5992
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2743
    selectionWasVisible := false.
1725
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2744
    selection notNil ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2745
        self multipleSelectOk ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2746
            first := selection firstIfEmpty:nil
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2747
        ] ifFalse:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2748
            first := selection
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2749
        ].
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2750
        first notNil ifTrue:[
5992
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2751
            selectionWasVisible := (first between:firstLineShown and:(firstLineShown + nFullLinesShown)).
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2752
        ]
1725
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2753
    ].
532f89cec6ae only scroll on size-change, if selection was visible before
Claus Gittinger <cg@exept.de>
parents: 1697
diff changeset
  2754
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2755
    super sizeChanged:how.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2756
2204
53a4c702b4df multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  2757
    oldFirst ~~ firstLineShown ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2758
        "/ super did scroll already
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2759
        ^ self
2204
53a4c702b4df multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  2760
    ].
53a4c702b4df multiSelect and shifted-alpha key
Claus Gittinger <cg@exept.de>
parents: 2194
diff changeset
  2761
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  2762
    shown ifTrue:[
5992
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2763
        (oldExtent isNil or:[oldExtent y ~= height]) ifTrue:[
6552
cfe2cf166508 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6470
diff changeset
  2764
            selection size ~~ 0 ifTrue:[
5992
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2765
                selectionWasVisible ifTrue:[
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2766
                    self multipleSelectOk ifTrue:[
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2767
                        first := selection firstIfEmpty:nil
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2768
                    ] ifFalse:[
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2769
                        first := selection
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2770
                    ].
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2771
                    first notNil ifTrue:[self makeLineVisible:first]
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2772
                ]
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2773
            ] ifFalse:[
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2774
                "
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2775
                 if we were at the end before, move to the end again.
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2776
                 Still to be seen, if this is better in real life ...
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2777
                "
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2778
                wasAtEnd ifTrue:[
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2779
                    "at end"
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2780
                    self scrollToBottom
9c05410340c1 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5956
diff changeset
  2781
                ]
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2782
            ]
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  2783
        ]
125
claus
parents: 124
diff changeset
  2784
    ]
claus
parents: 124
diff changeset
  2785
6552
cfe2cf166508 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6470
diff changeset
  2786
    "Modified: / 01-12-1998 / 23:27:27 / cg"
cfe2cf166508 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6470
diff changeset
  2787
    "Modified: / 01-03-2019 / 16:10:46 / Claus Gittinger"
155
claus
parents: 151
diff changeset
  2788
! !
claus
parents: 151
diff changeset
  2789
1918
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2790
!SelectionInListView methodsFor:'focus handling'!
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2791
3423
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2792
showFocus:explicit
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2793
    self invalidateSelection.
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2794
    super showFocus:explicit
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2795
!
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2796
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2797
showNoFocus:explicit
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2798
    self invalidateSelection.
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2799
    super showNoFocus:explicit
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2800
!
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2801
1918
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2802
wantsFocusWithPointerEnter
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2803
    "return true, if I want the focus when
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2804
     the mouse pointer enters"
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2805
3306
5658bc68661e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3289
diff changeset
  2806
    (UserPreferences current focusFollowsMouse ~~ false
1918
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2807
    and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true)
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2808
    ]) ifTrue:[
6552
cfe2cf166508 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6470
diff changeset
  2809
        list size ~~ 0 ifTrue:[
2481
7b7985560ea7 take focus on pointer enter only if the list is not empty.
Claus Gittinger <cg@exept.de>
parents: 2446
diff changeset
  2810
            ^ true
7b7985560ea7 take focus on pointer enter only if the list is not empty.
Claus Gittinger <cg@exept.de>
parents: 2446
diff changeset
  2811
        ]
1918
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2812
    ].
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2813
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2814
    ^ false
6552
cfe2cf166508 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6470
diff changeset
  2815
cfe2cf166508 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6470
diff changeset
  2816
    "Modified: / 01-03-2019 / 16:10:50 / Claus Gittinger"
1918
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2817
! !
3ac07b97b4f7 use extra query: #wantsFocusWithPointerEnter;
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2818
5481
6eeeb8d2dabf #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5429
diff changeset
  2819
!SelectionInListView methodsFor:'help'!
6eeeb8d2dabf #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5429
diff changeset
  2820
6257
67c2af78181e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6191
diff changeset
  2821
helpTextAt:aPoint
6185
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2822
    "ask the line for its help text"
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2823
     
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2824
    |lineNr|
5481
6eeeb8d2dabf #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5429
diff changeset
  2825
6eeeb8d2dabf #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5429
diff changeset
  2826
    lineNr := self lineAtY:aPoint y.
5483
ae6277a36df5 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
  2827
    lineNr notNil ifTrue:[
6257
67c2af78181e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6191
diff changeset
  2828
        ^ self helpTextForLine:lineNr
5483
ae6277a36df5 #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5481
diff changeset
  2829
    ].
5481
6eeeb8d2dabf #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5429
diff changeset
  2830
    ^ nil
6185
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2831
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2832
    "Modified (comment): / 18-07-2017 / 13:32:04 / cg"
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2833
!
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2834
6257
67c2af78181e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6191
diff changeset
  2835
helpTextForLine:lineNr
6185
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2836
    "the fallback here is to ask the item if it is not a string,
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2837
     otherwise, return the full label string
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2838
     for lines which are clipped (longer than the view's width)"
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2839
     
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2840
    |item len text|
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2841
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2842
    item := self at:lineNr.
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2843
    item isString ifFalse:[
6257
67c2af78181e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6191
diff changeset
  2844
        text := item perform:#helpText ifNotUnderstood:nil.
6185
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2845
        text notNil ifTrue:[
6333
f7ff21d8cf9c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6322
diff changeset
  2846
            ^ text asString withoutSeparators
6185
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2847
        ].    
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2848
    ].
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2849
    
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2850
    len := self widthOfLine:lineNr.
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2851
    len > width ifTrue:[
6333
f7ff21d8cf9c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6322
diff changeset
  2852
        text := (self listAt:lineNr) asString 
f7ff21d8cf9c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6322
diff changeset
  2853
                    copy
f7ff21d8cf9c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6322
diff changeset
  2854
                        replaceAllForWhich:#isSeparator with:(Character space).
f7ff21d8cf9c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6322
diff changeset
  2855
                        "/ collect:[:ch | ch isSeparator ifTrue:[$ ] ifFalse:[ch]]  
f7ff21d8cf9c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6322
diff changeset
  2856
        ^ text withoutSeparators
6185
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2857
    ].      
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2858
    ^ nil
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2859
11a10868443b #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 6168
diff changeset
  2860
    "Created: / 18-07-2017 / 13:31:36 / cg"
6333
f7ff21d8cf9c #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 6322
diff changeset
  2861
    "Modified: / 08-06-2018 / 10:43:44 / Claus Gittinger"
5481
6eeeb8d2dabf #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5429
diff changeset
  2862
! !
6eeeb8d2dabf #BUGFIX
Claus Gittinger <cg@exept.de>
parents: 5429
diff changeset
  2863
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2864
!SelectionInListView methodsFor:'initialization'!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2865
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2866
fetchDeviceResources
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2867
    "fetch device colors, to avoid reallocation at redraw time"
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2868
4913
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2869
    |graphicsDevice|
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2870
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2871
    super fetchDeviceResources.
5639
d1d2cc8baa30 device access
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
  2872
    graphicsDevice := device.
4913
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2873
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2874
    hilightFgColor notNil ifTrue:[hilightFgColor := hilightFgColor onDevice:graphicsDevice].
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2875
    hilightBgColor notNil ifTrue:[hilightBgColor := hilightBgColor onDevice:graphicsDevice].
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2876
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2877
    halfIntensityFgColor notNil ifTrue:[halfIntensityFgColor := halfIntensityFgColor onDevice:graphicsDevice].
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2878
    hilightFrameColor    notNil ifTrue:[hilightFrameColor := hilightFrameColor onDevice:graphicsDevice].
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2879
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2880
    hilightFgColorNoFocus notNil ifTrue:[hilightFgColorNoFocus := hilightFgColorNoFocus onDevice:graphicsDevice].
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2881
    hilightBgColorNoFocus notNil ifTrue:[hilightBgColorNoFocus := hilightBgColorNoFocus onDevice:graphicsDevice].
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2882
!
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2883
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2884
initCursor
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2885
    "set the cursor - a hand"
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2886
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2887
    cursor := Cursor hand
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2888
!
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2889
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2890
initStyle
968
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
  2891
    "setup viewStyle specifics"
ba32bbfb7aad commentary
Claus Gittinger <cg@exept.de>
parents: 965
diff changeset
  2892
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2893
    super initStyle.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2894
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2895
    bgColor := viewBackground.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2896
    hilightFrameColor := nil.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2897
    hilightLevel := 0.
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2898
    hilightStyle := DefaultHilightStyle.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2899
    arrowLevel := 1.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2900
    smallArrow := false.
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2901
5639
d1d2cc8baa30 device access
Claus Gittinger <cg@exept.de>
parents: 5537
diff changeset
  2902
    device hasGrayscales ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2903
        "
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2904
         must get rid of these hard codings
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2905
        "
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2906
        (hilightStyle == #next) ifTrue:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2907
            hilightFgColor := fgColor.
4913
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2908
            hilightBgColor := self whiteColor.
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2909
            hilightFrameColor := fgColor
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2910
        ] ifFalse:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2911
            (hilightStyle == #motif) ifTrue:[
4913
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2912
                fgColor := self whiteColor.
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2913
                bgColor := Grey.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2914
                viewBackground := bgColor.
4913
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  2915
                hilightFgColor := bgColor  "fgColor" "self whiteColor".
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2916
                hilightBgColor := fgColor "bgColor lightened" "darkened".
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2917
            ] ifFalse:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2918
                (hilightStyle == #openwin) ifTrue:[
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2919
                    hilightFgColor := fgColor.
5100
9353eebbe50f class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4971
diff changeset
  2920
                    hilightBgColor := Color gray.
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2921
                    smallArrow := true.
1634
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
  2922
                ] ifFalse:[
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
  2923
                    (hilightStyle == #win95) ifTrue:[
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
  2924
                        smallArrow := true.
e0d964c84f23 win95 look fix
Claus Gittinger <cg@exept.de>
parents: 1620
diff changeset
  2925
                    ]
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2926
                ]
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2927
            ]
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2928
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2929
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2930
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2931
    hilightFgColor isNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2932
        hilightFgColor := bgColor.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2933
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2934
    hilightBgColor isNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2935
        hilightBgColor := fgColor.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2936
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2937
    DefaultForegroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2938
        fgColor := DefaultForegroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2939
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2940
    DefaultBackgroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2941
        bgColor := viewBackground := DefaultBackgroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2942
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2943
    DefaultHilightForegroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2944
        hilightFgColor := DefaultHilightForegroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2945
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2946
    DefaultHilightBackgroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2947
        hilightBgColor := DefaultHilightBackgroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2948
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2949
    DefaultHilightFrameColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2950
        hilightFrameColor := DefaultHilightFrameColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2951
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2952
    DefaultHilightLevel notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2953
        hilightLevel := DefaultHilightLevel
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2954
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2955
    DefaultRightArrowLevel notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2956
        arrowLevel := DefaultRightArrowLevel
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2957
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2958
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2959
    DefaultShadowColor notNil ifTrue:[
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2960
        shadowColor := DefaultShadowColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2961
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2962
    DefaultLightColor notNil ifTrue:[
941
f06fa4d47f26 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 898
diff changeset
  2963
        lightColor := DefaultLightColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2964
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2965
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2966
    (hilightLevel abs > 0) ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2967
        lineSpacing := 3
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2968
    ] ifFalse:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2969
        lineSpacing := 2
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2970
    ].
4575
051746528aae class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  2971
    #hack.
051746528aae class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  2972
    "/ q&d temporary hack.
051746528aae class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  2973
    "/ X11 fonts are currently so ugly... add more spacing.
6648
74e5ad248df1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6646
diff changeset
  2974
    device isX11Platform ifTrue:[
4575
051746528aae class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  2975
        lineSpacing := lineSpacing + 3.
051746528aae class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4535
diff changeset
  2976
    ].
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2977
    hilightFgColor isNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2978
        hilightFgColor := bgColor.
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2979
        hilightBgColor := fgColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2980
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2981
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2982
    DefaultDisabledForegroundColor notNil ifTrue:[
510
69259a0d7c07 better motif-style hilighting
Claus Gittinger <cg@exept.de>
parents: 490
diff changeset
  2983
        halfIntensityFgColor := DefaultDisabledForegroundColor
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2984
    ] ifFalse:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
  2985
        halfIntensityFgColor := Color darkGray.
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2986
    ].
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  2987
5674
7a82399d403b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5666
diff changeset
  2988
    hilightFgColorNoFocus := DefaultHilightForegroundColorNoFocus.
3423
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2989
    hilightFgColorNoFocus isNil ifTrue:[
5674
7a82399d403b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5666
diff changeset
  2990
        hilightFgColorNoFocus := hilightFgColor slightlyLightened.
3423
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2991
    ].
5674
7a82399d403b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5666
diff changeset
  2992
    hilightBgColorNoFocus := DefaultHilightBackgroundColorNoFocus.
3423
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2993
    hilightBgColorNoFocus isNil ifTrue:[
5674
7a82399d403b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5666
diff changeset
  2994
        hilightBgColorNoFocus := hilightBgColor slightlyLightened.
7a82399d403b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5666
diff changeset
  2995
    ]
3423
ea51036f2083 highlight selection dependent on has focus
ca
parents: 3306
diff changeset
  2996
4324
ef15f29888ad comment: #initStyle
az
parents: 4296
diff changeset
  2997
    "Modified: / 05-08-1998 / 00:00:00 / cg"
ef15f29888ad comment: #initStyle
az
parents: 4296
diff changeset
  2998
    "Modified (comment): / 05-10-2011 / 15:50:50 / az"
6648
74e5ad248df1 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6646
diff changeset
  2999
    "Modified: / 25-07-2019 / 12:31:49 / Claus Gittinger"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3000
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3001
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3002
initialize
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3003
    super initialize.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3004
3466
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  3005
    isButtonPressActive := false.
4578
9a81e7074007 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4575
diff changeset
  3006
    "/ fontHeight := font height + lineSpacing.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3007
    enabled := true.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3008
    ignoreReselect := true.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3009
    multipleSelectOk := toggleSelect := strikeOut := printItems := false.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3010
    useIndex := true.
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3011
    dragIsActive := allowDrag := false.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3012
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3013
    keyActionStyle := #select.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3014
    returnKeyActionStyle := #doubleClick.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3015
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3016
    listMsg := self class defaultListMessage.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3017
    initialSelectionMsg := self class defaultSelectionMessage.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3018
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3019
    "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
  3020
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3021
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3022
realize
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3023
    super realize.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3024
1068
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3025
    model notNil ifTrue:[
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3026
        self getSelectionFromModel.
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3027
    ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3028
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3029
    selection notNil ifTrue:[
1068
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3030
        selection isCollection ifTrue:[
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3031
            selection notEmpty ifTrue:[
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3032
                self makeLineVisible:selection first
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3033
            ]
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3034
        ] ifFalse:[
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3035
            self makeLineVisible:selection
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3036
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3037
    ].
1068
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3038
c977751d66bf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1045
diff changeset
  3039
    "Modified: 27.2.1997 / 14:23:40 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  3040
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  3041
5121
f3bc3a3c7eba class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
  3042
!SelectionInListView methodsFor:'native widget support'!
f3bc3a3c7eba class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
  3043
f3bc3a3c7eba class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
  3044
nativeWindowType
f3bc3a3c7eba class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
  3045
    "return a symbol describing my native window type 
5537
362ae978ac0c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5514
diff changeset
  3046
     (may be used internally by the device as a native window creation hint,
362ae978ac0c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 5514
diff changeset
  3047
      if the device supports native windows)"
5121
f3bc3a3c7eba class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
  3048
f3bc3a3c7eba class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
  3049
    ^ #SelectionInListView
f3bc3a3c7eba class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
  3050
! !
f3bc3a3c7eba class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5110
diff changeset
  3051
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3052
!SelectionInListView methodsFor:'private'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3053
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3054
argForChangeMessage
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3055
    "return the argument for a selectionChange;
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3056
     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
  3057
     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
  3058
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3059
    useIndex ~~ false ifTrue:[  "/ i.e. everything except false
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3060
        self multipleSelectOk ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3061
            selection isNil ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3062
                ^ #() 
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3063
            ].
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3064
        ].
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3065
        ^ selection
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
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3068
    printItems ifFalse:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3069
        ^ self selectionValue
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3070
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3071
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3072
    items notNil ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3073
        self multipleSelectOk ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3074
            ^ selection collect:[:nr | items at:nr]
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3075
        ].
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3076
        ^ items at:selection
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3077
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3078
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3079
    ^ nil       "/ cannot happen
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3080
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3081
    "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
  3082
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3083
2187
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3084
characterSearchItemStringAt:lineNr
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3085
    "for first-character search:
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3086
     return a lines item-string.
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3087
     For multi-col items, this may be different from the actual string"
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3088
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3089
    |item s|
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3090
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3091
    item := self at:lineNr.
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3092
    item isNil ifTrue:[^ nil].
2702
1c385145ab46 Convert Object>>errorSignal -> Error
Stefan Vogel <sv@exept.de>
parents: 2684
diff changeset
  3093
    (Error catch:[
2187
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3094
       s := item asString
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3095
    ]) ifTrue:[
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3096
       s := item displayString
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3097
    ].
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3098
    ^ s
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3099
!
b5bfc9d40650 allow for subclasses to redefine character search
Claus Gittinger <cg@exept.de>
parents: 2169
diff changeset
  3100
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3101
checkRemovingSelection:lineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3102
    "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
  3103
4478
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  3104
    self checkRemovingSelectionFrom:lineNr to:lineNr
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  3105
!
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  3106
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  3107
checkRemovingSelectionFrom:startNr to:endNr
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  3108
    "when a range of lines is removed, we have to adjust the selection"
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  3109
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3110
    |newSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3111
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3112
    selection notNil ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3113
        self multipleSelectOk ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3114
            newSelection := OrderedCollection new.
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3115
            selection do:[:sel |
4478
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  3116
                sel < startNr ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3117
                    newSelection add:sel
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3118
                ] ifFalse:[
4478
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  3119
                    sel > endNr ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3120
                        newSelection add:(sel - 1)
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3121
                    ]
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3122
                    "otherwise remove it from the selection"
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3123
                ]
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3124
            ].
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3125
            newSelection size == 0 ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3126
                selection := nil
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3127
            ] ifFalse:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3128
                selection := newSelection
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3129
            ]
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3130
        ] ifFalse:[
4478
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  3131
            (selection between:startNr and:endNr) ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3132
                selection := nil
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3133
            ] ifFalse:[
4478
bb0095a3eae7 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4477
diff changeset
  3134
                selection > endNr ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3135
                    selection := selection - 1
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3136
                ]
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3137
            ]
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3138
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3139
    ]
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3140
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3141
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3142
getListFromModel
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3143
    "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
  3144
     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
  3145
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3146
    |text msg|
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3147
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3148
    listChannel notNil ifTrue:[
1345
f3a4b2caee55 catch change notifuications assigned to list:
ca
parents: 1323
diff changeset
  3149
        items := listChannel value copy
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3150
    ] ifFalse:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3151
        (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
  3152
            ^ self
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3153
        ].
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3154
        items := model perform:msg.
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3155
    ].
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3156
    items notNil ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3157
        printItems ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3158
            text := items collect:[:element | element printString]
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3159
        ] ifFalse:[
4153
0ab9d09911e6 fixed: #getListFromModel
sr
parents: 4135
diff changeset
  3160
            text := items.
0ab9d09911e6 fixed: #getListFromModel
sr
parents: 4135
diff changeset
  3161
            items := nil.
587
19deffec383d if there is no listMessage, try aspect to get models text
Claus Gittinger <cg@exept.de>
parents: 586
diff changeset
  3162
        ].
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3163
        text notNil ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3164
            text isSequenceable ifFalse:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3165
                text := text asOrderedCollection
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3166
            ]
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3167
        ]
105
3d064ba4a0cc *** empty log message ***
claus
parents: 97
diff changeset
  3168
    ].
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3169
    self list:text keepSelection:true. "/ expandTabs:false
4153
0ab9d09911e6 fixed: #getListFromModel
sr
parents: 4135
diff changeset
  3170
0ab9d09911e6 fixed: #getListFromModel
sr
parents: 4135
diff changeset
  3171
    "Modified: / 29-06-2010 / 16:14:14 / sr"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3172
!
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
getSelectionFromModel
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3175
    "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
  3176
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3177
    |sel|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3178
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3179
    model notNil ifTrue:[
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3180
        listChannel notNil ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3181
            sel := model value.
1813
7f51dc0341a6 oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  3182
            sel isNil ifTrue:[
7f51dc0341a6 oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  3183
                self deselect.
7f51dc0341a6 oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  3184
                ^ self
7f51dc0341a6 oops - did not unselect if model was changed to nil.
Claus Gittinger <cg@exept.de>
parents: 1796
diff changeset
  3185
            ]
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3186
        ] ifFalse:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3187
            initialSelectionMsg isNil ifTrue:[^ self].
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  3188
            sel := model perform:initialSelectionMsg.
1310
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3189
        ].
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3190
        (useIndex or:[sel isNumber]) ifTrue:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3191
            self setSelection:sel 
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3192
        ] ifFalse:[
bd6ad7f1fda9 suports a listHolder and a model which only
ca
parents: 1299
diff changeset
  3193
            self setSelectElement:sel.
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  3194
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3195
    ].
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  3196
3424
85f9ca6a0dce oops - must care for items being different from the list.
Claus Gittinger <cg@exept.de>
parents: 3423
diff changeset
  3197
    "Modified: / 08-11-2006 / 19:46:33 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3198
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3199
5373
a95a624e0ae9 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5354
diff changeset
  3200
highlightLineSpacing
a95a624e0ae9 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5354
diff changeset
  3201
    "true if the spacing between lines is to be drawn with selected color,
a95a624e0ae9 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5354
diff changeset
  3202
     false if it remains white.
a95a624e0ae9 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5354
diff changeset
  3203
     false for selection in list views; true for edit/text views"
a95a624e0ae9 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5354
diff changeset
  3204
a95a624e0ae9 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5354
diff changeset
  3205
    ^ false
a95a624e0ae9 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5354
diff changeset
  3206
!
a95a624e0ae9 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5354
diff changeset
  3207
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3208
isValidSelection:aNumberOrCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3209
    "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
  3210
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3211
    |sz|
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3212
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3213
    aNumberOrCollection isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3214
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3215
    sz := self size.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3216
    (aNumberOrCollection isCollection) ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3217
        self multipleSelectOk ifFalse:[^ false].
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3218
        aNumberOrCollection do:[:index |
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3219
            (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
  3220
            (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
  3221
        ].
125
claus
parents: 124
diff changeset
  3222
    ] ifFalse:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3223
        (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
  3224
        (self lineIsEnabled:aNumberOrCollection) ifFalse:[^ false].
63
f4eaf04d1eaf *** empty log message ***
claus
parents: 60
diff changeset
  3225
    ].
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3226
    ^ true.
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3227
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3228
    "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
  3229
!
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3230
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3231
lineIsEnabled:lineNr
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3232
    ^ (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
  3233
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3234
    "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
  3235
!
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
positionToSelectionX:x y:y
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3238
    "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
  3239
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3240
    (x between:0 and:width) ifTrue:[
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  3241
        (y between:0 and:height) ifTrue:[
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  3242
            ^ self lineAtY:y
4601
1fafc57c47f4 Fix stc compiler warnings
Stefan Vogel <sv@exept.de>
parents: 4599
diff changeset
  3243
            "/ ^ self visibleLineToListLine:(self visibleLineOfY:y)
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  3244
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3245
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3246
    ^ nil
125
claus
parents: 124
diff changeset
  3247
!
claus
parents: 124
diff changeset
  3248
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3249
scrollSelectDown
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3250
    "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
  3251
6661
7644f244d2ac #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 6648
diff changeset
  3252
    self scrollDownLines:(self device shiftDown ifTrue:[10] ifFalse:[1]).
6821
cc88f681757a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6785
diff changeset
  3253
    self sceduleNextAutoScroll.
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  3254
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  3255
    "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
  3256
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3257
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3258
scrollSelectUp
6661
7644f244d2ac #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 6648
diff changeset
  3259
    "auto scroll action; 
7644f244d2ac #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 6648
diff changeset
  3260
     scroll and reinstall timed-block"
7644f244d2ac #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 6648
diff changeset
  3261
7644f244d2ac #UI_ENHANCEMENT by exept
Claus Gittinger <cg@exept.de>
parents: 6648
diff changeset
  3262
    self scrollUpLines:(self device shiftDown ifTrue:[10] ifFalse:[1]).
6821
cc88f681757a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6785
diff changeset
  3263
    self sceduleNextAutoScroll.
cc88f681757a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6785
diff changeset
  3264
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3265
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3266
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3267
selectOrToggleAtX:x y:y
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3268
    self selectOrToggleAtX:x y:y forRightClickMenu:false
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3269
!
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3270
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3271
selectOrToggleAtX:x y:y forRightClickMenu:forRightClickMenu
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3272
    |oldSelection listLineNr|
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3273
2318
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  3274
    selectMode := nil.
2413
2a72970c1da8 use #lineAtY:
Claus Gittinger <cg@exept.de>
parents: 2407
diff changeset
  3275
    listLineNr := self lineAtY:y. "/ self visibleLineToListLine:(self visibleLineOfY:y).
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3276
    listLineNr notNil ifTrue:[
2141
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  3277
        "/ this item selectable ?
a9f9956168b8 undid the last change - a single block is ok
Claus Gittinger <cg@exept.de>
parents: 2140
diff changeset
  3278
        (selectConditionBlock notNil 
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3279
         and:[(selectConditionBlock value:listLineNr) not]) ifTrue:[^ false].
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3280
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3281
        oldSelection := selection copy.
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3282
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3283
        forRightClickMenu ifTrue:[
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3284
            (self isInSelection:listLineNr) ifFalse:[
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3285
                self selectWithoutScroll:listLineNr.
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3286
                selectMode := false.
3917
4267c0a42fa9 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  3287
                (selection ~= oldSelection) ifTrue:[
4267c0a42fa9 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  3288
                    self selectionChangedFrom:oldSelection.
4267c0a42fa9 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  3289
                ].
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3290
            ].
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3291
        ] ifFalse:[
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3292
            (toggleSelect and:[self isInSelection:listLineNr]) ifTrue:[
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3293
                self removeFromSelection:listLineNr.
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3294
                selectMode := false.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3295
            ] ifFalse:[
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3296
                (self lineIsEnabled:listLineNr) ifFalse:[^ true].
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3297
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3298
                (toggleSelect and:[self multipleSelectOk]) ifTrue:[
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3299
                    self addToSelection:listLineNr
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3300
                ] ifFalse:[
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3301
                    self selectWithoutScroll:listLineNr.
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3302
                ].
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3303
                selectMode := true.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3304
            ].
3917
4267c0a42fa9 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  3305
            ((ignoreReselect not and:[selection notNil])
4267c0a42fa9 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  3306
             or:[selection ~= oldSelection]) ifTrue:[
4267c0a42fa9 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  3307
                self selectionChangedFrom:oldSelection.
4267c0a42fa9 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3912
diff changeset
  3308
            ].
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3309
        ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3310
        clickLine := listLineNr
3912
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3311
    ].
303733585541 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3879
diff changeset
  3312
    ^ true
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3313
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3314
    "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
  3315
    "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
  3316
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3317
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3318
visibleLineNeedsSpecialCare:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3319
    |listLine|
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
    listLine := self visibleLineToListLine:visLineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3322
    listLine isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3323
    (self isInSelection:listLine) ifTrue:[^ true].
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3324
    visualBlock notNil ifTrue:[^true].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3325
    listAttributes notNil ifTrue:[
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3326
        (listLine <= listAttributes size) ifTrue:[
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3327
            ^ (listAttributes at:listLine) notNil
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3328
        ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  3329
    ].
125
claus
parents: 124
diff changeset
  3330
    ^ false
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3331
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3332
    "Modified: / 21.6.1998 / 02:43:02 / cg"
125
claus
parents: 124
diff changeset
  3333
!
claus
parents: 124
diff changeset
  3334
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3335
widthForScrollBetween:start and:end
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3336
    "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
  3337
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3338
    | anySelectionInRange |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3339
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3340
    selection notNil ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3341
        self multipleSelectOk ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3342
            anySelectionInRange := false.
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3343
            selection do:[:s |
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3344
                (s between:start and:end) ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3345
                    anySelectionInRange := true
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3346
                ]
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3347
            ]
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3348
        ] ifFalse:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3349
            anySelectionInRange := selection between:start and:end
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3350
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3351
    ] ifFalse:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3352
        anySelectionInRange := false
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3353
    ].
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
    anySelectionInRange ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3356
        ^ width
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3357
"
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3358
        self is3D ifFalse:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3359
            ^ width 
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3360
        ].
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3361
        ( #(next openwin) includes:styleSheet name) ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3362
            ^ width 
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3363
        ].
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3364
        viewBackground = background ifFalse:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3365
            ^ width 
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3366
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3367
"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3368
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3369
    ^ super widthForScrollBetween:start and:end
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3370
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3371
2741
2f563c1ab4b7 method category rename
Claus Gittinger <cg@exept.de>
parents: 2739
diff changeset
  3372
!SelectionInListView methodsFor:'private-drag and drop'!
2563
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3373
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3374
collectionOfDragObjects
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3375
    "returns collection of dragable objects assigned to selection
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3376
     Here, by default, a collection of text-dragObjects is generated;
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3377
     however, if a dragObjectConverter is defined, that one gets a chance
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3378
     to convert as appropriate."
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3379
5248
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3380
    |collection indices converted|
2563
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3381
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3382
    collection := OrderedCollection new.
5248
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3383
    indices := OrderedCollection new.      
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3384
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3385
    self selectionDo:[:aNumber| 
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3386
        |text|
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3387
2563
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3388
        text := self at:aNumber.
5248
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3389
        collection add:(DropObject newText:text).
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3390
        indices add:aNumber.
2563
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3391
    ].
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3392
    dragObjectConverter notNil ifTrue:[
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3393
        converted := OrderedCollection new.
5248
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3394
        collection with:indices do:[:o :idx | 
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3395
            |convertedObject|
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3396
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3397
            convertedObject := dragObjectConverter value:o optionalArgument:idx.
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3398
            convertedObject notNil ifTrue:[
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3399
                converted add:convertedObject
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3400
            ]
6f6d361740c2 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5237
diff changeset
  3401
        ].
2563
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3402
        collection := converted
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3403
    ].
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3404
    ^ collection.
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3405
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3406
    "Modified: 6.4.1997 / 14:14:30 / cg"
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3407
! !
ffb88664908a Drag&Drop - remove unused stuff
Stefan Vogel <sv@exept.de>
parents: 2537
diff changeset
  3408
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3409
!SelectionInListView methodsFor:'queries'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3410
2597
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  3411
isCursorKeyConsumer
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  3412
    "return true, if the receiver can be controlled by cursor keys;
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  3413
     i.e. it can handle some keyboard input,
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  3414
     isCursorKeyConsumer are potential candidates for getting the keyboard
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  3415
     focus initially within dialogBoxes, or when the focus-follows-pointer
5237
0207715b9750 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5208
diff changeset
  3416
     mode is off."
2597
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  3417
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  3418
    ^ true
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  3419
!
feebf7ba0771 added #isCursorKeyConsumer (second chance initial focus in dialog)
Claus Gittinger <cg@exept.de>
parents: 2563
diff changeset
  3420
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3421
specClass
1379
04a05ed3f02e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  3422
    "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
  3423
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3424
    self class == SelectionInListView ifTrue:[^ SequenceViewSpec].
1045
a70450ed4d7d specClass query
ca
parents: 1010
diff changeset
  3425
    ^ super specClass
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3426
1379
04a05ed3f02e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  3427
    "Modified: / 5.9.1995 / 23:05:53 / claus"
04a05ed3f02e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1361
diff changeset
  3428
    "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
  3429
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3430
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3431
!SelectionInListView methodsFor:'redrawing'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3432
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3433
redrawElement:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3434
    "redraw an individual element"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3435
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3436
    ^ self redrawLine:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3437
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3438
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3439
redrawFromVisibleLine:startVisLineNr to:endVisLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3440
    "redraw a range of lines.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3441
     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
  3442
     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
  3443
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3444
    |special sel
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3445
     l1 "{ Class: SmallInteger }"
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3446
     l2 "{ Class: SmallInteger }"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3447
     selNo "{ Class: SmallInteger }" |
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3448
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3449
    ((selection isCollection) 
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3450
    or:[listAttributes notNil
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3451
    or:[visualBlock notNil
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3452
    or:[selectedVisualBlock notNil]]]) ifTrue:[
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3453
        "/ cannot do bulk-redraw ...
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3454
        l1 := startVisLineNr.
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3455
        l2 := endVisLineNr. 
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3456
        l1 to:l2 do:[:visLine |
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3457
            self redrawVisibleLine:visLine
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3458
        ].
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3459
        ^ self
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3460
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3461
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3462
"XXX only if -1/+1"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3463
"/    hilightLevel ~~ 0 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3464
"/     self paint:bgColor.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3465
"/     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
  3466
"/  ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3467
    special := true.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3468
    selection isNil ifTrue:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3469
        special := false
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3470
    ] ifFalse:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3471
        sel := self listLineToVisibleLine:selection.
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3472
        sel isNil ifTrue:[
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3473
            special := false
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3474
        ] ifFalse:[
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3475
            special := (sel between:startVisLineNr and:endVisLineNr)
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3476
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3477
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3478
    special ifFalse:[
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3479
      ^ super redrawFromVisibleLine:startVisLineNr to:endVisLineNr
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3480
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3481
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3482
    selNo := sel.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3483
    selNo > startVisLineNr ifTrue:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3484
        super redrawFromVisibleLine:startVisLineNr to:(selNo - 1)
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3485
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3486
    self redrawVisibleLine:selNo.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3487
    selNo < endVisLineNr ifTrue:[
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3488
        super redrawFromVisibleLine:(selNo + 1) to:endVisLineNr
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3489
    ]
393
c7aa164d2122 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
  3490
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3491
    "Modified: / 21.6.1998 / 02:42:17 / cg"
125
claus
parents: 124
diff changeset
  3492
!
claus
parents: 124
diff changeset
  3493
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3494
redrawVisibleLine:visLineNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3495
    "redraw a single line.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3496
     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
  3497
     Otherwise draw using supers method."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3498
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3499
    |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
  3500
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3501
    fg := fgColor.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3502
    bg := bgColor.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3503
    listLine := self visibleLineToListLine:visLineNr.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3504
    listLine notNil ifTrue:[
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3505
        (self isInSelection:listLine) ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3506
            ^ self drawVisibleLineSelected:visLineNr
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3507
        ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3508
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3509
        visualBlock notNil ifTrue:[
2290
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  3510
            y := self yOfVisibleLine:visLineNr.
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  3511
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  3512
            backgroundAlreadyClearedColor == bg ifFalse:[
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  3513
                gc paint:bg.
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  3514
                gc fillRectangleX:margin y:y - (lineSpacing//2)
2290
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  3515
                              width:(width - (2 * margin)) 
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  3516
                             height:fontHeight.
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  3517
            ].
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  3518
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3519
            dObj := visualBlock value:self value:listLine.
6054
2dd9fc1c0bff #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5992
diff changeset
  3520
            gc paint:fg on:bg.
4913
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  3521
            dObj displayOn:self x:(textStartLeft - viewOrigin) x y:y + gc font ascent opaque:true.
1600
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3522
            ^ self
bc8ba748da8a handle visualBlock / selectedVisualBlock (ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents: 1513
diff changeset
  3523
        ].
2290
1c602645fc3a visualBlock / selectedVisualBlock drawing fixed
Claus Gittinger <cg@exept.de>
parents: 2264
diff changeset
  3524
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3525
        listAttributes notNil ifTrue:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3526
            ((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
  3527
            or:[ (self lineIsEnabled:listLine) not ]) ifTrue:[
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3528
                fg := halfIntensityFgColor
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3529
            ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3530
            (self line:listLine hasAttribute:#bold) ifTrue:[
4913
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  3531
                newFont := gc font asBold.
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  3532
                (gc font bold 
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  3533
                or:[id := (newFont onDevice:gc device) fontId.
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3534
                    id isNil]) 
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3535
                ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3536
                    "
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3537
                     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
  3538
                     or no such font is available   
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3539
                    "
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3540
                    fgColor brightness > 0.5 ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3541
                        fg := fgColor darkened "darkened". 
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3542
                    ] ifFalse:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3543
                        fg := fgColor lightened "lightened"
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3544
                    ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3545
                    (fg brightness - bg brightness) abs < 0.25 ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3546
                        bgColor brightness > 0.5 ifTrue:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3547
                            fg := fg darkened. 
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3548
                        ] ifFalse:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3549
                            fg := fg lightened
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3550
                        ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3551
                    ]
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3552
                ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3553
                id notNil ifTrue:[
4913
b9b5c65a6e2f class: SelectionInListView
Stefan Vogel <sv@exept.de>
parents: 4860
diff changeset
  3554
                    oldFont := gc font.
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3555
                    self basicFont:newFont.
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3556
                    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
  3557
                    self basicFont:oldFont.
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3558
                ] ifFalse:[
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3559
                    self drawVisibleLine:visLineNr with:fg and:bg.
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3560
                ].
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3561
                ^ self
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3562
            ]
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3563
        ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3564
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3565
    ^ self drawVisibleLine:visLineNr with:fg and:bg
384
0f2676690760 fixed boldify when replacementFonts are involved
Claus Gittinger <cg@exept.de>
parents: 364
diff changeset
  3566
4153
0ab9d09911e6 fixed: #getListFromModel
sr
parents: 4135
diff changeset
  3567
    "Modified: / 08-08-1998 / 03:42:13 / cg"
0ab9d09911e6 fixed: #getListFromModel
sr
parents: 4135
diff changeset
  3568
    "Modified: / 29-06-2010 / 16:16:03 / sr"
125
claus
parents: 124
diff changeset
  3569
!
claus
parents: 124
diff changeset
  3570
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3571
redrawVisibleLine:visLineNr col:colNr
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3572
    "redraw a single character.
6103
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3573
     Must check, if it's in the selection and handle this case."
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3574
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3575
    (self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[
6103
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3576
        ^ self redrawVisibleLine:visLineNr
320
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
    super redrawVisibleLine:visLineNr col:colNr
6103
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3579
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3580
    "Modified (comment): / 13-02-2017 / 20:30:07 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3581
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3582
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3583
redrawVisibleLine:visLineNr from:startCol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3584
    "redraw from a col to the right end.
6103
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3585
     Must check, if it's in the selection and handle this case."
320
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
    (self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[
6103
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3588
        ^ self redrawVisibleLine:visLineNr
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3589
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3590
    super redrawVisibleLine:visLineNr from:startCol
6103
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3591
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3592
    "Modified (comment): / 13-02-2017 / 20:30:10 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3593
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3594
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3595
redrawVisibleLine:visLineNr from:startCol to:endCol
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3596
    "redraw from a startCol to endCol.
6103
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3597
     Must check, if it's in the selection and handle this case."
320
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
    (self visibleLineNeedsSpecialCare:visLineNr) ifTrue:[
6103
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3600
        ^ self redrawVisibleLine:visLineNr
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3601
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3602
    super redrawVisibleLine:visLineNr from:startCol to:endCol
6103
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3603
8e5af0e7851e #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 6073
diff changeset
  3604
    "Modified (comment): / 13-02-2017 / 20:30:13 / cg"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3605
! !
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3606
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3607
!SelectionInListView methodsFor:'selections'!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3608
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3609
deselect
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3610
    "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
  3611
     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
  3612
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3613
    self selection:nil
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3614
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3615
    "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
  3616
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3617
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3618
deselectWithoutRedraw
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3619
    "deselect without redraw or notifications.
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3620
     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
  3621
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3622
    selection := nil
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3623
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3624
    "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
  3625
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3626
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3627
expandSelectionToX:x y:y
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3628
    "used with button-motion and shift-press;
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3629
     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
  3630
     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
  3631
2738
d8cf5b3e84ed better expandSelectionCode.
Claus Gittinger <cg@exept.de>
parents: 2730
diff changeset
  3632
    |movedLine delta newSelection|
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3633
4758
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3634
    self multipleSelectOk ifFalse:[^ self].
5317
36f70ec8280a class: SelectionInListView
ca
parents: 5248
diff changeset
  3635
    "D120784 - WB when invoked without any selection"
36f70ec8280a class: SelectionInListView
ca
parents: 5248
diff changeset
  3636
    selection size == 0 ifTrue:[^ self].
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3637
997
615a5a19c5bf specClass
ca
parents: 988
diff changeset
  3638
    movedLine := self visibleLineToAbsoluteLine:(self visibleLineOfY:y).
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3639
4758
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3640
    clickLine isNil ifTrue:[
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3641
        selection size == 1 ifTrue:[
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3642
            clickLine := selection first.
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3643
        ] ifFalse:[
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3644
            movedLine > selection max ifTrue:[
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3645
                clickLine := selection max
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3646
            ] ifFalse:[
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3647
                movedLine < selection min ifTrue:[
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3648
                    clickLine := selection min
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3649
                ].
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3650
            ]
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3651
        ].
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3652
        clickLine isNil ifTrue:[
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3653
            ^ self
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3654
        ].
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3655
    ].
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3656
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3657
    selectionAtClickTime isNil ifTrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3658
        selectionAtClickTime := selection copy.
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3659
    ].
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3660
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3661
    newSelection := selectionAtClickTime copy.
5657
57b354293970 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  3662
    newSelection isNil ifTrue:[
57b354293970 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  3663
        newSelection := OrderedCollection new.
57b354293970 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  3664
    ] ifFalse:[
57b354293970 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  3665
        newSelection := newSelection asOrderedCollection.
57b354293970 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  3666
    ].    
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3667
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3668
    "/ compute new selection
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3669
    delta  := (clickLine < movedLine) ifTrue:[1] ifFalse:[-1].
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3670
    clickLine to:movedLine by:delta do:[:ln |
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3671
        |isSelected doSelect doUnselect|
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3672
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3673
        doSelect := doUnselect := false.
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3674
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3675
        isSelected := self is:ln inSelection:selectionAtClickTime.
4758
734f7f03e95c class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4719
diff changeset
  3676
        (selectMode ? true) == true ifTrue:[
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3677
            doSelect := isSelected not
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3678
        ] ifFalse:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3679
            selectMode == false ifTrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3680
                doUnselect := isSelected
2738
d8cf5b3e84ed better expandSelectionCode.
Claus Gittinger <cg@exept.de>
parents: 2730
diff changeset
  3681
            ] ifFalse:[
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3682
                selectMode == #toggle ifTrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3683
                    doUnselect := isSelected.
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3684
                    doSelect := doUnselect not.
2334
94cdb9b2d1f9 avoid bad list update due to automatically lost selection
Claus Gittinger <cg@exept.de>
parents: 2330
diff changeset
  3685
                ]
2738
d8cf5b3e84ed better expandSelectionCode.
Claus Gittinger <cg@exept.de>
parents: 2730
diff changeset
  3686
            ]
d8cf5b3e84ed better expandSelectionCode.
Claus Gittinger <cg@exept.de>
parents: 2730
diff changeset
  3687
        ].
d8cf5b3e84ed better expandSelectionCode.
Claus Gittinger <cg@exept.de>
parents: 2730
diff changeset
  3688
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3689
        doSelect ifTrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3690
            newSelection add:ln.
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3691
        ] ifFalse:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3692
            doUnselect ifTrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3693
                newSelection remove:ln.
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3694
            ]
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3695
        ]
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3696
    ].
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3697
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3698
    newSelection ~= selection ifTrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  3699
        self selection:newSelection.
882
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3700
    ].
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3701
2115
c994e244b8cf with multipleSelectOK, also expand/shrink the seletction
Claus Gittinger <cg@exept.de>
parents: 2102
diff changeset
  3702
    "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
  3703
    "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
  3704
!
38df470ab769 shift-button now expands a selection blockWise;
Claus Gittinger <cg@exept.de>
parents: 869
diff changeset
  3705
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3706
firstInSelection
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3707
    "return the index of the first selected line - nil if there is no selection"
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3708
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3709
    selection isNil ifTrue:[^ nil].
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3710
    selection isCollection ifTrue:[
5208
c3639557ee1a class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5207
diff changeset
  3711
        selection isEmpty ifTrue:[
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3712
            ^ nil
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3713
        ].
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3714
        ^ selection min
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3715
    ].
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3716
    ^ selection
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3717
!
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3718
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3719
hasSelection
6260
69259ae49d3f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 6257
diff changeset
  3720
    "return true, if an item is selected"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3721
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3722
    self multipleSelectOk ifTrue:[
6552
cfe2cf166508 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6470
diff changeset
  3723
        ^ selection size ~~ 0
2407
bbf31d2267ea fixed #hasSelection with multipleSelectOk
Claus Gittinger <cg@exept.de>
parents: 2401
diff changeset
  3724
    ].
6552
cfe2cf166508 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6470
diff changeset
  3725
    ^ selection notNil
cfe2cf166508 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6470
diff changeset
  3726
cfe2cf166508 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6470
diff changeset
  3727
    "Modified: / 01-03-2019 / 16:10:40 / Claus Gittinger"
125
claus
parents: 124
diff changeset
  3728
!
claus
parents: 124
diff changeset
  3729
2318
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  3730
is:aNumber inSelection:aSelection
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  3731
    "return true, if line, aNumber is in the selection"
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  3732
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  3733
    aSelection isNil ifTrue:[^ false].
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3734
    self multipleSelectOk ifTrue:[
2318
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  3735
        ^ (aSelection includes:aNumber)
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  3736
    ].
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  3737
    ^ (aNumber == aSelection)
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  3738
!
d4bea07df2cd fixed multi-select extension (i.e. press-motion)
Claus Gittinger <cg@exept.de>
parents: 2314
diff changeset
  3739
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3740
isInSelection:aNumber
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3741
    "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
  3742
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3743
    selection isNil ifTrue:[^ false].
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3744
    self multipleSelectOk ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3745
        ^ (selection includes:aNumber)
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3746
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3747
    ^ (aNumber == selection)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3748
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3749
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3750
lastInSelection
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3751
    "return the index of the last selected line - nil if there is no selection"
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3752
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3753
    selection isNil ifTrue:[^ nil].
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3754
    selection isCollection ifTrue:[
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3755
        selection size == 0 ifTrue:[
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3756
            ^ nil
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3757
        ].
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3758
        ^ selection max
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3759
    ].
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3760
    ^ selection
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3761
!
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3762
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3763
makeSelectionVisible
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3764
    "scroll to make the selection line visible"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3765
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3766
    |line|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3767
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3768
    selection notNil ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3769
        self multipleSelectOk ifTrue:[
2148
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3770
            selection isEmpty ifTrue:[^ self].
5956
649159a0d63a #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5864
diff changeset
  3771
            "/ don't move, if any in the selection isVisible
2148
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3772
            selection do:[:aSelectedLine |
6646
e2c1a572a33e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6552
diff changeset
  3773
                (self isLineFullyVisible:aSelectedLine) ifTrue:[
2148
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3774
                    ^ self
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3775
                ]
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3776
            ].
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3777
            line := selection first.
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3778
        ] ifFalse:[
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3779
            line := selection
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3780
        ].
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3781
        self makeLineVisible:line 
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3782
    ]
2148
a3077508aaa6 do not scroll in makeSelectionVisible
Claus Gittinger <cg@exept.de>
parents: 2142
diff changeset
  3783
6646
e2c1a572a33e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6552
diff changeset
  3784
    "Modified: / 24-02-2000 / 17:48:00 / cg"
e2c1a572a33e #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 6552
diff changeset
  3785
    "Modified: / 20-07-2019 / 07:51:08 / Claus Gittinger"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3786
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3787
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3788
nextAfterSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3789
    "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
  3790
     Wrap at end."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3791
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3792
    ^ self nextSelectableAfter:selection
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3793
!
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3794
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3795
nextSelectableAfter:indexOrIndexCollection
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3796
    "return the index of the next selectable entry after the indexOrIndexCollection.
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3797
     Wrap at end."
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3798
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3799
    |next sz|
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3800
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3801
    indexOrIndexCollection isNil ifTrue:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3802
        next := firstLineShown
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3803
    ] ifFalse:[
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3804
        indexOrIndexCollection isCollection ifTrue:[
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3805
            indexOrIndexCollection size == 0 ifTrue:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3806
                next := firstLineShown
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3807
            ] ifFalse:[
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3808
                next := indexOrIndexCollection max + 1
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3809
            ]
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3810
        ] ifFalse:[
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3811
            next := indexOrIndexCollection + 1
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3812
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3813
    ].
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3814
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3815
    (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
  3816
        sz := self size.
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3817
        next > sz ifTrue:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3818
            next := 1.
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3819
        ] ifFalse:[
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3820
            [next <= sz
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3821
             and:[(self isValidSelection:next) not ]] whileTrue:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3822
                next := next + 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3823
            ].
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3824
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3825
    ].
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3826
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3827
    (self isValidSelection:next) ifFalse:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3828
        next := nil
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3829
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3830
    ^ next
1640
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3831
1ddc9c17b4bf skip over disabled lines, when moving selection via cursor keys.
Claus Gittinger <cg@exept.de>
parents: 1638
diff changeset
  3832
    "Modified: / 8.8.1998 / 03:36:55 / cg"
125
claus
parents: 124
diff changeset
  3833
!
claus
parents: 124
diff changeset
  3834
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3835
numberOfSelections
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3836
    "return the number of selected entries"
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3837
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3838
    |sz|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3839
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3840
    selection isNil ifTrue:[^ 0].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3841
    sz := selection size.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3842
    sz > 0 ifTrue:[^ sz].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3843
    ^ 1
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3844
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3845
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3846
previousBeforeSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3847
    "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
  3848
     Wrap at beginning."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3849
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3850
    ^ self previousSelectableBefore:selection
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3851
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3852
!
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3853
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3854
previousSelectableBefore:indexOrIndexCollection
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3855
    "return the index of the previous selectable entry before the indexOrIndexCollection.
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3856
     Wrap at beginning."
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3857
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3858
    |prev|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3859
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3860
    indexOrIndexCollection isNil ifTrue:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3861
        prev := firstLineShown - 1 
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3862
    ] ifFalse:[
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3863
        indexOrIndexCollection isCollection ifTrue:[
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3864
            indexOrIndexCollection size == 0 ifTrue:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3865
                prev := firstLineShown - 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3866
            ] ifFalse:[
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3867
                prev := indexOrIndexCollection min - 1
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3868
            ]
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3869
        ] ifFalse:[
2194
d0487f4d4865 skip over disabled items, when changing the selection
Claus Gittinger <cg@exept.de>
parents: 2187
diff changeset
  3870
            prev := indexOrIndexCollection - 1
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3871
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3872
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3873
    (self isValidSelection:prev) ifFalse:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3874
        prev < 1 ifTrue:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3875
            prev := self size.
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3876
        ] ifFalse:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3877
            [prev >= 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3878
             and:[(self isValidSelection:prev) not]] whileTrue:[
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3879
                prev := prev - 1
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3880
            ].
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3881
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3882
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3883
    (self isValidSelection:prev) ifFalse:[
1244
5a1e81b3cdd4 next & previous with multiple selection
ca
parents: 1239
diff changeset
  3884
        prev := nil
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3885
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3886
    ^ prev
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3887
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3888
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3889
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3890
selectAll
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3891
    "select all entries. 
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3892
     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
  3893
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3894
    |oldSelection|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3895
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3896
    self multipleSelectOk ifTrue:[
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3897
        oldSelection := selection.
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3898
        selection := OrderedCollection withAll:(1 to:self size).
722
3f297a438fec use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents: 709
diff changeset
  3899
        self invalidate.
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3900
        self selectionChangedFrom:oldSelection.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3901
    ]
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3902
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3903
    "Modified: 15.11.1996 / 17:00:26 / cg"
125
claus
parents: 124
diff changeset
  3904
!
claus
parents: 124
diff changeset
  3905
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3906
selectElement:anObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3907
    "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
  3908
     Scroll to make the new selection visible.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3909
     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
  3910
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3911
    |lineNo|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3912
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3913
    list notNil ifTrue:[
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3914
        items notNil ifTrue:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3915
            lineNo := items indexOf:anObject ifAbsent:nil
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3916
        ] ifFalse:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3917
            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
  3918
        ].
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3919
        lineNo notNil ifTrue:[self selection:lineNo]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3920
    ]
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3921
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3922
    "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
  3923
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3924
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3925
selectElementWithoutScroll:anObject
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3926
    "select the element with same printString as the argument, anObject.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3927
     Do not scroll.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3928
     *** 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
  3929
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3930
    |lineNo|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3931
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3932
    list notNil ifTrue:[
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3933
        items notNil ifTrue:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3934
            lineNo := items indexOf:anObject ifAbsent:nil
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3935
        ] ifFalse:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3936
            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
  3937
        ].
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3938
        lineNo notNil ifTrue:[self selectWithoutScroll:lineNo]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3939
    ]
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3940
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3941
    "Modified: 15.11.1996 / 17:01:17 / cg"
125
claus
parents: 124
diff changeset
  3942
!
claus
parents: 124
diff changeset
  3943
4718
6fe98a8f1174 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4622
diff changeset
  3944
selectFirst
4719
8d62a0beee47 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4718
diff changeset
  3945
    "select the first selectable element.
4718
6fe98a8f1174 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4622
diff changeset
  3946
     Model and/or actionBlock notification IS done."
6fe98a8f1174 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4622
diff changeset
  3947
6fe98a8f1174 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4622
diff changeset
  3948
    self selection:(self nextSelectableAfter:0)
6fe98a8f1174 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4622
diff changeset
  3949
!
6fe98a8f1174 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4622
diff changeset
  3950
5514
a208d39257ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
  3951
selectFirstVisibleLine
a208d39257ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
  3952
    "select the first selectable element.
a208d39257ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
  3953
     Model and/or actionBlock notification IS done."
a208d39257ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
  3954
a208d39257ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
  3955
    self selection:(self nextSelectableAfter:self firstLineShown -1)
a208d39257ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
  3956
!
a208d39257ac #FEATURE
Claus Gittinger <cg@exept.de>
parents: 5483
diff changeset
  3957
4719
8d62a0beee47 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4718
diff changeset
  3958
selectLast
8d62a0beee47 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4718
diff changeset
  3959
    "select the last selectable element.
8d62a0beee47 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4718
diff changeset
  3960
     Model and/or actionBlock notification IS done."
8d62a0beee47 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4718
diff changeset
  3961
8d62a0beee47 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4718
diff changeset
  3962
    self selection:(self previousSelectableBefore:list size + 1)
8d62a0beee47 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4718
diff changeset
  3963
!
8d62a0beee47 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4718
diff changeset
  3964
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3965
selectNext
6168
02556ee274e9 #DOCUMENTATION by mawalch
mawalch
parents: 6103
diff changeset
  3966
    "select next line or first visible if there is currently no selection.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3967
     Wrap at end. 
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3968
     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
  3969
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3970
    self selection:(self nextAfterSelection)
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3971
6168
02556ee274e9 #DOCUMENTATION by mawalch
mawalch
parents: 6103
diff changeset
  3972
    "Modified: / 15-11-1996 / 17:01:27 / cg"
02556ee274e9 #DOCUMENTATION by mawalch
mawalch
parents: 6103
diff changeset
  3973
    "Modified (comment): / 07-06-2017 / 17:20:39 / mawalch"
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3974
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3975
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3976
selectPrevious
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3977
    "select previous line or previous visible if there is currently no selection.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3978
     Wrap at beginning. 
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3979
     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
  3980
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3981
    self selection:(self previousBeforeSelection).
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3982
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3983
    "Modified: 26.9.1995 / 09:41:16 / stefan"
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3984
    "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
  3985
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3986
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3987
selectWithoutScroll:aNumberOrNilOrCollection
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  3988
    "select line, aNumber or deselect if argument is nil.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  3989
     *** 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
  3990
2767
Claus Gittinger <cg@exept.de>
parents: 2766
diff changeset
  3991
    |newSelection multipleSelectOk oldItems newItems addedItems removedItems|
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3992
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  3993
    multipleSelectOk := self multipleSelectOk.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3994
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  3995
    newSelection := aNumberOrNilOrCollection.
2314
03348b8ae78b empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents: 2290
diff changeset
  3996
    multipleSelectOk ifTrue:[
2770
6b49ba35c070 multiselect: care for numeric arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2767
diff changeset
  3997
        newSelection notNil ifTrue:[
6b49ba35c070 multiselect: care for numeric arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2767
diff changeset
  3998
            newSelection isNumber ifTrue:[
6b49ba35c070 multiselect: care for numeric arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2767
diff changeset
  3999
                newSelection := OrderedCollection with:newSelection
6b49ba35c070 multiselect: care for numeric arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2767
diff changeset
  4000
            ].
6b49ba35c070 multiselect: care for numeric arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2767
diff changeset
  4001
2314
03348b8ae78b empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents: 2290
diff changeset
  4002
            newSelection := newSelection select:[:each | each notNil].
03348b8ae78b empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents: 2290
diff changeset
  4003
            newSelection size == 0 ifTrue:[newSelection := nil].
03348b8ae78b empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents: 2290
diff changeset
  4004
        ].
03348b8ae78b empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents: 2290
diff changeset
  4005
    ].
03348b8ae78b empty-list with cursorUp/Down lead into debugger
Claus Gittinger <cg@exept.de>
parents: 2290
diff changeset
  4006
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4007
    newSelection notNil ifTrue:[
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4008
        (self isValidSelection:newSelection) ifFalse:[
2761
30863cd1c0f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
  4009
            multipleSelectOk ifTrue:[
30863cd1c0f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
  4010
                newSelection := newSelection select:[:each | self isValidSelection:each].
30863cd1c0f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
  4011
            ] ifFalse:[
30863cd1c0f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
  4012
                newSelection := nil.
30863cd1c0f6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2758
diff changeset
  4013
            ].
1484
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4014
        ].
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4015
        newSelection == 0 ifTrue:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4016
            newSelection := nil
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4017
        ] ifFalse:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4018
            (newSelection isCollection
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4019
            and:[newSelection size == 0]) ifTrue:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4020
                newSelection := nil
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4021
            ]
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4022
        ].
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4023
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4024
        newSelection notNil ifTrue:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4025
            multipleSelectOk ifTrue:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4026
                newSelection isCollection ifFalse:[
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4027
                    newSelection := OrderedCollection with:newSelection
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4028
                ]
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4029
            ]
1d2fbdc2d662 selectWithoutScroll:aNumberOrNilOrCollection
ca
parents: 1473
diff changeset
  4030
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4031
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4032
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4033
    (newSelection = selection) ifTrue: [^ self].
125
claus
parents: 124
diff changeset
  4034
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4035
    multipleSelectOk ifTrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4036
        oldItems := selection ? #().
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4037
        newItems := newSelection ? #().
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4038
    ] ifFalse:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4039
        (selection isNil or:[selection == 0]) ifTrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4040
            oldItems := #()
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4041
        ] ifFalse:[
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4042
            oldItems := Array with:selection
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4043
        ].
2767
Claus Gittinger <cg@exept.de>
parents: 2766
diff changeset
  4044
        (newSelection isNil or:[newSelection == 0]) ifTrue:[
2766
ce0d83f618bd checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2764
diff changeset
  4045
            newItems := #()
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4046
        ] ifFalse:[
2767
Claus Gittinger <cg@exept.de>
parents: 2766
diff changeset
  4047
            newItems := Array with:newSelection
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4048
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4049
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4050
4599
3b7fbcaef9b6 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4578
diff changeset
  4051
    addedItems := newItems reject:[:item | (oldItems includes:item)].    
3b7fbcaef9b6 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4578
diff changeset
  4052
    removedItems := oldItems reject:[:item | (newItems includes:item)].    
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4053
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4054
    selection := newSelection.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4055
2767
Claus Gittinger <cg@exept.de>
parents: 2766
diff changeset
  4056
    addedItems do:[:line |
Claus Gittinger <cg@exept.de>
parents: 2766
diff changeset
  4057
        self redrawElement:line
Claus Gittinger <cg@exept.de>
parents: 2766
diff changeset
  4058
    ].
Claus Gittinger <cg@exept.de>
parents: 2766
diff changeset
  4059
    removedItems do:[:line |
2764
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4060
        self redrawElement:line
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4061
    ].
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4062
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4063
"/    "
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4064
"/     redraw old selection unhighlighted
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4065
"/    "
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4066
"/    selection notnil iftrue: [
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4067
"/        prevselection := selection.
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4068
"/        selection := nil.
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4069
"/        multipleselectok iftrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4070
"/            prevselection do:[:line |
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4071
"/                self redrawelement:line
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4072
"/            ]
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4073
"/        ] iffalse:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4074
"/            self redrawelement:prevselection
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4075
"/        ]
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4076
"/    ].
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4077
"/
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4078
"/    selection := newSelection.
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4079
"/
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4080
"/    "
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4081
"/     redraw new selection unhighlighted
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4082
"/    "
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4083
"/    newSelection notNil ifTrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4084
"/        multipleSelectOk ifTrue:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4085
"/"/            newSelection isCollection ifFalse:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4086
"/"/                selection := OrderedCollection with:newSelection.
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4087
"/"/            ].
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4088
"/            selection do:[:line |
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4089
"/                self redrawElement:line
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4090
"/            ]
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4091
"/        ] ifFalse:[
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4092
"/            self redrawElement:selection
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4093
"/        ]
36363d57b32d dont invalidate in scrollSelect (flashy display)
Claus Gittinger <cg@exept.de>
parents: 2761
diff changeset
  4094
"/    ]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4095
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  4096
    "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
  4097
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4098
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4099
selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4100
    "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
  4101
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4102
    ^ selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4103
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4104
2738
d8cf5b3e84ed better expandSelectionCode.
Claus Gittinger <cg@exept.de>
parents: 2730
diff changeset
  4105
selection:aNumberOrNilOrCollection
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4106
    "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
  4107
     scroll to make the selected line visible.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  4108
     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
  4109
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4110
    |oldSelection|
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4111
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4112
    oldSelection := selection.
2738
d8cf5b3e84ed better expandSelectionCode.
Claus Gittinger <cg@exept.de>
parents: 2730
diff changeset
  4113
    self setSelection:aNumberOrNilOrCollection.
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4114
    selection ~= oldSelection ifTrue:[
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4115
        self selectionChangedFrom:oldSelection
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4116
    ]
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4117
1638
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  4118
    "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
  4119
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4120
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4121
selectionAsCollection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4122
    "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
  4123
     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
  4124
     the multipleSelect style."
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4125
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4126
    selection isNil ifTrue:[^ #()].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4127
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4128
"/    self multipleSelectOk ifTrue:[
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4129
"/        ^ (OrderedCollection new) add:selection; yourself.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4130
"/    ].
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4131
    self multipleSelectOk ifFalse:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4132
        ^ (OrderedCollection new) add:selection; yourself.
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4133
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4134
    ^ selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4135
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4136
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4137
selectionChangedFrom:oldSelection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4138
    "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
  4139
2503
05307dff92f1 use new #valueWithOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  4140
    |changeArg actionArg|
970
188efaece4a0 ST-80 model notifications require 0 for reselect;
ca
parents: 968
diff changeset
  4141
188efaece4a0 ST-80 model notifications require 0 for reselect;
ca
parents: 968
diff changeset
  4142
    changeArg := actionArg := self argForChangeMessage.
965
ff8e6542eb13 when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  4143
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  4144
    "/
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  4145
    "/ the MVC way of doing things - notify model via changeMsg
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  4146
    "/
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4147
    self multipleSelectOk ifFalse:[
965
ff8e6542eb13 when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  4148
        "/ 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
  4149
        selection == oldSelection ifTrue:[
970
188efaece4a0 ST-80 model notifications require 0 for reselect;
ca
parents: 968
diff changeset
  4150
            changeArg := 0
965
ff8e6542eb13 when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  4151
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4152
    ].
2125
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  4153
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  4154
    "/ 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
  4155
    "/ 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
  4156
    "/ (valueHolder would not send a change in the == case)
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  4157
    "/ Q: should this be done in #sendChangeMessage ?
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  4158
    model isValueModel ifTrue:[
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  4159
        model value == changeArg ifTrue:[
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  4160
            model setValue:nil.
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  4161
        ]
f9000f830c2c tuned multiselect (no new collection).
Claus Gittinger <cg@exept.de>
parents: 2124
diff changeset
  4162
    ].
970
188efaece4a0 ST-80 model notifications require 0 for reselect;
ca
parents: 968
diff changeset
  4163
    self sendChangeMessageWith:changeArg.
6753
a29d982ad405 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6716
diff changeset
  4164
    "/ in case someon depends on me instead of the model
a29d982ad405 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 6716
diff changeset
  4165
    self changed:#selection with:selection.
965
ff8e6542eb13 when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  4166
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  4167
    "/
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  4168
    "/ the ST/X way of doing things - perform the actionBlock
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  4169
    "/
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  4170
    actionBlock notNil ifTrue:[
2503
05307dff92f1 use new #valueWithOptionalArg
Claus Gittinger <cg@exept.de>
parents: 2481
diff changeset
  4171
        actionBlock valueWithOptionalArgument:actionArg
1745
cca5376d130d doubleClickAction also gets index or value depending upon
Claus Gittinger <cg@exept.de>
parents: 1744
diff changeset
  4172
    ].
965
ff8e6542eb13 when both model & actionBlocks are present,
Claus Gittinger <cg@exept.de>
parents: 941
diff changeset
  4173
1010
f59879e23613 commentary
Claus Gittinger <cg@exept.de>
parents: 997
diff changeset
  4174
    "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
  4175
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4176
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4177
selectionDo:aBlock
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4178
    "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
  4179
     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
  4180
     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
  4181
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4182
    selection notNil ifTrue:[
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4183
        self multipleSelectOk ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4184
            selection do:aBlock
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4185
        ] ifFalse:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4186
            aBlock value:selection
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4187
        ].
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4188
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4189
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4190
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4191
selectionValue
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4192
    "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
  4193
     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
  4194
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4195
    self multipleSelectOk ifTrue:[
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4196
        selection isNil ifTrue:[^ #()].
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4197
        ^ selection collect:[:nr | self at:nr]
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4198
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4199
    selection isNil ifTrue:[^ nil].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4200
    ^ self at:selection
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4201
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4202
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  4203
selectionValueAsCollection
a399056aec3b center arrows
ca
parents: 987
diff changeset
  4204
    "return the selection values as a collection - allows selectionValues to
a399056aec3b center arrows
ca
parents: 987
diff changeset
  4205
     be enumerated independent of the multiSelect settings"
a399056aec3b center arrows
ca
parents: 987
diff changeset
  4206
a399056aec3b center arrows
ca
parents: 987
diff changeset
  4207
    selection isNil ifTrue:[^ #()].
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4208
    self multipleSelectOk ifTrue:[
988
a399056aec3b center arrows
ca
parents: 987
diff changeset
  4209
        ^ selection collect:[:nr | self at:nr]
a399056aec3b center arrows
ca
parents: 987
diff changeset
  4210
    ].
a399056aec3b center arrows
ca
parents: 987
diff changeset
  4211
    ^ Array with:(self at:selection)
a399056aec3b center arrows
ca
parents: 987
diff changeset
  4212
!
a399056aec3b center arrows
ca
parents: 987
diff changeset
  4213
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  4214
setSelectElement:anObject 
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  4215
    "select the element with same printString as the argument, anObject.
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  4216
     Scroll to make the new selection visible.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  4217
     *** No model and/or actionBlock notification is done here."
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  4218
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  4219
    |size lineNo coll s|
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4220
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4221
    list isNil ifTrue:[
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4222
        ^ self
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4223
    ].
2446
3771875cd836 multipleSelectOK as method (to allow redef)
Claus Gittinger <cg@exept.de>
parents: 2429
diff changeset
  4224
    self multipleSelectOk ifTrue:[
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4225
        (size := anObject size) == 0 ifTrue:[
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4226
            ^ self setSelection:nil
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  4227
        ].
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4228
        coll := OrderedCollection new:size.
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  4229
        anObject do:[:o | 
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4230
            items notNil ifTrue:[
2229
ece191c81264 use indexOf: instead of findFirst:
Claus Gittinger <cg@exept.de>
parents: 2227
diff changeset
  4231
                lineNo := items indexOf:o
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4232
            ] ifFalse:[
4527
4445373fd930 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4478
diff changeset
  4233
                lineNo := list findFirst:[:el | (o ? '') string = (el ? '') string]
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4234
            ].
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  4235
            lineNo ~~ 0 ifTrue:[
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4236
                coll add:lineNo
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4237
            ]
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4238
        ].
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4239
        ^ self setSelection:coll
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4240
    ].
2124
b4123a418b82 oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  4241
    anObject isNil ifTrue:[
b4123a418b82 oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  4242
        ^ self setSelection:nil
b4123a418b82 oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  4243
    ].
b4123a418b82 oops - care for nil arg in setSelection
Claus Gittinger <cg@exept.de>
parents: 2122
diff changeset
  4244
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4245
    items notNil ifTrue:[
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  4246
        lineNo := items findFirst:[:el | anObject = el]
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4247
    ] ifFalse:[
5852
9543b58b0e6c #OTHER by Maren
matilk
parents: 5827
diff changeset
  4248
        lineNo := list indexOf:anObject ifAbsent:[nil].
9543b58b0e6c #OTHER by Maren
matilk
parents: 5827
diff changeset
  4249
        lineNo isNil ifTrue:[
9543b58b0e6c #OTHER by Maren
matilk
parents: 5827
diff changeset
  4250
            s := anObject string.
6448
5b3cce36e399 #BUGFIX by Maren
matilk
parents: 6447
diff changeset
  4251
            lineNo := list findFirst:[:el | s = (el ? '') string]
5852
9543b58b0e6c #OTHER by Maren
matilk
parents: 5827
diff changeset
  4252
        ].
1358
ef59b066a13e setSelectElement: care for multiple
ca
parents: 1354
diff changeset
  4253
    ].
2122
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  4254
    lineNo ~~ 0 ifTrue:[
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  4255
        self setSelection:lineNo
eaf474215daa setSelect with emphasized items fixed
Claus Gittinger <cg@exept.de>
parents: 2115
diff changeset
  4256
    ]
6447
f836a6ef7bc6 #BUGFIX by Maren
matilk
parents: 6347
diff changeset
  4257
6448
5b3cce36e399 #BUGFIX by Maren
matilk
parents: 6447
diff changeset
  4258
    "Modified: / 01-10-2018 / 16:39:15 / Maren"
686
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  4259
!
03328d8ef2b6 more selection:/setSelection: stuff
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
  4260
2232
b65df4a6af2d when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  4261
setSelection:aNumberOrNilOrCollection
681
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4262
    "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
  4263
     scroll to make the selected line visible.
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  4264
     *** 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
  4265
2232
b65df4a6af2d when the selection is lost (due to a changed list),
Claus Gittinger <cg@exept.de>
parents: 2229
diff changeset
  4266
    self selectWithoutScroll:aNumberOrNilOrCollection.
2235
b51a9d465386 selection should be a colletion if multiSelect is on (keyPress)
Claus Gittinger <cg@exept.de>
parents: 2234
diff changeset
  4267
3466
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  4268
    "/ makeSelectionVisible handled in #buttonRelease
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  4269
    isButtonPressActive ifTrue:[^ self ].
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  4270
    
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  4271
    self hasSelection ifTrue:[
1638
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  4272
        self makeSelectionVisible
3466
f179adbd4f09 bugfix - makeSelectionVisible in buttonRelease
ca
parents: 3451
diff changeset
  4273
    ].
1638
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  4274
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  4275
    "Created: / 25.5.1996 / 12:23:18 / cg"
3168c74c3d48 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
  4276
    "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
  4277
!
9347a4f72cc9 #selection: now does a notification / #setSelection: does not
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  4278
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4279
toggleSelection:aNumber
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  4280
    "toggle selection-state of entry, aNumber.
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  4281
     *** 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
  4282
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4283
    (self isInSelection:aNumber) ifTrue:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  4284
        self removeFromSelection:aNumber
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4285
    ] ifFalse:[
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  4286
        self addToSelection:aNumber
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4287
    ]
886
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  4288
498e52f3d1dc commentary.
Claus Gittinger <cg@exept.de>
parents: 885
diff changeset
  4289
    "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
  4290
!
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4291
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4292
valueIsInSelection:someString
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4293
    "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
  4294
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4295
    |sel|
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4296
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4297
    selection isNil ifTrue:[^ false].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4298
    sel := self selectionValue.
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4299
    self numberOfSelections > 1 ifTrue:[
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4300
	^ (sel includes:someString)
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4301
    ].
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4302
    ^ (someString = sel)
125
claus
parents: 124
diff changeset
  4303
! !
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4304
869
4b09e6fe33b6 allow multiSelect modifier to be changed
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
  4305
!SelectionInListView class methodsFor:'documentation'!
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4306
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4307
version
5373
a95a624e0ae9 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5354
diff changeset
  4308
    ^ '$Header$'
4014
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  4309
!
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  4310
Claus Gittinger <cg@exept.de>
parents: 3930
diff changeset
  4311
version_CVS
5373
a95a624e0ae9 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 5354
diff changeset
  4312
    ^ '$Header$'
4971
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  4313
!
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  4314
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  4315
version_HG
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  4316
c67f7d22e6d8 class: SelectionInListView
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 4913
diff changeset
  4317
    ^ '$Changeset: <not expanded> $'
320
b2ca0310ead0 fixed error when resized empty and multiSelectOk
Claus Gittinger <cg@exept.de>
parents: 271
diff changeset
  4318
! !
4527
4445373fd930 class: SelectionInListView
Claus Gittinger <cg@exept.de>
parents: 4478
diff changeset
  4319