DataSetColumn.st
author ca
Wed, 20 May 1998 09:38:03 +0200
changeset 891 f4d2ed9d3b88
parent 883 0a790ad56286
child 991 c1bc86ebe79e
permissions -rw-r--r--
checkin from browser
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
Object subclass:#DataSetColumn
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
    17
	instanceVariableNames:'columnNumber dataSet labelExtent minWidth width description form
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    18
		buttonInset buttonExtent textInset drawableAction toggleExtent
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    19
		rendererType backgroundColor foregroundColor fgSelector
891
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
    20
		bgSelector columnAlignment label'
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
    21
	classVariableNames:''
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    22
	poolDictionaries:''
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    23
	category:'Views-DataSet'
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    24
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    25
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    26
!DataSetColumn class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    27
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    28
copyright
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    29
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    30
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    31
              All Rights Reserved
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    32
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    33
 This software is furnished under a license and may be used
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    34
 only in accordance with the terms of that license and with the
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    36
 be provided or otherwise made available to, or used by, any
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    37
 other person.  No title to or ownership of the software is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    38
 hereby transferred.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    39
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    40
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    41
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    42
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    43
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    44
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    45
documentation
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    46
"
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    47
    represent one single column description of a DataSetView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    48
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    49
    [Instance variables:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    50
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    51
        columnNumber    <Integer>               sequence number (into list of columns)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    52
        description     <DataSetColumnSpec>     the column description
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    53
        dataSet         <DSVColumnView>         the view it belongs to
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    54
        width           <Integer>               width of column
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    55
        minWidth        <Integer>               minimum required width by the column
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    56
        buttonInset     <Integer>               top inset of a button (toggle)
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    57
        buttonExtent    <Point>                 extent of form
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    58
        textInset       <Integer>               top inset of a string
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    59
        form            <Form>                  a form drawn in the cell
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
    60
        labelExtent     <Point>                 the preferred extent of the cell label on device
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    61
        drawableAction  <Action>                action to access the printable
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    62
                                                label of a cell
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    63
        rendererType    <Type>                  renderer type derived from
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    64
                                                column specification.
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    65
        backgroundColor <Color or nil>          background color of all cells or nil
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    66
                                                (nil: use default background color).
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    67
        foregroundColor <Color or nil>          foreground color of all cells or nil
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    68
                                                (nil: use default foreground color).
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    69
        fgSelector      <Selector or nil>       access specific foreground color for
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    70
                                                a cell
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    71
        bgSelector      <Selector or nil>       access specific background color for
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    72
                                                a cell
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
    73
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    74
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    75
    [author:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    76
        Claus Atzkern
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    77
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    78
    [see also:]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    79
        DataSetColumnSpec
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    80
        DSVColumnView
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    81
        DataSetView
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
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    86
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    87
!DataSetColumn methodsFor:'accessing'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    88
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    89
at:aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    90
    "get the value of the raw at an index, aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    91
    "
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
    92
    ^ description row:(dataSet at:aRowNr) at:columnNumber
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    93
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    94
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    95
at:aRowNr put:something
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    96
    "set the value of the raw at an index, aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    97
    "
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
    98
    description row:(dataSet at:aRowNr) at:columnNumber put:something
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
    99
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   100
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   101
backgroundColor
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   102
    ^ backgroundColor
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   103
!
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   104
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   105
description
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   106
    "returns the column description
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   107
    "
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   108
    ^ description
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   109
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   110
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   111
!
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   112
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   113
foregroundColor
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   114
    ^ foregroundColor
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   115
!
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   116
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   117
label
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   118
    "get the label assigned to the column
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   119
    "
891
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   120
    ^ label
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   121
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   122
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   123
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   124
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   125
rendererType
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   126
    "returns my renderer type
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   127
    "
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   128
    ^ rendererType
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   129
!
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   130
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   131
width
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   132
    "returns the width in pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   133
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   134
    |end|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   135
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   136
    width notNil ifTrue:[ ^ width ].                            "/ already computed
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   137
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   138
    (    (width := description width)    ~~ 0                   "/ fixed size
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   139
     or:[(width := description minWidth) ~~ 0]                  "/ start size
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   140
    ) ifFalse:[
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   141
        self containsText ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   142
            "/ take maximum 10 entries to calculate the width;
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   143
            "/ can be resized later if neccessary
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   144
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   145
            end := 10 min:dataSet size.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   146
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   147
            1 to:end do:[:aRowNr||lbl|
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   148
                lbl := self drawableAt:aRowNr.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   149
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   150
                (lbl respondsTo:#widthOn:) ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   151
                    width := width max:(lbl widthOn:dataSet)
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   152
                ] ifFalse:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   153
                    lbl notNil ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   154
                        width := width max:(lbl displayString widthOn:dataSet)
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   155
                    ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   156
                ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   157
            ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   158
            description editorType ~~ #None ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   159
                width := width + (dataSet font widthOn:dataSet device)
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   160
            ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   161
        ].
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   162
        width := (width + buttonExtent x) max:(4 + labelExtent x)
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   163
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   164
    ^ width := minWidth := width + dataSet separatorSize + (2 * dataSet horizontalSpacing).
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   165
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   166
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   167
width:aWidth
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   168
    "set the width
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   169
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   170
    |w|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   171
545
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
   172
    (w := description width) ~~ 0 ifTrue:[             "/ fixed size
d01d14358b07 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 542
diff changeset
   173
        width := minWidth := w
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   174
    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   175
        width := aWidth max:minWidth
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   176
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   177
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   178
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   179
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   180
!DataSetColumn methodsFor:'drawing'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   181
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   182
drawButtonAtIndex:anIndex x:xR y:yR with:fgColor and:bgColor
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   183
    |y0 x0 extent lv w h|
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   184
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   185
    w := buttonExtent x.
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   186
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   187
    rendererType ~~ #CheckToggle ifTrue:[
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   188
        (self hasChoices:anIndex) ifFalse:[
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   189
            ^ self
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   190
        ].
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   191
        lv := dataSet comboButtonLevel.
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   192
        x0 := width - w - 4
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   193
    ] ifFalse:[
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   194
        lv := dataSet checkToggleLevel.
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   195
        x0 := width - w - (dataSet separatorSize) + 1 // 2        
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   196
    ].
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   197
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   198
    y0 := yR + buttonInset.
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   199
    x0 := xR + x0.
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   200
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   201
    dataSet drawEdgesAtX:x0 y:y0 width:w height:(buttonExtent y) level:lv.
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   202
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   203
    (rendererType ~~ #CheckToggle or:[self at:anIndex]) ifTrue:[
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   204
        (dataSet isRowSelected:anIndex) ifFalse:[dataSet paint:fgColor on:bgColor]
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   205
                                         ifTrue:[dataSet paint:(dataSet hgLgFgColor)
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   206
                                                            on:(dataSet hgLgBgColor)
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   207
                                                ].
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   208
        extent := (buttonExtent - form extent) // 2.
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   209
        dataSet displayImage:form x:(x0 + extent x) y:(y0 + extent y)
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   210
    ].
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   211
!
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   212
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   213
drawFrom:start times:nTimes x0:x0 yTop:yTop yBot:yBot with:fgColor and:bgColor
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   214
    "redraw rows between start and stop
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   215
    "
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   216
    |lgCol dkCol fg bg lblFg lblBg lbl row colSp fH fW fE sepSz level
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   217
     h  "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   218
     n  "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   219
     y  "{ Class:SmallInteger }"
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   220
     x  "{ Class:SmallInteger }"
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   221
     xI "{ Class:SmallInteger }"
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   222
     xCol "{ Class:SmallInteger }"
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   223
     spacing "{ Class:SmallInteger }"|
882
60984f178b0a prepared for #left, #right or #center aligned columns
ps
parents: 833
diff changeset
   224
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   225
    h  := dataSet rowHeight.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   226
604
6cee1e2b14c2 bug fix in draw routine:
ca
parents: 595
diff changeset
   227
    (bg := backgroundColor) isNil ifTrue:[
6cee1e2b14c2 bug fix in draw routine:
ca
parents: 595
diff changeset
   228
        bg := bgColor
6cee1e2b14c2 bug fix in draw routine:
ca
parents: 595
diff changeset
   229
    ] ifFalse:[
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   230
        dataSet paint:(dataSet colorOnDevice:bg).
644
5472db50a5eb redraw: single separator
ca
parents: 637
diff changeset
   231
        dataSet fillRectangleX:x0 y:yTop width:width  height:(yBot - yTop - 1)
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   232
    ].
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   233
    fg    := foregroundColor ? fgColor.
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   234
    lgCol := dataSet hgLgFgColor.
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   235
    dkCol := dataSet hgLgBgColor.
655
ea7fbb7166d7 center CkeckToggle in row
ca
parents: 647
diff changeset
   236
    sepSz := dataSet separatorSize.
882
60984f178b0a prepared for #left, #right or #center aligned columns
ps
parents: 833
diff changeset
   237
    spacing := dataSet horizontalSpacing.
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   238
    y     := yTop + textInset.
882
60984f178b0a prepared for #left, #right or #center aligned columns
ps
parents: 833
diff changeset
   239
    x     := x0   + spacing.
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   240
    n     := start.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   241
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   242
    nTimes timesRepeat:[
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   243
        row := dataSet at:n.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   244
        lbl := drawableAction value:row.
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   245
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   246
        (dataSet isSelected:n inColumn:columnNumber) ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   247
            dataSet paint:dkCol.
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   248
            dataSet fillRectangleX:x0 y:y - textInset width:width height:(h - 2).
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   249
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   250
            rendererType == #rowSelector ifTrue:[
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   251
                lbl := form
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   252
            ] ifFalse:[
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   253
                lbl isText ifTrue:[lbl := lbl string]
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   254
            ].
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   255
            lblBg := dkCol.
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   256
            lblFg := lgCol.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   257
        ] ifFalse:[
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   258
            (bgSelector notNil and:[(lblBg := row perform:bgSelector) notNil]) ifTrue:[
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   259
                dataSet paint:(lblBg := dataSet colorOnDevice:lblBg).
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   260
                dataSet fillRectangleX:x0 y:y - textInset width:width height:(h - 2).                
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   261
            ] ifFalse:[
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   262
                lblBg := bg
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   263
            ].
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   264
            lbl notNil ifTrue:[
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   265
                (fgSelector notNil and:[(lblFg := row perform:fgSelector) notNil]) ifFalse:[
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   266
                    lblFg := fg.
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   267
                ] ifTrue:[
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   268
                    lblFg := dataSet colorOnDevice:lblFg.
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   269
                ].
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   270
            ]
882
60984f178b0a prepared for #left, #right or #center aligned columns
ps
parents: 833
diff changeset
   271
        ].
60984f178b0a prepared for #left, #right or #center aligned columns
ps
parents: 833
diff changeset
   272
        lbl notNil ifTrue:[
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   273
            columnAlignment == #left ifTrue:[
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   274
                xCol := x
882
60984f178b0a prepared for #left, #right or #center aligned columns
ps
parents: 833
diff changeset
   275
            ] ifFalse:[
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   276
                xCol := width - (lbl widthOn:dataSet).
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   277
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   278
                columnAlignment == #right ifTrue:[xCol := xCol - spacing]
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   279
                                         ifFalse:[xCol := xCol // 2].
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   280
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   281
                xCol := (x0 + xCol) max:0.
882
60984f178b0a prepared for #left, #right or #center aligned columns
ps
parents: 833
diff changeset
   282
            ].
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   283
            dataSet paint:lblFg on:lblBg.
882
60984f178b0a prepared for #left, #right or #center aligned columns
ps
parents: 833
diff changeset
   284
            lbl displayOn:dataSet x:xCol y:y
60984f178b0a prepared for #left, #right or #center aligned columns
ps
parents: 833
diff changeset
   285
        ].
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   286
        y := y + h.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   287
        n := n + 1.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   288
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   289
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   290
    (form notNil and:[rendererType ~~ #rowSelector]) ifTrue:[
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   291
        y := yTop.
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   292
        n := start.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   293
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   294
        nTimes timesRepeat:[
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   295
            self drawButtonAtIndex:n x:x0 y:y with:fgColor and:bgColor.
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   296
            y := y + h.
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   297
            n := n + 1.
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   298
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   299
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   300
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   301
    "/ DRAW SEPARATORS
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   302
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   303
    x  := x0 + width - 1.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   304
655
ea7fbb7166d7 center CkeckToggle in row
ca
parents: 647
diff changeset
   305
    sepSz == 1 ifTrue:[
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   306
        y := yTop.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   307
604
6cee1e2b14c2 bug fix in draw routine:
ca
parents: 595
diff changeset
   308
        dataSet paint:fgColor.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   309
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   310
        description showColSeparator ifTrue:[
644
5472db50a5eb redraw: single separator
ca
parents: 637
diff changeset
   311
            dataSet displayLineFromX:x y:yTop toX:x y:yBot - 1
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   312
        ].
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   313
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   314
        description showRowSeparator ifTrue:[
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   315
            y := yTop - 1.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   316
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   317
            nTimes timesRepeat:[
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   318
                y := y + h.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   319
                dataSet displayLineFromX:x0 y:y toX:x y:y
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   320
            ]
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   321
        ]
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   322
    ] ifFalse:[
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   323
        dkCol := dataSet separatorDarkColor.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   324
        lgCol := dataSet separatorLightColor.
568
ca
parents: 565
diff changeset
   325
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   326
        (colSp := description showColSeparator) ifTrue:[
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   327
            y := yBot - 1.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   328
            dataSet paint:lgCol.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   329
            dataSet displayLineFromX:x y:yTop toX:x y:y.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   330
            x := x - 1.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   331
            dataSet paint:dkCol.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   332
            dataSet displayLineFromX:x y:yTop toX:x y:y.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   333
        ] ifFalse:[
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   334
            dataSet paint:dkCol
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   335
        ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   336
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   337
        description showRowSeparator ifTrue:[
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   338
            y := yTop - 2.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   339
            x := x0 + width.
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   340
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   341
            colSp ifTrue:[x := x - 2].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   342
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   343
            nTimes timesRepeat:[
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   344
                y := y + h.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   345
                dataSet displayLineFromX:x0 y:y toX:x y:y.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   346
            ].
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   347
            y := yTop - 1.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   348
            dataSet paint:lgCol.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   349
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   350
            nTimes timesRepeat:[
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   351
                y := y + h.
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   352
                dataSet displayLineFromX:x0 y:y toX:x y:y.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   353
            ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   354
        ]
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   355
    ]
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   356
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   357
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   358
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   359
invalidate
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   360
    "set to invalidate; forces a recomputation
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   361
    "
568
ca
parents: 565
diff changeset
   362
    minWidth := width := nil.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   363
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   364
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   365
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   366
!DataSetColumn methodsFor:'editing'!
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   367
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   368
editorAt:aRowNr
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   369
    |val row|
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   370
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   371
    row := dataSet at:aRowNr.
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   372
    val := description row:row at:columnNumber.
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   373
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   374
    val isText ifTrue:[val := val string].
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   375
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   376
    ^ description editorOn:row value:val.
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   377
! !
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   378
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   379
!DataSetColumn methodsFor:'event handling'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   380
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   381
doesNotUnderstand:aMessage
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   382
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   383
    (description respondsTo:(aMessage selector)) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   384
        ^ aMessage sendTo:description
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   385
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   386
    ^ super doesNotUnderstand:aMessage
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   387
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   388
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   389
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   390
textInsetChanged:aTextInset
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   391
    "recompute all attributes
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   392
    "
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   393
    |lbl|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   394
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   395
    self containsText ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   396
        textInset := dataSet verticalSpacing.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   397
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   398
        dataSet size ~~ 0 ifTrue:[
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   399
            lbl := self drawableAt:1.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   400
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   401
            (lbl isString or:[lbl isNumber]) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   402
                textInset := aTextInset
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   403
            ] ifFalse:[
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   404
                (lbl isNil and:[description printSelector isNil]) ifTrue:[
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   405
                    textInset := aTextInset.
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   406
                ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   407
            ]
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   408
        ]
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   409
    ] ifFalse:[
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   410
        textInset := (  (dataSet rowHeight)
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   411
                      - (form height)
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   412
                      - (dataSet separatorSize)
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   413
                     ) // 2.    
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   414
    ].    
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   415
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   416
    form isNil ifTrue:[
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   417
        buttonInset := 0
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   418
    ] ifFalse:[        
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   419
        buttonInset := (  (dataSet rowHeight)
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   420
                        - (buttonExtent x)
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   421
                        - (dataSet separatorSize)
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   422
                       ) // 2.
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   423
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   424
        rendererType == #CheckToggle ifTrue:[
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   425
            buttonInset := buttonInset + 1
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   426
        ]        
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   427
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   428
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   429
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   430
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   431
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   432
!DataSetColumn methodsFor:'grow & degrow'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   433
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   434
growWidth:n
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   435
    "grow the width for n pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   436
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   437
    width := width + n.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   438
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   439
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   440
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   441
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   442
minWidth
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   443
    "get my minimum width required by the entries into the column
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   444
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   445
    ^ minWidth notNil ifTrue:[minWidth] ifFalse:[self width]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   446
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   447
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   448
!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   449
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   450
setMinWidth
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   451
    "set the width to the required width. returns the psitive delta width
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   452
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   453
    |deltaX|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   454
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   455
    deltaX := width - minWidth.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   456
    width  := minWidth.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   457
  ^ deltaX.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   458
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   459
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   460
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   461
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   462
!DataSetColumn methodsFor:'initialization'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   463
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   464
on:aDSVColumnView description:aDescription columnNumber:aNumber
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   465
    "instance creation; set attributes dependent on the description
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   466
    "
891
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   467
    |device selector format idx type oldFont newFont|
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   468
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   469
    columnNumber    := aNumber.
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   470
    dataSet         := aDSVColumnView.
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   471
    description     := aDescription.
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   472
    rendererType    := description rendererType.
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   473
    form            := width := nil.
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   474
    device          := dataSet device.
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   475
    drawableAction  := [:aRow| nil ].
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   476
    fgSelector      := description foregroundSelector.
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   477
    bgSelector      := description backgroundSelector.
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   478
    backgroundColor := description backgroundColor.
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   479
    foregroundColor := description foregroundColor.
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   480
    buttonExtent    := 0 @ 0.
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   481
    labelExtent     := 0 @ 0.
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   482
    columnAlignment := #left.
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   483
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   484
    backgroundColor notNil ifTrue:[
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   485
        backgroundColor := backgroundColor on:dataSet device
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   486
    ].
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   487
    foregroundColor notNil ifTrue:[
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   488
        foregroundColor := foregroundColor on:dataSet device
584
1426fe34f4e8 support of foreground and background colors
ca
parents: 568
diff changeset
   489
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   490
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   491
    oldFont := nil.
891
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   492
    label   := self resolveLabelWithBuilder:(dataSet builder).
824
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   493
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   494
    (label respondsTo:#string) ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   495
        "/
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   496
        "/ must set the font to accumulate the real extent of a string label
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   497
        "/
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   498
        (label isString and:[label isEmpty]) ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   499
            label := nil
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   500
        ] ifFalse:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   501
            (newFont := description labelFont) notNil ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   502
                oldFont := dataSet font.
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   503
                dataSet font:newFont.
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   504
            ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   505
        ]
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   506
    ].
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   507
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   508
    label notNil ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   509
        labelExtent := Point x:(label widthOn:dataSet) y:(label heightOn:dataSet).
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   510
    ].
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   511
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   512
    oldFont notNil ifTrue:[
d2e60c8ac775 support of Drag & Drop
ca
parents: 807
diff changeset
   513
        dataSet font:oldFont
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   514
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   515
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   516
    rendererType == #CheckToggle ifTrue:[
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   517
        form := dataSet checkToggleForm.
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   518
        buttonExtent := dataSet checkToggleExtent.
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   519
      ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   520
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   521
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   522
    rendererType == #rowSelector ifTrue:[
891
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   523
        form  := dataSet rowSelectorForm.
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   524
        buttonExtent := dataSet rowSelectorExtent.
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   525
      ^ self
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   526
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   527
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   528
    (rendererType == #ComboBox or:[rendererType == #ComboList]) ifTrue:[
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   529
        form := dataSet comboButtonForm.
807
46863a1cdd80 access method to retrieve the description
ca
parents: 655
diff changeset
   530
        buttonExtent := dataSet comboButtonExtent.
883
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   531
    ] ifFalse:[
0a790ad56286 add column justification
ca
parents: 882
diff changeset
   532
        columnAlignment := description columnAlignment
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   533
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   534
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   535
    selector := description printSelector.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   536
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   537
    selector notNil ifTrue:[
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   538
        drawableAction := [:aRow| aRow perform:selector with:dataSet ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   539
        ^ self
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   540
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   541
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   542
    (     (format := description formatString) notNil
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   543
     and:[(type   := description type) == #number or:[type == #numberOrNil]]
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   544
    ) ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   545
        "/ has a format string for number (supports only floats)
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   546
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   547
        (idx := format indexOf:$.) ~~ 0 ifTrue:[
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   548
            idx := format size - idx
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   549
        ].
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   550
        format := '%0.', idx printString, 'f'.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   551
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   552
        drawableAction := [:aRow||n|
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   553
            n := description row:aRow at:columnNumber.
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   554
            n isReal ifTrue:[n := n asFloat printfPrintString:format].
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   555
            n
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   556
        ]
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   557
    ] ifFalse:[         "/ default: no format string
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   558
        drawableAction := [:aRow| description row:aRow at:columnNumber ]
614
8316c869d4df support of readSelector with arguments
ca
parents: 607
diff changeset
   559
    ]
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   560
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   561
891
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   562
!
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   563
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   564
resolveLabelInBuilder:aBuilder
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   565
    |label appl|
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   566
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   567
    aBuilder isNil ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   568
        ^ description rawLabel        
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   569
    ].
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   570
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   571
    (label := description label) isString ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   572
        description labelIsImage ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   573
            aBuilder isEditing ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   574
                label := nil
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   575
            ] ifFalse:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   576
                label := aBuilder labelFor:(label asSymbol)
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   577
            ].
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   578
            ^ label ? description class defaultIcon
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   579
        ].
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   580
        description translateLabel == true ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   581
            (appl := aBuilder application) notNil ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   582
                ^ (appl resources string:label) ? label
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   583
            ]
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   584
        ]
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   585
    ].
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   586
    ^ label
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   587
!
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   588
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   589
resolveLabelWithBuilder:aBuilder
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   590
    |label appl|
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   591
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   592
    aBuilder isNil ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   593
        ^ description rawLabel        
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   594
    ].
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   595
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   596
    (label := description label) isString ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   597
        description labelIsImage ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   598
            aBuilder isEditing ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   599
                label := nil
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   600
            ] ifFalse:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   601
                label := aBuilder labelFor:(label asSymbol)
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   602
            ].
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   603
            ^ label ? description class defaultIcon
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   604
        ].
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   605
        description translateLabel == true ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   606
            (appl := aBuilder application) notNil ifTrue:[
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   607
                ^ (appl resources string:label) ? label
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   608
            ]
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   609
        ]
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   610
    ].
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   611
    ^ label
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   612
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   613
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   614
!DataSetColumn methodsFor:'private'!
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   615
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   616
drawableAt:aRowNr
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   617
    "get the drawable label at an index
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   618
    "
637
e56ec99923ae VW compatible
ca
parents: 621
diff changeset
   619
    ^ drawableAction value:(dataSet at:aRowNr)
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   620
! !
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   621
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   622
!DataSetColumn methodsFor:'queries'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   623
607
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   624
canSelect:aRowNr
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   625
    "returns true if cell in column is selectable
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   626
    "
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   627
    |s|
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   628
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   629
    description canSelect ifTrue:[
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   630
        ^ ((s := description selectSelector) isNil or:[(dataSet at:aRowNr) perform:s])
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   631
    ].
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   632
    ^ false
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   633
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   634
!
a5e0c2bf1370 support of multiple select:rows
ca
parents: 604
diff changeset
   635
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   636
containsText
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   637
    "returns true if text might exist
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   638
    "
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   639
    ^ (rendererType ~~ #rowSelector and:[rendererType ~~ #CheckToggle])
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   640
!
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   641
833
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   642
hasChoices:aRowNr
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   643
    ^ (description choicesFor:(dataSet at:aRowNr)) notNil
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   644
!
c4e3e579f8bd handle choices
ca
parents: 824
diff changeset
   645
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   646
heightOfHighestRow
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   647
    "returns the height of the highest row in pixels
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   648
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   649
    |hObj hMin end|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   650
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   651
    hMin := dataSet font heightOn:dataSet device.
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   652
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   653
    form notNil ifTrue:[
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   654
        hMin := hMin max:(buttonExtent y)
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   655
    ].
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   656
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   657
    (hObj := description height) == 0 ifTrue:[
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   658
        self containsText ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   659
            "/ search first none empty drawable object
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   660
            end := 10 min:dataSet size.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   661
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   662
            1 to:end do:[:aRowNr| |lbl|
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   663
                lbl := self drawableAt:aRowNr.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   664
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   665
                lbl notNil ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   666
                    (lbl respondsTo:#heightOn:) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   667
                        hObj := lbl heightOn:dataSet
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   668
                    ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   669
                        hObj := lbl displayString heightOn:dataSet
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   670
                    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   671
                    ^ hMin max:hObj
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   672
                ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   673
            ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   674
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   675
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   676
    ^ hMin max:hObj.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   677
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   678
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   679
!DataSetColumn methodsFor:'searching'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   680
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   681
findRowNrStartingWithChar:aChar start:start stop:stop
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   682
    "find the first row starting at start to stop, which drawable label
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   683
     starts with the character, aChar. The index of the detected row is
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   684
     returned or if no row is found 0.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   685
    "
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   686
    |char|
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   687
647
ee98a1976972 support of different styles
ca
parents: 644
diff changeset
   688
    self containsText ifTrue:[
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   689
        char  := aChar asLowercase.
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   690
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   691
        start to:stop do:[:aRowNr| |lbl|
621
620553e6a537 foreground & background selector (cell).
ca
parents: 614
diff changeset
   692
            lbl := self drawableAt:aRowNr.
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   693
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   694
            lbl isString ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   695
                (lbl size ~~ 0 and:[(lbl at:1) asLowercase == char]) ifTrue:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   696
                    ^ aRowNr
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   697
                ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   698
            ] ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   699
                lbl isNil ifFalse:[
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   700
                    ^ 0
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   701
                ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   702
            ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   703
        ]
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   704
    ].
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   705
    ^ 0
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   706
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   707
! !
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   708
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   709
!DataSetColumn class methodsFor:'documentation'!
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   710
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   711
version
891
f4d2ed9d3b88 checkin from browser
ca
parents: 883
diff changeset
   712
    ^ '$Header: /cvs/stx/stx/libwidg2/DataSetColumn.st,v 1.21 1998-05-20 07:38:03 ca Exp $'
542
e22c45e26653 intitial checkin
ca
parents:
diff changeset
   713
! !