DSVLabelView.st
author Claus Gittinger <cg@exept.de>
Sun, 29 Aug 1999 16:28:56 +0200
changeset 1494 096845be5d75
parent 1491 d6133cb2f3c9
child 1524 b7f986aa45f4
permissions -rw-r--r--
draw tabulatorLine on the tootView; do not use a SimpleView
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
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
    17
SimpleView subclass:#DSVLabelView
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
    18
	instanceVariableNames:'isVisible dataSet lineDrag columns selection enabled
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    19
		preferredHeight'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    20
	classVariableNames:''
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    21
	poolDictionaries:''
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    22
	category:'Views-DataSet'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    23
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    24
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
    25
Object subclass:#LineDrag
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
    26
	instanceVariableNames:'rootView topX topY botY column minX startX transX'
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    27
	classVariableNames:''
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    28
	poolDictionaries:''
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    29
	privateIn:DSVLabelView
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    30
!
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
    31
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    32
!DSVLabelView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    33
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    34
copyright
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    35
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    36
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    37
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    38
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    39
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    40
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    41
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    42
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    43
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    44
 hereby transferred.
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
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    50
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    51
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    52
documentation
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    53
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    54
    shows the labels assigned to the column descriptions. Used by the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    55
    DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    56
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    57
    [Instance variables:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    58
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    59
        dataSet         <DSVColumnView>         column view which shows the columns
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
    60
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    61
        selection       <Integer or nil>        current selected index or nil.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
    62
1086
2b5746c733f6 add some comment
ca
parents: 1085
diff changeset
    63
        enabled         <Boolean>               if a press action exists on a column
2b5746c733f6 add some comment
ca
parents: 1085
diff changeset
    64
                                                entry, this action could be enabled or
2b5746c733f6 add some comment
ca
parents: 1085
diff changeset
    65
                                                disabled.
2b5746c733f6 add some comment
ca
parents: 1085
diff changeset
    66
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    67
        isVisible       <Boolean>               true if the labelView is shown
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    68
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
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    83
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    84
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    85
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    86
!DSVLabelView methodsFor:'accessing'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
    87
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    88
columns:aListOfColumns
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    89
    "the list of columns changed
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
    90
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    91
    |layout|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    92
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    93
    columns         := aListOfColumns.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    94
    preferredHeight := nil.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    95
    selection       := nil.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    96
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    97
    isVisible ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    98
        dataSet layout:layout.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
    99
    ].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   100
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   101
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   102
preferredHeight
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   103
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   104
    preferredHeight isNil ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   105
        preferredHeight := 0.
884
4b2f2ddef43c bug fix:
ca
parents: 859
diff changeset
   106
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   107
        columns do:[:c|preferredHeight := (c label preferredHeight) max:preferredHeight ].
884
4b2f2ddef43c bug fix:
ca
parents: 859
diff changeset
   108
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   109
        
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   110
        preferredHeight := preferredHeight 
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   111
                         + (margin + margin + dataSet horizontalSpacing * 2)
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   112
    ].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   113
    ^ preferredHeight
884
4b2f2ddef43c bug fix:
ca
parents: 859
diff changeset
   114
! !
4b2f2ddef43c bug fix:
ca
parents: 859
diff changeset
   115
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   116
!DSVLabelView methodsFor:'drawing'!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   117
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   118
invalidate
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   119
    (shown and:[isVisible]) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   120
        super invalidate
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   121
    ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   122
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   123
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   124
invalidateItemAt:anIndex
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   125
    "invalidate rectangle assigned to an item at an index
824
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
    |cL xL xR hg|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   128
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   129
    (isVisible and:[shown]) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   130
        cL := columns at:anIndex ifAbsent:[^ nil].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   131
        xL := dataSet xVisibleOfColNr:anIndex.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   132
        xR := xL + cL width.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   133
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   134
        (xL < width and:[xR > 0]) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   135
            xL := xL max:0.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   136
            xR := xR min:width.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   137
            hg := height - margin - margin.
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
            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
   140
        ]
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
1408
1cda0a4fb566 use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents: 1269
diff changeset
   143
!
562
b7db6629f2cf recompute height from column labels
ca
parents: 560
diff changeset
   144
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   145
redrawX:x y:y width:w height:h
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   146
    "redraw a rectangle
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   147
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   148
    |items savClip bg fg fgColor bgColor level
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   149
     inset  "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   150
     maxX   "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   151
     colHgt "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   152
     wt     "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   153
     x1     "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   154
     x0     "{ Class:SmallInteger }"
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   155
    |
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   156
    (isVisible and:[shown]) ifFalse:[^ self].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   157
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   158
    bgColor := dataSet backgroundColor.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   159
    self paint:bgColor.
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   160
    self fillRectangleX:x y:y width:w height:h.
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   161
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   162
    columns isEmpty ifTrue:[^ self].
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   163
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   164
    fgColor := dataSet foregroundColor.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   165
    inset   := dataSet horizontalSpacing + 1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   166
    maxX    := (x + w) min:(width - margin).
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   167
    colHgt  := height - margin - margin.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   168
    savClip := clipRect.
859
e63eb6f321e1 support List for columns
ca
parents: 824
diff changeset
   169
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   170
    self clippingRectangle:(Rectangle left:x top:y width:w height:h).
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   171
    x1 := dataSet xVisibleOfColNr:1.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   172
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   173
    columns keysAndValuesDo:[:aKey :aCol| |anItem|
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   174
        anItem := aCol label.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   175
        wt := aCol width.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   176
        x0 := x1.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   177
        x1 := x1 + wt.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   178
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   179
        (x1 > x and:[x0 < maxX]) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   180
            fg := (anItem foregroundColor) ? fgColor.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   181
907
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   182
            (bg := anItem backgroundColor) notNil ifTrue:[
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   183
                bg ~= bgColor ifTrue:[
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   184
                    self paint:bg.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   185
                    self fillRectangleX:x0 y:margin width:wt height:colHgt.
907
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   186
                ]
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   187
            ] ifFalse:[
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   188
                bg := bgColor
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   189
            ].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   190
907
3250a67fcce2 draw for each column the label
ca
parents: 893
diff changeset
   191
            self paint:fg on:bg.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   192
            anItem redrawX:x0 w:wt h:height inset:inset on:self.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   193
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   194
            dataSet drawEdgesAtX:x0
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   195
                               y:margin
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   196
                           width:wt
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   197
                          height:colHgt
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   198
                           level:(selection == aKey ifTrue:[0] ifFalse:[2])
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   199
                              on:self
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   200
        ].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   201
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   202
859
e63eb6f321e1 support List for columns
ca
parents: 824
diff changeset
   203
    self clippingRectangle:savClip.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   204
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   205
562
b7db6629f2cf recompute height from column labels
ca
parents: 560
diff changeset
   206
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   207
! !
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   208
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   209
!DSVLabelView methodsFor:'event handling'!
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   210
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   211
buttonMotion:state x:x y:y
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   212
    "mouse-button was moved while pressed;
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   213
     redraw thumb at its new position and, if scroll-mode is asynchronous, 
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   214
     the scroll action is performed
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   215
    "
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   216
    lineDrag notNil ifTrue:[lineDrag moveToX:x]
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   217
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   218
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   219
!
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   220
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   221
buttonPress:button x:x y:y
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   222
    "handle a button press event; checks whether the item under the mouse
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   223
     is selectable. If true, the selection is set to the item.
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   224
    "
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   225
    |x0 x1|
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   226
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   227
    (isVisible and:[enabled and:[shown]]) ifFalse:[
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   228
        ^ self
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   229
    ].
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   230
    x1 := dataSet xVisibleOfColNr:1.
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   231
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   232
    columns keysAndValuesDo:[:index :aCol|
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   233
        x0 := x1.
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   234
        x1 := x0 + aCol width.
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   235
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   236
        (x1 > x and:[x0 < x]) ifTrue:[
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   237
            x + 6 > x1  ifFalse:[
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   238
                aCol label isSelectable ifTrue:[
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   239
                    self invalidateItemAt:(selection := index)
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   240
                ]
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   241
            ] ifTrue:[
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   242
                lineDrag := LineDrag new.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   243
                lineDrag column:aCol
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   244
                              x:x
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   245
                              y:margin
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   246
                              h:(self height + dataSet height)
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   247
                           minX:(x1 - aCol width + aCol minimumRequiredWidth)
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   248
                             on:self
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   249
            ].
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   250
            ^ self
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   251
        ].
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   252
    ].
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   253
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   254
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   255
637
e56ec99923ae VW compatible
ca
parents: 620
diff changeset
   256
buttonRelease:button x:x y:y
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   257
    "handle a button press event; checks whether the item under the mouse
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   258
     is the selected item. If true, the application is informed.
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   259
    "
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   260
    |selected index column deltaX|
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   261
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   262
    selection isNil ifTrue:[
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   263
        lineDrag notNil ifTrue:[
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   264
            lineDrag invertLine.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   265
            column   := lineDrag column.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   266
            deltaX   := lineDrag deltaX.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   267
            lineDrag := nil.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   268
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   269
            deltaX abs > 2 ifTrue:[
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   270
                dataSet changeWidthOfColumn:column deltaX:deltaX
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   271
            ]
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   272
        ].
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   273
        ^ self
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   274
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   275
    index     := self xVisibleToSelectionIndex:x.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   276
    selected  := index == selection.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   277
    index     := selection.
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   278
    selection := nil.
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   279
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   280
    self invalidateItemAt:index.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   281
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   282
    selected ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   283
        (columns at:index) label sendClickMsgTo:(self application)
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   284
    ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   285
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   286
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   287
!DSVLabelView methodsFor:'instance creation'!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   288
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   289
for:aColumnView
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   290
    "initialization
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   291
    "
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   292
    dataSet   := aColumnView.
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   293
    self level:(dataSet level).
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   294
    self borderWidth:(dataSet borderWidth).
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   295
!
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   296
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   297
initialize
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   298
    super initialize.
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   299
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   300
    enabled   := true.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   301
    isVisible := true.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   302
    columns   := #().
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   303
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   304
    self enableMotionEvents.
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   305
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   306
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   307
!
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   308
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   309
realize
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   310
    "recompute contents and fit columns to view
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   311
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   312
    self  bitGravity:#NorthWest.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   313
    super realize.
1085
cebea5318863 add enteredItem;
ca
parents: 907
diff changeset
   314
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   315
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   316
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   317
!DSVLabelView methodsFor:'queries'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   318
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   319
enabled
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   320
    "true, if widget is enabled
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   321
    "
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   322
    ^ enabled
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   323
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   324
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   325
enabled:aState
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   326
    "true, if widget is enabled
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   327
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   328
    enabled := aState.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   329
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   330
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   331
isVisible
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   332
    ^ isVisible
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   333
!
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   334
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   335
isVisible:aBool
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   336
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   337
    aBool ~~ isVisible ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   338
        isVisible := aBool.
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   339
        dataSet layout:nil.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   340
    ].
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   341
!
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   342
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   343
xVisibleToSelectionIndex:x
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   344
    "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
   345
     the column exists but is not selectable nil is returned.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   346
    "
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   347
    |index column|
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   348
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   349
    (isVisible and:[enabled]) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   350
        (     (index  := dataSet xVisibleToColNr:x)  notNil
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   351
         and:[(column := columns at:index ifAbsent:nil) notNil
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   352
         and:[column label isSelectable]]
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   353
        ) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   354
            ^ index
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   355
        ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   356
    ].
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   357
    ^ nil
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   358
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   359
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   360
!DSVLabelView methodsFor:'scrolling'!
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   361
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   362
copyFromX:x0 y:y0 toX:x1 y:y1 width:w invalidateX:leftX
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   363
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   364
    (shown and:[isVisible]) ifFalse:[^ self].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   365
1487
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   366
    (self sensor hasDamageFor:self) ifTrue:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   367
        self invalidate
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   368
    ] ifFalse:[
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   369
        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
   370
        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
   371
              repairNow:true
fd003e2156cc bug fixes + rework
Claus Gittinger <cg@exept.de>
parents: 1454
diff changeset
   372
    ]
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   373
! !
d2e60c8ac775 support of Drag & Drop
ca
parents: 648
diff changeset
   374
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   375
!DSVLabelView::LineDrag methodsFor:'accessing'!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   376
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   377
column
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   378
    "return the value of the instance variable 'column' (automatically generated)"
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   379
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   380
    ^ column!
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   381
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   382
deltaX
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   383
    "returns the distance x between the start and end action
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   384
    "
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   385
    ^ topX - startX
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   386
! !
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   387
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   388
!DSVLabelView::LineDrag methodsFor:'dragging'!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   389
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   390
invertLine
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   391
    "invert for a line
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   392
    "
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   393
    rootView clippedByChildren:false.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   394
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   395
    rootView xoring:[
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   396
        rootView lineWidth:2.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   397
        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
   398
        rootView flush
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   399
    ]    
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   400
!
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   401
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   402
moveToX:viewX
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   403
    |x|
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   404
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   405
    x := (minX max:viewX) + transX.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   406
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   407
    x == topX ifFalse:[
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   408
        self invertLine.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   409
        topX := x.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   410
        self invertLine.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   411
    ]
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   412
! !
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   413
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   414
!DSVLabelView::LineDrag methodsFor:'setup'!
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   415
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   416
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
   417
    |device point|
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   418
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   419
    column   := aColumn.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   420
    device   := aView device.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   421
    rootView := device rootView.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   422
    point    := device translatePoint:(x@y) from:(aView id) to:(rootView id).
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   423
    topX     := point x.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   424
    topY     := point y.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   425
    botY     := topY + h.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   426
    minX     := aMinX.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   427
    startX   := topX.
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   428
    transX   := topX - x.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   429
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   430
    self invertLine.
1491
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   431
! !
d6133cb2f3c9 support tabulator
Claus Gittinger <cg@exept.de>
parents: 1487
diff changeset
   432
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   433
!DSVLabelView class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   434
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   435
version
1494
096845be5d75 draw tabulatorLine on the tootView; do not use a SimpleView
Claus Gittinger <cg@exept.de>
parents: 1491
diff changeset
   436
    ^ '$Header: /cvs/stx/stx/libwidg2/DSVLabelView.st,v 1.27 1999-08-29 14:28:56 cg Exp $'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   437
! !