UpDownButton.st
author Stefan Vogel <sv@exept.de>
Sat, 10 Jan 1998 00:51:27 +0100
changeset 651 2317d52abba7
parent 577 fe0313b081bc
child 779 0abab228a8fd
permissions -rw-r--r--
Use Form>>onDevice: instead of obsolete #on:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
SimpleView subclass:#UpDownButton
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
     2
	instanceVariableNames:'orientation upButton downButton'
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
     3
	classVariableNames:'DefaultDownForm DefaultUpForm DefaultLeftForm DefaultRightForm'
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
	poolDictionaries:''
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
	category:'Views-Interactors'
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
!UpDownButton class methodsFor:'documentation'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
documentation
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
    an up/down button - simply two buttons in one view.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
    [author:]
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
        Claus Gittinger
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
    [see also:]
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
        ArrowButton
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
        ComboUpDownView
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
examples
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
                                                                [exBegin]
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
     |top ud|
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
     top := StandardSystemView new.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
     top extent:(300 @ 200).
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
     ud := UpDownButton in:top.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
     ud origin:(10 @ 10).
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
     ud upAction:[Transcript showCR:'up'].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
     ud downAction:[Transcript showCR:'down'].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
     top open.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
                                                                [exEnd]
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    38
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    39
                                                                [exBegin]
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    40
     |top ud|
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    41
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    42
     top := StandardSystemView new.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    43
     top extent:(300 @ 200).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    44
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    45
     ud := UpDownButton in:top.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    46
     ud orientation:#horizontal.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    47
     ud origin:(10 @ 10).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    48
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    49
     ud upAction:[Transcript showCR:'up'].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    50
     ud downAction:[Transcript showCR:'down'].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    51
     top open.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    52
                                                                [exEnd]
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
! !
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
!UpDownButton class methodsFor:'defaults'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
downButtonForm
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    "return the down-buttons image"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    62
    <resource: #style (#upDownButton.downForm #upDownButton.downFormFile)>
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    |fileName form|
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    66
    DefaultDownForm notNil ifTrue:[
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    67
        ^ DefaultDownForm
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    68
    ].
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    69
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    70
    form := StyleSheet at:'upDownButton.downForm' default:nil.
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    form isNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    72
        fileName := StyleSheet at:'upDownButton.downFormFile' default:'ComboDnB_win.xbm'.
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
        form := Image fromFile:fileName.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    ].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    form isNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    76
        form  := Form width:10 height:6 
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
                      fromArray:#[
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
                                  2r00000000 2r00000000
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    79
                                  2r01111111 2r10000000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    80
                                  2r00111111 2r00000000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    81
                                  2r00011110 2r00000000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    82
                                  2r00001100 2r00000000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    83
                                  2r00000000 2r00000000
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
                                 ]
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
                      on:Display.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    ].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    form notNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    88
        DefaultDownForm := form.
651
2317d52abba7 Use Form>>onDevice: instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 577
diff changeset
    89
        ^ form onDevice:Display
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    ].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    ^ nil
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    93
    "Created: / 1.4.1997 / 11:53:39 / cg"
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
    94
    "Modified: / 25.10.1997 / 14:24:20 / cg"
651
2317d52abba7 Use Form>>onDevice: instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 577
diff changeset
    95
    "Modified: / 8.1.1998 / 16:33:54 / stefan"
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    98
leftButtonForm
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    99
    "return the left-buttons image"
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   100
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   101
    <resource: #style (#upDownButton.leftForm #upDownButton.leftFormFile)>
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   102
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   103
    |fileName form|
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   104
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   105
    DefaultLeftForm notNil ifTrue:[
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   106
        ^ DefaultLeftForm
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   107
    ].
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   108
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   109
    form := StyleSheet at:'upDownButton.leftForm' default:nil.
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   110
    form isNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   111
        fileName := StyleSheet at:'upDownButton.leftFormFile' default:'ComboLtB_win.xbm'.
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   112
        form := Image fromFile:fileName.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   113
    ].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   114
    form isNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   115
        form  := Form width:6 height:10 
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   116
                      fromArray:#[
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   117
                                  2r00000000
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   118
                                  2r00001000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   119
                                  2r00011000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   120
                                  2r00111000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   121
                                  2r01111000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   122
                                  2r01111000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   123
                                  2r00111000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   124
                                  2r00011000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   125
                                  2r00001000
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   126
                                  2r00000000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   127
                                 ]
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   128
                      on:Display.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   129
    ].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   130
    form notNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   131
        DefaultLeftForm := form.
651
2317d52abba7 Use Form>>onDevice: instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 577
diff changeset
   132
        ^ form onDevice:Display
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   133
    ].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   134
    ^ nil
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   135
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   136
    "Created: / 1.4.1997 / 12:39:18 / cg"
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   137
    "Modified: / 25.10.1997 / 14:21:45 / cg"
651
2317d52abba7 Use Form>>onDevice: instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 577
diff changeset
   138
    "Modified: / 8.1.1998 / 16:34:05 / stefan"
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   139
!
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   140
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   141
rightButtonForm
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   142
    "return the left-buttons image"
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   143
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   144
    <resource: #style (#upDownButton.rightForm #upDownButton.rightFormFile)>
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   145
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   146
    |fileName form|
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   147
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   148
    DefaultRightForm notNil ifTrue:[
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   149
        ^ DefaultRightForm
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   150
    ].
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   151
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   152
    form := StyleSheet at:'upDownButton.rightForm' default:nil.
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   153
    form isNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   154
        fileName := StyleSheet at:'upDownButton.rightFormFile' default:'ComboRtB_win.xbm'.
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   155
        form := Image fromFile:fileName.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   156
    ].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   157
    form isNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   158
        form  := Form width:6 height:10 
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   159
                      fromArray:#[
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   160
                                  2r00000000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   161
                                  2r01000000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   162
                                  2r01100000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   163
                                  2r01110000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   164
                                  2r01111000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   165
                                  2r01111000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   166
                                  2r01110000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   167
                                  2r01100000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   168
                                  2r01000000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   169
                                  2r00000000
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   170
                                 ]
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   171
                      on:Display.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   172
    ].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   173
    form notNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   174
        DefaultRightForm := form.
651
2317d52abba7 Use Form>>onDevice: instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 577
diff changeset
   175
        ^ form onDevice:Display
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   176
    ].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   177
    ^ nil
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   178
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   179
    "Created: / 1.4.1997 / 12:39:34 / cg"
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   180
    "Modified: / 25.10.1997 / 14:23:04 / cg"
651
2317d52abba7 Use Form>>onDevice: instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 577
diff changeset
   181
    "Modified: / 8.1.1998 / 16:34:15 / stefan"
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   182
!
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   183
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
upButtonForm
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    "return the up-buttons image"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   187
    <resource: #style (#upDownButton.upForm #upDownButton.upFormFile)>
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
    |fileName form|
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   191
    DefaultUpForm notNil ifTrue:[
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   192
        ^ DefaultUpForm
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   193
    ].
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   194
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   195
    form := StyleSheet at:'upDownButton.upForm' default:nil.
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
    form isNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   197
        fileName := StyleSheet at:'upDownButton.upFormFile' default:'ComboUpB_win.xbm'.
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
        form := Image fromFile:fileName.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    ].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
    form isNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   201
        form  := Form width:10 height:6 
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
                      fromArray:#[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   203
                                  2r00000000 2r00000000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   204
                                  2r00001100 2r00000000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   205
                                  2r00011110 2r00000000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   206
                                  2r00111111 2r00000000
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   207
                                  2r01111111 2r10000000
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
                                  2r00000000 2r00000000
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
                                 ]
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
                      on:Display.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    ].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
    form notNil ifTrue:[
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   213
        DefaultUpForm := form.
651
2317d52abba7 Use Form>>onDevice: instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 577
diff changeset
   214
        ^ form onDevice:Display
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
    ].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
    ^ nil
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   218
    "Created: / 1.4.1997 / 11:54:13 / cg"
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   219
    "Modified: / 25.10.1997 / 14:23:49 / cg"
651
2317d52abba7 Use Form>>onDevice: instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 577
diff changeset
   220
    "Modified: / 8.1.1998 / 16:34:36 / stefan"
577
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   221
!
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   222
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   223
updateStyleCache
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   224
    DefaultDownForm := DefaultUpForm := DefaultLeftForm := DefaultRightForm := nil.
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   225
fe0313b081bc *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 340
diff changeset
   226
    "Created: / 25.10.1997 / 14:11:48 / cg"
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
! !
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
!UpDownButton methodsFor:'accessing-behavior'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
downAction:aBlock
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
    downButton action:aBlock
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   233
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   234
    "Created: 1.4.1997 / 11:56:33 / cg"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
upAction:aBlock
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
    upButton action:aBlock
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    "Created: 1.4.1997 / 11:56:28 / cg"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   241
! !
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
!UpDownButton methodsFor:'accessing-components'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
downButton
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
    ^ downButton
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
    "Created: 1.4.1997 / 11:56:05 / cg"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
upButton
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
    ^ upButton
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   254
    "Created: 1.4.1997 / 11:55:52 / cg"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
    "Modified: 1.4.1997 / 11:56:02 / cg"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
! !
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   258
!UpDownButton methodsFor:'accessing-look'!
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   259
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   260
orientation
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   261
    ^ orientation
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   262
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   263
    "Created: 1.4.1997 / 12:42:01 / cg"
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   264
!
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   265
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   266
orientation:aSymbol
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   267
    orientation := aSymbol.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   268
    self initializeButtonDimensions
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   269
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   270
    "Created: 1.4.1997 / 12:42:17 / cg"
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   271
    "Modified: 1.4.1997 / 12:42:29 / cg"
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   272
! !
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   273
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
!UpDownButton methodsFor:'initialization'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   275
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
initialize
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   277
    orientation := #vertical.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   278
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   279
    super initialize.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   280
    self initializeButtons
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   281
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   282
    "Created: 1.4.1997 / 11:58:07 / cg"
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   283
    "Modified: 1.4.1997 / 12:47:58 / cg"
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   284
!
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   285
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   286
initializeButtonDimensions
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   287
    orientation == #vertical ifTrue:[
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   288
        upButton label:(self class upButtonForm).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   289
        downButton label:(self class downButtonForm).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   290
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   291
        upButton origin:0@0.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   292
        downButton origin:(0 @ upButton preferredExtent y).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   293
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   294
        self preferredExtent:(upButton preferredExtent x
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   295
                              @
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   296
                              (upButton preferredExtent y 
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   297
                              +
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   298
                              downButton preferredExtent y)).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   299
    ] ifFalse:[
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   300
        upButton label:(self class rightButtonForm).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   301
        downButton label:(self class leftButtonForm).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   302
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   303
        downButton origin:0@0.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   304
        upButton origin:(downButton preferredExtent x @ 0).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   305
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   306
        self preferredExtent:((upButton preferredExtent x
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   307
                              +
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   308
                              downButton preferredExtent x)
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   309
                              @
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   310
                              upButton preferredExtent y).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   311
    ].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   312
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   313
    "Modified: 1.4.1997 / 12:47:38 / cg"
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
initializeButtons
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
    upButton := ArrowButton upIn:self.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
    upButton action:[self countUp].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
    upButton autoRepeat:true.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
    downButton := ArrowButton downIn:self.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
    downButton action:[self countDown].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
    downButton autoRepeat:true.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   325
    self initializeButtonDimensions
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   327
    "Modified: 1.4.1997 / 12:42:58 / cg"
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
! !
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
!UpDownButton class methodsFor:'documentation'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
version
651
2317d52abba7 Use Form>>onDevice: instead of obsolete #on:
Stefan Vogel <sv@exept.de>
parents: 577
diff changeset
   333
    ^ '$Header: /cvs/stx/stx/libwidg2/UpDownButton.st,v 1.4 1998-01-09 23:51:27 stefan Exp $'
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
! !