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