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