DSVColumnView.st
author Claus Gittinger <cg@exept.de>
Fri, 09 Nov 2001 14:58:37 +0100
changeset 2044 8e36106065f0
parent 2032 6eb610caad85
child 2074 89565d366510
permissions -rw-r--r--
fixed: click on a checkToggle (buttonPress event) fixed: sizeCHanged when a new list is set was missing
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     1
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     3
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     4
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    10
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    11
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    12
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    13
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    14
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    15
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
    16
"{ Package: 'stx:libwidg2' }"
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
    17
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    18
View subclass:#DSVColumnView
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    19
	instanceVariableNames:'labelView listHolder editValue editView multipleSelectOk useIndex
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    20
		selectedColIndex selectedRowIndex selectRowOnDefault rowHeight
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    21
		columnDescriptors viewOrigin colorMap rowFontAscent lockRowIndex
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    22
		rowIfAbsentBlock columnHolder registererImages list fgColor
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    23
		separatorSize catchChangeEvents beDependentOfRows bgColor
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    24
		hgLgFgColor hgLgBgColor actionBlock builder tabIntern
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    25
		doubleClickActionBlock verticalSpacing horizontalSpacing
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    26
		rowSelectorForm buttonLightColor buttonShadowColor
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    27
		buttonHalfLightColor buttonHalfShadowColor checkToggleExtent
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    28
		checkToggleForm checkToggleActiveImage checkTogglePassiveImage
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    29
		checkToggleLevel comboButtonExtent comboButtonForm
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    30
		comboButtonLevel clickPosition dragAccessPoint dragIsActive
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    31
		dropTarget dropSource columnAdaptor tabAtEndAction
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    32
		tabAtStartAction modifiedChannel autoScroll autoScrollBlock
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    33
		needFitColumns scrollWhenUpdating'
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    34
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    35
		DefaultHilightForegroundColor DefaultHilightBackgroundColor
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    36
		ButtonLightColor ButtonShadowColor CheckToggleActiveImage
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    37
		CheckTogglePassiveImage ButtonHalfLightColor
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    38
		ButtonHalfShadowColor ButtonEdgeStyle CheckToggleForm
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    39
		CheckToggleLevel CheckToggleExtent ComboButtonForm
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    40
		ComboButtonLevel ComboButtonExtent'
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    41
	poolDictionaries:''
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
    42
	category:'Views-DataSet'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    43
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    44
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    45
!DSVColumnView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    46
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    47
copyright
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    48
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    49
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    50
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    51
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    52
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    53
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    54
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    55
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    56
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    57
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    58
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    59
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    60
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    61
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    62
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    63
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    64
documentation
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    65
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    66
    implements a scrollable selection view based on rows and columns
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    67
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    68
    [Instance variables:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    69
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    70
        editValue               <Model>                 current editing model
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    71
        editView                <View>                  current editing component
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    72
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    73
        multipleSelectOk        <Boolean>               multiple selection enabled/disabled
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    74
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    75
        selectedColIndex        <Integer>               selected column index or 0
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    76
        selectedRowIndex        <Integer>               selected row    index or 0
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    77
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    78
        rowHeight               <Integer>               maximum height of any row
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    79
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    80
        columnDescriptors       <SequancableCollection> list of column descriptors
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    81
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    82
        viewOrigin              <Point>                 current view origin
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    83
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    84
        colorMap                <Dictionary>            store and register used colors on device
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    85
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    86
        rowFontAscent           <SmallInteger>          inset of a printable text in a row
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    87
                                                        including separator and font ascent.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    88
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    89
        lockRowIndex            <SmallInteger>          internal used to indicate a row which has
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    90
                                                        changed its contents but no redraw should be
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    91
                                                        done( at:put: ).
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    92
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    93
        columnHolder            <ValueHolder>           holder which keeps the list of column descriptors.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    94
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    95
        registererImages        <IdentityDictionary>    list of images registered on the device
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    96
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    97
        list                    <SequancableCollection> list of rows
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    98
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    99
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   100
        catchChangeEvents       <Boolean>               internal used to discard change notifications
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   101
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   102
        beDependentOfRows       <Boolean>               keep rows dependent; on default is disabled.
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   103
                                                        in case of enabled a row can raise a change
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   104
                                                        notification whithout a parameter which
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   105
                                                        will force a redraw of the row or the
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   106
                                                        readSelector of the column which will
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   107
                                                        redraw the cell in the row only.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   108
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   109
        fgColor                 <Color>                 foreground color
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   110
        bgColor                 <Color>                 background color
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   111
        hgLgFgColor             <Color>                 highlight foreground color (selected)
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   112
        hgLgBgColor             <Color>                 highlight background color (selected)
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   113
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   114
        buttonLightColor        <Color>                 LightColor      ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   115
        buttonShadowColor       <Color>                 ShadowColor     ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   116
        buttonHalfLightColor    <Color>                 HalfLightColor  ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   117
        buttonHalfShadowColor   <Color>                 HalfShadowColor ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   118
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   119
        actionBlock             <a OneArgBlock>         action block performed on select
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   120
        doubleClickActionBlock  <a OneArgBlock>         action block performed on double click
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   121
        rowIfAbsentBlock        <a OneArgBlock>         this block is performed on an emty list entry
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   122
                                                        to retrive the item from the application. The
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   123
                                                        argument to the block is the index into the list.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   124
                                                        The block should return the row instance which
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   125
                                                        is put to the list under the index.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   126
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   127
        builder                 <UIBuilder>             builder set by application
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   128
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   129
        verticalSpacing         <SmallInteger>          vertical   row spacing( top  & bottom )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   130
        horizontalSpacing       <SmallInteger>          horizontal row spacing( left & right )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   131
        separatorSize           <SmallInteger>          line width of a vertical or horizontal separator
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   132
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   133
        rowSelectorForm         <Form>                  form used by a row selector
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   134
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   135
        checkToggleForm         <Form>                  form used by a checkToggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   136
        checkToggleExtent       <Point>                 extent of a checkToggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   137
        checkToggleLevel        <SmallInteger>          level used to draw a check toggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   138
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   139
        comboButtonForm         <Form>                  form used by a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   140
        comboButtonExtent       <Point>                 extent of a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   141
        comboButtonLevel        <SmallInteger>          level used to draw a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   142
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   143
        clickPosition           <Point>                 click position of the mouse
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   144
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   145
        dragAccessPoint         <Point>                 point where the drag operation starts
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   146
        dragIsActive            <Boolean>               true if a drag operation is active
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   147
        dropTarget              <DropTarget>            drag & drop target
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   148
        dropSource              <DropSource>            drag & drop source
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   149
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   150
    [author:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   151
        Claus Atzkern
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   152
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   153
    [see also:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   154
        DataSetColumnSpec
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   155
        DataSetColumn
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   156
        DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   157
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   158
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   159
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   160
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   161
!DSVColumnView class methodsFor:'accessing forms'!
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   162
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   163
rowSelector
989
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   164
    "This resource specification was automatically generated
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   165
     by the ImageEditor of ST/X."
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   166
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   167
    "Do not manually edit this!! If it is corrupted,
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   168
     the ImageEditor may not be able to read the specification."
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   169
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   170
    "
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   171
     self rowSelector inspect
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   172
     ImageEditor openOnClass:self andSelector:#rowSelector
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   173
    "
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   174
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   175
    <resource: #image>
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   176
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   177
    ^Icon
70fd16dd0085 rowSelector changed
tz
parents: 988
diff changeset
   178
        constantNamed:#'DSVColumnView rowSelector'
1129
3b9e0fd31971 rowSelector icon restyled
tz
parents: 1123
diff changeset
   179
        ifAbsentPut:[(Depth2Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@A@@@AP@@A4@EW=@G?? O?:@@C(@@B @@B@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'C@@N@@<@?8C?0O? ?<C? @<@C @L@@@a') ; yourself); yourself]
3b9e0fd31971 rowSelector icon restyled
tz
parents: 1123
diff changeset
   180
3b9e0fd31971 rowSelector icon restyled
tz
parents: 1123
diff changeset
   181
3b9e0fd31971 rowSelector icon restyled
tz
parents: 1123
diff changeset
   182
! !
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   183
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   184
!DSVColumnView class methodsFor:'defaults'!
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   185
1844
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   186
defaultFont
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   187
    ^ SelectionInListView defaultFont
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   188
!
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   189
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   190
horizontalSpacing
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   191
    "returns the default horizontal space between rows
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   192
    "
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   193
    ^ 4
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   194
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   195
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   196
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   197
updateStyleCache
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   198
    "extract values from the styleSheet and cache them in class variables
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   199
    "
582
222fc7c63af0 new resource naming
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   200
    <resource: #style (#textForegroundColor #'scrollableView.backgroundColor'
222fc7c63af0 new resource naming
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   201
                       #'selection.hilightForegroundColor'
222fc7c63af0 new resource naming
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   202
                       #'selection.hilightBackgroundColor'   )>
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   203
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   204
    DefaultForegroundColor        := StyleSheet colorAt:#'textForegroundColor' default:(Color black).
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   205
    DefaultBackgroundColor        := StyleSheet colorAt:#'scrollableView.backgroundColor' default:DefaultViewBackgroundColor.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   206
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   207
    DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor' default:DefaultBackgroundColor.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   208
    DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor' default:DefaultForegroundColor.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   209
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   210
    DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   211
        DefaultHilightBackgroundColor := Color black
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   212
    ].
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   213
    ButtonLightColor       := StyleSheet colorAt:#'button.lightColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   214
    ButtonShadowColor      := StyleSheet colorAt:#'button.shadowColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   215
    ButtonHalfLightColor   := StyleSheet colorAt:#'button.halfLightColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   216
    ButtonHalfShadowColor  := StyleSheet colorAt:#'button.halfShadowColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   217
    ButtonEdgeStyle        := StyleSheet at:#'button.edgeStyle'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   218
    CheckToggleActiveImage := StyleSheet at:#'checkToggle.activeImage'.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   219
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   220
    CheckToggleActiveImage isNil ifTrue:[
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   221
        CheckTogglePassiveImage := nil
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   222
    ] ifFalse:[
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   223
        CheckTogglePassiveImage := StyleSheet at:#'checkToggle.passiveImage'.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   224
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   225
        CheckTogglePassiveImage isNil ifTrue:[
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   226
            CheckToggleActiveImage := nil
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   227
        ]
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   228
    ].
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   229
    ComboButtonForm   := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   230
    ComboButtonLevel  := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   231
    ComboButtonExtent := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   232
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   233
    CheckToggleForm   := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   234
    CheckToggleLevel  := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   235
    CheckToggleExtent := nil.
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   236
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   237
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   238
self updateStyleCache.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   239
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   240
582
222fc7c63af0 new resource naming
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   241
    "Modified: / 26.10.1997 / 17:09:07 / cg"
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   242
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   243
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   244
verticalSpacing
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   245
    "returns the default vertical space between rows
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   246
    "
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   247
    ^ 2
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   248
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   249
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   250
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   251
!DSVColumnView class methodsFor:'resources'!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   252
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   253
dragIconMulti
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   254
    "This resource specification was automatically generated
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   255
     by the ImageEditor of ST/X."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   256
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   257
    "Do not manually edit this!! If it is corrupted,
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   258
     the ImageEditor may not be able to read the specification."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   259
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   260
    "
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   261
     self dragIconMulti inspect
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   262
     ImageEditor openOnClass:self andSelector:#dragIconMulti
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   263
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   264
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   265
    <resource: #image>
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   266
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   267
    ^Icon
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   268
        constantNamed:#'DSVColumnView dragIconMulti'
1926
9bcb6b59ea37 if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   269
        ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@<@@@@O@@@@C3??L@<??3@OO?<<C3??O@<??0@OO?<@C3???0<???<OO???C3???0<???<OO???@C???0@???<@O???@C???0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C????@????0O????C????0?????O????3?????????????????????????????????????????????????????@????0O???<C????@????0@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself]
9bcb6b59ea37 if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   270
!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   271
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   272
dragIconSingle
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   273
    "This resource specification was automatically generated
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   274
     by the ImageEditor of ST/X."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   275
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   276
    "Do not manually edit this!! If it is corrupted,
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   277
     the ImageEditor may not be able to read the specification."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   278
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   279
    "
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   280
     self dragIconSingle inspect
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   281
     ImageEditor openOnClass:self andSelector:#dragIconSingle
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   282
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   283
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   284
    <resource: #image>
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   285
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   286
    ^Icon
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   287
        constantNamed:#'DSVColumnView dragIconSingle'
1926
9bcb6b59ea37 if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   288
        ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@??30@O?<<@C??@@@??0@@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C???<@????@O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself]
9bcb6b59ea37 if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   289
! !
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   290
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   291
!DSVColumnView methodsFor:'accessing'!
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   292
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   293
builder
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   294
    "get the builder (UIBuilder or nil)
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   295
    "
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   296
    ^ builder
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   297
!
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   298
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   299
builder:aBuilder
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   300
    "set the builder (UIBuilder or nil)
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   301
    "
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   302
    builder := aBuilder
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   303
!
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   304
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   305
columnView
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   306
    "returns self
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   307
    "
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   308
    ^ self
1067
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   309
!
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   310
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   311
labelView:aView
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   312
    labelView := aView for:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   313
1067
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   314
!
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   315
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   316
layout:aLayout
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   317
    "layout changed; change the layout of the labelView dependent on my layout
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   318
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   319
    |newLyt lblLyt bOffset tOffset|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   320
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   321
    (newLyt := aLayout ? layout) isNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   322
        ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   323
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   324
    lblLyt := newLyt copy.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   325
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   326
    labelView isVisible ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   327
        bOffset := labelView preferredHeight.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   328
        tOffset := margin.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   329
        newLyt topOffset:1 + bOffset.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   330
    ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   331
        bOffset := -1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   332
        tOffset := -2.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   333
        newLyt topOffset:margin.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   334
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   335
    lblLyt bottomFraction:0 offset:bOffset.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   336
    lblLyt topFraction:0    offset:tOffset.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   337
    labelView layout:lblLyt.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   338
    super layout:newLyt.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   339
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   340
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   341
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   342
level:aLevel
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   343
    "change the level and thus the level of the labelView
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   344
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   345
    aLevel ~~ level ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   346
        super level:aLevel.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   347
        labelView level:aLevel.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   348
    ]
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   349
!
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   350
1661
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   351
modifiedChannel
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   352
    "return the value of the instance variable 'modifiedChannel' (automatically generated)"
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   353
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   354
    ^ modifiedChannel
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   355
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   356
    "Created: / 30.1.2000 / 12:10:57 / cg"
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   357
!
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   358
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   359
modifiedChannel:something
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   360
    "set the value of the instance variable 'modifiedChannel' (automatically generated)"
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   361
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   362
    modifiedChannel := something.
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   363
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   364
    "Created: / 30.1.2000 / 12:10:57 / cg"
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   365
!
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
   366
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   367
rowFontAscent
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   368
    "returns the inset of a printable text in a row
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   369
    "
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   370
    ^ rowFontAscent
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   371
! !
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   372
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   373
!DSVColumnView methodsFor:'accessing-actions'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   374
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   375
action:aOneArgAction
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   376
    "set the action block to be performed on select
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   377
    "
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   378
    actionBlock := aOneArgAction
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   379
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   380
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   381
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   382
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   383
doubleClickAction:aOneArgAction
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   384
    "set the action block to be performed on doubleclick
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   385
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   386
    doubleClickActionBlock := aOneArgAction
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   387
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   388
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   389
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   390
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   391
rowIfAbsent:aOneArgAction
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   392
    "set the action block to be performed on each 'nil' entry into the
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   393
     list. The argument to the block is the index into the list. The
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   394
     block returns the row which is put to the list
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   395
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   396
    rowIfAbsentBlock := aOneArgAction
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   397
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   398
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   399
!
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   400
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   401
tabAtEndAction:aNoneArgAction
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   402
    "set the action, called without any argument at end of the list entering
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   403
     tab next.
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   404
     The default is to give the focus to the view after self in the focusSequence
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   405
    "
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   406
    tabAtEndAction := aNoneArgAction
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   407
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   408
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   409
!
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   410
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   411
tabAtStartAction:aNoneArgAction
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   412
    "set the action, called without any argument at start of the list entering
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   413
     tab previous.
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   414
     The default is to give the focus to the view before self in the focusSequence
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   415
    "
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   416
    tabAtStartAction := aNoneArgAction
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   417
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   418
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   419
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   420
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   421
!DSVColumnView methodsFor:'accessing-behavior'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   422
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   423
beDependentOfRows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   424
    "make myself dependent of any row; in this case any change notification
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   425
     raised by a row is catched and the cell identified by the 'readSelector'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   426
     is redrawn. In case of a nil readSelector, the whole raw is redrawn.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   427
        -> row changed:'what'
1953
9190339e9fad lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
   428
     On default the attribute is set to false (disabled).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   429
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   430
    ^ beDependentOfRows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   431
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   432
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   433
beDependentOfRows:aBool
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   434
    "make myself dependent of any row; in this case any change notification
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   435
     raised by a row is catched and the cell identified by the 'readSelector'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   436
     is redrawn. In case of a nil readSelector, the whole raw is redrawn.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   437
        -> row changed:'what'
1953
9190339e9fad lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
   438
     On default the attribute is set to false (disabled).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   439
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   440
    aBool ~~ beDependentOfRows ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   441
        beDependentOfRows := aBool.
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   442
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   443
        list size ~~ 0 ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   444
            list do:[:aRow| aRow notNil ifTrue:[
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   445
                beDependentOfRows ifTrue:[aRow addDependent:self]
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   446
                                 ifFalse:[aRow removeDependent:self]
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   447
                ]
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   448
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   449
        ]
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   450
    ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   451
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   452
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   453
enableChannel:aChannel
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   454
    enableChannel notNil ifTrue:[
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   455
        enableChannel removeDependent:self
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   456
    ].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   457
    (enableChannel := aChannel) notNil ifTrue:[
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   458
        enableChannel addDependent:self
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   459
    ].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   460
!
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   461
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   462
multipleSelectOk
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   463
    "allow/disallow multiple row selections; the default is false
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   464
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   465
    ^ multipleSelectOk
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   466
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   467
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   468
multipleSelectOk:aState
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   469
    "allow/disallow multiple row selections; the default is false
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   470
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   471
    aState == multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   472
        multipleSelectOk := aState.
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   473
        self deselect
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   474
    ]
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   475
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   476
1938
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   477
opaqueColumnResize
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   478
    ^ labelView opaqueColumnResize
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   479
!
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   480
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   481
opaqueColumnResize:aBoolean
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   482
    labelView opaqueColumnResize:aBoolean
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   483
!
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   484
1946
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   485
scrollWhenUpdating
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   486
    "return the scroll behavior, when I get a new text 
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   487
     (via the model or the #contents/#list)
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   488
     Possible returnValues are:
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   489
        #keep / nil     -> no change
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   490
        #endOfText      -> scroll to the end
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   491
        #beginOfText    -> scroll to the top
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   492
     The default is #beginOfText.
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   493
     This may be useful for fields which get new values assigned from
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   494
     the program (i.e. not from the user)"
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   495
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   496
    ^ scrollWhenUpdating
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   497
!
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   498
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   499
scrollWhenUpdating:aSymbolOrNil
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   500
    "define how to scroll, when I get a new text 
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   501
     (via the model or the #contents/#list)
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   502
     Allowed arguments are:
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   503
        #keep / nil     -> no change
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   504
        #endOfText      -> scroll to the end
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   505
        #beginOfText    -> scroll to the top
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   506
     The default is #beginOfText.
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   507
     This may be useful for fields which get new values assigned from
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   508
     the program (i.e. not from the user)"
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   509
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   510
    scrollWhenUpdating := aSymbolOrNil
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   511
!
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   512
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   513
selectRowOnDefault
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   514
    "in case of selecting a none selectable cell, the row is selected
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   515
    "
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   516
    ^ selectRowOnDefault
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   517
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   518
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   519
selectRowOnDefault:aBool
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   520
    "in case of selecting a none selectable cell, the row is selected
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   521
    "
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   522
    selectRowOnDefault := aBool
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   523
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   524
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   525
tabIntern
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   526
    "returns true if tabing is supported in the widget
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   527
    "
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   528
    ^ tabIntern
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   529
!
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   530
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   531
tabIntern:aBool
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   532
    "returns true if tabing is supported in the widget
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   533
    "
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   534
    tabIntern := aBool ? true
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   535
!
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   536
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   537
useIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   538
    "specify, if the selected components value or its index in the
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   539
     list should be sent to the model. The default is its index.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   540
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   541
    ^ useIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   542
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   543
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   544
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   545
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   546
useIndex:aBool
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   547
    "specify, if the selected components value or its index in the
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   548
     list should be sent to the model. The default is its index.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   549
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   550
    useIndex := aBool
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   551
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   552
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   553
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   554
!DSVColumnView methodsFor:'accessing-colors'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   555
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   556
backgroundColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   557
    "get the background color of the rows
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   558
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   559
    ^ bgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   560
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   561
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   562
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   563
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   564
backgroundColor:aColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   565
    "set the background color of the rows
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   566
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   567
    bgColor ~~ aColor ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   568
        super viewBackground:bgColor.
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   569
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   570
        self realized ifTrue:[
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
   571
            bgColor := aColor onDevice:device.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   572
            self invalidate
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   573
        ] ifFalse:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   574
            bgColor := aColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   575
        ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   576
    ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   577
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   578
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   579
foregroundColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   580
    "return the foreground color of the rows
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   581
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   582
    ^ fgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   583
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   584
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   585
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   586
foregroundColor:aColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   587
    "set the foreground color of the rows
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   588
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   589
    fgColor ~~ aColor ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   590
        self realized ifTrue:[
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
   591
            fgColor := aColor onDevice:device.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   592
            self invalidate
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   593
        ] ifFalse:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   594
            fgColor := aColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   595
        ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   596
    ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   597
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   598
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   599
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   600
hgLgBgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   601
    "returns the background color of a selected row
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   602
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   603
    ^ hgLgBgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   604
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   605
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   606
hgLgFgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   607
    "returns the foreground color of a selected row
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   608
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   609
    ^ hgLgFgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   610
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   611
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   612
separatorDarkColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   613
    "returns the dark color used for drawing a shadowed separator (3D)
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   614
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   615
    ^ shadowColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   616
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   617
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   618
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   619
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   620
separatorLightColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   621
    "returns the light color used for drawing a shadowed separator (3D)
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   622
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   623
    ^ lightColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   624
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   625
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   626
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   627
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   628
!DSVColumnView methodsFor:'accessing-columns'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   629
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   630
columnAt:anIndex
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   631
    "returns the column at an index
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   632
    "
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   633
    ^ columnDescriptors at:anIndex ifAbsent:nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   634
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   635
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   636
columnDescriptors
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   637
    "returns list of column descriptors
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   638
    "
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   639
    ^ columnDescriptors collect:[:aCol| aCol description ]
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   640
!
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   641
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   642
columnDescriptors:aColumnDescriptionList
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   643
    "set the columnDescriptors
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   644
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   645
    |cid delta|
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   646
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   647
    self deselect.
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   648
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   649
    (viewOrigin x ~~ 0 or:[viewOrigin y ~~ 0]) ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   650
        delta := viewOrigin negated.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   651
        viewOrigin := 0@0.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   652
        super originChanged:delta
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   653
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   654
    cid := 0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   655
    columnDescriptors := aColumnDescriptionList ? #().
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   656
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   657
    columnDescriptors := columnDescriptors collect:[:el||dsc lbl|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   658
        dsc := el isSequenceable ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:el]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   659
                                ifFalse:[el].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   660
        cid := cid + 1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   661
        lbl := DataSetLabel new description:dsc builder:builder on:labelView.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   662
        DataSetColumn new on:self description:dsc columnNumber:cid label:lbl
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   663
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   664
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   665
    preferredExtent := nil.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   666
    labelView columns:columnDescriptors.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   667
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   668
    shown ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   669
        self fitColumns.
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   670
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   671
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   672
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   673
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   674
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   675
firstColumn
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   676
    "returns the first column
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   677
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   678
    ^ columnDescriptors at:1
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   679
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   680
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   681
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   682
lastColumn
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   683
    "returns the last column
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   684
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   685
    ^ columnDescriptors last
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   686
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   687
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   688
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   689
!DSVColumnView methodsFor:'accessing-interactors'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   690
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   691
checkToggleActiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   692
    ^ checkToggleActiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   693
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   694
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   695
checkToggleExtent
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   696
    "returns the extent of a checkToggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   697
    "
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   698
    ^ checkToggleExtent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   699
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   700
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   701
checkToggleForm
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   702
    "returns the form of a checkToggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   703
    "
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   704
    ^ checkToggleForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   705
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   706
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   707
checkToggleLevel
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   708
    "returns the level of a checkToggle button
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   709
    "
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   710
    ^ checkToggleLevel
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   711
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   712
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   713
checkTogglePassiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   714
    ^ checkTogglePassiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   715
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   716
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   717
comboButtonExtent
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   718
    "returns the extent of a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   719
    "
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   720
    ^ comboButtonExtent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   721
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   722
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   723
comboButtonForm
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   724
    "returns the form of a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   725
    "
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   726
    ^ comboButtonForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   727
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   728
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   729
comboButtonLevel
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   730
    "returns the level of a comboList or -Box button
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   731
    "
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   732
    ^ comboButtonLevel
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   733
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   734
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   735
rowSelectorExtent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   736
    "returns the bitmap of a selected row
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   737
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   738
    ^ rowSelectorForm extent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   739
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   740
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   741
rowSelectorForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   742
    "returns the bitmap of a selected row
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   743
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   744
    ^ rowSelectorForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   745
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   746
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   747
!DSVColumnView methodsFor:'accessing-mvc'!
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   748
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   749
columnAdaptor
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   750
    "return the value of the instance variable 'columnAdaptor' (automatically generated)"
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   751
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
   752
    columnAdaptor isValueModel ifTrue:[^ columnAdaptor value].
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
   753
  ^ columnAdaptor
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
   754
!
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   755
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   756
columnAdaptor:something
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   757
    "set the value of the instance variable 'columnAdaptor' (automatically generated)"
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   758
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
   759
    columnAdaptor isValueModel ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
   760
        columnAdaptor removeDependent:self
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
   761
    ].
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
   762
    (columnAdaptor := something) isValueModel ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
   763
        columnAdaptor addDependent:self
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
   764
    ].
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
   765
!
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
   766
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   767
columnHolder
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   768
    "get the valueHolder, which keeps the list of column descriptions
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   769
    "
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   770
    ^ columnHolder
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   771
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   772
!
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   773
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   774
columnHolder:aValueHolder
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   775
    "set the valueHolder, which keeps the list of column descriptions
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   776
    "
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   777
    |columns|
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   778
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   779
    columnHolder notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   780
        columnHolder removeDependent:self
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   781
    ].
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   782
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   783
    (columnHolder := aValueHolder) notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   784
        columnHolder addDependent:self.
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   785
        columns := columnHolder value.
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   786
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   787
        columns notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   788
            self columnDescriptors:columns
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   789
        ]
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   790
    ].
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   791
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   792
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   793
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   794
listAt:index put:newElement
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   795
    "kludge callback, when an element hs to be replaced
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   796
     due to a col-adaptor returning a new row element
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   797
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   798
    |list|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   799
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   800
    (list := listHolder value) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   801
        list at:index put:newElement
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   802
    ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   803
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   804
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   805
listHolder:aListHolder
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   806
    "set the valueHolder which holds the list of rows
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   807
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   808
    listHolder ~~ aListHolder ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   809
        listHolder notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   810
            listHolder removeDependent:self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   811
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   812
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   813
        (listHolder := aListHolder) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   814
            listHolder addDependent:self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   815
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   816
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   817
    self pushEvent:#list: with:(listHolder value).
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   818
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   819
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   820
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   821
model:aModel
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   822
    "set the valueHolder which holds the selection and maybe the list of rows
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   823
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   824
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   825
        model removeDependent:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   826
        (model respondsTo:#list) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   827
            (model list == listHolder) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   828
                self listHolder:nil
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   829
            ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   830
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   831
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   832
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   833
    (model := aModel) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   834
        model addDependent:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   835
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   836
        (aModel respondsTo:#list) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   837
            self listHolder:model list
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   838
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   839
    ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   840
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   841
! !
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   842
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   843
!DSVColumnView methodsFor:'accessing-rows'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   844
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   845
at:aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   846
    "return the row at an index, aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   847
    "
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   848
    |row|
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   849
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   850
    (row := list at:aRowNr) isNil ifTrue:[
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   851
        lockRowIndex := aRowNr.
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   852
1034
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   853
        (rowIfAbsentBlock notNil
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   854
        and:[(row := rowIfAbsentBlock value:aRowNr) notNil]) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   855
            list at:aRowNr put:row.
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   856
            beDependentOfRows ifTrue:[row addDependent:self].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   857
        ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   858
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   859
        lockRowIndex := 0
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   860
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   861
    ^ row
1034
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   862
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
   863
    "Modified: / 31.7.1998 / 01:07:46 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   864
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   865
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   866
at:aRowNr ifAbsent:exceptionBlock
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   867
    "return the row at a aRowNr. If the index is invalid, return the
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   868
     result of evaluating the exceptionblock
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   869
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   870
    (aRowNr between:1 and:list size) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   871
        ^ self at:aRowNr
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   872
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   873
    ^ exceptionBlock value
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   874
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   875
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   876
at:aRowNr put:aRow
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   877
    "change the row at an index. The added row is returned
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   878
    "
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
   879
    lockRowIndex ~~ aRowNr ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
   880
        (aRowNr <= list size and:[(list at:aRowNr) == aRow]) ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
   881
            self invalidateRowAt:aRowNr
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
   882
        ] ifFalse:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
   883
            self replaceFrom:aRowNr to:aRowNr with:(Array with:aRow) startingAt:1.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   884
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   885
    ].
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
   886
  ^ aRow
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   887
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   888
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   889
first
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   890
    "return the first row
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   891
    "
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   892
    ^ self at:1
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   893
!
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   894
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   895
identityIndexOfRow:aRow
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   896
    "returns index of a row or 0
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   897
    "
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   898
    (list size ~~ 0 and:[aRow notNil]) ifTrue:[
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   899
        ^ list identityIndexOf:aRow
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   900
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   901
    ^ 0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   902
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   903
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   904
last
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   905
    "return the last row
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   906
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   907
    ^ self at:(list size)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   908
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   909
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   910
list
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   911
    "get the list of rows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   912
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   913
    ^ list
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   914
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   915
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   916
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   917
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   918
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   919
list:aList
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   920
    "set the list of rows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   921
    "
1259
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
   922
    |makeDependent selectionHasChanged|
656
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
   923
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   924
    "/ remove selection without redraw
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
   925
1259
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
   926
    selectionHasChanged := self hasSelection.
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
   927
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
   928
    editValue notNil ifTrue:[
2588f809445d update:with:from:
ca
parents: 618
diff changeset
   929
        editValue removeDependent:self.
2588f809445d update:with:from:
ca
parents: 618
diff changeset
   930
        editValue := nil
2588f809445d update:with:from:
ca
parents: 618
diff changeset
   931
    ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
   932
    self destroyEditView.
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
   933
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   934
    selectedColIndex := 0.
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   935
    selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   936
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   937
    shown ifFalse:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   938
        preferredExtent := nil
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   939
    ] ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   940
        aList size ~~ 0 ifTrue:[  "/ otherwise keep old values
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   941
            columnDescriptors do:[:aCol| aCol invalidate ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   942
            preferredExtent := nil.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   943
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   944
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   945
656
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
   946
    (makeDependent := beDependentOfRows) ifTrue:[
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
   947
        self beDependentOfRows:false.
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
   948
    ].
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
   949
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
   950
    aList size ~~ 0 ifTrue:[
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
   951
        list := OrderedCollection new:(aList size).
645
53c78cc2ee08 redraw twice in case of expose event during adding a new entry
ca
parents: 643
diff changeset
   952
        aList do:[:el| list add:el ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   953
    ] ifFalse:[
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
   954
        list := nil.
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
   955
        viewOrigin := 0 @ 0.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   956
    ].
656
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
   957
    self beDependentOfRows:makeDependent.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   958
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
   959
    shown ifTrue:[
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
   960
        self fitColumns
1949
0d9451776275 delayed fitColumns if not shown while list is changed.
ps
parents: 1948
diff changeset
   961
    ] ifFalse:[
0d9451776275 delayed fitColumns if not shown while list is changed.
ps
parents: 1948
diff changeset
   962
        needFitColumns := true
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
   963
    ].
1259
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
   964
    selectionHasChanged ifTrue:[
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
   965
        self selectionChanged.
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
   966
    ].
2044
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
   967
    self contentsChanged.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   968
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   969
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   970
!DSVColumnView methodsFor:'accessing-visibility'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   971
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   972
font:aFont
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   973
    "set the font for all shown rows.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   974
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   975
    (aFont notNil and:[aFont ~~ font]) ifTrue:[
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
   976
        super font:(aFont onDevice:device).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   977
        realized ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
   978
            columnDescriptors do:[:aCol| aCol invalidate ].
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
   979
            self preferredExtentChanged.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   980
            self invalidate.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   981
            self contentsChanged
1842
402a364ee001 delegate font to labelView
martin
parents: 1818
diff changeset
   982
        ].
402a364ee001 delegate font to labelView
martin
parents: 1818
diff changeset
   983
        labelView notNil ifTrue:[
402a364ee001 delegate font to labelView
martin
parents: 1818
diff changeset
   984
            labelView font:font
402a364ee001 delegate font to labelView
martin
parents: 1818
diff changeset
   985
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   986
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   987
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   988
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   989
has3Dseparators
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   990
    "returns true if shown in 3D mode
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   991
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   992
    ^ separatorSize ~~ 1
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   993
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   994
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   995
has3Dseparators:aBool
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   996
    "enable or disable 3D mode
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   997
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   998
    |newSepSize|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   999
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1000
    newSepSize := aBool ifTrue:[2] ifFalse:[1].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1001
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1002
    newSepSize ~~ separatorSize ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1003
        separatorSize := newSepSize.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1004
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1005
        realized ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1006
            columnDescriptors do:[:aCol| aCol invalidate ].
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  1007
            self preferredExtentChanged.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1008
            self invalidate.
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1009
            self contentsChanged
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  1010
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1011
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1012
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1013
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1014
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1015
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1016
horizontalSpacing
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1017
    "horizontal spacing used by columns
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1018
    "
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1019
    ^ horizontalSpacing
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1020
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1021
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1022
horizontalSpacing:aNumber
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1023
    "horizontal spacing used by columns
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1024
    "
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1025
    horizontalSpacing ~~ aNumber ifTrue:[
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1026
        horizontalSpacing := aNumber.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1027
        self preferredExtentChanged.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1028
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1029
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1030
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1031
showLabels
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1032
    "control the labels view to be visible or unvisible
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1033
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1034
    ^ labelView isVisible
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1035
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1036
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1037
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1038
showLabels:aState
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1039
    "control the labels view to be visible or unvisible
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1040
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1041
    labelView isVisible:aState
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1042
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1043
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1044
verticalSpacing
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1045
    "vertical spacing used by columns
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1046
    "
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1047
    ^ verticalSpacing
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1048
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1049
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1050
verticalSpacing:aNumber
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1051
    "vertical spacing used by columns
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1052
    "
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1053
    verticalSpacing ~~ aNumber ifTrue:[
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1054
        verticalSpacing := aNumber.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1055
        self preferredExtentChanged.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1056
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1057
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1058
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1059
!DSVColumnView methodsFor:'adding & removing rows'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1060
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1061
add:aRow
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1062
    "insert row at end
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1063
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1064
    ^ self add:aRow beforeIndex:(1 + list size)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1065
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1066
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1067
add:aRow afterIndex:aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1068
    "add a new row after slot aRowNr and redisplay; returns nil in case
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1069
     of an invalid index or the row
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1070
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1071
    ^ self add:aRow beforeIndex:(aRowNr + 1)
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1072
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1073
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1074
add:aRow beforeIndex:aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1075
    "add a new row before slot aRowNr and redisplay; returns nil in case
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1076
     of an invalid index or the row
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1077
    "
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1078
    self addAll:(Array with:aRow) beforeIndex:aRowNr.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1079
    ^ aRow.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1080
!
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1081
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1082
addAll:aList beforeIndex:start
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1083
    "add a collection of rows before slot start and redisplay
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1084
    "
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1085
    |y0 y1 yD h dH size noSel|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1086
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1087
    (size := aList size) == 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1088
        ^ self
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1089
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1090
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1091
    list size == 0 ifTrue:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1092
        ^ self list:aList
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1093
    ].
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  1094
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1095
    beDependentOfRows ifTrue:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1096
        aList do:[:aRow| aRow notNil ifTrue:[aRow addDependent:self]]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1097
    ].
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1098
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1099
    noSel := self numberOfSelections.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1100
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1101
    noSel ~~ 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1102
        multipleSelectOk ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1103
            selectedRowIndex >= start ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1104
                selectedRowIndex := selectedRowIndex + size
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1105
            ]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1106
        ] ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1107
            1 to:noSel do:[:i||v|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1108
                (v := selectedRowIndex at:i) >= start ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1109
                    selectedRowIndex at:i put:(v + size)
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1110
                ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1111
            ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1112
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1113
    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1114
    list addAll:aList beforeIndex:start.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1115
    self recomputeHeightOfContents.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1116
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1117
    y0 := (start - 1) * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1118
    yD := size * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1119
    y1 := y0 + yD.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1120
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1121
    y0 < viewOrigin y ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1122
        self originWillChange.
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1123
        viewOrigin := viewOrigin x @ (yD + viewOrigin y).
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1124
        "/ viewOrigin y:(yD + viewOrigin y).
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1125
        self originChanged:(0 @ yD).
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1126
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1127
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1128
    (shown not or:[self sensor hasDamageFor:self]) ifTrue:[
2044
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1129
        self invalidate.
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1130
        self contentsChanged.
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1131
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1132
    ].
645
53c78cc2ee08 redraw twice in case of expose event during adding a new entry
ca
parents: 643
diff changeset
  1133
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1134
    y0 := self yVisibleOfRowNr:start.
1258
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1135
    h  := height - margin.
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1136
    y1 := y0 + yD min:h.
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1137
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1138
    (y1 > margin and:[y0 < h]) ifTrue:[
1952
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1139
        "/ cg: if I have a non-solid background color,
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1140
        "/ or individual items have a bgColor selector,
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1141
        "/ invalidate the area (and readraw) instead of a scroll.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1142
        (viewBackground isImageOrForm 
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1143
        or:[ self anyColumnHasPotentialNonConstantBackground ])
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1144
        ifTrue:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1145
            "/ do not scroll but invalidate ...
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1146
            self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0).
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1147
        ] ifFalse:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1148
            h  := h - y1.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1149
            y0 := y0 max:margin.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1150
            dH := y1 - y0.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1151
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1152
            start == list size ifFalse:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1153
                self copyFrom:self x:0 y:y0 toX:0 y:y1 width:width height:h async:false
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1154
            ].
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1155
            self invalidateX:margin y:y0 width:width - margin - margin height:dH.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1156
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1157
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1158
    self contentsChanged.
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  1159
!
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  1160
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1161
addFirst:aRow
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1162
    "insert a row at start
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1163
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1164
    ^ self add:aRow beforeIndex:1
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1165
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1166
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1167
remove:aRow
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1168
    "remove a row
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1169
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1170
    |idx|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1171
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1172
    idx := list identityIndexOf:aRow.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1173
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1174
    idx ~~ 0 ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1175
        self removeFrom:idx to:idx.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1176
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1177
    ^ aRow
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1178
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1179
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1180
removeFirst
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1181
    "remove first row; returns the removed row
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1182
    "
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1183
    ^ self removeIndex:1
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1184
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1185
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1186
removeFrom:startIndex to:stopIndex
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1187
    "remove rows from start to stop
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1188
    "
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1189
    |coll noRedraw
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1190
     noSel "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1191
     size  "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1192
     start "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1193
     stop  "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1194
     y0    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1195
     y1    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1196
     oY    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1197
     dY    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1198
     yB    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1199
     h     "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1200
    |
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1201
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1202
    (    (start := startIndex) < 1
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1203
     or:[(stop := stopIndex) > list size]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1204
    ) ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1205
        ^ self subscriptBoundsError:start
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1206
    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1207
    size := stop - start + 1.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1208
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1209
    beDependentOfRows ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1210
        list from:start to:stop do:[:r| r notNil ifTrue:[r removeDependent:self]].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1211
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1212
    noSel := self numberOfSelections.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1213
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1214
    noSel ~~ 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1215
        noSel == 1 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1216
            noSel := self firstIndexSelected.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1217
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1218
            noSel < start ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1219
                noSel > stop ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1220
                    noSel := noSel - size.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1221
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1222
                    multipleSelectOk ifFalse:[selectedRowIndex := noSel]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1223
                                      ifTrue:[selectedRowIndex at:1 put:noSel]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1224
                ] ifFalse:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1225
                    editValue notNil ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1226
                        editValue removeDependent:self.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1227
                        editValue := nil.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1228
                    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1229
                    self deselect.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1230
                ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1231
            ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1232
        ] ifFalse:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1233
            coll := OrderedCollection new:noSel.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1234
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1235
            selectedRowIndex do:[:i|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1236
                i < start ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1237
                    coll add:i
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1238
                ] ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1239
                    i > stop ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1240
                        coll add:(i - size)
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1241
                    ]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1242
                ]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1243
            ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1244
            coll size == 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1245
                self deselect
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1246
            ] ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1247
                selectedRowIndex := coll
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1248
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1249
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1250
    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1251
    list removeFrom:start to:stop.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1252
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1253
    y0 := start - 1 * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1254
    dY := size * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1255
    y1 := dY + y0.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1256
    yB := y1 + margin - viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1257
    self recomputeHeightOfContents.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1258
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1259
    y0 < (oY := viewOrigin y) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1260
        (noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY]
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1261
                                ifTrue:[dY := dY negated].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1262
        self originWillChange.
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1263
        viewOrigin := viewOrigin x @ (dY + oY).
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1264
        "/ viewOrigin y:(dY + oY).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1265
        self originChanged:(0 @ dY).        
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1266
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1267
        noRedraw := y0 > (height + viewOrigin y)
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1268
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1269
1483
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1270
    (shown not or:[self sensor hasDamageFor:self]) ifTrue:[
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1271
          self invalidate.
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1272
        ^ self contentsChanged.
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1273
    ].
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1274
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1275
    (noRedraw or:[shown not]) ifFalse:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1276
        y0 := self yVisibleOfRowNr:start.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1277
        y0 := y0 max:margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1278
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1279
        "/ cg: if I have a non-solid background color,
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1280
        "/ or individual items have a bgColor selector,
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1281
        "/ invalidate the area (and readraw) instead of a scroll.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1282
        (viewBackground isImageOrForm 
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1283
        or:[ self anyColumnHasPotentialNonConstantBackground ])
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1284
        ifTrue:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1285
            "/ do not scroll but invalidate ...
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1286
        ] ifFalse:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1287
            y1 := yB.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1288
            h  := height - margin - yB.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1289
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1290
            h > 0 ifTrue:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1291
                self copyFrom:self x:0 y:yB toX:0 y:y0 width:width height:h async:false
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1292
            ].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1293
            y0 := y0 + h.
561
43b62e424d52 check height is positive before copy
ca
parents: 556
diff changeset
  1294
        ].
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1295
        self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1296
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1297
    self contentsChanged.
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1298
!
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1299
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1300
removeIndex:aRowNr
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1301
    "remove row at an index; returns the removed row
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1302
    "
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1303
    |row|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1304
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1305
    row := list at:aRowNr ifAbsent:nil.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1306
    self removeFrom:aRowNr to:aRowNr.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1307
  ^ row
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1308
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1309
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1310
removeLast
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1311
    "remove last row; the row is returned
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1312
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1313
    ^ self removeIndex:(list size)
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1314
!
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1315
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1316
replaceFrom:start to:stop with:aCollection startingAt:repStart
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1317
    "replace elements in the receiver between index start and stop,
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1318
     with elements  taken from replacementCollection starting at repStart.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1319
     Return the receiver.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1320
    "
2032
6eb610caad85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1321
    |inSelList listSize repStop run|
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1322
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1323
    inSelList := OrderedCollection new.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1324
    listSize  := list size.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1325
    repStop   := repStart + (stop - start).
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1326
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1327
    list isNil ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1328
        list := OrderedCollection new
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1329
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1330
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1331
    [listSize < stop] whileTrue:[ list add:nil. listSize := listSize + 1 ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1332
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1333
    start to:stop do:[:i| |aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1334
        aRow := list at:i ifAbsent:nil.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1335
    
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1336
        aRow notNil ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1337
            beDependentOfRows ifTrue:[aRow removeDependent:self].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1338
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1339
            (self isInSelection:i) ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1340
                inSelList add:i
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1341
            ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1342
            list at:i put:nil.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1343
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1344
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1345
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1346
    beDependentOfRows ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1347
        aCollection from:repStart to:repStop do:[:aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1348
            aRow notNil ifTrue:[aRow addDependent:self]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1349
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1350
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1351
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1352
    run := start.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1353
    aCollection from:repStart to:repStop do:[:aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1354
        list at:run put:aRow.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1355
        run := run + 1.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1356
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1357
    self invalidateRowsFrom:start to:stop.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1358
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1359
    inSelList size ~~ 0 ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1360
        self numberOfSelections == inSelList size ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1361
            self deselect
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1362
        ] ifFalse:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1363
            selectedRowIndex := selectedRowIndex select:[:i| (inSelList identityIndexOf:i) == 0 ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1364
            self selectionChanged.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1365
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1366
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1367
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1368
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1369
!DSVColumnView methodsFor:'change & update'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1370
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1371
changeWidthOfColumn:aColumn deltaX:aDeltaX
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1372
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1373
    aColumn setDescWidth:(aColumn width + aDeltaX).
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1374
    preferredExtent notNil ifTrue:[self fitColumns]
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1375
!
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1376
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1377
sizeChanged:how
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1378
    "size changed - move origin up if possible
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1379
     change the layout of the labelView dependent on my layout
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1380
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1381
    |lyt|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1382
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1383
    super sizeChanged:how.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1384
1934
e47baca296b1 must react to sizeChanged: - even if not shown
frank
parents: 1930
diff changeset
  1385
    "/ no - must compute even if not visible.
e47baca296b1 must react to sizeChanged: - even if not shown
frank
parents: 1930
diff changeset
  1386
    "/ (could be invisible in a notebook ...)
e47baca296b1 must react to sizeChanged: - even if not shown
frank
parents: 1930
diff changeset
  1387
    realized ifTrue:[                   "used to be: shown" 
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1388
        labelView isVisible ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1389
            lyt := labelView layout.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1390
            lyt  leftOffset:(layout leftOffset).
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1391
            lyt rightOffset:(layout rightOffset).
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1392
            labelView layout:lyt.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1393
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1394
        self fitColumns.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1395
    ]
859
e63eb6f321e1 support List for columns
ca
parents: 833
diff changeset
  1396
!
e63eb6f321e1 support List for columns
ca
parents: 833
diff changeset
  1397
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1398
update:what with:aPara from:chgObj
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1399
    "one of my rows/cells changed its value
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1400
    "
1953
9190339e9fad lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
  1401
    |row newValue realValue listHoldersList arg1 arg2 col idx|
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1402
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1403
    chgObj == columnHolder ifTrue:[
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1404
        ^ self columnDescriptors:(columnHolder value)
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1405
    ].
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1406
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1407
    chgObj == columnAdaptor ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1408
        col := columnAdaptor value.
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1409
        columnDescriptors do:[:aCol| aCol columnAdaptor:col].
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1410
      ^ self invalidate
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1411
    ].
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1412
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1413
    chgObj == editValue ifTrue:[
1227
2dd18061afc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1414
        newValue := editValue value.
1673
67898506ba03 bug fix in update:with:from: model can changed during setting
ca
parents: 1668
diff changeset
  1415
        col := self selectedColumn.
67898506ba03 bug fix in update:with:from: model can changed during setting
ca
parents: 1668
diff changeset
  1416
        idx := self firstIndexSelected.
67898506ba03 bug fix in update:with:from: model can changed during setting
ca
parents: 1668
diff changeset
  1417
67898506ba03 bug fix in update:with:from: model can changed during setting
ca
parents: 1668
diff changeset
  1418
        col at:idx put:newValue.
67898506ba03 bug fix in update:with:from: model can changed during setting
ca
parents: 1668
diff changeset
  1419
        realValue := col at:idx.
67898506ba03 bug fix in update:with:from: model can changed during setting
ca
parents: 1668
diff changeset
  1420
67898506ba03 bug fix in update:with:from: model can changed during setting
ca
parents: 1668
diff changeset
  1421
        "/ !!!! editValue could be changed before set !!!! therefore: chgObj == editValue
67898506ba03 bug fix in update:with:from: model can changed during setting
ca
parents: 1668
diff changeset
  1422
67898506ba03 bug fix in update:with:from: model can changed during setting
ca
parents: 1668
diff changeset
  1423
        (chgObj == editValue and:[realValue ~= newValue]) ifTrue:[
1227
2dd18061afc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1424
            "/ some validation by the row-object; the stored value
2dd18061afc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1425
            "/ is different from what I think.
2dd18061afc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1426
            "/ update my input fields modelValue
2dd18061afc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1427
            editValue value:realValue.
2dd18061afc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1428
        ].
1673
67898506ba03 bug fix in update:with:from: model can changed during setting
ca
parents: 1668
diff changeset
  1429
1661
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1430
        modifiedChannel notNil ifTrue:[
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1431
            modifiedChannel value:true.
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1432
        ].
1227
2dd18061afc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1433
        ^ self
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1434
    ].
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1435
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1436
    chgObj == model ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1437
        (what == #selectionIndex or:[what == #selection]) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1438
            ^ self selectRowIndex:(model selectionIndex copy)
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1439
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1440
        what == #list ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1441
            ^ self listHolder:model list
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1442
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1443
        what == #value ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1444
            model == listHolder ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1445
                self list:(listHolder value)
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1446
            ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1447
                self selectRowIndex:model value
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1448
            ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1449
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1450
        ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1451
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1452
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1453
    chgObj == listHolder ifTrue:[
1953
9190339e9fad lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
  1454
        listHoldersList := listHolder value.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1455
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1456
        what == #value ifTrue:[
1953
9190339e9fad lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
  1457
            ^ self list:listHoldersList
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1458
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1459
        aPara isCollection ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1460
            arg1 := aPara at:1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1461
            arg2 := aPara at:2.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1462
        ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1463
            arg1 := arg2 := aPara
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1464
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1465
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1466
        what == #at: ifTrue:[
1953
9190339e9fad lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
  1467
            ^ self at:arg1 put:(listHoldersList at:arg1)
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1468
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1469
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1470
        what == #insert: ifTrue:[
1953
9190339e9fad lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
  1471
            ^ self add:(listHoldersList at:arg1) beforeIndex:arg1
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1472
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1473
        
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1474
        what == #remove: ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1475
            ^ self removeFrom:arg1 to:arg1
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1476
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1477
        what == #removeFrom: ifTrue:[
1954
Claus Gittinger <cg@exept.de>
parents: 1953
diff changeset
  1478
            listHoldersList size == 0 ifTrue:[self list:nil]
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1479
                          ifFalse:[self removeFrom:arg1 to:arg2].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1480
            ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1481
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1482
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1483
        what == #insertCollection: ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1484
            arg2 ~~ 0 ifTrue:[
1953
9190339e9fad lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
  1485
                self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1)) beforeIndex:arg1
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1486
            ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1487
            ^ self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1488
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1489
        what == #replace: ifTrue:[
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1490
            self replaceFrom:arg1 to:arg2 with:listHoldersList startingAt:arg1.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1491
          ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1492
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1493
        ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1494
    ].
1593
2188ae28557e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
  1495
    arg1 := aPara ? what.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1496
    row := (what isNumber) ifTrue:[what] ifFalse:[chgObj].
1593
2188ae28557e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
  1497
    self redrawVisibleRow:row readSelector:arg1.
2188ae28557e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
  1498
1661
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1499
    "Modified: / 30.1.2000 / 12:16:49 / cg"
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1500
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1501
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1502
!DSVColumnView methodsFor:'drag & drop'!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1503
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1504
canDrag
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1505
    "returns true if dragging is enabled
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1506
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1507
    ^ dropSource notNil
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1508
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1509
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1510
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1511
dropSource
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1512
    "returns the dropSource or nil
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1513
    "
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1514
    ^ dropSource
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1515
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1516
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1517
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1518
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1519
dropSource:aDropSourceOrNil
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1520
    "set the dropSource or nil
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1521
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1522
    dropSource := aDropSourceOrNil.
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1523
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1524
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1525
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1526
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1527
dropTarget
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1528
    "returns the dropTarget or nil
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1529
    "
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1530
    ^ dropTarget
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1531
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1532
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1533
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1534
dropTarget:aDropTragetOrNil
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1535
    "set the dropTarget or nil
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1536
    "
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1537
    dropTarget := aDropTragetOrNil.
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1538
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1539
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1540
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1541
startDragAt:aPoint
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1542
    (dragIsActive not and:[dropSource notNil]) ifTrue:[
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1543
        dragIsActive := true.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1544
        dropSource startDragIn:self at:aPoint
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1545
    ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1546
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1547
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1548
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1549
!DSVColumnView methodsFor:'drawing'!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1550
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1551
colorOnDevice:aColor
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1552
    "returns color on device
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1553
    "
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1554
    |col|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1555
641
tz
parents: 637
diff changeset
  1556
    aColor = Color noColor ifFalse:[
tz
parents: 637
diff changeset
  1557
        col := colorMap at:aColor ifAbsent:nil.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1558
641
tz
parents: 637
diff changeset
  1559
        col isNil ifTrue:[
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  1560
            colorMap at:aColor put:(col := aColor onDevice:device)
641
tz
parents: 637
diff changeset
  1561
        ].
tz
parents: 637
diff changeset
  1562
        ^ col
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1563
    ].
641
tz
parents: 637
diff changeset
  1564
    ^ bgColor
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1565
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1566
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1567
forceRedraw
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1568
    "a redraw forced by any other component
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1569
    "
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1570
    shown ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1571
        self invalidate
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1572
    ]
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1573
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1574
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1575
invalidate
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1576
    "recompute extent before repair range
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1577
    "
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1578
    self  recomputeHeightOfContents.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1579
    super invalidate.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1580
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1581
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1582
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1583
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1584
invalidateRowAt:aRowNr
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1585
    "redraw total row at an index
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1586
    "
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1587
    self invalidateRowAt:aRowNr colAt:0
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1588
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1589
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1590
invalidateRowAt:aRowNr colAt:aColNr
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1591
    "redraw visible row in case of aColNr == 0 or the column in a row;
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1592
     in case that the row/column is hidden no redraw is done
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1593
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1594
    |x "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1595
     y "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1596
     h "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1597
     w "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1598
    |
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1599
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1600
    (shown and:[aRowNr notNil and:[aRowNr between:1 and:list size]]) ifTrue:[
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1601
        h := rowHeight.
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1602
        y := self yVisibleOfRowNr:aRowNr.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1603
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1604
        y < margin ifTrue:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1605
            (h := h + y) <= margin ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1606
                ^ self
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1607
            ].                                                  "/ row not visible
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1608
            h := h - margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1609
            y := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1610
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1611
            y >= height ifTrue:[^ self].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1612
        ].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1613
        aColNr ~~ 0 ifTrue:[                                    "/ redraw column in row
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1614
            w := (self columnAt:aColNr) width.
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1615
            x := self xVisibleOfColNr:aColNr.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1616
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1617
            x < margin ifTrue:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1618
                (w := w + x) <= margin ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1619
                    ^ self
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1620
                ].                                              "/ column not visible
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1621
                w := w - margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1622
                x := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1623
            ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1624
                x >= width ifTrue:[^ self].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1625
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1626
        ] ifFalse:[                                             "/ redraw whole row
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1627
            x := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1628
            w := width.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1629
        ].
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1630
        self invalidateX:x y:y width:w height:h
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1631
    ]
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1632
!
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1633
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1634
invalidateRowsFrom:aStart to:aStop
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1635
    "redraw visible row from start to stop
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1636
    "
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1637
    |size start stop y0 y1|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1638
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1639
    shown ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1640
        size  := list size.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1641
        start := aStart notNil ifTrue:[aStart max:1]    ifFalse:[1].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1642
        stop  := aStop  notNil ifTrue:[aStop  min:size] ifFalse:[size].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1643
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1644
        start <= stop ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1645
            y0 := (self yVisibleOfRowNr:start)              max:margin.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1646
            y1 := ((self yVisibleOfRowNr:stop) + rowHeight) min:height.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1647
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1648
            y0 < y1 ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1649
                self invalidateX:margin y:y0 width:width height:(y1 - y0)
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1650
            ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1651
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1652
    ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1653
!
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1654
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1655
invalidateX:x y:y width:w height:h
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1656
    "invalidate a rectangle 
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1657
    "
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1658
    shown ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1659
        self invalidate:(Rectangle left:x top:y width:w height:h)
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1660
    ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1661
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1662
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1663
redrawVisibleRow:aRow
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1664
    "redraw row if visible
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1665
    "
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1666
    self redrawVisibleRow:aRow colAt:0
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1667
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1668
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1669
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1670
redrawVisibleRow:aRow colAt:aColNr
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1671
    "redraw row if visible
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1672
    "
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1673
    |start "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1674
     stop  "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1675
    |
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1676
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1677
    (start := self indexOfFirstRowShown) ~~ 0 ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1678
        stop := (start + (height // rowHeight)) min:(list size).
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1679
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1680
        aRow isNumber ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1681
            (aRow between:start and:stop) ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1682
                self invalidateRowAt:aRow colAt:aColNr
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1683
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1684
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1685
            start to:stop do:[:i|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1686
                (self at:i) == aRow ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1687
                    ^ self invalidateRowAt:i colAt:aColNr
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1688
                ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1689
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1690
        ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1691
    ]
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1692
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1693
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1694
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1695
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1696
redrawVisibleRow:aRow readSelector:aSelector
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1697
    "redraw a column identified by its read selector; if no column with
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1698
     the specified read selector is detected, the whole line is drawn.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1699
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1700
    |row idx|
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1701
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1702
    aSelector isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1703
        idx := 0
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1704
    ] ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1705
        (row := aRow) isNumber ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1706
            (row := self at:aRow) isNil ifTrue:[ ^ self ]
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1707
        ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1708
        idx := columnDescriptors findFirst:[:aCol||desc|
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1709
            aCol description readSelector == aSelector
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1710
        ]
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1711
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1712
    self redrawVisibleRow:aRow colAt:idx
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1713
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1714
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1715
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1716
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1717
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1718
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1719
redrawX:x y:y width:w height:h
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1720
    "redraw part of myself immediately, given logical coordinates 
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1721
    "
1941
ed782edda825 fix clibRectangle durring drawing
ca
parents: 1938
diff changeset
  1722
    |c0 savClip
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1723
     start "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1724
     stop  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1725
     x0    "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1726
     x1    "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1727
     maxX  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1728
     yTop  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1729
     yBot  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1730
     clHg  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1731
     size  "{ Class:SmallInteger }"
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1732
    |
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1733
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1734
    shown ifFalse:[^ self].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1735
    self paint:bgColor.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1736
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1737
    columnDescriptors isEmpty ifTrue:[
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1738
        ^ self fillRectangleX:x y:y width:w height:h
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1739
    ].
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1740
    size  := list size.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1741
    yTop  := margin - viewOrigin y.                   
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1742
    c0    := y - yTop max:0.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1743
    start := (c0 // rowHeight) + 1.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1744
    stop  := (c0 + h - 1 // rowHeight + 1) min:size.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1745
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1746
    stop < start ifTrue:[
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1747
        ^ self fillRectangleX:x y:y width:w height:h
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1748
    ].
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1749
    savClip := clipRect.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1750
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1751
    maxX := (x + w) min:(width - margin).
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1752
    x0   := margin - viewOrigin x.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1753
    yTop := yTop + ((start - 1) * rowHeight).
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1754
    clHg := (stop - start + 1) * rowHeight.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1755
    yBot := yTop + clHg.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1756
1941
ed782edda825 fix clibRectangle durring drawing
ca
parents: 1938
diff changeset
  1757
    columnDescriptors do:[:aCol| |cw|
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1758
        x1 := x0 + aCol width.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1759
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1760
        (x1 > x and:[x0 < maxX]) ifTrue:[
1941
ed782edda825 fix clibRectangle durring drawing
ca
parents: 1938
diff changeset
  1761
            |left right rect|
ed782edda825 fix clibRectangle durring drawing
ca
parents: 1938
diff changeset
  1762
            left  := x0 max:x.
ed782edda825 fix clibRectangle durring drawing
ca
parents: 1938
diff changeset
  1763
            right := x1 min:maxX.
ed782edda825 fix clibRectangle durring drawing
ca
parents: 1938
diff changeset
  1764
            rect  := Rectangle left:left top:y width:(right - left) height:h.
ed782edda825 fix clibRectangle durring drawing
ca
parents: 1938
diff changeset
  1765
        
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1766
            clipRect := nil.
1941
ed782edda825 fix clibRectangle durring drawing
ca
parents: 1938
diff changeset
  1767
            self clippingRectangle:rect.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1768
            aCol redrawX:x0 y:yTop h:clHg  from:start to:stop.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1769
        ].
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1770
        x0 := x1
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1771
    ].
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1772
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1773
 "/ restore old clipping rectangle
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1774
    self clippingRectangle:savClip.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1775
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1776
    stop == size ifTrue:[
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1777
        yTop := y + h.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1778
        yBot < (yTop - margin) ifTrue:[
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1779
         "/ clear to bottom of screen
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  1780
            self paint:bgColor.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1781
            self fillRectangleX:x y:yBot width:w height:(yTop - yBot).
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1782
        ]
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  1783
    ].
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  1784
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1785
    (c0 := w + x- x1) > 0 ifTrue:[
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1786
     "/ clear to right of screen
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  1787
        self paint:bgColor.
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  1788
        self fillRectangleX:x1 y:y width:c0 height:h.
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  1789
    ].
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1790
! !
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1791
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1792
!DSVColumnView methodsFor:'drawing interactors'!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1793
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1794
drawCheckToggleAtX:xTop y:yTop w:rowWidth state:aState
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1795
    "draw a check toggle button
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1796
    "
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1797
    |e form
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1798
     y "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1799
     x "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1800
     h "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1801
     w "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1802
    |
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1803
    w := checkToggleExtent x.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1804
    h := checkToggleExtent y.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1805
    y := yTop + (rowHeight - h // 2).
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1806
    x := xTop + (rowWidth  - w // 2).
1529
aa5e8fae6f23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
  1807
    h odd ifTrue:[y := y + 1].
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1808
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1809
    (form := checkToggleActiveImage) isNil ifTrue:[
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1810
        self paint:bgColor.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1811
        self fillRectangleX:x y:y width:w height:h.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1812
        self drawEdgesAtX:x   y:y width:w height:h level:checkToggleLevel on:self.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1813
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1814
        aState ifFalse:[
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1815
            ^ self
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1816
        ].
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1817
        self paint:fgColor on:bgColor.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1818
        form := checkToggleForm
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1819
    ] ifFalse:[
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1820
        aState ifFalse:[form := checkTogglePassiveImage]
859
e63eb6f321e1 support List for columns
ca
parents: 833
diff changeset
  1821
    ].
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1822
    e := (checkToggleExtent - form extent) // 2.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1823
    self displayForm:form x:(x + e x) y:(y + e y).
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1824
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1825
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1826
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1827
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1828
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1829
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1830
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1831
drawComboButtonAtX:xTop y:yTop w:rowWidth
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1832
    "draw a combo button
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1833
    "
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1834
    |e
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1835
     x "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1836
     y "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1837
     h "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1838
     w "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1839
    |
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1840
    w := comboButtonExtent x.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1841
    h := comboButtonExtent y.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1842
    y := yTop + (rowHeight - h // 2).
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1843
    x := xTop + (rowWidth  - w - separatorSize - 1).
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1844
    e := (comboButtonExtent - comboButtonForm extent) // 2.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1845
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1846
    self paint:bgColor.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1847
    self fillRectangleX:x y:y width:w height:h.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  1848
    self drawEdgesAtX:x   y:y width:w height:h level:comboButtonLevel on:self.
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  1849
    self paint:fgColor on:bgColor.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1850
    self displayForm:comboButtonForm x:(x + e x) y:(y + e y)
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1851
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1852
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1853
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1854
drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1855
    "draw edges for a cell or label
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1856
    "
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1857
    aGC  drawEdgesForX:x
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1858
                     y:y 
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1859
                 width:w
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1860
                height:h
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1861
                 level:aLevel 
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1862
                shadow:buttonShadowColor 
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1863
                 light:buttonLightColor
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1864
            halfShadow:buttonHalfShadowColor 
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1865
             halfLight:buttonHalfLightColor
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1866
                 style:ButtonEdgeStyle.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1867
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1868
! !
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1869
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1870
!DSVColumnView methodsFor:'enumerating columns'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1871
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1872
columnsDo:aOneArgBlock
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1873
    "evaluate the argument, aOneArgBlock for every column
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1874
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1875
    columnDescriptors do:aOneArgBlock
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1876
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1877
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1878
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1879
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1880
columnsFrom:start to:stop do:aOneArgBlock
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1881
    "evaluate the argument, aOneArgBlock for the columns with index start to
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1882
     stop in the collection of column descriptors
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1883
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1884
    columnDescriptors from:start to:stop do:aOneArgBlock
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1885
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1886
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1887
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1888
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1889
!DSVColumnView methodsFor:'event handling'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1890
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1891
buttonMotion:buttonMask x:x y:y
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1892
    "mouse-move while button was pressed - handle multiple selection changes
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1893
    "
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1894
    |lnNr p oldSelection step|
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1895
1958
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1896
    buttonMask = 0 ifTrue:[
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1897
        dragAccessPoint := nil.
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1898
        dragIsActive := false.
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1899
    ].
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1900
1809
021aaf4e6006 added: enable-query in buttonMotion
tm
parents: 1807
diff changeset
  1901
    self isEnabled ifFalse:[^ self].
021aaf4e6006 added: enable-query in buttonMotion
tm
parents: 1807
diff changeset
  1902
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1903
    dragAccessPoint notNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1904
        dragIsActive ifFalse:[
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1905
            p := x @ y.
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  1906
            (clickPosition dist:p) > 5.0 ifTrue:[ self startDragAt:p ]
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1907
        ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1908
        ^ self
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1909
    ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1910
    self sensor ctrlDown ifTrue:[^ self ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1911
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1912
    (multipleSelectOk and:[selectedColIndex == 0 and:[selectedRowIndex notNil]]) ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1913
        ^ self
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1914
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1915
    "is it the select or 1-button ?"
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1916
1023
59c1888ca494 use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents: 1008
diff changeset
  1917
    self sensor leftButtonPressed ifFalse:[^ self].
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1918
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1919
    autoScroll ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1920
        "/ if moved outside of view, start autoscroll
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1921
        (y < 0) ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1922
            ^ self startAutoScroll:[self scrollUp] distance:y.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1923
        ].
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1924
        (y > height) ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1925
            ^ self startAutoScroll:[self scrollDown] distance:(y - height).
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1926
        ].
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1927
    ].
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1928
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1929
    "move inside - stop autoscroll if any"
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1930
    self stopAutoScroll.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1931
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1932
    y > height ifTrue:[
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1933
        lnNr := self yVisibleToRowNr:(height + rowHeight).
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1934
    ] ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1935
        y < 0 ifTrue:[
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1936
            lnNr := self yVisibleToRowNr:(rowHeight negated).
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1937
        ] ifFalse:[
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1938
            lnNr := self yVisibleToRowNr:y.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1939
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1940
    ].
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1941
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1942
    (lnNr isNil or:[lnNr < 1]) ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1943
        ^ self
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1944
    ].
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  1945
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1946
    oldSelection     := selectedRowIndex asOrderedCollection.
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1947
    selectedRowIndex := OrderedCollection new.
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1948
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1949
    clickPosition isNil ifTrue:[
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1950
        clickPosition := oldSelection at:1 ifAbsent:lnNr
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  1951
    ].
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1952
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1953
    step := lnNr < clickPosition ifTrue:[-1] ifFalse:[1].
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1954
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1955
    clickPosition to:lnNr by:step do:[:i|
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1956
        selectedRowIndex add:i.
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1957
        oldSelection removeIdentical:i ifAbsent:[ self invalidateRowAt:i colAt:0 ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1958
    ].
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1959
    oldSelection do:[:i| self invalidateRowAt:i colAt:0 ].
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
  1960
    self scrollToRowAt:lnNr colAt:0.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1961
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1962
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1963
buttonMultiPress:button x:x y:y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1964
    "a button was pressed twice - handle doubleclick here
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1965
    "
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  1966
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  1967
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1968
    ((button == 1) or:[button == #select]) ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1969
        ^ super buttonMultiPress:button x:x y:y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1970
    ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1971
    self numberOfSelections == 1 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1972
        self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1973
            (     selectedColIndex == 0
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1974
              or:[selectedColIndex == (self xVisibleToColNr:x)]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1975
            ) ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1976
                self doubleClicked
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1977
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1978
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1979
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1980
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1981
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1982
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1983
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1984
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1985
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1986
buttonPress:button x:x y:y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1987
    "a button was pressed - handle selection here
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1988
    "
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  1989
    |rowNr colNr menu sz first sensor|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1990
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  1991
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  1992
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  1993
    sensor := self sensor.
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  1994
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1995
    clickPosition   := nil.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1996
    dragAccessPoint := nil.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1997
    dragIsActive    := false.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1998
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  1999
    ((button == 2) or:[button == #menu]) ifTrue:[
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2000
        (menu := self findMenuForSelection) notNil ifTrue:[
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2001
            ^ menu startUp
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2002
        ]
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2003
    ] ifFalse:[
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2004
        (     (button == 1 or:[button == #select])
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2005
         and:[(rowNr := self yVisibleToRowNr:y) notNil
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2006
         and:[(colNr := self xVisibleToColNr:x) notNil]]
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2007
        ) ifTrue:[
1603
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2008
            multipleSelectOk ifTrue:[
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2009
                sensor ctrlDown ifTrue:[
1603
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2010
                    selectedColIndex ~~ 0 ifTrue:[
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2011
                        colNr := 0
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2012
                    ] ifFalse:[
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2013
                        (sz := self numberOfSelections == 0) ifFalse:[
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2014
                            (self isInSelection:rowNr) ifTrue:[
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2015
                                sz == 1 ifTrue:[
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2016
                                    self selectColIndex:0 rowIndex:nil.
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2017
                                    sensor flushMotionEventsFor:self.
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2018
                                    ^ self    
1603
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2019
                                ].
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2020
                                selectedRowIndex remove:rowNr.
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2021
                            ] ifFalse:[
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2022
                                selectedRowIndex add:rowNr
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2023
                            ].
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2024
                            self invalidateRowAt:rowNr.
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2025
                            self selectionChanged.
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2026
                            sensor flushMotionEventsFor:self.
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2027
                            ^ self
1603
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2028
                        ]
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2029
                    ]
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2030
                ] ifFalse:[
1603
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2031
                    (     selectedColIndex == 0
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2032
                     and:[(first := self firstIndexSelected) ~~ 0
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2033
                     and:[sensor shiftDown]]
1603
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2034
                    ) ifTrue:[|step list|
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2035
                        list := OrderedCollection new.
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2036
                        step := first < rowNr ifTrue:[1] ifFalse:[-1].
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2037
                        first to:rowNr by:step do:[:i|list add:i].
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2038
                        self selectedRowIndex:list.
33050a097bf2 checkin from browser
ca
parents: 1593
diff changeset
  2039
                        ^ self.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2040
                    ]
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2041
                ]
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2042
            ].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2043
            (self canDrag and:[self isSelected:rowNr inColumn:colNr]) ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2044
                clickPosition   := x @ y.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2045
                dragAccessPoint := (colNr @ rowNr).
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2046
            ] ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2047
                self selectRowAt:rowNr colAt:colNr atPoint:(x @ y)
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2048
            ].
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2049
            ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2050
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2051
    ].
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2052
    super buttonPress:button x:x y:y
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2053
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2054
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2055
buttonRelease:button x:x y:y
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2056
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  2057
    self stopAutoScroll.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  2058
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2059
    clickPosition notNil ifTrue:[
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2060
        dragAccessPoint notNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2061
            dragIsActive ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2062
                self selectRowAt:(dragAccessPoint y)
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2063
                           colAt:(dragAccessPoint x)
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2064
                         atPoint:clickPosition
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2065
            ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2066
            dragAccessPoint := nil.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2067
            dragIsActive := false.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2068
        ] ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2069
            self selectionChanged
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2070
        ].        
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2071
        clickPosition := nil.
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2072
    ].
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2073
    super buttonRelease:button x:x y:y
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2074
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2075
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2076
!
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2077
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2078
characterPress:aChar x:x y:y
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2079
    "search row in column at x/y starting its printable label with cahracter.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2080
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2081
    |colNr rowNr lsize found column|
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2082
872
ad92183a6e6b pass unhandled keys up (for focus control)
Claus Gittinger <cg@exept.de>
parents: 861
diff changeset
  2083
    (rowIfAbsentBlock notNil 
896
aa07612a7c04 care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2084
     or:[x isNil
aa07612a7c04 care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2085
     or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2086
        ^ self
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2087
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2088
    rowNr  := self lastIndexSelected.
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2089
    lsize  := list size.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2090
    column := self columnAt:colNr.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2091
    found  := 0.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2092
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2093
    lsize > rowNr ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2094
     "/ search to end
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2095
        found := column findRowNrStartingWithChar:aChar start:(rowNr + 1) stop:lsize.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2096
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2097
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2098
    (found == 0 and:[rowNr > 1]) ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2099
     "/ search from begin
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2100
        found := column findRowNrStartingWithChar:aChar start:1 stop:(rowNr - 1)
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2101
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2102
    found ~~ 0 ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2103
        self selectColIndex:colNr rowIndex:found.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2104
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2105
896
aa07612a7c04 care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2106
    "Modified: / 21.5.1998 / 03:30:22 / cg"
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2107
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2108
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2109
contentsChanged
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2110
    "contents changed - move origin up if possible
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2111
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2112
    |y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2113
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2114
    shown ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2115
        self recomputeHeightOfContents.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2116
        y := self maxViewOriginY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2117
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2118
        viewOrigin y > y ifTrue:[
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  2119
            scrollWhenUpdating ~~ false ifTrue:[
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  2120
                self scrollTo:(viewOrigin x @ y)
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  2121
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2122
        ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2123
            self updateEditViewOrigin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2124
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2125
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2126
    super contentsChanged
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2127
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2128
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2129
doubleClicked
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2130
    "handle a double click
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2131
    "
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2132
    |col sel idx|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2133
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2134
    self hasSelection ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2135
        idx := self firstIndexSelected.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2136
        col := self selectedColumn.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2137
        (col notNil and:[(sel := col doubleClickedSelector) notNil]) ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2138
            (self at:idx) perform:sel
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2139
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2140
            doubleClickActionBlock notNil ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2141
                doubleClickActionBlock value:idx
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2142
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2143
        ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2144
    ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2145
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2146
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2147
findMenuForSelection
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2148
    "find the middle button menu for the current selection; returns the menu or nil
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2149
    "
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2150
    |col row menu|
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2151
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2152
    self numberOfSelections == 1 ifTrue:[
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2153
        row := self at:(self firstIndexSelected).
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2154
        col := self selectedColumn.
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2155
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2156
        (col notNil and:[(menu := col menuForRow:row) notNil]) ifTrue:[
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2157
            ^ menu
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2158
        ].
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2159
        col := columnDescriptors detect:[:c| c rendererType == #rowSelector]
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2160
                                 ifNone:[nil].
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2161
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2162
        col notNil ifTrue:[
1223
176702811314 kludge: when asking for an itemMenu, pass application to
tm
parents: 1215
diff changeset
  2163
            ^ col menuForRow:row inApplication:(self application)
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2164
        ]
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2165
    ].
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2166
    ^ nil
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2167
!
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2168
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2169
keyPress:aKey x:x y:y
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2170
    "a key was pressed - handle page-keys here
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2171
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2172
    <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2173
                          #BeginOfText #EndOfText #ScrollUp #ScrollDown
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2174
                          #CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)>
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2175
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2176
    |sensor maxColNr selRowNr selColNr key column isTab listSize hasSelectables|
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2177
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2178
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2179
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2180
    (sensor := self sensor) isNil ifTrue:[
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2181
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2182
    ].
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2183
    (listSize := list size) == 0 ifTrue:[
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2184
        ^ super keyPress:aKey x:x y:y
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2185
    ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2186
    aKey isCharacter ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2187
        ^ self characterPress:aKey x:x y:y
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2188
    ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2189
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2190
    (aKey == #SelectAll) ifTrue:[
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2191
        multipleSelectOk ifTrue:[
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2192
            self selectAllRows. 
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2193
        ].
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2194
        ^ self
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2195
    ].
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2196
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2197
    aKey == #PreviousPage ifTrue:[^ self pageUp].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2198
    aKey == #NextPage     ifTrue:[^ self pageDown].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2199
    aKey == #HalfPageUp   ifTrue:[^ self halfPageUp].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2200
    aKey == #HalfPageDown ifTrue:[^ self halfPageDown].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2201
    aKey == #BeginOfText  ifTrue:[^ self scrollToTop].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2202
    aKey == #EndOfText    ifTrue:[^ self scrollToBottom].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2203
    aKey == #ScrollUp     ifTrue:[^ self scrollUp]. 
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2204
    aKey == #ScrollDown   ifTrue:[^ self scrollDown]. 
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2205
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2206
    aKey == #Return ifTrue:[
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2207
        self numberOfSelections == 1 ifTrue:[self doubleClicked].
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2208
      ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2209
    ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2210
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2211
    hasSelectables := false.
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2212
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2213
    columnDescriptors do:[:aCol|
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2214
        (hasSelectables or:[aCol rendererType == #rowSelector]) ifFalse:[
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2215
            hasSelectables := aCol description canSelect
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2216
        ]
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2217
    ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2218
    selRowNr := self firstIndexSelected.
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2219
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2220
    (aKey == #CursorUp or:[aKey == #CursorDown]) ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2221
        (hasSelectables or:[selectRowOnDefault]) ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2222
            selColNr := hasSelectables ifFalse:[0]
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2223
                                        ifTrue:[selectedColIndex].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2224
        
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2225
            aKey == #CursorUp ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2226
                selRowNr := selRowNr > 1 ifTrue:[selRowNr - 1] ifFalse:[listSize].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2227
            ] ifFalse:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2228
                selRowNr := selRowNr < listSize ifTrue:[selRowNr + 1] ifFalse:[1].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2229
            ].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2230
            self selectColIndex:selColNr rowIndex:selRowNr
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2231
        ].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2232
        ^ self
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2233
    ].
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2234
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2235
    hasSelectables ifFalse:[
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2236
        ^ super keyPress:aKey x:x y:y
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2237
    ].
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2238
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2239
    "/ CURSOR LEFT/RIGHT or TABING
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2240
    (aKey == #CursorLeft or:[aKey == #CursorRight]) ifFalse:[
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2241
        tabIntern ifFalse:[
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2242
            ^ super keyPress:aKey x:x y:y
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2243
        ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2244
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2245
        (aKey includesString:'Tab') ifTrue:[
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2246
            key := (sensor shiftDown or:[aKey includesString:'Left']) ifTrue:[#CursorLeft]
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2247
                                                                     ifFalse:[#CursorRight]
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2248
        ] ifFalse:[
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2249
            (aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2250
                ^ super keyPress:aKey x:x y:y
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2251
            ].
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2252
            key := aKey == #FocusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2253
        ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2254
        isTab := true.
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2255
    ] ifTrue:[
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2256
        isTab := false.
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2257
        key   := aKey.
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2258
    ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2259
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2260
    maxColNr := self numberOfColumns.
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2261
    selColNr := selectedColIndex.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  2262
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2263
    key == #CursorLeft ifTrue:[
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2264
        selRowNr == 0 ifTrue:[selRowNr := listSize].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2265
        selColNr == 0 ifTrue:[selColNr := maxColNr + 1].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2266
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2267
        [true] whileTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2268
            (selColNr := selColNr - 1) == 0 ifTrue:[
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2269
                (selRowNr := selRowNr - 1) == 0 ifTrue:[
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2270
                    isTab ifTrue:[
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2271
                        tabAtStartAction notNil ifTrue:[
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2272
                            tabAtStartAction value
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2273
                        ] ifFalse:[
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2274
                            self deselect.
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2275
                            self windowGroup focusPreviousFrom:self
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2276
                        ]
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2277
                    ].
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2278
                    ^ self
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2279
                ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2280
                selColNr := maxColNr
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2281
            ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2282
            column := self columnAt:selColNr.
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2283
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2284
            (column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2285
                ^ self selectColIndex:selColNr rowIndex:selRowNr.
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2286
            ]
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2287
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2288
    ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2289
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2290
    selRowNr == 0 ifTrue:[selRowNr := 1].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2291
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2292
    [true] whileTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2293
        (selColNr := selColNr + 1) > maxColNr ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2294
            (selRowNr := selRowNr + 1) > listSize ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2295
                isTab ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2296
                    tabAtEndAction notNil ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2297
                        tabAtEndAction value
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2298
                    ] ifFalse:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2299
                        self deselect.
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2300
                        self windowGroup focusNextFrom:self
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2301
                    ]
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2302
                ].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2303
                ^ self
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2304
            ].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2305
            selColNr := 1
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2306
        ].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2307
        column := self columnAt:selColNr.
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2308
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2309
        (column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2310
            ^ self selectColIndex:selColNr rowIndex:selRowNr
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2311
        ]
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2312
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2313
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2314
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2315
originChanged:delta
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2316
    "this one is sent, after the origin of my contents has changed -
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2317
     tell dependents (i.e. scrollers) about this
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2318
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2319
    super originChanged:delta.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2320
    self updateEditViewOrigin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2321
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2322
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2323
!DSVColumnView methodsFor:'focus handling'!
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2324
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2325
canTab
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2326
    super canTab ifTrue:[
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2327
        ^ editView isNil
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2328
    ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2329
    ^ false
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2330
! !
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  2331
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2332
!DSVColumnView methodsFor:'gc operations'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2333
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2334
imageOnDevice:anImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2335
    "associate image to device and clear pixel mask; returns the new image.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2336
    "
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2337
    |image|
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2338
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2339
    (image := anImage) notNil ifTrue:[
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2340
        image device ~~ device ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2341
            image := image copy onDevice:device.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2342
        ].
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2343
        image isImage ifTrue:[
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2344
            image := image clearMaskedPixels
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2345
        ]
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2346
    ].
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2347
    ^ image
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2348
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2349
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2350
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2351
registerImage:anImage key:aKey
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2352
    "any row can register an image with a unique identifier a key symbol
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2353
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2354
    |img|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2355
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2356
    (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2357
        ^ img
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2358
    ].
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2359
    img := self imageOnDevice:anImage.
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  2360
    registererImages at:aKey put:img.
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  2361
    ^ img
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2362
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2363
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2364
registeredImageAt:aKey
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2365
    "any row can register an image with a unique identifier
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2366
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2367
    ^ registererImages at:aKey ifAbsent:nil
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2368
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2369
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2370
releaseAllRegisteredImages
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2371
    "release all registered images
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2372
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2373
    registererImages := IdentityDictionary new.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2374
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2375
1326
7ec8697bad24 category change
Claus Gittinger <cg@exept.de>
parents: 1311
diff changeset
  2376
!DSVColumnView methodsFor:'initialize / release'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2377
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2378
create
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2379
    "set color on device
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2380
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2381
    super create.
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  2382
    fgColor     := fgColor     onDevice:device.
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  2383
    bgColor     := bgColor     onDevice:device.
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  2384
    hgLgFgColor := hgLgFgColor onDevice:device.
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  2385
    hgLgBgColor := hgLgBgColor onDevice:device.
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  2386
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  2387
    buttonShadowColor := buttonShadowColor onDevice:device.
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  2388
    buttonLightColor  := buttonLightColor onDevice:device.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2389
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2390
    buttonHalfShadowColor notNil ifTrue:[
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  2391
        buttonHalfShadowColor := buttonHalfShadowColor onDevice:device
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2392
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2393
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2394
    buttonHalfLightColor notNil ifTrue:[
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  2395
        buttonHalfLightColor := buttonHalfLightColor onDevice:device
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2396
    ].
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2397
    rowSelectorForm         := self imageOnDevice:rowSelectorForm.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2398
    checkToggleActiveImage  := self imageOnDevice:checkToggleActiveImage.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2399
    checkTogglePassiveImage := self imageOnDevice:checkTogglePassiveImage.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2400
    comboButtonForm         := self imageOnDevice:comboButtonForm.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2401
    checkToggleForm         := self imageOnDevice:checkToggleForm.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2402
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2403
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2404
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2405
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2406
destroy
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2407
    "remove dependencies
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2408
    "
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  2409
    self columnHolder:nil.
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2410
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2411
    listHolder    removeDependent:self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2412
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  2413
    columnAdaptor isValueModel ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  2414
        columnAdaptor removeDependent:self
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  2415
    ].
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  2416
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  2417
    self beDependentOfRows:false.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2418
    super destroy
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2419
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2420
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2421
initStyle
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2422
    "setup colors
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2423
    "
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2424
    |button widget|
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2425
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2426
    super initStyle.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2427
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2428
    DefaultForegroundColor isNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2429
        self class updateStyleCache
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2430
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2431
    fgColor     := DefaultForegroundColor.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2432
    bgColor     := DefaultBackgroundColor.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2433
    hgLgFgColor := DefaultHilightForegroundColor.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2434
    hgLgBgColor := DefaultHilightBackgroundColor.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2435
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2436
    shadowColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2437
        shadowColor := Color grayPercent:40.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2438
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2439
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2440
    lightColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2441
        lightColor := Color grayPercent:75
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2442
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2443
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2444
    buttonLightColor    := ButtonLightColor  ? lightColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2445
    buttonShadowColor   := ButtonShadowColor ? shadowColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2446
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2447
    (ButtonEdgeStyle == #soft) ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2448
        buttonHalfShadowColor := ButtonHalfShadowColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2449
        buttonHalfLightColor  := ButtonHalfLightColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2450
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2451
        buttonHalfShadowColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2452
            buttonHalfShadowColor := buttonShadowColor lightened
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2453
        ]
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2454
    ].
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  2455
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  2456
    buttonHalfShadowColor isNil ifTrue:[
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  2457
        buttonHalfShadowColor := Color gray
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  2458
    ].
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  2459
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2460
    rowSelectorForm         := self class rowSelector.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2461
    checkToggleActiveImage  := CheckToggleActiveImage.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2462
    checkTogglePassiveImage := CheckTogglePassiveImage.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  2463
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2464
    ComboButtonForm isNil ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2465
        widget            := ComboListView new.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2466
        button            := widget menuButton.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2467
        ComboButtonForm   := button label.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2468
        ComboButtonLevel  := button offLevel.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2469
        ComboButtonExtent := (button preferredExtent x) @ (widget preferredExtent y).
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2470
    ].
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2471
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2472
    CheckToggleForm isNil ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2473
        widget            := CheckToggle new.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2474
        CheckToggleForm   := widget label.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2475
        CheckToggleLevel  := widget offLevel.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2476
        CheckToggleExtent := widget preferredExtent.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2477
    ].
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2478
    comboButtonForm   := ComboButtonForm.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2479
    comboButtonLevel  := ComboButtonLevel.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2480
    comboButtonExtent := ComboButtonExtent.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2481
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2482
    checkToggleForm   := CheckToggleForm.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2483
    checkToggleLevel  := CheckToggleLevel.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2484
    checkToggleExtent := CheckToggleExtent.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2485
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2486
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2487
initialize
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2488
    "set default attributes
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2489
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2490
    super initialize.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2491
    self lineWidth:0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2492
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  2493
    tabIntern          := true.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2494
    useIndex           := true.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2495
    viewOrigin         := 0@0.
1480
51dd0cc6ea11 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1461
diff changeset
  2496
    font               := font onDevice:device.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2497
    rowHeight          := font height.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2498
    multipleSelectOk   := false.                        "/ multiselect disabled
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2499
    selectedRowIndex   := selectedColIndex  := 0.       "/ no selection
1778
51bbd960baf9 change registeredIcons from IdentityDictionary to Dictionary
ca
parents: 1776
diff changeset
  2500
    registererImages   := Dictionary new.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2501
    columnDescriptors  := #().
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2502
    beDependentOfRows  := false.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2503
    verticalSpacing    := self class verticalSpacing.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2504
    horizontalSpacing  := self class horizontalSpacing.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2505
    colorMap           := Dictionary new.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2506
    catchChangeEvents  := false.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2507
    dragIsActive       := false.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2508
    rowFontAscent      := 1.                            "/ dummy initialization
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2509
    separatorSize      := 1.                            "/ separators mode 2D
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2510
    selectRowOnDefault := true.
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  2511
    autoScroll         := true.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2512
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2513
705
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  2514
mapped
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  2515
    "set selection if exists after mapping
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  2516
    "
2032
6eb610caad85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  2517
"/    |idx|
6eb610caad85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  2518
"/
705
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  2519
    super mapped.
2011
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2520
"/    needFitColumns == true ifTrue:[
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2521
"/        self fitColumns
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2522
"/    ].
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2523
"/
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2524
"/    (idx := self firstIndexSelected) ~~ 0 ifTrue:[
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2525
"/        self scrollToRowAt:idx colAt:0.        
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2526
"/    ].
705
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  2527
!
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  2528
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2529
realize
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2530
    "recompute contents and fit columns to view
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2531
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2532
    |selection|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2533
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2534
    self  bitGravity:#NorthWest.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2535
    self  recomputeHeightOfContents.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2536
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2537
    selection := 0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2538
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2539
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2540
        (model respondsTo:#selectionIndex) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2541
            selection := model selectionIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2542
        ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2543
            model == listHolder ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2544
                selection := model value
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2545
            ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2546
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2547
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2548
    self selectRowIndex:selection.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2549
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2550
    super realize.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2551
    self  fitColumns.
2011
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2552
!
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2553
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2554
realized
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2555
    "set selection if exists after mapping
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2556
    "
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2557
    |idx|
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2558
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2559
    super realized.
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2560
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2561
    needFitColumns == true ifTrue:[
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2562
        self fitColumns
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2563
    ].
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2564
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2565
    (idx := self firstIndexSelected) ~~ 0 ifTrue:[
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2566
        self scrollToRowAt:idx colAt:0.        
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  2567
    ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2568
! !
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2569
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2570
!DSVColumnView methodsFor:'obsolete'!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2571
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2572
has3Dsepartors
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2573
    "shouldn't be used any more
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2574
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2575
    ^ self has3Dseparators
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2576
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2577
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2578
has3Dsepartors:aBool
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2579
    "shouldn't be used any more
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2580
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2581
    self has3Dseparators:aBool
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2582
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2583
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2584
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2585
!DSVColumnView methodsFor:'private'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2586
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2587
anyColumnHasBackground
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2588
    columnDescriptors isNil ifTrue:[^ false].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2589
    columnDescriptors do:[:eachCol |
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2590
        |bg|
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2591
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2592
        bg := eachCol backgroundColor.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2593
        (bg notNil and:[bg isImageOrForm]) ifTrue:[^ true].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2594
        eachCol bgSelector notNil ifTrue:[^ true].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2595
    ].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2596
    ^ false.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2597
!
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2598
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2599
anyColumnHasPotentialNonConstantBackground
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2600
    columnDescriptors isNil ifTrue:[^ false].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2601
    columnDescriptors do:[:eachCol | eachCol hasPotentialNonConstantBackground ifTrue:[^ true]].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2602
    ^ false.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2603
!
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2604
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2605
destroyEditView
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2606
    "destroy the edit view; release KeyboardForwarder
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2607
    "
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2608
    editView notNil ifTrue:[
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2609
        editView withAllSubViewsDo:[:aView|
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2610
            aView delegate:nil
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2611
        ].
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2612
        editView destroy.
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2613
        editView := nil.
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2614
        self windowGroup focusView:nil.
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2615
    ].
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2616
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2617
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2618
!
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2619
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2620
detectViewAt:aPoint in:aView
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
  2621
    "returns the view at a point
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
  2622
    "
2031
74c383e916b8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2019
diff changeset
  2623
    aView isNil ifTrue:[^ nil].
2019
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2624
    ^ aView detectViewAt:aPoint.
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2625
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2626
"/ cg: old code was (refactored to use common code)
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2627
"/
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2628
"/    |p|
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2629
"/
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2630
"/    (aView notNil and:[aView subViews notNil]) ifTrue:[
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2631
"/        aView subViews do:[:sv|
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2632
"/            p := device translatePoint:aPoint fromView:self toView:sv.
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2633
"/
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2634
"/            (p x >= 0 and:[p y >= 0 and:[p x <= sv width and:[p y <= sv height]]]) ifTrue:[
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2635
"/                ^ self detectViewAt:aPoint in:sv
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2636
"/            ]
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2637
"/        ]
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2638
"/    ].
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2639
"/    ^ aView
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2640
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  2641
    "Modified: / 10.10.2001 / 13:53:24 / cg"
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2642
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2643
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2644
fitColumns
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2645
    "fit columns to view; 
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2646
    "
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2647
    |list width changed dX sz oldOrgX newOrgX|
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2648
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2649
    preferredExtent isNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2650
        self preferredExtent.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2651
    ].
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2652
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2653
    columnDescriptors isEmpty ifTrue:[
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2654
        ^ self
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2655
    ].
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2656
    width := 0.
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2657
    list  := OrderedCollection new.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2658
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2659
    columnDescriptors do:[:aCol|
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2660
        aCol canResize ifTrue:[
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2661
            changed := true.
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2662
            aCol invalidate.
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2663
            aCol hasRelativeWidth ifFalse:[list add:aCol].
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2664
        ].
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2665
        width := width + aCol minWidth.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2666
    ].
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2667
    preferredExtent x:width.
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2668
    width := self innerWidth - width.
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2669
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2670
    (list notEmpty and:[width > 0]) ifTrue:[
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2671
        sz := list size.
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2672
        width >= sz ifTrue:[
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2673
            dX := width // sz.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2674
            list do:[:aCol|aCol growWidth:dX].
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2675
            width := width - (dX * sz).
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2676
        ].
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2677
        width ~~ 0 ifTrue:[list last growWidth:width].
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  2678
    ].
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2679
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  2680
    shown ifTrue:[
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  2681
        self      invalidate.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  2682
        labelView invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2683
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2684
        (oldOrgX := viewOrigin x) ~~ 0 ifTrue:[
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2685
            "/ UPDATE VIEW-ORIGIN X
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2686
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2687
            width   := preferredExtent x.
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2688
            newOrgX := (width - self innerWidth) max:0.
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2689
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2690
            newOrgX < oldOrgX ifTrue:[
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2691
                self originWillChange.
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2692
                viewOrigin := newOrgX @ (viewOrigin y).
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2693
                self originChanged:((newOrgX - oldOrgX) @ 0).
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2694
            ]
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2695
        ].
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2696
1930
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  2697
        "/ cg: do not scroll to selection when a column-size is changed
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  2698
"/        self hasSelection ifTrue:[
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  2699
"/            editView notNil ifTrue:[
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  2700
"/                editView width:(self selectedColumn width - (2 * separatorSize)).
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  2701
"/            ].
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  2702
"/            self scrollToSelection.
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  2703
"/        ].
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2704
        self contentsChanged.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2705
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2706
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2707
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2708
maxViewOriginY
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2709
    "returns the maximum possible y of the view origin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2710
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2711
    |y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2712
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2713
    y := self heightOfContents - self innerHeight.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2714
  ^ y max:0
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2715
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2716
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2717
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2718
updateEditViewOrigin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2719
    "update origin of the editView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2720
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2721
    |x y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2722
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2723
    editView notNil ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2724
        y := self yVisibleOfRowNr:(self firstIndexSelected).
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2725
        x := self xVisibleOfColNr:selectedColIndex.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2726
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2727
        editView origin:(x @ y + separatorSize).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2728
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2729
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2730
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2731
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2732
xVisibleOfColNr:aColNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2733
    "returns visible x assigned to a column number
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2734
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2735
    |x
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2736
     end "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2737
    |
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2738
    x := margin - viewOrigin x.
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2739
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2740
    aColNr > 1 ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2741
        end := aColNr - 1.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2742
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2743
        columnDescriptors from:1 to:end do:[:aCol|
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2744
            x := x + aCol width
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2745
        ]
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2746
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2747
  ^ x
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2748
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2749
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2750
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2751
xVisibleToColNr:x
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2752
    "returns the column number assigned to a physical x or nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2753
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2754
    |x0
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2755
     nr "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2756
    |
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2757
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2758
    x0 := x + viewOrigin x - margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2759
    nr := 1.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2760
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2761
    columnDescriptors do:[:aCol|
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2762
        x0 := x0 - aCol width.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  2763
        x0 <= 0 ifTrue:[^ nr].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2764
        nr := nr + 1.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2765
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2766
    ^ nil.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2767
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2768
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2769
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2770
yVisibleOfRowNr:aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2771
    "returns visible y assigned to the row number
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2772
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2773
    ^ (aRowNr - 1) * rowHeight + margin - viewOrigin y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2774
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2775
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2776
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2777
yVisibleToRowNr:y
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2778
    "returns the row number assigned to a physical y or nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2779
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2780
    |y0|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2781
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2782
    y0 := (y + viewOrigin y - margin) // rowHeight + 1.
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2783
  ^ (y0 <= list size) ifTrue:[y0] ifFalse:[nil]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2784
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2785
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2786
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2787
!DSVColumnView methodsFor:'queries'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2788
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2789
hasOpenEditor
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2790
    ^ editView notNil
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2791
!
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2792
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  2793
indexOfFirstRowShown
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  2794
    "returns index of first row shown
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  2795
    "
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  2796
    |idx|
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  2797
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2798
    idx := (viewOrigin y // rowHeight) + 1.
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2799
  ^ (idx <= list size) ifTrue:[idx] ifFalse:[0]
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  2800
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  2801
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  2802
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2803
isEnabled
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2804
    ^ enableChannel value ~~ false
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2805
!
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2806
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2807
numberOfColumns
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2808
    "returns number of columns
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2809
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2810
    ^ columnDescriptors size
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2811
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2812
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2813
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2814
numberOfRows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2815
    "returns number of raws
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2816
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2817
    ^ list size
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2818
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2819
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2820
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2821
rowHeight
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2822
    "get the height of the highest row in pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2823
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2824
    ^ rowHeight
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2825
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2826
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2827
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2828
separatorSize
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2829
    "returns vertical/horizontal size of a separator dependent on the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2830
     3D effect.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2831
    "
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2832
    ^ separatorSize
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2833
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2834
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2835
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2836
size
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2837
    "returns number of raws
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2838
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2839
    ^ list size
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2840
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2841
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2842
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2843
!DSVColumnView methodsFor:'recomputation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2844
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2845
hasPreferredExtent
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2846
    "returns true if preferred extent is accumulated
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2847
    "
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2848
    ^ preferredExtent notNil
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2849
!
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2850
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2851
preferredExtent
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2852
    "recompute preferred extent; raise notification
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2853
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2854
    |x "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2855
     h "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2856
    |
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2857
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2858
    preferredExtent notNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2859
        ^ preferredExtent
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2860
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2861
    x := 3.
1521
7ebada4e9e9c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  2862
    h := 0.
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2863
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2864
    columnDescriptors do:[:aCol|
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2865
        h := (aCol heightOfHighestRow) max:h.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2866
        x := x + (aCol minWidth).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2867
    ].
1521
7ebada4e9e9c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1506
diff changeset
  2868
    h == 0 ifTrue:[h := font height].
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2869
    rowHeight       := (h + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2870
    preferredExtent := x @ (list size * rowHeight).
1201
a81cf27650bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1187
diff changeset
  2871
    rowFontAscent   := font ascent.
a81cf27650bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1187
diff changeset
  2872
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2873
  ^ preferredExtent
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2874
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2875
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2876
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2877
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2878
preferredExtentChanged
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
  2879
    "called if the preffered extent changed
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
  2880
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2881
    |x "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2882
     y "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2883
    |
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2884
    y := viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2885
    x := viewOrigin x.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2886
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2887
    (y ~~ 0 or:[x ~~ 0]) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2888
        self originWillChange.
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  2889
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2890
        viewOrigin := 0 @ 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2891
        preferredExtent := nil.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2892
        self originChanged:(x negated  @ y negated).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2893
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2894
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2895
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2896
recomputeHeightOfContents
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
  2897
    "recompute height of contents( scrolling )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
  2898
    "
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2899
    preferredExtent notNil ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2900
        preferredExtent y:(rowHeight * list size)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2901
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2902
        self preferredExtent
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2903
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2904
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2905
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2906
!DSVColumnView methodsFor:'scroller interface'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2907
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2908
heightOfContents
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2909
    "return the height of the contents in pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2910
    "
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2911
    preferredExtent isNil ifTrue:[
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2912
        self preferredExtent
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2913
    ].
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  2914
    ^ preferredExtent y
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2915
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2916
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2917
innerHeight
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2918
    "returns the inner height of the contents shown
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2919
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2920
    ^ height - margin - margin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2921
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2922
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2923
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2924
innerWidth
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2925
    "returns the inner width of the contents shown
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2926
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2927
    ^ width - margin - margin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2928
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2929
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2930
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2931
verticalScrollStep
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2932
    "return the amount to scroll when stepping up/down.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2933
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2934
    ^ rowHeight
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2935
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2936
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2937
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2938
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2939
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2940
viewOrigin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2941
    "return the viewOrigin; thats the coordinate of the contents 
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2942
     which is shown topLeft in the view.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2943
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2944
    ^ viewOrigin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2945
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2946
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2947
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2948
widthOfContents
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2949
    "return the width of the contents in pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2950
    "
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2951
    preferredExtent isNil ifTrue:[
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2952
        self preferredExtent
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2953
    ].
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  2954
    ^ preferredExtent x
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2955
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2956
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2957
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2958
xOriginOfContents
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2959
    "return the horizontal origin of the contents in pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2960
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2961
    ^ viewOrigin x 
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2962
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2963
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2964
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2965
yOriginOfContents
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2966
    "return the vertical origin of the contents in pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2967
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2968
    ^ viewOrigin y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2969
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2970
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2971
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2972
!DSVColumnView methodsFor:'scrolling'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2973
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2974
scrollTo:anOrigin redraw:doRedraw
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2975
    "change origin to have newOrigin be visible at the top-left.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2976
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2977
    |newOrg dltOrg wg
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2978
     h       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2979
     w       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2980
     x       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2981
     x0      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2982
     x1      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2983
     y       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2984
     y0      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2985
     y1      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2986
     dX      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2987
     dY      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2988
     innerHG "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2989
     innerWT "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2990
    |
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2991
    shown ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2992
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2993
    ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  2994
1448
b389b8c76479 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  2995
    (wg := self windowGroup) notNil ifTrue:[
b389b8c76479 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  2996
        wg processRealExposeEventsFor:self.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2997
    ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  2998
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2999
    innerWT := self innerWidth.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3000
    innerHG := self innerHeight.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3001
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3002
    h := viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3003
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3004
    (y := anOrigin y) > h ifTrue:[              "/ end of contents
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3005
        y > (dY := self maxViewOriginY) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3006
            y := dY max:h
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3007
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3008
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3009
        y := y max:0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3010
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3011
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3012
    (x := anOrigin x) > 0 ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3013
        x := x min:(self widthOfContents - innerWT).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3014
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3015
    x      := x max:0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3016
    newOrg := (x @ y).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3017
    dltOrg := newOrg - viewOrigin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3018
    dX     := dltOrg x.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3019
    dY     := dltOrg y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3020
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3021
    (dX == 0 and:[dY == 0]) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3022
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3023
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3024
    self originWillChange.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3025
    viewOrigin := newOrg.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3026
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3027
    doRedraw ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3028
        ^ self originChanged:dltOrg
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3029
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3030
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3031
    dY ~~ 0 ifTrue:[                            "/ SCROLL VERTICAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3032
        dY := dY abs.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3033
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3034
        (dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3035
            self invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3036
        ] ifFalse:[                             "/ COPY VERTICAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3037
            y0 := y1 := margin + dY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3038
            h  := innerHG - dY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3039
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3040
            dltOrg y < 0 ifTrue:[y0 := margin. y := y0]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3041
                        ifFalse:[y1 := margin. y := y1 + h].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3042
1460
2fe0ac4bc4d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1448
diff changeset
  3043
            self copyFrom:self x:margin y:y0 toX:margin y:y1 width:innerWT height:h async:false.
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3044
            self invalidateX:margin y:y width:innerWT height:(innerHG - h).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3045
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3046
    ] ifFalse:[                                 "/ SCROLL HORIZONTAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3047
        dX := dX abs.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3048
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3049
        innerWT - dX < 20 ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3050
            labelView invalidate.
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3051
            self invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3052
        ] ifFalse:[                             "/ COPY HORIZONTAL
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  3053
            x0 := x1 := dX + margin.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3054
            w  := width - dX - margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3055
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  3056
            dltOrg x < 0 ifTrue:[x0 := x := margin ]
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  3057
                        ifFalse:[x1 := margin. x := w].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3058
1460
2fe0ac4bc4d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1448
diff changeset
  3059
            self copyFrom:self x:x0 y:margin toX:x1 y:margin width:w height:innerHG async:false.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3060
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3061
            labelView notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3062
                labelView copyFromX:x0 y:margin toX:x1 y:margin width:w invalidateX:x.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3063
            ].
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3064
            self invalidateX:x y:margin width:(width - w) height:innerHG.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3065
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3066
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3067
    self originChanged:dltOrg.
1123
ea32a2e3d44d care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
  3068
ea32a2e3d44d care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
  3069
    "Modified: / 7.9.1998 / 16:39:49 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3070
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3071
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3072
scrollToRowAt:aRowNr colAt:aColNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3073
    "make row at a row number in column at a column number visible
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3074
    "
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3075
    |x  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3076
     y  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3077
     l  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3078
     dY "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3079
     dX "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3080
    |
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3081
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3082
    (    (aRowNr between:1 and:(list size))
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3083
     and:[aColNr between:0 and:(columnDescriptors size)]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3084
    ) ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3085
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3086
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3087
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3088
    dY := dX := 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3089
    y  := self yVisibleOfRowNr:aRowNr.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3090
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3091
    y < margin ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3092
        dY := margin - y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3093
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3094
        y := y + rowHeight.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3095
        l := height - margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3096
        y > l ifTrue:[dY := l - y]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3097
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3098
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3099
    aColNr == 0 ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3100
        dY == 0 ifTrue:[^ self].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3101
        dX := 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3102
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3103
        x  := self xVisibleOfColNr:aColNr.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3104
1163
f46f69609c53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1149
diff changeset
  3105
        x <= margin ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3106
            dX := margin - x
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3107
        ] ifFalse:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3108
            x := x + (columnDescriptors at:aColNr) width.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3109
            l := width - margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3110
            x > l ifTrue:[dX := l - x]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3111
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3112
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3113
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3114
    (dX == 0 and:[dY == 0]) ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3115
        self scrollTo:(viewOrigin - (dX @ dY)).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3116
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3117
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3118
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3119
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3120
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3121
scrollToSelection
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3122
    "make selection visible
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3123
    "
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3124
    |rowNr|
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3125
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3126
    (rowNr := self firstIndexSelected) ~~ 0 ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3127
        self scrollToRowAt:rowNr colAt:selectedColIndex
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3128
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3129
1506
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3130
!
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3131
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3132
scrollVerticalTo:aPixelOffset
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3133
    "change origin to make aPixelOffset be the top line"
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3134
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3135
    |orgX orgY|
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3136
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3137
    orgX := viewOrigin x.
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3138
    orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight.
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3139
  ^ self scrollTo:(orgX @ orgY).
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  3140
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3141
!
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3142
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3143
startAutoScroll:aBlock distance:aDistance
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3144
    "setup for auto-scroll (when button-press-moving below view);
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3145
     - timeDelta for scroll is computed from distance
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3146
    "
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3147
    |timeDelta|
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3148
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3149
    (autoScroll and:[aBlock notNil]) ifFalse:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3150
        ^ self stopAutoScroll
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3151
    ].
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3152
    autoScrollBlock notNil ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3153
        Processor removeTimedBlock:autoScrollBlock.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3154
    ] ifFalse:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3155
        self compressMotionEvents:false.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3156
    ].
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3157
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3158
    timeDelta := 0.5 / (aDistance abs).
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3159
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3160
    autoScrollBlock := [
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3161
        aBlock value.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3162
        Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3163
    ].
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3164
    Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3165
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3166
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3167
!
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3168
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3169
stopAutoScroll
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3170
    "stop any autoScroll
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3171
    "
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3172
    autoScrollBlock notNil ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3173
        Processor removeTimedBlock:autoScrollBlock.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3174
        autoScrollBlock := nil.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3175
        self compressMotionEvents:true.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3176
    ].
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3177
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3178
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3179
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3180
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3181
!DSVColumnView methodsFor:'selection'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3182
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3183
deselect
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3184
    "deselect
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3185
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3186
    self selectColIndex:0 rowIndex:0
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3187
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3188
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3189
firstIndexSelected
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3190
    "returns index of first row selected or 0
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3191
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3192
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3193
        ^ selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3194
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3195
    selectedRowIndex size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3196
        ^ selectedRowIndex at:1
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3197
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3198
    ^ 0
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3199
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3200
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3201
hasSelection
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3202
    "returns true if a selection exists
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3203
    "
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3204
    ^ self numberOfSelections ~~ 0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3205
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3206
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3207
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3208
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3209
isInSelection:aRowNr
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3210
    "return true, if row, aRowNr is in the selection
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3211
    "
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3212
    aRowNr ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3213
        multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3214
            ^ aRowNr == selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3215
        ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3216
        selectedRowIndex size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3217
            ^ selectedRowIndex includes:aRowNr
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3218
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3219
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3220
    ^ false
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3221
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3222
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3223
isRowSelected:aRowNr
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3224
    "return true, if row is in the selection
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3225
    "
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3226
    selectedColIndex == 0 ifTrue:[
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3227
        ^ self isInSelection:aRowNr
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3228
    ].
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3229
    ^ false
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3230
!
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3231
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3232
isSelected:aRowNr inColumn:aColNr
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3233
    "returns true if cell in a row; a row number, in a column, a column
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3234
     number is selected.
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3235
    "
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  3236
    multipleSelectOk ifFalse:[
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  3237
        aRowNr ~~ selectedRowIndex ifTrue:[
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  3238
            ^ false
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  3239
        ]
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  3240
    ] ifTrue:[
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  3241
        (selectedRowIndex size ~~ 0 and:[selectedRowIndex includes:aRowNr]) ifFalse:[
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  3242
            ^ false
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  3243
        ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3244
    ].
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  3245
    ^ (selectedColIndex == 0 or:[selectedColIndex == aColNr])
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  3246
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3247
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3248
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3249
lastIndexSelected
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3250
    "returns index of last row selected or 0
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3251
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3252
    multipleSelectOk ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3253
        ^ selectedRowIndex
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3254
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3255
    selectedRowIndex size ~~ 0 ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3256
        ^ selectedRowIndex last
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3257
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3258
    ^ 0
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3259
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3260
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3261
numberOfSelections
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3262
    "return the number of selected rows
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3263
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3264
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3265
        ^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3266
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3267
    ^ selectedRowIndex size
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3268
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3269
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3270
selectAllRows
1971
6b24b6010cfc fixed #selectAllRows
Claus Gittinger <cg@exept.de>
parents: 1968
diff changeset
  3271
    "select all
6b24b6010cfc fixed #selectAllRows
Claus Gittinger <cg@exept.de>
parents: 1968
diff changeset
  3272
    "
6b24b6010cfc fixed #selectAllRows
Claus Gittinger <cg@exept.de>
parents: 1968
diff changeset
  3273
    selectedRowIndex isNil ifTrue:[selectedRowIndex := OrderedCollection new].
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3274
    1 to:list size do:[:eachRowNr |
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3275
        selectedRowIndex add:eachRowNr.    
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3276
        self invalidateRowAt:eachRowNr.
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3277
    ].
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3278
    self selectionChanged.
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3279
!
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3280
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3281
selectColIndex:aColNr rowIndex:aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3282
    "change selection with notification
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3283
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3284
    |oC oR|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3285
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3286
    oC := self selectedColIndex.
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3287
    oR := self selectedRowIndex.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3288
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3289
    self setSelectColIndex:aColNr rowIndex:aRowNr.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3290
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3291
    (oC ~~ self selectedColIndex or:[oR ~= self selectedRowIndex]) ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3292
        self selectionChanged
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3293
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3294
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3295
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3296
selectRow:something
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3297
    "select a row
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3298
    "
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3299
    ^ self selectedRowIndex:something
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3300
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3301
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3302
selectRowAt:rowNr colAt:colNr atPoint:aPoint
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3303
    |v p|
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3304
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3305
    self selectColIndex:colNr rowIndex:rowNr.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3306
2044
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  3307
    ((v := self detectViewAt:aPoint ignoreInvisible:true) notNil 
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  3308
    and:[v ~~ self])
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  3309
    ifTrue:[
2019
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  3310
        p := device translatePoint:aPoint fromView:self toView:v.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3311
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3312
        self sensor pushEvent:(WindowEvent buttonEvent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3313
                                 for:v
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3314
                                 type:#buttonPress:x:y:
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3315
                                 arguments:(Array with:#select with:p x with:p y)
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3316
                              )
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3317
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3318
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3319
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3320
selectRowIndex:something
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3321
    "set selection of rows
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3322
    "
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3323
    self selectColIndex:selectedColIndex rowIndex:something
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3324
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3325
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3326
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3327
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3328
selectedColIndex
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3329
    "returns selected column number or 0
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3330
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3331
    ^ selectedColIndex
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3332
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3333
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3334
selectedColumn
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3335
    "returns selected column or nil
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3336
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3337
    ^ columnDescriptors at:selectedColIndex ifAbsent:nil.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3338
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3339
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3340
selectedRow
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3341
    "returns selected row (or collection if multiple selection) or nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3342
    "
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3343
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3344
        ^ self at:selectedRowIndex ifAbsent:nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3345
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3346
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3347
    selectedRowIndex size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3348
        ^ selectedRowIndex collect:[:i| self at:i]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3349
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3350
    ^ nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3351
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3352
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3353
selectedRow:something
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3354
    "select something
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3355
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3356
    self selectedRowIndex:something
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3357
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3358
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3359
selectedRowIndex
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3360
    "returns selected row number or 0
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3361
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3362
    ^ selectedRowIndex
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3363
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3364
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3365
selectedRowIndex:something
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3366
    "set selection of rows
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3367
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3368
    self selectColIndex:selectedColIndex rowIndex:something
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3369
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3370
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3371
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3372
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3373
selectionChanged
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3374
    "selection has changed
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3375
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3376
    |val|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3377
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3378
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3379
        val := self selectedRowIndex copy.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3380
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3381
        (model respondsTo:#selectionIndex:) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3382
            model selectionIndex:val
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3383
        ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3384
            useIndex ifFalse:[ model value:(self selectedRow) ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3385
                      ifTrue:[ model value:val ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3386
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3387
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3388
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3389
    actionBlock notNil ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3390
        actionBlock value:(self selectedRowIndex)
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3391
    ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3392
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3393
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3394
selectionIndicesDo:aOneArgBlock
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3395
    "evaluate block on each row selected; the argument to the row
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3396
     is the index of the selected row
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3397
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3398
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3399
        selectedRowIndex ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3400
            aOneArgBlock value:selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3401
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3402
    ] ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3403
        selectedRowIndex size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3404
            selectedRowIndex do:[:i| aOneArgBlock value:i ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3405
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3406
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3407
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3408
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3409
setSelectColIndex:aColNr rowIndex:aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3410
    "change selection without notification
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3411
    "
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3412
    |editSpec rowNr colNr newCol oldCol oldRow sensor sglSelRow oldSz
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3413
     keyBrdFwd filter edValue edView|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3414
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3415
    rowNr := self validateSelection:aRowNr.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3416
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3417
    multipleSelectOk ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3418
        colNr := (rowNr size == 1) ifTrue:[aColNr] ifFalse:[0]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3419
    ] ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3420
        colNr := rowNr ~~ 0 ifTrue:[aColNr] ifFalse:[0]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3421
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3422
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3423
    (colNr := colNr ? 0) ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3424
        newCol := self columnAt:colNr.
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3425
        newCol rendererType == #rowSelector ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3426
            colNr := 0.
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3427
            newCol := nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3428
        ] ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3429
            multipleSelectOk ifTrue:[sglSelRow := rowNr at:1]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3430
                            ifFalse:[sglSelRow := rowNr].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3431
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3432
            (newCol canSelect:sglSelRow) ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3433
                newCol := nil.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3434
                colNr  := 0.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3435
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3436
                selectRowOnDefault ifFalse:[
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3437
                    rowNr  := multipleSelectOk ifFalse:[0] ifTrue:[nil]
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3438
                ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3439
            ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3440
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3441
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3442
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3443
    (rowNr = selectedRowIndex and:[colNr == selectedColIndex]) ifTrue:[
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  3444
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3445
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3446
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3447
    "/ release old selection
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3448
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3449
    oldSz  := self numberOfSelections.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3450
    oldCol := selectedColIndex.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3451
    oldRow := selectedRowIndex.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3452
1968
857cd9f14570 fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
  3453
    "/ cg: must change the selectedRow/Col AFTER we have stored the editValue.
857cd9f14570 fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
  3454
    "/ (otherwise, the editvalue might be stored into the new col as well ...)
857cd9f14570 fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
  3455
857cd9f14570 fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
  3456
"/    selectedRowIndex := rowNr.
857cd9f14570 fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
  3457
"/    selectedColIndex := colNr.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3458
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3459
    oldSz == 1 ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3460
        multipleSelectOk ifTrue:[oldRow := oldRow at:1].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3461
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3462
        editValue notNil ifTrue:[
1215
76b43b3de51e call accept before closing the editView
tm
parents: 1201
diff changeset
  3463
            editValue removeDependent:self
76b43b3de51e call accept before closing the editView
tm
parents: 1201
diff changeset
  3464
        ].
76b43b3de51e call accept before closing the editView
tm
parents: 1201
diff changeset
  3465
        editView notNil ifTrue:[
76b43b3de51e call accept before closing the editView
tm
parents: 1201
diff changeset
  3466
            editView allSubViewsDo:[:aSubView|
76b43b3de51e call accept before closing the editView
tm
parents: 1201
diff changeset
  3467
                aSubView perform:#accept ifNotUnderstood:nil.
76b43b3de51e call accept before closing the editView
tm
parents: 1201
diff changeset
  3468
            ]
76b43b3de51e call accept before closing the editView
tm
parents: 1201
diff changeset
  3469
        ].
76b43b3de51e call accept before closing the editView
tm
parents: 1201
diff changeset
  3470
76b43b3de51e call accept before closing the editView
tm
parents: 1201
diff changeset
  3471
        editValue notNil ifTrue:[
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3472
            edValue := editValue value.
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3473
            edValue isSequenceable ifTrue:[
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3474
                edValue size == 0 ifTrue:[
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3475
                    edValue := nil
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3476
                ] ifFalse:[
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3477
                    edValue isString not ifTrue:[
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3478
                        edValue := edValue select:[:el| el notNil ].
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3479
                        edValue size == 0 ifTrue:[
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3480
                            edValue := nil
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3481
                        ]
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3482
                    ]
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3483
                ]
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3484
            ].
1661
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3485
            (self columnAt:oldCol) at:oldRow put:edValue.
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3486
            modifiedChannel notNil ifTrue:[
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3487
                modifiedChannel value:true
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3488
            ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3489
            editValue := nil
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3490
        ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3491
        self destroyEditView.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3492
    ].
1968
857cd9f14570 fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
  3493
    selectedRowIndex := rowNr.
857cd9f14570 fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
  3494
    selectedColIndex := colNr.
857cd9f14570 fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
  3495
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3496
    shown ifFalse:[^ self ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3497
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  3498
    oldSz > 1 ifTrue:[                                  "/ redraw old selection
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  3499
        oldRow do:[:aRowNr|                             "/ unselected if visible
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3500
            self invalidateRowAt:aRowNr colAt:0
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  3501
        ]
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  3502
    ] ifFalse:[
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  3503
        oldSz == 1 ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3504
            self invalidateRowAt:oldRow colAt:oldCol
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  3505
        ]
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  3506
    ].   
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  3507
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3508
    "/ show new selection
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3509
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3510
    newCol notNil ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3511
        self scrollToRowAt:sglSelRow colAt:colNr.
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
  3512
        editSpec := newCol editorAt:sglSelRow.
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
  3513
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
  3514
        editSpec notNil ifTrue:[
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3515
            editView := SimpleView extent:(  (newCol width - (2 * separatorSize)) 
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3516
                                           @ (rowHeight    - (2 * separatorSize))
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3517
                                          )
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3518
                                       in:self.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3519
            self updateEditViewOrigin.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3520
1134
d7c5844b24b0 *** empty log message ***
ca
parents: 1131
diff changeset
  3521
            (newCol containsText or:[newCol showSelectionHighLighted not]) ifTrue:[
1565
ca
parents: 1530
diff changeset
  3522
                editView viewBackground:(newCol backgroundColorAt:sglSelRow)
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3523
            ] ifFalse:[
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3524
                editView viewBackground:hgLgBgColor
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3525
            ].
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3526
            edView := editSpec at:1.
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3527
            editView add:edView.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3528
            oldSz := editSpec size.
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3529
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3530
            oldSz == 3 ifTrue:[
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3531
                filter := [:aKey| #(#Tab #CursorUp #CursorDown) includes:aKey]
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3532
            ] ifFalse:[
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3533
                filter := [:aKey| aKey == #Tab]
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3534
            ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3535
            keyBrdFwd := KeyboardForwarder toView:self
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3536
                                        condition:nil
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3537
                                           filter:filter.
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3538
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3539
            editView withAllSubViewsDo:[:aView|
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3540
                aView delegate:keyBrdFwd.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3541
                aView font:font.
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3542
            ].
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3543
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3544
            (editValue := editSpec at:2 ifAbsent:nil) notNil ifTrue:[
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3545
                editValue addDependent:self.
648
1d77d0c9e58a check for isEditing
ca
parents: 647
diff changeset
  3546
            ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3547
            editView realize.
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3548
            edView canTab:true.
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3549
            self windowGroup focusView:edView.
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3550
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3551
        ] ifFalse:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3552
            self invalidateRowAt:sglSelRow colAt:colNr
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3553
        ].
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3554
    ] ifFalse:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3555
        self selectionIndicesDo:[:i| self invalidateRowAt:i colAt:0 ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3556
        self scrollToRowAt:(self firstIndexSelected) colAt:0
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3557
    ].
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3558
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3559
    sensor := self sensor.                              "/ catch expose events
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3560
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3561
    [sensor hasExposeEventFor:nil] whileTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3562
        self windowGroup processExposeEvents
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3563
    ].
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3564
1661
3a2a038e4173 added a modifiedChannel;
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  3565
    "Modified: / 30.1.2000 / 12:18:25 / cg"
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3566
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3567
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3568
validateSelection:aSelection
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3569
    |newSel|
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3570
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3571
    newSel := aSelection.
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3572
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3573
    (list size == 0 or:[newSel isNil or:[newSel == 0]]) ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3574
        ^ multipleSelectOk ifFalse:[0] ifTrue:[nil]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3575
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3576
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3577
    newSel isNumber ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3578
        ^ multipleSelectOk ifFalse:[newSel] ifTrue:[OrderedCollection with:newSel]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3579
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3580
    multipleSelectOk ifFalse:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  3581
        newSel := self identityIndexOfRow:aSelection
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3582
    ] ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3583
        newSel := nil.
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3584
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3585
        aSelection size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3586
            aSelection first isNumber ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3587
                newSel := aSelection
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3588
            ] ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3589
                aSelection do:[:el||n|
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  3590
                    (n := self identityIndexOfRow:el) ~~ 0 ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3591
                        newSel isNil ifTrue:[newSel := OrderedCollection new].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3592
                        newSel add:n
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3593
                    ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3594
                ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3595
            ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3596
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3597
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3598
    ^ newSel
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3599
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3600
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3601
!DSVColumnView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3602
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3603
version
2044
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  3604
    ^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.136 2001-11-09 13:58:37 cg Exp $'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3605
! !