TabulatorSpecification.st
author Claus Gittinger <cg@exept.de>
Tue, 04 Jun 1996 22:33:56 +0200
changeset 199 8a0ce1ae9ad8
parent 189 62771f258ef8
child 327 25ced24b63ea
permissions -rw-r--r--
example added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
36
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
     1
"
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
     3
	      All Rights Reserved
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
     4
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
     5
 This software is furnished under a license and may be used
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
     6
 only in accordance with the terms of that license and with the
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
     8
 be provided or otherwise made available to, or used by, any
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
     9
 other person.  No title to or ownership of the software is
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
    10
 hereby transferred.
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
    11
"
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    12
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    13
Object subclass:#TabulatorSpecification
128
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
    14
	instanceVariableNames:'tabUnit unitReference tabPositions tabTypes'
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
    15
	classVariableNames:''
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
    16
	poolDictionaries:''
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
    17
	category:'Views-Support'
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    18
!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
    19
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    20
!TabulatorSpecification class methodsFor:'documentation'!
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    21
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    22
copyright
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    23
"
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    24
 COPYRIGHT (c) 1994 by Claus Gittinger
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    25
	      All Rights Reserved
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    26
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    27
 This software is furnished under a license and may be used
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    28
 only in accordance with the terms of that license and with the
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    30
 be provided or otherwise made available to, or used by, any
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    31
 other person.  No title to or ownership of the software is
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    32
 hereby transferred.
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    33
"
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    34
!
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    35
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    36
documentation
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    37
"
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    38
    This is a helper class for table widgets and tabular data in
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    39
    lists.
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    40
    A tabulatorSpecification keeps track of where the tabs are,
36
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
    41
    and how they align. They are to be used in conjunction with
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
    42
    MultiColumnListEntry or the upcoming TableWidget.
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
    43
    However, they may also be useful to represent tabs in a
160b8f0dfd7d *** empty log message ***
claus
parents: 28
diff changeset
    44
    paragraph of text.
158
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
    45
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
    46
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
    47
    [author:]
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
    48
        Claus Gittinger
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
    49
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
    50
    [see also:]
199
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
    51
        Ruler TabSpecRuler
158
431e38dfc5ab documentation
Claus Gittinger <cg@exept.de>
parents: 128
diff changeset
    52
        ListView
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    53
"
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    54
!
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    55
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    56
examples 
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
    57
"
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    58
    Example use (in a ListView):
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    59
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    60
        |listView tabSpec entry|
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    61
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    62
        listView := ListView new.
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    63
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    64
        tabSpec := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    65
        tabSpec unit:#inch.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    66
        tabSpec positions:#(0     1     2.5    3.5    4       5        ).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    67
        tabSpec align:    #(#left #left #right #right #center #decimal ).
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    68
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    69
        entry := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    70
        entry tabulatorSpecification:tabSpec.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    71
        entry colAt:1 put:'left';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    72
              colAt:2 put:'left';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    73
              colAt:3 put:'right';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    74
              colAt:4 put:'right';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    75
              colAt:5 put:'center';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    76
              colAt:6 put:'.decimal'.
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    77
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    78
        listView at:1 put:entry.
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    79
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    80
        entry := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    81
        entry tabulatorSpecification:tabSpec.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    82
        entry colAt:1 put:'col1';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    83
              colAt:2 put:'col2';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    84
              colAt:3 put:'col3';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    85
              colAt:4 put:'col4';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    86
              colAt:5 put:'col5';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    87
              colAt:6 put:'col6.decimal'.
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    88
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    89
        listView at:2 put:entry.
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    90
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    91
        entry := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    92
        entry tabulatorSpecification:tabSpec.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    93
        entry colAt:1 put:'foo';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    94
              colAt:2 put:'fooBar';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    95
              colAt:3 put:'bar';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    96
              colAt:4 put:'barFoo';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    97
              colAt:5 put:'baz';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
    98
              colAt:6 put:'1234.56'.
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
    99
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   100
        listView at:3 put:entry.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   101
        listView open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   102
                                                                        [exEnd]
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   103
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   104
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   105
    defining field positions in millimeter :
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   106
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   107
        |listView tabSpec entry|
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   108
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   109
        listView := ListView new.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   110
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   111
        tabSpec := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   112
        tabSpec unit:#mm.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   113
        tabSpec positions:#(0 10 20 40).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   114
        tabSpec align:    #left.          
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   115
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   116
        entry := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   117
        entry tabulatorSpecification:tabSpec.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   118
        entry colAt:1 put:'1';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   119
              colAt:2 put:'2';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   120
              colAt:3 put:'3';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   121
              colAt:4 put:'4'.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   122
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   123
        listView at:1 put:entry.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   124
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   125
        entry := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   126
        entry tabulatorSpecification:tabSpec.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   127
        entry colAt:1 put:'aa';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   128
              colAt:2 put:'bb';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   129
              colAt:3 put:'cc';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   130
              colAt:4 put:'dd'.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   131
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   132
        listView at:2 put:entry.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   133
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   134
        listView open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   135
                                                                        [exEnd]
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   136
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   137
    defining field widths in millimeter :
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   138
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   139
        |listView tabSpec entry|
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   140
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   141
        listView := ListView new.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   142
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   143
        tabSpec := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   144
        tabSpec unit:#mm.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   145
        tabSpec widths:#(10 10 20 10).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   146
        tabSpec align:    #left.        
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   147
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   148
        entry := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   149
        entry tabulatorSpecification:tabSpec.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   150
        entry colAt:1 put:'1';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   151
              colAt:2 put:'2';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   152
              colAt:3 put:'3';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   153
              colAt:4 put:'4'.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   154
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   155
        listView at:1 put:entry.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   156
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   157
        entry := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   158
        entry tabulatorSpecification:tabSpec.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   159
        entry colAt:1 put:'aa';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   160
              colAt:2 put:'bb';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   161
              colAt:3 put:'cc';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   162
              colAt:4 put:'dd'.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   163
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   164
        listView at:2 put:entry.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   165
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   166
        listView open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   167
                                                                        [exEnd]
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   168
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   169
    defining field widths in pixels :
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   170
                                                                        [exBegin]
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   171
        |listView tabSpec entry|
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   172
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   173
        listView := ListView new.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   174
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   175
        tabSpec := TabulatorSpecification new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   176
        tabSpec unit:#pixel.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   177
        tabSpec widths:#(50 30 30 50).
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   178
        tabSpec align:    #left.        
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   179
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   180
        entry := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   181
        entry tabulatorSpecification:tabSpec.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   182
        entry colAt:1 put:'1';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   183
              colAt:2 put:'2';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   184
              colAt:3 put:'3';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   185
              colAt:4 put:'4'.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   186
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   187
        listView at:1 put:entry.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   188
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   189
        entry := MultiColListEntry new.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   190
        entry tabulatorSpecification:tabSpec.
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   191
        entry colAt:1 put:'aa';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   192
              colAt:2 put:'bb';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   193
              colAt:3 put:'cc';
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   194
              colAt:4 put:'dd'.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   195
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   196
        listView at:2 put:entry.
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   197
161
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   198
        listView open
5b6e284959a4 examples
Claus Gittinger <cg@exept.de>
parents: 158
diff changeset
   199
                                                                        [exEnd]
199
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   200
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   201
  same as first example, but adding a TabSpecRuler to show where
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   202
  the tabs are:
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   203
                                                                        [exBegin]
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   204
        |top ruler listView tabSpec entry|
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   205
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   206
        top := StandardSystemView extent:300@300.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   207
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   208
        ruler := TabSpecRuler origin:0.0@0.0 corner:1.0@20 in:top.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   209
        ruler level:0.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   210
        listView := ListView in:top.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   211
        listView origin:0.0@0.0 corner:1.0@1.0.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   212
        listView topInset:20.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   213
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   214
        tabSpec := TabulatorSpecification new.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   215
        tabSpec unit:#inch.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   216
        tabSpec positions:#(0     1     2.5    3.5    4       5        ).
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   217
        tabSpec align:    #(#left #left #right #right #center #decimal ).
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   218
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   219
        ruler tabulatorSpecification:tabSpec.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   220
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   221
        entry := MultiColListEntry new.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   222
        entry tabulatorSpecification:tabSpec.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   223
        entry colAt:1 put:'left';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   224
              colAt:2 put:'left';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   225
              colAt:3 put:'right';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   226
              colAt:4 put:'right';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   227
              colAt:5 put:'center';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   228
              colAt:6 put:'.decimal'.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   229
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   230
        listView at:1 put:entry.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   231
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   232
        entry := MultiColListEntry new.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   233
        entry tabulatorSpecification:tabSpec.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   234
        entry colAt:1 put:'col1';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   235
              colAt:2 put:'col2';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   236
              colAt:3 put:'col3';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   237
              colAt:4 put:'col4';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   238
              colAt:5 put:'col5';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   239
              colAt:6 put:'col6.decimal'.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   240
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   241
        listView at:2 put:entry.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   242
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   243
        entry := MultiColListEntry new.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   244
        entry tabulatorSpecification:tabSpec.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   245
        entry colAt:1 put:'foo';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   246
              colAt:2 put:'fooBar';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   247
              colAt:3 put:'bar';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   248
              colAt:4 put:'barFoo';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   249
              colAt:5 put:'baz';
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   250
              colAt:6 put:'1234.56'.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   251
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   252
        listView at:3 put:entry.
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   253
        top open
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   254
                                                                        [exEnd]
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   255
"
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   256
! !
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   257
70
claus
parents: 36
diff changeset
   258
!TabulatorSpecification class methodsFor:'instance creation'!
claus
parents: 36
diff changeset
   259
claus
parents: 36
diff changeset
   260
unit:unit positions:positions
claus
parents: 36
diff changeset
   261
    ^ (self new) unit:unit; positions:positions
claus
parents: 36
diff changeset
   262
claus
parents: 36
diff changeset
   263
    "
claus
parents: 36
diff changeset
   264
     TabulatorSpecification unit:#inch positions:#(0 3)
claus
parents: 36
diff changeset
   265
    "
claus
parents: 36
diff changeset
   266
claus
parents: 36
diff changeset
   267
    "Modified: 30.8.1995 / 16:37:50 / claus"
claus
parents: 36
diff changeset
   268
! !
claus
parents: 36
diff changeset
   269
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   270
!TabulatorSpecification methodsFor:'accessing'!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   271
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   272
align
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   273
    "return the align-vector"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   274
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   275
    ^ tabTypes
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   276
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   277
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   278
align:types
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   279
    "
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   280
     an array of tab-types; each one is
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   281
	#left
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   282
	#right
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   283
	#center
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   284
	#decimal
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   285
     or a symbol which gives align of all tabs
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   286
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   287
    "
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   288
    tabTypes := types
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   289
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   290
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   291
positions
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   292
    "return the position-vector"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   293
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   294
    ^ tabPositions
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   295
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   296
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   297
positions:tabs
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   298
    "set the position-vector"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   299
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   300
    tabPositions := tabs
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   301
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   302
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   303
size
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   304
    "return the number of tabs in this spec"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   305
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   306
    ^ tabPositions size
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   307
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   308
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   309
unit
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   310
    "return the unit"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   311
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   312
    ^ tabUnit
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   313
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   314
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   315
unit:aSymbol
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   316
    "set the unit.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   317
     allowed are: #inch, #mm, #cm, #pixel and #col"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   318
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   319
    tabUnit := aSymbol
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   320
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   321
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   322
unitRelativeTo:someObject
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   323
    "set for a relative unit. someObject should return its width
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   324
     and the tabs are set fraction-relative to this number (in pixel)."
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   325
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   326
    tabUnit := #relative.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   327
    unitReference := someObject
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   328
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   329
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   330
widths
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   331
    "return a width-vector"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   332
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   333
    |prev|
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   334
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   335
    prev := 0.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   336
    ^ tabPositions collect:[:p | |w| w := p - prev. prev := p. w].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   337
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   338
    "
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   339
     |spec|
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   340
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   341
     spec := TabulatorSpecification new.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   342
     spec unit:#inch.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   343
     spec positions:#(0     1     2.5    3.5    4       5        ).
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   344
     spec align:    #(#left #left #right #right #center #decimal ).
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   345
     spec widths
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   346
    "
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   347
!
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   348
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   349
widths:fieldWidths
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   350
    "set the position-vector from a vector of field widths"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   351
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   352
    |pos|
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   353
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   354
    pos := 0.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   355
    tabPositions := fieldWidths collect:[:w | 
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   356
					    |p|
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   357
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   358
					    p := pos.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   359
					    pos := pos + w.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   360
					    p].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   361
! !
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   362
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   363
!TabulatorSpecification methodsFor:'queries'!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   364
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   365
pixelsPerUnitOn:aGC
128
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   366
    |device mm|
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   367
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   368
    "
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   369
     return the number of device pixels one unit of my tabs
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   370
     takes on aGC
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   371
    "
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   372
    tabUnit isNil ifTrue:[
128
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   373
        tabUnit := #col
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   374
    ].
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   375
    tabUnit == #relative ifTrue:[
128
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   376
        ^ unitReference width
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   377
    ].
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   378
    tabUnit == #col ifTrue:[
128
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   379
        ^ aGC font width
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   380
    ].
189
62771f258ef8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   381
    device := aGC graphicsDevice.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   382
    tabUnit == #inch ifTrue:[
128
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   383
        ^ device horizontalPixelPerInch
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   384
    ].
128
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   385
    mm := device horizontalPixelPerMillimeter.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   386
    tabUnit == #mm ifTrue:[
128
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   387
        ^ mm
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   388
    ].
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   389
    tabUnit == #cm ifTrue:[
128
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   390
        ^ mm * 10
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   391
    ].
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   392
    "
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   393
     assume pixels
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   394
    "
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   395
    ^ 1.
128
cd2b82b1c222 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 98
diff changeset
   396
189
62771f258ef8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 161
diff changeset
   397
    "Modified: 28.5.1996 / 20:25:34 / cg"
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   398
!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   399
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   400
positionOfTab:index forString:aString on:aGC
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   401
    "return the position (in device units) of the string to be drawn
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   402
     at position index."
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   403
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   404
    |pos type idx left|
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   405
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   406
    pos := self positionOfTab:index on:aGC.
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   407
    pos isNil ifTrue:[^ nil].
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   408
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   409
    type := self typeOfTab:index.
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   410
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   411
    type == #right ifTrue:[
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   412
	^ pos - (aGC font widthOf:aString).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   413
    ].
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   414
    type == #center ifTrue:[
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   415
	^ pos - ((aGC font widthOf:aString) // 2).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   416
    ].
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   417
    type == #decimal ifTrue:[
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   418
	idx := aString indexOf:$..
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   419
	idx == 0 ifTrue:[
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   420
	     ^ pos - (aGC font widthOf:aString).
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   421
	].
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   422
	left := aString copyTo:(idx-1).
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   423
	^ pos - (aGC font widthOf:left).
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   424
    ].
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   425
    "default is left"
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   426
    ^ pos
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   427
!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   428
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   429
positionOfTab:index on:aGC
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   430
    "return the position (in device units) of the tab at index"
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   431
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   432
    |unit pos|
25
e07adf47d209 *** empty log message ***
claus
parents: 19
diff changeset
   433
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   434
    tabPositions isNil ifTrue:[^ nil].
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   435
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   436
    unit := self pixelsPerUnitOn:aGC.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   437
    pos := ((tabPositions at:index) * unit).
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   438
    ^ pos
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   439
!
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   440
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   441
typeOfTab:index
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   442
    "return the type of the tab at position index."
28
ca403f4c5b86 *** empty log message ***
claus
parents: 25
diff changeset
   443
97
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   444
    tabPositions isNil ifTrue:[^ #left].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   445
    tabTypes notNil ifTrue:[
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   446
	(tabTypes isMemberOf:Symbol) ifTrue:[
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   447
	    ^ tabTypes
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   448
	].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   449
	^ tabTypes at:index.
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   450
    ].
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   451
    "default is left"
306cb0aa67be checkin from browser
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   452
    ^ #left
19
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   453
! !
79ab6bc98651 Initial revision
claus
parents:
diff changeset
   454
98
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   455
!TabulatorSpecification class methodsFor:'documentation'!
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   456
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   457
version
199
8a0ce1ae9ad8 example added
Claus Gittinger <cg@exept.de>
parents: 189
diff changeset
   458
    ^ '$Header: /cvs/stx/stx/libwidg2/TabulatorSpecification.st,v 1.13 1996-06-04 20:33:56 cg Exp $'
98
de14b996ee80 version at the end
Claus Gittinger <cg@exept.de>
parents: 97
diff changeset
   459
! !