DSVColumnView.st
author Claus Gittinger <cg@exept.de>
Fri, 15 Jun 2018 10:54:35 +0200
changeset 5816 7876c07931a7
parent 5809 c43c2f1c38ba
child 5873 c8cf9d94aed1
permissions -rw-r--r--
#DOCUMENTATION by cg class: ComboListView class comment/format in: #documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5737
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
     1
"{ Encoding: utf8 }"
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
     2
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     3
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     4
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     5
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     6
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     7
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    12
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    13
"
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
    15
4772
11b5f36c5943 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
    16
"{ NameSpace: Smalltalk }"
11b5f36c5943 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
    17
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    18
View subclass:#DSVColumnView
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    19
	instanceVariableNames:'labelView listHolder editValue editView multipleSelectOk useIndex
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
    20
		selectedColIndexHolder selectedRowIndex selectRowOnDefault
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
    21
		buttonMotionAction buttonReleaseAction rowHeight minRowHeight
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    22
		columnDescriptors viewOrigin colorMap rowFontAscent lockRowIndex
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    23
		rowIfAbsentBlock columnHolder registererImages list fgColor
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    24
		separatorSize catchChangeEvents beDependentOfRows bgColor
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    25
		actionBlock builder tabIntern doubleClickActionBlock
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    26
		verticalSpacing horizontalSpacing rowSelectorForm
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    27
		buttonLightColor buttonShadowColor buttonHalfLightColor
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    28
		buttonHalfShadowColor checkToggleExtent checkToggleForm
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    29
		checkToggleActiveImage checkTogglePassiveImage checkToggleLevel
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
    30
		radioButtonActiveImage radioButtonPassiveImage comboButtonExtent
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
    31
		comboButtonForm comboButtonLevel dropSource columnAdaptor
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
    32
		tabAtEndAction tabAtStartAction modifiedChannel autoScroll
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
    33
		autoScrollBlock needFitColumns scrollWhenUpdating
2886
c7dd9972a292 dropTarget
Claus Gittinger <cg@exept.de>
parents: 2885
diff changeset
    34
		separatorOneDColor selectionForegroundColor
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
    35
		selectionForegroundColorNoFocus selectionBackgroundColor
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
    36
		selectionBackgroundColorNoFocus selectionFrameColor
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
    37
		selectionFrameColorNoFocus previousExtent selectConditionBlock
4613
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
    38
		scrollRowWise autoScrollToColumn cachedPreferredExtent
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
    39
		sortListInPlace labelFgColor labelBgColor
5664
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
    40
		updateListHolderWhenSorting ignoreReselect'
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    41
	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    42
		DefaultHilightForegroundColor DefaultHilightBackgroundColor
3988
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
    43
		DefaultHilightFrameColor ButtonLightColor ButtonShadowColor
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
    44
		CheckToggleActiveImage CheckTogglePassiveImage
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
    45
		ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
    46
		CheckToggleForm CheckToggleLevel CheckToggleExtent
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
    47
		ComboButtonForm ComboButtonLevel ComboButtonExtent
4489
e492b99bfa39 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4486
diff changeset
    48
		StopRedrawSignal RadioButtonActiveImage RadioButtonPassiveImage
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
    49
		PreselectAllWhenOpeningEditor
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
    50
		DefaultHilightForegroundColorNoFocus
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
    51
		DefaultHilightBackgroundColorNoFocus DefaultLabelForegroundColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
    52
		DefaultLabelBackgroundColor'
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    53
	poolDictionaries:''
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    54
	category:'Views-DataSet'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    55
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    56
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    57
!DSVColumnView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    58
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    59
copyright
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    60
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    61
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    62
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    63
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    64
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    65
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    66
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    67
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    68
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    69
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    70
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    71
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    72
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    73
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    74
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    75
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    76
documentation
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    77
"
2788
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    78
    ColumnView part of a DataSetView.
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    79
    implements a scrollable selection view based on rows and columns.
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    80
    Used as the contents-part of a DataSetView.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    81
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    82
    [Instance variables:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    83
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    84
        editValue               <Model>                 current editing model
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    85
        editView                <View>                  current editing component
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    86
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    87
        buttonReleaseAction     <Action or nil>         called if the mouse button is released
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    88
        buttonMotionAction      <Action or nil>         called during mouse motion with one
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    89
                                                        argument the point under the mouse.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    90
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    91
        multipleSelectOk        <Boolean>               multiple selection enabled/disabled
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    92
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    93
        selectedColIndex        <Integer>               selected column index or 0
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    94
        selectedRowIndex        <Integer>               selected row    index or 0
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    95
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    96
        rowHeight               <Integer>               maximum height of any row
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
    97
        minRowHeight            <Integer>               minimum height of all displayed labels
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    98
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    99
        columnDescriptors       <SequancableCollection> list of column descriptors
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   100
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   101
        viewOrigin              <Point>                 current view origin
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   102
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   103
        colorMap                <Dictionary>            store and register used colors on device
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   104
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   105
        rowFontAscent           <SmallInteger>          inset of a printable text in a row
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   106
                                                        including separator and font ascent.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   107
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   108
        lockRowIndex            <SmallInteger>          internal used to indicate a row which has
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   109
                                                        changed its contents but no redraw should be
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   110
                                                        done( at:put: ).
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   111
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   112
        columnHolder            <ValueHolder>           holder which keeps the list of column descriptors.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   113
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   114
        registererImages        <IdentityDictionary>    list of images registered on the device
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   115
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   116
        list                    <SequancableCollection> list of rows
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   117
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   118
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   119
        catchChangeEvents       <Boolean>               internal used to discard change notifications
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   120
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   121
        beDependentOfRows       <Boolean>               keep rows dependent; on default is disabled.
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   122
                                                        in case of enabled a row can raise a change
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   123
                                                        notification whithout a parameter which
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   124
                                                        will force a redraw of the row or the
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   125
                                                        readSelector of the column which will
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   126
                                                        redraw the cell in the row only.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   127
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   128
        fgColor                 <Color>                 foreground color
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   129
        bgColor                 <Color>                 background color
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   130
        hgLgFgColor             <Color>                 highlight foreground color (selected)
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   131
        hgLgBgColor             <Color>                 highlight background color (selected)
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   132
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   133
        buttonLightColor        <Color>                 LightColor      ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   134
        buttonShadowColor       <Color>                 ShadowColor     ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   135
        buttonHalfLightColor    <Color>                 HalfLightColor  ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   136
        buttonHalfShadowColor   <Color>                 HalfShadowColor ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   137
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   138
        actionBlock             <a OneArgBlock>         action block performed on select
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   139
        doubleClickActionBlock  <a OneArgBlock>         action block performed on double click
5308
4e35010e00be #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5279
diff changeset
   140
        rowIfAbsentBlock        <a OneArgBlock>         this block is performed on an empty list entry
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   141
                                                        to retrive the item from the application. The
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   142
                                                        argument to the block is the index into the list.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   143
                                                        The block should return the row instance which
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   144
                                                        is put to the list under the index.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   145
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   146
        builder                 <UIBuilder>             builder set by application
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   147
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   148
        verticalSpacing         <SmallInteger>          vertical   row spacing( top  & bottom )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   149
        horizontalSpacing       <SmallInteger>          horizontal row spacing( left & right )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   150
        separatorSize           <SmallInteger>          line width of a vertical or horizontal separator
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   151
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   152
        rowSelectorForm         <Form>                  form used by a row selector
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   153
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   154
        checkToggleForm         <Form>                  form used by a checkToggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   155
        checkToggleExtent       <Point>                 extent of a checkToggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   156
        checkToggleLevel        <SmallInteger>          level used to draw a check toggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   157
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   158
        comboButtonForm         <Form>                  form used by a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   159
        comboButtonExtent       <Point>                 extent of a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   160
        comboButtonLevel        <SmallInteger>          level used to draw a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   161
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   162
        dropTarget              <DropTarget>            drag & drop target
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   163
        dropSource              <DropSource>            drag & drop source
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   164
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   165
    [author:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   166
        Claus Atzkern
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   167
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   168
    [see also:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   169
        DataSetColumnSpec
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   170
        DataSetColumn
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   171
        DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   172
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   173
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   174
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   175
!DSVColumnView class methodsFor:'defaults'!
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   176
1844
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   177
defaultFont
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   178
    ^ SelectionInListView defaultFont
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   179
!
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   180
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   181
horizontalSpacing
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   182
    "returns the default horizontal space between rows
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   183
    "
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   184
    ^ 4
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   185
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   186
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   187
3961
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   188
preselectAllWhenOpeningEditor:aBoolean
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   189
    PreselectAllWhenOpeningEditor := aBoolean
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   190
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   191
    "Created: / 02-11-2010 / 22:00:28 / cg"
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   192
!
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   193
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   194
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   195
    "extract values from the styleSheet and cache them in class variables"
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   196
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   197
    <resource: #style (#textForegroundColor
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   198
                       #'scrollableView.backgroundColor'
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   199
                       #'button.lightColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   200
                       #'button.shadowColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   201
                       #'button.halfLightColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   202
                       #'button.halfShadowColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   203
                       #'button.edgeStyle'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   204
                       #'checkToggle.activeImage'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   205
                       #'checkToggle.passiveImage'
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   206
                       #'radioButton.activeImage'
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   207
                       #'radioButton.passiveImage'
582
222fc7c63af0 new resource naming
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   208
                       #'selection.hilightForegroundColor'
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   209
                       #'selection.hilightBackgroundColor'
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   210
                       #'selection.hilightFrameColor'
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   211
                       #'dataSet.labelView.foregroundColor'
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   212
                       #'dataSet.labelView.backgroundColor'
3988
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   213
    )>
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   214
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   215
    DefaultForegroundColor        := StyleSheet colorAt:#'textForegroundColor' default:(Color black).
3986
163354e9ee4c changed: #updateStyleCache
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
   216
    "/ DefaultBackgroundColor        := StyleSheet colorAt:#'scrollableView.backgroundColor' default:DefaultViewBackgroundColor.
163354e9ee4c changed: #updateStyleCache
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
   217
    DefaultBackgroundColor        := StyleSheet colorAt:#'selection.backgroundColor' default:DefaultViewBackgroundColor.
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   218
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   219
    DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor' default:DefaultBackgroundColor.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   220
    DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor' default:DefaultForegroundColor.
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
   221
    DefaultHilightForegroundColorNoFocus := StyleSheet colorAt:#'selection.hilightForegroundColorNoFocus'.
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
   222
    DefaultHilightBackgroundColorNoFocus := StyleSheet colorAt:#'selection.hilightBackgroundColorNoFocus'.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   223
    DefaultHilightFrameColor      := StyleSheet colorAt:#'selection.hilightFrameColor'. "/ no default; nil means: no frame
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   224
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   225
    DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   226
        DefaultHilightBackgroundColor := Color black
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   227
    ].
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   228
    ButtonLightColor       := StyleSheet colorAt:#'button.lightColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   229
    ButtonShadowColor      := StyleSheet colorAt:#'button.shadowColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   230
    ButtonHalfLightColor   := StyleSheet colorAt:#'button.halfLightColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   231
    ButtonHalfShadowColor  := StyleSheet colorAt:#'button.halfShadowColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   232
    ButtonEdgeStyle        := StyleSheet at:#'button.edgeStyle'.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   233
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   234
    CheckToggleActiveImage := StyleSheet at:#'checkToggle.activeImage'.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   235
    CheckToggleActiveImage isNil ifTrue:[
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   236
        CheckTogglePassiveImage := nil
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   237
    ] ifFalse:[
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   238
        CheckTogglePassiveImage := StyleSheet at:#'checkToggle.passiveImage'.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   239
        CheckTogglePassiveImage isNil ifTrue:[
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   240
            CheckToggleActiveImage := nil
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   241
        ]
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   242
    ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   243
    CheckToggleForm   := nil.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   244
    CheckToggleLevel  := nil.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   245
    CheckToggleExtent := nil.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   246
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   247
    RadioButtonActiveImage := StyleSheet at:#'radioButton.activeImage'.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   248
    RadioButtonPassiveImage := StyleSheet at:#'radioButton.passiveImage'.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   249
    (RadioButtonActiveImage isNil or:[ RadioButtonPassiveImage isNil ]) ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   250
        RadioButtonActiveImage := RadioButton roundOnForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   251
        RadioButtonPassiveImage := RadioButton roundOffForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   252
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   253
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   254
    ComboButtonForm   := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   255
    ComboButtonLevel  := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   256
    ComboButtonExtent := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   257
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   258
    DefaultLabelBackgroundColor := StyleSheet at:#'dataSet.labelView.backgroundColor' default:nil.
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   259
    DefaultLabelForegroundColor := StyleSheet at:#'dataSet.labelView.foregroundColor' default:nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   260
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   261
    "
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   262
     self updateStyleCache.
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   263
    "
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   264
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   265
    "Modified: / 20-01-2011 / 08:44:28 / cg"
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   266
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   267
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   268
verticalSpacing
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   269
    "returns the default vertical space between rows
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   270
    "
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   271
    ^ 2
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   272
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   273
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   274
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   275
!DSVColumnView class methodsFor:'image specs'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   276
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   277
dragIconMulti
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   278
    "This resource specification was automatically generated
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   279
     by the ImageEditor of ST/X."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   280
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   281
    "Do not manually edit this!! If it is corrupted,
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   282
     the ImageEditor may not be able to read the specification."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   283
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   284
    "
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   285
     self dragIconMulti inspect
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   286
     ImageEditor openOnClass:self andSelector:#dragIconMulti
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   287
     Icon flushCachedIcons
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   288
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   289
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   290
    <resource: #image>
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   291
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   292
    ^Icon
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   293
        constantNamed:'DSVColumnView class dragIconMulti'
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   294
        ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   295
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@<@@@@O@@@@C3??L@<??3@OO?<<C3??O@<??0@OO?<@C3???0<???<OO???C3???0<???<OO???@C?
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   296
??0@???<@O???@C???0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b')
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   297
            colorMapFromArray:#[0 0 0 255 255 255]
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   298
            mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   299
@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C????@????0O????C????0?????O????3?????????????????????????????????????????????
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   300
????????@????0O???<C????@????0@@@@@@@@@@@@@@@@@@@@@b'); yourself); yourself]
1926
9bcb6b59ea37 if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   301
!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   302
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   303
dragIconSingle
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   304
    "This resource specification was automatically generated
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   305
     by the ImageEditor of ST/X."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   306
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   307
    "Do not manually edit this!! If it is corrupted,
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   308
     the ImageEditor may not be able to read the specification."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   309
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   310
    "
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   311
     self dragIconSingle inspect
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   312
     ImageEditor openOnClass:self andSelector:#dragIconSingle
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   313
     Icon flushCachedIcons
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   314
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   315
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   316
    <resource: #image>
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   317
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   318
    ^Icon
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   319
        constantNamed:'DSVColumnView class dragIconSingle'
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   320
        ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   321
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@??30@O?<<@C??@@@??0@@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@O???@C??
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   322
?0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b')
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   323
            colorMapFromArray:#[0 0 0 255 255 255]
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   324
            mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   325
@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C???<@????@O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O??
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   326
?<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b'); yourself); yourself]
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   327
!
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   328
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   329
rowSelectorImage
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   330
    "This resource specification was automatically generated
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   331
     by the ImageEditor of ST/X."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   332
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   333
    "Do not manually edit this!! If it is corrupted,
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   334
     the ImageEditor may not be able to read the specification."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   335
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   336
    "
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   337
     self rowSelectorImage inspect
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   338
     ImageEditor openOnClass:self andSelector:#rowSelectorImage
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   339
     Icon flushCachedIcons
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   340
    "
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   341
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   342
    <resource: #image>
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   343
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   344
    ^Icon
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   345
        constantNamed:'DSVColumnView class rowSelectorImage'
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   346
        ifAbsentPut:[(Depth2Image width:11 height:11) bits:(ByteArray fromPackedString:'@ @@@#@@*#0@@C,@O>(0N*($J*$P@BT@*!!P@@!!@@@ @@')
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   347
            colorMapFromArray:#[0 0 0 127 127 127 170 170 170 255 255 255]
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   348
            mask:((ImageMask width:11 height:11) bits:(ByteArray fromPackedString:'C@@N@@<@?8C?0O? ?<C? @<@C @L@@@a'); yourself); yourself]
1926
9bcb6b59ea37 if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   349
! !
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   350
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   351
!DSVColumnView class methodsFor:'signal constants'!
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   352
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   353
stopRedrawSignal
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   354
    "returns the signal which is raised during drawing if the
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   355
     required label height is less than the current rowHeight
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   356
    "
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   357
    StopRedrawSignal isNil ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   358
        StopRedrawSignal := Notification newSignalMayProceed:true.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   359
        StopRedrawSignal nameClass:self message:#stopRedrawSignal.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   360
    ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   361
    ^ StopRedrawSignal
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   362
! !
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   363
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   364
!DSVColumnView methodsFor:'accessing'!
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   365
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   366
builder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   367
    "get the builder (UIBuilder or nil)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   368
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   369
    ^ builder
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   370
!
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   371
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   372
builder:aBuilder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   373
    "set the builder (UIBuilder or nil)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   374
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   375
    builder := aBuilder
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   376
!
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   377
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   378
columnView
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   379
    "returns self"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   380
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   381
    ^ self
1067
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   382
!
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   383
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   384
heightOfContents
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   385
    "return the height of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   386
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   387
    cachedPreferredExtent isNil ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   388
        self preferredExtent
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   389
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   390
    ^ cachedPreferredExtent y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   391
!
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   392
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   393
labelView
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   394
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   395
    ^labelView
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   396
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   397
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   398
labelView:aView
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   399
    labelView := aView for:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   400
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   401
    labelView layout:(LayoutFrame
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   402
                        leftFraction:0 offset:0
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   403
                        rightFraction:1 offset:0
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   404
                        topFraction:0 offset:0
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   405
                        bottomFraction:0 offset:[self preferredLabelViewHeight]).
1067
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   406
!
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   407
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   408
level:aLevel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   409
    "change the level and thus the level of the labelView"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   410
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   411
    aLevel ~~ level ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   412
        super level:aLevel.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   413
"/        labelView level:aLevel.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   414
    ]
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   415
!
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   416
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   417
preferredLabelViewHeight
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   418
    ^ labelView preferredHeight "/ + (labelView margin + self verticalSpacing * 2).
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   419
!
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   420
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   421
rowFontAscent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   422
    "returns the inset of a printable text in a row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   423
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   424
    ^ rowFontAscent
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   425
!
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   426
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   427
selectedColIndex:newSelectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   428
    self selectedColIndexHolder value:newSelectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   429
!
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   430
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   431
selectedColIndexHolder
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   432
    selectedColIndexHolder isNil ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   433
        selectedColIndexHolder := ValueHolder new.
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   434
    ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   435
    ^ selectedColIndexHolder
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   436
! !
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   437
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   438
!DSVColumnView methodsFor:'accessing-actions'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   439
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   440
action:aOneArgAction
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   441
    "set the action block to be performed on select"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   442
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   443
    actionBlock := aOneArgAction
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   444
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   445
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   446
doubleClickAction:aOneArgAction
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   447
    "set the action block to be performed on doubleclick"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   448
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   449
    doubleClickActionBlock := aOneArgAction
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   450
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   451
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   452
rowIfAbsent:aOneArgAction
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   453
    "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
   454
     list. The argument to the block is the index into the list. The
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   455
     block returns the row which is put to the list"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   456
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   457
    rowIfAbsentBlock := aOneArgAction
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   458
!
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   459
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   460
selectConditionBlock
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   461
    "get the select-conditionBlock; this block is evaluated before
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   462
     any selection change is performed (passing the to-be-changed row number
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   463
     index as arg).
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   464
     The change will not be done, if the block returns false. "
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   465
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   466
    ^ selectConditionBlock
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   467
!
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   468
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   469
selectConditionBlock:aOneArgBlockOrNil
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   470
    "set the select-conditionBlock; this block is evaluated before
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   471
     any selection change is performed (passing the to-be-changed row number
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   472
     index as arg).
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   473
     The change will not be done, if the block returns false. "
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   474
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   475
    selectConditionBlock := aOneArgBlockOrNil.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   476
!
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   477
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   478
tabAtEndAction:aNoneArgAction
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   479
    "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
   480
     tab next.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   481
     The default is to give the focus to the view after self in the focusSequence"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   482
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   483
    tabAtEndAction := aNoneArgAction
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   484
!
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   485
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   486
tabAtStartAction:aNoneArgAction
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   487
    "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
   488
     tab previous.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   489
     The default is to give the focus to the view before self in the focusSequence"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   490
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   491
    tabAtStartAction := aNoneArgAction
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   492
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   493
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   494
!DSVColumnView methodsFor:'accessing-behavior'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   495
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   496
autoScrollToColumn
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   497
    "return true, if I scroll to the column, when one is selected."
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   498
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   499
    ^ autoScrollToColumn
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   500
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   501
    "Created: / 22-10-2006 / 11:01:25 / cg"
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   502
!
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   503
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   504
autoScrollToColumn:aBoolean
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   505
    "control, if I should scroll to the column, when one is selected.
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   506
     The default is true"
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   507
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   508
    autoScrollToColumn := aBoolean
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   509
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   510
    "Created: / 22-10-2006 / 11:01:46 / cg"
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   511
!
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   512
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   513
beDependentOfRows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   514
    "make myself dependent of any row; in this case any change notification
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   515
     raised by a row is catched and the cell identified by the 'readSelector'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   516
     is redrawn. In case of a nil readSelector, the whole raw is redrawn.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   517
        -> row changed:'what'
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   518
     By default, the attribute is set to false (disabled)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   519
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   520
    ^ beDependentOfRows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   521
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   522
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   523
beDependentOfRows:aBool
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   524
    "make myself dependent of any row; in this case any change notification
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   525
     raised by a row is catched and the cell identified by the 'readSelector'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   526
     is redrawn. In case of a nil readSelector, the whole raw is redrawn.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   527
        -> row changed:'what'
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   528
     By default, the attribute is set to false (disabled)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   529
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   530
    aBool ~~ beDependentOfRows ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   531
        beDependentOfRows := aBool.
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   532
        aBool ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   533
            self makeDependentOfRows
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   534
        ] ifFalse:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   535
            self makeIndependentOfRows
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   536
        ].
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   537
    ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   538
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   539
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   540
enableChannel:aChannel
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   541
    enableChannel notNil ifTrue:[
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   542
        enableChannel removeDependent:self
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   543
    ].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   544
    (enableChannel := aChannel) notNil ifTrue:[
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   545
        enableChannel addDependent:self
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   546
    ].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   547
!
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   548
5664
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   549
ignoreReselect
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   550
    "controls if clicking on an already selected item should
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   551
     be ignored or should perform the select action again.
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   552
     By default, these are ignored"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   553
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   554
    ^ ignoreReselect
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   555
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   556
    "Created: / 22-10-2006 / 11:01:25 / cg"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   557
!
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   558
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   559
ignoreReselect:aBoolean
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   560
    "controls if clicking on an already selected item should
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   561
     be ignored or should perform the select action again.
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   562
     By default, these are ignored"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   563
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   564
    ignoreReselect := aBoolean
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   565
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   566
    "Created: / 22-10-2006 / 11:01:25 / cg"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   567
!
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   568
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   569
makeDependentOfRows
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   570
    "make myself dependent of any row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   571
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   572
    list size ~~ 0 ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   573
        list do:[:aRow |
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   574
            aRow notNil ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   575
                aRow addDependent:self
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   576
            ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   577
        ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   578
    ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   579
!
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   580
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   581
makeIndependentOfRows
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   582
    "make myself independent of any row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   583
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   584
    list size ~~ 0 ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   585
        list do:[:aRow |
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   586
            aRow notNil ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   587
                aRow removeDependent:self
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   588
            ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   589
        ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   590
    ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   591
!
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   592
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   593
multipleSelectOk
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   594
    "allow/disallow multiple row selections; the default is false"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   595
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   596
    ^ multipleSelectOk
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   597
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   598
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   599
multipleSelectOk:sBoolean
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   600
    "allow/disallow multiple row selections; the default is false"
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   601
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   602
    |colIdx rowIdx|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   603
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   604
    sBoolean == multipleSelectOk ifTrue:[^ self ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   605
    colIdx := rowIdx := 0.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   606
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   607
    self hasSelection ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   608
        colIdx := self selectedColIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   609
        rowIdx := self selectedRowIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   610
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   611
        rowIdx isSequenceable ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   612
            rowIdx := rowIdx at:1 ifAbsent:0
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   613
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   614
        self setSelectColIndex:0 rowIndex:0 openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   615
    ].
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   616
    multipleSelectOk := sBoolean.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   617
    self selectColIndex:colIdx rowIndex:rowIdx openEditor:false.
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   618
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   619
    "Modified (format): / 04-02-2017 / 21:31:30 / cg"
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   620
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   621
1938
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   622
opaqueColumnResize
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   623
    ^ labelView opaqueColumnResize
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   624
!
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   625
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   626
opaqueColumnResize:aBoolean
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   627
    labelView opaqueColumnResize:aBoolean
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   628
!
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   629
1946
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   630
scrollWhenUpdating
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   631
    "return the scroll behavior, when I get a new text
1946
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   632
     (via the model or the #contents/#list)
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   633
     Possible returnValues are:
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   634
        #keep / nil     -> no change
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   635
        #endOfText      -> scroll to the end
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   636
        #beginOfText    -> scroll to the top
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   637
     The default is #beginOfText.
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   638
     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
   639
     the program (i.e. not from the user)"
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   640
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   641
    ^ scrollWhenUpdating
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   642
!
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   643
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   644
scrollWhenUpdating:aSymbolOrNil
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   645
    "define how to scroll, when I get a new text
1946
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   646
     (via the model or the #contents/#list)
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   647
     Allowed arguments are:
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   648
        #keep / nil     -> no change
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   649
        #endOfText      -> scroll to the end
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   650
        #beginOfText    -> scroll to the top
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   651
     The default is #beginOfText.
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   652
     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
   653
     the program (i.e. not from the user)"
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   654
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   655
    scrollWhenUpdating := aSymbolOrNil
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   656
!
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   657
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   658
selectRowOnDefault
3449
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   659
    "if true, in case of selecting a none selectable cell, the row is selected.
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   660
     If false, nothing is selected. The default is true."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   661
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   662
    ^ selectRowOnDefault
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   663
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   664
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   665
selectRowOnDefault:aBool
3449
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   666
    "if true, in case of selecting a none selectable cell, the row is selected.
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   667
     If false, nothing is selected. The default is true."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   668
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   669
    selectRowOnDefault := aBool
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   670
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   671
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   672
sortListInPlace
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   673
    "when false (default for backward compatibility):
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   674
     if sorting, create a copy
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   675
     of the list, which is wrong when useIndex is on,
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   676
     as the application will get the index in the sorted
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   677
     list, which is probably different from tha apps list mode.
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   678
     When true (should be default, but that might break many
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   679
     users), the passed in list is sorted in place (i.e. possibly
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   680
     sorting the application's list)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   681
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   682
    ^ sortListInPlace
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   683
!
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   684
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   685
sortListInPlace:aBoolean
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   686
    "when false (default for backward compatibility):
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   687
     if sorting, create a copy
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   688
     of the list, which is wrong when useIndex is on,
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   689
     as the application will get the index in the sorted
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   690
     list, which is probably different from tha apps list mode.
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   691
     When true (should be default, but that might break many
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   692
     users), the passed in list is sorted in place (i.e. possibly
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   693
     sorting the application's list)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   694
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   695
    sortListInPlace := aBoolean.
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   696
!
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   697
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   698
tabIntern
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   699
    "returns true if tabing is supported in the widget"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   700
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   701
    ^ tabIntern
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   702
!
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   703
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   704
tabIntern:aBool
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   705
    "returns true if tabing is supported in the widget"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   706
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   707
    tabIntern := aBool ? true
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   708
!
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   709
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   710
updateListHolderWhenSorting
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   711
    "return true if the the listHolder's value are be updated,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   712
     when I sort a list.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   713
     By default, this is false so it must be set explicitly
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   714
     (for bug-backward compatibility,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   715
     and to avoid introducing new side effects)."
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   716
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   717
    ^ updateListHolderWhenSorting
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   718
!
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   719
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   720
updateListHolderWhenSorting:aBoolean
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   721
    "define if the the listHolder's value should be updated,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   722
     when I sort a list.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   723
     By default, this is false so it must be set explicitly
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   724
     (for bug-backward compatibility,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   725
     and to avoid introducing new side effects)."
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   726
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   727
    updateListHolderWhenSorting := aBoolean
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   728
!
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   729
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   730
useIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   731
    "specify, if the selected components value or its index in the
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   732
     list should be sent to the model. The default is its index."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   733
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   734
    ^ useIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   735
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   736
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   737
useIndex:aBool
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   738
    "specify, if the selected components value or its index in the
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   739
     list should be sent to the model. The default is its index."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   740
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   741
    useIndex := aBool
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   742
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   743
5639
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   744
!DSVColumnView methodsFor:'accessing-channels'!
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   745
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   746
modifiedChannel
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   747
    ^ modifiedChannel
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   748
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   749
    "Created: / 30.1.2000 / 12:10:57 / cg"
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   750
!
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   751
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   752
modifiedChannel:something
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   753
    modifiedChannel := something.
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   754
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   755
    "Created: / 30.1.2000 / 12:10:57 / cg"
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   756
! !
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   757
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   758
!DSVColumnView methodsFor:'accessing-color & font'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   759
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   760
backgroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   761
    "get the background color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   762
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   763
    ^ bgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   764
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   765
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   766
backgroundColor:aColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   767
    "set the background color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   768
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   769
    bgColor ~~ aColor ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   770
        super viewBackground:bgColor.
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   771
        self realized ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
   772
            bgColor := aColor onDevice:device.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   773
            self invalidate
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   774
        ] ifFalse:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   775
            bgColor := aColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   776
        ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   777
    ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   778
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   779
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   780
foregroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   781
    "return the foreground color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   782
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   783
    ^ fgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   784
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   785
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   786
foregroundColor:aColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   787
    "set the foreground color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   788
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   789
    fgColor ~~ aColor ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   790
        self realized ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
   791
            fgColor := aColor onDevice:device.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   792
            self invalidate
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   793
        ] ifFalse:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   794
            fgColor := aColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   795
        ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   796
    ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   797
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   798
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   799
labelBackgroundColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   800
    "get the background color of the label row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   801
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   802
    ^ labelBgColor ? bgColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   803
!
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   804
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   805
labelForegroundColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   806
    "get the foreground color of the label row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   807
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   808
    ^ labelFgColor ? fgColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   809
!
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   810
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   811
selectionBackgroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   812
    "returns the background color of a selected row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   813
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   814
    self hasFocus ifTrue:[
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   815
        ^ selectionBackgroundColor
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   816
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   817
    ^ selectionBackgroundColorNoFocus.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   818
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   819
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   820
selectionForegroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   821
    "returns the foreground color of a selected row"
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   822
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   823
    self hasFocus ifTrue:[
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   824
        ^ selectionForegroundColor
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   825
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   826
    ^ selectionForegroundColorNoFocus.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   827
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   828
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   829
selectionFrameColor
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   830
    "returns the frame color of a selected row"
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   831
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   832
    self hasFocus ifTrue:[
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   833
        ^ selectionFrameColor
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   834
    ].
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   835
    ^ selectionFrameColorNoFocus.
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   836
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   837
    "Created: / 20-01-2011 / 08:45:08 / cg"
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   838
!
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   839
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   840
separatorDarkColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   841
    "returns the dark color used for drawing a shadowed separator (3D)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   842
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   843
    ^ shadowColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   844
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   845
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   846
separatorLightColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   847
    "returns the light color used for drawing a shadowed separator (3D)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   848
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   849
    ^ lightColor
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   850
!
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   851
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   852
separatorOneDColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   853
    "returns the color used for drawing a oneD separator"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   854
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   855
    separatorOneDColor isNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   856
        ^ fgColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   857
    ].
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   858
    ^ separatorOneDColor
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   859
!
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   860
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   861
separatorOneDColor:aColorOrNil
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   862
    "set the color used for drawing a oneD separator; if the color
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   863
     is nil, the current forgroundColor is used"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   864
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   865
    separatorOneDColor = aColorOrNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   866
        ^ self
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   867
    ].
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   868
    separatorOneDColor := aColorOrNil.
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   869
    self realized ifTrue:[
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   870
        separatorOneDColor notNil ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
   871
            separatorOneDColor := separatorOneDColor onDevice:device.
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   872
        ].
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   873
        self invalidate.
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   874
    ].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   875
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   876
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   877
!DSVColumnView methodsFor:'accessing-columns'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   878
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   879
columnAt:anIndex
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   880
    <resource: #obsolete>
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   881
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   882
    "returns the column at an index"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   883
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   884
    self obsoleteMethodWarning:'use columnDescriptorAt:'.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   885
    ^ self columnDescriptorAt:anIndex
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   886
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   887
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   888
columnDescriptorAt:anIndex
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   889
    "returns the columnDescriptor at an index"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   890
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   891
    ^ columnDescriptors at:anIndex ifAbsent:nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   892
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   893
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   894
columnDescriptors
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   895
    "returns list of column descriptors"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   896
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   897
    ^ columnDescriptors collect:[:aCol | aCol description ]
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   898
!
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   899
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   900
columnDescriptors:aColumnDescriptionList
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   901
    "set the columnDescriptors;
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   902
     scroll to top and deselect"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   903
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   904
    self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:true
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   905
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   906
    "Modified: / 13-09-2017 / 15:05:05 / cg"
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   907
!
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   908
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   909
columnDescriptors:aColumnDescriptionList deselect:deselect scrollToTop:scrollToTop
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   910
    "set the columnDescriptors;
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   911
     if deselect is true, then deselect;
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   912
     if scrollToTop is true, then scroll to top;
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   913
     otherwise, take the current selection and try to make it visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   914
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   915
    |delta indexOfFirstRow|
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   916
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   917
    deselect ifTrue:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   918
        self deselect.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   919
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   920
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   921
    (viewOrigin x ~~ 0 or:[ viewOrigin y ~~ 0 ]) ifTrue:[
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   922
        scrollToTop ifTrue:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   923
            delta := viewOrigin negated.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   924
            viewOrigin := 0 @ 0.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   925
            self originChanged:delta
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   926
        ] ifFalse:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   927
            indexOfFirstRow := self yVisibleToRowNr:0.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   928
        ].
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   929
    ].
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   930
    self setColumnDescriptors:aColumnDescriptionList.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   931
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   932
    indexOfFirstRow notNil ifTrue:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   933
        self scrollToRowAt:indexOfFirstRow colAt:1.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   934
    ].
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   935
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   936
    "Created: / 13-09-2017 / 15:04:50 / cg"
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   937
!
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   938
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   939
columnDescriptors:aColumnDescriptionList scrollToTop:scrollToTop
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   940
    "set the columnDescriptors and deselect;
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   941
     if scrollToTop is true, then scroll to top;
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   942
     otherwise, take the current selection and try to make it visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   943
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   944
    self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:scrollToTop
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   945
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   946
    "Created: / 13-09-2017 / 15:03:15 / cg"
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   947
!
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   948
2703
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   949
dataSetColumns
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   950
    "returns the list of DataSetColumns; each column represents a DataSetColumnSpec"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   951
2703
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   952
    ^ columnDescriptors
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   953
!
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   954
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   955
firstColumn
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   956
    "returns the first column"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   957
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   958
    ^ columnDescriptors at:1
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   959
!
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   960
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   961
lastColumn
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   962
    "returns the last column"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   963
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   964
    ^ columnDescriptors last
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   965
!
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   966
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   967
setColumnDescriptors:aColumnDescriptionList
5310
8b7aff55b666 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
   968
    "set the columnDescriptors; don't deselect and do not scroll to top"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   969
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   970
    |cid|
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   971
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   972
    cid := 0.
3536
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   973
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   974
    aColumnDescriptionList isEmptyOrNil ifTrue:[
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   975
        columnDescriptors := OrderedCollection new.
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   976
    ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   977
        columnDescriptors := aColumnDescriptionList
3536
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   978
            collect:
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   979
                [:el||dsc lbl|
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   980
                    dsc := el isSequenceable
3536
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   981
                                ifTrue:[DataSetColumnSpec decodeFromLiteralArray:el]
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   982
                                ifFalse:[el].
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   983
                    cid := cid + 1.
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   984
                    lbl := DataSetLabel new description:dsc builder:builder on:labelView.
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   985
                    DataSetColumn new on:self description:dsc columnNumber:cid label:lbl
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   986
                ].
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   987
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   988
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   989
    cachedPreferredExtent := nil.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   990
    labelView columns:columnDescriptors.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   991
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   992
    self fitColumns.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   993
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
   994
    "Modified: / 07-01-2012 / 16:46:59 / cg"
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   995
    "Modified (format): / 13-09-2017 / 15:04:01 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   996
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   997
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   998
!DSVColumnView methodsFor:'accessing-interactors'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   999
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1000
checkToggleActiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1001
    ^ checkToggleActiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1002
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1003
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1004
checkToggleExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1005
    "returns the extent of a checkToggle"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1006
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1007
    ^ checkToggleExtent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1008
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1009
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1010
checkToggleForm
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1011
    "returns the form of a checkToggle"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1012
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1013
    ^ checkToggleForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1014
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1015
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1016
checkToggleLevel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1017
    "returns the level of a checkToggle button"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1018
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1019
    ^ checkToggleLevel
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1020
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1021
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1022
checkTogglePassiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1023
    ^ checkTogglePassiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1024
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1025
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1026
comboButtonExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1027
    "returns the extent of a comboList or -Box"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1028
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1029
    ^ comboButtonExtent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1030
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1031
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1032
comboButtonForm
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1033
    "returns the form of a comboList or -Box"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1034
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1035
    ^ comboButtonForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1036
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1037
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1038
comboButtonLevel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1039
    "returns the level of a comboList or -Box button"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1040
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1041
    ^ comboButtonLevel
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1042
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1043
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1044
radioButtonExtent
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1045
    "returns the extent of a radio button"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1046
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1047
    ^ radioButtonActiveImage extent
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1048
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1049
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1050
rowSelectorExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1051
    "returns the bitmap of a selected row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1052
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1053
    ^ rowSelectorForm extent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1054
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1055
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1056
rowSelectorForm
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1057
    "returns the (arrow-) image shown for a selected row.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1058
     (the arrow shown in the first column)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1059
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1060
    ^ rowSelectorForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1061
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1062
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1063
!DSVColumnView methodsFor:'accessing-mvc'!
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1064
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1065
columnAdaptor
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1066
    "return the value of the instance variable 'columnAdaptor' (automatically generated)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1067
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1068
    columnAdaptor isValueModel ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1069
        ^ columnAdaptor value
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1070
    ].
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1071
    ^ columnAdaptor
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1072
!
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1073
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1074
columnAdaptor:something
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1075
    "set the value of the instance variable 'columnAdaptor' (automatically generated)"
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1076
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1077
    columnAdaptor isValueModel ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1078
        columnAdaptor removeDependent:self
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1079
    ].
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1080
    (columnAdaptor := something) isValueModel ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1081
        columnAdaptor addDependent:self
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1082
    ].
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1083
!
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1084
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1085
columnHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1086
    "get the valueHolder, which keeps the list of column descriptions"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1087
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1088
    ^ columnHolder
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1089
!
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1090
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1091
columnHolder:aValueHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1092
    "set the valueHolder, which keeps the list of column descriptions"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1093
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1094
    |columns|
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1095
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1096
    columnHolder notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1097
        columnHolder removeDependent:self
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1098
    ].
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1099
    (columnHolder := aValueHolder) notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1100
        columnHolder addDependent:self.
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1101
        columns := columnHolder value.
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1102
        columns notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1103
            self columnDescriptors:columns
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1104
        ]
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1105
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1106
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1107
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1108
listAt:index put:newElement
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1109
    "kludge callback, when an element hs to be replaced
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1110
     due to a col-adaptor returning a new row element"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1111
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1112
    |list|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1113
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1114
    (list := listHolder value) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1115
        list at:index put:newElement
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1116
    ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1117
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1118
2318
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1119
listHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1120
    "get the valueHolder which holds the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1121
2318
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1122
    ^ listHolder
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1123
!
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1124
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1125
listHolder:aListHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1126
    "set the valueHolder which holds the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1127
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1128
    listHolder ~~ aListHolder ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1129
        listHolder notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1130
            listHolder removeDependent:self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1131
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1132
        (listHolder := aListHolder) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1133
            listHolder addDependent:self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1134
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1135
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1136
    self pushEvent:#list: with:(listHolder value).
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1137
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1138
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1139
model:aModel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1140
    "set the valueHolder which holds the selection and maybe the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1141
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1142
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1143
        model removeDependent:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1144
        (model respondsTo:#list) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1145
            (model list == listHolder) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1146
                self listHolder:nil
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1147
            ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1148
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1149
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1150
    (model := aModel) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1151
        model addDependent:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1152
        (aModel respondsTo:#list) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1153
            self listHolder:model list
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1154
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1155
    ]
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1156
! !
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1157
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1158
!DSVColumnView methodsFor:'accessing-rows'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1159
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1160
at:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1161
    "return the row at an index, aRowNr"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1162
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1163
    |row|
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1164
3994
f44c9cded11e changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3993
diff changeset
  1165
    list isNil ifTrue:[^ nil].
3757
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  1166
    (row := list at:aRowNr ifAbsent:nil) isNil ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1167
        lockRowIndex := aRowNr.
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1168
1034
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  1169
        (rowIfAbsentBlock notNil
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  1170
        and:[(row := rowIfAbsentBlock value:aRowNr) notNil]) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1171
            list at:aRowNr put:row.
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1172
            beDependentOfRows ifTrue:[row addDependent:self].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1173
        ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1174
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1175
        lockRowIndex := 0
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1176
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1177
    ^ row
1034
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  1178
3994
f44c9cded11e changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3993
diff changeset
  1179
    "Modified: / 22-01-2011 / 09:14:48 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1180
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1181
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1182
at:aRowNr ifAbsent:exceptionBlock
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1183
    "return the row at a aRowNr. If the index is invalid, return the
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1184
     result of evaluating the exceptionblock"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1185
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1186
    (aRowNr between:1 and:list size) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1187
        ^ self at:aRowNr
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1188
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1189
    ^ exceptionBlock value
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1190
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1191
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1192
at:aRowNr put:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1193
    "change the row at an index. The added row is returned"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1194
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1195
    lockRowIndex ~~ aRowNr ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1196
        (aRowNr <= list size and:[ (list at:aRowNr) == aRow ]) ifTrue:[
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1197
            self invalidateRowAt:aRowNr
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1198
        ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1199
            self
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1200
                replaceFrom:aRowNr
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1201
                to:aRowNr
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1202
                with:(Array with:aRow)
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1203
                startingAt:1.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1204
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1205
    ].
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1206
    ^ aRow
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1207
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1208
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1209
first
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1210
    "return the first row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1211
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1212
    ^ self at:1
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1213
!
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1214
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1215
identityIndexOfRow:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1216
    "returns index of a row or 0"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1217
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1218
    (list size ~~ 0 and:[ aRow notNil ]) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1219
        ^ list identityIndexOf:aRow
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1220
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1221
    ^ 0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1222
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1223
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1224
last
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1225
    "return the last row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1226
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1227
    ^ self at:(list size)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1228
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1229
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1230
list
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1231
    "get the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1232
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1233
    ^ list
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1234
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1235
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1236
list:aRawList
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1237
    "set the list of rows"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1238
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1239
    |newList selectionHasChanged sortColNr sortSelectorOrBlock sortBlockSelector sortBlock|
656
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
  1240
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1241
    "/ remove selection without redraw
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1242
1259
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1243
    selectionHasChanged := self hasSelection.
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1244
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  1245
    self destroyEditView.
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1246
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  1247
    self selectedColIndex:0.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1248
    selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1249
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1250
    shown ifFalse:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1251
        cachedPreferredExtent := nil
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1252
    ] ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1253
        aRawList size == 0 ifTrue:[
2834
edddf1a3c2ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2816
diff changeset
  1254
            "/ keep old column-width information
edddf1a3c2ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2816
diff changeset
  1255
        ] ifFalse:[
2524
a41c43dba6c9 care for nil colDescr.
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
  1256
            columnDescriptors notNil ifTrue:[
a41c43dba6c9 care for nil colDescr.
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
  1257
                columnDescriptors do:[:aCol| aCol invalidate ].
a41c43dba6c9 care for nil colDescr.
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
  1258
            ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1259
            cachedPreferredExtent := nil.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1260
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1261
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1262
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1263
    beDependentOfRows ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1264
        self makeIndependentOfRows
656
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
  1265
    ].
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  1266
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1267
    aRawList size == 0 ifTrue:[
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1268
        list := nil.
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1269
        viewOrigin := 0 @ 0.
2834
edddf1a3c2ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2816
diff changeset
  1270
    ] ifFalse:[
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1271
        "/ list := OrderedCollection withAll:aRawList.
4613
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1272
        sortListInPlace ifTrue:[
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1273
            newList := aRawList
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1274
        ] ifFalse:[
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1275
            newList := aRawList copyAsOrderedCollection.
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1276
        ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1277
        (sortColNr := labelView indexOfSortColumn) notNil ifTrue:[
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1278
            sortBlockSelector := (columnDescriptors at:sortColNr) sortBlockSelector.
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1279
            sortBlockSelector notNil ifTrue:[
3964
df77ea0f171d changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1280
                sortBlock := self application aspectFor:sortBlockSelector.
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1281
                newList sort:sortBlock
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1282
            ] ifFalse:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1283
                sortSelectorOrBlock := (columnDescriptors at:sortColNr) sortSelector.
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1284
                sortSelectorOrBlock notNil ifTrue:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1285
                    sortSelectorOrBlock isBlock ifTrue:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1286
                        newList sort:sortSelectorOrBlock
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1287
                    ] ifFalse:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1288
                        newList sort:[:a :b | (a perform:sortSelectorOrBlock) < (b perform:sortSelectorOrBlock)]
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1289
                    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1290
                ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1291
            ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1292
            labelView reverseSort ifTrue:[
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1293
                newList reverse.
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1294
            ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1295
        ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1296
        list := newList.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1297
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1298
        sortListInPlace ifFalse:[
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1299
            listHolder notNil ifTrue:[
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1300
                updateListHolderWhenSorting ifTrue:[
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1301
                    listHolder value:newList withoutNotifying:self.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1302
                ].
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1303
            ].
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1304
        ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1305
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1306
        beDependentOfRows ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1307
            self makeDependentOfRows
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1308
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1309
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1310
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1311
    shown ifTrue:[
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  1312
        self fitColumns
1949
0d9451776275 delayed fitColumns if not shown while list is changed.
ps
parents: 1948
diff changeset
  1313
    ] ifFalse:[
0d9451776275 delayed fitColumns if not shown while list is changed.
ps
parents: 1948
diff changeset
  1314
        needFitColumns := true
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1315
    ].
1259
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1316
    selectionHasChanged ifTrue:[
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1317
        self selectionChanged.
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1318
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1319
    cachedPreferredExtent := nil.
2044
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1320
    self contentsChanged.
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1321
3964
df77ea0f171d changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1322
    "Modified: / 08-11-2010 / 22:07:49 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1323
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1324
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1325
!DSVColumnView methodsFor:'accessing-visibility'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1326
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1327
font:aFont
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1328
    "set the font for all shown rows."
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1329
    |newGCFont|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1330
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1331
    (aFont isNil or:[aFont = self font]) ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1332
        ^ self
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1333
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1334
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1335
    columnDescriptors isEmptyOrNil ifTrue:[
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  1336
        super font:aFont.
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1337
        self labelView font:aFont.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1338
        rowFontAscent := self font ascent.
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1339
        rowHeight     := verticalSpacing + (self font height) + verticalSpacing + separatorSize.
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1340
        minRowHeight  := rowHeight.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1341
        ^ self
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1342
    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1343
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1344
    "/ close current editor if open
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1345
    self destroyEditView.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1346
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1347
    newGCFont := aFont.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1348
    realized ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1349
        |visibleColumns font oldSize newSize factor minimum|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1350
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1351
        newGCFont := aFont onDevice:self graphicsDevice.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1352
        factor := (newGCFont height / gc font height) asFloat.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1353
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1354
        minimum := self separatorSize + (2 * self horizontalSpacing).
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1355
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1356
        factor = 1 ifFalse:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1357
            "/ there are columns which are more or less invisible (exlude rowSelector)
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1358
            visibleColumns := columnDescriptors select:[:eachColumn|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1359
                (eachColumn rendererType ~~ #rowSelector and:[eachColumn width > minimum])
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1360
            ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1361
        ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1362
        visibleColumns notEmptyOrNil ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1363
            factor < 1 ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1364
                "/ check if zoomOut is allowed
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1365
                visibleColumns do:[: eachColumn|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1366
                    (eachColumn width * factor) > (minimum+1) ifFalse:[^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1367
                ].
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1368
            ].
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1369
            visibleColumns do:[:eachColumn|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1370
                eachColumn setDescWidth:(eachColumn width * factor) rounded.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1371
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1372
                font := eachColumn label font.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1373
                font notNil ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1374
                    font sizeUnit ~~ #px ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1375
                        oldSize := font size.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1376
                        newSize := (oldSize * factor) rounded.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1377
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1378
                        (newSize ~= oldSize and:[newSize >= 4]) ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1379
                            font := font asSize:newSize.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1380
                            font notNil ifTrue:[eachColumn label font:font].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1381
                        ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1382
                    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1383
                ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1384
            ].
1842
402a364ee001 delegate font to labelView
martin
parents: 1818
diff changeset
  1385
        ].
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1386
    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1387
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1388
    super font:newGCFont.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1389
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1390
    rowFontAscent := self font ascent.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1391
    rowHeight     := verticalSpacing + self font height + verticalSpacing + separatorSize.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1392
    minRowHeight  := rowHeight.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1393
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1394
    columnDescriptors do:[:eachColumn| eachColumn invalidate].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1395
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1396
    labelView font:self font.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1397
    self labelView fontChanged.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1398
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1399
    cachedPreferredExtent := nil.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1400
    viewOrigin := 0 @ 0.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1401
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1402
    realized ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1403
        self fitColumns.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1404
        superView recomputeLayouts.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1405
        self invalidate.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1406
        self labelView invalidate.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1407
        self contentsChanged.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1408
        self makeSelectionVisible.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1409
    ].
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1410
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1411
    "Modified (format): / 13-09-2017 / 15:34:22 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1412
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1413
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1414
has3Dseparators
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1415
    "returns true if shown in 3D mode"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1416
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1417
    ^ separatorSize ~~ 1
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1418
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1419
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1420
has3Dseparators:aBool
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1421
    "enable or disable 3D mode"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1422
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1423
    |newSepSize|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1424
3672
ff861e62db1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
  1425
    newSepSize := aBool ifTrue:[2] ifFalse:[1].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1426
    newSepSize ~~ separatorSize ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1427
        separatorSize := newSepSize.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1428
        realized ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1429
            columnDescriptors do:[:aCol |
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1430
                aCol invalidate
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1431
            ].
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  1432
            self preferredExtentChanged.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1433
            self invalidate.
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1434
            self contentsChanged
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  1435
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1436
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1437
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1438
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1439
horizontalSpacing
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1440
    "horizontal spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1441
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1442
    ^ horizontalSpacing
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1443
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1444
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1445
horizontalSpacing:aNumber
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1446
    "horizontal spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1447
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1448
    horizontalSpacing ~~ aNumber ifTrue:[
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1449
        horizontalSpacing := aNumber.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1450
        self preferredExtentChanged.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1451
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1452
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1453
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1454
showLabels
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1455
    "control the labels view to be visible or unvisible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1456
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1457
    ^ labelView isVisible
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
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1460
showLabels:aBoolean
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1461
    "control the labels view to be visible or unvisible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1462
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1463
    labelView isVisible:aBoolean
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1464
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1465
    "Modified (format): / 04-02-2017 / 21:31:43 / cg"
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1466
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1467
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1468
verticalSpacing
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1469
    "vertical spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1470
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1471
    ^ verticalSpacing
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1472
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1473
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1474
verticalSpacing:aNumber
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1475
    "vertical spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1476
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1477
    verticalSpacing ~~ aNumber ifTrue:[
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1478
        verticalSpacing := aNumber.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1479
        self preferredExtentChanged.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1480
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1481
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1482
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1483
!DSVColumnView methodsFor:'adding & removing rows'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1484
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1485
add:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1486
    "insert row at end"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1487
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1488
    ^ self add:aRow beforeIndex:(1 + list size)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1489
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1490
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1491
add:aRow afterIndex:aRowNr
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1492
    "add a new row after slot aRowNr and redisplay; returns nil in case
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1493
     of an invalid index or the row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1494
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1495
    ^ self add:aRow beforeIndex:(aRowNr + 1)
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1496
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1497
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1498
add:aRow beforeIndex:aRowNr
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1499
    "add a new row before slot aRowNr and redisplay; returns nil in case
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1500
     of an invalid index or the row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1501
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1502
    self addAll:(Array with:aRow) beforeIndex:aRowNr.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1503
    ^ aRow.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1504
!
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1505
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1506
addAll:aList beforeIndex:start
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1507
    "add a collection of rows before slot start and redisplay"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1508
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1509
    |y0 y1 yD h dH size noSel|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1510
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1511
    (size := aList size) == 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1512
        ^ self
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1513
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1514
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1515
    beDependentOfRows ifTrue:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1516
        aList do:[:aRow| aRow notNil ifTrue:[aRow addDependent:self]]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1517
    ].
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1518
4116
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1519
    list isNil ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1520
        self list:aList.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1521
    ] ifFalse:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1522
        noSel := self numberOfSelections.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1523
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1524
        noSel ~~ 0 ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1525
            multipleSelectOk ifFalse:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1526
                selectedRowIndex >= start ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1527
                    selectedRowIndex := selectedRowIndex + size
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1528
                ]
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1529
            ] ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1530
                1 to:noSel do:[:i||v|
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1531
                    (v := selectedRowIndex at:i) >= start ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1532
                        selectedRowIndex at:i put:(v + size)
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1533
                    ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1534
                ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1535
            ]
4116
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1536
        ].
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1537
        list addAll:aList beforeIndex:start.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1538
    ].
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1539
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1540
    self recomputeHeightOfContents.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1541
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1542
    y0 := (start - 1) * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1543
    yD := size * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1544
    y1 := y0 + yD.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1545
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1546
    y0 < viewOrigin y ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1547
        self originWillChange.
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1548
        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
  1549
        "/ viewOrigin y:(yD + viewOrigin y).
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1550
        self originChanged:(0 @ yD).
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1551
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1552
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1553
    (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
  1554
        self invalidate.
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1555
        self contentsChanged.
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1556
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1557
    ].
645
53c78cc2ee08 redraw twice in case of expose event during adding a new entry
ca
parents: 643
diff changeset
  1558
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1559
    y0 := self yVisibleOfRowNr:start.
1258
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1560
    h  := height - margin.
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1561
    y1 := y0 + yD min:h.
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1562
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1563
    (y1 > margin and:[y0 < h]) ifTrue:[
1952
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1564
        "/ cg: if I have a non-solid background color,
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1565
        "/ or individual items have a bgColor selector,
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1566
        "/ invalidate the area (and readraw) instead of a scroll.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1567
        (viewBackground isImageOrForm
1952
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1568
        or:[ self anyColumnHasPotentialNonConstantBackground ])
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1569
        ifTrue:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1570
            "/ do not scroll but invalidate ...
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1571
            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
  1572
        ] ifFalse:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1573
            h  := h - y1.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1574
            y0 := y0 max:margin.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1575
            dH := y1 - y0.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1576
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1577
            start == list size ifFalse:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1578
                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
  1579
            ].
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1580
            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
  1581
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1582
    ].
3478
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1583
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1584
    self contentsChanged.
3478
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1585
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1586
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1587
        self scrollToBottom.
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1588
    ].
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  1589
!
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  1590
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1591
addFirst:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1592
    "insert a row at start"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1593
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1594
    ^ self add:aRow beforeIndex:1
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1595
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1596
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1597
remove:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1598
    "remove a row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1599
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1600
    |idx|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1601
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1602
    idx := list identityIndexOf:aRow.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1603
    idx ~~ 0 ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1604
        self removeFrom:idx to:idx.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1605
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1606
    ^ aRow
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1607
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1608
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1609
removeFirst
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1610
    "remove first row; returns the removed row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1611
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1612
    ^ self removeIndex:1
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1613
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1614
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1615
removeFrom:startIndex to:stopIndex
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1616
    "remove rows from start to stop"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1617
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1618
    |coll noRedraw
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1619
     noSel "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1620
     size  "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1621
     start "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1622
     stop  "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1623
     y0    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1624
     y1    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1625
     oY    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1626
     dY    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1627
     yB    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1628
     h     "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1629
    |
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1630
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1631
    (    (start := startIndex) < 1
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1632
     or:[(stop := stopIndex) > list size]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1633
    ) ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1634
        ^ self subscriptBoundsError:start
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1635
    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1636
    size := stop - start + 1.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1637
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1638
    beDependentOfRows ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1639
        list from:start to:stop do:[:r| r notNil ifTrue:[r removeDependent:self]].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1640
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1641
    noSel := self numberOfSelections.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1642
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1643
    noSel ~~ 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1644
        noSel == 1 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1645
            noSel := self firstIndexSelected.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1646
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1647
            noSel < start ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1648
                noSel > stop ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1649
                    noSel := noSel - size.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1650
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1651
                    multipleSelectOk ifFalse:[selectedRowIndex := noSel]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1652
                                      ifTrue:[selectedRowIndex at:1 put:noSel]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1653
                ] ifFalse:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1654
                    editValue notNil ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1655
                        editValue removeDependent:self.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1656
                        editValue := nil.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1657
                    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1658
                    self deselect.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1659
                ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1660
            ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1661
        ] ifFalse:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1662
            coll := OrderedCollection new:noSel.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1663
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1664
            selectedRowIndex do:[:i|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1665
                i < start ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1666
                    coll add:i
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1667
                ] ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1668
                    i > stop ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1669
                        coll add:(i - size)
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1670
                    ]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1671
                ]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1672
            ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1673
            coll size == 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1674
                self deselect
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1675
            ] ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1676
                selectedRowIndex := coll
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1677
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1678
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1679
    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1680
    list removeFrom:start to:stop.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1681
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1682
    y0 := (start - 1) * rowHeight.
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1683
    dY := size * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1684
    y1 := dY + y0.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1685
    yB := y1 + margin - viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1686
    self recomputeHeightOfContents.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1687
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1688
    y0 < (oY := viewOrigin y) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1689
        (noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY]
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1690
                                ifTrue:[dY := dY negated].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1691
        self originWillChange.
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1692
        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
  1693
        "/ viewOrigin y:(dY + oY).
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1694
        self originChanged:(0 @ dY).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1695
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1696
        noRedraw := y0 > (height + viewOrigin y)
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1697
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1698
1483
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1699
    (shown not or:[self sensor hasDamageFor:self]) ifTrue:[
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1700
          self invalidate.
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1701
        ^ self contentsChanged.
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1702
    ].
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1703
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1704
    (noRedraw or:[shown not]) ifFalse:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1705
        y0 := self yVisibleOfRowNr:start.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1706
        y0 := y0 max:margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1707
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1708
        "/ cg: if I have a non-solid background color,
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1709
        "/ or individual items have a bgColor selector,
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1710
        "/ invalidate the area (and readraw) instead of a scroll.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1711
        (viewBackground isImageOrForm
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1712
        or:[ self anyColumnHasPotentialNonConstantBackground ])
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1713
        ifTrue:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1714
            "/ do not scroll but invalidate ...
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1715
        ] ifFalse:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1716
            y1 := yB.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1717
            h  := height - margin - yB.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1718
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1719
            h > 0 ifTrue:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1720
                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
  1721
            ].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1722
            y0 := y0 + h.
561
43b62e424d52 check height is positive before copy
ca
parents: 556
diff changeset
  1723
        ].
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1724
        self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1725
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1726
    self contentsChanged.
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1727
!
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1728
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1729
removeIndex:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1730
    "remove row at an index; returns the removed row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1731
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1732
    |row|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1733
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1734
    row := list at:aRowNr ifAbsent:nil.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1735
    self removeFrom:aRowNr to:aRowNr.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1736
    ^ row
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1737
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1738
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1739
removeLast
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1740
    "remove last row; the row is returned"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1741
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1742
    ^ self removeIndex:(list size)
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1743
!
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1744
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1745
replaceFrom:start to:stop with:aCollection startingAt:repStart
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1746
    "replace elements in the receiver between index start and stop,
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1747
     with elements  taken from replacementCollection starting at repStart.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1748
     Return the receiver."
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1749
2032
6eb610caad85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1750
    |inSelList listSize repStop run|
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1751
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1752
    inSelList := OrderedCollection new.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1753
    listSize  := list size.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1754
    repStop   := repStart + (stop - start).
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1755
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1756
    list isNil ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1757
        list := OrderedCollection new
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1758
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1759
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1760
    [listSize < stop] whileTrue:[ list add:nil. listSize := listSize + 1 ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1761
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1762
    start to:stop do:[:i| |aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1763
        aRow := list at:i ifAbsent:nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1764
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1765
        aRow notNil ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1766
            beDependentOfRows ifTrue:[aRow removeDependent:self].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1767
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1768
            (self isInSelection:i) ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1769
                inSelList add:i
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1770
            ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1771
            list at:i put:nil.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1772
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1773
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1774
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1775
    beDependentOfRows ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1776
        aCollection from:repStart to:repStop do:[:aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1777
            aRow notNil ifTrue:[aRow addDependent:self]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1778
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1779
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1780
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1781
    run := start.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1782
    aCollection from:repStart to:repStop do:[:aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1783
        list at:run put:aRow.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1784
        run := run + 1.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1785
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1786
    self invalidateRowsFrom:start to:stop.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1787
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1788
    inSelList size ~~ 0 ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1789
        self numberOfSelections == inSelList size ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1790
            self deselect
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1791
        ] ifFalse:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1792
            selectedRowIndex := selectedRowIndex select:[:i| (inSelList identityIndexOf:i) == 0 ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1793
            self selectionChanged.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1794
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1795
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1796
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1797
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1798
!DSVColumnView methodsFor:'change & update'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1799
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1800
changeWidthOfColumn:aColumn deltaX:aDeltaX
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1801
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1802
    aColumn setDescWidth:(aColumn width + aDeltaX).
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1803
    cachedPreferredExtent notNil ifTrue:[self fitColumns]
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1804
!
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1805
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1806
update:what with:aPara from:chgObj
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1807
    "one of my rows/cells changed its value"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1808
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1809
    |row listHoldersList arg1 arg2 col|
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1810
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1811
    chgObj == columnHolder ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1812
        cachedPreferredExtent := nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1813
        self columnDescriptors:(columnHolder value).
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1814
        ^ self.
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1815
    ].
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1816
    chgObj == columnAdaptor ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1817
        col := columnAdaptor value.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1818
        columnDescriptors do:[:aCol |
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1819
            aCol columnAdaptor:col
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1820
        ].
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1821
        self invalidate.
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1822
        ^ self
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1823
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1824
    chgObj == editValue ifTrue:[
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1825
        self updateColumnFromEditValue.
1227
2dd18061afc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1826
        ^ self
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1827
    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1828
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1829
    chgObj == model ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1830
        (what == #selectionIndex or:[ what == #selection ]) ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1831
            self selectRowIndex:(model selectionIndex copy).
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1832
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1833
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1834
        what == #list ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1835
            cachedPreferredExtent := nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1836
            self listHolder:model list.
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1837
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1838
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1839
        what == #value ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1840
            model == listHolder ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1841
                cachedPreferredExtent := nil.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1842
                self list:(listHolder value)
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1843
            ] ifFalse:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1844
                useIndex ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1845
                    self selectRowIndex:model value
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1846
                ] ifFalse:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1847
                    |newSel|
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1848
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1849
                    multipleSelectOk ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1850
                        newSel := (model value ? #()) collect:[:each | self list indexOf:each]
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1851
                    ] ifFalse:[
5719
d53bae9fd8b2 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5718
diff changeset
  1852
                        newSel := (self list ? #()) indexOf:model value
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1853
                    ].
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1854
                    self selectRowIndex:newSel
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1855
                ].
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1856
            ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1857
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1858
        ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1859
    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1860
4219
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  1861
    (chgObj == listHolder) ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1862
        cachedPreferredExtent := nil.
1953
9190339e9fad lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents: 1952
diff changeset
  1863
        listHoldersList := listHolder value.
4219
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  1864
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1865
        what == #value ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1866
            self list:listHoldersList.
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1867
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1868
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1869
        aPara isCollection ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1870
            arg1 := aPara at:1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1871
            arg2 := aPara at:2.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1872
        ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1873
            arg1 := arg2 := aPara
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1874
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1875
        what == #at: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1876
            self at:arg1 put:(listHoldersList at:arg1).
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1877
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1878
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1879
        what == #insert: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1880
            self add:(listHoldersList at:arg1) beforeIndex:arg1.
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1881
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1882
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1883
        what == #remove: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1884
            self removeFrom:arg1 to:arg1.
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1885
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1886
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1887
        what == #removeFrom: ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1888
            listHoldersList size == 0 ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1889
                self list:nil
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1890
            ] ifFalse:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1891
                self removeFrom:arg1 to:arg2
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1892
            ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1893
            ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1894
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1895
        what == #insertCollection: ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1896
            arg2 ~~ 0 ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1897
                self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1))
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1898
                    beforeIndex:arg1
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1899
            ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1900
            ^ self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1901
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1902
        what == #replace: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1903
            self
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1904
                replaceFrom:arg1 to:arg2
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1905
                with:listHoldersList startingAt:arg1.
2537
cf1b9b6eeb41 change update:with:from: - ask cg
penk
parents: 2535
diff changeset
  1906
            ^ self
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1907
        ].
2537
cf1b9b6eeb41 change update:with:from: - ask cg
penk
parents: 2535
diff changeset
  1908
        self list:listHoldersList.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1909
        ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1910
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1911
1593
2188ae28557e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
  1912
    arg1 := aPara ? what.
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  1913
    row := (what isNumber) ifTrue:[what] ifFalse:[chgObj].
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  1914
    self invalidateVisibleRow:row readSelector:arg1.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1915
    editView notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1916
        (self isInSelection:(self identityIndexOfRow:row)) ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1917
            self updateEditorFromChangedRow
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1918
        ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1919
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1920
5719
d53bae9fd8b2 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5718
diff changeset
  1921
    "Modified: / 30-01-2000 / 12:16:49 / cg"
d53bae9fd8b2 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5718
diff changeset
  1922
    "Modified: / 08-03-2018 / 18:06:19 / stefan"
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1923
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1924
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1925
updateColumnFromEditValue
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1926
    |editValueBefore firstSelectedIndex newValue realValue col|
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1927
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1928
    editValueBefore := editValue.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1929
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1930
    firstSelectedIndex := self firstIndexSelected.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1931
    newValue := editValue value.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1932
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1933
    col := self selectedColumn.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1934
    col at:firstSelectedIndex put:newValue.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1935
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1936
    col editorType == #RadioButton ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1937
        "/ turn off the other column
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1938
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1939
        1 to:list size do:[:rowNr |
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1940
            rowNr ~~ firstSelectedIndex ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1941
                (col at:rowNr) ~~ false ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1942
                    col at:rowNr put:false.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1943
                    self invalidateRowAt:rowNr colAt:col columnNumber.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1944
                ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1945
            ]
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1946
        ]
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1947
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1948
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1949
    realValue := col at:firstSelectedIndex.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1950
    (realValue ~= newValue) ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1951
        "/ some validation by the row-object; the stored value
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1952
        "/ is different from what I think.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1953
        "/ update my input fields modelValue
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1954
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1955
        "/ just in case someone nilled or changed the editValue
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1956
        "/ Q: is this CA's paranoia or could this really be done in the at:put: above ???
3518
ab2b4b5cfda0 Fix reset of editValue when changed model does not exept change
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  1957
        "/ A (sv): it me happen, if the set method specified in the column descriptor did not set the
ab2b4b5cfda0 Fix reset of editValue when changed model does not exept change
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  1958
        "/         model.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1959
        (editValueBefore == editValue) ifTrue:[
3518
ab2b4b5cfda0 Fix reset of editValue when changed model does not exept change
Stefan Vogel <sv@exept.de>
parents: 3512
diff changeset
  1960
            editValue value:realValue withoutNotifying:self.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1961
        ].
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1962
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1963
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1964
    modifiedChannel notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1965
        modifiedChannel value:true.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1966
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1967
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1968
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1969
updateEditorFromChangedRow
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1970
    |rowsValue rowNr|
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1971
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1972
    (rowNr := selectedRowIndex) isNumber ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1973
        rowNr := rowNr first.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1974
    ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1975
    rowsValue := (self columnDescriptorAt:self selectedColIndex) at:rowNr.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1976
    (editValue notNil and:[ editValue value ~= rowsValue ]) ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1977
        editValue value:rowsValue withoutNotifying:self.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1978
        editView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1979
            withAllSubViewsDo:[:v |
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1980
                v isInputField ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1981
                    v flash.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1982
                ]
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1983
            ]
2702
35892dc4449a bugfix: test whether editValue notNil
ca
parents: 2695
diff changeset
  1984
    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1985
!
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1986
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1987
updateList
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1988
    listHolder notNil ifTrue:[
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1989
        self list:listHolder value.
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1990
        ^ self
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1991
    ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1992
    model notNil ifTrue:[
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1993
        self list:model value.
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1994
        ^ self
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1995
    ].
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1996
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1997
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1998
!DSVColumnView methodsFor:'drag & drop'!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1999
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2000
canDrag
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2001
    "returns true if dragging is enabled"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2002
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2003
    ^ dropSource notNil
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2004
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2005
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2006
canStartDragAt:aPoint clickedAt:clickPoint
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2007
    self canDrag ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2008
        ^ false
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2009
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2010
    ^ (aPoint dist:clickPoint) > (UserPreferences current motionDistanceToStartDrag)
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2011
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2012
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2013
dragAutoScroll:aDropContext
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2014
    "called by the DragAndDropManager to scroll during a drag/drop operation
5805
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2015
     if required (decided by the widget itself). 
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2016
     If a scroll is done, return true;
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2017
     otherwise false (used to restore the background)"
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2018
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2019
    |yInset absLnNr y|
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2020
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2021
    (super dragAutoScroll:aDropContext) ifTrue:[^ true].
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2022
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2023
    y := aDropContext targetPoint y.
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2024
    yInset := margin + rowHeight.
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2025
    y > yInset ifTrue:[
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2026
        y >= (height - yInset) ifFalse:[^ false].
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2027
    ].
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2028
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2029
    absLnNr := self yVisibleToRowNr:y.
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2030
    absLnNr isNil ifTrue:[^ false].
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2031
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2032
    (absLnNr > 1 and:[absLnNr < self size]) ifFalse:[
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2033
        ^ false
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2034
    ].
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2035
    aDropContext contentsWillChange.
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2036
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2037
    y > yInset
2580
aea885fae0de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2038
        ifTrue:[self scrollDown:rowHeight]
aea885fae0de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2039
        ifFalse:[self scrollUp:rowHeight].
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2040
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2041
    ^ true
5805
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2042
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2043
    "Modified: / 14-06-2018 / 11:21:13 / Claus Gittinger"
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2044
!
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2045
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2046
dropSource
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2047
    "returns the dropSource or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2048
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2049
    ^ dropSource
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2050
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2051
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2052
dropSource:aDropSourceOrNil
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2053
    "set the dropSource or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2054
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2055
    dropSource := aDropSourceOrNil.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2056
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2057
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2058
startDragAt:aPoint
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2059
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2060
    dropSource notNil ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2061
        buttonReleaseAction := buttonMotionAction := nil.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2062
        dropSource startDragIn:self at:aPoint.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2063
    ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2064
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2065
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2066
!DSVColumnView methodsFor:'drawing'!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2067
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2068
colorOnDevice:aColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2069
    "returns color on device"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2070
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2071
    |col|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2072
641
tz
parents: 637
diff changeset
  2073
    aColor = Color noColor ifFalse:[
tz
parents: 637
diff changeset
  2074
        col := colorMap at:aColor ifAbsent:nil.
tz
parents: 637
diff changeset
  2075
        col isNil ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  2076
            colorMap at:aColor put:(col := aColor onDevice:device)
641
tz
parents: 637
diff changeset
  2077
        ].
tz
parents: 637
diff changeset
  2078
        ^ col
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2079
    ].
641
tz
parents: 637
diff changeset
  2080
    ^ bgColor
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2081
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2082
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2083
forceRedraw
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2084
    "a redraw forced by any other component"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2085
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2086
    shown ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2087
        self invalidate
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2088
    ]
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2089
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2090
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2091
invalidate
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2092
    "recompute extent before repair range"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2093
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2094
    self recomputeHeightOfContents.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2095
    super invalidate.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2096
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2097
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2098
invalidateRowAt:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2099
    "redraw total row at an index"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2100
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2101
    self invalidateRowAt:aRowNr colAt:0
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2102
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2103
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2104
invalidateRowAt:aRowNr colAt:aColNr
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2105
    "redraw either a single column in a row,
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2106
     or the complete visible row (in case of aColNr == 0).
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2107
     If the row/column is hidden, no redraw is done"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2108
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2109
    |x "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2110
     y "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2111
     h "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2112
     w "{ Class:SmallInteger }"
2523
a7d71e57632f care for non-existing column
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
  2113
     col|
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2114
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2115
    (shown and:[aRowNr notNil and:[aRowNr between:1 and:list size]]) ifTrue:[
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2116
        h := rowHeight.
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2117
        y := self yVisibleOfRowNr:aRowNr.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2118
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2119
        y < margin ifTrue:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2120
            (h := h + y) <= margin ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2121
                ^ self
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2122
            ].                                                  "/ row not visible
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2123
            h := h - margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2124
            y := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2125
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2126
            y >= height ifTrue:[^ self].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2127
        ].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2128
        aColNr ~~ 0 ifTrue:[                                    "/ redraw column in row
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2129
            col := (self columnDescriptorAt:aColNr).
3672
ff861e62db1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
  2130
            w := col isNil ifTrue:[0] ifFalse:[col width].
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2131
            x := self xVisibleOfColNr:aColNr.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2132
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2133
            x < margin ifTrue:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2134
                (w := w + x) <= margin ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2135
                    ^ self
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2136
                ].                                              "/ column not visible
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2137
                w := w - margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2138
                x := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2139
            ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2140
                x >= width ifTrue:[^ self].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2141
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2142
        ] ifFalse:[                                             "/ redraw whole row
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2143
            x := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2144
            w := width.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2145
        ].
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2146
        self invalidateX:x y:y width:w height:h
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2147
    ]
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2148
!
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2149
2469
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2150
invalidateRows:aCollection
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2151
    "redraw some visible rows"
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2152
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2153
    shown ifTrue:[
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2154
        aCollection do:[:rowIndex |
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2155
            self invalidateRowAt:rowIndex
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2156
        ]
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2157
    ]
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2158
!
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2159
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2160
invalidateRowsFrom:aStart to:aStop
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2161
    "redraw visible row from start to stop"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2162
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2163
    |size start stop y0 y1|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2164
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2165
    shown ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2166
        size  := list size.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2167
        start := aStart notNil ifTrue:[aStart max:1]    ifFalse:[1].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2168
        stop  := aStop  notNil ifTrue:[aStop  min:size] ifFalse:[size].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2169
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2170
        start <= stop ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2171
            y0 := (self yVisibleOfRowNr:start)              max:margin.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2172
            y1 := ((self yVisibleOfRowNr:stop) + rowHeight) min:height.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2173
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2174
            y0 < y1 ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2175
                self invalidateX:margin y:y0 width:width height:(y1 - y0)
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2176
            ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2177
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2178
    ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2179
!
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2180
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2181
invalidateSelection
5214
1f88a970e4db #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5204
diff changeset
  2182
    "invalidate (force async redraw) the current selection"
1f88a970e4db #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5204
diff changeset
  2183
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2184
    |colIndex|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2185
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2186
    shown ifTrue:[
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2187
        colIndex := self selectedColIndex ? 0.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2188
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2189
        self selectionIndicesDo:[:aRowIndex|
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2190
            self invalidateRowAt:aRowIndex colAt:colIndex.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2191
        ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2192
    ]
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2193
!
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2194
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2195
invalidateVisibleRow:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2196
    "redraw row if visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2197
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2198
    self invalidateVisibleRow:aRow colAt:0
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2199
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2200
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2201
invalidateVisibleRow:aRow colAt:aColNr
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2202
    "redraw either a single column in a row,
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2203
     or the complete visible row (in case of aColNr == 0).
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2204
     If the row/column is hidden, no redraw is done"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2205
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2206
    |start "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2207
     stop  "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2208
    |
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2209
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2210
    (start := self indexOfFirstRowShown) ~~ 0 ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2211
        stop := (start + (height // rowHeight)) min:(list size).
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2212
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2213
        aRow isNumber ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2214
            (aRow between:start and:stop) ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2215
                self invalidateRowAt:aRow colAt:aColNr
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2216
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2217
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2218
            start to:stop do:[:i|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2219
                (self at:i) == aRow ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2220
                    ^ self invalidateRowAt:i colAt:aColNr
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2221
                ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2222
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2223
        ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2224
    ]
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2225
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2226
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2227
invalidateVisibleRow:aRow readSelector:aSelector
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2228
    "redraw a column identified by its read selector; if no column with
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2229
     the specified read selector is detected, the whole line is drawn."
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2230
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2231
    |row idx|
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2232
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2233
    aSelector isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2234
        idx := 0
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2235
    ] ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2236
        (row := aRow) isNumber ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2237
            (row := self at:aRow) isNil ifTrue:[ ^ self ]
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2238
        ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2239
        idx := columnDescriptors
4686
dda678ab83bf class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  2240
                findFirst:[:aCol| aCol description readSelector == aSelector]
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2241
    ].
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2242
    self invalidateVisibleRow:aRow colAt:idx
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2243
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2244
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2245
redrawX:x y:y width:w height:h
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2246
    "redraw part of myself immediately, given logical coordinates "
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2247
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2248
    |c0 savClip stopRedraw selWidth
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2249
     start "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2250
     stop  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2251
     x0    "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2252
     x1    "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2253
     maxX  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2254
     yTop  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2255
     yBot  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2256
     clHg  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2257
     size  "{ Class:SmallInteger }"
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2258
     lineColor
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2259
    |
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2260
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2261
    shown ifFalse:[^ self].
3993
6840bc23b584 changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2262
    self isReallyShown ifFalse:[^ self].
6840bc23b584 changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2263
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2264
    gc paint:bgColor.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2265
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2266
    columnDescriptors isEmpty ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2267
        ^ gc fillRectangleX:x y:y width:w height:h
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2268
    ].
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2269
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2270
    size  := list size.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2271
    yTop  := margin - viewOrigin y.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2272
    c0    := y - yTop max:0.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2273
    start := (c0 // rowHeight) + 1.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2274
    stop  := (((c0 + h - 1) // rowHeight) + 1) min:size.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2275
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2276
    stop < start ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2277
        ^ gc fillRectangleX:x y:y width:w height:h
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2278
    ].
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  2279
    savClip := self clippingBoundsOrNil.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2280
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2281
    maxX := (x + w) min:(width - margin).
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2282
    x0   := margin - viewOrigin x.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2283
    yTop := yTop + ((start - 1) * rowHeight).
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2284
    clHg := (stop - start + 1) * rowHeight.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2285
    yBot := yTop + clHg.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2286
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2287
    stopRedraw := false.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2288
5737
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2289
    self class stopRedrawSignal handle:[:ex |
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2290
        "/ redraw aborted due to too many changes while drawing.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2291
        stopRedraw := true.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2292
    ] do:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2293
        columnDescriptors do:[:aCol| |cw|
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2294
            x1 := x0 + aCol width.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2295
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2296
            (x1 > x and:[x0 < maxX]) ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2297
                |left right rect|
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2298
                left  := x0 max:x.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2299
                right := x1 min:maxX.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2300
                rect  := Rectangle left:left top:y width:(right - left) height:h.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2301
5737
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2302
                "/ self clippingBounds:nil.
5204
fccb63f32188 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5195
diff changeset
  2303
                self clippingBounds:rect.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2304
                aCol redrawX:x0 y:yTop h:clHg  from:start to:stop.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2305
            ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2306
            x0 := x1
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2307
        ].
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2308
    ].
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2309
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2310
    "/ restore old clipping rectangle
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  2311
    self clippingBounds:savClip.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2312
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2313
    stopRedraw ifTrue:[
5737
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2314
        "/ redraw aborted due to too many changes while drawing.
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2315
        "/ try again after some grace period
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2316
        Processor addTimedBlock:[self invalidate] after:0.1 seconds.
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2317
        "/  self invalidate.
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2318
        "/ self makeSelectionVisible.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2319
        ^ self
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2320
    ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2321
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2322
    stop == size ifTrue:[
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2323
        yTop := y + h.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2324
        yBot < (yTop - margin) ifTrue:[
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2325
            "/ clear to bottom of screen
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2326
            gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2327
            gc fillRectangleX:x y:yBot width:w height:(yTop - yBot).
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2328
        ]
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  2329
    ].
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  2330
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2331
    (c0 := w + x- x1) > 0 ifTrue:[
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2332
        "/ clear to right of screen
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2333
        gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2334
        gc fillRectangleX:x1 y:y width:c0 height:h.
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  2335
    ].
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2336
    "/ if only rows are selected we have to draw
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2337
    "/  - the selection frame around the labels
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2338
    "/  - and to fill the selection area behind the table if not bound to the width of the view
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2339
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2340
    self hasRowSelection ifFalse:[ ^ self ].  "/ nothing to do
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2341
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2342
    selWidth := width-margin-x1.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2343
    lineColor := self selectionFrameColor.
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2344
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2345
    self selectionIndicesDo:[:rowNr |
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2346
        | yVis |
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2347
        yVis := self yVisibleOfRowNr:rowNr.
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2348
        selWidth > 0 ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2349
            gc paint:selectionBackgroundColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2350
            gc fillRectangleX:x1 y:yVis width:selWidth height:rowHeight.
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2351
        ].
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2352
        lineColor notNil ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2353
            gc paint:lineColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2354
            gc displayLineFromX:x y:yVis toX:width y:yVis.
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2355
            yVis := yVis+rowHeight -1.
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2356
            gc displayLineFromX:x y:yVis toX:width y:yVis.
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2357
        ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2358
    ].
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2359
3993
6840bc23b584 changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2360
    "Modified: / 21-01-2011 / 15:58:11 / cg"
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2361
! !
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2362
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2363
!DSVColumnView methodsFor:'drawing interactors'!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2364
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2365
displayLabel:aLabel x:xLeft y:yTop
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2366
    "display the label at x y; test whether the height of the label matches to the current
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2367
     rowHeight. If not, an exception is raised and the rowHeight is recomputed"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2368
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2369
    |y h |
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2370
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2371
    aLabel notNil ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2372
        aLabel isString ifTrue:[
2593
24ddc48c5ad4 bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents: 2592
diff changeset
  2373
            y := yTop + self rowFontAscent.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2374
        ] ifFalse:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2375
            h := aLabel heightOn:self.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2376
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2377
            h > minRowHeight ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2378
                minRowHeight := h.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2379
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  2380
                cachedPreferredExtent notNil ifTrue:[
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  2381
"/                    rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2382
                    cachedPreferredExtent := Point
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  2383
                                            x: cachedPreferredExtent x
3172
65f4533fbf75 preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents: 3149
diff changeset
  2384
                                            y: (list size * rowHeight).
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2385
                    self contentsChanged.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2386
                ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2387
                self class stopRedrawSignal raiseRequest.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2388
            ].
2593
24ddc48c5ad4 bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents: 2592
diff changeset
  2389
            y := yTop + (aLabel ascentOn:self).
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2390
        ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2391
        aLabel displayOn:self x:xLeft y:y.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2392
    ].
3172
65f4533fbf75 preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents: 3149
diff changeset
  2393
65f4533fbf75 preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents: 3149
diff changeset
  2394
    "Modified: / 05-02-2007 / 09:07:10 / cg"
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2395
!
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2396
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2397
drawCheckToggleAtX:xLeft y:yTop w:cellWidth state:cellValue
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2398
    "draw a check toggle button"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2399
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2400
    |e form
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2401
     y "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2402
     x "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2403
     h "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2404
     w "{ Class:SmallInteger }"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2405
     state|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2406
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2407
    state := (cellValue ? false).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2408
    state isBoolean ifFalse:[ state := false ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2409
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2410
    w := checkToggleExtent x.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2411
    h := checkToggleExtent y.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2412
    y := yTop + ((rowHeight - h) // 2).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2413
    x := xLeft + ((cellWidth  - w) // 2).
1529
aa5e8fae6f23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
  2414
    h odd ifTrue:[y := y + 1].
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2415
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2416
    checkToggleActiveImage isNil ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2417
        gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2418
        gc fillRectangleX:x y:y width:w height:h.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2419
        self drawEdgesAtX:x   y:y width:w height:h level:checkToggleLevel on:self.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2420
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2421
        state ifFalse:[
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2422
            ^ self
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2423
        ].
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2424
        gc paint:fgColor on:bgColor.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2425
        form := checkToggleForm
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2426
    ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2427
        form := state
5053
ab95fb6af06f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  2428
                    ifTrue:[checkToggleActiveImage]
ab95fb6af06f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  2429
                    ifFalse:[checkTogglePassiveImage].
859
e63eb6f321e1 support List for columns
ca
parents: 833
diff changeset
  2430
    ].
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2431
    e := (checkToggleExtent - form extent) // 2.
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2432
    gc displayForm:form x:(x + e x) y:(y + e y).
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2433
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2434
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2435
drawComboButtonAtX:xTop y:yTop w:rowWidth
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2436
    "draw a combo button"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2437
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2438
    |e
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2439
     x "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2440
     y "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2441
     h "{ Class:SmallInteger }"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2442
     w "{ Class:SmallInteger }"|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2443
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2444
    w := comboButtonExtent x.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2445
    h := comboButtonExtent y.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2446
    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
  2447
    x := xTop + (rowWidth  - w - separatorSize - 1).
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2448
    e := (comboButtonExtent - comboButtonForm extent) // 2.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2449
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2450
    gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2451
    gc fillRectangleX:x y:y width:w height:h.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2452
    self drawEdgesAtX:x   y:y width:w height:h level:comboButtonLevel on:self.
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2453
    gc paint:fgColor on:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2454
    gc displayForm:comboButtonForm x:(x + e x) y:(y + e y)
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2455
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2456
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2457
drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2458
    "draw edges for a cell or label"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2459
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2460
    aGC
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2461
        drawEdgesForX:x
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2462
        y:y
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2463
        width:w
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2464
        height:h
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2465
        level:aLevel
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2466
        shadow:buttonShadowColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2467
        light:buttonLightColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2468
        halfShadow:buttonHalfShadowColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2469
        halfLight:buttonHalfLightColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2470
        style:ButtonEdgeStyle.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2471
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2472
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2473
drawRadioButtonAtX:xLeft y:yTop w:cellWidth state:aBooleanOrNil
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2474
    "draw a radio button"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2475
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2476
    |image
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2477
     y "{ Class:SmallInteger }"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2478
     x "{ Class:SmallInteger }"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2479
     h "{ Class:SmallInteger }"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2480
     w "{ Class:SmallInteger }"|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2481
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2482
    w := radioButtonActiveImage extent x.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2483
    h := radioButtonActiveImage extent y.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2484
    y := yTop + ((rowHeight - h) // 2).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2485
    x := xLeft + ((cellWidth - w) // 2).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2486
    h odd ifTrue:[y := y + 1].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2487
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2488
    image := (aBooleanOrNil == true)
5053
ab95fb6af06f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  2489
                ifTrue:[radioButtonActiveImage]
ab95fb6af06f #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 4991
diff changeset
  2490
                ifFalse:[radioButtonPassiveImage].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2491
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  2492
    image := image onDevice:device.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2493
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2494
    self displayForm:image x:x y:y.
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2495
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2496
    "Modified (format): / 04-02-2017 / 21:31:16 / cg"
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2497
! !
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2498
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2499
!DSVColumnView methodsFor:'enumerating columns'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2500
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2501
columnsDo:aOneArgBlock
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2502
    "evaluate the argument, aOneArgBlock for every columnDescriptor"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2503
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2504
    columnDescriptors do:aOneArgBlock
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2505
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2506
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2507
columnsFrom:start to:stop do:aOneArgBlock
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2508
    "evaluate the argument, aOneArgBlock for the columns with index start to
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2509
     stop in the collection of column descriptors"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2510
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2511
    columnDescriptors
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2512
        from:start
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2513
        to:stop
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2514
        do:aOneArgBlock
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2515
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2516
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2517
!DSVColumnView methodsFor:'event handling'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2518
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2519
buttonControlPressAt:clickPoint rowNr:aRowNr colNr:aColNr
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2520
    |isSelected prvRow doAdd chgSet|
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2521
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2522
    buttonMotionAction := buttonReleaseAction := nil.
3239
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2523
    isSelected := self isInSelection:aRowNr.
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2524
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2525
    multipleSelectOk ifFalse:[
3239
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2526
        isSelected ifTrue:[
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2527
            self deselect.
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2528
        ] ifFalse:[
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2529
            self selectRowAt:aRowNr colAt:aColNr atPoint:clickPoint openEditor:false.
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2530
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2531
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2532
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2533
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2534
    isSelected ifTrue:[ self removeRowFromSelection:aRowNr ]
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2535
              ifFalse:[ self addRowToSelection:aRowNr ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2536
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2537
    multipleSelectOk ifFalse:[ ^ self ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2538
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2539
    prvRow := aRowNr.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2540
    chgSet := IdentitySet new.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2541
    doAdd  := isSelected not.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2542
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2543
    buttonMotionAction := [:p|
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2544
        |rowNr mustRestore step f|
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2545
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2546
        rowNr := self yVisibleToRowNr:(p y).
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2547
        (rowNr notNil and:[rowNr ~~ prvRow]) ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2548
            rowNr == aRowNr ifTrue:[
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2549
                mustRestore := true
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2550
            ] ifFalse:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2551
                rowNr > aRowNr ifTrue:[ mustRestore := (rowNr < prvRow) ]
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2552
                              ifFalse:[ mustRestore := (rowNr > prvRow) ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2553
            ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2554
            prvRow > rowNr ifTrue:[ step := -1 ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2555
                          ifFalse:[ step :=  1 ].
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2556
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2557
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2558
            mustRestore ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2559
                [ prvRow ~~ rowNr ] whileTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2560
                    (chgSet removeIdentical:prvRow ifAbsent:nil) notNil ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2561
                        doAdd ifFalse:[ self addRowToSelection:prvRow ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2562
                               ifTrue:[ self removeRowFromSelection:prvRow ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2563
                    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2564
                    prvRow := prvRow + step.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2565
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2566
            ] ifFalse:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2567
                [ prvRow ~~ rowNr ] whileTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2568
                    prvRow := prvRow + step.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2569
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2570
                    doAdd ~~ (self isInSelection:rowNr) ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2571
                        chgSet add:prvRow.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2572
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2573
                        doAdd ifTrue:[ self addRowToSelection:prvRow ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2574
                             ifFalse:[ self removeRowFromSelection:prvRow ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2575
                    ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2576
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2577
            ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2578
        ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2579
    ].
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  2580
3239
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2581
    "Modified: / 21-07-2007 / 22:00:27 / cg"
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2582
!
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2583
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2584
buttonMotion:buttonMask x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2585
    "mouse-move while button was pressed - handle multiple selection changes"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2586
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2587
    self isEnabled ifFalse:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2588
        ^ self
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2589
    ].
2788
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2590
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2591
    buttonMotionAction notNil ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2592
        buttonMotionAction value:(x @ y).
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2593
        buttonMotionAction notNil ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2594
            autoScroll ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2595
                "/ if moved outside of view, start autoscroll
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2596
                (y < 0) ifTrue:[
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  2597
                    ^ self startAutoScroll:#scrollUp distance:y.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2598
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2599
                (y > height) ifTrue:[
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  2600
                    ^ self startAutoScroll:#scrollDown distance:(y - height).
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2601
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2602
            ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2603
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2604
    ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2605
    self stopAutoScroll.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2606
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2607
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2608
buttonMultiPress:button x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2609
    "a button was pressed twice - handle doubleclick here"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2610
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2611
    |selectedCol|
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2612
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2613
    buttonMotionAction := buttonReleaseAction := nil.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2614
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2615
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2616
3742
a4bb22bc79e2 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  2617
    (button == 1) ifFalse:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2618
        ^ super buttonMultiPress:button x:x y:y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2619
    ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2620
    self numberOfSelections == 1 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2621
        self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2622
            selectedCol := self selectedColIndex.
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2623
            ( selectedCol == 0
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2624
              or:[selectedCol == (self xVisibleToColNr:x)]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2625
            ) ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2626
                self doubleClicked
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2627
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2628
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2629
    ]
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2630
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2631
    "Modified: / 26-03-2007 / 15:19:04 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2632
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2633
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2634
buttonPress:button x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2635
    "a button was pressed - handle selection here"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2636
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2637
    |rowNr colNr sensor clickPoint clickedIntoSelection column columnEditorType|
2802
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2638
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2639
    buttonMotionAction := buttonReleaseAction := nil.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2640
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2641
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2642
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2643
    rowNr := self yVisibleToRowNr:y.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2644
    colNr := self xVisibleToColNr:x.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2645
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2646
    (button == 2) ifTrue:[ |openMenu|
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2647
        openMenu := false.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2648
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2649
        UserPreferences current selectOnRightClick ifFalse:[
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2650
            openMenu := true.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2651
        ] ifTrue:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2652
            UserPreferences current showRightButtonMenuOnRelease ifFalse:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2653
                (rowNr notNil and:[colNr notNil and:[self isRowSelectable:rowNr]]) ifTrue:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2654
                    self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2655
                ].
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2656
                openMenu := true.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2657
            ].
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2658
        ].
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2659
        openMenu ifTrue:[ |menu|
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2660
            menu := self findMenuForSelection.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2661
            menu notNil ifTrue:[
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2662
                self startUpMenu:menu.
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2663
            ] ifFalse:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2664
                super buttonPress:button x:x y:y.
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2665
            ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2666
            ^ self
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2667
        ].
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2668
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2669
2804
8204b926377d oops - firstRow could be nil
Claus Gittinger <cg@exept.de>
parents: 2802
diff changeset
  2670
    (rowNr isNil or:[colNr isNil]) ifTrue:[
2722
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  2671
        self deselect.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2672
        super buttonPress:button x:x y:y.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2673
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2674
    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2675
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  2676
    (self isRowSelectable:rowNr) ifFalse:[^ self ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  2677
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2678
    sensor     := self sensor.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2679
    clickPoint := x @ y.
2813
74cfefd3a0a4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2812
diff changeset
  2680
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2681
    sensor shiftDown ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2682
        self buttonShiftPressAt:clickPoint rowNr:rowNr colNr:colNr.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2683
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2684
    ].
2802
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2685
    sensor ctrlDown ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2686
        self buttonControlPressAt:clickPoint rowNr:rowNr colNr:colNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2687
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2688
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2689
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2690
    multipleSelectOk ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2691
        self canDrag ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2692
            self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2693
            ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2694
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2695
        self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2696
3923
d5c71ade2f43 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  2697
        ((button == 2) and:[UserPreferences current selectOnRightClick]) ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2698
            self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2699
        ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2700
            buttonReleaseAction :=
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2701
                [
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2702
                    self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2703
                ].
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2704
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2705
            buttonMotionAction :=
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2706
                [:aPoint|
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2707
                    (self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2708
                        self startDragAt:aPoint
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2709
                    ]
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2710
                ].
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2711
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2712
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2713
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2714
3923
d5c71ade2f43 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  2715
    ((button == 2) and:[UserPreferences current selectOnRightClick]) ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2716
        buttonReleaseAction :=
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2717
            [
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2718
                self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true.
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2719
            ].
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2720
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2721
        "/ normally, we select on button release; however, any editor is shown immediately
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2722
        ((column := self columnDescriptorAt:colNr) notNil
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2723
        and:[ (columnEditorType := column description editorType) notNil
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2724
        and:[ columnEditorType ~~ #None ]]) ifTrue:[
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2725
            buttonReleaseAction value.
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2726
            buttonReleaseAction := nil.
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2727
            editView notNil ifTrue:[
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2728
                |p|
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2729
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2730
                "/ kludge
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  2731
                p := device translatePoint:x@y fromView:self toView:editView.
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2732
                editView simulateButtonPress:button at:p.
4056
36eb0b1137db changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4055
diff changeset
  2733
                (editView subViews first isKindOf:EditTextView) ifTrue:[
36eb0b1137db changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4055
diff changeset
  2734
                    editView simulateButtonRelease:button at:p.
36eb0b1137db changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4055
diff changeset
  2735
                ].
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2736
                ^ self.
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2737
            ]
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2738
        ]
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2739
    ].
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2740
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2741
    clickedIntoSelection := self isInSelection:rowNr.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2742
    clickedIntoSelection ifTrue:[
3908
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2743
        |selColIdx|
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2744
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2745
        selColIdx := self selectedColIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2746
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2747
        (selColIdx ~~ 0 and:[selColIdx ~~ colNr]) ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2748
            clickedIntoSelection := (selectedRowIndex size > 1)
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2749
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2750
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2751
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2752
    clickedIntoSelection ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2753
        self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2754
    ] ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2755
        self canDrag ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2756
            buttonMotionAction :=
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2757
                [:aPoint|
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2758
                    (self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2759
                        self startDragAt:aPoint
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2760
                    ]
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2761
                ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2762
            ^ self
2802
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2763
        ]
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2764
    ].
2788
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2765
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2766
    buttonMotionAction := [:p|
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2767
        (self bounds containsPoint:p) ifTrue:[
3908
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2768
            |rowUnderPoint|
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2769
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2770
            rowUnderPoint := self yVisibleToRowNr:(p y).
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2771
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2772
            rowUnderPoint notNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2773
                buttonReleaseAction notNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2774
                    rowUnderPoint == rowNr ifFalse:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2775
                        buttonReleaseAction := nil
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2776
                    ].
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2777
                ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2778
                buttonReleaseAction isNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2779
                    self selectRowFrom:rowNr to:rowUnderPoint.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2780
                ]
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2781
            ]
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2782
        ].
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2783
    ].
3908
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2784
4056
36eb0b1137db changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4055
diff changeset
  2785
    "Modified: / 12-07-2011 / 14:54:45 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2786
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2787
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2788
buttonRelease:button x:x y:y
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2789
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2790
    buttonMotionAction := nil.
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  2791
    self stopAutoScroll.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  2792
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2793
    buttonReleaseAction notNil ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2794
        buttonReleaseAction value.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2795
        buttonReleaseAction := nil.
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2796
    ].
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2797
    super buttonRelease:button x:x y:y
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2798
!
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2799
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2800
buttonShiftPressAt:clickPoint rowNr:aRowNr colNr:aColNr
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2801
    |colIdx numSelRows|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2802
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2803
    buttonReleaseAction := buttonMotionAction := nil.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2804
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2805
    colIdx := aColNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2806
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2807
    (multipleSelectOk and:[(numSelRows := selectedRowIndex size) > 0]) ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2808
        (numSelRows == 1 and:[self isInSelection:aRowNr]) ifFalse:[ |min max|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2809
            min := max := aRowNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2810
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2811
            selectedRowIndex do:[:anIndex|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2812
                min := min min:anIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2813
                max := max max:anIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2814
            ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2815
            self selectRowFrom:min to:max.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2816
            ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2817
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2818
        self selectedColIndex ~~ 0 ifTrue:[     "/ toggle column selection
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2819
            colIdx := 0
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2820
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2821
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2822
    self selectRowAt:aRowNr colAt:colIdx atPoint:clickPoint openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2823
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2824
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2825
characterPress:aChar x:x y:y
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  2826
    "search row in column at x/y starting its printable label with character."
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2827
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2828
    |colNr rowNr lsize found column|
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2829
2445
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2830
    lsize  := list size.
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2831
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2832
"/    (rowIfAbsentBlock notNil
2445
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2833
"/     or:[x isNil
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2834
"/     or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2835
"/        ^ self
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2836
"/    ].
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2837
    colNr := self findFirstColumnWithStringFrom:1 to:lsize.
2535
4df3f0a09b83 fixed: characterPressed: ... on non editable column
tm
parents: 2524
diff changeset
  2838
    colNr isNil ifTrue:[ ^ self ].
4df3f0a09b83 fixed: characterPressed: ... on non editable column
tm
parents: 2524
diff changeset
  2839
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2840
    rowNr  := self lastIndexSelected.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2841
    column := self columnDescriptorAt:colNr.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2842
    found  := 0.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2843
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2844
    lsize > rowNr ifTrue:[
2445
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2845
        "/ search to end
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2846
        found := column findRowNrStartingWithChar:aChar start:(rowNr + 1) stop:lsize.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2847
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2848
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2849
    (found == 0 and:[rowNr > 1]) ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2850
     "/ search from begin
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2851
        found := column findRowNrStartingWithChar:aChar start:1 stop:(rowNr - 1)
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2852
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2853
    found ~~ 0 ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2854
        self selectColIndex:colNr rowIndex:found.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2855
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2856
896
aa07612a7c04 care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2857
    "Modified: / 21.5.1998 / 03:30:22 / cg"
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2858
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2859
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2860
contentsChanged
4257
0740dae4df00 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  2861
    "size of contents changed - move origin up if possible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2862
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2863
    |y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2864
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2865
    shown ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2866
        self recomputeHeightOfContents.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2867
        y := self maxViewOriginY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2868
        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
  2869
            scrollWhenUpdating ~~ false ifTrue:[
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  2870
                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
  2871
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2872
        ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2873
            self updateEditViewOrigin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2874
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2875
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2876
    super contentsChanged
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2877
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2878
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2879
cursorKey:aKey rawKey:rawKey
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2880
    |hasSelectables step start minSelRowNr maxSelRowNr selColNr selRowNr listSize|
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2881
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2882
    hasSelectables := self hasSelectables.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2883
    listSize := list size.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2884
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2885
    (hasSelectables or:[selectRowOnDefault]) ifFalse:[ ^ self ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2886
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2887
    minSelRowNr := self minIndexSelected.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2888
    maxSelRowNr := self maxIndexSelected.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2889
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  2890
    selColNr := hasSelectables ifFalse:[0] ifTrue:[self selectedColIndex].
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2891
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2892
    aKey == #CursorUp ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2893
        selRowNr := minSelRowNr > 1 ifTrue:[minSelRowNr - 1] ifFalse:[listSize].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2894
        step := -1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2895
    ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2896
        aKey == #CursorDown ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2897
            selRowNr := maxSelRowNr < listSize ifTrue:[maxSelRowNr + 1] ifFalse:[1].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2898
            step := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2899
        ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2900
            ("aKey == #BeginOfLine or:[" rawKey == #Home "]") ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2901
                selRowNr := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2902
                step := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2903
            ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2904
                (rawKey == #End) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2905
                    selRowNr := listSize.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2906
                    step := -1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2907
                ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2908
            ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2909
        ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2910
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2911
    start := selRowNr.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2912
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2913
    [ self isRowSelectable:selRowNr ] whileFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2914
        selRowNr := selRowNr + step.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2915
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2916
        selRowNr == 0 ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2917
            selRowNr := listSize.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2918
        ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2919
            selRowNr > listSize ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2920
                selRowNr := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2921
            ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2922
        ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2923
        selRowNr == start ifTrue:[^ self ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2924
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2925
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2926
    ((aKey == #CursorUp) or:[aKey == #CursorDown]) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2927
        (multipleSelectOk and:[self sensor shiftDown]) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2928
            self addRowToSelection:selRowNr.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2929
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2930
            aKey == #CursorDown ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2931
                self makeLineVisible:((selRowNr+1) min:listSize)
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2932
            ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2933
                self makeLineVisible:((selRowNr-1) max:1)
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2934
            ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2935
            ^ self
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2936
        ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2937
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2938
    self selectColIndex:selColNr rowIndex:selRowNr
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2939
!
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2940
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2941
doubleClicked
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2942
    "handle a double click"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2943
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2944
    |col sel idx|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2945
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2946
    self hasSelection ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2947
        idx := self firstIndexSelected.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2948
        col := self selectedColumn.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2949
        (col notNil and:[ (sel := col doubleClickedSelector) notNil ]) ifTrue:[
2074
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2044
diff changeset
  2950
            col doubleClickOn:idx
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2951
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2952
            doubleClickActionBlock notNil ifTrue:[
4772
11b5f36c5943 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
  2953
                doubleClickActionBlock valueWithOptionalArgument:idx
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2954
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2955
        ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2956
    ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2957
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2958
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2959
findMenuForSelection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2960
    "find the middle button menu for the current selection; returns the menu or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2961
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2962
    |col row menu|
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2963
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2964
    self numberOfSelections == 1 ifTrue:[
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2965
        row := self at:(self firstIndexSelected).
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2966
        col := self selectedColumn.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2967
        col notNil ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2968
            menu := col menuForRow:row orAdaptor:columnAdaptor.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2969
            menu notNil ifTrue:[ ^ menu ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2970
        ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2971
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2972
        col := columnDescriptors
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2973
                        detect:[:c | c rendererType == #rowSelector ]
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2974
                        ifNone:[ nil ].
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2975
        col notNil ifTrue:[
1223
176702811314 kludge: when asking for an itemMenu, pass application to
tm
parents: 1215
diff changeset
  2976
            ^ col menuForRow:row inApplication:(self application)
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2977
        ]
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2978
    ].
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2979
    ^ nil
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2980
!
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2981
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2982
keyPress:aKey x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2983
    "a key was pressed - handle page-keys here"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2984
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2985
    <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2986
                          #BeginOfText #EndOfText #ScrollUp #ScrollDown
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  2987
                          #CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)>
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2988
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2989
    |maxColNr firstSelRowNr selRowNr selColNr
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  2990
     key column isTab listSize hasSelectables rawKey|
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  2991
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2992
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2993
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2994
    (listSize := list size) == 0 ifTrue:[
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2995
        ^ super keyPress:aKey x:x y:y
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  2996
    ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2997
    aKey isCharacter ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  2998
        ^ self characterPress:aKey x:x y:y
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2999
    ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3000
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3001
    (aKey == #SelectAll) ifTrue:[
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3002
        multipleSelectOk ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3003
            self selectAllRows.
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3004
        ].
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3005
        ^ self
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3006
    ].
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3007
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3008
    aKey == #PreviousPage ifTrue:[^ self pageUp].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3009
    aKey == #NextPage     ifTrue:[^ self pageDown].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3010
    aKey == #HalfPageUp   ifTrue:[^ self halfPageUp].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3011
    aKey == #HalfPageDown ifTrue:[^ self halfPageDown].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3012
    aKey == #BeginOfText  ifTrue:[^ self scrollToTop].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3013
    aKey == #EndOfText    ifTrue:[^ self scrollToBottom].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3014
    aKey == #ScrollUp     ifTrue:[^ self scrollUp].
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3015
    aKey == #ScrollDown   ifTrue:[^ self scrollDown].
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3016
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3017
    aKey == #Return ifTrue:[
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3018
        editView notNil ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3019
            (self selectedRowIndex size == 1
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3020
            and:[self selectedRowIndex first == listSize]) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3021
                self selectRowIndex:nil.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3022
            ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3023
                self cursorKey:#CursorDown rawKey:#CursorDown.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3024
            ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3025
            ^ self
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3026
        ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3027
        self numberOfSelections == 1 ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3028
            self doubleClicked
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3029
        ].
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3030
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3031
    ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3032
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3033
    hasSelectables := self hasSelectables.
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3034
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3035
    rawKey := (WindowGroup lastEventQuerySignal query) rawKey.
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3036
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3037
    (aKey == #CursorUp
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3038
    or:[aKey == #CursorDown
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3039
    or:[rawKey == #Home
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3040
    or:[rawKey == #End]]])
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3041
    ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3042
        self cursorKey:aKey rawKey:rawKey.
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3043
        ^ self
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3044
    ].
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3045
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3046
    hasSelectables ifFalse:[
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3047
        ^ super keyPress:aKey x:x y:y
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3048
    ].
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3049
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3050
    "/ CURSOR LEFT/RIGHT or TABING
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3051
    (aKey == #CursorLeft or:[aKey == #CursorRight]) ifTrue:[
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3052
        isTab := false.
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3053
        key   := aKey.
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3054
    ] ifFalse:[
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3055
        tabIntern ifFalse:[
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3056
            ^ super keyPress:aKey x:x y:y
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3057
        ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3058
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3059
        (aKey includesString:'Tab') ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3060
            key := (aKey = #BackTab or:[self sensor shiftDown or:[aKey includesString:'Left']])
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
  3061
                        ifTrue:[#CursorLeft]
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
  3062
                        ifFalse:[#CursorRight]
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3063
        ] ifFalse:[
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3064
            (aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3065
                ^ super keyPress:aKey x:x y:y
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3066
            ].
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3067
            key := aKey == #FocusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3068
        ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3069
        isTab := true.
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3070
    ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3071
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3072
    maxColNr := self numberOfColumns.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  3073
    selColNr := self selectedColIndex.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3074
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3075
    firstSelRowNr := self firstIndexSelected.
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3076
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3077
    key == #CursorLeft ifTrue:[
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3078
        selRowNr := firstSelRowNr.
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3079
        selRowNr == 0 ifTrue:[selRowNr := listSize].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3080
        selColNr == 0 ifTrue:[selColNr := maxColNr + 1].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3081
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3082
        [true] whileTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3083
            (selColNr := selColNr - 1) == 0 ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3084
                [   selRowNr := selRowNr - 1.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3085
                    selRowNr == 0 ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3086
                        isTab ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3087
                            tabAtStartAction notNil ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3088
                                tabAtStartAction value
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3089
                            ] ifFalse:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3090
                                self deselect.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3091
                                self windowGroup focusPreviousFrom:self
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3092
                            ]
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3093
                        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3094
                        ^ self
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3095
                    ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3096
                    (self isRowSelectable:selRowNr)
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3097
                ] whileFalse.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3098
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3099
                selColNr := maxColNr
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3100
            ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3101
            column := self columnDescriptorAt:selColNr.
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3102
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3103
            (column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3104
                ^ self selectColIndex:selColNr rowIndex:selRowNr.
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3105
            ]
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3106
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3107
    ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3108
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3109
    selRowNr := firstSelRowNr.
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3110
    selRowNr == 0 ifTrue:[selRowNr := 1].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3111
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3112
    [true] whileTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3113
        (selColNr := selColNr + 1) > maxColNr ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3114
            [   selRowNr := selRowNr + 1.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3115
                selRowNr > listSize ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3116
                    isTab ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3117
                        tabAtEndAction notNil ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3118
                            tabAtEndAction value
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3119
                        ] ifFalse:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3120
                            self deselect.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3121
                            self windowGroup focusNextFrom:self
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3122
                        ]
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3123
                    ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3124
                    ^ self
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3125
                ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3126
                (self isRowSelectable:selRowNr)
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3127
            ] whileFalse.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3128
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3129
            selColNr := 1
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3130
        ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3131
        column := self columnDescriptorAt:selColNr.
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3132
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3133
        (column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3134
            ^ self selectColIndex:selColNr rowIndex:selRowNr
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3135
        ]
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3136
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3137
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3138
5670
9aea34629aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5666
diff changeset
  3139
keyboardZoom:largerBoolean
5279
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3140
    "CTRL+/- zoom action"
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3141
5670
9aea34629aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5666
diff changeset
  3142
    self fontLargerOrSmaller:largerBoolean
5279
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3143
!
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3144
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3145
mouseWheelZoom:amount
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3146
    "CTRL-wheel action"
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3147
    |oldSize newSize font|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3148
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3149
    font := gc font.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3150
    font sizeUnit == #px ifTrue:[ ^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3151
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3152
    oldSize := font size.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3153
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3154
    amount > 0 ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3155
        oldSize < 5 ifTrue:[ ^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3156
        newSize := oldSize - 1.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3157
    ] ifFalse:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3158
        oldSize > 99 ifTrue:[^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3159
        newSize := oldSize + 1.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3160
    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3161
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3162
    self font:(font asSize:newSize).
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3163
!
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3164
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3165
originChanged:delta
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3166
    "this one is sent, after the origin of my contents has changed -
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3167
     tell dependents (i.e. scrollers) about this"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3168
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3169
    super originChanged:delta.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3170
    self updateEditViewOrigin.
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3171
!
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3172
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3173
sizeChanged:how
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3174
    "size changed - move origin up if possible
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3175
     change the layout of the labelView dependent on my layout"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3176
4163
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3177
    |selectionWasVisible lastExtent|
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3178
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3179
    lastExtent := previousExtent notNil ifTrue:[previousExtent] ifFalse:[self extent].
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3180
    selectionWasVisible := self isSelectionVisibleIn:lastExtent.
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3181
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3182
    previousExtent := self extent.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3183
    super sizeChanged:how.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3184
4163
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3185
    previousExtent := self extent.
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3186
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3187
    "/ no - must compute even if not visible.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3188
    "/ (could be invisible in a notebook ...)
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3189
    realized ifTrue:[                   "used to be: shown"
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3190
"/        labelView isVisible ifTrue:[
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3191
"/            lyt := labelView layout.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3192
"/            lyt  leftOffset:(layout leftOffset).
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3193
"/            lyt rightOffset:(layout rightOffset).
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3194
"/            labelView layout:lyt.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3195
"/        ].
4163
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3196
        previousExtent x ~= lastExtent x ifTrue: [
4123
a80521cc987c changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4116
diff changeset
  3197
            self fitColumns.
a80521cc987c changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4116
diff changeset
  3198
        ].
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3199
        selectionWasVisible ifTrue:[
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3200
            self makeSelectionVisible.
4020
3bf856409692 changed: #sizeChanged:
ca
parents: 3994
diff changeset
  3201
        ].
3bf856409692 changed: #sizeChanged:
ca
parents: 3994
diff changeset
  3202
        self updateEditViewOrigin.
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3203
    ].
4059
b8d390e67d16 changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
  3204
4123
a80521cc987c changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4116
diff changeset
  3205
    "Modified: / 04-05-2012 / 14:34:24 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3206
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3207
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3208
!DSVColumnView methodsFor:'focus handling'!
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3209
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3210
canTab
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3211
    super canTab ifTrue:[
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3212
        ^ editView isNil
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3213
    ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3214
    ^ false
2101
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3215
!
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3216
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3217
showFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3218
    self invalidateSelection.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3219
    super showFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3220
!
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3221
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3222
showNoFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3223
    self invalidateSelection.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3224
    super showNoFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3225
!
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3226
2101
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3227
wantsFocusWithPointerEnter
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3228
    "views which like to take the keyboard focus
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3229
     when the pointer enters can do so by redefining this
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3230
     to return true"
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3231
3924
72044fd3296a changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
  3232
    editView notNil ifTrue:[^ false].
2237
1da5501b1248 bug fix in focus handling
ca
parents: 2226
diff changeset
  3233
2958
99f7bfe9e9a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2956
diff changeset
  3234
    (UserPreferences current focusFollowsMouse ~~ false
2101
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3235
    and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true)
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3236
    ]) ifTrue:[
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3237
        list size > 0 ifTrue:[
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3238
            ^ true
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3239
        ]
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3240
    ].
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3241
    ^ false
3924
72044fd3296a changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
  3242
72044fd3296a changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
  3243
    "Modified: / 08-08-2010 / 14:41:00 / cg"
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3244
! !
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3245
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3246
!DSVColumnView methodsFor:'gc operations'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3247
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3248
imageOnMyDevice:anImage
4606
1cc343187f71 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4589
diff changeset
  3249
    "associate image to device and returns the new image."
1cc343187f71 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4589
diff changeset
  3250
1cc343187f71 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4589
diff changeset
  3251
    anImage isNil ifTrue:[^ nil].
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  3252
    ^ anImage onDevice:device.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3253
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3254
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3255
registerImage:anImage key:aKey
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3256
    "any row can register an image with a unique identifier a key symbol"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3257
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3258
    |img|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3259
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3260
    (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3261
        ^ img
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3262
    ].
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3263
    img := self imageOnMyDevice:anImage.
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  3264
    registererImages at:aKey put:img.
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  3265
    ^ img
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3266
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3267
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3268
registeredImageAt:aKey
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3269
    "any row can register an image with a unique identifier"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3270
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3271
    ^ registererImages at:aKey ifAbsent:nil
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3272
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3273
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3274
releaseAllRegisteredImages
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3275
    "release all registered images"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3276
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3277
    registererImages := IdentityDictionary new.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3278
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3279
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3280
!DSVColumnView methodsFor:'help'!
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3281
5680
48cf8714352b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5670
diff changeset
  3282
helpTextAt:aPoint
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3283
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item)."
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3284
3248
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3285
    |rowNr colNr col|
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3286
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3287
    columnDescriptors isEmpty ifTrue:[^ nil].
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3288
3248
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3289
    rowNr := self yVisibleToRowNr:aPoint y.
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3290
    rowNr isNil ifTrue:[^ nil ].
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3291
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3292
    colNr := self xVisibleToColNr:aPoint x.
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  3293
    colNr notNil ifTrue:[
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3294
        col := columnDescriptors at:colNr.
3458
5f9a85c6279a Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents: 3449
diff changeset
  3295
        ^ col activeHelpTextForRow:rowNr.
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3296
    ].
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3297
    ^ nil
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3298
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3299
    "Created: / 26-03-2007 / 14:42:54 / cg"
3248
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3300
    "Modified: / 16-10-2007 / 17:52:24 / cg"
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3301
! !
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3302
2500
1477b0a5a918 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3303
!DSVColumnView methodsFor:'initialization & release'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3304
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3305
create
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3306
    |graphicsDevice|
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3307
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3308
    super create.
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  3309
    graphicsDevice := device.
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3310
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3311
    fgColor     := fgColor     onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3312
    bgColor     := bgColor     onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3313
    selectionForegroundColor := selectionForegroundColor onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3314
    selectionBackgroundColor := selectionBackgroundColor onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3315
    selectionFrameColor notNil ifTrue:[selectionFrameColor := selectionFrameColor onDevice:graphicsDevice].
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3316
    selectionForegroundColorNoFocus := selectionForegroundColorNoFocus onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3317
    selectionBackgroundColorNoFocus := selectionBackgroundColorNoFocus onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3318
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3319
    buttonShadowColor := buttonShadowColor onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3320
    buttonLightColor  := buttonLightColor onDevice:graphicsDevice.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3321
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3322
    buttonHalfShadowColor notNil ifTrue:[
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3323
        buttonHalfShadowColor := buttonHalfShadowColor onDevice:graphicsDevice
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3324
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3325
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3326
    buttonHalfLightColor notNil ifTrue:[
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3327
        buttonHalfLightColor := buttonHalfLightColor onDevice:graphicsDevice
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3328
    ].
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3329
    rowSelectorForm         := self imageOnMyDevice:rowSelectorForm.
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3330
    checkToggleActiveImage  := self imageOnMyDevice:checkToggleActiveImage.
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3331
    checkTogglePassiveImage := self imageOnMyDevice:checkTogglePassiveImage.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3332
    checkToggleForm         := self imageOnMyDevice:checkToggleForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3333
    radioButtonActiveImage  := self imageOnMyDevice:radioButtonActiveImage.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3334
    radioButtonPassiveImage := self imageOnMyDevice:radioButtonPassiveImage.
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3335
    comboButtonForm         := self imageOnMyDevice:comboButtonForm.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3336
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3337
    "Modified: / 20-01-2011 / 08:43:51 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3338
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3339
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3340
initStyle
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3341
    "setup colors, etc."
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3342
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3343
    |button widget|
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3344
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3345
    super initStyle.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3346
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3347
    DefaultForegroundColor isNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3348
        self class updateStyleCache
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3349
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3350
    fgColor     := DefaultForegroundColor.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3351
    bgColor     := DefaultBackgroundColor.
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
  3352
    labelFgColor := DefaultLabelForegroundColor.
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
  3353
    labelBgColor := DefaultLabelBackgroundColor.
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  3354
    selectionForegroundColor := DefaultHilightForegroundColor.
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  3355
    selectionBackgroundColor := DefaultHilightBackgroundColor.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3356
    selectionFrameColor      := DefaultHilightFrameColor.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3357
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3358
    shadowColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3359
        shadowColor := Color grayPercent:40.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3360
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3361
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3362
    lightColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3363
        lightColor := Color grayPercent:75
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3364
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3365
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3366
    buttonLightColor    := ButtonLightColor  ? lightColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3367
    buttonShadowColor   := ButtonShadowColor ? shadowColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3368
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3369
    (ButtonEdgeStyle == #soft) ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3370
        buttonHalfShadowColor := ButtonHalfShadowColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3371
        buttonHalfLightColor  := ButtonHalfLightColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3372
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3373
        buttonHalfShadowColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3374
            buttonHalfShadowColor := buttonShadowColor lightened
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3375
        ]
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3376
    ].
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3377
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3378
    buttonHalfShadowColor isNil ifTrue:[
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3379
        buttonHalfShadowColor := Color gray
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3380
    ].
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3381
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3382
    selectionForegroundColorNoFocus isNil ifTrue:[
4653
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3383
        selectionForegroundColorNoFocus := DefaultHilightForegroundColorNoFocus.
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3384
        selectionForegroundColorNoFocus isNil ifTrue:[
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3385
            selectionForegroundColorNoFocus := selectionForegroundColor slightlyLightened.
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3386
        ]
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3387
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3388
    selectionBackgroundColorNoFocus isNil ifTrue:[
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3389
        selectionBackgroundColorNoFocus := DefaultHilightBackgroundColorNoFocus.
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3390
        selectionBackgroundColorNoFocus isNil ifTrue:[
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3391
            selectionBackgroundColor notNil ifTrue:[
4653
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3392
                selectionBackgroundColorNoFocus := selectionBackgroundColor slightlyLightened.
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3393
                "/ selectionBackgroundColorNoFocus := Color brightness:(selectionBackgroundColor "lightened" brightness).   "/ asGray.
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3394
            ].
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3395
        ].
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3396
    ].
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3397
    selectionFrameColorNoFocus isNil ifTrue:[
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3398
        selectionFrameColor notNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3399
            selectionFrameColorNoFocus := selectionFrameColor lightened.
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3400
            "/ selectionFrameColorNoFocus := Color brightness:(selectionFrameColor "lightened" brightness).   "/ asGray
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3401
        ]
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3402
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3403
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  3404
    rowSelectorForm         := self class rowSelectorImage.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3405
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3406
    checkToggleActiveImage  := CheckToggleActiveImage.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3407
    checkTogglePassiveImage := CheckTogglePassiveImage.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3408
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3409
    CheckToggleForm isNil ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3410
        widget            := CheckToggle new.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3411
        CheckToggleForm   := widget label.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3412
        CheckToggleLevel  := widget offLevel.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3413
        CheckToggleExtent := widget preferredExtent.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3414
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3415
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3416
    checkToggleForm   := CheckToggleForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3417
    checkToggleLevel  := CheckToggleLevel.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3418
    checkToggleExtent := CheckToggleExtent.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3419
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3420
    radioButtonActiveImage  := RadioButtonActiveImage.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3421
    radioButtonPassiveImage := RadioButtonPassiveImage.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3422
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3423
    ComboButtonForm isNil ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3424
        widget            := ComboListView new.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3425
        button            := widget menuButton.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3426
        ComboButtonForm   := button label.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3427
        ComboButtonLevel  := button offLevel.
3428
436f115aefe8 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  3428
        ComboButtonExtent := (button preferredWidth) @ (widget preferredHeight).
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3429
    ].
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3430
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3431
    comboButtonForm   := ComboButtonForm.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3432
    comboButtonLevel  := ComboButtonLevel.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3433
    comboButtonExtent := ComboButtonExtent.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3434
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3435
    "Modified: / 20-01-2012 / 15:48:13 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3436
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3437
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3438
initialize
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3439
    "set default attributes"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3440
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3441
    |fontOnDevice|
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3442
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3443
    verticalSpacing    := verticalSpacing ? self class verticalSpacing.
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3444
    horizontalSpacing  := horizontalSpacing ? self class horizontalSpacing.
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3445
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3446
    super initialize.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3447
    self lineWidth:0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3448
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3449
    separatorSize      := 1.                            "/ separators mode 2D
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3450
    verticalSpacing    := self class verticalSpacing.
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3451
    horizontalSpacing  := self class horizontalSpacing.
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3452
    tabIntern          := true.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3453
    useIndex           := true.
5664
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  3454
    ignoreReselect     := true.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3455
    viewOrigin         := 0@0.
5204
fccb63f32188 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5195
diff changeset
  3456
    fontOnDevice       := gc deviceFont.
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3457
    rowFontAscent      := fontOnDevice ascent.
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3458
    rowHeight          := verticalSpacing + (fontOnDevice height) + verticalSpacing + separatorSize.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  3459
    minRowHeight       := rowHeight.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3460
    multipleSelectOk   := false.                        "/ multiselect disabled
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  3461
    selectedRowIndex   := 0.                            "/ no selection
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3462
    self selectedColIndex:0.
1778
51bbd960baf9 change registeredIcons from IdentityDictionary to Dictionary
ca
parents: 1776
diff changeset
  3463
    registererImages   := Dictionary new.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3464
    columnDescriptors  := #().
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3465
    beDependentOfRows  := false.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3466
    colorMap           := Dictionary new.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3467
    catchChangeEvents  := false.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3468
    selectRowOnDefault := true.
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3469
    autoScroll         := true.
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  3470
    autoScrollToColumn := true.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3471
    scrollRowWise      := false.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3472
    sortListInPlace    := false.    "/ when false (default for backward compatibility):
4613
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3473
                                    "/ if sorting, create a copy
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3474
                                    "/ of the list, which is wrong when useIndex is on,
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3475
                                    "/ as the application will get the index in the sorted
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3476
                                    "/ list, which is probably different from tha apps list mode.
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3477
                                    "/ When true (should be default, but that might break many
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3478
                                    "/ users), the passed in list is sorted in place (i.e. possibly
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3479
                                    "/ sorting the application's list).
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3480
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3481
    updateListHolderWhenSorting := false.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3482
                                    "/ when false (default for backward compatibility):
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3483
                                    "/ if sorting, do not write back the sorted list into the listHolder
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3484
                                    "/ When true (should be default, but that might break many
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3485
                                    "/ users), the sorted list is written back into the listHolder,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3486
                                    "/ but only if sortListInPlace is false.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3487
3223
b9d1b2cec92d Bug 623: active help during button motion
ca
parents: 3219
diff changeset
  3488
    "/ need for active help
b9d1b2cec92d Bug 623: active help during button motion
ca
parents: 3219
diff changeset
  3489
    self enableMotionEvents.
b9d1b2cec92d Bug 623: active help during button motion
ca
parents: 3219
diff changeset
  3490
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3491
    "Modified: / 13-09-2017 / 16:08:34 / cg"
705
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  3492
!
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  3493
2807
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3494
mapped
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3495
    "set selection (if any) after mapping"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3496
2807
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3497
    |idx|
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3498
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3499
    super mapped.
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3500
    needFitColumns == true ifTrue:[
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3501
        self fitColumns
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3502
    ].
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3503
    (idx := self firstIndexSelected) ~~ 0 ifTrue:[
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3504
        self scrollToRowAt:idx colAt:0.
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3505
    ].
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3506
!
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3507
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3508
realize
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3509
    "recompute contents and fit columns to view"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3510
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3511
    |selection|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3512
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3513
    self bitGravity:#NorthWest.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3514
    self recomputeHeightOfContents.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3515
    selection := 0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3516
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3517
        (model respondsTo:#selectionIndex) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3518
            selection := model selectionIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3519
        ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3520
            model == listHolder ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3521
                selection := model value
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3522
            ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3523
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3524
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3525
    self selectRowIndex:selection.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3526
    super realize.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3527
    self fitColumns.
2011
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  3528
!
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  3529
2157
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3530
release
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3531
    "remove dependencies"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3532
2157
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3533
    self columnHolder:nil.
4219
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3534
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3535
    beDependentOfRows ifTrue:[self makeIndependentOfRows].
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3536
    listHolder notNil ifTrue:[
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3537
        listHolder removeDependent:self.
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3538
    ].
2157
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3539
    columnAdaptor isValueModel ifTrue:[
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3540
        columnAdaptor removeDependent:self
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3541
    ].
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3542
    super release
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3543
! !
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3544
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3545
!DSVColumnView methodsFor:'obsolete'!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3546
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3547
has3Dsepartors
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3548
    <resource: #obsolete>
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3549
    "shouldn't be used any more"
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3550
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3551
    self obsoleteMethodWarning.
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3552
    ^ self has3Dseparators
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3553
!
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3554
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3555
has3Dsepartors:aBool
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3556
    <resource: #obsolete>
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3557
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3558
    "shouldn't be used any more"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3559
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3560
    self obsoleteMethodWarning.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3561
    self has3Dseparators:aBool
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3562
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3563
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3564
!DSVColumnView methodsFor:'private'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3565
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3566
anyColumnHasBackground
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3567
    columnDescriptors isNil ifTrue:[^ false].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3568
    columnDescriptors do:[:eachCol |
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3569
        |bg|
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3570
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3571
        bg := eachCol backgroundColor.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3572
        (bg notNil and:[bg isImageOrForm]) ifTrue:[^ true].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3573
        eachCol bgSelector notNil ifTrue:[^ true].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3574
    ].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3575
    ^ false.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3576
!
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3577
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3578
anyColumnHasPotentialNonConstantBackground
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3579
    columnDescriptors isNil ifTrue:[^ false].
2933
ab7be1db710d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  3580
    ^ columnDescriptors contains:[:someCol | someCol hasPotentialNonConstantBackground].
ab7be1db710d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  3581
"/    columnDescriptors do:[:eachCol | eachCol hasPotentialNonConstantBackground ifTrue:[^ true]].
ab7be1db710d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  3582
"/    ^ false.
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3583
!
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3584
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3585
destroyEditView
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3586
    "destroy the edit view; release KeyboardForwarder"
2730
77bab35466a3 *** empty log message ***
ca
parents: 2728
diff changeset
  3587
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3588
    editValue notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3589
        editValue removeDependent:self.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3590
        editValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3591
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3592
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3593
    editView notNil ifTrue:[ |winGroup focusView|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3594
        self hasFocus ifTrue:[focusView := self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3595
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3596
        editView withAllSubViewsDo:[:aView |
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3597
            aView hasFocus ifTrue:[focusView := self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3598
            aView delegate:nil
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3599
        ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3600
        editView destroy.
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3601
        editView := nil.
2730
77bab35466a3 *** empty log message ***
ca
parents: 2728
diff changeset
  3602
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3603
        winGroup := self windowGroup.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3604
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3605
        winGroup notNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3606
            winGroup focusView:focusView.
2730
77bab35466a3 *** empty log message ***
ca
parents: 2728
diff changeset
  3607
        ]
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3608
    ].
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3609
!
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3610
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3611
detectViewAt:aPoint in:aView
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3612
    "returns the view at a point"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3613
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3614
    aView isNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3615
        ^ nil
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3616
    ].
2019
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  3617
    ^ aView detectViewAt:aPoint.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3618
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3619
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3620
fitColumns
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3621
    "fit columns to view; "
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3622
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3623
    |selectedColumn columnsWithRelativeWidth
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3624
     overallMinWidth restWidth anyChange oldOrgX newOrgX oldWidth|
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3625
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3626
    realized ifFalse:[
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3627
        needFitColumns := true.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3628
        ^ self
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3629
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3630
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3631
    cachedPreferredExtent isNil ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3632
        self preferredExtent.
2956
c4319600989e *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 2933
diff changeset
  3633
    ] ifFalse:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3634
        oldWidth := cachedPreferredExtent x.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3635
    ].
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3636
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3637
    columnDescriptors isEmpty ifTrue:[
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3638
        ^ self
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3639
    ].
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3640
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3641
    overallMinWidth := 0.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3642
    anyChange := false.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3643
    columnsWithRelativeWidth := OrderedCollection new.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3644
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3645
    columnDescriptors do:[:aCol|
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3646
        aCol canResize ifTrue:[
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3647
            anyChange := true.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3648
            aCol invalidate.
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3649
        ].
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3650
        aCol hasRelativeWidth ifTrue:[columnsWithRelativeWidth add:aCol].
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3651
        overallMinWidth := overallMinWidth + aCol minWidth.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3652
    ].
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3653
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3654
    cachedPreferredExtent := width @(self preferredHeight).
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3655
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3656
    columnsWithRelativeWidth notEmpty ifTrue:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3657
        restWidth := self innerWidth - overallMinWidth.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3658
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3659
        restWidth > 0 ifTrue:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3660
            |sumOfAnnouncedRelativeWidths sumWeach|
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3661
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3662
            "/ distribute restwidth among remaining columns according to
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3663
            "/ their announced relative width's
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3664
            sumOfAnnouncedRelativeWidths := columnsWithRelativeWidth sum:[:each | each description width].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3665
            sumWeach := 0.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3666
            columnsWithRelativeWidth do:[:each |
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3667
                |eachRel wEach|
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3668
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3669
                eachRel := each description width / sumOfAnnouncedRelativeWidths.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3670
                each == columnsWithRelativeWidth last ifTrue:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3671
                    wEach := restWidth - sumWeach.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3672
                ] ifFalse:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3673
                    wEach := (eachRel * restWidth) truncated.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3674
                    sumWeach := sumWeach + wEach.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3675
                ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3676
                each setWidth:wEach.
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3677
            ].
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3678
        ]
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3679
    ] ifFalse:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3680
        anyChange ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3681
            | resizableColumns numberOfResizable additionalOffsetX |
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3682
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3683
            overallMinWidth  := 0.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3684
            resizableColumns := OrderedCollection new.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3685
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3686
            columnDescriptors do:[: eachColumn |
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3687
                eachColumn canResize ifTrue:[ resizableColumns add: eachColumn ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3688
                eachColumn width: nil. "force a recomputation of width"
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3689
                overallMinWidth := overallMinWidth + eachColumn width.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3690
            ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3691
            numberOfResizable := resizableColumns size.
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3692
            numberOfResizable > 0 ifTrue:[
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3693
                restWidth := self innerWidth - overallMinWidth.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3694
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3695
                restWidth > numberOfResizable ifTrue:[
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3696
                    additionalOffsetX := restWidth // numberOfResizable.
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3697
                    resizableColumns do:[:aCol| aCol growWidth:additionalOffsetX ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3698
                    restWidth := restWidth - (additionalOffsetX * numberOfResizable).
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3699
                ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3700
                restWidth > 0 ifTrue:[ resizableColumns last growWidth:restWidth ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3701
            ].
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3702
        ].
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3703
    ].
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  3704
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3705
    shown ifTrue:[
4116
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3706
        "have to invalidate unconditionally even if nothing has been changed here:
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3707
         #fitColumns is called from #changeWidthOfColumn:deltaX:
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3708
         after a manual resize"
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3709
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3710
        self      invalidate.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3711
        labelView invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3712
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3713
        (oldOrgX := viewOrigin x) ~~ 0 ifTrue:[
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3714
            |prefWidth|
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3715
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3716
            "/ UPDATE VIEW-ORIGIN X
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3717
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3718
            prefWidth   := self preferredWidth.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3719
            newOrgX := (prefWidth - self innerWidth) max:0.
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3720
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3721
            newOrgX < oldOrgX ifTrue:[
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3722
                self originWillChange.
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3723
                viewOrigin := newOrgX @ (viewOrigin y).
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3724
                self originChanged:((newOrgX - oldOrgX) @ 0).
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3725
            ]
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3726
        ].
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3727
1930
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3728
        "/ cg: do not scroll to selection when a column-size is changed
2319
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3729
1930
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3730
"/        self hasSelection ifTrue:[
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3731
"/            editView notNil ifTrue:[
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3732
"/                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
  3733
"/            ].
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3734
"/            self scrollToSelection.
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3735
"/        ].
2319
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3736
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3737
        "/ ca: but resize the editView (if there is any currently visible)
2319
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3738
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3739
        editView notNil ifTrue:[
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3740
            selectedColumn := self selectedColumn.
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3741
            selectedColumn notNil ifTrue:[
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3742
                editView width:(selectedColumn width - (2 * separatorSize)).
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3743
            ]
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3744
        ].
3428
436f115aefe8 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  3745
        oldWidth ~= self preferredWidth ifTrue:[
2956
c4319600989e *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 2933
diff changeset
  3746
            self contentsChanged.
c4319600989e *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 2933
diff changeset
  3747
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3748
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3749
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3750
    "Modified (format): / 15-03-2018 / 11:40:25 / mawalch"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3751
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3752
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3753
hasSelectables
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3754
    columnDescriptors do:[:aCol|
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3755
        (aCol rendererType == #rowSelector) ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3756
            (aCol description canSelect) ifTrue:[^ true].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3757
        ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3758
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3759
    ^ false.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3760
!
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3761
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3762
maxViewOriginY
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3763
    "returns the maximum possible y of the view origin"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3764
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3765
    |y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3766
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3767
    y := self heightOfContents - self innerHeight.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3768
    ^ y max:0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3769
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3770
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3771
updateEditViewOrigin
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3772
    "update origin of the editView"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3773
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3774
    |x y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3775
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3776
    editView notNil ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3777
        y := self yVisibleOfRowNr:(self firstIndexSelected).
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  3778
        x := self xVisibleOfColNr:self selectedColIndex.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3779
        editView origin:(x @ y + separatorSize).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3780
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3781
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3782
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3783
xVisibleOfColNr:aColNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3784
    "returns visible x assigned to a column number"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3785
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3786
    |x
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3787
     end "{ Class:SmallInteger }"|
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3788
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3789
    x := margin - viewOrigin x.
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3790
    aColNr > 1 ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3791
        end := aColNr - 1.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3792
        columnDescriptors
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3793
            from:1
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3794
            to:end
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3795
            do:[:aCol | x := x + aCol width ]
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3796
    ].
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3797
    ^ x
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3798
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3799
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3800
xVisibleToColNr:x
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  3801
    "returns the column number for a physical x position.
5079
1ef6c9d3cdf3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5057
diff changeset
  3802
     Returns nil if x is beyond the last column."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3803
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3804
    |x0|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3805
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3806
    x0 := x + viewOrigin x - margin.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3807
    columnDescriptors keysAndValuesDo:[:index :aCol |
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3808
        x0 := x0 - aCol width.
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3809
        x0 <= 0 ifTrue:[ ^ index ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3810
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3811
    ^ nil.
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3812
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  3813
    "Modified: / 26-03-2007 / 15:22:01 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3814
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3815
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3816
yVisibleOfRowNr:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3817
    "returns visible y assigned to the row number"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3818
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3819
    ^ (aRowNr - 1) * rowHeight + margin - viewOrigin y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3820
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3821
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3822
yVisibleToRowNr:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3823
    "returns the row number assigned to a physical y or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3824
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3825
    |rowNr|
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3826
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3827
    rowNr := (y + viewOrigin y - margin) // rowHeight + 1.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3828
    (rowNr between:1 and:(list size)) ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3829
        ^ rowNr
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3830
    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3831
    ^ nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3832
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3833
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3834
!DSVColumnView methodsFor:'queries'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3835
2728
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3836
firstLineShown
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3837
    "for protocol-compat. with listviews"
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3838
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3839
    ^ self indexOfFirstRowShown
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3840
!
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3841
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3842
hasOpenEditor
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3843
    ^ editView notNil
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3844
!
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3845
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3846
indexOfFirstRowShown
2797
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3847
    "returns the index of the first shown row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3848
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3849
    |idx|
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3850
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3851
    idx := (viewOrigin y // rowHeight) + 1.
2797
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3852
    ^ (idx max:1)
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3853
!
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3854
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3855
indexOfLastRowShown
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3856
    "returns the index of the last shown row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3857
2797
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3858
    |idx|
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3859
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3860
    idx := (viewOrigin y + height - 1 // rowHeight) + 1.
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3861
    ^ (idx min:list size)
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3862
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3863
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3864
isEnabled
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3865
    ^ enableChannel value ~~ false
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3866
!
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3867
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3868
isRowSelectable:aRowNumber
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3869
    "returne true if a row number is selectable"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3870
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3871
    (aRowNumber notNil and:[ aRowNumber ~~ 0 ]) ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3872
        selectConditionBlock isNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3873
            ^ true
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3874
        ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3875
        ^ (selectConditionBlock value:aRowNumber)
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3876
    ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3877
    ^ false
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3878
!
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3879
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3880
numberOfColumns
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3881
    "returns number of columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3882
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3883
    ^ columnDescriptors size
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3884
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3885
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3886
numberOfRows
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3887
    "returns number of rows"
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3888
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3889
    ^ list size
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3890
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3891
    "Modified (comment): / 15-03-2018 / 12:23:01 / mawalch"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3892
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3893
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3894
rowHeight
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3895
    "get the height of the highest row in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3896
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3897
    ^ rowHeight
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3898
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3899
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3900
separatorSize
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3901
    "returns vertical/horizontal size of a separator dependent on the
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3902
     3D effect."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3903
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3904
    ^ separatorSize
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3905
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3906
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3907
size
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3908
    "returns number of rows"
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3909
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3910
    ^ list size
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3911
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3912
    "Modified (comment): / 15-03-2018 / 12:24:18 / mawalch"
4486
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3913
!
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3914
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3915
yVisibleToLineNr:yVisible
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3916
    ^ self yVisibleToRowNr:yVisible.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3917
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3918
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3919
!DSVColumnView methodsFor:'recomputation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3920
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3921
computeRowHeight
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3922
    |minHeight|
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3923
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3924
    minHeight := self font height.
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3925
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3926
    columnDescriptors do:[:aCol |
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3927
        minHeight := (aCol heightOfHighestRow) max:minHeight.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3928
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3929
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3930
    "/ to fix a double bug which compensated for not computing things correctly
5730
dcaa2eb5a14b #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5723
diff changeset
  3931
    "/ (verticalSpacing was always computed as 2 into the height, even if changed later,
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3932
    "/  it was stil in the max-of-col-heights, because minHeight was never reset, but always
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3933
    "/  carried on in the minRowHeight)
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3934
    minHeight := 2 + minHeight + 2.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3935
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3936
    rowHeight := (verticalSpacing + minHeight + verticalSpacing + separatorSize).
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3937
    minRowHeight := rowHeight.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3938
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3939
    "Created: / 13-09-2017 / 15:32:28 / cg"
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3940
!
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3941
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3942
hasPreferredExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3943
    "returns true if preferred extent is accumulated"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3944
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3945
    ^ cachedPreferredExtent notNil
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3946
!
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  3947
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3948
preferredExtent
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3949
    "return my preferred extent"
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3950
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3951
    |numRows prefWidth prefHeight|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3952
3566
44235ce5af57 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3536
diff changeset
  3953
    "/ If I have an explicit preferredExtent..
44235ce5af57 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3536
diff changeset
  3954
    explicitExtent notNil ifTrue:[
44235ce5af57 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3536
diff changeset
  3955
        ^ explicitExtent
44235ce5af57 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3536
diff changeset
  3956
    ].
44235ce5af57 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3536
diff changeset
  3957
44235ce5af57 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3536
diff changeset
  3958
    "/ If I have a cached preferredExtent value..
5310
8b7aff55b666 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
  3959
    "/ cg: you don't need two cached variables - do you ?
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3960
    preferredExtent notNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3961
        ^ preferredExtent
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3962
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3963
    cachedPreferredExtent notNil ifTrue:[
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3964
        ^ cachedPreferredExtent
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3965
    ].
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3966
    self computeRowHeight.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3967
4961
3aa86bd7a0ce #BUGFIX
matilk
parents: 4875
diff changeset
  3968
    prefWidth := (columnDescriptors size - 1) max:0.  "/ for the separators
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3969
    columnDescriptors do:[:aCol |
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3970
        prefWidth := prefWidth + (aCol minWidth max:5).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3971
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3972
    numRows := list size.
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3973
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3974
    "/ no need for a separator after the last row.
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3975
    prefHeight := separatorSize + ((numRows * rowHeight) "- separatorSize") "+ separatorSize".
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3976
3494
da2c27c005e0 oops - preferredExtent
Claus Gittinger <cg@exept.de>
parents: 3488
diff changeset
  3977
    cachedPreferredExtent := prefWidth @ prefHeight.
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3978
    ^ cachedPreferredExtent
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3979
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3980
    "Modified: / 13-09-2017 / 15:53:27 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3981
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3982
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3983
preferredExtentChanged
3519
9102be1f145c fix typo in comment
Stefan Vogel <sv@exept.de>
parents: 3518
diff changeset
  3984
    "called if the preferred extent changed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3985
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3986
    |x "{ Class:SmallInteger }"
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3987
     y "{ Class:SmallInteger }"|
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3988
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3989
    y := viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3990
    x := viewOrigin x.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3991
    (y ~~ 0 or:[ x ~~ 0 ]) ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3992
        self originWillChange.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3993
        viewOrigin := 0 @ 0.
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3994
        cachedPreferredExtent := nil.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3995
        self originChanged:(x negated @ y negated).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3996
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3997
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3998
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3999
recomputeHeightOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4000
    "recompute height of contents( scrolling )"
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4001
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4002
    cachedPreferredExtent := nil.
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4003
"/    cachedPreferredExtent notNil ifTrue:[
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4004
"/        cachedPreferredExtent y:(rowHeight * list size)
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4005
"/    ] ifFalse:[
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4006
"/        self preferredExtent
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4007
"/    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4008
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4009
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4010
!DSVColumnView methodsFor:'scroller interface'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4011
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4012
innerHeight
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4013
    "returns the inner height of the contents shown"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4014
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4015
    ^ height - margin - margin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4016
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4017
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4018
verticalScrollStep
3500
d2adfa92fa6d comment
Claus Gittinger <cg@exept.de>
parents: 3494
diff changeset
  4019
    "return the amount to scroll when stepping up/down (also used for mouseWheel)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4020
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4021
    ^ rowHeight
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4022
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4023
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4024
viewOrigin
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4025
    "return the viewOrigin;
5252
06aa7602b274 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5214
diff changeset
  4026
     that's the coordinate of the contents which is shown topLeft in the view."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4027
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4028
    ^ viewOrigin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4029
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4030
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4031
widthOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4032
    "return the width of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4033
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4034
    cachedPreferredExtent isNil ifTrue:[
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4035
        self preferredExtent
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4036
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4037
    ^ cachedPreferredExtent x
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4038
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4039
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4040
xOriginOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4041
    "return the horizontal origin of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4042
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4043
    ^ viewOrigin x
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4044
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4045
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4046
yOriginOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4047
    "return the vertical origin of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4048
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4049
    ^ viewOrigin y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4050
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4051
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4052
!DSVColumnView methodsFor:'scrolling'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4053
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4054
scrollTo:anOrigin redraw:doRedraw
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4055
    "change origin to have newOrigin be visible at the top-left."
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4056
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4057
    |newOrg dltOrg wg
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4058
     h       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4059
     w       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4060
     x       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4061
     x0      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4062
     x1      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4063
     y       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4064
     y0      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4065
     y1      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4066
     dX      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4067
     dY      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4068
     innerHG "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4069
     innerWT "{ Class:SmallInteger }"
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4070
     lMargin
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4071
    |
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4072
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4073
    shown ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4074
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4075
    ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4076
1448
b389b8c76479 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  4077
    (wg := self windowGroup) notNil ifTrue:[
b389b8c76479 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  4078
        wg processRealExposeEventsFor:self.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4079
    ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4080
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4081
    innerWT := self innerWidth.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4082
    innerHG := self innerHeight.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4083
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4084
    h := viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4085
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4086
    (y := anOrigin y) > h ifTrue:[              "/ end of contents
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4087
        y > (dY := self maxViewOriginY) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4088
            y := dY max:h
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4089
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4090
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4091
        y := y max:0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4092
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4093
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4094
    (x := anOrigin x) > 0 ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4095
        x := x min:(self widthOfContents - innerWT).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4096
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4097
    x      := x max:0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4098
    newOrg := (x @ y).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4099
    dltOrg := newOrg - viewOrigin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4100
    dX     := dltOrg x.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4101
    dY     := dltOrg y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4102
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4103
    (dX == 0 and:[dY == 0]) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4104
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4105
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4106
    self originWillChange.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4107
    viewOrigin := newOrg.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4108
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4109
    doRedraw ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4110
        ^ self originChanged:dltOrg
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4111
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4112
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4113
    dY ~~ 0 ifTrue:[                            "/ SCROLL VERTICAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4114
        dY := dY abs.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4115
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4116
        (dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  4117
            self invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4118
        ] ifFalse:[                             "/ COPY VERTICAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4119
            y0 := y1 := margin + dY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4120
            h  := innerHG - dY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4121
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4122
            dltOrg y < 0 ifTrue:[y0 := margin. y := y0]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4123
                        ifFalse:[y1 := margin. y := y1 + h].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4124
1460
2fe0ac4bc4d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1448
diff changeset
  4125
            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
  4126
            self invalidateX:margin y:y width:innerWT height:(innerHG - h).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4127
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4128
    ] ifFalse:[                                 "/ SCROLL HORIZONTAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4129
        dX := dX abs.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4130
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4131
        innerWT - dX < 20 ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4132
            labelView invalidate.
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  4133
            self invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4134
        ] ifFalse:[                             "/ COPY HORIZONTAL
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  4135
            x0 := x1 := dX + margin.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4136
            w  := width - dX.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4137
            lMargin := labelView margin.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4138
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4139
            dltOrg x < 0 ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4140
                " ->"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4141
                x0 := x := margin.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4142
                self copyFrom:self x:margin y:margin toX:margin+dX y:margin width:innerWT-dX height:innerHG async:false.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4143
                self invalidateX:margin y:margin width:dX height:innerHG.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4144
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4145
                labelView notNil ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4146
                    labelView copyFrom:labelView x:lMargin y:lMargin toX:lMargin+dX y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4147
                    labelView invalidateX:lMargin y:lMargin width:dX height:labelView innerHeight.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4148
                ].
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4149
            ] ifFalse:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4150
                x1 := margin. x := w.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4151
                self copyFrom:self x:margin+dX y:margin toX:margin y:margin width:innerWT-dX height:innerHG async:false.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4152
                self invalidateX:width-margin-dX y:margin width:dX height:innerHG.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4153
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4154
                labelView notNil ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4155
                    labelView copyFrom:labelView x:lMargin+dX y:lMargin toX:lMargin y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4156
                    labelView invalidateX:labelView width-lMargin-dX y:lMargin width:dX height:labelView innerHeight.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4157
                ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4158
            ].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4159
            labelView repairDamage.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4160
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4161
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4162
    self originChanged:dltOrg.
1123
ea32a2e3d44d care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
  4163
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4164
    wg notNil ifTrue:[
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4165
        wg processRealExposeEventsFor:self.
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4166
    ].
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4167
1123
ea32a2e3d44d care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
  4168
    "Modified: / 7.9.1998 / 16:39:49 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4169
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4170
2728
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4171
scrollToLine:aLineNr
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4172
    "for compat. with listViews"
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4173
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4174
    self scrollToRowAt:aLineNr colAt:1.
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4175
!
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4176
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4177
scrollToRowAt:aRowNr colAt:aColNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4178
    "make row at a row number in column at a column number visible"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4179
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4180
    |x  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4181
     y  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4182
     l  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4183
     dY "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4184
     dX "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4185
    |
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4186
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4187
    (    (aRowNr between:1 and:(list size))
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4188
     and:[aColNr between:0 and:(columnDescriptors size)]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4189
    ) ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4190
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4191
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4192
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4193
    dY := dX := 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4194
    y  := self yVisibleOfRowNr:aRowNr.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4195
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4196
    y < margin ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4197
        dY := margin - y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4198
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4199
        y := y + rowHeight.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4200
        l := height - margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4201
        y > l ifTrue:[dY := l - y]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4202
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4203
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4204
    aColNr == 0 ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4205
        dY == 0 ifTrue:[^ self].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4206
        dX := 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4207
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4208
        x  := self xVisibleOfColNr:aColNr.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4209
1163
f46f69609c53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1149
diff changeset
  4210
        x <= margin ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4211
            dX := margin - x
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4212
        ] ifFalse:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4213
            x := x + (columnDescriptors at:aColNr) width.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4214
            l := width - margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4215
            x > l ifTrue:[dX := l - x]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4216
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4217
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4218
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4219
    (dX == 0 and:[dY == 0]) ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4220
        self scrollTo:(viewOrigin - (dX @ dY)).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4221
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4222
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4223
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4224
scrollToSelection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4225
    "make selection visible"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4226
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4227
    |rowNr|
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4228
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4229
    (rowNr := self firstIndexSelected) ~~ 0 ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4230
        self scrollToRowAt:rowNr colAt:self selectedColIndex
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4231
    ]
1506
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4232
!
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4233
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4234
scrollVerticalTo:aPixelOffset
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4235
    "change origin to make aPixelOffset be the top line"
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4236
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4237
    |orgX orgY|
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4238
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4239
    orgX := viewOrigin x.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4240
    scrollRowWise ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4241
        orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4242
    ] ifFalse:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4243
        orgY := aPixelOffset.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4244
    ].
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4245
    ^ self scrollTo:(orgX @ orgY).
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4246
!
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4247
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4248
startAutoScroll:aSelectorOrBlock distance:aDistance
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4249
    "setup for auto-scroll (when button-press-moving below/above view);
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4250
     - timeDelta for scroll is computed from distance"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4251
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4252
    |timeDelta scrollBlock|
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4253
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4254
    autoScroll ifFalse:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4255
        self stopAutoScroll.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4256
        ^ self
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4257
    ].
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4258
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4259
    autoScrollBlock notNil ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4260
        Processor removeTimedBlock:autoScrollBlock.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4261
    ] ifFalse:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4262
        self compressMotionEvents:false.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4263
    ].
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4264
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4265
    timeDelta := 0.5 / (aDistance abs).
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4266
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4267
    scrollBlock :=
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4268
        [
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4269
            aSelectorOrBlock isSymbol ifTrue:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4270
                self perform:aSelectorOrBlock.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4271
            ] ifFalse:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4272
                aSelectorOrBlock value
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4273
            ].
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4274
            autoScrollBlock notNil ifTrue:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4275
                Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4276
            ]
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4277
        ].
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4278
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4279
    autoScrollBlock := [self sensor pushUserEvent:#value for:scrollBlock].
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4280
    Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4281
!
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4282
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4283
stopAutoScroll
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4284
    "stop any autoScroll"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4285
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4286
    autoScrollBlock notNil ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4287
        Processor removeTimedBlock:autoScrollBlock.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4288
        autoScrollBlock := nil.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4289
        self compressMotionEvents:true.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4290
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4291
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4292
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4293
!DSVColumnView methodsFor:'searching'!
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4294
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4295
findFirstColumnWithStringFrom:start to:stop
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4296
    start to:stop do:[:eachNr|
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4297
        |row lbl|
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4298
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4299
        row := self at:eachNr.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4300
        columnDescriptors keysAndValuesDo:[:colNr :col |
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4301
            lbl := col shownValueForRow:row rowNr:eachNr.
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4302
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4303
            lbl isNonByteCollection ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4304
                lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4305
            ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4306
            (lbl respondsTo:#string) ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4307
                lbl := lbl string.
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4308
            ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4309
            (lbl size ~~ 0 and:[(lbl at:1) isCharacter]) ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4310
                ^ colNr
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4311
            ]
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4312
        ]
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4313
    ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4314
    ^ nil
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4315
!
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4316
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4317
findFirstRowWithString: aString from:start to:stop by: step ignoreCase:ignoreCase
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4318
    "Return the rowNr from the first row that matches aString.
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4319
     The search is performed between the start and stop row numbers and incrementing by a step"
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4320
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4321
    |stringToMatch|
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4322
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4323
    aString isEmptyOrNil ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4324
        ^ self
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4325
    ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4326
    stringToMatch := '*', aString, '*'.
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4327
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4328
    start to:stop by:step do:[:rowNr|
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4329
        |row lbl|
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4330
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4331
        row := self at:rowNr.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4332
        columnDescriptors keysAndValuesDo:[:colNr :col |
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4333
            lbl := col shownValueForRow:row rowNr:rowNr.
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4334
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4335
            lbl isNonByteCollection ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4336
                lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first].
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4337
            ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4338
            (lbl respondsTo:#string) ifTrue:[
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4339
                lbl := lbl string.
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4340
            ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4341
            lbl isNumber ifTrue:[
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4342
                lbl := lbl printString.
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4343
            ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4344
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4345
            (lbl size ~~ 0
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4346
                and:[(lbl at:1) isCharacter
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4347
                and:[stringToMatch match:lbl caseSensitive:ignoreCase not
4359
bb6d48846f0d class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4333
diff changeset
  4348
            ]]) ifTrue:[
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4349
                ^ rowNr
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4350
            ]
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4351
        ]
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4352
    ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4353
    ^ nil
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4354
!
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4355
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4356
findFirstRowWithString: aString from:start to:stop ignoreCase:ignoreCase
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4357
    "Return the rowNr from the first row that matches aString.
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4358
     The search is performed between the start and stop row numbers"
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4359
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4360
    ^ self findFirstRowWithString:aString from:start to:stop by:1 ignoreCase:ignoreCase
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4361
! !
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4362
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4363
!DSVColumnView methodsFor:'selection'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4364
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4365
addRowToSelection:aRowNr
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4366
    "add a row to the selection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4367
     if a column is selected, the column will be closed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4368
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4369
    |newSelection|
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4370
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4371
    (self isRowSelectable:aRowNr) ifFalse:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4372
        ^ self
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4373
    ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4374
    self numberOfSelections == 0 ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4375
        self selectColIndex:0 rowIndex:aRowNr.
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4376
        ^ self
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4377
    ].
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4378
    (self isInSelection:aRowNr) ifTrue:[
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4379
        ^ self
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4380
    ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4381
    multipleSelectOk ifFalse:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4382
        self selectColIndex:0 rowIndex:aRowNr.
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4383
        ^ self
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4384
    ].
2371
2bc91b1b59a5 bugfix when adding to selection
ca
parents: 2370
diff changeset
  4385
    newSelection := selectedRowIndex copyWith:aRowNr.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4386
    self selectedColIndex ~~ 0 ifTrue:[
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4387
        self selectColIndex:0 rowIndex:newSelection.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4388
    ] ifFalse:[
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4389
        selectedRowIndex := newSelection.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4390
        self invalidateRowAt:aRowNr.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4391
        self selectionChanged.
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4392
    ].
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4393
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4394
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4395
deselect
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4396
    self selectColIndex:0 rowIndex:0
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4397
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4398
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4399
firstIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4400
    "returns index of first row selected or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4401
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4402
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4403
        ^ selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4404
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4405
    selectedRowIndex size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4406
        ^ selectedRowIndex at:1
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4407
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4408
    ^ 0
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4409
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4410
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4411
forceAcceptInEditor
2722
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4412
    editView notNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4413
        editView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4414
            allSubViewsDo:[:aSubView |
2722
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4415
                (aSubView respondsTo:#accept) ifTrue:[
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4416
                    aSubView accept
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4417
                ].
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4418
            ]
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4419
    ]
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4420
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4421
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4422
hasRowSelection
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4423
    "returns true if a selection exists, and its a complete row
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4424
     (as opposed to either no selection, or a columnSelection)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4425
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4426
    ^ self hasSelection and:[ self selectedColIndex == 0 ]
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4427
!
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4428
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4429
hasSelection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4430
    "returns true if a selection exists"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4431
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4432
    ^ self numberOfSelections ~~ 0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4433
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4434
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4435
isInSelection:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4436
    "returns true, if row, aRowNr is in the selection"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4437
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4438
    aRowNr ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4439
        multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4440
            ^ aRowNr == selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4441
        ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4442
        selectedRowIndex size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4443
            ^ selectedRowIndex includes:aRowNr
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4444
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4445
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4446
    ^ false
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4447
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4448
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4449
isRowSelected:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4450
    "returns true, if row is in the selection"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4451
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4452
    self selectedColIndex == 0 ifTrue:[
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4453
        ^ self isInSelection:aRowNr
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4454
    ].
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4455
    ^ false
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4456
!
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4457
2263
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4458
isRowVisible:aRowNr
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4459
    |y h|
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4460
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4461
    h := rowHeight.
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4462
    y := self yVisibleOfRowNr:aRowNr.
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4463
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4464
    y < margin ifTrue:[
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4465
        (h := h + y) <= margin ifTrue:[
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4466
            ^ false
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4467
        ].
2263
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4468
    ] ifFalse:[
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4469
        y >= (height-margin) ifTrue:[^ false].
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4470
    ].
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4471
    ^ true
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4472
!
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4473
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4474
isSelected:aRowNr inColumn:aColNr
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4475
    "returns true if cell in a row; a row number, in a column, a column
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4476
     number is selected."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4477
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4478
    multipleSelectOk ifFalse:[
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4479
        aRowNr ~~ selectedRowIndex ifTrue:[
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4480
            ^ false
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4481
        ]
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4482
    ] ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4483
        (selectedRowIndex size ~~ 0 and:[ selectedRowIndex includes:aRowNr ]) ifFalse:[
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4484
            ^ false
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4485
        ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4486
    ].
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4487
    ^ (self selectedColIndex == 0 or:[ self selectedColIndex == aColNr ])
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4488
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4489
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4490
isSelectionVisibleIn:anExtentPoint
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4491
    self selectionIndicesDo:[:selRowNr |
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4492
        |y|
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4493
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4494
        y := self yVisibleOfRowNr:selRowNr.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4495
        (y between:margin and:(anExtentPoint y - margin)) ifTrue:[^ true].
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4496
    ].
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4497
    ^ false.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4498
!
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4499
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4500
lastIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4501
    "returns index of last selected row or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4502
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4503
    multipleSelectOk ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4504
        ^ selectedRowIndex
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4505
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4506
    selectedRowIndex size ~~ 0 ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4507
        ^ selectedRowIndex last
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4508
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4509
    ^ 0
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4510
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4511
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4512
makeLineVisible:aLine
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4513
    "scroll to make aLine visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4514
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4515
    |colNr|
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4516
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4517
    aLine == 0 ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4518
        ^ self
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4519
    ].
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4520
    (self isRowVisible:aLine) ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4521
        ^ self
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4522
    ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4523
    (self selectedColIndex notNil and:[ self selectedColIndex ~~ 0 ]) ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4524
        colNr := self selectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4525
    ] ifFalse:[ colNr := 1 ].
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4526
    self scrollToRowAt:aLine colAt:colNr
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4527
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4528
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4529
makeSelectionVisible
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4530
    "scroll to make the selection line visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4531
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4532
    |rowNr colNr|
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4533
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4534
    rowNr := self firstIndexSelected.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4535
    rowNr == 0 ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4536
        ^ self
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4537
    ].
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4538
    (self selectedColIndex notNil and:[ self selectedColIndex ~~ 0 ]) ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4539
        colNr := self selectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4540
    ] ifFalse:[ colNr := 1 ].
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4541
    self scrollToRowAt:rowNr colAt:colNr
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4542
!
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4543
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4544
maxIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4545
    "return the largest index selected or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4546
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4547
    multipleSelectOk ifFalse:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4548
        ^ selectedRowIndex
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4549
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4550
    selectedRowIndex size ~~ 0 ifTrue:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4551
        ^ selectedRowIndex max
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4552
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4553
    ^ 0
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4554
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4555
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4556
minIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4557
    "return the smallest index selected or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4558
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4559
    multipleSelectOk ifFalse:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4560
        ^ selectedRowIndex
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4561
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4562
    selectedRowIndex size ~~ 0 ifTrue:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4563
        ^ selectedRowIndex min
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4564
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4565
    ^ 0
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4566
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4567
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4568
numberOfSelections
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4569
    "return the number of selected rows"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4570
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4571
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4572
        ^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4573
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4574
    ^ selectedRowIndex size
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4575
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4576
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4577
openEditorOnSelection
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4578
     |colIdx column rowIdx editorAndModel winGroup
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4579
      editor filter keyBrdFwd selColor|
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4580
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4581
    (shown and:[editView isNil]) ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4582
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4583
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4584
    winGroup := self windowGroup.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4585
    winGroup isNil ifTrue:[^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4586
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4587
    colIdx := self selectedColIndex ? 0.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4588
    column := self columnDescriptorAt:colIdx.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4589
    column isNil ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4590
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4591
    rowIdx := self selectedRowIndex ? 0.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4592
    rowIdx == 0 ifTrue:[^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4593
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4594
    rowIdx isSequenceable ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4595
        rowIdx := rowIdx at:1 ifAbsent:[ ^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4596
    ].
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4597
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4598
    editorAndModel := column editorForRowAt:rowIdx.
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4599
    editorAndModel isNil ifTrue:[^ self].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4600
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4601
    autoScrollToColumn == true ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4602
        self scrollToRowAt:rowIdx colAt:colIdx.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4603
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4604
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4605
    editView := SimpleView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4606
                extent:((column width - (2 * separatorSize))
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4607
                        @ (rowHeight - (2 * separatorSize)))
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4608
                in:self.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4609
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4610
    self updateEditViewOrigin.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4611
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4612
    (column containsText or:[ column showSelectionHighLighted not ]) ifTrue:[
3149
66df7168e377 bug fix
ca
parents: 3141
diff changeset
  4613
        selColor := (column backgroundColorAt:rowIdx)
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4614
    ] ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4615
        selColor := selectionBackgroundColor
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4616
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4617
    editView viewBackground:selectionBackgroundColor.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4618
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4619
    editor := editorAndModel editor.
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4620
    editView add:editor.
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4621
    editorAndModel editorNeedsCursorKeys ifTrue:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4622
        editorAndModel editorNeedsReturnKey ifTrue:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4623
            "/ only steal TAB from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4624
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4625
        ] ifFalse:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4626
            "/ steal TAB and RETURN from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4627
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #Return ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4628
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4629
    ] ifFalse:[
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4630
        editorAndModel editorNeedsReturnKey ifTrue:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4631
            "/ only steal TAB and Curosr Keys from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4632
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4633
        ] ifFalse:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4634
            "/ steal TAB, RETURN and Curosr Keys from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4635
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown #Return ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4636
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4637
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4638
    keyBrdFwd := KeyboardForwarder
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4639
                toView:self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4640
                condition:nil
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4641
                filter:filter.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4642
    editView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4643
        withAllSubViewsDo:[:aView |
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4644
            aView delegate:keyBrdFwd.
4496
229bdd6b4754 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4489
diff changeset
  4645
            aView font:self font.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4646
        ].
3141
095e746ebc1d bug fix
ca
parents: 3140
diff changeset
  4647
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4648
    (editValue := editorAndModel model) notNil ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4649
        editValue addDependent:self.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4650
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4651
    editView realize.
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4652
    editor canTab:true.
3962
0b5f7e526d0f changed:
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  4653
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4654
    winGroup focusView:editor.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4655
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4656
    self processAllExposeEvents.
3960
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4657
3962
0b5f7e526d0f changed:
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  4658
    "Modified: / 02-11-2010 / 22:04:01 / cg"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4659
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4660
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4661
processAllExposeEvents
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4662
    |sensor|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4663
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4664
    sensor := self sensor.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4665
    [
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4666
        sensor hasExposeEventFor:nil
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4667
    ] whileTrue:[
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4668
        self windowGroup processExposeEvents
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4669
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4670
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4671
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4672
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4673
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4674
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4675
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4676
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4677
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4678
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4679
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4680
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4681
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4682
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4683
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4684
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4685
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4686
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4687
removeRowFromSelection:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4688
    "remove a row from the selection"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4689
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4690
    (self isInSelection:aRowNr) ifFalse:[^ self].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4691
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4692
    self numberOfSelections == 1 ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4693
        self deselect.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4694
    ] ifFalse:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4695
        selectedRowIndex := selectedRowIndex copyWithout:aRowNr.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4696
        self invalidateRowAt:aRowNr.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4697
        self selectionChanged.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4698
    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4699
!
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4700
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4701
selectAllRows
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4702
    "select all"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4703
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4704
    multipleSelectOk ifFalse:[^ self].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4705
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4706
    selectedRowIndex := (1 to:list size) select:[:idx| self isRowSelectable:idx ].
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4707
    self selectionChanged.
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4708
    self invalidate.
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4709
!
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4710
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4711
selectColIndex:aColNr rowIndex:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4712
    "change selection with notification"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4713
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4714
    self selectColIndex:aColNr rowIndex:aRowNr openEditor:true.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4715
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4716
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4717
selectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4718
    "change selection with notification"
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4719
5666
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4720
    |oldCol oldRow|
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4721
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4722
    oldCol := self selectedColIndex.
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4723
    oldRow := self selectedRowIndex.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4724
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4725
    self setSelectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4726
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4727
    (oldCol ~~ self selectedColIndex
5666
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4728
    or:[oldRow ~= self selectedRowIndex
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4729
    or:[ignoreReselect == false]]) ifTrue:[
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4730
        self selectionChanged:aColNr
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4731
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4732
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4733
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4734
selectRow:something
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4735
    "select a row"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4736
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4737
    ^ self selectedRowIndex:something
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4738
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4739
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4740
selectRowAt:rowNr colAt:colNr atPoint:aPoint
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4741
    self selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:true.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4742
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4743
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4744
selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:openEditor
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4745
    |view p shouldClick editorType|
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4746
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4747
    view := editView.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4748
    self selectColIndex:colNr rowIndex:rowNr openEditor:openEditor.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4749
    openEditor ifFalse:[ ^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4750
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4751
    editView isNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4752
        "/ might be a reselection
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4753
        self openEditorOnSelection.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4754
        editView isNil ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4755
    ] ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4756
        editView == view ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4757
    ].
5517
9acf3fa7e7a8 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5447
diff changeset
  4758
    view := self detectViewAt:aPoint ignoreInvisible:false.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4759
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4760
    shouldClick := true.
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4761
    "/ when PreselectAllWhenOpeningEditor is true, we should not click into
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4762
    "/ the editor, as this couldclear the selection.
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4763
    "/ however, for non-text editors, it is a good idea to do so...
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4764
    PreselectAllWhenOpeningEditor == true ifTrue:[
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4765
        shouldClick := false.
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4766
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4767
        editorType := self selectedColumn editorType.
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4768
        editorType == #ComboList ifTrue:[ shouldClick := true ].
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4769
        "/ TODO: more heuristics here...
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4770
        "/ editorType == #RadioButton ifTrue:[ ].
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4771
    ].
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4772
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4773
    shouldClick ifTrue:[
2125
67e0f2c9ad4d event types are private to WindowEvent;
ca
parents: 2101
diff changeset
  4774
        "/ simulate clicking into the editor
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4775
        self breakPoint:#ca.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4776
        (view ~~ self and:[view notNil]) ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  4777
            p := device translatePoint:aPoint fromView:self toView:view.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4778
            self sensor
3960
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4779
                    pushEvent:(WindowEvent   buttonPress:1 x:p x y:p y view:view);
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4780
                    pushEvent:(WindowEvent buttonRelease:1 x:p x y:p y view:view).
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4781
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4782
"/        "/ a very special hack for radioButtons:
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4783
"/        "/ if the button is now on, all other cells must be turned off !!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4784
"/        self selectedColumn editorType == #RadioButton ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4785
"/            1 tolist size do:[:eachRowNr |
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4786
"/                eachRowNr ~~ rowNr ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4787
"/                    self at:eachRowNr put:false
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4788
"/                ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4789
"/            ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4790
"/        ].
3960
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4791
        ].
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4792
    ].
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4793
4073
14b8653c124f changed: #selectRowAt:colAt:atPoint:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4059
diff changeset
  4794
    "Modified: / 07-09-2011 / 16:08:45 / cg"
5517
9acf3fa7e7a8 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5447
diff changeset
  4795
    "Modified: / 15-03-2017 / 21:09:54 / stefan"
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4796
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4797
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4798
selectRowFrom:start to:stop
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4799
    |step oldSelection newSelection|
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4800
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4801
    start == stop ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4802
        self selectColIndex:0 rowIndex:start.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4803
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4804
    ].
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4805
    step := (start <= stop) ifTrue:1 ifFalse:-1.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4806
    newSelection := (start to:stop by:step)
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4807
                select:[:idx | self isRowSelectable:idx ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4808
    self selectedColIndex ~~ 0 ifTrue:[
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4809
        self selectColIndex:0 rowIndex:newSelection.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4810
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4811
    ].
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4812
    oldSelection := selectedRowIndex ? #().
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4813
    selectedRowIndex := newSelection.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4814
    newSelection
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4815
        select:[:i | (oldSelection includes:i) not ]
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4816
        thenDo:[:i | self invalidateRowAt:i ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4817
    oldSelection
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4818
        select:[:i | (newSelection includes:i) not ]
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4819
        thenDo:[:i | self invalidateRowAt:i ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4820
    self selectionChanged.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4821
!
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4822
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4823
selectRowIndex:something
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4824
    "set selection of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4825
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4826
    self selectColIndex:self selectedColIndex rowIndex:something
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4827
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4828
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4829
selectedColIndex
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4830
    "returns selected column number or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4831
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4832
    ^ self selectedColIndexHolder value
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4833
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4834
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4835
selectedColumn
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4836
    "returns selected column or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4837
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4838
    ^ columnDescriptors at:self selectedColIndex ifAbsent:nil.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4839
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4840
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4841
selectedRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4842
    "returns the selected row (or collection if multiple selection) or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4843
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4844
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4845
        ^ self at:selectedRowIndex ifAbsent:nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4846
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4847
    selectedRowIndex size ~~ 0 ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4848
        ^ selectedRowIndex collect:[:i | self at:i ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4849
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4850
    ^ nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4851
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4852
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4853
selectedRow:something
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4854
    "select something"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4855
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4856
    self selectedRowIndex:something
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4857
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4858
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4859
selectedRowIndex
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4860
    "returns selected row number or 0"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4861
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4862
    ^ selectedRowIndex
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4863
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4864
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4865
selectedRowIndex:rowOrCollectionOfRows
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4866
    "set the row selection (single or multiple rows);
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  4867
     does NOT change the selected column."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4868
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4869
    self selectColIndex:(self selectedColIndex) rowIndex:rowOrCollectionOfRows
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4870
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4871
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4872
selectionChanged
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4873
    "selection has changed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4874
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4875
    self selectionChanged:nil
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4876
!
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4877
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4878
selectionChanged:colNrOrNil
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4879
    "selection has changed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4880
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4881
    |val|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4882
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4883
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4884
        val := self selectedRowIndex copy.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4885
        (model respondsTo:#selectionIndex:) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4886
            model selectionIndex:val
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4887
        ] ifFalse:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4888
            |newVal|
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4889
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4890
            newVal := (useIndex ifTrue:[val] ifFalse:[self selectedRow]).
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4891
            "/ must check here: valueHolder compares using identity to identify
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4892
            "/ changes. This would lead to an endless recursion....
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4893
            model value ~= newVal ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4894
                model value:newVal
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4895
            ]
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4896
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4897
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4898
    actionBlock notNil ifTrue:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4899
        colNrOrNil isNil ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4900
            actionBlock valueWithOptionalArgument:(self selectedRowIndex)
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4901
        ] ifFalse:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4902
            actionBlock valueWithOptionalArgument:(self selectedRowIndex) and:colNrOrNil
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4903
        ].
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4904
    ]
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4905
!
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4906
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4907
selectionIndicesDo:aOneArgBlock
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4908
    "evaluate block on each row selected; the argument to the row
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4909
     is the index of the selected row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4910
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4911
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4912
        selectedRowIndex ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4913
            aOneArgBlock value:selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4914
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4915
    ] ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4916
        selectedRowIndex size ~~ 0 ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4917
            selectedRowIndex do:aOneArgBlock
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4918
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4919
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4920
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4921
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4922
setSelectColIndex:colNrArg rowIndex:rowNrArg
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4923
    "change selection without notification"
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4924
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4925
    self setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:true
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4926
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4927
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4928
setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:openEditor
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4929
    "change selection without notification"
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4930
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4931
    |rowNr colNr newCol oldCol oldRow sglSelRow oldSz winGroup|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4932
5709
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  4933
    rowNr := self validateSelection:rowNrArg.
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  4934
    rowNr isNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4935
        rowNr := multipleSelectOk ifTrue:[#()] ifFalse:[0].
5709
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  4936
    ].
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  4937
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4938
    colNr := colNrArg.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4939
    rowNr == 0 ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4940
        colNr := 0.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4941
    ] ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4942
        multipleSelectOk ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4943
            (rowNr size == 1) ifFalse:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4944
                colNr := 0
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4945
            ]
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4946
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4947
    ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4948
    (colNr := colNr ? 0) ~~ 0 ifTrue:[
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4949
        newCol := self columnDescriptorAt:colNr.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4950
        newCol rendererType == #rowSelector ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4951
            colNr := 0.
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4952
            newCol := nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4953
        ] ifFalse:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4954
            multipleSelectOk ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4955
                sglSelRow := rowNr at:1
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4956
            ] ifFalse:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4957
                sglSelRow := rowNr
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4958
            ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4959
            (newCol canSelect:sglSelRow) ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4960
                newCol := nil.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4961
                colNr := 0.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  4962
                selectRowOnDefault ifFalse:[
3449
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
  4963
                    rowNr := multipleSelectOk ifTrue:[nil] ifFalse:[0]
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  4964
                ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4965
            ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4966
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4967
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4968
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4969
    (rowNr = selectedRowIndex and:[ colNr == self selectedColIndex ]) ifTrue:[
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  4970
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4971
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4972
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4973
    "/ release old selection
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4974
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4975
    oldSz := self numberOfSelections.
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4976
    oldCol := self selectedColIndex.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4977
    oldRow := selectedRowIndex.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4978
    oldSz == 1 ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4979
        multipleSelectOk ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4980
            oldRow := oldRow at:1
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4981
        ].
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4982
        self updateColumnFromEditValueAndDestroyEditView.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4983
    ].
5666
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4984
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4985
    (rowNr ~= selectedRowIndex
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4986
    or:[ignoreReselect == false]) ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4987
        selectedRowIndex := rowNr.
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4988
        self selectionChanged:colNr.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4989
    ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4990
    self selectedColIndex:colNr.
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4991
    shown ifFalse:[ ^ self ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4992
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4993
    winGroup := self windowGroup.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4994
    winGroup isNil ifTrue:[^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4995
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4996
    oldSz > 1 ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4997
        "/ redraw old selection
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4998
        oldRow do:[:aRowNr |
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4999
            "/ unselected if visible
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  5000
            self invalidateRowAt:aRowNr colAt:0
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5001
        ]
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5002
    ] ifFalse:[
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5003
        oldSz == 1 ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  5004
            self invalidateRowAt:oldRow colAt:oldCol
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5005
        ]
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5006
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5007
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5008
    "/ show new selection
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5009
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5010
    newCol notNil ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5011
        openEditor ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5012
            self openEditorOnSelection.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5013
            editView notNil ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5014
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5015
        self invalidateRowAt:sglSelRow colAt:colNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5016
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  5017
        autoScrollToColumn == true ifTrue:[
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  5018
            self scrollToRowAt:sglSelRow colAt:colNr.
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  5019
        ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5020
    ] ifFalse:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5021
        self selectionIndicesDo:[:i | self invalidateRowAt:i colAt:0 ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5022
        self scrollToRowAt:(self firstIndexSelected) colAt:0
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5023
    ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5024
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5025
    self processAllExposeEvents.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5026
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  5027
    "Modified: / 12-07-2011 / 14:22:42 / cg"
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5028
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5029
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5030
updateColumnFromEditValueAndDestroyEditView
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5031
    |edValue selCol selRow|
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5032
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5033
    selCol := self selectedColIndex.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5034
    selRow := selectedRowIndex.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5035
    editValue notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5036
        editValue removeDependent:self
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5037
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5038
    editView notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5039
        self forceAcceptInEditor
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5040
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5041
    editValue notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5042
        edValue := editValue value.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5043
        edValue isSequenceable ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5044
            edValue size == 0 ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5045
                edValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5046
            ] ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5047
                edValue isString ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5048
                    edValue := edValue select:[:el | el notNil ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5049
                    edValue size == 0 ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5050
                        edValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5051
                    ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5052
                ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5053
            ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5054
        ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5055
        selRow isNumber ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5056
            "/ ??? should we do ???:
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5057
            "/ selRow do:[:eachRow |
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5058
            "/     (self columnAt:selCol) at:eachRow put:edValue.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5059
            "/ ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5060
            selRow := selRow first
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5061
        ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5062
        (self columnDescriptorAt:selCol) at:selRow put:edValue.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5063
        modifiedChannel notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5064
            modifiedChannel value:true
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5065
        ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5066
        editValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5067
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5068
    self destroyEditView.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5069
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5070
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5071
validateSelection:aSelection
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5072
    |newSel|
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5073
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5074
    (list size == 0 or:[aSelection isNil or:[aSelection == 0]]) ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5075
        ^ multipleSelectOk ifFalse:[0] ifTrue:[nil]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5076
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5077
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5078
    newSel := aSelection.
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5079
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5080
    multipleSelectOk ifFalse:[
2732
0d3258f88f58 *** empty log message ***
martin
parents: 2730
diff changeset
  5081
        newSel isInteger ifFalse:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5082
            newSel := self identityIndexOfRow:aSelection.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5083
        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5084
        ^ (self isRowSelectable:newSel) ifTrue:[newSel] ifFalse:[0].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5085
    ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5086
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5087
    "multiple selection
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5088
    "
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5089
    aSelection size ~~ 0 ifTrue:[
2732
0d3258f88f58 *** empty log message ***
martin
parents: 2730
diff changeset
  5090
        aSelection first isInteger ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5091
            newSel := aSelection select:[:idx| self isRowSelectable:idx ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5092
        ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5093
            newSel := aSelection
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5094
                            collect:[:el| self identityIndexOfRow:el ]
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5095
                            thenSelect:[:idx| self isRowSelectable:idx ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5096
        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5097
        newSel notEmpty ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5098
            ^ newSel
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5099
        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5100
    ] ifFalse:[
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5101
        newSel isInteger ifFalse:[
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5102
            newSel := self identityIndexOfRow:aSelection.
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5103
        ].
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5104
        (self isRowSelectable:newSel) ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5105
            ^ Array with:newSel
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5106
        ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5107
    ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5108
    ^ nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5109
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5110
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5111
!DSVColumnView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5112
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5113
version
4794
73a3ffcaf58c class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4772
diff changeset
  5114
    ^ '$Header$'
3757
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  5115
!
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  5116
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  5117
version_CVS
4794
73a3ffcaf58c class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4772
diff changeset
  5118
    ^ '$Header$'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5119
! !
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  5120