TabSpecRuler.st
author Claus Gittinger <cg@exept.de>
Tue, 21 Oct 1997 20:33:10 +0200
changeset 566 11ca5c6ba3d8
parent 365 4228b1451bc9
child 1120 6f4f09f9ad43
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
38
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
     1
"
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
     3
	      All Rights Reserved
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
     4
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
     5
 This software is furnished under a license and may be used
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
     6
 only in accordance with the terms of that license and with the
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
     8
 be provided or otherwise made available to, or used by, any
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
     9
 other person.  No title to or ownership of the software is
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    10
 hereby transferred.
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    11
"
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    12
566
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    13
'From Smalltalk/X, Version:3.2.1 on 20-oct-1997 at 3:15:06 pm'                  !
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
    14
49
claus
parents: 40
diff changeset
    15
SimpleView subclass:#TabSpecRuler
342
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    16
	instanceVariableNames:'tabSpec titles handleStyle handleCursor movedTabIndex movedTabX
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    17
		synchronousOperation handleWidth fixedTabs tabsAreVariable
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    18
		hiddenTabs'
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    19
	classVariableNames:'DefaultHandleStyle'
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    20
	poolDictionaries:''
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    21
	category:'Views-Misc'
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    22
!
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    23
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    24
!TabSpecRuler class methodsFor:'documentation'!
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    25
38
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    26
copyright
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    27
"
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    28
 COPYRIGHT (c) 1994 by Claus Gittinger
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    29
	      All Rights Reserved
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    30
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    31
 This software is furnished under a license and may be used
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    32
 only in accordance with the terms of that license and with the
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    33
 inclusion of the above copyright notice.   This software may not
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    34
 be provided or otherwise made available to, or used by, any
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    35
 other person.  No title to or ownership of the software is
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    36
 hereby transferred.
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    37
"
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    38
!
858ec30d05fe *** empty log message ***
claus
parents: 36
diff changeset
    39
36
160b8f0dfd7d *** empty log message ***
claus
parents: 29
diff changeset
    40
documentation
160b8f0dfd7d *** empty log message ***
claus
parents: 29
diff changeset
    41
"
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    42
    It shows the tabulator positions of a TabulatorSpecification
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    43
    and allows its tab positions to be manipulated.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    44
    (as shown in a FileBrowser, when the longList is enabled).
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    45
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    46
    [author]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    47
        Claus Gittinger
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    48
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    49
    [see also:]
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    50
        TabulatorSpecification
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    51
        Ruler
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    52
        ListView
36
160b8f0dfd7d *** empty log message ***
claus
parents: 29
diff changeset
    53
"
160b8f0dfd7d *** empty log message ***
claus
parents: 29
diff changeset
    54
!
160b8f0dfd7d *** empty log message ***
claus
parents: 29
diff changeset
    55
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    56
examples
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    57
"
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    58
                                                                [exBegin]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    59
    |top head spec|
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    60
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    61
    top := View new.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    62
    top extent:300@100.
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    63
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    64
    head := TabSpecRuler in:top.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    65
    head width:1.0.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    66
    head level:1.
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    67
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    68
    spec := TabulatorSpecification new.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    69
    spec unit:#inch.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    70
    spec positions:#(0     1     2.5    3.5    4       5        ).
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    71
    spec align:    #(#left #left #right #right #center #decimal ).
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    72
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    73
    head tabulatorSpecification:spec.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    74
    top open.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    75
                                                                [exEnd]
342
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    76
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    77
                                                                [exBegin]
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    78
    |top head spec|
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    79
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    80
    top := View new.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    81
    top extent:300@100.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    82
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    83
    head := TabSpecRuler in:top.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    84
    head width:1.0.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    85
    head level:1.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    86
    head titles:#('col1' 'col2' 'col3' 'col4' 'col5' 'col6').
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    87
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    88
    spec := TabulatorSpecification new.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    89
    spec unit:#inch.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    90
    spec positions:#(0     1     2.5    3.5    4       5        ).
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    91
    spec align:    #(#left #left #right #right #center #decimal ).
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    92
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    93
    head tabulatorSpecification:spec.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    94
    top open.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
    95
                                                                [exEnd]
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    96
"
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    97
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    98
! !
b1663ac8f532 Initial revision
claus
parents:
diff changeset
    99
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   100
!TabSpecRuler class methodsFor:'defaults'!
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   101
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   102
updateStyleCache
566
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   103
    <resource: #style (#'tabRuler.handleStyle')>
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   104
566
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   105
    DefaultHandleStyle := StyleSheet at:'tabRuler.handleStyle'.
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   106
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   107
    "Modified: 20.10.1997 / 15:14:47 / cg"
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   108
! !
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   109
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   110
!TabSpecRuler methodsFor:'accessing'!
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   111
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   112
fixedTabs
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   113
    "return the collection of tabIndices which are fixed;
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   114
     or nil, if all are variable"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   115
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   116
    ^ fixedTabs
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   117
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   118
    "Created: 28.3.1997 / 15:02:29 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   119
    "Modified: 28.3.1997 / 15:03:05 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   120
!
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   121
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   122
fixedTabs:something
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   123
    "set the collection of tabIndices which are fixed;
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   124
     nil, if all are to be variable"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   125
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   126
    fixedTabs := something.
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   127
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   128
    "Created: 28.3.1997 / 15:02:29 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   129
    "Modified: 28.3.1997 / 15:03:18 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   130
!
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   131
330
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   132
hiddenTabs
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   133
    "return the collection of tabs which are to be hidden
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   134
     (or nil if all are to be shown)"
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   135
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   136
    ^ hiddenTabs
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   137
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   138
    "Created: 28.3.1997 / 15:35:54 / cg"
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   139
    "Modified: 28.3.1997 / 15:36:18 / cg"
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   140
!
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   141
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   142
hiddenTabs:something
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   143
    "set the collection of tabs which are to be hidden
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   144
     (or nil if all are to be shown)"
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   145
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   146
    hiddenTabs := something.
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   147
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   148
    "Created: 28.3.1997 / 15:35:54 / cg"
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   149
    "Modified: 28.3.1997 / 15:36:24 / cg"
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   150
!
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   151
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   152
synchronousOperation
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   153
    "return the synchronousOperation mode settings value"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   154
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   155
    ^ synchronousOperation
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   156
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   157
    "Created: 28.3.1997 / 15:01:17 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   158
    "Modified: 28.3.1997 / 15:02:20 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   159
!
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   160
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   161
synchronousOperation:something
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   162
    "set/clear synchronousOperation mode;
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   163
     if on, a move is immediately forwarded to dependents;
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   164
     of off, its forwarded when the mouse button is released."
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   165
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   166
    synchronousOperation := something.
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   167
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   168
    "Modified: 28.3.1997 / 15:02:07 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   169
!
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   170
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   171
tabsAreVariable
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   172
    "return the value of the instance variable 'tabsAreVariable' (automatically generated)"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   173
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   174
    ^ tabsAreVariable
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   175
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   176
    "Created: 28.3.1997 / 15:05:27 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   177
!
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   178
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   179
tabsAreVariable:something
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   180
    "set/clear movability of tabs. If false, tab positions are only
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   181
     displayed - but cannot be moved by the user.
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   182
     The default is true."
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   183
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   184
    tabsAreVariable := something.
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   185
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   186
    "Created: 28.3.1997 / 15:05:27 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   187
    "Modified: 28.3.1997 / 15:06:19 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   188
!
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   189
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   190
tabulatorSpecification:aTabSpec
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   191
    "set my tabulator specification"
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   192
365
4228b1451bc9 redraw when the spec is changed
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
   193
    tabSpec := aTabSpec.
4228b1451bc9 redraw when the spec is changed
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
   194
    shown ifTrue:[
4228b1451bc9 redraw when the spec is changed
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
   195
        self invalidate
4228b1451bc9 redraw when the spec is changed
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
   196
    ]
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   197
365
4228b1451bc9 redraw when the spec is changed
Claus Gittinger <cg@exept.de>
parents: 342
diff changeset
   198
    "Modified: 18.4.1997 / 18:16:07 / cg"
342
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   199
!
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   200
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   201
titles:aCollectionOfStrings
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   202
    titles := aCollectionOfStrings
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   203
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   204
    "Created: 1.4.1997 / 13:52:37 / cg"
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   205
! !
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   206
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   207
!TabSpecRuler methodsFor:'event handling'!
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   208
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   209
buttonMotion:state x:x y:y
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   210
    "mouse-button was moved while pressed;
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   211
     redraw thumb at its new position and, if scroll-mode is asynchronous, 
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   212
     the scroll action is performed"
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   213
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   214
    |left right limit1 limit2 minSpacing newX|
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   215
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   216
    movedTabIndex notNil ifTrue:[
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   217
        minSpacing := 5.
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   218
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   219
        left := limit1 := 0.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   220
        movedTabIndex > 1 ifTrue:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   221
            left := self positionOfTabAtIndex:(movedTabIndex-1).
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   222
            limit1 := left + minSpacing.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   223
        ].
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   224
        right := limit2 := width.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   225
        movedTabIndex < tabSpec size ifTrue:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   226
            right := self positionOfTabAtIndex:(movedTabIndex+1).
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   227
            limit2 := right - minSpacing.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   228
        ].
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   229
        newX := (x max:limit1) min:limit2.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   230
        x ~= newX ifTrue:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   231
            self cursor:Cursor stop.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   232
        ] ifFalse:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   233
            self cursor:handleCursor
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   234
        ].
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   235
        newX ~= movedTabX ifTrue:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   236
            movedTabX := newX.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   237
            self clearRectangleX:left+handleWidth y:0 
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   238
                           width:(right-left-handleWidth-handleWidth) height:height.
342
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   239
            movedTabIndex ~~ 1 ifTrue:[
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   240
                self redrawTitleAtIndex:(movedTabIndex - 1).
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   241
            ].
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   242
            self redrawTabAtIndex:movedTabIndex.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   243
            synchronousOperation == true ifTrue:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   244
                self moveTabAtIndex:movedTabIndex toX:movedTabX
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   245
            ]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   246
        ]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   247
    ] ifFalse:[
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   248
        (self canMoveTabAtX:x) ifTrue:[
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   249
            self cursor:handleCursor
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   250
        ] ifFalse:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   251
            self cursor:(Cursor normal)
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   252
        ]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   253
    ]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   254
342
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   255
    "Modified: 1.4.1997 / 15:21:16 / cg"
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   256
!
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   257
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   258
buttonPress:button x:x y:y
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   259
    "mouse-button was pressed;
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   260
     start moving the tab"
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   261
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   262
    movedTabIndex := nil.
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   263
    (self canMoveTabAtX:x) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   264
        movedTabIndex := self indexOfTabAtX:x.
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   265
        self cursor:handleCursor.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   266
    ]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   267
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   268
    "Modified: 28.3.1997 / 15:13:15 / cg"
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   269
!
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   270
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   271
buttonRelease:button x:x y:y
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   272
    "mouse-button was pressed;
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   273
     start moving the tab"
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   274
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   275
    |idx|
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   276
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   277
    idx := movedTabIndex.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   278
    movedTabIndex := nil.
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   279
    idx notNil ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   280
        synchronousOperation == true ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   281
            self moveTabAtIndex:idx toX:movedTabX
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   282
        ]
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   283
    ]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   284
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   285
    "Modified: 28.3.1997 / 15:10:23 / cg"
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   286
!
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   287
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   288
pointerLeave:state
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   289
    "mouse left view - restore cursor."
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   290
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   291
    self cursor:(Cursor normal).
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   292
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   293
    "Created: 28.3.1997 / 13:37:52 / cg"
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   294
! !
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   295
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   296
!TabSpecRuler methodsFor:'initialization'!
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   297
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   298
initStyle
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   299
    super initStyle.
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   300
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   301
    handleStyle := DefaultHandleStyle.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   302
    handleCursor := (VariablePanel cursorForOrientation:#horizontal) onDevice:device.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   303
    self is3D ifTrue:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   304
        handleWidth := 2.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   305
    ] ifFalse:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   306
        handleWidth := 1
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   307
    ]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   308
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   309
    "Modified: 28.3.1997 / 14:35:23 / cg"
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   310
!
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   311
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   312
initialize
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   313
    super initialize.
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   314
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   315
    tabsAreVariable := true.
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   316
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   317
    self enableMotionEvents.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   318
    self enableEnterLeaveEvents.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   319
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   320
    self height:(font height + (2 * font descent)). 
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   321
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   322
    "
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   323
     TabSpecRuler new open
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   324
    "
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   325
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   326
    "Modified: 28.3.1997 / 15:06:29 / cg"
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   327
! !
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   328
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   329
!TabSpecRuler methodsFor:'private'!
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   330
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   331
canMoveTabAtX:x
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   332
    |idx|
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   333
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   334
    tabsAreVariable ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   335
        (idx := self indexOfTabAtX:x) ~~ 0 ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   336
            (fixedTabs notNil and:[fixedTabs includes:idx]) ifFalse:[
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   337
                ^ true
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   338
            ]
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   339
        ]
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   340
    ].
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   341
    ^ false
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   342
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   343
    "Created: 28.3.1997 / 15:12:05 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   344
    "Modified: 28.3.1997 / 15:19:01 / cg"
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   345
!
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   346
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   347
indexOfTabAtX:x
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   348
    |xTab minDelta bestIndex|
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   349
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   350
    tabSpec isNil ifTrue:[^ 0].
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   351
    bestIndex := 0.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   352
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   353
    1 to:tabSpec size do:[:i |
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   354
        xTab := tabSpec positionOfTab:i on:self.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   355
        (x between:(xTab-5) and:(xTab+5)) ifTrue:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   356
            (minDelta isNil 
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   357
            or:[(x - xTab) abs < minDelta]) ifTrue:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   358
                minDelta := (x - xTab) abs.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   359
                bestIndex := i.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   360
            ]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   361
        ]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   362
    ].
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   363
    ^ bestIndex
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   364
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   365
    "Modified: 28.3.1997 / 13:43:47 / cg"
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   366
    "Created: 28.3.1997 / 15:12:09 / cg"
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   367
!
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   368
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   369
moveTabAtIndex:idx toX:movedTabX
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   370
    |unitPosition|
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   371
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   372
    unitPosition := (tabSpec unitsPerPixelOn:self) * movedTabX.
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   373
    tabSpec moveTabAtIndex:idx to:unitPosition.
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   374
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   375
    "Modified: 28.3.1997 / 14:54:58 / cg"
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   376
! !
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   377
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   378
!TabSpecRuler methodsFor:'redrawing'!
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   379
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   380
drawHandleAtX:x type:handleType
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   381
    "redraw a tabulator handle"
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   382
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   383
    self paint:Black.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   384
    self displayLineFromX:x y:0 toX:x y:height - 1.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   385
    self is3D ifTrue:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   386
        self paint:White.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   387
        self displayLineFromX:x+1 y:0 toX:x+1 y:height - 1
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   388
    ]
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   389
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   390
    "Modified: 28.3.1997 / 14:35:48 / cg"
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   391
!
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   392
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   393
positionOfTabAtIndex:idx
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   394
    ^ ( tabSpec positionOfTab:idx on:self ) rounded.
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   395
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   396
    "Created: 28.3.1997 / 14:26:28 / cg"
328
Claus Gittinger <cg@exept.de>
parents: 326
diff changeset
   397
    "Modified: 28.3.1997 / 15:14:03 / cg"
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   398
!
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   399
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   400
redraw
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   401
    "redraw the handles from by tabSpec"
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   402
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   403
    tabSpec isNil ifTrue:[^ self].
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   404
    shown ifFalse:[^ self].
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   405
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   406
    1 to:tabSpec size do:[:idx |
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   407
        self redrawTabAtIndex:idx.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   408
    ]
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   409
342
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   410
    "Modified: 1.4.1997 / 15:13:16 / cg"
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   411
!
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   412
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   413
redrawTabAtIndex:idx
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   414
    "redraw a single handle"
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   415
342
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   416
    |x s|
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   417
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   418
    tabSpec isNil ifTrue:[^ self].
342
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   419
    idx == movedTabIndex ifTrue:[
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   420
        x := movedTabX
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   421
    ] ifFalse:[
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   422
        x := self positionOfTabAtIndex:idx.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   423
    ].
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   424
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   425
    (hiddenTabs notNil and:[hiddenTabs includes:idx]) ifFalse:[
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   426
        self drawHandleAtX:x type:(tabSpec typeOfTab:idx).
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   427
    ].
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   428
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   429
    titles notNil ifTrue:[
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   430
        s := titles at:idx.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   431
        self paint:Color black.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   432
        s displayOn:self x:x+3 y:(font ascent).
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   433
    ].
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   434
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   435
    "Created: 28.3.1997 / 13:57:54 / cg"
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   436
    "Modified: 1.4.1997 / 15:29:19 / cg"
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   437
!
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   438
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   439
redrawTitleAtIndex:idx
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   440
    "redraw a single handle"
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   441
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   442
    |x s|
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   443
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   444
    tabSpec isNil ifTrue:[^ self].
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   445
    titles isNil ifTrue:[^ self].
330
e216c5a56f88 hiding tabs
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
   446
326
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   447
    idx == movedTabIndex ifTrue:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   448
        x := movedTabX
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   449
    ] ifFalse:[
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   450
        x := self positionOfTabAtIndex:idx.
7abb145cb6f4 moving - not yet finished
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   451
    ].
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   452
342
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   453
    s := titles at:idx.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   454
    self paint:Color black.
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   455
    s displayOn:self x:x+3 y:(font ascent).
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   456
9e7148fb27c4 prepared to show titles
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
   457
    "Modified: 1.4.1997 / 15:20:31 / cg"
29
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   458
! !
b1663ac8f532 Initial revision
claus
parents:
diff changeset
   459
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   460
!TabSpecRuler class methodsFor:'documentation'!
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   461
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   462
version
566
11ca5c6ba3d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 365
diff changeset
   463
    ^ '$Header: /cvs/stx/stx/libwidg2/TabSpecRuler.st,v 1.13 1997-10-21 18:33:10 cg Exp $'
200
e1ba0782f37c comments
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
   464
! !