DSVLabelView.st
author Claus Gittinger <cg@exept.de>
Mon, 28 Feb 2005 15:29:56 +0100
changeset 2789 e7c8596999e7
parent 2685 e3b9d046915d
child 2820 990d1d3eaffc
permissions -rw-r--r--
comment
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     1
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     3
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     4
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    10
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    11
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    12
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    13
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    14
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    15
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    16
1844
05a9cb2fc86f default font
martin
parents: 1605
diff changeset
    17
"{ Package: 'stx:libwidg2' }"
05a9cb2fc86f default font
martin
parents: 1605
diff changeset
    18
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
    19
SimpleView subclass:#DSVLabelView
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
    20
	instanceVariableNames:'dataSet lineDrag columns selection enabled preferredHeight
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
    21
		handleCursor tabSpacing opaqueColumnResize verticalLabelSpacing'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    22
	classVariableNames:''
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    23
	poolDictionaries:''
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    24
	category:'Views-DataSet'
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
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
    28
	instanceVariableNames:'rootView topX topY botY column minX startX transX'
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    29
	classVariableNames:''
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    30
	poolDictionaries:''
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    31
	privateIn:DSVLabelView
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
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   100
    "the list of columns changed
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
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
1931
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   111
opaqueColumnResize
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   112
    ^ opaqueColumnResize
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   113
!
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   114
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   115
opaqueColumnResize:aBoolean
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   116
    opaqueColumnResize := aBoolean
884
4b2f2ddef43c bug fix:
ca
parents: 859
diff changeset
   117
! !
4b2f2ddef43c bug fix:
ca
parents: 859
diff changeset
   118
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   119
!DSVLabelView methodsFor:'drawing'!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   120
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   121
invalidate
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   122
    (shown) ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   123
        super invalidate
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   124
    ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   125
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   126
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   127
invalidateItemAt:anIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   128
    "invalidate rectangle assigned to an item at an index
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   129
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   130
    |cL xL xR hg|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   131
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   132
    (shown) ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   133
        cL := columns at:anIndex ifAbsent:[^ nil].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   134
        xL := self xVisibleOfColNr:anIndex.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   135
        xR := xL + cL width.
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
        (xL < width and:[xR > 0]) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   138
            xL := xL max:0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   139
            xR := xR min:width.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   140
            hg := height - margin - margin.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   141
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   142
            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
   143
        ]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   144
    ]
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   145
!
562
b7db6629f2cf recompute height from column labels
ca
parents: 560
diff changeset
   146
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   147
redrawColumnsInX:x y:y width:w height:h
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   148
    "redraw a rectangle
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   149
    "
1605
3eb7d3e78e08 checkin from browser
ca
parents: 1585
diff changeset
   150
    |savClip bg fg fgColor bgColor
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   151
     inset  "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   152
     maxX   "{ Class:SmallInteger }"
1524
b7f986aa45f4 visibility of label; show as button (yes/no)
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   153
     lblH  "{ Class:SmallInteger }"
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   154
     wt     "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   155
     x1     "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   156
     x0     "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   157
    |
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   158
    (shown) ifFalse:[^ self].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   159
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   160
    bgColor := dataSet backgroundColor.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   161
    self paint:bgColor.
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   162
    self fillRectangleX:x y:y width:w height:h.
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   163
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   164
    columns isEmpty ifTrue:[^ self].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   165
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   166
    fgColor := dataSet foregroundColor.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   167
    inset   := dataSet horizontalSpacing + 1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   168
    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
   169
    lblH    := height - margin - margin.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   170
    savClip := clipRect.
859
e63eb6f321e1 support List for columns
ca
parents: 824
diff changeset
   171
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   172
    x1 := self xVisibleOfColNr:1.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   173
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   174
    columns keysAndValuesDo:[:aKey :aCol| |anItem|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   175
        anItem := aCol label.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   176
        wt := aCol width.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   177
        x0 := x1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   178
        x1 := x1 + wt.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   179
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   180
        (x1 > x and:[x0 < maxX]) ifTrue:[
1940
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   181
            |left right rect|
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   182
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   183
            left  := x0 max:x.
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   184
            right := x1 min:maxX.
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   185
            rect  := Rectangle left:left top:y width:(right - left) height:h.
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   186
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   187
            clipRect := nil.
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   188
            self clippingRectangle:rect.
50cf5e9dea10 allow resizing less than label size
ca
parents: 1939
diff changeset
   189
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   190
            fg := (anItem foregroundColor) ? fgColor.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   191
907
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   192
            (bg := anItem backgroundColor) notNil ifTrue:[
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   193
                bg ~= bgColor ifTrue:[
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   194
                    self paint:bg.
1524
b7f986aa45f4 visibility of label; show as button (yes/no)
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
   195
                    self fillRectangleX:x0 y:margin width:wt height:lblH.
907
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   196
                ]
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   197
            ] ifFalse:[
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   198
                bg := bgColor
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   199
            ].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   200
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   201
            self   paint:fg on:bg.            
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   202
            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
   203
        ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   204
    ].
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   205
!
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   206
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   207
redrawEdgesX:x y:yTop width:aWidth height:aHeight
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   208
    "redraw the edges in the range
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   209
    "
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   210
    |tabXL desc drawWidth
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   211
     maxX "{ Class:SmallInteger }"
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   212
     h    "{ Class:SmallInteger }"
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   213
     x1   "{ Class:SmallInteger }"
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   214
     x0   "{ Class:SmallInteger }"
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   215
     y0   "{ Class:SmallInteger }"
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   216
     absLabelLevel
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   217
    |
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   218
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   219
    maxX := (x + aWidth) min:(width - margin).
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   220
    absLabelLevel := 1.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   221
    x1   := self xVisibleOfColNr:1.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   222
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   223
    y0 := margin.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   224
    h  := height - margin - margin.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   225
"/    margin >= absLabelLevel ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   226
"/        y0 := y0 - absLabelLevel.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   227
"/        h := h + absLabelLevel+absLabelLevel.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   228
"/    ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   229
    columns keysAndValuesDo:[:aKey :aCol|
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   230
        desc := aCol description.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   231
        x0   := x1.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   232
        x1   := x1 + aCol width.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   233
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   234
        aKey == selection ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   235
            (x1 > x and:[x0 < maxX]) ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   236
                dataSet drawEdgesAtX:x0 y:y0 width:(x1 - x0) height:h level:(absLabelLevel negated) on:self.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   237
            ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   238
            tabXL notNil ifTrue:[drawWidth := x0 - tabXL].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   239
        ] ifFalse:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   240
            desc labelHasButtonLayout ifFalse:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   241
                tabXL notNil ifTrue:[drawWidth := x0 - tabXL].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   242
            ] ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   243
                tabXL isNil ifTrue:[tabXL := x0].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   244
                desc labelIsPartOfGroup ifFalse:[drawWidth := x1 - tabXL].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   245
            ]
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   246
        ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   247
        drawWidth notNil ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   248
            ((tabXL + drawWidth) > x and:[tabXL < maxX]) ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   249
                dataSet drawEdgesAtX:tabXL y:y0 width:drawWidth height:h level:absLabelLevel on:self.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   250
            ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   251
            drawWidth := tabXL := nil.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   252
        ]
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   253
    ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   254
    tabXL notNil ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   255
        dataSet drawEdgesAtX:tabXL y:y0 width:(x1 - tabXL) height:h level:absLabelLevel on:self
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   256
    ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   257
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   258
    x1 < (maxX - absLabelLevel - absLabelLevel - 3) ifTrue:[
2150
5184a8b92c2a better look
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   259
        dataSet 
5184a8b92c2a better look
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   260
            drawEdgesAtX:x1 y:y0 
5184a8b92c2a better look
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   261
            width:(width-margin-x1-absLabelLevel) height:h 
5184a8b92c2a better look
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   262
            level:absLabelLevel on:self
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   263
    ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   264
!
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   265
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   266
redrawX:x y:y width:wArg height:h
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   267
    |savClip w|
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   268
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   269
    (shown) ifFalse:[^ self].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   270
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   271
    w := wArg.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   272
    self redrawColumnsInX:x y:y width:w height:h.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   273
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   274
    super redrawX:x y:y width:w height:h.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   275
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   276
"/    (x + w) >= (width-margin) ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   277
"/        w := (width-margin) - 1 - x.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   278
"/    ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   279
    self clippingRectangle:(Rectangle left:x top:margin width:w height:height-margin-margin).
1605
3eb7d3e78e08 checkin from browser
ca
parents: 1585
diff changeset
   280
    self redrawEdgesX:x y:y width:w height:h.
859
e63eb6f321e1 support List for columns
ca
parents: 824
diff changeset
   281
    self clippingRectangle:savClip.
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   282
! !
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   283
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   284
!DSVLabelView methodsFor:'event handling'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   285
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   286
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
   287
    "mouse-button was moved;
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   288
     redraw thumb at its new position and, if scroll-mode is asynchronous, 
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   289
     the scroll action is performed
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   290
    "
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   291
    |idx x1 col|
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   292
1958
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   293
    state = 0 ifTrue:[
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   294
        lineDrag := nil.
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   295
    ].
15d36271d2fc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1940
diff changeset
   296
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   297
    lineDrag notNil ifTrue:[
1932
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   298
        (opaqueColumnResize ? (UserPreferences current opaqueTableColumnResizing == true)) ifTrue:[
1939
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   299
            lineDrag moveToX:x.      
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   300
            dataSet changeWidthOfColumn:lineDrag column deltaX:lineDrag deltaX.
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   301
            lineDrag resetDeltaX.    
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   302
        ] ifFalse:[
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   303
            lineDrag invertLine. "/ off
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   304
            lineDrag moveToX:x.      
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   305
            lineDrag invertLine. "/ on
1931
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   306
        ].
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   307
        ^ self.
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   308
    ].
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   309
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   310
    "/ in the resize area ?
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   311
    idx := self xVisibleToColNr:(x-tabSpacing).
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   312
    col := columns at:idx ifAbsent:nil.
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   313
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   314
    (col notNil and:[col isResizeable]) ifTrue:[
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   315
        x1 := self xVisibleOfColNr:(idx + 1).
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   316
        (x between:(x1-tabSpacing) and:(x1+tabSpacing))
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   317
        "/ x + tabSpacing > x1 
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   318
        ifTrue:[
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   319
            ^ self cursor:handleCursor
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   320
        ].
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   321
    ].
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   322
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   323
    self cursor:(Cursor normal)
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   324
!
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   325
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   326
buttonPress:button x:x y:y
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   327
    "handle a button press event; checks whether the item under the mouse
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   328
     is selectable. If true, the selection is set to the item.
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   329
    "
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   330
    |x1 idx col|
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   331
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   332
    (enabled and:[shown]) ifFalse:[
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   333
        ^ self
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   334
    ].
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   335
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   336
    "/ in the resize area ?
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   337
    idx := self xVisibleToColNr:(x-tabSpacing).
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
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
    idx ~~ 0 ifTrue:[
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   340
        col := columns at:idx ifAbsent:nil.
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   341
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   342
        col isResizeable ifTrue:[
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   343
            x1 := self xVisibleOfColNr:(idx + 1).
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   344
            (x between:(x1-tabSpacing) and:(x1+tabSpacing))
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   345
            ifTrue:[
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   346
                col := columns at:idx ifAbsent:nil.
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   347
                self cursor:handleCursor.
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   348
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   349
                lineDrag := LineDrag new.
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   350
                lineDrag column:col
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   351
                              x:x
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   352
                              y:margin
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   353
                              h:(self height + dataSet height)
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   354
                           minX:(x1 - col width + col minimumRequiredWidth)
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   355
                             on:self.
1939
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   356
                (opaqueColumnResize ? (UserPreferences current opaqueTableColumnResizing == true)) ifFalse:[
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   357
                    lineDrag invertLine.
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   358
                ].
1937
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   359
              ^ self
1eb0ed685b71 enable/disable resizeability
ca
parents: 1933
diff changeset
   360
            ]
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   361
        ]
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   362
    ].
1585
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   363
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   364
    idx := self xVisibleToColNr:x.
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   365
    col := columns at:idx ifAbsent:nil.
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   366
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   367
    col notNil ifTrue:[
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   368
        col label isSelectable ifTrue:[
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   369
            self invalidateItemAt:(selection := idx)
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   370
        ]
b4f60b1a025b fixed handle-fetch detection (handle is now easier to catch)
Claus Gittinger <cg@exept.de>
parents: 1525
diff changeset
   371
    ].
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   372
    self cursor:(Cursor normal).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   373
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   374
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   375
buttonRelease:button x:x y:y
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   376
    "handle a button press event; checks whether the item under the mouse
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   377
     is the selected item. If true, the application is informed.
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   378
    "
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   379
    |selected index column deltaX|
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   380
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   381
    self cursor:(Cursor normal).
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   382
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   383
    selection isNil ifTrue:[
1933
be953fb15d3d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   384
        lineDrag notNil ifTrue:[
1939
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   385
            (opaqueColumnResize ? (UserPreferences current opaqueTableColumnResizing == true)) ifFalse:[
2150
5184a8b92c2a better look
Claus Gittinger <cg@exept.de>
parents: 2146
diff changeset
   386
                lineDrag invertLine.
1932
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   387
                column   := lineDrag column.
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   388
                deltaX   := lineDrag deltaX.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   389
1932
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   390
                deltaX abs > 0 "2" ifTrue:[
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   391
                    dataSet changeWidthOfColumn:column deltaX:deltaX
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   392
                ]
ff9a2d6f71ff opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1931
diff changeset
   393
            ].
1933
be953fb15d3d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1932
diff changeset
   394
            lineDrag := nil.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   395
        ].
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   396
        ^ self
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   397
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   398
    index     := self xVisibleToSelectionIndex:x.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   399
    selected  := index == selection.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   400
    index     := selection.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   401
    selection := nil.
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   402
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   403
    self invalidateItemAt:index.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   404
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   405
    selected ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   406
        (columns at:index) label sendClickMsgTo:(self application)
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   407
    ]
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   408
!
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   409
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   410
pointerLeave:state
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   411
    "mouse left view - restore cursor.
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   412
    "
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   413
    self sensor anyButtonPressed ifFalse:[
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   414
        self cursor:(Cursor normal)
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   415
    ].
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   416
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   417
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   418
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   419
!
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   420
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   421
xVisibleToColNr:x
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   422
    "returns the column number assigned to a physical x or nil
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   423
    "
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   424
    |x0 x1|
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   425
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   426
    x1 := self xVisibleOfColNr:1.
1525
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   427
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   428
    columns keysAndValuesDo:[:index :aCol|
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   429
        x0 := x1.
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   430
        x1 := x0 + aCol width.
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   431
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   432
        (x1 > x and:[x0 < x]) ifTrue:[
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   433
            ^ index
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   434
        ]
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   435
    ].
1ab7703b29a9 change cursor if lineDrag is enabled
Claus Gittinger <cg@exept.de>
parents: 1524
diff changeset
   436
    ^ 0
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   437
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   438
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   439
!DSVLabelView methodsFor:'initialization'!
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   440
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   441
initStyle
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   442
    super initStyle.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   443
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   444
    handleCursor := (VariablePanel cursorForOrientation:#horizontal onDevice:device) onDevice:device.
2685
e3b9d046915d font: onDevice
james
parents: 2153
diff changeset
   445
    font := (self class defaultFont) onDevice:device.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   446
    "/ self level:0.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   447
    self level:(StyleSheet at:#'dataSet.labelView.level' default:-1).
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   448
    verticalLabelSpacing := (StyleSheet at:#'dataSet.labelView.verticalSpace' default:2).
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   449
!
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   450
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   451
initialize
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   452
    super initialize.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   453
    "/ super level:(self defaultLevel).
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   454
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   455
    enabled    := true.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   456
    columns    := #().
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   457
    tabSpacing := self class tabSpacing.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   458
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   459
    self enableMotionEvents.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   460
! !
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   461
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   462
!DSVLabelView methodsFor:'instance creation'!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   463
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   464
for:aColumnView
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   465
    "initialization
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   466
    "
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   467
    dataSet   := aColumnView.
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   468
"/    self level:(dataSet level).
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   469
"/    self borderWidth:(dataSet borderWidth).
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   470
!
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   471
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   472
realize
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   473
    "recompute contents and fit columns to view
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   474
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   475
    self  bitGravity:#NorthWest.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   476
    super realize.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   477
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   478
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   479
!DSVLabelView methodsFor:'queries'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   480
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   481
enabled
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   482
    "true, if widget is enabled
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   483
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   484
    ^ enabled
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   485
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   486
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   487
enabled:aState
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   488
    "true, if widget is enabled
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   489
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   490
    enabled := aState.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   491
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   492
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   493
preferredHeight
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   494
    |h|
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   495
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   496
    preferredHeight notNil ifTrue:[
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   497
        ^ preferredHeight
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   498
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   499
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   500
    h := 0.
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   501
    columns do:[:c | h := (c label preferredHeight) max:h ].
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   502
    ^ self margin + verticalLabelSpacing + h + verticalLabelSpacing + self margin
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   503
!
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   504
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   505
xVisibleOfColNr:colNr
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   506
    "/ must adjust, because dataset includes its own margin, which might be different from ours
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   507
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   508
    ^ (dataSet xVisibleOfColNr:colNr) - dataSet margin + margin
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   509
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   510
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   511
xVisibleToSelectionIndex:x
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   512
    "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
   513
     the column exists but is not selectable nil is returned.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   514
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   515
    |index column|
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   516
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   517
    (shown and:[enabled]) ifTrue:[
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   518
        (     (index  := dataSet xVisibleToColNr:x)  notNil
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   519
         and:[(column := columns at:index ifAbsent:nil) notNil
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   520
         and:[column label isSelectable]]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   521
        ) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   522
            ^ index
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   523
        ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   524
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   525
    ^ nil
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   526
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   527
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   528
!DSVLabelView methodsFor:'scrolling'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   529
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   530
copyFromX:x0 y:y0 toX:x1 y:y1 width:w invalidateX:leftX
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   531
2146
4ae1ec9f5307 level fixes;
penk
parents: 2027
diff changeset
   532
    (shown) ifFalse:[^ self].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   533
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   534
    (self sensor hasDamageFor:self) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   535
        self invalidate
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   536
    ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   537
        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
   538
        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
   539
              repairNow:true
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   540
    ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   541
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   542
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   543
!DSVLabelView::LineDrag methodsFor:'accessing'!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   544
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   545
column
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   546
    "return the value of the instance variable 'column' (automatically generated)"
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   547
1931
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   548
    ^ column
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   549
!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   550
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   551
deltaX
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   552
    "returns the distance x between the start and end action
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   553
    "
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   554
    ^ topX - startX
1931
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   555
!
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   556
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   557
resetDeltaX
576fbc61285a opaque table col resize
Claus Gittinger <cg@exept.de>
parents: 1844
diff changeset
   558
    startX := topX
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   559
! !
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   560
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   561
!DSVLabelView::LineDrag methodsFor:'dragging'!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   562
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   563
invertLine
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   564
    "invert for a line
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   565
    "
2027
e61da28e7ffc use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   566
    |c rootDevice|
e61da28e7ffc use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   567
e61da28e7ffc use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   568
    rootDevice := rootView device.
1939
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   569
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   570
    rootView clippedByChildren:false.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   571
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   572
    rootView xoring:[
2027
e61da28e7ffc use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   573
        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
   574
        rootView lineWidth:2.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   575
        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
   576
        rootView flush
2027
e61da28e7ffc use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   577
    ]
e61da28e7ffc use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   578
e61da28e7ffc use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   579
    "Modified: / 10.10.2001 / 15:14:25 / cg"
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   580
!
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   581
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   582
moveToX:viewX
1939
842c9c23e798 opaque move redraw
Claus Gittinger <cg@exept.de>
parents: 1937
diff changeset
   583
    topX := (minX max:viewX) + transX.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   584
! !
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   585
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   586
!DSVLabelView::LineDrag methodsFor:'setup'!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   587
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   588
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
   589
    |device point|
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   590
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   591
    column   := aColumn.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   592
    device   := aView device.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   593
    rootView := device rootView.
2027
e61da28e7ffc use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1959
diff changeset
   594
    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
   595
    topX     := point x.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   596
    topY     := point y.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   597
    botY     := topY + h.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   598
    minX     := aMinX.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   599
    startX   := topX.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   600
    transX   := topX - x.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   601
! !
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   602
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   603
!DSVLabelView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   604
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   605
version
2789
e7c8596999e7 comment
Claus Gittinger <cg@exept.de>
parents: 2685
diff changeset
   606
    ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.48 2005-02-28 14:29:56 cg Exp $'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   607
! !