DSVColumnView.st
author Claus Gittinger <cg@exept.de>
Fri, 01 Mar 2019 16:10:30 +0100
changeset 6015 2eabdcac77fb
parent 5990 1c1e8ef4220b
child 6043 8d87fa82b05d
permissions -rw-r--r--
#REFACTORING by cg class: SelectionInListModelView changed: #selectWithoutScroll:redraw: #wantsFocusWithPointerEnter
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     1
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     3
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     4
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    10
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    11
"
1754
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
4dea21fbacee #buttonMotion:x:y: -- with autoScroll support
ca
parents: 1749
diff changeset
    13
4772
11b5f36c5943 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
    14
"{ NameSpace: Smalltalk }"
11b5f36c5943 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
    15
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    16
View subclass:#DSVColumnView
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    17
	instanceVariableNames:'labelView listHolder editValue editView multipleSelectOk useIndex
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
    18
		selectedColIndexHolder selectedRowIndex selectRowOnDefault
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
    19
		buttonMotionAction buttonReleaseAction rowHeight minRowHeight
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    20
		columnDescriptors viewOrigin colorMap rowFontAscent lockRowIndex
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    21
		rowIfAbsentBlock columnHolder registererImages list fgColor
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    22
		separatorSize catchChangeEvents beDependentOfRows bgColor
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    23
		actionBlock builder tabIntern doubleClickActionBlock
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    24
		verticalSpacing horizontalSpacing rowSelectorForm
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    25
		buttonLightColor buttonShadowColor buttonHalfLightColor
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    26
		buttonHalfShadowColor checkToggleExtent checkToggleForm
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    27
		checkToggleActiveImage checkTogglePassiveImage
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    28
		checkToggleDisabledActiveImage checkToggleDisabledPassiveImage
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    29
		checkToggleLevel radioButtonActiveImage radioButtonPassiveImage
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    30
		radioButtonDisabledActiveImage radioButtonDisabledPassiveImage
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    31
		comboButtonExtent comboButtonForm comboButtonDisabledForm
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    32
		comboButtonLevel dropSource columnAdaptor tabAtEndAction
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    33
		tabAtStartAction modifiedChannel autoScroll autoScrollBlock
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    34
		needFitColumns scrollWhenUpdating separatorOneDColor
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    35
		selectionForegroundColor selectionForegroundColorNoFocus
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    36
		selectionBackgroundColor selectionBackgroundColorNoFocus
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    37
		selectionFrameColor selectionFrameColorNoFocus previousExtent
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    38
		selectConditionBlock scrollRowWise autoScrollToColumn
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    39
		cachedPreferredExtent 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
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    45
		CheckToggleDisabledActiveImage CheckToggleDisabledPassiveImage
3988
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
    46
		ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
    47
		CheckToggleForm CheckToggleLevel CheckToggleExtent
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    48
		ComboButtonForm ComboButtonDisabledForm ComboButtonLevel
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    49
		ComboButtonExtent StopRedrawSignal RadioButtonActiveImage
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    50
		RadioButtonPassiveImage RadioButtonDisabledActiveImage
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
    51
		RadioButtonDisabledPassiveImage PreselectAllWhenOpeningEditor
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
    52
		DefaultHilightForegroundColorNoFocus
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
    53
		DefaultHilightBackgroundColorNoFocus DefaultLabelForegroundColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
    54
		DefaultLabelBackgroundColor'
2482
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    55
	poolDictionaries:''
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
    56
	category:'Views-DataSet'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    57
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    58
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    59
!DSVColumnView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    60
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    61
copyright
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    62
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    63
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    64
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    65
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    66
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    67
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    68
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    69
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    70
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    71
 hereby transferred.
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
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    77
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    78
documentation
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    79
"
2788
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    80
    ColumnView part of a DataSetView.
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    81
    implements a scrollable selection view based on rows and columns.
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
    82
    Used as the contents-part of a DataSetView.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    83
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    84
    [Instance variables:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    85
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    86
        editValue               <Model>                 current editing model
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    87
        editView                <View>                  current editing component
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    88
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    89
        buttonReleaseAction     <Action or nil>         called if the mouse button is released
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    90
        buttonMotionAction      <Action or nil>         called during mouse motion with one
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    91
                                                        argument the point under the mouse.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
    92
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    93
        multipleSelectOk        <Boolean>               multiple selection enabled/disabled
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    94
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    95
        selectedColIndex        <Integer>               selected column index or 0
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    96
        selectedRowIndex        <Integer>               selected row    index or 0
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
    97
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    98
        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
    99
        minRowHeight            <Integer>               minimum height of all displayed labels
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   100
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   101
        columnDescriptors       <SequancableCollection> list of column descriptors
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   102
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   103
        viewOrigin              <Point>                 current view origin
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   104
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   105
        colorMap                <Dictionary>            store and register used colors on device
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   106
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   107
        rowFontAscent           <SmallInteger>          inset of a printable text in a row
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   108
                                                        including separator and font ascent.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   109
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   110
        lockRowIndex            <SmallInteger>          internal used to indicate a row which has
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   111
                                                        changed its contents but no redraw should be
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   112
                                                        done( at:put: ).
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   113
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   114
        columnHolder            <ValueHolder>           holder which keeps the list of column descriptors.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   115
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   116
        registererImages        <IdentityDictionary>    list of images registered on the device
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   117
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   118
        list                    <SequancableCollection> list of rows
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   119
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   120
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   121
        catchChangeEvents       <Boolean>               internal used to discard change notifications
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   122
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   123
        beDependentOfRows       <Boolean>               keep rows dependent; on default is disabled.
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   124
                                                        in case of enabled a row can raise a change
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   125
                                                        notification whithout a parameter which
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   126
                                                        will force a redraw of the row or the
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   127
                                                        readSelector of the column which will
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
   128
                                                        redraw the cell in the row only.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   129
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   130
        fgColor                 <Color>                 foreground color
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   131
        bgColor                 <Color>                 background color
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   132
        hgLgFgColor             <Color>                 highlight foreground color (selected)
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   133
        hgLgBgColor             <Color>                 highlight background color (selected)
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   134
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   135
        buttonLightColor        <Color>                 LightColor      ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   136
        buttonShadowColor       <Color>                 ShadowColor     ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   137
        buttonHalfLightColor    <Color>                 HalfLightColor  ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   138
        buttonHalfShadowColor   <Color>                 HalfShadowColor ( drawing the edge of a button )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   139
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   140
        actionBlock             <a OneArgBlock>         action block performed on select
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   141
        doubleClickActionBlock  <a OneArgBlock>         action block performed on double click
5308
4e35010e00be #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5279
diff changeset
   142
        rowIfAbsentBlock        <a OneArgBlock>         this block is performed on an empty list entry
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   143
                                                        to retrive the item from the application. The
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   144
                                                        argument to the block is the index into the list.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   145
                                                        The block should return the row instance which
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   146
                                                        is put to the list under the index.
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   147
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   148
        builder                 <UIBuilder>             builder set by application
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   149
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   150
        verticalSpacing         <SmallInteger>          vertical   row spacing( top  & bottom )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   151
        horizontalSpacing       <SmallInteger>          horizontal row spacing( left & right )
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   152
        separatorSize           <SmallInteger>          line width of a vertical or horizontal separator
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   153
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   154
        rowSelectorForm         <Form>                  form used by a row selector
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   155
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   156
        checkToggleForm         <Form>                  form used by a checkToggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   157
        checkToggleExtent       <Point>                 extent of a checkToggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   158
        checkToggleLevel        <SmallInteger>          level used to draw a check toggle
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   159
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   160
        comboButtonForm         <Form>                  form used by a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   161
        comboButtonExtent       <Point>                 extent of a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   162
        comboButtonLevel        <SmallInteger>          level used to draw a comboList or -Box
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   163
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   164
        dropTarget              <DropTarget>            drag & drop target
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   165
        dropSource              <DropSource>            drag & drop source
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   166
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   167
    [author:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   168
        Claus Atzkern
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   169
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   170
    [see also:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   171
        DataSetColumnSpec
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   172
        DataSetColumn
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   173
        DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   174
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   175
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   176
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   177
!DSVColumnView class methodsFor:'defaults'!
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   178
1844
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   179
defaultFont
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   180
    ^ SelectionInListView defaultFont
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   181
!
05a9cb2fc86f default font
martin
parents: 1842
diff changeset
   182
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   183
horizontalSpacing
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   184
    "returns the default horizontal space between rows
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   185
    "
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   186
    ^ 4
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   187
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   188
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   189
3961
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   190
preselectAllWhenOpeningEditor:aBoolean
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   191
    PreselectAllWhenOpeningEditor := aBoolean
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
    "Created: / 02-11-2010 / 22:00:28 / cg"
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   194
!
6cd0b3929aa2 added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents: 3960
diff changeset
   195
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   196
updateStyleCache
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   197
    "extract values from the styleSheet and cache them in class variables"
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   198
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   199
    <resource: #style (#textForegroundColor
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   200
                       #'scrollableView.backgroundColor'
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   201
                       #'button.lightColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   202
                       #'button.shadowColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   203
                       #'button.halfLightColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   204
                       #'button.halfShadowColor'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   205
                       #'button.edgeStyle'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   206
                       #'checkToggle.activeImage'
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   207
                       #'checkToggle.passiveImage'
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   208
                       #'radioButton.activeImage'
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   209
                       #'radioButton.passiveImage'
582
222fc7c63af0 new resource naming
Claus Gittinger <cg@exept.de>
parents: 567
diff changeset
   210
                       #'selection.hilightForegroundColor'
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   211
                       #'selection.hilightBackgroundColor'
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   212
                       #'selection.hilightFrameColor'
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   213
                       #'dataSet.labelView.foregroundColor'
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   214
                       #'dataSet.labelView.backgroundColor'
3988
Claus Gittinger <cg@exept.de>
parents: 3986
diff changeset
   215
    )>
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   216
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   217
    DefaultForegroundColor        := StyleSheet colorAt:#'textForegroundColor' default:(Color black).
3986
163354e9ee4c changed: #updateStyleCache
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
   218
    "/ DefaultBackgroundColor        := StyleSheet colorAt:#'scrollableView.backgroundColor' default:DefaultViewBackgroundColor.
163354e9ee4c changed: #updateStyleCache
Claus Gittinger <cg@exept.de>
parents: 3964
diff changeset
   219
    DefaultBackgroundColor        := StyleSheet colorAt:#'selection.backgroundColor' default:DefaultViewBackgroundColor.
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   220
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   221
    DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor' default:DefaultBackgroundColor.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   222
    DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor' default:DefaultForegroundColor.
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
   223
    DefaultHilightForegroundColorNoFocus := StyleSheet colorAt:#'selection.hilightForegroundColorNoFocus'.
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
   224
    DefaultHilightBackgroundColorNoFocus := StyleSheet colorAt:#'selection.hilightBackgroundColorNoFocus'.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   225
    DefaultHilightFrameColor      := StyleSheet colorAt:#'selection.hilightFrameColor'. "/ no default; nil means: no frame
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   226
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   227
    DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   228
        DefaultHilightBackgroundColor := Color black
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
   229
    ].
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   230
    ButtonLightColor       := StyleSheet colorAt:#'button.lightColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   231
    ButtonShadowColor      := StyleSheet colorAt:#'button.shadowColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   232
    ButtonHalfLightColor   := StyleSheet colorAt:#'button.halfLightColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   233
    ButtonHalfShadowColor  := StyleSheet colorAt:#'button.halfShadowColor'.
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   234
    ButtonEdgeStyle        := StyleSheet at:#'button.edgeStyle'.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   235
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   236
    CheckToggleActiveImage := StyleSheet at:#'checkToggle.activeImage'.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   237
    CheckToggleActiveImage isNil ifTrue:[
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   238
        CheckTogglePassiveImage := nil
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   239
    ] ifFalse:[
1333
011e6414dae5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1326
diff changeset
   240
        CheckTogglePassiveImage := StyleSheet at:#'checkToggle.passiveImage'.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   241
        CheckTogglePassiveImage isNil ifTrue:[
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   242
            CheckToggleActiveImage := nil
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   243
        ]
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
   244
    ].
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   245
    "/ CheckToggleDisabledActiveImage := StyleSheet at:#'checkToggle.disabledActiveImage'.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   246
    "/ CheckToggleDisabledPassiveImage := StyleSheet at:#'checkToggle.disabledPassiveImage'.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   247
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   248
    CheckToggleForm   := nil.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   249
    CheckToggleLevel  := nil.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   250
    CheckToggleExtent := nil.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   251
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   252
    RadioButtonActiveImage := StyleSheet at:#'radioButton.activeImage'.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   253
    RadioButtonPassiveImage := StyleSheet at:#'radioButton.passiveImage'.
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   254
    "/ RadioButtonDisabledActiveImage := StyleSheet at:#'radioButton.disabledActiveImage'.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   255
    "/ RadioButtonDisabledPassiveImage := StyleSheet at:#'radioButton.disabledPassiveImage'.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   256
    (RadioButtonActiveImage isNil or:[ RadioButtonPassiveImage isNil ]) ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   257
        RadioButtonActiveImage := RadioButton roundOnForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   258
        RadioButtonPassiveImage := RadioButton roundOffForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   259
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   260
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   261
    ComboButtonForm   := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   262
    ComboButtonLevel  := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   263
    ComboButtonExtent := nil.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
   264
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   265
    DefaultLabelBackgroundColor := StyleSheet at:#'dataSet.labelView.backgroundColor' default:nil.
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   266
    DefaultLabelForegroundColor := StyleSheet at:#'dataSet.labelView.foregroundColor' default:nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   267
2777
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   268
    "
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   269
     self updateStyleCache.
56bb352f6b91 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2776
diff changeset
   270
    "
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   271
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   272
    "Modified: / 20-01-2011 / 08:44:28 / cg"
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
   273
    "Modified (comment): / 17-08-2018 / 17:06:46 / Claus Gittinger"
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   274
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   275
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   276
verticalSpacing
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   277
    "returns the default vertical space between rows
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   278
    "
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   279
    ^ 2
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
   280
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   281
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   282
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   283
!DSVColumnView class methodsFor:'image specs'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   284
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   285
dragIconMulti
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   286
    "This resource specification was automatically generated
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   287
     by the ImageEditor of ST/X."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   288
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   289
    "Do not manually edit this!! If it is corrupted,
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   290
     the ImageEditor may not be able to read the specification."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   291
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   292
    "
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   293
     self dragIconMulti inspect
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   294
     ImageEditor openOnClass:self andSelector:#dragIconMulti
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   295
     Icon flushCachedIcons
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   296
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   297
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   298
    <resource: #image>
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   299
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   300
    ^Icon
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   301
        constantNamed:'DSVColumnView class dragIconMulti'
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   302
        ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   303
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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
   304
??0@???<@O???@C???0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b')
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   305
            colorMapFromArray:#[0 0 0 255 255 255]
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   306
            mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   307
@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C????@????0O????C????0?????O????3?????????????????????????????????????????????
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   308
????????@????0O???<C????@????0@@@@@@@@@@@@@@@@@@@@@b'); yourself); yourself]
1926
9bcb6b59ea37 if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   309
!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   310
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   311
dragIconSingle
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   312
    "This resource specification was automatically generated
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   313
     by the ImageEditor of ST/X."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   314
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   315
    "Do not manually edit this!! If it is corrupted,
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   316
     the ImageEditor may not be able to read the specification."
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   317
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   318
    "
988
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   319
     self dragIconSingle inspect
d077faaade27 better hilight colors
tz
parents: 896
diff changeset
   320
     ImageEditor openOnClass:self andSelector:#dragIconSingle
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   321
     Icon flushCachedIcons
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   322
    "
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   323
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   324
    <resource: #image>
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   325
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   326
    ^Icon
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   327
        constantNamed:'DSVColumnView class dragIconSingle'
5100
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   328
        ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   329
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@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
   330
?0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b')
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   331
            colorMapFromArray:#[0 0 0 255 255 255]
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   332
            mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:'
16a95d366ed5 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5079
diff changeset
   333
@@@@@@@@@@@@@@@@@@@@@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
   334
?<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b'); yourself); yourself]
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   335
!
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   336
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   337
rowSelectorImage
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   338
    "This resource specification was automatically generated
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   339
     by the ImageEditor of ST/X."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   340
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   341
    "Do not manually edit this!! If it is corrupted,
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   342
     the ImageEditor may not be able to read the specification."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   343
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   344
    "
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   345
     self rowSelectorImage inspect
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
   346
     ImageEditor openOnClass:self andSelector:#rowSelectorImage
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   347
     Icon flushCachedIcons
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   348
    "
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   349
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   350
    <resource: #image>
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   351
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   352
    ^Icon
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   353
        constantNamed:'DSVColumnView class rowSelectorImage'
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   354
        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
   355
            colorMapFromArray:#[0 0 0 127 127 127 170 170 170 255 255 255]
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   356
            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
   357
! !
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   358
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   359
!DSVColumnView class methodsFor:'signal constants'!
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
    "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
   363
     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
   364
    "
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   365
    StopRedrawSignal isNil ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   366
        StopRedrawSignal := Notification newSignalMayProceed:true.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   367
        StopRedrawSignal nameClass:self message:#stopRedrawSignal.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   368
    ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   369
    ^ StopRedrawSignal
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   370
! !
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
   371
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   372
!DSVColumnView methodsFor:'accessing'!
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   373
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   374
builder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   375
    "get the builder (UIBuilder or nil)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   376
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   377
    ^ builder
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   378
!
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   379
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   380
builder:aBuilder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   381
    "set the builder (UIBuilder or nil)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   382
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   383
    builder := aBuilder
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   384
!
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
   385
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   386
columnView
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   387
    "returns self"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   388
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   389
    ^ self
1067
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   390
!
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   391
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   392
heightOfContents
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   393
    "return the height of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   394
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   395
    cachedPreferredExtent isNil ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   396
        self preferredExtent
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   397
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   398
    ^ cachedPreferredExtent y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   399
!
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   400
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   401
labelView
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   402
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   403
    ^labelView
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   404
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
   405
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   406
labelView:aView
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   407
    labelView := aView for:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   408
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   409
    labelView layout:(LayoutFrame
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   410
                        leftFraction:0 offset:0
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   411
                        rightFraction:1 offset:0
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   412
                        topFraction:0 offset:0
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   413
                        bottomFraction:0 offset:[self preferredLabelViewHeight]).
1067
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   414
!
c66188014600 keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents: 1042
diff changeset
   415
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   416
level:aLevel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   417
    "change the level and thus the level of the labelView"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   418
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   419
    aLevel ~~ level ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   420
        super level:aLevel.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   421
"/        labelView level:aLevel.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   422
    ]
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   423
!
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   424
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   425
preferredLabelViewHeight
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   426
    ^ labelView preferredHeight "/ + (labelView margin + self verticalSpacing * 2).
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   427
!
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
   428
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   429
rowFontAscent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   430
    "returns the inset of a printable text in a row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   431
1087
8e97cbfebe12 add some comment
ca
parents: 1067
diff changeset
   432
    ^ rowFontAscent
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   433
!
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   434
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   435
selectedColIndex:newSelectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   436
    self selectedColIndexHolder value:newSelectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   437
!
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   438
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   439
selectedColIndexHolder
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   440
    selectedColIndexHolder isNil ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   441
        selectedColIndexHolder := ValueHolder new.
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   442
    ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
   443
    ^ selectedColIndexHolder
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   444
! !
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   445
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   446
!DSVColumnView methodsFor:'accessing-actions'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   447
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   448
action:aOneArgAction
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   449
    "set the action block to be performed on select"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   450
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   451
    actionBlock := aOneArgAction
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   452
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   453
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   454
doubleClickAction:aOneArgAction
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   455
    "set the action block to be performed on doubleclick"
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
    doubleClickActionBlock := aOneArgAction
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   458
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   459
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   460
rowIfAbsent:aOneArgAction
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   461
    "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
   462
     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
   463
     block returns the row which is put to the list"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   464
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   465
    rowIfAbsentBlock := aOneArgAction
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   466
!
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   467
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   468
selectConditionBlock
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   469
    "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
   470
     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
   471
     index as arg).
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   472
     The change will not be done, if the block returns false. "
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   473
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   474
    ^ selectConditionBlock
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   475
!
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   476
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   477
selectConditionBlock:aOneArgBlockOrNil
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   478
    "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
   479
     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
   480
     index as arg).
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   481
     The change will not be done, if the block returns false. "
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   482
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   483
    selectConditionBlock := aOneArgBlockOrNil.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   484
!
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
   485
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   486
tabAtEndAction:aNoneArgAction
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   487
    "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
   488
     tab next.
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 after 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
    tabAtEndAction := aNoneArgAction
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   492
!
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   493
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   494
tabAtStartAction:aNoneArgAction
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   495
    "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
   496
     tab previous.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   497
     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
   498
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
   499
    tabAtStartAction := aNoneArgAction
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   500
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   501
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   502
!DSVColumnView methodsFor:'accessing-behavior'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
   503
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   504
autoScrollToColumn
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   505
    "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
   506
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   507
    ^ autoScrollToColumn
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   508
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   509
    "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
   510
!
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
autoScrollToColumn:aBoolean
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   513
    "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
   514
     The default is true"
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   515
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   516
    autoScrollToColumn := aBoolean
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   517
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   518
    "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
   519
!
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
   520
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   521
beDependentOfRows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   522
    "make myself dependent of any row; in this case any change notification
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   523
     raised by a row is catched and the cell identified by the 'readSelector'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   524
     is redrawn. In case of a nil readSelector, the whole raw is redrawn.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   525
        -> row changed:'what'
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   526
     By default, the attribute is set to false (disabled)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   527
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   528
    ^ beDependentOfRows
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   529
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   530
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   531
beDependentOfRows:aBool
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   532
    "make myself dependent of any row; in this case any change notification
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   533
     raised by a row is catched and the cell identified by the 'readSelector'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   534
     is redrawn. In case of a nil readSelector, the whole raw is redrawn.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   535
        -> row changed:'what'
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   536
     By default, the attribute is set to false (disabled)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   537
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   538
    aBool ~~ beDependentOfRows ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   539
        beDependentOfRows := aBool.
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   540
        aBool ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   541
            self makeDependentOfRows
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   542
        ] ifFalse:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   543
            self makeIndependentOfRows
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   544
        ].
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
   545
    ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   546
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   547
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   548
enableChannel:aChannel
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   549
    enableChannel notNil ifTrue:[
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   550
        enableChannel removeDependent:self
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   551
    ].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   552
    (enableChannel := aChannel) notNil ifTrue:[
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   553
        enableChannel addDependent:self
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   554
    ].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   555
!
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
   556
5664
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   557
ignoreReselect
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   558
    "controls if clicking on an already selected item should
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   559
     be ignored or should perform the select action again.
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   560
     By default, these are ignored"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   561
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   562
    ^ ignoreReselect
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
    "Created: / 22-10-2006 / 11:01:25 / cg"
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
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   567
ignoreReselect:aBoolean
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   568
    "controls if clicking on an already selected item should
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   569
     be ignored or should perform the select action again.
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   570
     By default, these are ignored"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   571
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   572
    ignoreReselect := aBoolean
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   573
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   574
    "Created: / 22-10-2006 / 11:01:25 / cg"
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   575
!
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
   576
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   577
makeDependentOfRows
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   578
    "make myself dependent of any row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   579
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   580
    list size ~~ 0 ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   581
        list do:[:aRow |
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   582
            aRow notNil ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   583
                aRow addDependent:self
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   584
            ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   585
        ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   586
    ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   587
!
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   588
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   589
makeIndependentOfRows
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   590
    "make myself independent of any row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   591
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   592
    list size ~~ 0 ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   593
        list do:[:aRow |
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   594
            aRow notNil ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   595
                aRow removeDependent:self
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   596
            ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   597
        ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   598
    ]
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   599
!
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
   600
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   601
multipleSelectOk
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   602
    "allow/disallow multiple row selections; the default is false"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   603
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   604
    ^ multipleSelectOk
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   605
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
   606
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   607
multipleSelectOk:sBoolean
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   608
    "allow/disallow multiple row selections; the default is false"
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   609
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   610
    |colIdx rowIdx|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   611
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   612
    sBoolean == multipleSelectOk ifTrue:[^ self ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   613
    colIdx := rowIdx := 0.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   614
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   615
    self hasSelection ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   616
        colIdx := self selectedColIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   617
        rowIdx := self selectedRowIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   618
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   619
        rowIdx isSequenceable ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   620
            rowIdx := rowIdx at:1 ifAbsent:0
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   621
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   622
        self setSelectColIndex:0 rowIndex:0 openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   623
    ].
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   624
    multipleSelectOk := sBoolean.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
   625
    self selectColIndex:colIdx rowIndex:rowIdx openEditor:false.
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   626
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
   627
    "Modified (format): / 04-02-2017 / 21:31:30 / cg"
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   628
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   629
1938
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   630
opaqueColumnResize
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   631
    ^ labelView opaqueColumnResize
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   632
!
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   633
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   634
opaqueColumnResize:aBoolean
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   635
    labelView opaqueColumnResize:aBoolean
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   636
!
079c19d965c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1934
diff changeset
   637
1946
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   638
scrollWhenUpdating
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   639
    "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
   640
     (via the model or the #contents/#list)
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   641
     Possible returnValues are:
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   642
        #keep / nil     -> no change
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   643
        #endOfText      -> scroll to the end
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   644
        #beginOfText    -> scroll to the top
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   645
     The default is #beginOfText.
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   646
     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
   647
     the program (i.e. not from the user)"
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   648
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   649
    ^ scrollWhenUpdating
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   650
!
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   651
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   652
scrollWhenUpdating:aSymbolOrNil
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   653
    "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
   654
     (via the model or the #contents/#list)
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   655
     Allowed arguments are:
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   656
        #keep / nil     -> no change
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   657
        #endOfText      -> scroll to the end
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   658
        #beginOfText    -> scroll to the top
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   659
     The default is #beginOfText.
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   660
     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
   661
     the program (i.e. not from the user)"
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   662
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   663
    scrollWhenUpdating := aSymbolOrNil
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   664
!
0738b9f8c19f preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents: 1941
diff changeset
   665
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   666
selectRowOnDefault
3449
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   667
    "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
   668
     If false, nothing is selected. The default is true."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   669
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   670
    ^ selectRowOnDefault
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   671
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   672
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   673
selectRowOnDefault:aBool
3449
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
   674
    "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
   675
     If false, nothing is selected. The default is true."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   676
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   677
    selectRowOnDefault := aBool
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   678
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   679
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   680
sortListInPlace
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   681
    "when false (default for backward compatibility):
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   682
     if sorting, create a copy
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   683
     of the list, which is wrong when useIndex is on,
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   684
     as the application will get the index in the sorted
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   685
     list, which is probably different from tha apps list mode.
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   686
     When true (should be default, but that might break many
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   687
     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
   688
     sorting the application's list)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   689
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   690
    ^ sortListInPlace
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   691
!
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   692
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   693
sortListInPlace:aBoolean
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   694
    "when false (default for backward compatibility):
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   695
     if sorting, create a copy
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   696
     of the list, which is wrong when useIndex is on,
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   697
     as the application will get the index in the sorted
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   698
     list, which is probably different from tha apps list mode.
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   699
     When true (should be default, but that might break many
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   700
     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
   701
     sorting the application's list)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   702
5195
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   703
    sortListInPlace := aBoolean.
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   704
!
1d15a878af42 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5194
diff changeset
   705
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   706
tabIntern
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   707
    "returns true if tabing is supported in the widget"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   708
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   709
    ^ tabIntern
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   710
!
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   711
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   712
tabIntern:aBool
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   713
    "returns true if tabing is supported in the widget"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   714
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   715
    tabIntern := aBool ? true
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   716
!
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
   717
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   718
updateListHolderWhenSorting
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   719
    "return true if the the listHolder's value are be updated,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   720
     when I sort a list.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   721
     By default, this is false so it must be set explicitly
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   722
     (for bug-backward compatibility,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   723
     and to avoid introducing new side effects)."
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   724
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   725
    ^ updateListHolderWhenSorting
5194
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
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   728
updateListHolderWhenSorting:aBoolean
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   729
    "define if the the listHolder's value should be updated,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   730
     when I sort a list.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   731
     By default, this is false so it must be set explicitly
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   732
     (for bug-backward compatibility,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   733
     and to avoid introducing new side effects)."
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   734
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   735
    updateListHolderWhenSorting := aBoolean
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   736
!
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
   737
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   738
useIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   739
    "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
   740
     list should be sent to the model. The default is its index."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   741
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   742
    ^ useIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   743
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   744
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   745
useIndex:aBool
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   746
    "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
   747
     list should be sent to the model. The default is its index."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   748
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   749
    useIndex := aBool
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   750
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   751
5639
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   752
!DSVColumnView methodsFor:'accessing-channels'!
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   753
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   754
modifiedChannel
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   755
    ^ modifiedChannel
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
    "Created: / 30.1.2000 / 12:10:57 / cg"
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   758
!
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   759
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   760
modifiedChannel:something
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   761
    modifiedChannel := something.
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   762
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   763
    "Created: / 30.1.2000 / 12:10:57 / cg"
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   764
! !
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   765
f3534ebb5c13 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5603
diff changeset
   766
!DSVColumnView methodsFor:'accessing-color & font'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   767
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   768
backgroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   769
    "get the background color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   770
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   771
    ^ bgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   772
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   773
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   774
backgroundColor:aColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   775
    "set the background color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   776
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   777
    bgColor ~~ aColor ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   778
        super viewBackground:bgColor.
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   779
        self realized ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
   780
            bgColor := aColor onDevice:device.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   781
            self invalidate
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   782
        ] ifFalse:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   783
            bgColor := aColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   784
        ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   785
    ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   786
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   787
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   788
foregroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   789
    "return the foreground color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   790
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   791
    ^ fgColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   792
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   793
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   794
foregroundColor:aColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   795
    "set the foreground color of the rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   796
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   797
    fgColor ~~ aColor ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   798
        self realized ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
   799
            fgColor := aColor onDevice:device.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   800
            self invalidate
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   801
        ] ifFalse:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   802
            fgColor := aColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   803
        ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   804
    ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   805
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   806
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   807
labelBackgroundColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   808
    "get the background color of the label row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   809
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   810
    ^ labelBgColor ? bgColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   811
!
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   812
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   813
labelForegroundColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   814
    "get the foreground color of the label row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   815
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   816
    ^ labelFgColor ? fgColor
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   817
!
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
   818
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   819
selectionBackgroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   820
    "returns the background color of a selected row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   821
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   822
    self hasFocus ifTrue:[
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   823
        ^ selectionBackgroundColor
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   824
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   825
    ^ selectionBackgroundColorNoFocus.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   826
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   827
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   828
selectionForegroundColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   829
    "returns the foreground color of a selected row"
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   830
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   831
    self hasFocus ifTrue:[
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   832
        ^ selectionForegroundColor
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   833
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
   834
    ^ selectionForegroundColorNoFocus.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   835
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   836
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   837
selectionFrameColor
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   838
    "returns the frame color of a selected row"
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   839
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   840
    self hasFocus ifTrue:[
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   841
        ^ selectionFrameColor
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   842
    ].
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   843
    ^ selectionFrameColorNoFocus.
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   844
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   845
    "Created: / 20-01-2011 / 08:45:08 / cg"
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   846
!
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
   847
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   848
separatorDarkColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   849
    "returns the dark color used for drawing a shadowed separator (3D)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   850
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   851
    ^ shadowColor
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   852
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   853
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   854
separatorLightColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   855
    "returns the light color used for drawing a shadowed separator (3D)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   856
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   857
    ^ lightColor
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   858
!
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
separatorOneDColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   861
    "returns the color used for drawing a oneD separator"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   862
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   863
    separatorOneDColor isNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   864
        ^ fgColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   865
    ].
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   866
    ^ separatorOneDColor
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   867
!
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   868
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   869
separatorOneDColor:aColorOrNil
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   870
    "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
   871
     is nil, the current forgroundColor is used"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   872
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   873
    separatorOneDColor = aColorOrNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   874
        ^ self
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   875
    ].
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   876
    separatorOneDColor := aColorOrNil.
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   877
    self realized ifTrue:[
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   878
        separatorOneDColor notNil ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
   879
            separatorOneDColor := separatorOneDColor onDevice:device.
2637
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   880
        ].
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   881
        self invalidate.
d563163414b8 add color for drawing separators in OneD mode
ca
parents: 2636
diff changeset
   882
    ].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   883
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
   884
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
   885
!DSVColumnView methodsFor:'accessing-columns'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   886
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   887
columnAt:anIndex
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   888
    <resource: #obsolete>
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   889
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   890
    "returns the column at an index"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   891
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   892
    self obsoleteMethodWarning:'use columnDescriptorAt:'.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   893
    ^ self columnDescriptorAt:anIndex
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   894
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   895
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   896
columnDescriptorAt:anIndex
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
   897
    "returns the columnDescriptor at an index"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   898
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
   899
    ^ columnDescriptors at:anIndex ifAbsent:nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   900
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   901
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   902
columnDescriptors
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   903
    "returns list of column descriptors"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   904
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   905
    ^ columnDescriptors collect:[:aCol | aCol description ]
886
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   906
!
57bd1eddba23 catch empty line in redraw
ca
parents: 874
diff changeset
   907
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   908
columnDescriptors:aColumnDescriptionList
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   909
    "set the columnDescriptors;
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   910
     scroll to top and deselect"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   911
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   912
    self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:true
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   913
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   914
    "Modified: / 13-09-2017 / 15:05:05 / cg"
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   915
!
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   916
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   917
columnDescriptors:aColumnDescriptionList deselect:deselect scrollToTop:scrollToTop
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   918
    "set the columnDescriptors;
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   919
     if deselect is true, then deselect;
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   920
     if scrollToTop is true, then scroll to top;
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   921
     otherwise, take the current selection and try to make it visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   922
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   923
    |delta indexOfFirstRow|
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   924
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   925
    deselect ifTrue:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   926
        self deselect.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   927
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   928
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   929
    (viewOrigin x ~~ 0 or:[ viewOrigin y ~~ 0 ]) ifTrue:[
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   930
        scrollToTop ifTrue:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   931
            delta := viewOrigin negated.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   932
            viewOrigin := 0 @ 0.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   933
            self originChanged:delta
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   934
        ] ifFalse:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   935
            indexOfFirstRow := self yVisibleToRowNr:0.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   936
        ].
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
    self setColumnDescriptors:aColumnDescriptionList.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   939
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   940
    indexOfFirstRow notNil ifTrue:[
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   941
        self scrollToRowAt:indexOfFirstRow colAt:1.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   942
    ].
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   943
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   944
    "Created: / 13-09-2017 / 15:04:50 / cg"
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
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   947
columnDescriptors:aColumnDescriptionList scrollToTop:scrollToTop
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   948
    "set the columnDescriptors and deselect;
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   949
     if scrollToTop is true, then scroll to top;
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   950
     otherwise, take the current selection and try to make it visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   951
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   952
    self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:scrollToTop
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   953
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
   954
    "Created: / 13-09-2017 / 15:03:15 / cg"
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   955
!
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   956
2703
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   957
dataSetColumns
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   958
    "returns the list of DataSetColumns; each column represents a DataSetColumnSpec"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   959
2703
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   960
    ^ columnDescriptors
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   961
!
252b881f86ad added accessor #dataSetColumns
james
parents: 2702
diff changeset
   962
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   963
firstColumn
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   964
    "returns the first column"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   965
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   966
    ^ columnDescriptors at:1
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   967
!
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   968
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   969
lastColumn
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
   970
    "returns the last column"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   971
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   972
    ^ columnDescriptors last
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   973
!
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   974
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   975
setColumnDescriptors:aColumnDescriptionList
5310
8b7aff55b666 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5308
diff changeset
   976
    "set the columnDescriptors; don't deselect and do not scroll to top"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   977
2154
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   978
    |cid|
cb22be939082 split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents: 2152
diff changeset
   979
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   980
    cid := 0.
3536
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   981
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   982
    aColumnDescriptionList isEmptyOrNil ifTrue:[
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   983
        columnDescriptors := OrderedCollection new.
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   984
    ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   985
        columnDescriptors := aColumnDescriptionList
3536
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   986
            collect:
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   987
                [:el||dsc lbl|
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
   988
                    dsc := el isSequenceable
3536
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   989
                                ifTrue:[DataSetColumnSpec decodeFromLiteralArray:el]
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   990
                                ifFalse:[el].
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   991
                    cid := cid + 1.
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   992
                    lbl := DataSetLabel new description:dsc builder:builder on:labelView.
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   993
                    DataSetColumn new on:self description:dsc columnNumber:cid label:lbl
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   994
                ].
3afcdcca3101 bugfix: setColumnDescriptors:
ca
parents: 3519
diff changeset
   995
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   996
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
   997
    cachedPreferredExtent := nil.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
   998
    labelView columns:columnDescriptors.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   999
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  1000
    self fitColumns.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  1001
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  1002
    "Modified: / 07-01-2012 / 16:46:59 / cg"
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1003
    "Modified (format): / 13-09-2017 / 15:04:01 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1004
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1005
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1006
!DSVColumnView methodsFor:'accessing-interactors'!
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1007
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1008
checkToggleActiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1009
    ^ checkToggleActiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1010
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1011
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1012
checkToggleExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1013
    "returns the extent of a checkToggle"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1014
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1015
    ^ checkToggleExtent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1016
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1017
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1018
checkToggleForm
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1019
    "returns the form of a checkToggle"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1020
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1021
    ^ checkToggleForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1022
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1023
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1024
checkToggleLevel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1025
    "returns the level of a checkToggle button"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1026
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1027
    ^ checkToggleLevel
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1028
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1029
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1030
checkTogglePassiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1031
    ^ checkTogglePassiveImage
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1032
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  1033
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1034
comboButtonExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1035
    "returns the extent of a comboList or -Box"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1036
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1037
    ^ comboButtonExtent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1038
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1039
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1040
comboButtonForm
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1041
    "returns the form of a comboList or -Box"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1042
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1043
    ^ comboButtonForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1044
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1045
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1046
comboButtonLevel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1047
    "returns the level of a comboList or -Box button"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1048
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1049
    ^ comboButtonLevel
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1050
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1051
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1052
radioButtonExtent
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1053
    "returns the extent of a radio button"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1054
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1055
    ^ radioButtonActiveImage extent
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1056
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1057
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1058
rowSelectorExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1059
    "returns the bitmap of a selected row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1060
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1061
    ^ rowSelectorForm extent
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1062
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1063
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1064
rowSelectorForm
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  1065
    "returns the (arrow-) image shown for a selected row.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1066
     (the arrow shown in the first column)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1067
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1068
    ^ rowSelectorForm
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1069
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  1070
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1071
!DSVColumnView methodsFor:'accessing-mvc'!
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1072
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1073
columnAdaptor
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1074
    "return the value of the instance variable 'columnAdaptor' (automatically generated)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1075
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1076
    columnAdaptor isValueModel ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1077
        ^ columnAdaptor value
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1078
    ].
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1079
    ^ columnAdaptor
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1080
!
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1081
5969
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  1082
columnAdaptor:usuallyAnApplication
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1083
    "set the value of the instance variable 'columnAdaptor' (automatically generated)"
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1084
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1085
    columnAdaptor isValueModel ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1086
        columnAdaptor removeDependent:self
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1087
    ].
5969
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  1088
    (columnAdaptor := usuallyAnApplication) isValueModel ifTrue:[
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1089
        columnAdaptor addDependent:self
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1090
    ].
5969
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  1091
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  1092
    "Modified (format): / 21-11-2018 / 19:32:57 / Claus Gittinger"
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1093
!
1008
7874385db982 changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents: 991
diff changeset
  1094
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1095
columnHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1096
    "get the valueHolder, which keeps the list of column descriptions"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1097
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1098
    ^ columnHolder
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1099
!
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1100
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1101
columnHolder:aValueHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1102
    "set the valueHolder, which keeps the list of column descriptions"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1103
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1104
    |columns|
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1105
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1106
    columnHolder notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1107
        columnHolder removeDependent:self
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1108
    ].
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1109
    (columnHolder := aValueHolder) notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1110
        columnHolder addDependent:self.
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1111
        columns := columnHolder value.
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1112
        columns notNil ifTrue:[
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1113
            self columnDescriptors:columns
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1114
        ]
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1115
    ].
1487
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
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1118
listAt:index put:newElement
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1119
    "kludge callback, when an element hs to be replaced
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1120
     due to a col-adaptor returning a new row element"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1121
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1122
    |list|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1123
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1124
    (list := listHolder value) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1125
        list at:index put:newElement
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1126
    ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1127
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1128
2318
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1129
listHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1130
    "get the valueHolder which holds the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1131
2318
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1132
    ^ listHolder
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1133
!
41a4297a87af access method for the listHolder
ca
parents: 2276
diff changeset
  1134
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1135
listHolder:aListHolder
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1136
    "set the valueHolder which holds the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1137
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1138
    listHolder ~~ aListHolder ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1139
        listHolder notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1140
            listHolder removeDependent:self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1141
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1142
        (listHolder := aListHolder) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1143
            listHolder addDependent:self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1144
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1145
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1146
    self pushEvent:#list: with:(listHolder value).
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
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1149
model:aModel
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1150
    "set the valueHolder which holds the selection and maybe the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1151
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1152
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1153
        model removeDependent:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1154
        (model respondsTo:#list) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1155
            (model list == listHolder) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1156
                self listHolder:nil
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1157
            ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1158
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1159
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1160
    (model := aModel) notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1161
        model addDependent:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1162
        (aModel respondsTo:#list) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1163
            self listHolder:model list
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1164
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1165
    ]
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1166
! !
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1167
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1168
!DSVColumnView methodsFor:'accessing-rows'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1169
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1170
at:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1171
    "return the row at an index, aRowNr"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1172
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1173
    |row|
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1174
3994
f44c9cded11e changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3993
diff changeset
  1175
    list isNil ifTrue:[^ nil].
3757
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  1176
    (row := list at:aRowNr ifAbsent:nil) isNil ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1177
        lockRowIndex := aRowNr.
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1178
1034
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  1179
        (rowIfAbsentBlock notNil
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  1180
        and:[(row := rowIfAbsentBlock value:aRowNr) notNil]) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1181
            list at:aRowNr put:row.
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1182
            beDependentOfRows ifTrue:[row addDependent:self].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1183
        ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1184
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1185
        lockRowIndex := 0
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1186
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1187
    ^ row
1034
bd02c4cd7582 care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents: 1023
diff changeset
  1188
3994
f44c9cded11e changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3993
diff changeset
  1189
    "Modified: / 22-01-2011 / 09:14:48 / cg"
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 ifAbsent:exceptionBlock
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1193
    "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
  1194
     result of evaluating the exceptionblock"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1195
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1196
    (aRowNr between:1 and:list size) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1197
        ^ self at:aRowNr
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1198
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1199
    ^ exceptionBlock value
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1200
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1201
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1202
at:aRowNr put:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1203
    "change the row at an index. The added row is returned"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1204
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1205
    lockRowIndex ~~ aRowNr ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1206
        (aRowNr <= list size and:[ (list at:aRowNr) == aRow ]) ifTrue:[
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1207
            self invalidateRowAt:aRowNr
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1208
        ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1209
            self
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1210
                replaceFrom:aRowNr
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1211
                to:aRowNr
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1212
                with:(Array with:aRow)
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1213
                startingAt:1.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1214
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1215
    ].
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1216
    ^ aRow
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1217
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1218
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1219
first
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1220
    "return the first row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1221
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1222
    ^ self at:1
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1223
!
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1224
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1225
identityIndexOfRow:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1226
    "returns index of a row or 0"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1227
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1228
    (list size ~~ 0 and:[ aRow notNil ]) ifTrue:[
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1229
        ^ list identityIndexOf:aRow
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1230
    ].
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1231
    ^ 0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1232
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1233
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1234
last
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1235
    "return the last row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1236
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1237
    ^ self at:(list size)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1238
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1239
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1240
list
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1241
    "get the list of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1242
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1243
    ^ list
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1244
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1245
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1246
list:aRawList
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1247
    "set the list of rows"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1248
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1249
    |newList selectionHasChanged sortColNr sortSelectorOrBlock sortBlockSelector sortBlock|
656
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
  1250
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1251
    "/ remove selection without redraw
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1252
1259
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1253
    selectionHasChanged := self hasSelection.
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1254
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  1255
    self destroyEditView.
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1256
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  1257
    self selectedColIndex:0.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1258
    selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1259
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1260
    shown ifFalse:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1261
        cachedPreferredExtent := nil
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1262
    ] ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1263
        aRawList size == 0 ifTrue:[
2834
edddf1a3c2ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2816
diff changeset
  1264
            "/ keep old column-width information
edddf1a3c2ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2816
diff changeset
  1265
        ] ifFalse:[
2524
a41c43dba6c9 care for nil colDescr.
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
  1266
            columnDescriptors notNil ifTrue:[
a41c43dba6c9 care for nil colDescr.
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
  1267
                columnDescriptors do:[:aCol| aCol invalidate ].
a41c43dba6c9 care for nil colDescr.
Claus Gittinger <cg@exept.de>
parents: 2523
diff changeset
  1268
            ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1269
            cachedPreferredExtent := nil.
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1270
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1271
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1272
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1273
    beDependentOfRows ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1274
        self makeIndependentOfRows
656
96a9b94e5472 bugfix:
ca
parents: 649
diff changeset
  1275
    ].
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  1276
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1277
    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
  1278
        list := nil.
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1279
        viewOrigin := 0 @ 0.
2834
edddf1a3c2ea *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2816
diff changeset
  1280
    ] ifFalse:[
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1281
        "/ list := OrderedCollection withAll:aRawList.
4613
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1282
        sortListInPlace ifTrue:[
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1283
            newList := aRawList
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1284
        ] ifFalse:[
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1285
            newList := aRawList copyAsOrderedCollection.
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  1286
        ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1287
        (sortColNr := labelView indexOfSortColumn) notNil ifTrue:[
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1288
            sortBlockSelector := (columnDescriptors at:sortColNr) sortBlockSelector.
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1289
            sortBlockSelector notNil ifTrue:[
3964
df77ea0f171d changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1290
                sortBlock := self application aspectFor:sortBlockSelector.
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1291
                newList sort:sortBlock
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1292
            ] ifFalse:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1293
                sortSelectorOrBlock := (columnDescriptors at:sortColNr) sortSelector.
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1294
                sortSelectorOrBlock notNil ifTrue:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1295
                    sortSelectorOrBlock isBlock ifTrue:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1296
                        newList sort:sortSelectorOrBlock
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1297
                    ] ifFalse:[
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1298
                        newList sort:[:a :b | (a perform:sortSelectorOrBlock) < (b perform:sortSelectorOrBlock)]
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1299
                    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1300
                ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1301
            ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1302
            labelView reverseSort ifTrue:[
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1303
                newList reverse.
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1304
            ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1305
        ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1306
        list := newList.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1307
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1308
        sortListInPlace ifFalse:[
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1309
            listHolder notNil ifTrue:[
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1310
                updateListHolderWhenSorting ifTrue:[
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1311
                    listHolder value:newList withoutNotifying:self.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1312
                ].
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1313
            ].
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  1314
        ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1315
2836
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1316
        beDependentOfRows ifTrue:[
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1317
            self makeDependentOfRows
5989b6c71e87 code cleanup
Claus Gittinger <cg@exept.de>
parents: 2835
diff changeset
  1318
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1319
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1320
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  1321
    shown ifTrue:[
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  1322
        self fitColumns
1949
0d9451776275 delayed fitColumns if not shown while list is changed.
ps
parents: 1948
diff changeset
  1323
    ] ifFalse:[
0d9451776275 delayed fitColumns if not shown while list is changed.
ps
parents: 1948
diff changeset
  1324
        needFitColumns := true
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1325
    ].
1259
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1326
    selectionHasChanged ifTrue:[
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1327
        self selectionChanged.
be271bf31e4b raise selectionChanged notification in case that
tm
parents: 1258
diff changeset
  1328
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1329
    cachedPreferredExtent := nil.
2044
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1330
    self contentsChanged.
3897
3c7724395afc changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3855
diff changeset
  1331
3964
df77ea0f171d changed: #list:
Claus Gittinger <cg@exept.de>
parents: 3962
diff changeset
  1332
    "Modified: / 08-11-2010 / 22:07:49 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1333
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1334
1818
fe99c5c721e9 category changes
Claus Gittinger <cg@exept.de>
parents: 1809
diff changeset
  1335
!DSVColumnView methodsFor:'accessing-visibility'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1336
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1337
font:aFont
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1338
    "set the font for all shown rows."
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1339
    |newGCFont|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1340
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1341
    (aFont isNil or:[aFont = self font]) ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1342
        ^ self
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1343
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1344
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1345
    columnDescriptors isEmptyOrNil ifTrue:[
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  1346
        super font:aFont.
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1347
        self labelView font:aFont.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1348
        rowFontAscent := self font ascent.
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1349
        rowHeight     := verticalSpacing + (self font height) + verticalSpacing + separatorSize.
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1350
        minRowHeight  := rowHeight.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1351
        ^ self
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1352
    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1353
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1354
    "/ close current editor if open
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1355
    self destroyEditView.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1356
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1357
    newGCFont := aFont.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1358
    realized ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1359
        |visibleColumns font oldSize newSize factor minimum|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1360
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1361
        newGCFont := aFont onDevice:self graphicsDevice.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1362
        factor := (newGCFont height / gc font height) asFloat.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1363
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1364
        minimum := self separatorSize + (2 * self horizontalSpacing).
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1365
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1366
        factor = 1 ifFalse:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1367
            "/ there are columns which are more or less invisible (exlude rowSelector)
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1368
            visibleColumns := columnDescriptors select:[:eachColumn|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1369
                (eachColumn rendererType ~~ #rowSelector and:[eachColumn width > minimum])
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1370
            ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1371
        ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1372
        visibleColumns notEmptyOrNil ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1373
            factor < 1 ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1374
                "/ check if zoomOut is allowed
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1375
                visibleColumns do:[: eachColumn|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1376
                    (eachColumn width * factor) > (minimum+1) ifFalse:[^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1377
                ].
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1378
            ].
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1379
            visibleColumns do:[:eachColumn|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1380
                eachColumn setDescWidth:(eachColumn width * factor) rounded.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1381
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1382
                font := eachColumn label font.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1383
                font notNil ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1384
                    font sizeUnit ~~ #px ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1385
                        oldSize := font size.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1386
                        newSize := (oldSize * factor) rounded.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1387
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1388
                        (newSize ~= oldSize and:[newSize >= 4]) ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1389
                            font := font asSize:newSize.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1390
                            font notNil ifTrue:[eachColumn label font:font].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1391
                        ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1392
                    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1393
                ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1394
            ].
1842
402a364ee001 delegate font to labelView
martin
parents: 1818
diff changeset
  1395
        ].
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1396
    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1397
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1398
    super font:newGCFont.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1399
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1400
    rowFontAscent := self font ascent.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1401
    rowHeight     := verticalSpacing + self font height + verticalSpacing + separatorSize.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1402
    minRowHeight  := rowHeight.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1403
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1404
    columnDescriptors do:[:eachColumn| eachColumn invalidate].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1405
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1406
    labelView font:self font.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1407
    self labelView fontChanged.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1408
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1409
    cachedPreferredExtent := nil.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1410
    viewOrigin := 0 @ 0.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1411
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1412
    realized ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1413
        self fitColumns.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1414
        superView recomputeLayouts.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1415
        self invalidate.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1416
        self labelView invalidate.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1417
        self contentsChanged.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1418
        self makeSelectionVisible.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  1419
    ].
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1420
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  1421
    "Modified (format): / 13-09-2017 / 15:34:22 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1422
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1423
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1424
has3Dseparators
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1425
    "returns true if shown in 3D mode"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1426
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1427
    ^ separatorSize ~~ 1
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1428
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1429
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1430
has3Dseparators:aBool
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1431
    "enable or disable 3D mode"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1432
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1433
    |newSepSize|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1434
3672
ff861e62db1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
  1435
    newSepSize := aBool ifTrue:[2] ifFalse:[1].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1436
    newSepSize ~~ separatorSize ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1437
        separatorSize := newSepSize.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1438
        realized ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1439
            columnDescriptors do:[:aCol |
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1440
                aCol invalidate
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1441
            ].
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  1442
            self preferredExtentChanged.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1443
            self invalidate.
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  1444
            self contentsChanged
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  1445
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1446
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1447
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1448
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1449
horizontalSpacing
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1450
    "horizontal spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1451
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1452
    ^ horizontalSpacing
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1453
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1454
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1455
horizontalSpacing:aNumber
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1456
    "horizontal spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1457
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1458
    horizontalSpacing ~~ aNumber ifTrue:[
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1459
        horizontalSpacing := aNumber.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1460
        self preferredExtentChanged.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1461
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1462
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1463
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1464
showLabels
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1465
    "control the labels view to be visible or unvisible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1466
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1467
    ^ labelView isVisible
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1468
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1469
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1470
showLabels:aBoolean
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1471
    "control the labels view to be visible or unvisible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1472
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1473
    labelView isVisible:aBoolean
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1474
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  1475
    "Modified (format): / 04-02-2017 / 21:31:43 / cg"
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1476
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1477
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1478
verticalSpacing
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1479
    "vertical spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1480
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1481
    ^ verticalSpacing
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1482
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1483
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1484
verticalSpacing:aNumber
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1485
    "vertical spacing used by columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1486
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1487
    verticalSpacing ~~ aNumber ifTrue:[
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1488
        verticalSpacing := aNumber.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1489
        self preferredExtentChanged.
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  1490
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1491
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1492
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1493
!DSVColumnView methodsFor:'adding & removing rows'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1494
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1495
add:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1496
    "insert row at end"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1497
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1498
    ^ self add:aRow beforeIndex:(1 + list size)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1499
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1500
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1501
add:aRow afterIndex:aRowNr
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1502
    "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
  1503
     of an invalid index or the row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1504
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1505
    ^ self add:aRow beforeIndex:(aRowNr + 1)
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1506
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1507
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1508
add:aRow beforeIndex:aRowNr
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1509
    "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
  1510
     of an invalid index or the row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1511
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1512
    self addAll:(Array with:aRow) beforeIndex:aRowNr.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1513
    ^ aRow.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1514
!
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1515
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1516
addAll:aList beforeIndex:start
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1517
    "add a collection of rows before slot start and redisplay"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1518
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1519
    |y0 y1 yD h dH size noSel|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1520
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1521
    (size := aList size) == 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1522
        ^ self
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1523
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1524
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1525
    beDependentOfRows ifTrue:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1526
        aList do:[:aRow| aRow notNil ifTrue:[aRow addDependent:self]]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1527
    ].
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1528
4116
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1529
    list isNil ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1530
        self list:aList.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1531
    ] ifFalse:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1532
        noSel := self numberOfSelections.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1533
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1534
        noSel ~~ 0 ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1535
            multipleSelectOk ifFalse:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1536
                selectedRowIndex >= start ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1537
                    selectedRowIndex := selectedRowIndex + size
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1538
                ]
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1539
            ] ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1540
                1 to:noSel do:[:i||v|
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1541
                    (v := selectedRowIndex at:i) >= start ifTrue:[
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1542
                        selectedRowIndex at:i put:(v + size)
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1543
                    ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1544
                ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1545
            ]
4116
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1546
        ].
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1547
        list addAll:aList beforeIndex:start.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1548
    ].
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  1549
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1550
    self recomputeHeightOfContents.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1551
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1552
    y0 := (start - 1) * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1553
    yD := size * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1554
    y1 := y0 + yD.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1555
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1556
    y0 < viewOrigin y ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1557
        self originWillChange.
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1558
        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
  1559
        "/ viewOrigin y:(yD + viewOrigin y).
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1560
        self originChanged:(0 @ yD).
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1561
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1562
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1563
    (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
  1564
        self invalidate.
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1565
        self contentsChanged.
8e36106065f0 fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents: 2032
diff changeset
  1566
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1567
    ].
645
53c78cc2ee08 redraw twice in case of expose event during adding a new entry
ca
parents: 643
diff changeset
  1568
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1569
    y0 := self yVisibleOfRowNr:start.
1258
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1570
    h  := height - margin.
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1571
    y1 := y0 + yD min:h.
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1572
d41cbd2c3dc8 addAll:...
tm
parents: 1227
diff changeset
  1573
    (y1 > margin and:[y0 < h]) ifTrue:[
1952
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1574
        "/ cg: if I have a non-solid background color,
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1575
        "/ or individual items have a bgColor selector,
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1576
        "/ invalidate the area (and readraw) instead of a scroll.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1577
        (viewBackground isImageOrForm
1952
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1578
        or:[ self anyColumnHasPotentialNonConstantBackground ])
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1579
        ifTrue:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1580
            "/ do not scroll but invalidate ...
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1581
            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
  1582
        ] ifFalse:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1583
            h  := h - y1.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1584
            y0 := y0 max:margin.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1585
            dH := y1 - y0.
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1586
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1587
            start == list size ifFalse:[
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1588
                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
  1589
            ].
1da01418012a if any col has potential non-constant background,
ps
parents: 1951
diff changeset
  1590
            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
  1591
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1592
    ].
3478
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1593
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1594
    self contentsChanged.
3478
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1595
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1596
    (scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1597
        self scrollToBottom.
85c3eb472b36 scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents: 3458
diff changeset
  1598
    ].
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  1599
!
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  1600
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1601
addFirst:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1602
    "insert a row at start"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1603
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1604
    ^ self add:aRow beforeIndex:1
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1605
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1606
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1607
remove:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1608
    "remove a row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1609
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1610
    |idx|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1611
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1612
    idx := list identityIndexOf:aRow.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1613
    idx ~~ 0 ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1614
        self removeFrom:idx to:idx.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1615
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1616
    ^ aRow
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1617
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1618
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1619
removeFirst
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1620
    "remove first row; returns the removed row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1621
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  1622
    ^ self removeIndex:1
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1623
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1624
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1625
removeFrom:startIndex to:stopIndex
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1626
    "remove rows from start to stop"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1627
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1628
    |coll noRedraw
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1629
     noSel "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1630
     size  "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1631
     start "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1632
     stop  "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1633
     y0    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1634
     y1    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1635
     oY    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1636
     dY    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1637
     yB    "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1638
     h     "{ Class: SmallInteger }"
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1639
    |
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1640
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1641
    (    (start := startIndex) < 1
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1642
     or:[(stop := stopIndex) > list size]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1643
    ) ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1644
        ^ self subscriptBoundsError:start
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  1645
    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1646
    size := stop - start + 1.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1647
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1648
    beDependentOfRows ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1649
        list from:start to:stop do:[:r| r notNil ifTrue:[r removeDependent:self]].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1650
    ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1651
    noSel := self numberOfSelections.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1652
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1653
    noSel ~~ 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1654
        noSel == 1 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1655
            noSel := self firstIndexSelected.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1656
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1657
            noSel < start ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1658
                noSel > stop ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1659
                    noSel := noSel - size.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1660
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1661
                    multipleSelectOk ifFalse:[selectedRowIndex := noSel]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1662
                                      ifTrue:[selectedRowIndex at:1 put:noSel]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1663
                ] ifFalse:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1664
                    editValue notNil ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1665
                        editValue removeDependent:self.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1666
                        editValue := nil.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1667
                    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1668
                    self deselect.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  1669
                ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1670
            ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  1671
        ] ifFalse:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1672
            coll := OrderedCollection new:noSel.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1673
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1674
            selectedRowIndex do:[:i|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1675
                i < start ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1676
                    coll add:i
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1677
                ] ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1678
                    i > stop ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1679
                        coll add:(i - size)
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1680
                    ]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1681
                ]
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1682
            ].
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1683
            coll size == 0 ifTrue:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1684
                self deselect
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1685
            ] ifFalse:[
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1686
                selectedRowIndex := coll
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1687
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1688
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1689
    ].
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1690
    list removeFrom:start to:stop.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1691
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1692
    y0 := (start - 1) * rowHeight.
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1693
    dY := size * rowHeight.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1694
    y1 := dY + y0.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1695
    yB := y1 + margin - viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1696
    self recomputeHeightOfContents.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1697
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1698
    y0 < (oY := viewOrigin y) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1699
        (noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY]
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1700
                                ifTrue:[dY := dY negated].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1701
        self originWillChange.
1948
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  1702
        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
  1703
        "/ viewOrigin y:(dY + oY).
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1704
        self originChanged:(0 @ dY).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1705
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1706
        noRedraw := y0 > (height + viewOrigin y)
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1707
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1708
1483
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1709
    (shown not or:[self sensor hasDamageFor:self]) ifTrue:[
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1710
          self invalidate.
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1711
        ^ self contentsChanged.
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1712
    ].
c9fd1b1d775d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1480
diff changeset
  1713
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1714
    (noRedraw or:[shown not]) ifFalse:[
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1715
        y0 := self yVisibleOfRowNr:start.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1716
        y0 := y0 max:margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1717
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1718
        "/ cg: if I have a non-solid background color,
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1719
        "/ or individual items have a bgColor selector,
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1720
        "/ invalidate the area (and readraw) instead of a scroll.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1721
        (viewBackground isImageOrForm
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1722
        or:[ self anyColumnHasPotentialNonConstantBackground ])
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1723
        ifTrue:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1724
            "/ do not scroll but invalidate ...
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1725
        ] ifFalse:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1726
            y1 := yB.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1727
            h  := height - margin - yB.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1728
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1729
            h > 0 ifTrue:[
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1730
                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
  1731
            ].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  1732
            y0 := y0 + h.
561
43b62e424d52 check height is positive before copy
ca
parents: 556
diff changeset
  1733
        ].
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  1734
        self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1735
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1736
    self contentsChanged.
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1737
!
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1738
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1739
removeIndex:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1740
    "remove row at an index; returns the removed row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1741
861
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1742
    |row|
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1743
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1744
    row := list at:aRowNr ifAbsent:nil.
a227a3ca27e7 bug fix in multi selection
ca
parents: 859
diff changeset
  1745
    self removeFrom:aRowNr to:aRowNr.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1746
    ^ row
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1747
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1748
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1749
removeLast
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1750
    "remove last row; the row is returned"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1751
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  1752
    ^ self removeIndex:(list size)
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1753
!
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1754
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1755
replaceFrom:start to:stop with:aCollection startingAt:repStart
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1756
    "replace elements in the receiver between index start and stop,
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1757
     with elements  taken from replacementCollection starting at repStart.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1758
     Return the receiver."
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1759
2032
6eb610caad85 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2031
diff changeset
  1760
    |inSelList listSize repStop run|
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1761
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1762
    inSelList := OrderedCollection new.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1763
    listSize  := list size.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1764
    repStop   := repStart + (stop - start).
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1765
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1766
    list isNil ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1767
        list := OrderedCollection new
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1768
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1769
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1770
    [listSize < stop] whileTrue:[ list add:nil. listSize := listSize + 1 ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1771
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1772
    start to:stop do:[:i| |aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1773
        aRow := list at:i ifAbsent:nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1774
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1775
        aRow notNil ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1776
            beDependentOfRows ifTrue:[aRow removeDependent:self].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1777
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1778
            (self isInSelection:i) ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1779
                inSelList add:i
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1780
            ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1781
            list at:i put:nil.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1782
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1783
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1784
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1785
    beDependentOfRows ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1786
        aCollection from:repStart to:repStop do:[:aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1787
            aRow notNil ifTrue:[aRow addDependent:self]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1788
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1789
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1790
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1791
    run := start.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1792
    aCollection from:repStart to:repStop do:[:aRow|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1793
        list at:run put:aRow.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1794
        run := run + 1.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1795
    ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1796
    self invalidateRowsFrom:start to:stop.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1797
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1798
    inSelList size ~~ 0 ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1799
        self numberOfSelections == inSelList size ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1800
            self deselect
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1801
        ] ifFalse:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1802
            selectedRowIndex := selectedRowIndex select:[:i| (inSelList identityIndexOf:i) == 0 ].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1803
            self selectionChanged.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1804
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  1805
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1806
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1807
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1808
!DSVColumnView methodsFor:'change & update'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  1809
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1810
changeWidthOfColumn:aColumn deltaX:aDeltaX
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1811
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1812
    aColumn setDescWidth:(aColumn width + aDeltaX).
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1813
    cachedPreferredExtent notNil ifTrue:[self fitColumns]
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1814
!
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  1815
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1816
update:what with:aPara from:chgObj
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1817
    "one of my rows/cells changed its value"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1818
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1819
    |row listHoldersList arg1 arg2 col|
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1820
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1821
    chgObj == columnHolder ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1822
        cachedPreferredExtent := nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1823
        self columnDescriptors:(columnHolder value).
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1824
        ^ self.
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1825
    ].
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1826
    chgObj == columnAdaptor ifTrue:[
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1827
        col := columnAdaptor value.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1828
        columnDescriptors do:[:aCol |
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1829
            aCol columnAdaptor:col
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1830
        ].
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1831
        self invalidate.
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1832
        ^ self
1711
97e1fd579b89 columnAdapter can now be a valueHolder
ca
parents: 1673
diff changeset
  1833
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1834
    chgObj == editValue ifTrue:[
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1835
        self updateColumnFromEditValue.
1227
2dd18061afc5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1223
diff changeset
  1836
        ^ self
622
2588f809445d update:with:from:
ca
parents: 618
diff changeset
  1837
    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1838
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1839
    chgObj == model ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1840
        (what == #selectionIndex or:[ what == #selection ]) ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1841
            self selectRowIndex:(model selectionIndex copy).
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1842
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1843
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1844
        what == #list ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1845
            cachedPreferredExtent := nil.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1846
            self listHolder:model list.
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1847
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1848
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1849
        what == #value ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1850
            model == listHolder ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1851
                cachedPreferredExtent := nil.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1852
                self list:(listHolder value)
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1853
            ] ifFalse:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1854
                useIndex ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1855
                    self selectRowIndex:model value
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1856
                ] ifFalse:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1857
                    |newSel|
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1858
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1859
                    multipleSelectOk ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1860
                        newSel := (model value ? #()) collect:[:each | self list indexOf:each]
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1861
                    ] ifFalse:[
5719
d53bae9fd8b2 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5718
diff changeset
  1862
                        newSel := (self list ? #()) indexOf:model value
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1863
                    ].
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1864
                    self selectRowIndex:newSel
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  1865
                ].
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1866
            ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1867
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1868
        ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1869
    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1870
4219
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  1871
    (chgObj == listHolder) ifTrue:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1872
        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
  1873
        listHoldersList := listHolder value.
4219
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  1874
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1875
        what == #value ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1876
            self list:listHoldersList.
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
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
        aPara isCollection ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1880
            arg1 := aPara at:1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1881
            arg2 := aPara at:2.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1882
        ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1883
            arg1 := arg2 := aPara
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1884
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1885
        what == #at: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1886
            self at:arg1 put:(listHoldersList at:arg1).
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1887
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1888
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1889
        what == #insert: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1890
            self add:(listHoldersList at:arg1) beforeIndex:arg1.
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1891
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1892
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1893
        what == #remove: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1894
            self removeFrom:arg1 to:arg1.
2776
73715c613579 *** empty log message ***
penk
parents: 2733
diff changeset
  1895
            ^ self.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1896
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1897
        what == #removeFrom: ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1898
            listHoldersList size == 0 ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1899
                self list:nil
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1900
            ] ifFalse:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1901
                self removeFrom:arg1 to:arg2
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1902
            ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1903
            ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1904
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1905
        what == #insertCollection: ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1906
            arg2 ~~ 0 ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1907
                self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1))
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1908
                    beforeIndex:arg1
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1909
            ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1910
            ^ self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1911
        ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1912
        what == #replace: ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1913
            self
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1914
                replaceFrom:arg1 to:arg2
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1915
                with:listHoldersList startingAt:arg1.
2537
cf1b9b6eeb41 change update:with:from: - ask cg
penk
parents: 2535
diff changeset
  1916
            ^ self
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1917
        ].
2537
cf1b9b6eeb41 change update:with:from: - ask cg
penk
parents: 2535
diff changeset
  1918
        self list:listHoldersList.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1919
        ^ self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  1920
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  1921
1593
2188ae28557e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1565
diff changeset
  1922
    arg1 := aPara ? what.
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  1923
    row := (what isNumber) ifTrue:[what] ifFalse:[chgObj].
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  1924
    self invalidateVisibleRow:row readSelector:arg1.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1925
    editView notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1926
        (self isInSelection:(self identityIndexOfRow:row)) ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1927
            self updateEditorFromChangedRow
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1928
        ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1929
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1930
5719
d53bae9fd8b2 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5718
diff changeset
  1931
    "Modified: / 30-01-2000 / 12:16:49 / cg"
d53bae9fd8b2 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 5718
diff changeset
  1932
    "Modified: / 08-03-2018 / 18:06:19 / stefan"
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1933
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1934
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1935
updateColumnFromEditValue
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1936
    |editValueBefore firstSelectedIndex newValue realValue col|
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1937
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1938
    editValueBefore := editValue.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1939
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1940
    firstSelectedIndex := self firstIndexSelected.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1941
    newValue := editValue value.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1942
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1943
    col := self selectedColumn.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1944
    col at:firstSelectedIndex put:newValue.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1945
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1946
    col editorType == #RadioButton ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1947
        "/ turn off the other column
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1948
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1949
        1 to:list size do:[:rowNr |
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1950
            rowNr ~~ firstSelectedIndex ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1951
                (col at:rowNr) ~~ false ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1952
                    col at:rowNr put:false.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1953
                    self invalidateRowAt:rowNr colAt:col columnNumber.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1954
                ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1955
            ]
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1956
        ]
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1957
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1958
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1959
    realValue := col at:firstSelectedIndex.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1960
    (realValue ~= newValue) ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1961
        "/ some validation by the row-object; the stored value
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1962
        "/ is different from what I think.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1963
        "/ update my input fields modelValue
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1964
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1965
        "/ just in case someone nilled or changed the editValue
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1966
        "/ 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
  1967
        "/ 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
  1968
        "/         model.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1969
        (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
  1970
            editValue value:realValue withoutNotifying:self.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1971
        ].
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1972
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1973
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1974
    modifiedChannel notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1975
        modifiedChannel value:true.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1976
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1977
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1978
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1979
updateEditorFromChangedRow
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1980
    |rowsValue rowNr|
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1981
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1982
    (rowNr := selectedRowIndex) isNumber ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1983
        rowNr := rowNr first.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1984
    ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  1985
    rowsValue := (self columnDescriptorAt:self selectedColIndex) at:rowNr.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1986
    (editValue notNil and:[ editValue value ~= rowsValue ]) ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1987
        editValue value:rowsValue withoutNotifying:self.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1988
        editView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  1989
            withAllSubViewsDo:[:v |
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1990
                v isInputField ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1991
                    v flash.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  1992
                ]
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  1993
            ]
2702
35892dc4449a bugfix: test whether editValue notNil
ca
parents: 2695
diff changeset
  1994
    ].
3773
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1995
!
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1996
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1997
updateList
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1998
    listHolder notNil ifTrue:[
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  1999
        self list:listHolder value.
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2000
        ^ self
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2001
    ].
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2002
    model notNil ifTrue:[
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2003
        self list:model value.
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2004
        ^ self
c4fcafeada43 sortable
Claus Gittinger <cg@exept.de>
parents: 3770
diff changeset
  2005
    ].
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2006
! !
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2007
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2008
!DSVColumnView methodsFor:'drag & drop'!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2009
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2010
canDrag
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2011
    "returns true if dragging is enabled"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2012
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2013
    ^ dropSource notNil
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2014
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2015
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2016
canStartDragAt:aPoint clickedAt:clickPoint
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2017
    self canDrag ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2018
        ^ false
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2019
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2020
    ^ (aPoint dist:clickPoint) > (UserPreferences current motionDistanceToStartDrag)
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2021
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2022
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2023
dragAutoScroll:aDropContext
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2024
    "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
  2025
     if required (decided by the widget itself). 
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2026
     If a scroll is done, return true;
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2027
     otherwise false (used to restore the background)"
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2028
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2029
    |yInset absLnNr y|
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2030
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2031
    (super dragAutoScroll:aDropContext) ifTrue:[^ true].
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2032
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2033
    y := aDropContext targetPoint y.
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2034
    yInset := margin + rowHeight.
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2035
    y > yInset ifTrue:[
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2036
        y >= (height - yInset) ifFalse:[^ false].
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2037
    ].
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2038
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2039
    absLnNr := self yVisibleToRowNr:y.
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2040
    absLnNr isNil ifTrue:[^ false].
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2041
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2042
    (absLnNr > 1 and:[absLnNr < self size]) ifFalse:[
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2043
        ^ false
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2044
    ].
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2045
    aDropContext contentsWillChange.
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2046
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2047
    y > yInset
2580
aea885fae0de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2048
        ifTrue:[self scrollDown:rowHeight]
aea885fae0de checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2575
diff changeset
  2049
        ifFalse:[self scrollUp:rowHeight].
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2050
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2051
    ^ true
5805
a76e98c02491 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5737
diff changeset
  2052
5809
c43c2f1c38ba #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5805
diff changeset
  2053
    "Modified: / 14-06-2018 / 11:21:13 / Claus Gittinger"
2575
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2054
!
fe15b02fbaf6 support sutoScroll during drag & drop
ca
parents: 2543
diff changeset
  2055
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2056
dropSource
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2057
    "returns the dropSource or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2058
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2059
    ^ dropSource
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2060
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2061
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2062
dropSource:aDropSourceOrNil
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2063
    "set the dropSource or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2064
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2065
    dropSource := aDropSourceOrNil.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2066
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2067
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 809
diff changeset
  2068
startDragAt:aPoint
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2069
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2070
    dropSource notNil ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2071
        buttonReleaseAction := buttonMotionAction := nil.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2072
        dropSource startDragIn:self at:aPoint.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2073
    ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2074
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2075
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2076
!DSVColumnView methodsFor:'drawing'!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2077
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2078
colorOnDevice:aColor
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2079
    "returns color on device"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2080
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2081
    |col|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2082
641
tz
parents: 637
diff changeset
  2083
    aColor = Color noColor ifFalse:[
tz
parents: 637
diff changeset
  2084
        col := colorMap at:aColor ifAbsent:nil.
tz
parents: 637
diff changeset
  2085
        col isNil ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  2086
            colorMap at:aColor put:(col := aColor onDevice:device)
641
tz
parents: 637
diff changeset
  2087
        ].
tz
parents: 637
diff changeset
  2088
        ^ col
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2089
    ].
641
tz
parents: 637
diff changeset
  2090
    ^ bgColor
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2091
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2092
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2093
forceRedraw
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2094
    "a redraw forced by any other component"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2095
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2096
    shown ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2097
        self invalidate
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2098
    ]
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2099
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2100
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2101
invalidate
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2102
    "recompute extent before repair range"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2103
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2104
    self recomputeHeightOfContents.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2105
    super invalidate.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2106
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2107
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2108
invalidateRowAt:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2109
    "redraw total row at an index"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2110
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2111
    self invalidateRowAt:aRowNr colAt:0
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2112
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2113
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2114
invalidateRowAt:aRowNr colAt:aColNr
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2115
    "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
  2116
     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
  2117
     If the row/column is hidden, no redraw is done"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2118
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2119
    |x "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2120
     y "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2121
     h "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2122
     w "{ Class:SmallInteger }"
2523
a7d71e57632f care for non-existing column
Claus Gittinger <cg@exept.de>
parents: 2500
diff changeset
  2123
     col|
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2124
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2125
    (shown and:[aRowNr notNil and:[aRowNr between:1 and:list size]]) ifTrue:[
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2126
        h := rowHeight.
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2127
        y := self yVisibleOfRowNr:aRowNr.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2128
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2129
        y < margin ifTrue:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2130
            (h := h + y) <= margin ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2131
                ^ self
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2132
            ].                                                  "/ row not visible
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2133
            h := h - margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2134
            y := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2135
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2136
            y >= height ifTrue:[^ self].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2137
        ].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2138
        aColNr ~~ 0 ifTrue:[                                    "/ redraw column in row
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2139
            col := (self columnDescriptorAt:aColNr).
3672
ff861e62db1d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3604
diff changeset
  2140
            w := col isNil ifTrue:[0] ifFalse:[col width].
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2141
            x := self xVisibleOfColNr:aColNr.
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2142
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2143
            x < margin ifTrue:[
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2144
                (w := w + x) <= margin ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2145
                    ^ self
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2146
                ].                                              "/ column not visible
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2147
                w := w - margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2148
                x := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2149
            ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2150
                x >= width ifTrue:[^ self].
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2151
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2152
        ] ifFalse:[                                             "/ redraw whole row
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2153
            x := margin.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2154
            w := width.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2155
        ].
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2156
        self invalidateX:x y:y width:w height:h
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2157
    ]
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2158
!
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2159
2469
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2160
invalidateRows:aCollection
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2161
    "redraw some visible rows"
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2162
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2163
    shown ifTrue:[
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2164
        aCollection do:[:rowIndex |
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2165
            self invalidateRowAt:rowIndex
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2166
        ]
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2167
    ]
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2168
!
a6e3ffd6df94 Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents: 2458
diff changeset
  2169
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2170
invalidateRowsFrom:aStart to:aStop
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2171
    "redraw visible row from start to stop"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2172
1956
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2173
    |size start stop y0 y1|
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2174
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2175
    shown ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2176
        size  := list size.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2177
        start := aStart notNil ifTrue:[aStart max:1]    ifFalse:[1].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2178
        stop  := aStop  notNil ifTrue:[aStop  min:size] ifFalse:[size].
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2179
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2180
        start <= stop ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2181
            y0 := (self yVisibleOfRowNr:start)              max:margin.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2182
            y1 := ((self yVisibleOfRowNr:stop) + rowHeight) min:height.
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2183
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2184
            y0 < y1 ifTrue:[
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2185
                self invalidateX:margin y:y0 width:width height:(y1 - y0)
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2186
            ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2187
        ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2188
    ]
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2189
!
bd553f644454 implement: #replaceFrom:to:with:startingAt:
ca
parents: 1954
diff changeset
  2190
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2191
invalidateSelection
5214
1f88a970e4db #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5204
diff changeset
  2192
    "invalidate (force async redraw) the current selection"
1f88a970e4db #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5204
diff changeset
  2193
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2194
    |colIndex|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2195
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2196
    shown ifTrue:[
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2197
        colIndex := self selectedColIndex ? 0.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2198
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2199
        self selectionIndicesDo:[:aRowIndex|
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2200
            self invalidateRowAt:aRowIndex colAt:colIndex.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2201
        ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2202
    ]
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2203
!
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  2204
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2205
invalidateVisibleRow:aRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2206
    "redraw row if visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2207
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2208
    self invalidateVisibleRow:aRow colAt:0
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2209
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2210
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2211
invalidateVisibleRow:aRow colAt:aColNr
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2212
    "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
  2213
     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
  2214
     If the row/column is hidden, no redraw is done"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2215
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2216
    |start "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2217
     stop  "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2218
    |
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2219
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2220
    (start := self indexOfFirstRowShown) ~~ 0 ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  2221
        stop := (start + (height // rowHeight)) min:(list size).
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2222
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2223
        aRow isNumber ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2224
            (aRow between:start and:stop) ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2225
                self invalidateRowAt:aRow colAt:aColNr
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2226
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2227
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2228
            start to:stop do:[:i|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2229
                (self at:i) == aRow ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  2230
                    ^ self invalidateRowAt:i colAt:aColNr
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2231
                ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2232
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2233
        ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2234
    ]
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2235
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2236
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2237
invalidateVisibleRow:aRow readSelector:aSelector
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2238
    "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
  2239
     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
  2240
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2241
    |row idx|
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2242
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2243
    aSelector isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2244
        idx := 0
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2245
    ] ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2246
        (row := aRow) isNumber ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2247
            (row := self at:aRow) isNil ifTrue:[ ^ self ]
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2248
        ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2249
        idx := columnDescriptors
4686
dda678ab83bf class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4664
diff changeset
  2250
                findFirst:[:aCol| aCol description readSelector == aSelector]
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2251
    ].
2190
9c7777ad9594 bad names: redraw vs. invalidate
penk
parents: 2157
diff changeset
  2252
    self invalidateVisibleRow:aRow colAt:idx
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2253
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2254
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2255
redrawX:x y:y width:w height:h
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2256
    "redraw part of myself immediately, given logical coordinates "
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2257
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2258
    |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
  2259
     start "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2260
     stop  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2261
     x0    "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2262
     x1    "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2263
     maxX  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2264
     yTop  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2265
     yBot  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2266
     clHg  "{ Class:SmallInteger }"
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2267
     size  "{ Class:SmallInteger }"
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2268
     lineColor
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2269
    |
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2270
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2271
    shown ifFalse:[^ self].
3993
6840bc23b584 changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2272
    self isReallyShown ifFalse:[^ self].
6840bc23b584 changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2273
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2274
    gc paint:bgColor.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2275
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2276
    columnDescriptors isEmpty 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
    ].
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2279
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2280
    size  := list size.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2281
    yTop  := margin - viewOrigin y.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2282
    c0    := y - yTop max:0.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2283
    start := (c0 // rowHeight) + 1.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2284
    stop  := (((c0 + h - 1) // rowHeight) + 1) min:size.
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2285
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2286
    stop < start ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2287
        ^ gc fillRectangleX:x y:y width:w height:h
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2288
    ].
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  2289
    savClip := self clippingBoundsOrNil.
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2290
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2291
    maxX := (x + w) min:(width - margin).
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2292
    x0   := margin - viewOrigin x.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2293
    yTop := yTop + ((start - 1) * rowHeight).
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2294
    clHg := (stop - start + 1) * rowHeight.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2295
    yBot := yTop + clHg.
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2296
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2297
    stopRedraw := false.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2298
5737
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2299
    self class stopRedrawSignal handle:[:ex |
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2300
        "/ 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
  2301
        stopRedraw := true.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2302
    ] do:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2303
        columnDescriptors do:[:aCol| |cw|
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2304
            x1 := x0 + aCol width.
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
            (x1 > x and:[x0 < maxX]) ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2307
                |left right rect|
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2308
                left  := x0 max:x.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2309
                right := x1 min:maxX.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2310
                rect  := Rectangle left:left top:y width:(right - left) height:h.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2311
5737
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2312
                "/ self clippingBounds:nil.
5204
fccb63f32188 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5195
diff changeset
  2313
                self clippingBounds:rect.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2314
                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
  2315
            ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2316
            x0 := x1
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2317
        ].
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2318
    ].
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2319
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2320
    "/ restore old clipping rectangle
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  2321
    self clippingBounds:savClip.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2322
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2323
    stopRedraw ifTrue:[
5737
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2324
        "/ redraw aborted due to too many changes while drawing.
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2325
        "/ try again after some grace period
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2326
        Processor addTimedBlock:[self invalidate] after:0.1 seconds.
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2327
        "/  self invalidate.
eeb4d51e4e3a #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5730
diff changeset
  2328
        "/ self makeSelectionVisible.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2329
        ^ self
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2330
    ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2331
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2332
    stop == size ifTrue:[
1115
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2333
        yTop := y + h.
7f3f4581c3d3 clear background
ca
parents: 1112
diff changeset
  2334
        yBot < (yTop - margin) ifTrue:[
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  2335
            "/ clear to bottom of screen
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2336
            gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2337
            gc fillRectangleX:x y:yBot width:w height:(yTop - yBot).
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2338
        ]
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  2339
    ].
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  2340
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  2341
    (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
  2342
        "/ clear to right of screen
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2343
        gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2344
        gc fillRectangleX:x1 y:y width:c0 height:h.
1136
4a9d9db81422 set bg/fg color when drawing an interactor
ca
parents: 1134
diff changeset
  2345
    ].
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2346
    "/ if only rows are selected we have to draw
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2347
    "/  - the selection frame around the labels
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2348
    "/  - 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
  2349
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2350
    self hasRowSelection ifFalse:[ ^ self ].  "/ nothing to do
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2351
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2352
    selWidth := width-margin-x1.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2353
    lineColor := self selectionFrameColor.
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2354
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2355
    self selectionIndicesDo:[:rowNr |
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2356
        | yVis |
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2357
        yVis := self yVisibleOfRowNr:rowNr.
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2358
        selWidth > 0 ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2359
            gc paint:selectionBackgroundColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2360
            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
  2361
        ].
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2362
        lineColor notNil ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2363
            gc paint:lineColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2364
            gc displayLineFromX:x y:yVis toX:width y:yVis.
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2365
            yVis := yVis+rowHeight -1.
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2366
            gc displayLineFromX:x y:yVis toX:width y:yVis.
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  2367
        ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2368
    ].
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  2369
3993
6840bc23b584 changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents: 3991
diff changeset
  2370
    "Modified: / 21-01-2011 / 15:58:11 / cg"
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2371
! !
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2372
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2373
!DSVColumnView methodsFor:'drawing interactors'!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2374
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2375
displayLabel:aLabel x:xLeft y:yTop
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2376
    "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
  2377
     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
  2378
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2379
    |y h |
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2380
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2381
    aLabel notNil ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2382
        aLabel isString ifTrue:[
2593
24ddc48c5ad4 bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents: 2592
diff changeset
  2383
            y := yTop + self rowFontAscent.
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2384
        ] ifFalse:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2385
            h := aLabel heightOn:self.
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
            h > minRowHeight ifTrue:[
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2388
                minRowHeight := h.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2389
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  2390
                cachedPreferredExtent notNil ifTrue:[
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  2391
"/                    rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2392
                    cachedPreferredExtent := Point
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  2393
                                            x: cachedPreferredExtent x
3172
65f4533fbf75 preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents: 3149
diff changeset
  2394
                                            y: (list size * rowHeight).
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2395
                    self contentsChanged.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2396
                ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2397
                self class stopRedrawSignal raiseRequest.
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2398
            ].
2593
24ddc48c5ad4 bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents: 2592
diff changeset
  2399
            y := yTop + (aLabel ascentOn:self).
2592
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2400
        ].
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2401
        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
  2402
    ].
3172
65f4533fbf75 preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents: 3149
diff changeset
  2403
65f4533fbf75 preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents: 3149
diff changeset
  2404
    "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
  2405
!
ab64fbe4fb1e resize #rowHeight if a display label does not match the computed rowHeight
ca
parents: 2580
diff changeset
  2406
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2407
drawCheckToggleAtX:xLeft y:yTop w:cellWidth state:cellValue
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2408
    "draw a check toggle button"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2409
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2410
    |e form
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2411
     y "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2412
     x "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2413
     h "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2414
     w "{ Class:SmallInteger }"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2415
     state|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2416
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2417
    state := (cellValue ? false).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2418
    state isBoolean ifFalse:[ state := false ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2419
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2420
    w := checkToggleExtent x.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2421
    h := checkToggleExtent y.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2422
    y := yTop + ((rowHeight - h) // 2).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2423
    x := xLeft + ((cellWidth  - w) // 2).
1529
aa5e8fae6f23 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1521
diff changeset
  2424
    h odd ifTrue:[y := y + 1].
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2425
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2426
    checkToggleActiveImage isNil ifTrue:[
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2427
        gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2428
        gc fillRectangleX:x y:y width:w height:h.
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2429
        self drawEdgesAtX:x y:y width:w height:h level:checkToggleLevel on:self.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2430
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2431
        state ifFalse:[
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2432
            ^ self
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2433
        ].
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2434
        gc paint:fgColor on:bgColor.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2435
        form := checkToggleForm
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2436
    ] ifFalse:[
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2437
        form := self isEnabled
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2438
                    ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2439
                        state
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2440
                            ifTrue:[checkToggleActiveImage]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2441
                            ifFalse:[checkTogglePassiveImage]] 
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2442
                    ifFalse:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2443
                        state
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2444
                            ifTrue:[(checkToggleDisabledActiveImage ? checkToggleActiveImage)]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2445
                            ifFalse:[(checkToggleDisabledPassiveImage ? checkTogglePassiveImage)]].
859
e63eb6f321e1 support List for columns
ca
parents: 833
diff changeset
  2446
    ].
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2447
    e := (checkToggleExtent - form extent) // 2.
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2448
    gc displayForm:form x:(x + e x) y:(y + e y).
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2449
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2450
    "Modified: / 17-08-2018 / 17:33:03 / Claus Gittinger"
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2451
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2452
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2453
drawComboButtonAtX:xTop y:yTop w:rowWidth
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2454
    "draw a combo button"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2455
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2456
    |e
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2457
     x "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2458
     y "{ Class:SmallInteger }"
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2459
     h "{ Class:SmallInteger }"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2460
     w "{ Class:SmallInteger }"|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2461
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2462
    w := comboButtonExtent x.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2463
    h := comboButtonExtent y.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2464
    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
  2465
    x := xTop + (rowWidth  - w - separatorSize - 1).
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2466
    e := (comboButtonExtent - comboButtonForm extent) // 2.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2467
5421
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2468
    gc paint:bgColor.
3fd7edaeb379 #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5347
diff changeset
  2469
    gc fillRectangleX:x y:y width:w height:h.
1131
ef8f528399aa clear background under button
ca
parents: 1129
diff changeset
  2470
    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
  2471
    gc paint:fgColor on:bgColor.
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2472
    gc 
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2473
        displayForm:
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2474
            (self isEnabled 
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2475
                ifTrue:[comboButtonForm]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2476
                ifFalse:[comboButtonDisabledForm ? comboButtonForm])
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2477
        x:(x + e x) 
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2478
        y:(y + e y)
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2479
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2480
    "Modified: / 17-08-2018 / 17:35:20 / Claus Gittinger"
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2481
!
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  2482
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2483
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
  2484
    "draw edges for a cell or label"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2485
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2486
    aGC
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2487
        drawEdgesForX:x
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2488
        y:y
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2489
        width:w
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2490
        height:h
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2491
        level:aLevel
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2492
        shadow:buttonShadowColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2493
        light:buttonLightColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2494
        halfShadow:buttonHalfShadowColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2495
        halfLight:buttonHalfLightColor
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2496
        style:ButtonEdgeStyle.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2497
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2498
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2499
drawRadioButtonAtX:xLeft y:yTop w:cellWidth state:aBooleanOrNil
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2500
    "draw a radio button"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2501
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2502
    |image
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2503
     y "{ Class:SmallInteger }"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2504
     x "{ Class:SmallInteger }"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2505
     h "{ Class:SmallInteger }"
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2506
     w "{ Class:SmallInteger }"|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2507
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2508
    w := radioButtonActiveImage extent x.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2509
    h := radioButtonActiveImage extent y.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2510
    y := yTop + ((rowHeight - h) // 2).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2511
    x := xLeft + ((cellWidth - w) // 2).
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2512
    h odd ifTrue:[y := y + 1].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2513
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2514
    image := self isEnabled
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2515
                ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2516
                    (aBooleanOrNil == true)
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2517
                        ifTrue:[radioButtonActiveImage]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2518
                        ifFalse:[radioButtonPassiveImage]]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2519
                ifFalse:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2520
                    (aBooleanOrNil == true)
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2521
                        ifTrue:[radioButtonDisabledActiveImage ? radioButtonActiveImage]
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2522
                        ifFalse:[radioButtonDisabledPassiveImage ? radioButtonPassiveImage]].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2523
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  2524
    image := image onDevice:device.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2525
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2526
    self displayForm:image x:x y:y.
5447
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2527
867fdca4b691 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5421
diff changeset
  2528
    "Modified (format): / 04-02-2017 / 21:31:16 / cg"
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  2529
    "Modified: / 17-08-2018 / 17:36:23 / Claus Gittinger"
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2530
! !
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2531
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2532
!DSVColumnView methodsFor:'enumerating columns'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2533
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2534
columnsDo:aOneArgBlock
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2535
    "evaluate the argument, aOneArgBlock for every columnDescriptor"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2536
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2537
    columnDescriptors do:aOneArgBlock
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2538
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2539
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2540
columnsFrom:start to:stop do:aOneArgBlock
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2541
    "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
  2542
     stop in the collection of column descriptors"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2543
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2544
    columnDescriptors
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2545
        from:start
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2546
        to:stop
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2547
        do:aOneArgBlock
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2548
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2549
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2550
!DSVColumnView methodsFor:'event handling'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2551
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2552
buttonControlPressAt:clickPoint rowNr:aRowNr colNr:aColNr
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2553
    |isSelected prvRow doAdd chgSet|
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2554
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2555
    buttonMotionAction := buttonReleaseAction := nil.
3239
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2556
    isSelected := self isInSelection:aRowNr.
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2557
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2558
    multipleSelectOk ifFalse:[
3239
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2559
        isSelected ifTrue:[
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2560
            self deselect.
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2561
        ] ifFalse:[
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2562
            self selectRowAt:aRowNr colAt:aColNr atPoint:clickPoint openEditor:false.
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2563
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2564
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2565
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2566
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2567
    isSelected ifTrue:[ self removeRowFromSelection:aRowNr ]
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2568
              ifFalse:[ self addRowToSelection:aRowNr ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2569
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2570
    multipleSelectOk ifFalse:[ ^ self ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2571
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2572
    prvRow := aRowNr.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2573
    chgSet := IdentitySet new.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2574
    doAdd  := isSelected not.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2575
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2576
    buttonMotionAction := [:p|
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2577
        |rowNr mustRestore step f|
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2578
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2579
        rowNr := self yVisibleToRowNr:(p y).
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2580
        (rowNr notNil and:[rowNr ~~ prvRow]) ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2581
            rowNr == aRowNr ifTrue:[
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2582
                mustRestore := true
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2583
            ] ifFalse:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2584
                rowNr > aRowNr ifTrue:[ mustRestore := (rowNr < prvRow) ]
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2585
                              ifFalse:[ mustRestore := (rowNr > prvRow) ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2586
            ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2587
            prvRow > rowNr ifTrue:[ step := -1 ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2588
                          ifFalse:[ step :=  1 ].
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2589
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2590
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2591
            mustRestore ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2592
                [ prvRow ~~ rowNr ] whileTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2593
                    (chgSet removeIdentical:prvRow ifAbsent:nil) notNil ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2594
                        doAdd ifFalse:[ self addRowToSelection:prvRow ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2595
                               ifTrue:[ self removeRowFromSelection:prvRow ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2596
                    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2597
                    prvRow := prvRow + step.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2598
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2599
            ] ifFalse:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2600
                [ prvRow ~~ rowNr ] whileTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2601
                    prvRow := prvRow + step.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2602
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2603
                    doAdd ~~ (self isInSelection:rowNr) ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2604
                        chgSet add:prvRow.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2605
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2606
                        doAdd ifTrue:[ self addRowToSelection:prvRow ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2607
                             ifFalse:[ self removeRowFromSelection:prvRow ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2608
                    ]
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2609
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2610
            ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2611
        ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2612
    ].
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  2613
3239
7b18b6694058 ctrl-click toggles
Claus Gittinger <cg@exept.de>
parents: 3223
diff changeset
  2614
    "Modified: / 21-07-2007 / 22:00:27 / cg"
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2615
!
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2616
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2617
buttonMotion:buttonMask x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2618
    "mouse-move while button was pressed - handle multiple selection changes"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2619
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2620
    self isEnabled ifFalse:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2621
        ^ self
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2622
    ].
2788
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2623
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2624
    buttonMotionAction notNil ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2625
        buttonMotionAction value:(x @ y).
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2626
        buttonMotionAction notNil ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2627
            autoScroll ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2628
                "/ if moved outside of view, start autoscroll
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2629
                (y < 0) ifTrue:[
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  2630
                    ^ self startAutoScroll:#scrollUp distance:y.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2631
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2632
                (y > height) ifTrue:[
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  2633
                    ^ self startAutoScroll:#scrollDown distance:(y - height).
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2634
                ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2635
            ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2636
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2637
    ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2638
    self stopAutoScroll.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2639
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2640
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2641
buttonMultiPress:button x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2642
    "a button was pressed twice - handle doubleclick here"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2643
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2644
    |selectedCol|
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2645
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2646
    buttonMotionAction := buttonReleaseAction := nil.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2647
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2648
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2649
3742
a4bb22bc79e2 preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents: 3702
diff changeset
  2650
    (button == 1) ifFalse:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2651
        ^ super buttonMultiPress:button x:x y:y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2652
    ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2653
    self numberOfSelections == 1 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2654
        self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2655
            selectedCol := self selectedColIndex.
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2656
            ( selectedCol == 0
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2657
              or:[selectedCol == (self xVisibleToColNr:x)]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2658
            ) ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2659
                self doubleClicked
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  2660
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2661
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2662
    ]
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2663
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  2664
    "Modified: / 26-03-2007 / 15:19:04 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2665
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2666
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2667
buttonPress:button x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2668
    "a button was pressed - handle selection here"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2669
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2670
    |rowNr colNr sensor clickPoint clickedIntoSelection column columnEditorType|
2802
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2671
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2672
    buttonMotionAction := buttonReleaseAction := nil.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2673
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2674
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  2675
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2676
    rowNr := self yVisibleToRowNr:y.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2677
    colNr := self xVisibleToColNr:x.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2678
5895
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2679
    (button == 2) ifTrue:[ 
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2680
        |openMenu|
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2681
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2682
        openMenu := false.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2683
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2684
        UserPreferences current selectOnRightClick ifFalse:[
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2685
            openMenu := true.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2686
        ] ifTrue:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2687
            UserPreferences current showRightButtonMenuOnRelease ifFalse:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2688
                (rowNr notNil and:[colNr notNil and:[self isRowSelectable:rowNr]]) ifTrue:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2689
                    self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2690
                ].
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2691
                openMenu := true.
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2692
            ].
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2693
        ].
5895
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2694
        openMenu ifTrue:[ 
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2695
            |menu|
7eb99c8f6368 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5890
diff changeset
  2696
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2697
            menu := self findMenuForSelection.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2698
            menu notNil ifTrue:[
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2699
                self startUpMenu:menu.
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2700
            ] ifFalse:[
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2701
                super buttonPress:button x:x y:y.
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2702
            ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2703
            ^ self
4664
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2704
        ].
a537a996fb22 class: DSVColumnView
ca
parents: 4653
diff changeset
  2705
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2706
2804
8204b926377d oops - firstRow could be nil
Claus Gittinger <cg@exept.de>
parents: 2802
diff changeset
  2707
    (rowNr isNil or:[colNr isNil]) ifTrue:[
2722
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  2708
        self deselect.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2709
        super buttonPress:button x:x y:y.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2710
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2711
    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2712
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  2713
    (self isRowSelectable:rowNr) ifFalse:[^ self ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  2714
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2715
    sensor     := self sensor.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2716
    clickPoint := x @ y.
2813
74cfefd3a0a4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2812
diff changeset
  2717
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2718
    sensor shiftDown ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2719
        self buttonShiftPressAt:clickPoint rowNr:rowNr colNr:colNr.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2720
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2721
    ].
2802
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2722
    sensor ctrlDown ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2723
        self buttonControlPressAt:clickPoint rowNr:rowNr colNr:colNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2724
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2725
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2726
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2727
    multipleSelectOk ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2728
        self canDrag ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2729
            self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2730
            ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2731
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2732
        self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2733
3923
d5c71ade2f43 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  2734
        ((button == 2) and:[UserPreferences current selectOnRightClick]) ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2735
            self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2736
        ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2737
            buttonReleaseAction :=
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2738
                [
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2739
                    self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2740
                ].
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2741
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2742
            buttonMotionAction :=
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2743
                [:aPoint|
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2744
                    (self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2745
                        self startDragAt:aPoint
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2746
                    ]
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2747
                ].
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2748
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2749
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2750
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2751
3923
d5c71ade2f43 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3922
diff changeset
  2752
    ((button == 2) and:[UserPreferences current selectOnRightClick]) ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2753
        buttonReleaseAction :=
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2754
            [
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2755
                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
  2756
            ].
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2757
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2758
        "/ normally, we select on button release; however, any editor is shown immediately
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2759
        ((column := self columnDescriptorAt:colNr) notNil
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2760
        and:[ (columnEditorType := column description editorType) notNil
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2761
        and:[ columnEditorType ~~ #None ]]) ifTrue:[
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2762
            buttonReleaseAction value.
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2763
            buttonReleaseAction := nil.
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2764
            editView notNil ifTrue:[
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2765
                ^ self.
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2766
            ]
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2767
        ]
3922
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2768
    ].
fd141174f607 changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3908
diff changeset
  2769
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2770
    clickedIntoSelection := self isInSelection:rowNr.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2771
    clickedIntoSelection ifTrue:[
3908
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2772
        |selColIdx|
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2773
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2774
        selColIdx := self selectedColIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2775
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2776
        (selColIdx ~~ 0 and:[selColIdx ~~ colNr]) ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2777
            clickedIntoSelection := (selectedRowIndex size > 1)
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2778
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2779
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2780
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2781
    clickedIntoSelection ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2782
        self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2783
    ] ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2784
        self canDrag ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2785
            buttonMotionAction :=
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2786
                [:aPoint|
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2787
                    (self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2788
                        self startDragAt:aPoint
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2789
                    ]
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  2790
                ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2791
            ^ self
2802
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2792
        ]
fa5806bd210a select behavior changed:
Claus Gittinger <cg@exept.de>
parents: 2797
diff changeset
  2793
    ].
2788
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2794
8f45f2da80fa selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents: 2777
diff changeset
  2795
    buttonMotionAction := [:p|
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2796
        (self bounds containsPoint:p) ifTrue:[
3908
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2797
            |rowUnderPoint|
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2798
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2799
            rowUnderPoint := self yVisibleToRowNr:(p y).
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2800
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2801
            rowUnderPoint notNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2802
                buttonReleaseAction notNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2803
                    rowUnderPoint == rowNr ifFalse:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2804
                        buttonReleaseAction := nil
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2805
                    ].
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2806
                ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2807
                buttonReleaseAction isNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2808
                    self selectRowFrom:rowNr to:rowUnderPoint.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2809
                ]
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2810
            ]
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2811
        ].
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  2812
    ].
3908
a8586db23418 comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 3897
diff changeset
  2813
4056
36eb0b1137db changed: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents: 4055
diff changeset
  2814
    "Modified: / 12-07-2011 / 14:54:45 / cg"
5990
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  2815
    "Modified (format): / 31-01-2019 / 23:39:56 / Claus Gittinger"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2816
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2817
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2818
buttonRelease:button x:x y:y
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2819
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2820
    buttonMotionAction := nil.
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  2821
    self stopAutoScroll.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  2822
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2823
    buttonReleaseAction notNil ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2824
        buttonReleaseAction value.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  2825
        buttonReleaseAction := nil.
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2826
    ].
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2827
    super buttonRelease:button x:x y:y
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2828
!
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  2829
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2830
buttonShiftPressAt:clickPoint rowNr:aRowNr colNr:aColNr
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2831
    |colIdx numSelRows|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2832
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2833
    buttonReleaseAction := buttonMotionAction := nil.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2834
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2835
    colIdx := aColNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2836
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2837
    (multipleSelectOk and:[(numSelRows := selectedRowIndex size) > 0]) ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2838
        (numSelRows == 1 and:[self isInSelection:aRowNr]) ifFalse:[ |min max|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2839
            min := max := aRowNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2840
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2841
            selectedRowIndex do:[:anIndex|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2842
                min := min min:anIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2843
                max := max max:anIndex.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2844
            ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2845
            self selectRowFrom:min to:max.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2846
            ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2847
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2848
        self selectedColIndex ~~ 0 ifTrue:[     "/ toggle column selection
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2849
            colIdx := 0
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2850
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2851
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2852
    self selectRowAt:aRowNr colAt:colIdx atPoint:clickPoint openEditor:false.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2853
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  2854
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2855
characterPress:aChar x:x y:y
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  2856
    "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
  2857
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2858
    |colNr rowNr lsize found column|
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2859
2445
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2860
    lsize  := list size.
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2861
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2862
"/    (rowIfAbsentBlock notNil
2445
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2863
"/     or:[x isNil
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2864
"/     or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2865
"/        ^ self
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2866
"/    ].
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2867
    colNr := self findFirstColumnWithStringFrom:1 to:lsize.
2535
4df3f0a09b83 fixed: characterPressed: ... on non editable column
tm
parents: 2524
diff changeset
  2868
    colNr isNil ifTrue:[ ^ self ].
4df3f0a09b83 fixed: characterPressed: ... on non editable column
tm
parents: 2524
diff changeset
  2869
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2870
    rowNr  := self lastIndexSelected.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2871
    column := self columnDescriptorAt:colNr.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2872
    found  := 0.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2873
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2874
    lsize > rowNr ifTrue:[
2445
df54aa1128b3 charcter search: first column which contains a string is searched for
penk
parents: 2398
diff changeset
  2875
        "/ search to end
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2876
        found := column findRowNrStartingWithChar:aChar start:(rowNr + 1) stop:lsize.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2877
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2878
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2879
    (found == 0 and:[rowNr > 1]) ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2880
     "/ search from begin
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2881
        found := column findRowNrStartingWithChar:aChar start:1 stop:(rowNr - 1)
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2882
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2883
    found ~~ 0 ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2884
        self selectColIndex:colNr rowIndex:found.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2885
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2886
896
aa07612a7c04 care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents: 892
diff changeset
  2887
    "Modified: / 21.5.1998 / 03:30:22 / cg"
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2888
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  2889
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2890
contentsChanged
4257
0740dae4df00 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4255
diff changeset
  2891
    "size of contents changed - move origin up if possible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2892
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2893
    |y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2894
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2895
    shown ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2896
        self recomputeHeightOfContents.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2897
        y := self maxViewOriginY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2898
        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
  2899
            scrollWhenUpdating ~~ false ifTrue:[
9ed8131d94bb viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents: 1947
diff changeset
  2900
                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
  2901
            ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2902
        ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2903
            self updateEditViewOrigin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2904
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2905
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2906
    super contentsChanged
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2907
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2908
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2909
cursorKey:aKey rawKey:rawKey
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2910
    |hasSelectables step start minSelRowNr maxSelRowNr selColNr selRowNr listSize|
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2911
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2912
    hasSelectables := self hasSelectables.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2913
    listSize := list size.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2914
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2915
    (hasSelectables or:[selectRowOnDefault]) ifFalse:[ ^ self ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2916
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2917
    minSelRowNr := self minIndexSelected.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2918
    maxSelRowNr := self maxIndexSelected.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2919
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  2920
    selColNr := hasSelectables ifFalse:[0] ifTrue:[self selectedColIndex].
2816
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
    aKey == #CursorUp ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2923
        selRowNr := minSelRowNr > 1 ifTrue:[minSelRowNr - 1] ifFalse:[listSize].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2924
        step := -1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2925
    ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2926
        aKey == #CursorDown ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2927
            selRowNr := maxSelRowNr < listSize ifTrue:[maxSelRowNr + 1] ifFalse:[1].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2928
            step := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2929
        ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2930
            ("aKey == #BeginOfLine or:[" rawKey == #Home "]") ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2931
                selRowNr := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2932
                step := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2933
            ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2934
                (rawKey == #End) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2935
                    selRowNr := listSize.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2936
                    step := -1.
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
            ]
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
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2941
    start := selRowNr.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2942
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2943
    [ self isRowSelectable:selRowNr ] whileFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2944
        selRowNr := selRowNr + step.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2945
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2946
        selRowNr == 0 ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2947
            selRowNr := listSize.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2948
        ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2949
            selRowNr > listSize ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2950
                selRowNr := 1.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2951
            ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2952
        ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2953
        selRowNr == start ifTrue:[^ self ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2954
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2955
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2956
    ((aKey == #CursorUp) or:[aKey == #CursorDown]) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2957
        (multipleSelectOk and:[self sensor shiftDown]) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2958
            self addRowToSelection:selRowNr.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2959
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2960
            aKey == #CursorDown ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2961
                self makeLineVisible:((selRowNr+1) min:listSize)
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2962
            ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2963
                self makeLineVisible:((selRowNr-1) max:1)
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2964
            ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2965
            ^ self
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2966
        ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2967
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2968
    self selectColIndex:selColNr rowIndex:selRowNr
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2969
!
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  2970
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2971
doubleClicked
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2972
    "handle a double click"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2973
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2974
    |col sel idx|
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2975
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2976
    self hasSelection ifTrue:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2977
        idx := self firstIndexSelected.
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2978
        col := self selectedColumn.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2979
        (col notNil and:[ (sel := col doubleClickedSelector) notNil ]) ifTrue:[
2074
89565d366510 doubleClick and menu via columnAdaptor
martin
parents: 2044
diff changeset
  2980
            col doubleClickOn:idx
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2981
        ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2982
            doubleClickActionBlock notNil ifTrue:[
4772
11b5f36c5943 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4686
diff changeset
  2983
                doubleClickActionBlock valueWithOptionalArgument:idx
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2984
            ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2985
        ]
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  2986
    ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2987
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  2988
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2989
findMenuForSelection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  2990
    "find the middle button menu for the current selection; returns the menu or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  2991
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2992
    |col row menu|
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2993
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2994
    self numberOfSelections == 1 ifTrue:[
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2995
        row := self at:(self firstIndexSelected).
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  2996
        col := self selectedColumn.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2997
        col notNil ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2998
            menu := col menuForRow:row orAdaptor:columnAdaptor.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  2999
            menu notNil ifTrue:[ ^ menu ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3000
        ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3001
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3002
        col := columnDescriptors
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3003
                        detect:[:c | c rendererType == #rowSelector ]
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3004
                        ifNone:[ nil ].
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3005
        col notNil ifTrue:[
1223
176702811314 kludge: when asking for an itemMenu, pass application to
tm
parents: 1215
diff changeset
  3006
            ^ col menuForRow:row inApplication:(self application)
667
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3007
        ]
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3008
    ].
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3009
    ^ nil
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3010
!
caa3c553d3d1 accessing of the middle-button assigned to a cell
ca
parents: 656
diff changeset
  3011
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3012
keyPress:aKey x:x y:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3013
    "a key was pressed - handle page-keys here"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3014
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3015
    <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3016
                          #BeginOfText #EndOfText #ScrollUp #ScrollDown
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3017
                          #CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)>
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3018
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3019
    |maxColNr firstSelRowNr selRowNr selColNr
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3020
     key column isTab listSize hasSelectables rawKey|
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3021
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3022
    self isEnabled ifFalse:[^ self].
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3023
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3024
    (listSize := list size) == 0 ifTrue:[
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3025
        ^ super keyPress:aKey x:x y:y
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3026
    ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3027
    aKey isCharacter ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3028
        ^ self characterPress:aKey x:x y:y
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3029
    ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3030
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3031
    (aKey == #SelectAll) ifTrue:[
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3032
        multipleSelectOk ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3033
            self selectAllRows.
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3034
        ].
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3035
        ^ self
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3036
    ].
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  3037
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3038
    aKey == #PreviousPage ifTrue:[^ self pageUp].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3039
    aKey == #NextPage     ifTrue:[^ self pageDown].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3040
    aKey == #HalfPageUp   ifTrue:[^ self halfPageUp].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3041
    aKey == #HalfPageDown ifTrue:[^ self halfPageDown].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3042
    aKey == #BeginOfText  ifTrue:[^ self scrollToTop].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3043
    aKey == #EndOfText    ifTrue:[^ self scrollToBottom].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3044
    aKey == #ScrollUp     ifTrue:[^ self scrollUp].
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3045
    aKey == #ScrollDown   ifTrue:[^ self scrollDown].
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3046
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3047
    aKey == #Return ifTrue:[
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3048
        editView notNil ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3049
            (self selectedRowIndex size == 1
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3050
            and:[self selectedRowIndex first == listSize]) ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3051
                self selectRowIndex:nil.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3052
            ] ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3053
                self cursorKey:#CursorDown rawKey:#CursorDown.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3054
            ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3055
            ^ self
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3056
        ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3057
        self numberOfSelections == 1 ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3058
            self doubleClicked
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3059
        ].
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3060
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3061
    ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3062
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3063
    hasSelectables := self hasSelectables.
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3064
5873
c8cf9d94aed1 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5809
diff changeset
  3065
    rawKey := (WindowGroup lastEvent) rawKey.
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3066
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3067
    (aKey == #CursorUp
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3068
    or:[aKey == #CursorDown
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3069
    or:[rawKey == #Home
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3070
    or:[rawKey == #End]]])
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3071
    ifTrue:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3072
        self cursorKey:aKey rawKey:rawKey.
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3073
        ^ self
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3074
    ].
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3075
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3076
    hasSelectables ifFalse:[
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3077
        ^ super keyPress:aKey x:x y:y
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3078
    ].
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3079
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3080
    "/ CURSOR LEFT/RIGHT or TABING
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3081
    (aKey == #CursorLeft or:[aKey == #CursorRight]) ifTrue:[
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3082
        isTab := false.
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3083
        key   := aKey.
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3084
    ] ifFalse:[
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3085
        tabIntern ifFalse:[
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3086
            ^ super keyPress:aKey x:x y:y
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3087
        ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3088
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3089
        (aKey includesString:'Tab') ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3090
            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
  3091
                        ifTrue:[#CursorLeft]
13acaaf02528 Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents: 2470
diff changeset
  3092
                        ifFalse:[#CursorRight]
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3093
        ] ifFalse:[
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3094
            (aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3095
                ^ super keyPress:aKey x:x y:y
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3096
            ].
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3097
            key := aKey == #FocusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3098
        ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3099
        isTab := true.
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3100
    ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3101
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3102
    maxColNr := self numberOfColumns.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  3103
    selColNr := self selectedColIndex.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3104
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3105
    firstSelRowNr := self firstIndexSelected.
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  3106
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3107
    key == #CursorLeft ifTrue:[
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3108
        selRowNr := firstSelRowNr.
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3109
        selRowNr == 0 ifTrue:[selRowNr := listSize].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3110
        selColNr == 0 ifTrue:[selColNr := maxColNr + 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) == 0 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 == 0 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
                            tabAtStartAction notNil ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3118
                                tabAtStartAction 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 focusPreviousFrom: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
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
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 := maxColNr
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3130
            ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3131
            column := self columnDescriptorAt:selColNr.
1416
505ef8832a06 focus next/previous
Claus Gittinger <cg@exept.de>
parents: 1408
diff changeset
  3132
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3133
            (column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3134
                ^ self selectColIndex:selColNr rowIndex:selRowNr.
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3135
            ]
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3136
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3137
    ].
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3138
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  3139
    selRowNr := firstSelRowNr.
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3140
    selRowNr == 0 ifTrue:[selRowNr := 1].
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3141
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3142
    [true] whileTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3143
        (selColNr := selColNr + 1) > maxColNr ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3144
            [   selRowNr := selRowNr + 1.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3145
                selRowNr > listSize ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3146
                    isTab ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3147
                        tabAtEndAction notNil ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3148
                            tabAtEndAction value
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3149
                        ] ifFalse:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3150
                            self deselect.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3151
                            self windowGroup focusNextFrom:self
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3152
                        ]
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3153
                    ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3154
                    ^ self
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3155
                ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3156
                (self isRowSelectable:selRowNr)
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3157
            ] whileFalse.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3158
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3159
            selColNr := 1
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3160
        ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3161
        column := self columnDescriptorAt:selColNr.
1776
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3162
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3163
        (column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3164
            ^ self selectColIndex:selColNr rowIndex:selRowNr
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3165
        ]
e28ffcdd52a7 bugfix in cursor up/down
ca
parents: 1754
diff changeset
  3166
    ].
5873
c8cf9d94aed1 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5809
diff changeset
  3167
c8cf9d94aed1 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5809
diff changeset
  3168
    "Modified: / 09-08-2018 / 09:27:46 / Claus Gittinger"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3169
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3170
5670
9aea34629aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5666
diff changeset
  3171
keyboardZoom:largerBoolean
5279
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3172
    "CTRL+/- zoom action"
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3173
5670
9aea34629aea #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5666
diff changeset
  3174
    self fontLargerOrSmaller:largerBoolean
5279
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3175
!
d30e2f0b2356 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5252
diff changeset
  3176
5563
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3177
mouseWheelZoom:amount
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3178
    "CTRL-wheel action"
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3179
    |oldSize newSize font|
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3180
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3181
    font := gc font.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3182
    font sizeUnit == #px ifTrue:[ ^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3183
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3184
    oldSize := font size.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3185
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3186
    amount > 0 ifTrue:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3187
        oldSize < 5 ifTrue:[ ^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3188
        newSize := oldSize - 1.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3189
    ] ifFalse:[
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3190
        oldSize > 99 ifTrue:[^ self].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3191
        newSize := oldSize + 1.
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3192
    ].
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3193
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3194
    self font:(font asSize:newSize).
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3195
!
9dae00116509 #BUGFIX by ca
ca
parents: 5517
diff changeset
  3196
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3197
originChanged:delta
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3198
    "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
  3199
     tell dependents (i.e. scrollers) about this"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3200
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3201
    super originChanged:delta.
e22c45e26653 intitial checkin
ca
parents:
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
!
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3204
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3205
sizeChanged:how
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3206
    "size changed - move origin up if possible
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3207
     change the layout of the labelView dependent on my layout"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3208
4163
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3209
    |selectionWasVisible lastExtent|
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3210
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3211
    lastExtent := previousExtent notNil ifTrue:[previousExtent] ifFalse:[self extent].
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3212
    selectionWasVisible := self isSelectionVisibleIn:lastExtent.
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3213
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3214
    previousExtent := self extent.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3215
    super sizeChanged:how.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3216
4163
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3217
    previousExtent := self extent.
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3218
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3219
    "/ 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
  3220
    "/ (could be invisible in a notebook ...)
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3221
    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
  3222
"/        labelView isVisible ifTrue:[
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3223
"/            lyt := labelView layout.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3224
"/            lyt  leftOffset:(layout leftOffset).
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3225
"/            lyt rightOffset:(layout rightOffset).
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3226
"/            labelView layout:lyt.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3227
"/        ].
4163
3d9fbb60d952 class: DSVColumnView
ca
parents: 4161
diff changeset
  3228
        previousExtent x ~= lastExtent x ifTrue: [
4123
a80521cc987c changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4116
diff changeset
  3229
            self fitColumns.
a80521cc987c changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4116
diff changeset
  3230
        ].
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3231
        selectionWasVisible ifTrue:[
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3232
            self makeSelectionVisible.
4020
3bf856409692 changed: #sizeChanged:
ca
parents: 3994
diff changeset
  3233
        ].
3bf856409692 changed: #sizeChanged:
ca
parents: 3994
diff changeset
  3234
        self updateEditViewOrigin.
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  3235
    ].
4059
b8d390e67d16 changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4056
diff changeset
  3236
4123
a80521cc987c changed: #sizeChanged:
Claus Gittinger <cg@exept.de>
parents: 4116
diff changeset
  3237
    "Modified: / 04-05-2012 / 14:34:24 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3238
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3239
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3240
!DSVColumnView methodsFor:'focus handling'!
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3241
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3242
canTab
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3243
    super canTab ifTrue:[
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3244
        ^ editView isNil
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3245
    ].
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3246
    ^ false
2101
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3247
!
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3248
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3249
showFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3250
    self invalidateSelection.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3251
    super showFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3252
!
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3253
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3254
showNoFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3255
    self invalidateSelection.
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3256
    super showNoFocus:explicit
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3257
!
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3258
2101
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3259
wantsFocusWithPointerEnter
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3260
    "views which like to take the keyboard focus
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3261
     when the pointer enters can do so by redefining this
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3262
     to return true"
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3263
3924
72044fd3296a changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
  3264
    editView notNil ifTrue:[^ false].
2237
1da5501b1248 bug fix in focus handling
ca
parents: 2226
diff changeset
  3265
2958
99f7bfe9e9a2 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2956
diff changeset
  3266
    (UserPreferences current focusFollowsMouse ~~ false
2101
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3267
    and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true)
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3268
    ]) ifTrue:[
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3269
        list size > 0 ifTrue:[
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3270
            ^ true
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3271
        ]
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3272
    ].
56dce43c4f46 *** empty log message ***
penk
parents: 2074
diff changeset
  3273
    ^ false
3924
72044fd3296a changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
  3274
72044fd3296a changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents: 3923
diff changeset
  3275
    "Modified: / 08-08-2010 / 14:41:00 / cg"
1665
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3276
! !
51c444bfe5ae default behavour tabing; not yet configurable (next step)
ca
parents: 1661
diff changeset
  3277
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3278
!DSVColumnView methodsFor:'gc operations'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3279
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3280
imageOnMyDevice:anImage
4606
1cc343187f71 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4589
diff changeset
  3281
    "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
  3282
1cc343187f71 Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents: 4589
diff changeset
  3283
    anImage isNil ifTrue:[^ nil].
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  3284
    ^ anImage onDevice:device.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3285
!
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3286
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3287
registerImage:anImage key:aKey
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3288
    "any row can register an image with a unique identifier a key symbol"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3289
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3290
    |img|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3291
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3292
    (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3293
        ^ img
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3294
    ].
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3295
    img := self imageOnMyDevice:anImage.
567
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  3296
    registererImages at:aKey put:img.
01083cbb4bae checkin from browser
ca
parents: 563
diff changeset
  3297
    ^ img
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3298
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3299
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3300
registeredImageAt:aKey
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3301
    "any row can register an image with a unique identifier"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3302
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3303
    ^ registererImages at:aKey ifAbsent:nil
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3304
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3305
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3306
releaseAllRegisteredImages
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3307
    "release all registered images"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3308
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3309
    registererImages := IdentityDictionary new.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3310
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3311
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3312
!DSVColumnView methodsFor:'help'!
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3313
5680
48cf8714352b #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5670
diff changeset
  3314
helpTextAt:aPoint
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3315
    "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
  3316
3248
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3317
    |rowNr colNr col|
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3318
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3319
    columnDescriptors isEmpty ifTrue:[^ nil].
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3320
3248
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3321
    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
  3322
    rowNr isNil ifTrue:[^ nil ].
c9e48b873e6e do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents: 3239
diff changeset
  3323
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3324
    colNr := self xVisibleToColNr:aPoint x.
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  3325
    colNr notNil ifTrue:[
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3326
        col := columnDescriptors at:colNr.
3458
5f9a85c6279a Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents: 3449
diff changeset
  3327
        ^ col activeHelpTextForRow:rowNr.
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3328
    ].
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3329
    ^ nil
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3330
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3331
    "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
  3332
    "Modified: / 16-10-2007 / 17:52:24 / cg"
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3333
! !
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3334
2500
1477b0a5a918 method category rename
Claus Gittinger <cg@exept.de>
parents: 2488
diff changeset
  3335
!DSVColumnView methodsFor:'initialization & release'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3336
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3337
create
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3338
    |graphicsDevice|
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3339
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3340
    super create.
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  3341
    graphicsDevice := device.
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3342
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3343
    fgColor     := fgColor     onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3344
    bgColor     := bgColor     onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3345
    selectionForegroundColor := selectionForegroundColor onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3346
    selectionBackgroundColor := selectionBackgroundColor onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3347
    selectionFrameColor notNil ifTrue:[selectionFrameColor := selectionFrameColor onDevice:graphicsDevice].
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3348
    selectionForegroundColorNoFocus := selectionForegroundColorNoFocus onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3349
    selectionBackgroundColorNoFocus := selectionBackgroundColorNoFocus onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3350
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3351
    buttonShadowColor := buttonShadowColor onDevice:graphicsDevice.
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3352
    buttonLightColor  := buttonLightColor onDevice:graphicsDevice.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3353
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3354
    buttonHalfShadowColor notNil ifTrue:[
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3355
        buttonHalfShadowColor := buttonHalfShadowColor onDevice:graphicsDevice
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3356
    ].
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
    buttonHalfLightColor notNil ifTrue:[
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3359
        buttonHalfLightColor := buttonHalfLightColor onDevice:graphicsDevice
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3360
    ].
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3361
    rowSelectorForm         := self imageOnMyDevice:rowSelectorForm.
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3362
    checkToggleActiveImage  := self imageOnMyDevice:checkToggleActiveImage.
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3363
    checkTogglePassiveImage := self imageOnMyDevice:checkTogglePassiveImage.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3364
    checkToggleForm         := self imageOnMyDevice:checkToggleForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3365
    radioButtonActiveImage  := self imageOnMyDevice:radioButtonActiveImage.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3366
    radioButtonPassiveImage := self imageOnMyDevice:radioButtonPassiveImage.
2488
74c81c1e30d7 imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents: 2487
diff changeset
  3367
    comboButtonForm         := self imageOnMyDevice:comboButtonForm.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3368
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3369
    "Modified: / 20-01-2011 / 08:43:51 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3370
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3371
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3372
initStyle
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3373
    "setup colors, etc."
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3374
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3375
    |button widget|
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3376
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3377
    super initStyle.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3378
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3379
    DefaultForegroundColor isNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3380
        self class updateStyleCache
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3381
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3382
    fgColor     := DefaultForegroundColor.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3383
    bgColor     := DefaultBackgroundColor.
4875
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
  3384
    labelFgColor := DefaultLabelForegroundColor.
e47db739d7d1 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4794
diff changeset
  3385
    labelBgColor := DefaultLabelBackgroundColor.
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  3386
    selectionForegroundColor := DefaultHilightForegroundColor.
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  3387
    selectionBackgroundColor := DefaultHilightBackgroundColor.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3388
    selectionFrameColor      := DefaultHilightFrameColor.
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3389
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3390
    shadowColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3391
        shadowColor := Color grayPercent:40.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3392
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3393
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3394
    lightColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3395
        lightColor := Color grayPercent:75
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3396
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3397
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3398
    buttonLightColor    := ButtonLightColor  ? lightColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3399
    buttonShadowColor   := ButtonShadowColor ? shadowColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3400
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3401
    (ButtonEdgeStyle == #soft) ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3402
        buttonHalfShadowColor := ButtonHalfShadowColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3403
        buttonHalfLightColor  := ButtonHalfLightColor.
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3404
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3405
        buttonHalfShadowColor isNil ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3406
            buttonHalfShadowColor := buttonShadowColor lightened
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3407
        ]
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  3408
    ].
1490
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3409
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3410
    buttonHalfShadowColor isNil ifTrue:[
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3411
        buttonHalfShadowColor := Color gray
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3412
    ].
9c418c3aaf49 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
  3413
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3414
    selectionForegroundColorNoFocus isNil ifTrue:[
4653
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3415
        selectionForegroundColorNoFocus := DefaultHilightForegroundColorNoFocus.
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3416
        selectionForegroundColorNoFocus isNil ifTrue:[
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3417
            selectionForegroundColorNoFocus := selectionForegroundColor slightlyLightened.
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3418
        ]
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3419
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3420
    selectionBackgroundColorNoFocus isNil ifTrue:[
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3421
        selectionBackgroundColorNoFocus := DefaultHilightBackgroundColorNoFocus.
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3422
        selectionBackgroundColorNoFocus isNil ifTrue:[
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3423
            selectionBackgroundColor notNil ifTrue:[
4653
e760275fb093 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4644
diff changeset
  3424
                selectionBackgroundColorNoFocus := selectionBackgroundColor slightlyLightened.
4644
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3425
                "/ selectionBackgroundColorNoFocus := Color brightness:(selectionBackgroundColor "lightened" brightness).   "/ asGray.
a1734dfe9bfe class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4613
diff changeset
  3426
            ].
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3427
        ].
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3428
    ].
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3429
    selectionFrameColorNoFocus isNil ifTrue:[
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3430
        selectionFrameColor notNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3431
            selectionFrameColorNoFocus := selectionFrameColor lightened.
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3432
            "/ selectionFrameColorNoFocus := Color brightness:(selectionFrameColor "lightened" brightness).   "/ asGray
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3433
        ]
3138
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3434
    ].
bf718db445b5 highlight selection dependent on has focus
ca
parents: 3130
diff changeset
  3435
2711
6cbf18e03573 category
Claus Gittinger <cg@exept.de>
parents: 2703
diff changeset
  3436
    rowSelectorForm         := self class rowSelectorImage.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3437
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3438
    checkToggleActiveImage  := CheckToggleActiveImage.
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3439
    checkTogglePassiveImage := CheckTogglePassiveImage.
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3440
    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3441
    CheckToggleDisabledActiveImage isNil ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3442
        CheckToggleDisabledActiveImage := CheckToggle disabledActiveImage
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3443
    ].    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3444
    CheckToggleDisabledPassiveImage isNil ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3445
        CheckToggleDisabledPassiveImage := CheckToggle disabledPassiveImage
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3446
    ].    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3447
    checkToggleDisabledActiveImage  := CheckToggleDisabledActiveImage.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3448
    checkToggleDisabledPassiveImage := CheckToggleDisabledPassiveImage.
1100
376515452be4 support of all styles; windows and next
ca
parents: 1089
diff changeset
  3449
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3450
    CheckToggleForm isNil ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3451
        widget            := CheckToggle new.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3452
        CheckToggleForm   := widget label.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3453
        CheckToggleLevel  := widget offLevel.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3454
        CheckToggleExtent := widget preferredExtent.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3455
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3456
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3457
    checkToggleForm   := CheckToggleForm.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3458
    checkToggleLevel  := CheckToggleLevel.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3459
    checkToggleExtent := CheckToggleExtent.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3460
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3461
    radioButtonActiveImage  := RadioButtonActiveImage.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3462
    radioButtonPassiveImage := RadioButtonPassiveImage.
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  3463
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3464
    RadioButtonDisabledActiveImage isNil ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3465
        RadioButtonDisabledActiveImage := RadioButton disabledActiveForm.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3466
    ].    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3467
    RadioButtonDisabledPassiveImage isNil ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3468
        RadioButtonDisabledPassiveImage := RadioButton disabledPassiveForm.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3469
    ].    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3470
    radioButtonDisabledActiveImage  := RadioButtonDisabledActiveImage.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3471
    radioButtonDisabledPassiveImage := RadioButtonDisabledPassiveImage.
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3472
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3473
    ComboButtonForm isNil ifTrue:[
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3474
        widget            := ComboListView new.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3475
        button            := widget menuButton.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3476
        ComboButtonForm   := button label.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3477
        ComboButtonLevel  := button offLevel.
3428
436f115aefe8 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  3478
        ComboButtonExtent := (button preferredWidth) @ (widget preferredHeight).
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3479
    ].
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3480
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3481
    comboButtonForm   := ComboButtonForm.
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3482
    ComboButtonDisabledForm isNil ifTrue:[
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3483
        ComboButtonDisabledForm := ComboView disabledForm
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3484
    ].    
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3485
    comboButtonDisabledForm   := ComboButtonDisabledForm.
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3486
    comboButtonLevel  := ComboButtonLevel.
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  3487
    comboButtonExtent := ComboButtonExtent.
3989
5c6706e4e0d1 preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents: 3988
diff changeset
  3488
4101
675d38e2ad1e changed: #initStyle
Claus Gittinger <cg@exept.de>
parents: 4095
diff changeset
  3489
    "Modified: / 20-01-2012 / 15:48:13 / cg"
5890
99d778b7d1a3 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5873
diff changeset
  3490
    "Modified: / 17-08-2018 / 17:33:56 / Claus Gittinger"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3491
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3492
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3493
initialize
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3494
    "set default attributes"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3495
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3496
    |fontOnDevice|
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3497
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3498
    verticalSpacing    := verticalSpacing ? self class verticalSpacing.
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3499
    horizontalSpacing  := horizontalSpacing ? self class horizontalSpacing.
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3500
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3501
    super initialize.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3502
    self lineWidth:0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3503
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3504
    separatorSize      := 1.                            "/ separators mode 2D
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3505
    verticalSpacing    := self class verticalSpacing.
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3506
    horizontalSpacing  := self class horizontalSpacing.
1668
085f5ee84f9b tabing internal
ca
parents: 1665
diff changeset
  3507
    tabIntern          := true.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3508
    useIndex           := true.
5664
8eb2ee9eb548 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5639
diff changeset
  3509
    ignoreReselect     := true.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3510
    viewOrigin         := 0@0.
5204
fccb63f32188 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5195
diff changeset
  3511
    fontOnDevice       := gc deviceFont.
4521
727d661f5e8e class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4496
diff changeset
  3512
    rowFontAscent      := fontOnDevice ascent.
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  3513
    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
  3514
    minRowHeight       := rowHeight.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3515
    multipleSelectOk   := false.                        "/ multiselect disabled
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  3516
    selectedRowIndex   := 0.                            "/ no selection
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3517
    self selectedColIndex:0.
1778
51bbd960baf9 change registeredIcons from IdentityDictionary to Dictionary
ca
parents: 1776
diff changeset
  3518
    registererImages   := Dictionary new.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3519
    columnDescriptors  := #().
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3520
    beDependentOfRows  := false.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3521
    colorMap           := Dictionary new.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3522
    catchChangeEvents  := false.
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3523
    selectRowOnDefault := true.
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  3524
    autoScroll         := true.
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  3525
    autoScrollToColumn := true.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3526
    scrollRowWise      := false.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3527
    sortListInPlace    := false.    "/ when false (default for backward compatibility):
4613
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3528
                                    "/ if sorting, create a copy
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3529
                                    "/ of the list, which is wrong when useIndex is on,
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3530
                                    "/ as the application will get the index in the sorted
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3531
                                    "/ list, which is probably different from tha apps list mode.
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3532
                                    "/ When true (should be default, but that might break many
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3533
                                    "/ users), the passed in list is sorted in place (i.e. possibly
73e2facef522 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4606
diff changeset
  3534
                                    "/ sorting the application's list).
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3535
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3536
    updateListHolderWhenSorting := false.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3537
                                    "/ when false (default for backward compatibility):
5194
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3538
                                    "/ 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
  3539
                                    "/ When true (should be default, but that might break many
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3540
                                    "/ users), the sorted list is written back into the listHolder,
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3541
                                    "/ but only if sortListInPlace is false.
b28b44a4a21e #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5100
diff changeset
  3542
3223
b9d1b2cec92d Bug 623: active help during button motion
ca
parents: 3219
diff changeset
  3543
    "/ need for active help
b9d1b2cec92d Bug 623: active help during button motion
ca
parents: 3219
diff changeset
  3544
    self enableMotionEvents.
b9d1b2cec92d Bug 623: active help during button motion
ca
parents: 3219
diff changeset
  3545
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  3546
    "Modified: / 13-09-2017 / 16:08:34 / cg"
705
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  3547
!
d9ebfd72d506 set selection if exists after mapping
tz
parents: 667
diff changeset
  3548
2807
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3549
mapped
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3550
    "set selection (if any) after mapping"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3551
2807
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3552
    |idx|
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3553
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3554
    super mapped.
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3555
    needFitColumns == true ifTrue:[
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3556
        self fitColumns
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3557
    ].
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3558
    (idx := self firstIndexSelected) ~~ 0 ifTrue:[
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3559
        self scrollToRowAt:idx colAt:0.
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3560
    ].
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3561
!
0e03635f5ced *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2804
diff changeset
  3562
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3563
realize
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3564
    "recompute contents and fit columns to view"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3565
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3566
    |selection|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3567
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3568
    self bitGravity:#NorthWest.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3569
    self recomputeHeightOfContents.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3570
    selection := 0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3571
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3572
        (model respondsTo:#selectionIndex) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3573
            selection := model selectionIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3574
        ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3575
            model == listHolder ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3576
                selection := model value
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3577
            ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3578
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3579
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3580
    self selectRowIndex:selection.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3581
    super realize.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3582
    self fitColumns.
2011
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  3583
!
128778a6a31d dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents: 1971
diff changeset
  3584
2157
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3585
release
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3586
    "remove dependencies"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3587
2157
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3588
    self columnHolder:nil.
4219
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3589
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3590
    beDependentOfRows ifTrue:[self makeIndependentOfRows].
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3591
    listHolder notNil ifTrue:[
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3592
        listHolder removeDependent:self.
5038c1c44e84 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4176
diff changeset
  3593
    ].
2157
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3594
    columnAdaptor isValueModel ifTrue:[
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3595
        columnAdaptor removeDependent:self
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3596
    ].
6cfdf247519a destroy - release
Claus Gittinger <cg@exept.de>
parents: 2154
diff changeset
  3597
    super release
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3598
! !
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3599
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3600
!DSVColumnView methodsFor:'obsolete'!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3601
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3602
has3Dsepartors
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3603
    <resource: #obsolete>
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3604
    "shouldn't be used any more"
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3605
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3606
    self obsoleteMethodWarning.
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3607
    ^ self has3Dseparators
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3608
!
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3609
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3610
has3Dsepartors:aBool
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3611
    <resource: #obsolete>
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3612
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3613
    "shouldn't be used any more"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3614
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  3615
    self obsoleteMethodWarning.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3616
    self has3Dseparators:aBool
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3617
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3618
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3619
!DSVColumnView methodsFor:'private'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3620
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3621
anyColumnHasBackground
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3622
    columnDescriptors isNil ifTrue:[^ false].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3623
    columnDescriptors do:[:eachCol |
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3624
        |bg|
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3625
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3626
        bg := eachCol backgroundColor.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3627
        (bg notNil and:[bg isImageOrForm]) ifTrue:[^ true].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3628
        eachCol bgSelector notNil ifTrue:[^ true].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3629
    ].
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3630
    ^ false.
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3631
!
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3632
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3633
anyColumnHasPotentialNonConstantBackground
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3634
    columnDescriptors isNil ifTrue:[^ false].
2933
ab7be1db710d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  3635
    ^ columnDescriptors contains:[:someCol | someCol hasPotentialNonConstantBackground].
ab7be1db710d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  3636
"/    columnDescriptors do:[:eachCol | eachCol hasPotentialNonConstantBackground ifTrue:[^ true]].
ab7be1db710d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2907
diff changeset
  3637
"/    ^ false.
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3638
!
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3639
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3640
destroyEditView
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3641
    "destroy the edit view; release KeyboardForwarder"
2730
77bab35466a3 *** empty log message ***
ca
parents: 2728
diff changeset
  3642
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3643
    editValue notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3644
        editValue removeDependent:self.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3645
        editValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  3646
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3647
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3648
    editView notNil ifTrue:[ |winGroup focusView|
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3649
        self hasFocus ifTrue:[focusView := self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3650
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3651
        editView withAllSubViewsDo:[:aView |
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3652
            aView hasFocus ifTrue:[focusView := self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3653
            aView delegate:nil
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3654
        ].
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3655
        editView destroy.
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3656
        editView := nil.
2730
77bab35466a3 *** empty log message ***
ca
parents: 2728
diff changeset
  3657
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3658
        winGroup := self windowGroup.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3659
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3660
        winGroup notNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  3661
            winGroup focusView:focusView.
2730
77bab35466a3 *** empty log message ***
ca
parents: 2728
diff changeset
  3662
        ]
1111
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3663
    ].
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3664
!
4fd0430173fa support #Tab
ca
parents: 1109
diff changeset
  3665
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3666
detectViewAt:aPoint in:aView
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3667
    "returns the view at a point"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3668
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3669
    aView isNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3670
        ^ nil
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3671
    ].
2019
0d2757149700 extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents: 2011
diff changeset
  3672
    ^ aView detectViewAt:aPoint.
637
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3673
!
e56ec99923ae VW compatible
ca
parents: 622
diff changeset
  3674
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3675
fitColumns
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3676
    "fit columns to view; "
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3677
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3678
    |selectedColumn columnsWithRelativeWidth
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3679
     overallMinWidth restWidth anyChange oldOrgX newOrgX oldWidth|
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3680
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3681
    realized ifFalse:[
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3682
        needFitColumns := true.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3683
        ^ self
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3684
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3685
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3686
    cachedPreferredExtent isNil ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3687
        self preferredExtent.
2956
c4319600989e *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 2933
diff changeset
  3688
    ] ifFalse:[
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  3689
        oldWidth := cachedPreferredExtent x.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  3690
    ].
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3691
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3692
    columnDescriptors isEmpty ifTrue:[
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3693
        ^ self
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3694
    ].
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3695
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3696
    overallMinWidth := 0.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3697
    anyChange := false.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3698
    columnsWithRelativeWidth := OrderedCollection new.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3699
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3700
    columnDescriptors do:[:aCol|
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3701
        aCol canResize ifTrue:[
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3702
            anyChange := true.
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3703
            aCol invalidate.
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3704
        ].
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3705
        aCol hasRelativeWidth ifTrue:[columnsWithRelativeWidth add:aCol].
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3706
        overallMinWidth := overallMinWidth + aCol minWidth.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3707
    ].
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3708
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3709
    cachedPreferredExtent := width @(self preferredHeight).
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3710
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3711
    columnsWithRelativeWidth notEmpty ifTrue:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3712
        restWidth := self innerWidth - overallMinWidth.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3713
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3714
        restWidth > 0 ifTrue:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3715
            |sumOfAnnouncedRelativeWidths sumWeach|
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3716
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3717
            "/ distribute restwidth among remaining columns according to
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3718
            "/ their announced relative width's
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3719
            sumOfAnnouncedRelativeWidths := columnsWithRelativeWidth sum:[:each | each description width].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3720
            sumWeach := 0.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3721
            columnsWithRelativeWidth do:[:each |
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3722
                |eachRel wEach|
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3723
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3724
                eachRel := each description width / sumOfAnnouncedRelativeWidths.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3725
                each == columnsWithRelativeWidth last ifTrue:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3726
                    wEach := restWidth - sumWeach.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3727
                ] ifFalse:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3728
                    wEach := (eachRel * restWidth) truncated.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3729
                    sumWeach := sumWeach + wEach.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3730
                ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3731
                each setWidth:wEach.
4415
474bed6d8e60 class: DSVColumnView
ca
parents: 4359
diff changeset
  3732
            ].
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3733
        ]
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3734
    ] ifFalse:[
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3735
        anyChange ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3736
            | resizableColumns numberOfResizable additionalOffsetX |
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3737
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3738
            overallMinWidth  := 0.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3739
            resizableColumns := OrderedCollection new.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3740
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3741
            columnDescriptors do:[: eachColumn |
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3742
                eachColumn canResize ifTrue:[ resizableColumns add: eachColumn ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3743
                eachColumn width: nil. "force a recomputation of width"
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3744
                overallMinWidth := overallMinWidth + eachColumn width.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3745
            ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3746
            numberOfResizable := resizableColumns size.
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3747
            numberOfResizable > 0 ifTrue:[
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3748
                restWidth := self innerWidth - overallMinWidth.
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3749
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3750
                restWidth > numberOfResizable ifTrue:[
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3751
                    additionalOffsetX := restWidth // numberOfResizable.
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3752
                    resizableColumns do:[:aCol| aCol growWidth:additionalOffsetX ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3753
                    restWidth := restWidth - (additionalOffsetX * numberOfResizable).
4425
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3754
                ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3755
                restWidth > 0 ifTrue:[ resizableColumns last growWidth:restWidth ].
c013e9757f1a class: DSVColumnView
ab
parents: 4415
diff changeset
  3756
            ].
1484
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3757
        ].
52b16597ce48 support relative width
Claus Gittinger <cg@exept.de>
parents: 1483
diff changeset
  3758
    ].
1492
eefe55529016 support tabulators
Claus Gittinger <cg@exept.de>
parents: 1490
diff changeset
  3759
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  3760
    shown ifTrue:[
4116
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3761
        "have to invalidate unconditionally even if nothing has been changed here:
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3762
         #fitColumns is called from #changeWidthOfColumn:deltaX:
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3763
         after a manual resize"
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3764
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3765
        self      invalidate.
d79570ee3773 changed:
Stefan Vogel <sv@exept.de>
parents: 4101
diff changeset
  3766
        labelView invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3767
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3768
        (oldOrgX := viewOrigin x) ~~ 0 ifTrue:[
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3769
            |prefWidth|
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3770
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3771
            "/ UPDATE VIEW-ORIGIN X
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3772
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3773
            prefWidth   := self preferredWidth.
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3774
            newOrgX := (prefWidth - self innerWidth) max:0.
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3775
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3776
            newOrgX < oldOrgX ifTrue:[
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3777
                self originWillChange.
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3778
                viewOrigin := newOrgX @ (viewOrigin y).
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3779
                self originChanged:((newOrgX - oldOrgX) @ 0).
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3780
            ]
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3781
        ].
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3782
1930
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3783
        "/ 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
  3784
1930
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3785
"/        self hasSelection ifTrue:[
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3786
"/            editView notNil ifTrue:[
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3787
"/                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
  3788
"/            ].
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3789
"/            self scrollToSelection.
31274c3264d6 do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents: 1926
diff changeset
  3790
"/        ].
2319
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3791
4095
1a4c11fc0865 added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents: 4073
diff changeset
  3792
        "/ 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
  3793
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3794
        editView notNil ifTrue:[
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3795
            selectedColumn := self selectedColumn.
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3796
            selectedColumn notNil ifTrue:[
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3797
                editView width:(selectedColumn width - (2 * separatorSize)).
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3798
            ]
b75af47412ff bug fix; if columns extent changed, update extent of editView
ca
parents: 2318
diff changeset
  3799
        ].
3428
436f115aefe8 added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents: 3382
diff changeset
  3800
        oldWidth ~= self preferredWidth ifTrue:[
2956
c4319600989e *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 2933
diff changeset
  3801
            self contentsChanged.
c4319600989e *** empty log message ***
Michael Beyl <mb@exept.de>
parents: 2933
diff changeset
  3802
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3803
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3804
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3805
    "Modified (format): / 15-03-2018 / 11:40:25 / mawalch"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3806
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3807
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3808
hasSelectables
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3809
    columnDescriptors do:[:aCol|
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3810
        (aCol rendererType == #rowSelector) ifFalse:[
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3811
            (aCol description canSelect) ifTrue:[^ true].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3812
        ]
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3813
    ].
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3814
    ^ false.
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3815
!
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  3816
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3817
maxViewOriginY
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3818
    "returns the maximum possible y of the view origin"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3819
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3820
    |y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3821
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3822
    y := self heightOfContents - self innerHeight.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3823
    ^ y max:0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3824
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3825
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3826
updateEditViewOrigin
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3827
    "update origin of the editView"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3828
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3829
    |x y|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3830
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3831
    editView notNil ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3832
        y := self yVisibleOfRowNr:(self firstIndexSelected).
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  3833
        x := self xVisibleOfColNr:self selectedColIndex.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  3834
        editView origin:(x @ y + separatorSize).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3835
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3836
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3837
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3838
xVisibleOfColNr:aColNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3839
    "returns visible x assigned to a column number"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3840
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3841
    |x
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3842
     end "{ Class:SmallInteger }"|
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3843
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3844
    x := margin - viewOrigin x.
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3845
    aColNr > 1 ifTrue:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3846
        end := aColNr - 1.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3847
        columnDescriptors
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3848
            from:1
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3849
            to:end
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3850
            do:[:aCol | x := x + aCol width ]
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3851
    ].
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3852
    ^ x
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3853
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3854
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3855
xVisibleToColNr:x
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  3856
    "returns the column number for a physical x position.
5079
1ef6c9d3cdf3 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5057
diff changeset
  3857
     Returns nil if x is beyond the last column."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3858
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3859
    |x0|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3860
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3861
    x0 := x + viewOrigin x - margin.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3862
    columnDescriptors keysAndValuesDo:[:index :aCol |
1951
670b575a31a4 if any col has potential non-constant background,
ps
parents: 1949
diff changeset
  3863
        x0 := x0 - aCol width.
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3864
        x0 <= 0 ifTrue:[ ^ index ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3865
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3866
    ^ nil.
3215
edb9fb9e4931 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3172
diff changeset
  3867
3217
e74188fce7c2 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3215
diff changeset
  3868
    "Modified: / 26-03-2007 / 15:22:01 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3869
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3870
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3871
yVisibleOfRowNr:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3872
    "returns visible y assigned to the row number"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3873
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3874
    ^ (aRowNr - 1) * rowHeight + margin - viewOrigin y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3875
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3876
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3877
yVisibleToRowNr:y
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3878
    "returns the row number assigned to a physical y or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3879
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3880
    |rowNr|
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3881
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3882
    rowNr := (y + viewOrigin y - margin) // rowHeight + 1.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3883
    (rowNr between:1 and:(list size)) ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3884
        ^ rowNr
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3885
    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  3886
    ^ nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3887
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3888
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3889
!DSVColumnView methodsFor:'queries'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3890
2728
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3891
firstLineShown
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3892
    "for protocol-compat. with listviews"
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3893
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3894
    ^ self indexOfFirstRowShown
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3895
!
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  3896
1149
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3897
hasOpenEditor
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3898
    ^ editView notNil
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3899
!
c212f122c8b3 allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents: 1136
diff changeset
  3900
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3901
indexOfFirstRowShown
2797
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3902
    "returns the index of the first shown row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3903
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3904
    |idx|
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3905
1498
3b4dc3326705 checkin from browser
tm
parents: 1497
diff changeset
  3906
    idx := (viewOrigin y // rowHeight) + 1.
2797
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3907
    ^ (idx max:1)
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3908
!
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3909
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3910
indexOfLastRowShown
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3911
    "returns the index of the last shown row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3912
2797
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3913
    |idx|
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3914
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3915
    idx := (viewOrigin y + height - 1 // rowHeight) + 1.
9f171595edcc indexOfLastVisibleItem
Claus Gittinger <cg@exept.de>
parents: 2792
diff changeset
  3916
    ^ (idx min:list size)
563
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3917
!
826871ce82c9 bug fix:
ca
parents: 561
diff changeset
  3918
1805
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3919
isEnabled
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3920
    ^ enableChannel value ~~ false
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3921
!
66792febb315 add enableChannel
tm
parents: 1778
diff changeset
  3922
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3923
isRowSelectable:aRowNumber
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3924
    "returne true if a row number is selectable"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3925
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3926
    (aRowNumber notNil and:[ aRowNumber ~~ 0 ]) ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3927
        selectConditionBlock isNil ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3928
            ^ true
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3929
        ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3930
        ^ (selectConditionBlock value:aRowNumber)
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3931
    ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3932
    ^ false
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3933
!
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  3934
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3935
numberOfColumns
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3936
    "returns number of columns"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3937
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3938
    ^ columnDescriptors size
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3939
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3940
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3941
numberOfRows
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3942
    "returns number of rows"
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3943
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  3944
    ^ list size
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3945
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3946
    "Modified (comment): / 15-03-2018 / 12:23:01 / mawalch"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3947
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3948
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3949
rowHeight
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  3950
    "get the height of the highest row in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3951
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3952
    ^ rowHeight
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3953
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3954
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3955
separatorSize
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3956
    "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
  3957
     3D effect."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3958
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  3959
    ^ separatorSize
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3960
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3961
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3962
size
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3963
    "returns number of rows"
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3964
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3965
    ^ list size
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3966
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  3967
    "Modified (comment): / 15-03-2018 / 12:24:18 / mawalch"
4486
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3968
!
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3969
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3970
yVisibleToLineNr:yVisible
3407ac48b630 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4459
diff changeset
  3971
    ^ self yVisibleToRowNr:yVisible.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3972
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3973
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3974
!DSVColumnView methodsFor:'recomputation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  3975
5952
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3976
computePreferredExtent
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3977
    "return my preferred extent"
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3978
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3979
    |numRows prefWidth prefHeight|
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3980
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3981
    cachedPreferredExtent notNil ifTrue:[
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3982
        ^ cachedPreferredExtent
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3983
    ].
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3984
    self computeRowHeight.
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3985
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3986
    prefWidth := (columnDescriptors size - 1) max:0.  "/ for the separators
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3987
    columnDescriptors do:[:aCol |
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3988
        prefWidth := prefWidth + (aCol minWidth max:5).
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3989
    ].
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3990
    numRows := list size.
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3991
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3992
    "/ no need for a separator after the last row.
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3993
    prefHeight := separatorSize + ((numRows * rowHeight) "- separatorSize") "+ separatorSize".
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3994
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3995
    cachedPreferredExtent := prefWidth @ prefHeight.
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3996
    ^ cachedPreferredExtent
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3997
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3998
    "Created: / 09-11-2018 / 19:50:03 / Claus Gittinger"
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  3999
!
059e5ddd60f3 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5902
diff changeset
  4000
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4001
computeRowHeight
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4002
    |minHeight|
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4003
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  4004
    minHeight := self font height.
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4005
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4006
    columnDescriptors do:[:aCol |
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4007
        minHeight := (aCol heightOfHighestRow) max:minHeight.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4008
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4009
5603
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  4010
    "/ 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
  4011
    "/ (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
  4012
    "/  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
  4013
    "/  carried on in the minRowHeight)
974a4c6a7656 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5602
diff changeset
  4014
    minHeight := 2 + minHeight + 2.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4015
5602
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4016
    rowHeight := (verticalSpacing + minHeight + verticalSpacing + separatorSize).
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4017
    minRowHeight := rowHeight.
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4018
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4019
    "Created: / 13-09-2017 / 15:32:28 / cg"
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4020
!
3ac5c652c19e #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5563
diff changeset
  4021
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4022
hasPreferredExtent
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4023
    "returns true if preferred extent is accumulated"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4024
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4025
    ^ cachedPreferredExtent notNil
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4026
!
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4027
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4028
preferredExtentChanged
3519
9102be1f145c fix typo in comment
Stefan Vogel <sv@exept.de>
parents: 3518
diff changeset
  4029
    "called if the preferred extent changed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4030
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4031
    |x "{ Class:SmallInteger }"
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4032
     y "{ Class:SmallInteger }"|
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4033
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4034
    y := viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4035
    x := viewOrigin x.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4036
    (y ~~ 0 or:[ x ~~ 0 ]) ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4037
        self originWillChange.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4038
        viewOrigin := 0 @ 0.
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4039
        cachedPreferredExtent := nil.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4040
        self originChanged:(x negated @ y negated).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4041
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4042
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4043
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4044
recomputeHeightOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4045
    "recompute height of contents( scrolling )"
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4046
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4047
    cachedPreferredExtent := nil.
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4048
"/    cachedPreferredExtent notNil ifTrue:[
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4049
"/        cachedPreferredExtent y:(rowHeight * list size)
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4050
"/    ] ifFalse:[
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4051
"/        self preferredExtent
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4052
"/    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4053
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4054
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4055
!DSVColumnView methodsFor:'scroller interface'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4056
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4057
innerHeight
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4058
    "returns the inner height of the contents shown"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4059
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4060
    ^ height - margin - margin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4061
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4062
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4063
verticalScrollStep
3500
d2adfa92fa6d comment
Claus Gittinger <cg@exept.de>
parents: 3494
diff changeset
  4064
    "return the amount to scroll when stepping up/down (also used for mouseWheel)."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4065
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4066
    ^ rowHeight
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4067
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4068
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4069
viewOrigin
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4070
    "return the viewOrigin;
5252
06aa7602b274 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5214
diff changeset
  4071
     that's the coordinate of the contents which is shown topLeft in the view."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4072
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4073
    ^ viewOrigin
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4074
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4075
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4076
widthOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4077
    "return the width of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4078
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4079
    cachedPreferredExtent isNil ifTrue:[
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4080
        self preferredExtent
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4081
    ].
3488
d30da03147fe preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3478
diff changeset
  4082
    ^ cachedPreferredExtent x
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4083
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4084
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4085
xOriginOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4086
    "return the horizontal origin of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4087
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4088
    ^ viewOrigin x
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4089
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4090
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4091
yOriginOfContents
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4092
    "return the vertical origin of the contents in pixels"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4093
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4094
    ^ viewOrigin y
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4095
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4096
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4097
!DSVColumnView methodsFor:'scrolling'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4098
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4099
scrollTo:anOrigin redraw:doRedraw
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4100
    "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
  4101
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4102
    |newOrg dltOrg wg
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4103
     h       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4104
     w       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4105
     x       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4106
     x0      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4107
     x1      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4108
     y       "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4109
     y0      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4110
     y1      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4111
     dX      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4112
     dY      "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4113
     innerHG "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4114
     innerWT "{ Class:SmallInteger }"
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4115
     lMargin
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4116
    |
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4117
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4118
    shown ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4119
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4120
    ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4121
1448
b389b8c76479 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  4122
    (wg := self windowGroup) notNil ifTrue:[
b389b8c76479 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1416
diff changeset
  4123
        wg processRealExposeEventsFor:self.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4124
    ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4125
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4126
    innerWT := self innerWidth.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4127
    innerHG := self innerHeight.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4128
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4129
    h := viewOrigin y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4130
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4131
    (y := anOrigin y) > h ifTrue:[              "/ end of contents
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4132
        y > (dY := self maxViewOriginY) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4133
            y := dY max:h
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4134
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4135
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4136
        y := y max:0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4137
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4138
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4139
    (x := anOrigin x) > 0 ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4140
        x := x min:(self widthOfContents - innerWT).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4141
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4142
    x      := x max:0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4143
    newOrg := (x @ y).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4144
    dltOrg := newOrg - viewOrigin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4145
    dX     := dltOrg x.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4146
    dY     := dltOrg y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4147
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4148
    (dX == 0 and:[dY == 0]) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4149
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4150
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4151
    self originWillChange.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4152
    viewOrigin := newOrg.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4153
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4154
    doRedraw ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4155
        ^ self originChanged:dltOrg
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4156
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4157
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4158
    dY ~~ 0 ifTrue:[                            "/ SCROLL VERTICAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4159
        dY := dY abs.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4160
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4161
        (dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  4162
            self invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4163
        ] ifFalse:[                             "/ COPY VERTICAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4164
            y0 := y1 := margin + dY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4165
            h  := innerHG - dY.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4166
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4167
            dltOrg y < 0 ifTrue:[y0 := margin. y := y0]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4168
                        ifFalse:[y1 := margin. y := y1 + h].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4169
1460
2fe0ac4bc4d1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1448
diff changeset
  4170
            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
  4171
            self invalidateX:margin y:y width:innerWT height:(innerHG - h).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4172
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4173
    ] ifFalse:[                                 "/ SCROLL HORIZONTAL
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4174
        dX := dX abs.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4175
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4176
        innerWT - dX < 20 ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4177
            labelView invalidate.
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  4178
            self invalidate.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4179
        ] ifFalse:[                             "/ COPY HORIZONTAL
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  4180
            x0 := x1 := dX + margin.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4181
            w  := width - dX.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4182
            lMargin := labelView margin.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4183
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4184
            dltOrg x < 0 ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4185
                " ->"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4186
                x0 := x := margin.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4187
                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
  4188
                self invalidateX:margin y:margin width:dX height:innerHG.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4189
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4190
                labelView notNil ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4191
                    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
  4192
                    labelView invalidateX:lMargin y:lMargin width:dX height:labelView innerHeight.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4193
                ].
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4194
            ] ifFalse:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4195
                x1 := margin. x := w.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4196
                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
  4197
                self invalidateX:width-margin-dX y:margin width:dX height:innerHG.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4198
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4199
                labelView notNil ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4200
                    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
  4201
                    labelView invalidateX:labelView width-lMargin-dX y:lMargin width:dX height:labelView innerHeight.
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4202
                ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4203
            ].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2125
diff changeset
  4204
            labelView repairDamage.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4205
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4206
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4207
    self originChanged:dltOrg.
1123
ea32a2e3d44d care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
  4208
2458
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4209
    wg notNil ifTrue:[
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4210
        wg processRealExposeEventsFor:self.
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4211
    ].
0411397ef0a2 readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents: 2445
diff changeset
  4212
1123
ea32a2e3d44d care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents: 1115
diff changeset
  4213
    "Modified: / 7.9.1998 / 16:39:49 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4214
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4215
2728
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4216
scrollToLine:aLineNr
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4217
    "for compat. with listViews"
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4218
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4219
    self scrollToRowAt:aLineNr colAt:1.
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4220
!
a53382733524 +scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents: 2722
diff changeset
  4221
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4222
scrollToRowAt:aRowNr colAt:aColNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4223
    "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
  4224
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4225
    |x  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4226
     y  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4227
     l  "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4228
     dY "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4229
     dX "{ Class:SmallInteger }"
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4230
    |
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4231
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4232
    (    (aRowNr between:1 and:(list size))
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4233
     and:[aColNr between:0 and:(columnDescriptors size)]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4234
    ) ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4235
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4236
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4237
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4238
    dY := dX := 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4239
    y  := self yVisibleOfRowNr:aRowNr.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4240
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4241
    y < margin ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4242
        dY := margin - y.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4243
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4244
        y := y + rowHeight.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4245
        l := height - margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4246
        y > l ifTrue:[dY := l - y]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4247
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4248
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4249
    aColNr == 0 ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4250
        dY == 0 ifTrue:[^ self].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4251
        dX := 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4252
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4253
        x  := self xVisibleOfColNr:aColNr.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4254
1163
f46f69609c53 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1149
diff changeset
  4255
        x <= margin ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4256
            dX := margin - x
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4257
        ] ifFalse:[
1497
d9b55a308c9e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1492
diff changeset
  4258
            x := x + (columnDescriptors at:aColNr) width.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4259
            l := width - margin.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4260
            x > l ifTrue:[dX := l - x]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4261
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4262
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4263
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4264
    (dX == 0 and:[dY == 0]) ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4265
        self scrollTo:(viewOrigin - (dX @ dY)).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4266
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4267
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4268
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4269
scrollToSelection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4270
    "make selection visible"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4271
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4272
    |rowNr|
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4273
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4274
    (rowNr := self firstIndexSelected) ~~ 0 ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4275
        self scrollToRowAt:rowNr colAt:self selectedColIndex
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4276
    ]
1506
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4277
!
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4278
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4279
scrollVerticalTo:aPixelOffset
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4280
    "change origin to make aPixelOffset be the top line"
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4281
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4282
    |orgX orgY|
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4283
4935ddbc8f6e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1498
diff changeset
  4284
    orgX := viewOrigin x.
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4285
    scrollRowWise ifTrue:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4286
        orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4287
    ] ifFalse:[
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4288
        orgY := aPixelOffset.
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4289
    ].
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4290
    ^ self scrollTo:(orgX @ orgY).
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4291
!
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4292
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4293
startAutoScroll:aSelectorOrBlock distance:aDistance
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4294
    "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
  4295
     - timeDelta for scroll is computed from distance"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4296
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4297
    |timeDelta scrollBlock|
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4298
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4299
    autoScroll ifFalse:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4300
        self stopAutoScroll.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4301
        ^ self
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4302
    ].
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4303
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4304
    autoScrollBlock notNil ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4305
        Processor removeTimedBlock:autoScrollBlock.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4306
    ] ifFalse:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4307
        self compressMotionEvents:false.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4308
    ].
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4309
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4310
    timeDelta := 0.5 / (aDistance abs).
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4311
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4312
    scrollBlock :=
2670
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4313
        [
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4314
            aSelectorOrBlock isSymbol ifTrue:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4315
                self perform:aSelectorOrBlock.
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4316
            ] ifFalse:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4317
                aSelectorOrBlock value
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4318
            ].
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4319
            autoScrollBlock notNil ifTrue:[
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4320
                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
  4321
            ]
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4322
        ].
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4323
27dacfff1d6d autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents: 2637
diff changeset
  4324
    autoScrollBlock := [self sensor pushUserEvent:#value for:scrollBlock].
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4325
    Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4326
!
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4327
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4328
stopAutoScroll
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4329
    "stop any autoScroll"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4330
1749
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4331
    autoScrollBlock notNil ifTrue:[
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4332
        Processor removeTimedBlock:autoScrollBlock.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4333
        autoScrollBlock := nil.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4334
        self compressMotionEvents:true.
e78e17ead1ce support of auto scrolling
ca
parents: 1722
diff changeset
  4335
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4336
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4337
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4338
!DSVColumnView methodsFor:'searching'!
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4339
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4340
findFirstColumnWithStringFrom:start to:stop
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4341
    start to:stop do:[:eachNr|
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4342
        |row lbl|
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4343
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4344
        row := self at:eachNr.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4345
        columnDescriptors keysAndValuesDo:[:colNr :col |
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4346
            lbl := col shownValueForRow:row rowNr:eachNr.
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4348
            lbl isNonByteCollection ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4349
                lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4350
            ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4351
            (lbl respondsTo:#string) ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4352
                lbl := lbl string.
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4353
            ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4354
            (lbl size ~~ 0 and:[(lbl at:1) isCharacter]) ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4355
                ^ colNr
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4356
            ]
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4357
        ]
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4358
    ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4359
    ^ nil
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4360
!
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4361
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4362
findFirstRowWithString: aString from:start to:stop by: step ignoreCase:ignoreCase
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4363
    "Return the rowNr from the first row that matches aString.
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4364
     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
  4365
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4366
    |stringToMatch|
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4367
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4368
    aString isEmptyOrNil ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4369
        ^ self
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4370
    ].
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4371
    stringToMatch := '*', aString, '*'.
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4372
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4373
    start to:stop by:step do:[:rowNr|
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4374
        |row lbl|
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4375
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4376
        row := self at:rowNr.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4377
        columnDescriptors keysAndValuesDo:[:colNr :col |
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4378
            lbl := col shownValueForRow:row rowNr:rowNr.
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4379
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4380
            lbl isNonByteCollection ifTrue:[
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4381
                lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first].
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4382
            ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4383
            (lbl respondsTo:#string) ifTrue:[
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4384
                lbl := lbl string.
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4385
            ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4386
            lbl isNumber ifTrue:[
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4387
                lbl := lbl printString.
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4388
            ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4389
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4390
            (lbl size ~~ 0
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4391
                and:[(lbl at:1) isCharacter
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4392
                and:[stringToMatch match:lbl caseSensitive:ignoreCase not
4359
bb6d48846f0d class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4333
diff changeset
  4393
            ]]) ifTrue:[
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4394
                ^ rowNr
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4395
            ]
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4396
        ]
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4397
    ].
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4398
    ^ nil
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4399
!
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4400
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4401
findFirstRowWithString: aString from:start to:stop ignoreCase:ignoreCase
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4402
    "Return the rowNr from the first row that matches aString.
5347
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4403
     The search is performed between the start and stop row numbers"
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4404
e0b26e38ee0f #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5310
diff changeset
  4405
    ^ self findFirstRowWithString:aString from:start to:stop by:1 ignoreCase:ignoreCase
3382
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4406
! !
a812cae515a5 add #findFirstRowWithString:from:to:ignoreCase:
fm
parents: 3302
diff changeset
  4407
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4408
!DSVColumnView methodsFor:'selection'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4409
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4410
addRowToSelection:aRowNr
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4411
    "add a row to the selection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4412
     if a column is selected, the column will be closed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4413
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4414
    |newSelection|
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4415
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4416
    (self isRowSelectable:aRowNr) ifFalse:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4417
        ^ self
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4418
    ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4419
    self numberOfSelections == 0 ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4420
        self selectColIndex:0 rowIndex:aRowNr.
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4421
        ^ self
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4422
    ].
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4423
    (self isInSelection:aRowNr) ifTrue:[
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4424
        ^ self
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4425
    ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4426
    multipleSelectOk ifFalse:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4427
        self selectColIndex:0 rowIndex:aRowNr.
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4428
        ^ self
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4429
    ].
2371
2bc91b1b59a5 bugfix when adding to selection
ca
parents: 2370
diff changeset
  4430
    newSelection := selectedRowIndex copyWith:aRowNr.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4431
    self selectedColIndex ~~ 0 ifTrue:[
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4432
        self selectColIndex:0 rowIndex:newSelection.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4433
    ] ifFalse:[
2907
c4a8cac87053 ctrl-select fixed
Claus Gittinger <cg@exept.de>
parents: 2886
diff changeset
  4434
        selectedRowIndex := newSelection.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4435
        self invalidateRowAt:aRowNr.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4436
        self selectionChanged.
2370
8d1fadf4e4f6 #addRowToSelection: omit redraws
ca
parents: 2363
diff changeset
  4437
    ].
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4438
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4439
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4440
deselect
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4441
    self selectColIndex:0 rowIndex:0
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4442
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4443
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4444
firstIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4445
    "returns index of first row selected or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4446
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4447
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4448
        ^ selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4449
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4450
    selectedRowIndex size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4451
        ^ selectedRowIndex at:1
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4452
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4453
    ^ 0
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4454
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4455
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4456
forceAcceptInEditor
2722
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4457
    editView notNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4458
        editView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4459
            allSubViewsDo:[:aSubView |
2722
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4460
                (aSubView respondsTo:#accept) ifTrue:[
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4461
                    aSubView accept
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4462
                ].
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4463
            ]
18c5bd340b1b close editor when clicking outside
ca
parents: 2714
diff changeset
  4464
    ]
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4465
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  4466
2151
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4467
hasRowSelection
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4468
    "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
  4469
     (as opposed to either no selection, or a columnSelection)"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4470
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4471
    ^ 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
  4472
!
50f8723054e7 selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
  4473
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4474
hasSelection
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4475
    "returns true if a selection exists"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4476
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4477
    ^ self numberOfSelections ~~ 0
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4478
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4479
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4480
isInSelection:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4481
    "returns true, if row, aRowNr is in the selection"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4482
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4483
    aRowNr ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4484
        multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4485
            ^ aRowNr == selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4486
        ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4487
        selectedRowIndex size ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4488
            ^ selectedRowIndex includes:aRowNr
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4489
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4490
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4491
    ^ false
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4492
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4493
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4494
isRowSelected:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4495
    "returns true, if row is in the selection"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4496
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4497
    self selectedColIndex == 0 ifTrue:[
647
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4498
        ^ self isInSelection:aRowNr
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4499
    ].
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4500
    ^ false
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4501
!
ee98a1976972 support of different styles
ca
parents: 645
diff changeset
  4502
2263
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4503
isRowVisible:aRowNr
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4504
    |y h|
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4505
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4506
    h := rowHeight.
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4507
    y := self yVisibleOfRowNr:aRowNr.
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4508
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4509
    y < margin ifTrue:[
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4510
        (h := h + y) <= margin ifTrue:[
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4511
            ^ false
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4512
        ].
2263
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4513
    ] ifFalse:[
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4514
        y >= (height-margin) ifTrue:[^ false].
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4515
    ].
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4516
    ^ true
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4517
!
e7648d72264f + #isRowVisible
penk
parents: 2247
diff changeset
  4518
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4519
isSelected:aRowNr inColumn:aColNr
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  4520
    "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
  4521
     number is selected."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4522
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4523
    multipleSelectOk ifFalse:[
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4524
        aRowNr ~~ selectedRowIndex ifTrue:[
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4525
            ^ false
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4526
        ]
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4527
    ] ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4528
        (selectedRowIndex size ~~ 0 and:[ selectedRowIndex includes:aRowNr ]) ifFalse:[
1042
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4529
            ^ false
b2b27ac9a550 change rowSelector icon;
ca
parents: 1034
diff changeset
  4530
        ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4531
    ].
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4532
    ^ (self selectedColIndex == 0 or:[ self selectedColIndex == aColNr ])
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4533
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4534
2276
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4535
isSelectionVisibleIn:anExtentPoint
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4536
    self selectionIndicesDo:[:selRowNr |
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4537
        |y|
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4538
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4539
        y := self yVisibleOfRowNr:selRowNr.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4540
        (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
  4541
    ].
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4542
    ^ false.
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4543
!
19de72502874 dont make selection visible after resize, if it was not visible before
ca
parents: 2263
diff changeset
  4544
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4545
lastIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4546
    "returns index of last selected row or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4547
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4548
    multipleSelectOk ifFalse:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4549
        ^ selectedRowIndex
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4550
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4551
    selectedRowIndex size ~~ 0 ifTrue:[
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4552
        ^ selectedRowIndex last
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4553
    ].
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4554
    ^ 0
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4555
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4556
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4557
makeLineVisible:aLine
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4558
    "scroll to make aLine visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4559
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4560
    |colNr|
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4561
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4562
    aLine == 0 ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4563
        ^ self
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4564
    ].
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4565
    (self isRowVisible:aLine) ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4566
        ^ self
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4567
    ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4568
    (self selectedColIndex notNil and:[ self selectedColIndex ~~ 0 ]) ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4569
        colNr := self selectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4570
    ] ifFalse:[ colNr := 1 ].
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4571
    self scrollToRowAt:aLine colAt:colNr
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4572
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4573
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4574
makeSelectionVisible
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4575
    "scroll to make the selection line visible"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4576
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4577
    |rowNr colNr|
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4578
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4579
    rowNr := self firstIndexSelected.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4580
    rowNr == 0 ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4581
        ^ self
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4582
    ].
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4583
    (self selectedColIndex notNil and:[ self selectedColIndex ~~ 0 ]) ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4584
        colNr := self selectedColIndex
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4585
    ] ifFalse:[ colNr := 1 ].
2246
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4586
    self scrollToRowAt:rowNr colAt:colNr
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4587
!
5d59b5e2e00c makeSelectionVisible after #sizeChanged:
ca
parents: 2237
diff changeset
  4588
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4589
maxIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4590
    "return the largest index selected or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4591
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4592
    multipleSelectOk ifFalse:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4593
        ^ selectedRowIndex
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4594
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4595
    selectedRowIndex size ~~ 0 ifTrue:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4596
        ^ selectedRowIndex max
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4597
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4598
    ^ 0
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4599
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4600
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4601
minIndexSelected
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4602
    "return the smallest index selected or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4603
2363
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4604
    multipleSelectOk ifFalse:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4605
        ^ selectedRowIndex
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4606
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4607
    selectedRowIndex size ~~ 0 ifTrue:[
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4608
        ^ selectedRowIndex min
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4609
    ].
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4610
    ^ 0
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4611
!
72cda227e48d shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents: 2333
diff changeset
  4612
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4613
numberOfSelections
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4614
    "return the number of selected rows"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4615
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4616
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4617
        ^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4618
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4619
    ^ selectedRowIndex size
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4620
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4621
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4622
openEditorOnSelection
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4623
     |colIdx column rowIdx editorAndModel winGroup
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4624
      editor filter keyBrdFwd selColor|
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4625
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4626
    (shown and:[editView isNil]) ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4627
        ^ self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4628
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4629
    winGroup := self windowGroup.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4630
    winGroup isNil ifTrue:[^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4631
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4632
    colIdx := self selectedColIndex ? 0.
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4633
    column := self columnDescriptorAt:colIdx.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4634
    column isNil ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4635
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4636
    rowIdx := self selectedRowIndex ? 0.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4637
    rowIdx == 0 ifTrue:[^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4638
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4639
    rowIdx isSequenceable ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4640
        rowIdx := rowIdx at:1 ifAbsent:[ ^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4641
    ].
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4642
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4643
    editorAndModel := column editorForRowAt:rowIdx.
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4644
    editorAndModel isNil ifTrue:[^ self].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4645
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4646
    autoScrollToColumn == true ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4647
        self scrollToRowAt:rowIdx colAt:colIdx.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4648
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4649
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4650
    editView := SimpleView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4651
                extent:((column width - (2 * separatorSize))
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4652
                        @ (rowHeight - (2 * separatorSize)))
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4653
                in:self.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4654
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4655
    self updateEditViewOrigin.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4656
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4657
    (column containsText or:[ column showSelectionHighLighted not ]) ifTrue:[
3149
66df7168e377 bug fix
ca
parents: 3141
diff changeset
  4658
        selColor := (column backgroundColorAt:rowIdx)
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4659
    ] ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4660
        selColor := selectionBackgroundColor
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4661
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4662
    editView viewBackground:selectionBackgroundColor.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4663
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4664
    editor := editorAndModel editor.
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4665
    editView add:editor.
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4666
    editorAndModel editorNeedsCursorKeys ifTrue:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4667
        editorAndModel editorNeedsReturnKey ifTrue:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4668
            "/ only steal TAB from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4669
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4670
        ] ifFalse:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4671
            "/ steal TAB and RETURN from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4672
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #Return ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4673
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4674
    ] ifFalse:[
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4675
        editorAndModel editorNeedsReturnKey ifTrue:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4676
            "/ only steal TAB and Curosr Keys from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4677
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4678
        ] ifFalse:[
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4679
            "/ steal TAB, RETURN and Curosr Keys from the editor
4176
915f6fa47e09 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4163
diff changeset
  4680
            filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown #Return ) includes:aKey ]
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4681
        ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4682
    ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4683
    keyBrdFwd := KeyboardForwarder
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4684
                toView:self
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4685
                condition:nil
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4686
                filter:filter.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4687
    editView
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4688
        withAllSubViewsDo:[:aView |
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4689
            aView delegate:keyBrdFwd.
4496
229bdd6b4754 class: DSVColumnView
Stefan Vogel <sv@exept.de>
parents: 4489
diff changeset
  4690
            aView font:self font.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4691
        ].
3141
095e746ebc1d bug fix
ca
parents: 3140
diff changeset
  4692
3855
41653ef27914 changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents: 3779
diff changeset
  4693
    (editValue := editorAndModel model) notNil ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4694
        editValue addDependent:self.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4695
    ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4696
    editView realize.
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4697
    editor canTab:true.
3962
0b5f7e526d0f changed:
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  4698
3770
e24ada279c5e changed:
Claus Gittinger <cg@exept.de>
parents: 3757
diff changeset
  4699
    winGroup focusView:editor.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4700
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4701
    self processAllExposeEvents.
3960
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4702
3962
0b5f7e526d0f changed:
Claus Gittinger <cg@exept.de>
parents: 3961
diff changeset
  4703
    "Modified: / 02-11-2010 / 22:04:01 / cg"
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4704
!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4705
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4706
processAllExposeEvents
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4707
    |sensor|
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4708
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4709
    sensor := self sensor.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4710
    [
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4711
        sensor hasExposeEventFor:nil
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4712
    ] whileTrue:[
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4713
        self windowGroup processExposeEvents
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4714
    ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4715
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4716
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4717
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4718
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4719
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4720
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4721
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4722
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4723
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4724
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4725
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4726
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4727
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4728
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4729
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4730
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4731
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4732
removeRowFromSelection:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4733
    "remove a row from the selection"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4734
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4735
    (self isInSelection:aRowNr) ifFalse:[^ self].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4736
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4737
    self numberOfSelections == 1 ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4738
        self deselect.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4739
    ] ifFalse:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4740
        selectedRowIndex := selectedRowIndex copyWithout:aRowNr.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4741
        self invalidateRowAt:aRowNr.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4742
        self selectionChanged.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4743
    ].
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4744
!
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4745
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4746
selectAllRows
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4747
    "select all"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4748
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4749
    multipleSelectOk ifFalse:[^ self].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4750
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4751
    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
  4752
    self selectionChanged.
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  4753
    self invalidate.
1947
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4754
!
1e11b36633b2 added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
  4755
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4756
selectColIndex:aColNr rowIndex:aRowNr
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4757
    "change selection with notification"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4758
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4759
    self selectColIndex:aColNr rowIndex:aRowNr openEditor:true.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4760
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4761
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4762
selectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4763
    "change selection with notification"
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4764
5666
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4765
    |oldCol oldRow|
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4766
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4767
    oldCol := self selectedColIndex.
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4768
    oldRow := self selectedRowIndex.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4769
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4770
    self setSelectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4771
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4772
    (oldCol ~~ self selectedColIndex
5666
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4773
    or:[oldRow ~= self selectedRowIndex
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  4774
    or:[ignoreReselect == false]]) ifTrue:[
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4775
        self selectionChanged:aColNr
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4776
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4777
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4778
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4779
selectRow:something
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4780
    "select a row"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4781
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4782
    ^ self selectedRowIndex:something
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4783
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4784
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4785
selectRowAt:rowNr colAt:colNr atPoint:aPoint
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4786
    self selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:true.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4787
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4788
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4789
selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:openEditor
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4790
    |view p shouldClick editorType|
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4791
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4792
    view := editView.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4793
    self selectColIndex:colNr rowIndex:rowNr openEditor:openEditor.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4794
    openEditor ifFalse:[ ^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4795
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4796
    editView isNil ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4797
        "/ might be a reselection
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4798
        self openEditorOnSelection.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4799
        editView isNil ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4800
    ] ifFalse:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4801
        editView == view ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4802
    ].
5517
9acf3fa7e7a8 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5447
diff changeset
  4803
    view := self detectViewAt:aPoint ignoreInvisible:false.
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4804
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4805
    shouldClick := true.
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4806
    "/ when PreselectAllWhenOpeningEditor is true, we should not click into
5902
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4807
    "/ the editor, as this could clear the selection.
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4808
    "/ 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
  4809
    PreselectAllWhenOpeningEditor == true ifTrue:[
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4810
        shouldClick := false.
5990
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4811
    ].
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4812
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4813
    editorType := self selectedColumn editorType.
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4814
    editorType == #ComboList ifTrue:[ 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4815
        shouldClick := true 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4816
    ] ifFalse:[
5902
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4817
        editorType == #ComboBox ifTrue:[ 
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4818
            "/ only click if clicked onto menu-pull button
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4819
            (view ~~ self and:[view notNil]) ifTrue:[
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4820
                |screenPoint comboSubView|
5990
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4821
5902
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4822
                screenPoint := device translatePoint:aPoint fromView:self toView:nil.
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4823
                comboSubView := device viewFromPoint:screenPoint.
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4824
                (comboSubView notNil and:[comboSubView isKindOf:Button]) ifTrue:[
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4825
                    shouldClick := true 
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4826
                ].    
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4827
            ].    
5990
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4828
        ] ifFalse:[
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4829
            editorType == #CheckToggle ifTrue:[ 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4830
                shouldClick := true 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4831
            ] ifFalse:[
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4832
                editorType == #RadioButton ifTrue:[ 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4833
                    shouldClick := true 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4834
                ] ifFalse:[
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4835
                    "/ TODO: more heuristics here...
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4836
                    "/ editorType == #RadioButton ifTrue:[ ].
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4837
                    (view isKindOf:ComboBoxButton) ifTrue:[
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4838
                        shouldClick := true 
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4839
                    ].
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4840
                ].
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4841
            ]
5902
1ad98b113571 #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 5896
diff changeset
  4842
        ].
5990
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4843
    ].
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4844
    
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4845
    shouldClick ifTrue:[
2125
67e0f2c9ad4d event types are private to WindowEvent;
ca
parents: 2101
diff changeset
  4846
        "/ simulate clicking into the editor
4459
0fd01d06e0b4 class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4425
diff changeset
  4847
        self breakPoint:#ca.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4848
        (view ~~ self and:[view notNil]) ifTrue:[
4991
ddee68d07788 device access
Claus Gittinger <cg@exept.de>
parents: 4961
diff changeset
  4849
            p := device translatePoint:aPoint fromView:self toView:view.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4850
            self sensor
3960
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4851
                    pushEvent:(WindowEvent   buttonPress:1 x:p x y:p y view:view);
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4852
                    pushEvent:(WindowEvent buttonRelease:1 x:p x y:p y view:view).
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4853
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4854
"/        "/ a very special hack for radioButtons:
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4855
"/        "/ if the button is now on, all other cells must be turned off !!
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4856
"/        self selectedColumn editorType == #RadioButton ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4857
"/            1 tolist size do:[:eachRowNr |
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4858
"/                eachRowNr ~~ rowNr ifTrue:[
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4859
"/                    self at:eachRowNr put:false
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4860
"/                ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4861
"/            ].
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  4862
"/        ].
3960
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4863
        ].
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4864
    ].
20b0047e59c6 +PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents: 3924
diff changeset
  4865
4073
14b8653c124f changed: #selectRowAt:colAt:atPoint:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4059
diff changeset
  4866
    "Modified: / 07-09-2011 / 16:08:45 / cg"
5517
9acf3fa7e7a8 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5447
diff changeset
  4867
    "Modified: / 15-03-2017 / 21:09:54 / stefan"
5990
1c1e8ef4220b #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5969
diff changeset
  4868
    "Modified: / 31-01-2019 / 23:38:26 / Claus Gittinger"
809
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4869
!
0206d997fe99 support styleSheet and set preferred extent for drawing
ca
parents: 765
diff changeset
  4870
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4871
selectRowFrom:start to:stop
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4872
    |step oldSelection newSelection|
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4873
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4874
    start == stop ifTrue:[
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4875
        self selectColIndex:0 rowIndex:start.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4876
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4877
    ].
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4878
    step := (start <= stop) ifTrue:1 ifFalse:-1.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4879
    newSelection := (start to:stop by:step)
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4880
                select:[:idx | self isRowSelectable:idx ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4881
    self selectedColIndex ~~ 0 ifTrue:[
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4882
        self selectColIndex:0 rowIndex:newSelection.
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4883
        ^ self
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4884
    ].
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4885
    oldSelection := selectedRowIndex ? #().
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4886
    selectedRowIndex := newSelection.
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4887
    newSelection
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4888
        select:[:i | (oldSelection includes:i) not ]
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4889
        thenDo:[:i | self invalidateRowAt:i ].
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4890
    oldSelection
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4891
        select:[:i | (newSelection includes:i) not ]
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4892
        thenDo:[:i | self invalidateRowAt:i ].
2398
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4893
    self selectionChanged.
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4894
!
bea17c9648e4 *** empty log message ***
ca
parents: 2371
diff changeset
  4895
5969
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  4896
selectRowIndex:anInteger
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4897
    "set selection of rows"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4898
5969
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  4899
    self selectColIndex:self selectedColIndex rowIndex:anInteger
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  4900
fa2bd856b54d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5952
diff changeset
  4901
    "Modified (format): / 21-11-2018 / 20:08:26 / Claus Gittinger"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4902
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4903
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4904
selectedColIndex
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4905
    "returns selected column number or 0"
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4906
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4907
    ^ self selectedColIndexHolder value
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4908
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4909
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4910
selectedColumn
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4911
    "returns selected column or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4912
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  4913
    ^ columnDescriptors at:self selectedColIndex ifAbsent:nil.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4914
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4915
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4916
selectedRow
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4917
    "returns the selected row (or collection if multiple selection) or nil"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4918
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4919
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4920
        ^ self at:selectedRowIndex ifAbsent:nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4921
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4922
    selectedRowIndex size ~~ 0 ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4923
        ^ selectedRowIndex collect:[:i | self at:i ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4924
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4925
    ^ nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4926
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4927
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4928
selectedRow:something
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4929
    "select something"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4930
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4931
    self selectedRowIndex:something
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4932
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4933
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4934
selectedRowIndex
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4935
    "returns selected row number or 0"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4936
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4937
    ^ selectedRowIndex
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4938
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4939
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4940
selectedRowIndex:rowOrCollectionOfRows
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  4941
    "set the row selection (single or multiple rows);
2816
7e36fce15001 return-key handling;
Claus Gittinger <cg@exept.de>
parents: 2813
diff changeset
  4942
     does NOT change the selected column."
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4943
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4944
    self selectColIndex:(self selectedColIndex) rowIndex:rowOrCollectionOfRows
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4945
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4946
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4947
selectionChanged
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4948
    "selection has changed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4949
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4950
    self selectionChanged:nil
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4951
!
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4952
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4953
selectionChanged:colNrOrNil
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4954
    "selection has changed"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4955
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4956
    |val|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4957
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4958
    model notNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4959
        val := self selectedRowIndex copy.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4960
        (model respondsTo:#selectionIndex:) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4961
            model selectionIndex:val
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4962
        ] ifFalse:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4963
            |newVal|
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4964
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4965
            newVal := (useIndex ifTrue:[val] ifFalse:[self selectedRow]).
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4966
            "/ must check here: valueHolder compares using identity to identify
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4967
            "/ changes. This would lead to an endless recursion....
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4968
            model value ~= newVal ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4969
                model value:newVal
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4970
            ]
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4971
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1484
diff changeset
  4972
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4973
    actionBlock notNil ifTrue:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4974
        colNrOrNil isNil ifTrue:[
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4975
            actionBlock valueWithOptionalArgument:(self selectedRowIndex)
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4976
        ] ifFalse:[
5708
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4977
            actionBlock valueWithOptionalArgument:(self selectedRowIndex) and:colNrOrNil
d477077d4990 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 5680
diff changeset
  4978
        ].
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4979
    ]
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4980
!
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  4981
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4982
selectionIndicesDo:aOneArgBlock
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4983
    "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
  4984
     is the index of the selected row"
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4985
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4986
    multipleSelectOk ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4987
        selectedRowIndex ~~ 0 ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4988
            aOneArgBlock value:selectedRowIndex
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4989
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4990
    ] ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4991
        selectedRowIndex size ~~ 0 ifTrue:[
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4992
            selectedRowIndex do:aOneArgBlock
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  4993
        ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4994
    ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4995
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  4996
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  4997
setSelectColIndex:colNrArg rowIndex:rowNrArg
2714
f0d55d0e204d categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents: 2711
diff changeset
  4998
    "change selection without notification"
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  4999
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5000
    self setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:true
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5001
!
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5002
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5003
setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:openEditor
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5004
    "change selection without notification"
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5005
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5006
    |rowNr colNr newCol oldCol oldRow sglSelRow oldSz winGroup|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5007
5709
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  5008
    rowNr := self validateSelection:rowNrArg.
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  5009
    rowNr isNil ifTrue:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5010
        rowNr := multipleSelectOk ifTrue:[#()] ifFalse:[0].
5709
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  5011
    ].
06971867c02d #BUGFIX by sr
sr
parents: 5708
diff changeset
  5012
2470
64aae46d9d4e code cleanup
Claus Gittinger <cg@exept.de>
parents: 2469
diff changeset
  5013
    colNr := colNrArg.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5014
    rowNr == 0 ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5015
        colNr := 0.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5016
    ] ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5017
        multipleSelectOk ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5018
            (rowNr size == 1) ifFalse:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5019
                colNr := 0
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5020
            ]
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5021
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5022
    ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5023
    (colNr := colNr ? 0) ~~ 0 ifTrue:[
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5024
        newCol := self columnDescriptorAt:colNr.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5025
        newCol rendererType == #rowSelector ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5026
            colNr := 0.
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5027
            newCol := nil
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5028
        ] ifFalse:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5029
            multipleSelectOk ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5030
                sglSelRow := rowNr at:1
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5031
            ] ifFalse:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5032
                sglSelRow := rowNr
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5033
            ].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5034
            (newCol canSelect:sglSelRow) ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5035
                newCol := nil.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5036
                colNr := 0.
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  5037
                selectRowOnDefault ifFalse:[
3449
2ba8e55953aa some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents: 3428
diff changeset
  5038
                    rowNr := multipleSelectOk ifTrue:[nil] ifFalse:[0]
1112
81f2a7f0afdc draw routines for interactors
ca
parents: 1111
diff changeset
  5039
                ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5040
            ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5041
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5042
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5043
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5044
    (rowNr = selectedRowIndex and:[ colNr == self selectedColIndex ]) ifTrue:[
643
bfd44867347f adding: bug fix
ca
parents: 642
diff changeset
  5045
        ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5046
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5047
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5048
    "/ release old selection
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5049
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5050
    oldSz := self numberOfSelections.
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5051
    oldCol := self selectedColIndex.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5052
    oldRow := selectedRowIndex.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5053
    oldSz == 1 ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5054
        multipleSelectOk ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5055
            oldRow := oldRow at:1
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5056
        ].
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5057
        self updateColumnFromEditValueAndDestroyEditView.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5058
    ].
5666
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  5059
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  5060
    (rowNr ~= selectedRowIndex
88930c01d31b #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 5664
diff changeset
  5061
    or:[ignoreReselect == false]) ifTrue:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5062
        selectedRowIndex := rowNr.
3302
6725ecddd8e3 pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents: 3248
diff changeset
  5063
        self selectionChanged:colNr.
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5064
    ].
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5065
    self selectedColIndex:colNr.
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5066
    shown ifFalse:[ ^ self ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5067
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5068
    winGroup := self windowGroup.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5069
    winGroup isNil ifTrue:[^ self ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5070
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5071
    oldSz > 1 ifTrue:[
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5072
        "/ redraw old selection
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5073
        oldRow do:[:aRowNr |
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5074
            "/ unselected if visible
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  5075
            self invalidateRowAt:aRowNr colAt:0
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5076
        ]
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5077
    ] ifFalse:[
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5078
        oldSz == 1 ifTrue:[
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1333
diff changeset
  5079
            self invalidateRowAt:oldRow colAt:oldCol
618
6a79bf9b4cd3 support list with undefined rows
ca
parents: 612
diff changeset
  5080
        ]
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5081
    ].
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5082
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5083
    "/ show new selection
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5084
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5085
    newCol notNil ifTrue:[
3140
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5086
        openEditor ifTrue:[
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5087
            self openEditorOnSelection.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5088
            editView notNil ifTrue:[^ self].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5089
        ].
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5090
        self invalidateRowAt:sglSelRow colAt:colNr.
6f2bc099fb35 new selectionHandling - buttonPress
ca
parents: 3138
diff changeset
  5091
3130
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  5092
        autoScrollToColumn == true ifTrue:[
30ac624dd866 added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents: 3091
diff changeset
  5093
            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
  5094
        ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5095
    ] ifFalse:[
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5096
        self selectionIndicesDo:[:i | self invalidateRowAt:i colAt:0 ].
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5097
        self scrollToRowAt:(self firstIndexSelected) colAt:0
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5098
    ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5099
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5100
    self processAllExposeEvents.
612
af7786327bd4 add columnHolder
ca
parents: 610
diff changeset
  5101
4055
4373923243d3 comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents: 4020
diff changeset
  5102
    "Modified: / 12-07-2011 / 14:22:42 / cg"
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5103
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5104
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5105
updateColumnFromEditValueAndDestroyEditView
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5106
    |edValue selCol selRow|
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5107
2960
1bb470bcdb64 colIndex as a holder;
fm
parents: 2958
diff changeset
  5108
    selCol := self selectedColIndex.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5109
    selRow := selectedRowIndex.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5110
    editValue notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5111
        editValue removeDependent:self
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5112
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5113
    editView notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5114
        self forceAcceptInEditor
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5115
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5116
    editValue notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5117
        edValue := editValue value.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5118
        edValue isSequenceable ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5119
            edValue size == 0 ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5120
                edValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5121
            ] ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5122
                edValue isString ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5123
                    edValue := edValue select:[:el | el notNil ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5124
                    edValue size == 0 ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5125
                        edValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5126
                    ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5127
                ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5128
            ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5129
        ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5130
        selRow isNumber ifFalse:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5131
            "/ ??? should we do ???:
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5132
            "/ selRow do:[:eachRow |
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5133
            "/     (self columnAt:selCol) at:eachRow put:edValue.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5134
            "/ ]
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5135
            selRow := selRow first
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5136
        ].
3504
7a480e6164ea refactored;
Claus Gittinger <cg@exept.de>
parents: 3500
diff changeset
  5137
        (self columnDescriptorAt:selCol) at:selRow put:edValue.
2695
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5138
        modifiedChannel notNil ifTrue:[
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5139
            modifiedChannel value:true
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5140
        ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5141
        editValue := nil
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5142
    ].
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5143
    self destroyEditView.
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5144
!
02d2039ec6a6 WO's changes
werner
parents: 2670
diff changeset
  5145
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5146
validateSelection:aSelection
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5147
    |newSel|
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5148
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5149
    (list size == 0 or:[aSelection isNil or:[aSelection == 0]]) ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5150
        ^ multipleSelectOk ifFalse:[0] ifTrue:[nil]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5151
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5152
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5153
    newSel := aSelection.
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5154
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5155
    multipleSelectOk ifFalse:[
2732
0d3258f88f58 *** empty log message ***
martin
parents: 2730
diff changeset
  5156
        newSel isInteger ifFalse:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5157
            newSel := self identityIndexOfRow:aSelection.
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5158
        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5159
        ^ (self isRowSelectable:newSel) ifTrue:[newSel] ifFalse:[0].
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5160
    ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5161
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5162
    "multiple selection
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5163
    "
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5164
    aSelection size ~~ 0 ifTrue:[
2732
0d3258f88f58 *** empty log message ***
martin
parents: 2730
diff changeset
  5165
        aSelection first isInteger ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5166
            newSel := aSelection select:[:idx| self isRowSelectable:idx ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5167
        ] ifFalse:[
5723
3019347d6f76 #REFACTORING by mawalch
mawalch
parents: 5719
diff changeset
  5168
            newSel := aSelection
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5169
                            collect:[:el| self identityIndexOfRow:el ]
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5170
                            thenSelect:[:idx| self isRowSelectable:idx ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5171
        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5172
        newSel notEmpty ifTrue:[
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5173
            ^ newSel
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5174
        ].
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5175
    ] ifFalse:[
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5176
        newSel isInteger ifFalse:[
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5177
            newSel := self identityIndexOfRow:aSelection.
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5178
        ].
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5179
        (self isRowSelectable:newSel) ifTrue:[
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5180
            ^ Array with:newSel
2733
7b5a0d80c4a8 Change by cg.
martin
parents: 2732
diff changeset
  5181
        ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 596
diff changeset
  5182
    ].
2636
103067a67ff9 add selectConditionBlock: to enable the selection of a row
ca
parents: 2593
diff changeset
  5183
    ^ nil
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5184
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5185
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5186
!DSVColumnView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5187
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5188
version
4794
73a3ffcaf58c class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4772
diff changeset
  5189
    ^ '$Header$'
3757
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  5190
!
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  5191
05d3a8228fdd changed: #at:
Claus Gittinger <cg@exept.de>
parents: 3742
diff changeset
  5192
version_CVS
4794
73a3ffcaf58c class: DSVColumnView
Claus Gittinger <cg@exept.de>
parents: 4772
diff changeset
  5193
    ^ '$Header$'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
  5194
! !
4161
4722a6575ff0 class: DSVColumnView
ca
parents: 4123
diff changeset
  5195