SteppingSlider.st
author Claus Gittinger <cg@exept.de>
Fri, 15 Jun 2018 10:54:35 +0200
changeset 5816 7876c07931a7
parent 4010 34cc746561a6
permissions -rw-r--r--
#DOCUMENTATION by cg class: ComboListView class comment/format in: #documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
     1
"
1e6bf473d863 Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1994 by Claus Gittinger
49
claus
parents: 23
diff changeset
     3
	      All Rights Reserved
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
     4
1e6bf473d863 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
1e6bf473d863 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
1e6bf473d863 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
1e6bf473d863 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
1e6bf473d863 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    11
"
1982
7e268ddd2ab2 Fix up/down kuddelmuddel.
Stefan Vogel <sv@exept.de>
parents: 1470
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
7e268ddd2ab2 Fix up/down kuddelmuddel.
Stefan Vogel <sv@exept.de>
parents: 1470
diff changeset
    13
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    14
ScrollBar subclass:#SteppingSlider
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    15
	instanceVariableNames:'stepIncrement'
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    16
	classVariableNames:''
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    17
	poolDictionaries:''
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    18
	category:'Views-Interactors'
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    19
!
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    20
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    21
!SteppingSlider class methodsFor:'documentation'!
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    22
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    23
copyright
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    24
"
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    25
 COPYRIGHT (c) 1994 by Claus Gittinger
49
claus
parents: 23
diff changeset
    26
	      All Rights Reserved
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    27
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    28
 This software is furnished under a license and may be used
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    33
 hereby transferred.
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    34
"
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    35
!
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    36
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    37
documentation
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    38
"
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    39
    SteppingSliders are like Sliders, but add step-up and step-down
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    40
    buttons (which increment/decrement the value).
57
claus
parents: 49
diff changeset
    41
    (you can also think of them as a ScrollBar with a slider instead of
claus
parents: 49
diff changeset
    42
     a scroller as component)
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    43
"
49
claus
parents: 23
diff changeset
    44
!
claus
parents: 23
diff changeset
    45
claus
parents: 23
diff changeset
    46
examples 
claus
parents: 23
diff changeset
    47
"
claus
parents: 23
diff changeset
    48
    non model operation:
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    49
                                                                [exBegin]
49
claus
parents: 23
diff changeset
    50
      |top sl|
claus
parents: 23
diff changeset
    51
claus
parents: 23
diff changeset
    52
      top := StandardSystemView extent:200@200.
claus
parents: 23
diff changeset
    53
      sl := SteppingSlider in:top.
claus
parents: 23
diff changeset
    54
      sl origin:(0.0@0.0) corner:(sl width@1.0).
184
13a2f3677c68 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    55
      sl scrollAction:[:pos | Transcript showCR:pos].    
49
claus
parents: 23
diff changeset
    56
      top open
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    57
                                                                [exEnd]
49
claus
parents: 23
diff changeset
    58
claus
parents: 23
diff changeset
    59
57
claus
parents: 49
diff changeset
    60
    change the step:
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    61
                                                                [exBegin]
57
claus
parents: 49
diff changeset
    62
      |top sl|
49
claus
parents: 23
diff changeset
    63
claus
parents: 23
diff changeset
    64
      top := StandardSystemView extent:200@200.
claus
parents: 23
diff changeset
    65
      sl := SteppingSlider in:top.
claus
parents: 23
diff changeset
    66
      sl origin:(0.0@0.0) corner:(sl width@1.0).
184
13a2f3677c68 showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 86
diff changeset
    67
      sl scrollAction:[:pos | Transcript showCR:pos].    
57
claus
parents: 49
diff changeset
    68
      sl stepIncrement:10.
claus
parents: 49
diff changeset
    69
      top open
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    70
                                                                [exEnd]
57
claus
parents: 49
diff changeset
    71
claus
parents: 49
diff changeset
    72
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    73
    model operation (watch the value):
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    74
                                                                [exBegin]
57
claus
parents: 49
diff changeset
    75
      |model top sl fld|
claus
parents: 49
diff changeset
    76
claus
parents: 49
diff changeset
    77
      model := 0 asValue.
claus
parents: 49
diff changeset
    78
claus
parents: 49
diff changeset
    79
      top := StandardSystemView extent:200@200.
claus
parents: 49
diff changeset
    80
      top label:'slider on model'.
claus
parents: 49
diff changeset
    81
      sl := SteppingSlider in:top.
claus
parents: 49
diff changeset
    82
      sl origin:(0.0@0.0) corner:(sl width@1.0).
49
claus
parents: 23
diff changeset
    83
      sl model:model.
57
claus
parents: 49
diff changeset
    84
      top open.
claus
parents: 49
diff changeset
    85
claus
parents: 49
diff changeset
    86
      top := StandardSystemView extent:200@200.
claus
parents: 49
diff changeset
    87
      top label:'inputField on model'.
claus
parents: 49
diff changeset
    88
      fld := EditField in:top.
claus
parents: 49
diff changeset
    89
      fld origin:(0.0@0.0) corner:(1.0 @ fld height).
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    90
      fld converter:(PrintConverter new initForNumber); model:model.
49
claus
parents: 23
diff changeset
    91
      top open
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    92
                                                                [exEnd]
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    93
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
    94
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    95
    two views on the same model:
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    96
                                                                [exBegin]
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    97
      |model top sl fld|
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    98
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
    99
      model := 0 asValue.
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
   100
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   101
      top := StandardSystemView extent:200@200.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   102
      top label:'slider on model'.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   103
      sl := SteppingSlider in:top.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   104
      sl origin:(0.0@0.0) corner:(sl width@1.0).
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   105
      sl model:model.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   106
      top open.
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
   107
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   108
      top := StandardSystemView extent:200@200.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   109
      top label:'slider on model'.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   110
      sl := ThumbWheel in:top.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   111
      sl origin:(0.0@0.0) corner:(20@1.0).
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   112
      sl model:model.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   113
      top open.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   114
                                                                [exEnd]
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   115
"
49
claus
parents: 23
diff changeset
   116
! !
claus
parents: 23
diff changeset
   117
claus
parents: 23
diff changeset
   118
!SteppingSlider methodsFor:'accessing'!
claus
parents: 23
diff changeset
   119
claus
parents: 23
diff changeset
   120
model:aModel
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   121
    "set the model - forwarded to the thumb.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   122
     if nonNil, this will get the thumbs origin
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   123
     via #value: messages"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   124
49
claus
parents: 23
diff changeset
   125
    thumb model:aModel
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   126
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   127
    "Modified: 28.5.1997 / 15:07:55 / cg"
57
claus
parents: 49
diff changeset
   128
!
claus
parents: 49
diff changeset
   129
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   130
start:start stop:stop step:step
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   131
    "set start (min), stop (max) and step increment.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   132
     The increment is used when clicking on a step button"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   133
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   134
    thumb start:start stop:stop.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   135
    stepIncrement := step
57
claus
parents: 49
diff changeset
   136
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   137
    "Modified: 28.5.1997 / 15:03:56 / cg"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   138
!
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   139
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   140
step
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   141
    "return the step increment.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   142
     The increment is used when clicking on a step button"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   143
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   144
    ^ stepIncrement
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   145
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   146
    "Modified: 28.5.1997 / 15:04:01 / cg"
65
claus
parents: 57
diff changeset
   147
!
claus
parents: 57
diff changeset
   148
claus
parents: 57
diff changeset
   149
step:aNumber
claus
parents: 57
diff changeset
   150
    "same as stepIncrement;
claus
parents: 57
diff changeset
   151
     set the value used for stepping (defaults to 1)"
claus
parents: 57
diff changeset
   152
claus
parents: 57
diff changeset
   153
    stepIncrement := aNumber
claus
parents: 57
diff changeset
   154
!
claus
parents: 57
diff changeset
   155
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   156
stepIncrement:aNumber 
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   157
    "set the value used for stepping (defaults to 1).
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   158
     Same as #step: for compatibility."
65
claus
parents: 57
diff changeset
   159
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   160
    stepIncrement := aNumber
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   161
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   162
    "Modified: 28.5.1997 / 15:04:25 / cg"
65
claus
parents: 57
diff changeset
   163
! !
claus
parents: 57
diff changeset
   164
2129
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   165
!SteppingSlider methodsFor:'event handling'!
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   166
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   167
keyPress:key x:x y:y
4010
34cc746561a6 changed:
Stefan Vogel <sv@exept.de>
parents: 2129
diff changeset
   168
    <resource: #keyboard (#CursorRight #CursorUp #CursorLeft #CursorDown #+ #-)>
2129
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   169
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   170
    |step|
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   171
"/    enabled ifFalse:[^ self].
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   172
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   173
    step := thumb keyboardStep ? stepIncrement.
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   174
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   175
    (key == #CursorLeft
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   176
    or:[key == #CursorUp
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   177
    or:[key == $-]]) ifTrue:[
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   178
        self scrollStep:step negated.
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   179
        ^ self
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   180
    ].
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   181
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   182
    (key == #CursorRight
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   183
    or:[key == #CursorDown
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   184
    or:[key == $+]]) ifTrue:[
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   185
        self scrollStep:step.
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   186
        ^ self
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   187
    ].
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   188
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   189
    super keyPress:key x:x y:y
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   190
! !
811701a228c5 add key handling
Stefan Vogel <sv@exept.de>
parents: 1982
diff changeset
   191
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   192
!SteppingSlider methodsFor:'initialization'!
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   193
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   194
createElements
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   195
    "create the scroller and the two step buttons"
65
claus
parents: 57
diff changeset
   196
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   197
    self orientation == #horizontal ifTrue:[
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   198
        button1 := ArrowButton leftIn:self.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   199
        button1 name:'LeftButton'.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   200
        button2 := ArrowButton rightIn:self.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   201
        button2 name:'RightButton'.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   202
        thumb := HorizontalSlider in:self.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   203
    ] ifFalse:[
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   204
        button1 := ArrowButton upIn:self.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   205
        button1 name:'UpButton'.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   206
        button2 := ArrowButton downIn:self.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   207
        button2 name:'DownButton'.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   208
        thumb := Slider in:self.
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   209
    ].
65
claus
parents: 57
diff changeset
   210
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   211
    "Modified: 28.5.1997 / 15:09:50 / cg"
65
claus
parents: 57
diff changeset
   212
!
claus
parents: 57
diff changeset
   213
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   214
initialize
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   215
    "initialize; the increment is set to 1 (one)"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   216
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   217
    super initialize.
65
claus
parents: 57
diff changeset
   218
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   219
    stepIncrement := 1.
402
db4b13aff9c9 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   220
    buttonLayout := #around.
db4b13aff9c9 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   221
1982
7e268ddd2ab2 Fix up/down kuddelmuddel.
Stefan Vogel <sv@exept.de>
parents: 1470
diff changeset
   222
    self scrollDownAction:[self scrollStepDown].
7e268ddd2ab2 Fix up/down kuddelmuddel.
Stefan Vogel <sv@exept.de>
parents: 1470
diff changeset
   223
    self scrollUpAction:[self scrollStepUp].
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   224
402
db4b13aff9c9 more code moved to superclass
Claus Gittinger <cg@exept.de>
parents: 400
diff changeset
   225
    "Modified: 28.5.1997 / 16:12:04 / cg"
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
   226
! !
1e6bf473d863 Initial revision
claus
parents:
diff changeset
   227
1e6bf473d863 Initial revision
claus
parents:
diff changeset
   228
!SteppingSlider methodsFor:'misc'!
1e6bf473d863 Initial revision
claus
parents:
diff changeset
   229
1e6bf473d863 Initial revision
claus
parents:
diff changeset
   230
doesNotUnderstand:aMessage
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   231
    "forward any unimplemented message to the scroller"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   232
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   233
    ^ aMessage sendTo:thumb
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   234
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   235
    "Modified: 28.5.1997 / 15:05:37 / cg"
23
1e6bf473d863 Initial revision
claus
parents:
diff changeset
   236
! !
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   237
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   238
!SteppingSlider methodsFor:'private'!
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   239
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   240
scrollStep:delta
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   241
    "step by some delta"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   242
871
831b19654aae moved scrollStep:
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
   243
    thumb scrollStep:delta
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   244
871
831b19654aae moved scrollStep:
Claus Gittinger <cg@exept.de>
parents: 402
diff changeset
   245
    "Modified: / 21.4.1998 / 20:52:49 / cg"
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   246
!
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   247
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   248
scrollStepDown
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   249
    "sent when the step-down button is pressd"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   250
1982
7e268ddd2ab2 Fix up/down kuddelmuddel.
Stefan Vogel <sv@exept.de>
parents: 1470
diff changeset
   251
    self scrollStep:stepIncrement
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   252
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   253
    "Modified: 28.5.1997 / 15:11:02 / cg"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   254
!
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   255
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   256
scrollStepUp
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   257
    "sent when the step-up button is pressd"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   258
1982
7e268ddd2ab2 Fix up/down kuddelmuddel.
Stefan Vogel <sv@exept.de>
parents: 1470
diff changeset
   259
    self scrollStep:stepIncrement negated
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   260
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   261
    "Modified: 28.5.1997 / 15:11:08 / cg"
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   262
! !
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   263
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   264
!SteppingSlider class methodsFor:'documentation'!
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   265
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   266
version
4010
34cc746561a6 changed:
Stefan Vogel <sv@exept.de>
parents: 2129
diff changeset
   267
    ^ '$Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.14 2011-02-05 17:37:29 stefan Exp $'
34cc746561a6 changed:
Stefan Vogel <sv@exept.de>
parents: 2129
diff changeset
   268
!
34cc746561a6 changed:
Stefan Vogel <sv@exept.de>
parents: 2129
diff changeset
   269
34cc746561a6 changed:
Stefan Vogel <sv@exept.de>
parents: 2129
diff changeset
   270
version_CVS
34cc746561a6 changed:
Stefan Vogel <sv@exept.de>
parents: 2129
diff changeset
   271
    ^ '$Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.14 2011-02-05 17:37:29 stefan Exp $'
400
d176fd820716 merged common code from steppingSlider & horizontalSteppingSlider
Claus Gittinger <cg@exept.de>
parents: 184
diff changeset
   272
! !