Slider.st
author claus
Wed, 30 Aug 1995 20:06:56 +0200
changeset 71 9f9243f5813b
parent 62 378b60ba1200
child 86 4d7dbb5f1719
permissions -rw-r--r--
.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
     1
"
4
claus
parents: 2
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
24
6704fad5eb7d *** empty log message ***
claus
parents: 11
diff changeset
     3
	      All Rights Reserved
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
     4
0fd7841626f6 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
0fd7841626f6 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
0fd7841626f6 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
0fd7841626f6 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
0fd7841626f6 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
0fd7841626f6 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
0fd7841626f6 Initial revision
claus
parents:
diff changeset
    11
"
0fd7841626f6 Initial revision
claus
parents:
diff changeset
    12
49
claus
parents: 48
diff changeset
    13
'From Smalltalk/X, Version:2.10.5 on 30-apr-1995 at 1:46:33 am'!
claus
parents: 48
diff changeset
    14
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
    15
Scroller subclass:#Slider
49
claus
parents: 48
diff changeset
    16
	 instanceVariableNames:'sliderHeight'
claus
parents: 48
diff changeset
    17
	 classVariableNames:''
claus
parents: 48
diff changeset
    18
	 poolDictionaries:''
claus
parents: 48
diff changeset
    19
	 category:'Views-Interactors'
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
    20
!
0fd7841626f6 Initial revision
claus
parents:
diff changeset
    21
11
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    22
!Slider class methodsFor:'documentation'!
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    23
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    24
copyright
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    25
"
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    26
 COPYRIGHT (c) 1992 by Claus Gittinger
24
6704fad5eb7d *** empty log message ***
claus
parents: 11
diff changeset
    27
	      All Rights Reserved
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
    28
11
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    29
 This software is furnished under a license and may be used
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    30
 only in accordance with the terms of that license and with the
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    32
 be provided or otherwise made available to, or used by, any
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    33
 other person.  No title to or ownership of the software is
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    34
 hereby transferred.
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    35
"
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    36
!
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
    37
11
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    38
version
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    39
"
71
claus
parents: 62
diff changeset
    40
$Header: /cvs/stx/stx/libwidg2/Slider.st,v 1.11 1995-08-30 18:06:44 claus Exp $
11
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    41
"
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    42
!
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
    43
11
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    44
documentation
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    45
"
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    46
    this class implements sliders - which are simply scrollers
49
claus
parents: 48
diff changeset
    47
    with a constant thumbHeight. For details on actionBlocks and
claus
parents: 48
diff changeset
    48
    MVC operation, see the documentation in Scroller.
11
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
    49
"
48
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    50
!
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    51
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    52
examples
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    53
"
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    54
    a slider with action block (ST/X style):
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    55
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    56
	|top s|
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    57
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    58
	top := StandardSystemView new extent:200@200.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    59
	s := Slider in:top.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    60
	s origin:(0.0@0.0) corner:(20@1.0).
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    61
	s scrollAction:[:percent | Transcript show:'moved to: '; showCr:percent asFloat].
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    62
	top open
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    63
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    64
49
claus
parents: 48
diff changeset
    65
    same, horizontal:
claus
parents: 48
diff changeset
    66
claus
parents: 48
diff changeset
    67
	|top s|
claus
parents: 48
diff changeset
    68
claus
parents: 48
diff changeset
    69
	top := StandardSystemView new extent:200@200.
claus
parents: 48
diff changeset
    70
	s := HorizontalSlider in:top.
claus
parents: 48
diff changeset
    71
	s origin:(0.0@0.0) corner:(1.0@20).
claus
parents: 48
diff changeset
    72
	s scrollAction:[:percent | Transcript show:'moved to: '; showCr:percent asFloat].
claus
parents: 48
diff changeset
    73
	top open
claus
parents: 48
diff changeset
    74
claus
parents: 48
diff changeset
    75
claus
parents: 48
diff changeset
    76
    with a range other than the default:
claus
parents: 48
diff changeset
    77
claus
parents: 48
diff changeset
    78
	|top s|
claus
parents: 48
diff changeset
    79
claus
parents: 48
diff changeset
    80
	top := StandardSystemView new extent:200@200.
claus
parents: 48
diff changeset
    81
	s := Slider in:top.
claus
parents: 48
diff changeset
    82
	s origin:(0.0@0.0) corner:(20@1.0).
claus
parents: 48
diff changeset
    83
	s scrollAction:[:percent | Transcript show:'moved to: '; showCr:percent asFloat].
claus
parents: 48
diff changeset
    84
	s start:-50 stop:50.
claus
parents: 48
diff changeset
    85
	top open
claus
parents: 48
diff changeset
    86
claus
parents: 48
diff changeset
    87
48
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    88
    using a model (ST-80 style):
49
claus
parents: 48
diff changeset
    89
    (see the changing value in the inspector)
48
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    90
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    91
	|top s m|
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    92
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    93
	m := 0 asValue.
49
claus
parents: 48
diff changeset
    94
	m inspect.
48
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    95
	top := StandardSystemView new extent:200@200.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    96
	s := Slider in:top.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    97
	s origin:(0.0@0.0) corner:(20@1.0).
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    98
	s model:m.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
    99
	top open
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   100
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   101
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   102
    reacting to changes from the model:
49
claus
parents: 48
diff changeset
   103
    (look at and/or change value using 'self value:' in the inspector).
48
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   104
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   105
	|top s m|
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   106
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   107
	m := 0 asValue.
49
claus
parents: 48
diff changeset
   108
	m inspect. 
48
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   109
	top := StandardSystemView new extent:200@200.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   110
	s := Slider in:top.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   111
	s origin:(0.0@0.0) corner:(20@1.0).
49
claus
parents: 48
diff changeset
   112
	s model:m.
48
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   113
	top open
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   114
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   115
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   116
    using a different changeSelector:
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   117
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   118
	|top s1 s2 m|
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   119
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   120
	m := Plug new.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   121
	m respondTo:#value1: with:[:v | Transcript show:'scroller 1 moved to: '; showCr:v].
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   122
	m respondTo:#value2: with:[:v | Transcript show:'scroller 2 moved to: '; showCr:v].
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   123
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   124
	top := StandardSystemView new extent:200@200.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   125
	s1 := Slider in:top.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   126
	s1 origin:(0.0@0.0) corner:(20@1.0).
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   127
	s1 thumbHeight:10.  'percent'.     
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   128
	s1 model:m; change:#value1:.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   129
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   130
	s2 := Slider in:top.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   131
	s2 origin:(30@0.0) corner:(50@1.0).
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   132
	s2 thumbHeight:10.  'percent'.     
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   133
	s2 model:m; change:#value2:.
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   134
	top open
62
claus
parents: 49
diff changeset
   135
claus
parents: 49
diff changeset
   136
claus
parents: 49
diff changeset
   137
    another example:
claus
parents: 49
diff changeset
   138
claus
parents: 49
diff changeset
   139
	|top redVal greenVal blueVal 
claus
parents: 49
diff changeset
   140
	 colorVal upd s1 s2 s3 l|
claus
parents: 49
diff changeset
   141
claus
parents: 49
diff changeset
   142
	redVal := 0 asValue.
claus
parents: 49
diff changeset
   143
	greenVal := 0 asValue.
claus
parents: 49
diff changeset
   144
	blueVal := 0 asValue.
claus
parents: 49
diff changeset
   145
claus
parents: 49
diff changeset
   146
	upd := [colorVal value:(Color red:redVal value
claus
parents: 49
diff changeset
   147
				      green:greenVal value
claus
parents: 49
diff changeset
   148
				      blue:blueVal value)].
claus
parents: 49
diff changeset
   149
claus
parents: 49
diff changeset
   150
	colorVal := (Color red:0 green:0 blue:0) asValue.
claus
parents: 49
diff changeset
   151
	colorVal onChangeSend:#value to:[l backgroundColor:colorVal value].
claus
parents: 49
diff changeset
   152
claus
parents: 49
diff changeset
   153
	redVal onChangeSend:#value to:upd.
claus
parents: 49
diff changeset
   154
	greenVal onChangeSend:#value to:upd.
claus
parents: 49
diff changeset
   155
	blueVal onChangeSend:#value to:upd.
claus
parents: 49
diff changeset
   156
claus
parents: 49
diff changeset
   157
	top := StandardSystemView new extent:200@200.
claus
parents: 49
diff changeset
   158
	top label:'Color mixer'.
claus
parents: 49
diff changeset
   159
claus
parents: 49
diff changeset
   160
	s1 := Slider in:top.
claus
parents: 49
diff changeset
   161
	s1 origin:(0.0@0.0) corner:(20@1.0).
claus
parents: 49
diff changeset
   162
	s1 thumbHeight:10.  'percent'.     
claus
parents: 49
diff changeset
   163
	s1 model:redVal.
claus
parents: 49
diff changeset
   164
claus
parents: 49
diff changeset
   165
	s2 := Slider in:top.
claus
parents: 49
diff changeset
   166
	s2 origin:(30@0.0) corner:(50@1.0).
claus
parents: 49
diff changeset
   167
	s2 thumbHeight:10.  'percent'.     
claus
parents: 49
diff changeset
   168
	s2 model:greenVal.
claus
parents: 49
diff changeset
   169
claus
parents: 49
diff changeset
   170
	s3 := Slider in:top.
claus
parents: 49
diff changeset
   171
	s3 origin:(60@0.0) corner:(80@1.0).
claus
parents: 49
diff changeset
   172
	s3 thumbHeight:10.  'percent'.     
claus
parents: 49
diff changeset
   173
	s3 model:blueVal.
claus
parents: 49
diff changeset
   174
claus
parents: 49
diff changeset
   175
	l := Label in:top.
claus
parents: 49
diff changeset
   176
	l origin:90@0.0 corner:1.0@1.0.
claus
parents: 49
diff changeset
   177
	l backgroundColor:Color black.
claus
parents: 49
diff changeset
   178
claus
parents: 49
diff changeset
   179
	top open
claus
parents: 49
diff changeset
   180
claus
parents: 49
diff changeset
   181
claus
parents: 49
diff changeset
   182
    the same setup, using action blocks:
claus
parents: 49
diff changeset
   183
claus
parents: 49
diff changeset
   184
	|top red green blue
claus
parents: 49
diff changeset
   185
	 colorVal upd s1 s2 s3 labelModel l|
claus
parents: 49
diff changeset
   186
claus
parents: 49
diff changeset
   187
	red := green := blue := 0.
claus
parents: 49
diff changeset
   188
claus
parents: 49
diff changeset
   189
	top := StandardSystemView new extent:200@200.
claus
parents: 49
diff changeset
   190
	top label:'Color mixer'.
claus
parents: 49
diff changeset
   191
claus
parents: 49
diff changeset
   192
	s1 := Slider in:top.
claus
parents: 49
diff changeset
   193
	s1 origin:(0.0@0.0) corner:(20@1.0).
claus
parents: 49
diff changeset
   194
	s1 thumbHeight:10.  'percent'.     
claus
parents: 49
diff changeset
   195
	s1 action:[:percent | red := percent.
claus
parents: 49
diff changeset
   196
			      l backgroundColor:(Color red:red green:green blue:blue)].
claus
parents: 49
diff changeset
   197
claus
parents: 49
diff changeset
   198
	s2 := Slider in:top.
claus
parents: 49
diff changeset
   199
	s2 origin:(30@0.0) corner:(50@1.0).
claus
parents: 49
diff changeset
   200
	s2 thumbHeight:10.  'percent'.     
claus
parents: 49
diff changeset
   201
	s2 action:[:percent | green := percent.
claus
parents: 49
diff changeset
   202
			      l backgroundColor:(Color red:red green:green blue:blue)].
claus
parents: 49
diff changeset
   203
claus
parents: 49
diff changeset
   204
	s3 := Slider in:top.
claus
parents: 49
diff changeset
   205
	s3 origin:(60@0.0) corner:(80@1.0).
claus
parents: 49
diff changeset
   206
	s3 thumbHeight:10.  'percent'.     
claus
parents: 49
diff changeset
   207
	s3 action:[:percent | blue := percent.
claus
parents: 49
diff changeset
   208
			      l backgroundColor:(Color red:red green:green blue:blue)].
claus
parents: 49
diff changeset
   209
claus
parents: 49
diff changeset
   210
	l := Label in:top.
claus
parents: 49
diff changeset
   211
	l origin:90@0.0 corner:1.0@1.0.
claus
parents: 49
diff changeset
   212
	l backgroundColor:Color black.
claus
parents: 49
diff changeset
   213
claus
parents: 49
diff changeset
   214
	top open
48
c844acacf010 *** empty log message ***
claus
parents: 40
diff changeset
   215
"
11
793044d4bc90 *** empty log message ***
claus
parents: 8
diff changeset
   216
! !
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   217
49
claus
parents: 48
diff changeset
   218
!Slider methodsFor:'private'!
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   219
49
claus
parents: 48
diff changeset
   220
percentFromAbs:absValue
claus
parents: 48
diff changeset
   221
    "given a number of pixels, compute percentage"
8
91035a03b4cf *** empty log message ***
claus
parents: 4
diff changeset
   222
49
claus
parents: 48
diff changeset
   223
    |fullSize val|
24
6704fad5eb7d *** empty log message ***
claus
parents: 11
diff changeset
   224
49
claus
parents: 48
diff changeset
   225
    (orientation == #vertical) ifTrue:[
claus
parents: 48
diff changeset
   226
	fullSize := height
claus
parents: 48
diff changeset
   227
    ] ifFalse:[
claus
parents: 48
diff changeset
   228
	fullSize := width
claus
parents: 48
diff changeset
   229
    ].
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   230
49
claus
parents: 48
diff changeset
   231
    val := absValue / (fullSize - sliderHeight - (margin * 2)) * (rangeEnd - rangeStart).
claus
parents: 48
diff changeset
   232
    val := val + rangeStart.
claus
parents: 48
diff changeset
   233
    val < rangeStart ifTrue:[^ rangeStart].
claus
parents: 48
diff changeset
   234
    val > rangeEnd ifTrue:[^ rangeEnd].
claus
parents: 48
diff changeset
   235
    ^ val
claus
parents: 48
diff changeset
   236
!
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   237
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   238
absFromPercent:percent
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   239
    "given a percentage, compute number of pixels"
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   240
49
claus
parents: 48
diff changeset
   241
    |fullSize|
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   242
49
claus
parents: 48
diff changeset
   243
    (orientation == #vertical) ifTrue:[
claus
parents: 48
diff changeset
   244
	fullSize := height
claus
parents: 48
diff changeset
   245
    ] ifFalse:[
claus
parents: 48
diff changeset
   246
	fullSize := width
claus
parents: 48
diff changeset
   247
    ].
claus
parents: 48
diff changeset
   248
    ^ ((percent * (fullSize - sliderHeight - (margin * 2))) / 100) rounded
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   249
!
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   250
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   251
computeThumbFrame
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   252
    "redefined, since the thumb-height stays constant"
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   253
49
claus
parents: 48
diff changeset
   254
    |nh nw ny nx sz m|
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   255
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   256
    thumbHeight := 0.
49
claus
parents: 48
diff changeset
   257
    sz := (self absFromPercent:thumbOrigin) + margin.
claus
parents: 48
diff changeset
   258
    m := margin + inset.
claus
parents: 48
diff changeset
   259
    (orientation == #vertical) ifTrue:[
claus
parents: 48
diff changeset
   260
	ny := sz.
claus
parents: 48
diff changeset
   261
	nh := sliderHeight.
claus
parents: 48
diff changeset
   262
	nx := m.     
claus
parents: 48
diff changeset
   263
	nw := width - (2 * nx).
claus
parents: 48
diff changeset
   264
    ] ifFalse:[
claus
parents: 48
diff changeset
   265
	nx := sz.
claus
parents: 48
diff changeset
   266
	nw := sliderHeight.
claus
parents: 48
diff changeset
   267
	ny := m.     
claus
parents: 48
diff changeset
   268
	nh := height - (2 * ny).
claus
parents: 48
diff changeset
   269
    ].
claus
parents: 48
diff changeset
   270
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   271
    "
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   272
     do not create new Rectangle if its the same anyway
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   273
    "
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   274
    thumbFrame notNil ifTrue:[
24
6704fad5eb7d *** empty log message ***
claus
parents: 11
diff changeset
   275
	(ny == thumbFrame top) ifTrue:[
6704fad5eb7d *** empty log message ***
claus
parents: 11
diff changeset
   276
	  (nx == thumbFrame left) ifTrue:[
6704fad5eb7d *** empty log message ***
claus
parents: 11
diff changeset
   277
	    (nh == thumbFrame height) ifTrue:[
6704fad5eb7d *** empty log message ***
claus
parents: 11
diff changeset
   278
	      (nw == thumbFrame width) ifTrue:[ ^ self]
6704fad5eb7d *** empty log message ***
claus
parents: 11
diff changeset
   279
	    ]
6704fad5eb7d *** empty log message ***
claus
parents: 11
diff changeset
   280
	  ]
6704fad5eb7d *** empty log message ***
claus
parents: 11
diff changeset
   281
	]
0
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   282
    ].
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   283
    thumbFrame := Rectangle left:nx top:ny width:nw height:nh
0fd7841626f6 Initial revision
claus
parents:
diff changeset
   284
! !
49
claus
parents: 48
diff changeset
   285
claus
parents: 48
diff changeset
   286
!Slider methodsFor:'initialization'!
claus
parents: 48
diff changeset
   287
claus
parents: 48
diff changeset
   288
initStyle
claus
parents: 48
diff changeset
   289
    super initStyle.
claus
parents: 48
diff changeset
   290
claus
parents: 48
diff changeset
   291
    tallyMarks := StyleSheet at:'sliderNTallyMarks' default:1.
claus
parents: 48
diff changeset
   292
    tallyLevel := StyleSheet at:'sliderTallyLevel' default:-1.    
claus
parents: 48
diff changeset
   293
!
claus
parents: 48
diff changeset
   294
claus
parents: 48
diff changeset
   295
initialize
claus
parents: 48
diff changeset
   296
    sliderHeight := (self verticalPixelPerMillimeter:10) rounded.
claus
parents: 48
diff changeset
   297
    super initialize.
claus
parents: 48
diff changeset
   298
    thumbHeight := 0.
claus
parents: 48
diff changeset
   299
! !
claus
parents: 48
diff changeset
   300
claus
parents: 48
diff changeset
   301
!Slider methodsFor:'forced scroll'!
claus
parents: 48
diff changeset
   302
claus
parents: 48
diff changeset
   303
pageUp
claus
parents: 48
diff changeset
   304
    "ignored - a slider has no concept of page-wise scrolling"
claus
parents: 48
diff changeset
   305
claus
parents: 48
diff changeset
   306
    ^ self
claus
parents: 48
diff changeset
   307
!
claus
parents: 48
diff changeset
   308
claus
parents: 48
diff changeset
   309
pageDown
claus
parents: 48
diff changeset
   310
    "ignored - a slider has no concept of page-wise scrolling"
claus
parents: 48
diff changeset
   311
claus
parents: 48
diff changeset
   312
    ^ self
claus
parents: 48
diff changeset
   313
! !
claus
parents: 48
diff changeset
   314
claus
parents: 48
diff changeset
   315
!Slider methodsFor:'accessing'!
claus
parents: 48
diff changeset
   316
claus
parents: 48
diff changeset
   317
thumbHeight
claus
parents: 48
diff changeset
   318
    "redefined since a slider has no height - just origin"
claus
parents: 48
diff changeset
   319
claus
parents: 48
diff changeset
   320
    ^ nil
claus
parents: 48
diff changeset
   321
! !
claus
parents: 48
diff changeset
   322