DSVLabelView.st
author Claus Gittinger <cg@exept.de>
Fri, 28 Jun 2019 09:21:50 +0200
changeset 6078 08c9e2a47dc5
parent 5943 5bd4c8c6ec5f
child 6104 fc350a449043
permissions -rw-r--r--
#OTHER by cg self class name -> self className
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5943
5bd4c8c6ec5f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
     1
"{ Encoding: utf8 }"
5bd4c8c6ec5f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
     2
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     3
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     4
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     5
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     6
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     7
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    12
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    13
"
1844
05a9cb2fc86f default font
martin
parents: 1605
diff changeset
    14
"{ Package: 'stx:libwidg2' }"
05a9cb2fc86f default font
martin
parents: 1605
diff changeset
    15
4876
8edcf9875271 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
    16
"{ NameSpace: Smalltalk }"
8edcf9875271 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
    17
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
    18
SimpleView subclass:#DSVLabelView
3774
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    19
	instanceVariableNames:'dataSet lineDrag columns selection enabled preferredHeight
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    20
		handleCursor tabSpacing opaqueColumnResize verticalLabelSpacing
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    21
		indexOfSortColumn reverseSort'
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    22
	classVariableNames:''
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    23
	poolDictionaries:''
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    24
	category:'Views-DataSet'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    25
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    26
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
    27
Object subclass:#LineDrag
3774
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    28
	instanceVariableNames:'topX topY botY column minX startX transX topView color'
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    29
	classVariableNames:''
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    30
	poolDictionaries:''
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
    31
	privateIn:DSVLabelView
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    32
!
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    33
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    34
!DSVLabelView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    35
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    36
copyright
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    37
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    38
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    39
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    40
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    41
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    42
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    43
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    44
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    45
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    46
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    47
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    48
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    49
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    50
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    51
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    52
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    53
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    54
documentation
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    55
"
2789
e7c8596999e7 comment
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
    56
    shows the labels assigned to the column descriptions. 
e7c8596999e7 comment
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
    57
    Used as the title-part of a DataSetView.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    58
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    59
    [Instance variables:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    60
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    61
        dataSet         <DSVColumnView>         column view which shows the columns
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
    62
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    63
        selection       <Integer or nil>        current selected index or nil.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
    64
1086
2b5746c733f6 add some comment
ca
parents: 1085
diff changeset
    65
        enabled         <Boolean>               if a press action exists on a column
2b5746c733f6 add some comment
ca
parents: 1085
diff changeset
    66
                                                entry, this action could be enabled or
2b5746c733f6 add some comment
ca
parents: 1085
diff changeset
    67
                                                disabled.
2b5746c733f6 add some comment
ca
parents: 1085
diff changeset
    68
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    69
        preferredHeight <Integer>               the preferred height of the labelView
1086
2b5746c733f6 add some comment
ca
parents: 1085
diff changeset
    70
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    71
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    72
    [author:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    73
        Claus Atzkern
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    74
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    75
    [see also:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    76
        DSVColumnView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    77
        DataSetColumnSpec
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    78
        DataSetColumn
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    79
        DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    80
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    81
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    82
1940
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
    83
!DSVLabelView class methodsFor:'accessing'!
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
    84
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
    85
tabSpacing
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
    86
    "returns the tab spacing
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
    87
    "
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
    88
    ^ 2
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
    89
! !
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
    90
1844
05a9cb2fc86f default font
martin
parents: 1605
diff changeset
    91
!DSVLabelView class methodsFor:'defaults'!
05a9cb2fc86f default font
martin
parents: 1605
diff changeset
    92
05a9cb2fc86f default font
martin
parents: 1605
diff changeset
    93
defaultFont
05a9cb2fc86f default font
martin
parents: 1605
diff changeset
    94
    ^ DSVColumnView defaultFont
05a9cb2fc86f default font
martin
parents: 1605
diff changeset
    95
! !
05a9cb2fc86f default font
martin
parents: 1605
diff changeset
    96
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    97
!DSVLabelView methodsFor:'accessing'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
    98
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    99
columns:aListOfColumns
3489
f2f5a8273044 preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   100
    "the list of columns changed"
f2f5a8273044 preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   101
2152
6c52408279f9 halts and unused methods removed
Claus Gittinger <cg@exept.de>
parents: 2151
diff changeset
   102
    aListOfColumns = columns ifTrue:[^ self].
2150
5184a8b92c2a better look
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   103
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   104
    columns         := aListOfColumns.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   105
    preferredHeight := nil.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   106
    selection       := nil.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   107
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   108
    self changed:#columnLayout.
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   109
!
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   110
3583
4072f1a89291 added #dataSet accessor method
Stefan Vogel <sv@exept.de>
parents: 3572
diff changeset
   111
dataSet
4072f1a89291 added #dataSet accessor method
Stefan Vogel <sv@exept.de>
parents: 3572
diff changeset
   112
    ^ dataSet
4072f1a89291 added #dataSet accessor method
Stefan Vogel <sv@exept.de>
parents: 3572
diff changeset
   113
!
4072f1a89291 added #dataSet accessor method
Stefan Vogel <sv@exept.de>
parents: 3572
diff changeset
   114
3766
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   115
indexOfSortColumn
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   116
    ^ indexOfSortColumn
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   117
!
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   118
1931
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   119
opaqueColumnResize
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   120
    ^ opaqueColumnResize
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   121
!
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   122
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   123
opaqueColumnResize:aBoolean
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   124
    opaqueColumnResize := aBoolean
3769
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   125
!
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   126
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   127
reverseSort
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   128
    ^ reverseSort
884
4b2f2ddef43c bug fix:
ca
parents: 859
diff changeset
   129
! !
4b2f2ddef43c bug fix:
ca
parents: 859
diff changeset
   130
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   131
!DSVLabelView methodsFor:'drawing'!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   132
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   133
invalidate
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   134
    (shown) ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   135
        super invalidate
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   136
    ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   137
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   138
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   139
invalidateItemAt:anIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   140
    "invalidate rectangle assigned to an item at an index
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   141
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   142
    |cL xL xR hg|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   143
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   144
    (shown) ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   145
        cL := columns at:anIndex ifAbsent:[^ nil].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   146
        xL := self xVisibleOfColNr:anIndex.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   147
        xR := xL + cL width.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   148
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   149
        (xL < width and:[xR > 0]) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   150
            xL := xL max:0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   151
            xR := xR min:width.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   152
            hg := height - margin - margin.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   153
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   154
            self invalidate:(Rectangle left:xL top:margin width:(xR - xL) height:hg)
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   155
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   156
    ]
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   157
!
562
b7db6629f2cf recompute height from column labels
ca
parents: 560
diff changeset
   158
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   159
redrawColumnsInX:x y:y width:w height:h
4522
2f6d2d3aeea3 class: DSVLabelView
Stefan Vogel <sv@exept.de>
parents: 4497
diff changeset
   160
    "redraw a rectangle"
2f6d2d3aeea3 class: DSVLabelView
Stefan Vogel <sv@exept.de>
parents: 4497
diff changeset
   161
2f6d2d3aeea3 class: DSVLabelView
Stefan Vogel <sv@exept.de>
parents: 4497
diff changeset
   162
    |bg fg fgColor bgColor
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   163
     inset  "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   164
     maxX   "{ Class:SmallInteger }"
1524
b7f986aa45f4 visibility of label; show as button (yes/no)
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   165
     lblH  "{ Class:SmallInteger }"
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   166
     wt     "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   167
     x1     "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   168
     x0     "{ Class:SmallInteger }"
3648
23f1b38dbe62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
   169
     item|
23f1b38dbe62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
   170
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   171
    (shown) ifFalse:[^ self].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   172
4876
8edcf9875271 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   173
    bgColor := dataSet labelBackgroundColor.
5422
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   174
    gc paint:bgColor.
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   175
    gc fillRectangleX:x y:y width:w height:h.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   176
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   177
    columns isEmpty ifTrue:[^ self].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   178
4876
8edcf9875271 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   179
    fgColor := dataSet labelForegroundColor.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   180
    inset   := dataSet horizontalSpacing + 1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   181
    maxX    := (x + w) min:(width - margin).
1524
b7f986aa45f4 visibility of label; show as button (yes/no)
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   182
    lblH    := height - margin - margin.
859
e63eb6f321e1 support List for columns
ca
parents: 824
diff changeset
   183
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   184
    x1 := self xVisibleOfColNr:1.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   185
3648
23f1b38dbe62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
   186
    columns keysAndValuesDo:[:eachKey :eachCol| 
23f1b38dbe62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
   187
        item := eachCol label.
23f1b38dbe62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
   188
23f1b38dbe62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
   189
        wt := eachCol width.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   190
        x0 := x1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   191
        x1 := x1 + wt.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   192
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   193
        (x1 > x and:[x0 < maxX]) ifTrue:[
1940
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   194
            |left right rect|
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   195
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   196
            left  := x0 max:x.
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   197
            right := x1 min:maxX.
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   198
            rect  := Rectangle left:left top:y width:(right - left) height:h.
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   199
4522
2f6d2d3aeea3 class: DSVLabelView
Stefan Vogel <sv@exept.de>
parents: 4497
diff changeset
   200
"/            clipRect := nil.
5410
56776faa77eb #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 5238
diff changeset
   201
            self clippingBounds:rect.
1940
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   202
3648
23f1b38dbe62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
   203
            fg := (item foregroundColor) ? fgColor.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   204
3648
23f1b38dbe62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
   205
            (bg := item backgroundColor) notNil ifTrue:[
907
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   206
                bg ~= bgColor ifTrue:[
5422
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   207
                    gc paint:bg.
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   208
                    gc fillRectangleX:x0 y:margin width:wt height:lblH.
907
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   209
                ]
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   210
            ] ifFalse:[
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   211
                bg := bgColor
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   212
            ].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   213
5422
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   214
            gc paint:fg on:bg.            
3648
23f1b38dbe62 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3583
diff changeset
   215
            item redrawX:x0 w:wt h:height inset:inset on:self.
1524
b7f986aa45f4 visibility of label; show as button (yes/no)
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   216
        ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   217
    ].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   218
!
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   219
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   220
redrawEdgesX:x y:yTop width:aWidth height:aHeight
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   221
    "redraw the edges in the range
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   222
    "
3467
f2212331f4e5 changed #redrawEdgesX:y:width:height:
ca
parents: 3466
diff changeset
   223
    |desc startOfTabX endOfTabX lastColumn has3Dseparators separatorOneDColor
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   224
     maxX "{ Class:SmallInteger }"
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   225
     h    "{ Class:SmallInteger }"
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   226
     x1   "{ Class:SmallInteger }"
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   227
     x0   "{ Class:SmallInteger }"
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   228
     y0   "{ Class:SmallInteger }"
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   229
     absLabelLevel
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   230
    |
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   231
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   232
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   233
    maxX := (x + aWidth) min:(width - margin).
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   234
    absLabelLevel := 1.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   235
    x1   := self xVisibleOfColNr:1.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   236
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   237
    y0 := margin.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   238
    h  := height - margin - margin.
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   239
3467
f2212331f4e5 changed #redrawEdgesX:y:width:height:
ca
parents: 3466
diff changeset
   240
    has3Dseparators    := dataSet has3Dseparators.
f2212331f4e5 changed #redrawEdgesX:y:width:height:
ca
parents: 3466
diff changeset
   241
    separatorOneDColor := dataSet separatorOneDColor.
f2212331f4e5 changed #redrawEdgesX:y:width:height:
ca
parents: 3466
diff changeset
   242
    lastColumn         := columns last.
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   243
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   244
    columns keysAndValuesDo:[:aKey :aCol|
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   245
        desc := aCol description.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   246
        x0   := x1.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   247
        x1   := x1 + aCol width.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   248
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   249
        endOfTabX := nil.
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   250
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   251
        aKey == selection ifTrue:[
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   252
            startOfTabX notNil ifTrue:[ endOfTabX := x0 ].
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   253
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   254
            (x1 > x and:[x0 < maxX]) ifTrue:[
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   255
                dataSet drawEdgesAtX:x0 y:y0 width:(x1 - x0) height:h level:-1 on:self.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   256
            ].
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   257
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   258
        ] ifFalse:[
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   259
            desc labelHasButtonLayout ifTrue:[
3466
e35f9173be58 changed #redrawEdgesX:y:width:height:
ca
parents: 3465
diff changeset
   260
                startOfTabX isNil ifTrue:[ startOfTabX := x0 ].
e35f9173be58 changed #redrawEdgesX:y:width:height:
ca
parents: 3465
diff changeset
   261
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   262
                (desc== lastColumn or:[desc labelIsPartOfGroup not]) ifTrue:[
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   263
                    endOfTabX := x1.
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   264
                ]
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   265
            ] ifFalse:[
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   266
                startOfTabX notNil ifTrue:[
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   267
                    endOfTabX := x0.
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   268
                ].
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   269
            ].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   270
        ].
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   271
        endOfTabX notNil ifTrue:[
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   272
            startOfTabX isNil ifTrue:[ startOfTabX := x0 ].
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   273
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   274
            startOfTabX < endOfTabX ifTrue:[
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   275
                (endOfTabX > x and:[startOfTabX < maxX]) ifTrue:[
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   276
                    has3Dseparators ifTrue:[
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   277
                        dataSet drawEdgesAtX:startOfTabX y:y0 width:(endOfTabX - startOfTabX) height:h level:absLabelLevel on:self.
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   278
                    ] ifFalse:[
5422
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   279
                        gc paint:separatorOneDColor.
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   280
                        gc displayLineFromX:endOfTabX-1 y:0 toX:endOfTabX-1 y:h.
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   281
                    ].
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   282
                ].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   283
            ].
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   284
            startOfTabX := nil.
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   285
        ].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   286
    ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   287
3464
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   288
    has3Dseparators ifTrue:[
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   289
        x1 < (maxX - absLabelLevel - absLabelLevel - 3) ifTrue:[
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   290
            dataSet
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   291
                drawEdgesAtX:x1 y:y0
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   292
                width:(width"-margin"-x1"-absLabelLevel") height:h
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   293
                level:absLabelLevel on:self
c9d675b2cfd9 bugfix - support of not has3Dseparators
ca
parents: 3324
diff changeset
   294
        ].
3467
f2212331f4e5 changed #redrawEdgesX:y:width:height:
ca
parents: 3466
diff changeset
   295
    ] ifFalse:[
f2212331f4e5 changed #redrawEdgesX:y:width:height:
ca
parents: 3466
diff changeset
   296
        h := h - 1.
5422
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   297
        gc paint:separatorOneDColor.
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   298
        gc displayLineFromX:x y:h toX:(x + aWidth) y:h.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   299
    ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   300
!
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   301
4162
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   302
redrawX:xArg y:y width:wArg height:h
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   303
    |savClip x w |
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   304
3694
8a9158be10d7 dont do a super redraw - it clears what has just been drawn
Claus Gittinger <cg@exept.de>
parents: 3648
diff changeset
   305
    shown ifFalse:[^ self].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   306
4162
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   307
    x := xArg.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   308
    w := wArg.
4162
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   309
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   310
    self redrawColumnsInX:x y:y width:w height:h.
4162
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   311
    columns size == 0 ifTrue:[ ^ self ].
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   312
4522
2f6d2d3aeea3 class: DSVLabelView
Stefan Vogel <sv@exept.de>
parents: 4497
diff changeset
   313
    savClip := gc clippingBoundsOrNil.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   314
4162
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   315
    dataSet has3Dseparators ifTrue:[ | eoXlastCol |
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   316
        eoXlastCol := self xVisibleOfColNr:( columns size + 1).
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   317
        x >= eoXlastCol ifTrue:[
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   318
            w := w +( x - eoXlastCol ).
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   319
            x := eoXlastCol.
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   320
        ].
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   321
    ].
5189
ff07b0369121 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5078
diff changeset
   322
    self clippingBounds:(Rectangle left:x top:margin width:w height:height-margin-margin).
4162
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   323
        
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   324
    xArg > x ifTrue:[
5422
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   325
        gc paint:(dataSet backgroundColor).
e783e1ebf5ca #TUNING by cg
Claus Gittinger <cg@exept.de>
parents: 5410
diff changeset
   326
        gc fillRectangleX:x y:y width:w height:h.
4162
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   327
    ].    
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   328
    self redrawEdgesX:x y:y width:w height:h.
5189
ff07b0369121 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5078
diff changeset
   329
    self clippingBounds:savClip.
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   330
! !
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   331
2820
990d1d3eaffc adding enumerating columns method
ab
parents: 2789
diff changeset
   332
!DSVLabelView methodsFor:'enumerating columns'!
990d1d3eaffc adding enumerating columns method
ab
parents: 2789
diff changeset
   333
990d1d3eaffc adding enumerating columns method
ab
parents: 2789
diff changeset
   334
columnsDo:aOneArgBlock 
990d1d3eaffc adding enumerating columns method
ab
parents: 2789
diff changeset
   335
    "evaluate the argument, aOneArgBlock for every column"
990d1d3eaffc adding enumerating columns method
ab
parents: 2789
diff changeset
   336
990d1d3eaffc adding enumerating columns method
ab
parents: 2789
diff changeset
   337
    columns do:aOneArgBlock
990d1d3eaffc adding enumerating columns method
ab
parents: 2789
diff changeset
   338
! !
990d1d3eaffc adding enumerating columns method
ab
parents: 2789
diff changeset
   339
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   340
!DSVLabelView methodsFor:'event handling'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   341
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   342
buttonMotion:state x:x y:y
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   343
    "mouse-button was moved;
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   344
     redraw thumb at its new position and, if scroll-mode is asynchronous, 
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   345
     the scroll action is performed
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   346
    "
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   347
    |colNr x1 col|
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   348
1958
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   349
    state = 0 ifTrue:[
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   350
        lineDrag := nil.
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   351
    ].
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   352
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   353
    lineDrag notNil ifTrue:[
1932
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   354
        (opaqueColumnResize ? (UserPreferences current opaqueTableColumnResizing == true)) ifTrue:[
1939
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   355
            lineDrag moveToX:x.      
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   356
            dataSet changeWidthOfColumn:lineDrag column deltaX:lineDrag deltaX.
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   357
            lineDrag resetDeltaX.    
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   358
        ] ifFalse:[
3537
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   359
            lineDrag invertLinesMovingToX:x.
1931
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   360
        ].
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   361
        ^ self.
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   362
    ].
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   363
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   364
    "/ in the resize area ?
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   365
    colNr := self xVisibleToColNr:(x-tabSpacing).
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   366
    colNr notNil ifTrue:[
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   367
        col := columns at:colNr.
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   368
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   369
        (col notNil and:[col isResizeable]) ifTrue:[
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   370
            x1 := self xVisibleOfColNr:(colNr + 1).
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   371
            (x between:(x1-tabSpacing) and:(x1+tabSpacing))
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   372
            "/ x + tabSpacing > x1 
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   373
            ifTrue:[
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   374
                self cursor:handleCursor.
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   375
                ^ self
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   376
            ].
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   377
        ].
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   378
    ].
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   379
    self cursor:(Cursor normal)
3212
cb80f339ddfa +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
   380
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   381
    "Modified: / 26-03-2007 / 15:20:27 / cg"
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   382
!
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   383
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   384
buttonPress:button x:x y:y
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   385
    "handle a button press event; checks whether the item under the mouse
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   386
     is selectable. If true, the selection is set to the item.
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   387
    "
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   388
    |x1 colNr col|
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   389
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   390
    (enabled and:[shown]) ifFalse:[
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   391
        ^ self
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   392
    ].
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   393
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   394
    "/ in the resize area ?
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   395
    colNr := self xVisibleToColNr:(x-tabSpacing).
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   396
    colNr notNil ifTrue:[
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   397
        col := columns at:colNr.
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   398
        col isResizeable ifTrue:[
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   399
            x1 := self xVisibleOfColNr:(colNr + 1).
3212
cb80f339ddfa +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
   400
            (x between:(x1-tabSpacing) and:(x1+tabSpacing)) ifTrue:[
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   401
                col := columns at:colNr ifAbsent:nil.
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   402
                self cursor:handleCursor.
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   403
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   404
                lineDrag := LineDrag new.
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   405
                lineDrag column:col
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   406
                              x:x
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   407
                              y:margin
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   408
                              h:(self height + dataSet height)
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   409
                           minX:(x1 - col width + col minimumRequiredWidth)
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   410
                             on:self.
1939
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   411
                (opaqueColumnResize ? (UserPreferences current opaqueTableColumnResizing == true)) ifFalse:[
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   412
                    lineDrag invertLine.
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   413
                ].
3212
cb80f339ddfa +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
   414
                ^ self
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   415
            ]
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   416
        ]
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   417
    ].
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   418
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   419
    colNr := self xVisibleToColNr:x.
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   420
    colNr notNil ifTrue:[
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   421
        col := columns at:colNr.
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   422
        col label isSelectable ifTrue:[
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   423
            self invalidateItemAt:(selection := colNr)
3212
cb80f339ddfa +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
   424
        ].
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   425
    ].
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   426
    self cursor:(Cursor normal).
3212
cb80f339ddfa +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
   427
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   428
    "Modified: / 26-03-2007 / 15:21:00 / cg"
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   429
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   430
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   431
buttonRelease:button x:x y:y
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   432
    "handle a button press event; checks whether the item under the mouse
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   433
     is the selected item. If true, the application is informed.
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   434
    "
3769
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   435
    |selected column deltaX colNr|
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   436
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   437
    self cursor:(Cursor normal).
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   438
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   439
    selection isNil ifTrue:[
1933
be953fb15d3d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   440
        lineDrag notNil ifTrue:[
1939
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   441
            (opaqueColumnResize ? (UserPreferences current opaqueTableColumnResizing == true)) ifFalse:[
2150
5184a8b92c2a better look
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   442
                lineDrag invertLine.
1932
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   443
                column   := lineDrag column.
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   444
                deltaX   := lineDrag deltaX.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   445
1932
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   446
                deltaX abs > 0 "2" ifTrue:[
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   447
                    dataSet changeWidthOfColumn:column deltaX:deltaX
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   448
                ]
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   449
            ].
1933
be953fb15d3d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   450
            lineDrag := nil.
4428
dc1eea56fb2f class: DSVLabelView
Claus Gittinger <cg@exept.de>
parents: 4162
diff changeset
   451
            ^ self.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   452
        ].
3774
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   453
3769
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   454
        ((colNr := dataSet xVisibleToColNr:x) notNil
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   455
        and:[ (column := columns at:colNr) notNil
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   456
        and:[ column label isSortable ]]) ifTrue:[
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   457
            indexOfSortColumn == colNr ifTrue:[
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   458
                reverseSort := (reverseSort ? false) not
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   459
            ] ifFalse:[
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   460
                reverseSort := false.
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   461
                indexOfSortColumn := colNr.
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   462
            ].
3774
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   463
            self invalidateItemAt:colNr.
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   464
            dataSet updateList.
3769
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   465
        ].
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   466
        ^ self.
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   467
    ].
3769
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   468
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   469
    colNr := self xVisibleToSelectionIndex:x.
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   470
    selected  := (colNr == selection).
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   471
    colNr     := selection.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   472
    selection := nil.
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   473
3769
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   474
    self invalidateItemAt:colNr.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   475
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   476
    selected ifTrue:[
3774
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   477
        self sendClickMsgForColumnNr:colNr
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   478
    ]
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   479
!
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   480
5562
5a25c39f1864 #BUGFIX by ca
ca
parents: 5446
diff changeset
   481
fontChanged
5a25c39f1864 #BUGFIX by ca
ca
parents: 5446
diff changeset
   482
    "invoked after the font has changed"
5a25c39f1864 #BUGFIX by ca
ca
parents: 5446
diff changeset
   483
    preferredHeight := nil.
5a25c39f1864 #BUGFIX by ca
ca
parents: 5446
diff changeset
   484
    columns do:[:each| each label fontChangedOn:self].
5a25c39f1864 #BUGFIX by ca
ca
parents: 5446
diff changeset
   485
!
5a25c39f1864 #BUGFIX by ca
ca
parents: 5446
diff changeset
   486
5a25c39f1864 #BUGFIX by ca
ca
parents: 5446
diff changeset
   487
mouseWheelZoom:amount
5a25c39f1864 #BUGFIX by ca
ca
parents: 5446
diff changeset
   488
    ^ dataSet mouseWheelZoom:amount
5a25c39f1864 #BUGFIX by ca
ca
parents: 5446
diff changeset
   489
!
5a25c39f1864 #BUGFIX by ca
ca
parents: 5446
diff changeset
   490
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   491
pointerLeave:state
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   492
    "mouse left view - restore cursor.
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   493
    "
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   494
    self sensor anyButtonPressed ifFalse:[
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   495
        self cursor:(Cursor normal)
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   496
    ].
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   497
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   498
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   499
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   500
!
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   501
3774
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   502
sendClickMsgForColumnNr:colNr
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   503
    "inform the receiver of a button release notification"
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   504
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   505
    |receiver col description labelActionSelector|
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   506
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   507
    receiver := self application.
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   508
    receiver isNil ifTrue:[^ self].
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   509
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   510
    col := columns at:colNr.
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   511
    description := col description.
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   512
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   513
    (labelActionSelector := description labelActionSelector) notNil ifTrue:[
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   514
        receiver perform:labelActionSelector withOptionalArgument:(description labelActionArgument) and:colNr
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   515
    ].
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   516
!
60cc6d68cc3a sortable
Claus Gittinger <cg@exept.de>
parents: 3769
diff changeset
   517
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   518
xVisibleToColNr:x
3212
cb80f339ddfa +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
   519
    "returns the column number for a physical x position.
5078
1712c18ead27 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4990
diff changeset
   520
     Returns nil if x is beyond the last column."
3212
cb80f339ddfa +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
   521
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   522
    |x0 x1|
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   523
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   524
    x1 := self xVisibleOfColNr:1.
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   526
    columns keysAndValuesDo:[:index :aCol|
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   527
        x0 := x1.
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   528
        x1 := x0 + aCol width.
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   529
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   530
        (x1 > x and:[x0 < x]) ifTrue:[
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   531
            ^ index
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   532
        ]
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   533
    ].
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   534
    ^ nil
3212
cb80f339ddfa +activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3188
diff changeset
   535
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   536
    "Modified: / 26-03-2007 / 15:21:37 / cg"
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   537
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   538
3188
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   539
!DSVLabelView methodsFor:'focus handling'!
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   540
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   541
canTab
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   542
    ^ false
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   543
!
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   544
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   545
wantsFocusWithButtonPress
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   546
    "never wants the focus - view which keeps the labels
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   547
    "
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   548
    ^ false
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   549
! !
35f40882d508 focus handling - bugfix
ca
parents: 2924
diff changeset
   550
3214
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   551
!DSVLabelView methodsFor:'help'!
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   552
5674
b0c29ac08517 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
   553
helpTextAt:aPoint
3214
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   554
    "return the helpText for aPoint (i.e. when mouse-pointer is moved over an item)."
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   555
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   556
    |colNr col|
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   557
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   558
    columns isEmpty ifTrue:[^ nil].
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   559
    colNr := self xVisibleToColNr:aPoint x.
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   560
    colNr notNil ifTrue:[
3214
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   561
        col := columns at:colNr.
3523
26c2bafdd0fb separate activeHelp for labels
Claus Gittinger <cg@exept.de>
parents: 3489
diff changeset
   562
        ^ col activeHelpTextForLabel.
3214
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   563
    ].
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   564
    ^ nil
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   565
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   566
    "Created: / 26-03-2007 / 13:43:20 / cg"
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   567
    "Modified: / 26-03-2007 / 15:21:07 / cg"
3214
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   568
! !
28214ee49bb6 activeHelpText
Claus Gittinger <cg@exept.de>
parents: 3212
diff changeset
   569
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   570
!DSVLabelView methodsFor:'initialization'!
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   571
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   572
initStyle
2924
a1e88fa18621 resource directive
Claus Gittinger <cg@exept.de>
parents: 2820
diff changeset
   573
    <resource: #style (#'dataSet.labelView.level'
a1e88fa18621 resource directive
Claus Gittinger <cg@exept.de>
parents: 2820
diff changeset
   574
                       #'dataSet.labelView.verticalSpace' 
a1e88fa18621 resource directive
Claus Gittinger <cg@exept.de>
parents: 2820
diff changeset
   575
                       )>
a1e88fa18621 resource directive
Claus Gittinger <cg@exept.de>
parents: 2820
diff changeset
   576
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   577
    super initStyle.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   578
4990
bf3fb53d4dc0 device access
Claus Gittinger <cg@exept.de>
parents: 4876
diff changeset
   579
    handleCursor := (VariablePanel cursorForOrientation:#horizontal onDevice: device) onDevice: device.
5238
cebbdb8032de #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 5189
diff changeset
   580
    gc font:self class defaultFont.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   581
    "/ self level:0.
2924
a1e88fa18621 resource directive
Claus Gittinger <cg@exept.de>
parents: 2820
diff changeset
   582
    self level:(styleSheet at:#'dataSet.labelView.level' default:-1).
a1e88fa18621 resource directive
Claus Gittinger <cg@exept.de>
parents: 2820
diff changeset
   583
    verticalLabelSpacing := (styleSheet at:#'dataSet.labelView.verticalSpace' default:2).
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   584
!
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   585
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   586
initialize
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   587
    super initialize.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   588
    "/ super level:(self defaultLevel).
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   589
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   590
    enabled    := true.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   591
    columns    := #().
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   592
    tabSpacing := self class tabSpacing.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   593
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   594
    self enableMotionEvents.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   595
! !
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   596
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   597
!DSVLabelView methodsFor:'instance creation'!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   598
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   599
for:aColumnView
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   600
    "initialization
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   601
    "
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   602
    dataSet   := aColumnView.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   603
"/    self level:(dataSet level).
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   604
"/    self borderWidth:(dataSet borderWidth).
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   605
!
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   606
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   607
realize
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   608
    "recompute contents and fit columns to view
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   609
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   610
    self  bitGravity:#NorthWest.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   611
    super realize.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   612
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   613
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   614
!DSVLabelView methodsFor:'queries'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   615
3769
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   616
columnIndexOfDescription:aColumnDescription
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   617
    ^ columns findFirst:[:col | col description == aColumnDescription]
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   618
!
7b20f210313c sortable columns
Claus Gittinger <cg@exept.de>
parents: 3766
diff changeset
   619
5943
5bd4c8c6ec5f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   620
computePreferredExtent
5bd4c8c6ec5f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   621
    ^ 100 @ self preferredHeight
5bd4c8c6ec5f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   622
5bd4c8c6ec5f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   623
    "Created: / 09-11-2018 / 19:50:18 / Claus Gittinger"
5bd4c8c6ec5f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   624
!
5bd4c8c6ec5f #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 5674
diff changeset
   625
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   626
enabled
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   627
    "true, if widget is enabled
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   628
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   629
    ^ enabled
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   630
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   631
5446
6371c5e1a429 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5422
diff changeset
   632
enabled:aBoolean
6371c5e1a429 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5422
diff changeset
   633
    "true, if widget is enabled"
6371c5e1a429 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5422
diff changeset
   634
6371c5e1a429 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5422
diff changeset
   635
    enabled := aBoolean.
6371c5e1a429 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5422
diff changeset
   636
6371c5e1a429 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 5422
diff changeset
   637
    "Modified (comment): / 04-02-2017 / 21:31:52 / cg"
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   638
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   639
3766
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   640
indexOfLabel:aLabel
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   641
    ^ columns findFirst:[:col | col label == aLabel].
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   642
!
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   643
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   644
preferredHeight
3489
f2f5a8273044 preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   645
    |maxLabelHeight|
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   646
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   647
    preferredHeight notNil ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   648
        ^ preferredHeight
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   649
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   650
3489
f2f5a8273044 preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   651
    maxLabelHeight :=
f2f5a8273044 preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   652
        columns inject:0 into:[:maxSoFar :col | (col label preferredHeight) max:maxSoFar ].
f2f5a8273044 preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents: 3467
diff changeset
   653
4621
6b74f4a3bd60 class: DSVLabelView
Claus Gittinger <cg@exept.de>
parents: 4522
diff changeset
   654
    ^ ((self margin + verticalLabelSpacing) * 2) + maxLabelHeight 
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   655
!
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   656
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   657
xVisibleOfColNr:colNr
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   658
    "/ must adjust, because dataset includes its own margin, which might be different from ours
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   659
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   660
    ^ (dataSet xVisibleOfColNr:colNr) - dataSet margin + margin
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   661
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   662
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   663
xVisibleToSelectionIndex:x
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   664
    "returns the column number assigned to a physical x or nil. If
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   665
     the column exists but is not selectable nil is returned.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   666
    "
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   667
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   668
    |colNr column|
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   669
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   670
    (shown and:[enabled]) ifTrue:[
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   671
        ((colNr  := dataSet xVisibleToColNr:x)  notNil
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   672
         and:[(column := columns at:colNr) notNil
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   673
         and:[column label isSelectable]]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   674
        ) ifTrue:[
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   675
            ^ colNr
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   676
        ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   677
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   678
    ^ nil
3216
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   679
18f104700621 xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents: 3214
diff changeset
   680
    "Modified: / 26-03-2007 / 15:21:27 / cg"
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   681
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   682
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   683
!DSVLabelView methodsFor:'scrolling'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   684
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   685
copyFromX:x0 y:y0 toX:x1 y:y1 width:w invalidateX:leftX
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   686
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   687
    (shown) ifFalse:[^ self].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   688
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   689
    (self sensor hasDamageFor:self) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   690
        self invalidate
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   691
    ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   692
        self   copyFrom:self x:x0 y:y0 toX:x1 y:y1 width:w height:height async:false.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   693
        self invalidate:(Rectangle left:leftX top:0 width:(width - w) height:height)
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   694
              repairNow:true
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   695
    ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   696
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   697
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   698
!DSVLabelView::LineDrag methodsFor:'accessing'!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   699
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   700
column
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   701
    "return the value of the instance variable 'column' (automatically generated)"
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   702
1931
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   703
    ^ column
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   704
!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   705
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   706
deltaX
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   707
    "returns the distance x between the start and end action
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   708
    "
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   709
    ^ topX - startX
1931
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   710
!
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   711
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   712
resetDeltaX
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   713
    startX := topX
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   714
! !
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   715
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   716
!DSVLabelView::LineDrag methodsFor:'dragging'!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   717
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   718
invertLine
3537
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   719
    "invert current line
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   720
    "
3537
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   721
    self invertLinesMovingToX:nil.
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   722
!
2027
e61da28e7ffc use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   723
3537
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   724
invertLinesMovingToX:viewX
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   725
    "invert current line
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   726
     if x notNil than change x position and invert new line"
1939
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   727
3537
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   728
    topView clippedByChildren:false.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   729
3537
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   730
    topView xoring:[
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   731
        topView paint:color.
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   732
        topView lineWidth:2.
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   733
        topView displayLineFromX:topX y:topY toX:topX y:botY.
2027
e61da28e7ffc use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   734
3537
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   735
        viewX notNil ifTrue:[
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   736
            self moveToX:viewX.
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   737
            topView displayLineFromX:topX y:topY toX:topX y:botY.
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   738
        ].
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   739
        topView flush
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   740
    ].
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   741
    topView clippedByChildren:true.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   742
!
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   743
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   744
moveToX:viewX
1939
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   745
    topX := (minX max:viewX) + transX.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   746
! !
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   747
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   748
!DSVLabelView::LineDrag methodsFor:'setup'!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   749
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   750
column:aColumn x:x y:y h:h minX:aMinX on:aView
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   751
    |device point|
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   752
3537
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   753
    column  := aColumn.
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   754
    topView := aView topView.
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   755
    device  := topView device.
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   756
    color   := Color colorId:(device blackpixel bitXor:device whitepixel).
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   757
    point   := device translatePoint:(x@y) fromView:aView toView:topView.
a34d64b71dd2 bugfix (vists) - donot drag on rootView; use topView
ca
parents: 3523
diff changeset
   758
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   759
    topX     := point x.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   760
    topY     := point y.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   761
    botY     := topY + h.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   762
    minX     := aMinX.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   763
    startX   := topX.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   764
    transX   := topX - x.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   765
! !
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   766
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   767
!DSVLabelView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   768
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   769
version
4876
8edcf9875271 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   770
    ^ '$Header$'
3766
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   771
!
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   772
4d81404f6f4c added: #isSortable
Claus Gittinger <cg@exept.de>
parents: 3694
diff changeset
   773
version_CVS
4876
8edcf9875271 #UI_ENHANCEMENT
Claus Gittinger <cg@exept.de>
parents: 4621
diff changeset
   774
    ^ '$Header$'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   775
! !
4162
a83bdc0dba68 class: DSVLabelView
ca
parents: 3774
diff changeset
   776