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