UpDownButton.st
author Claus Gittinger <cg@exept.de>
Fri, 15 Jun 2018 10:54:35 +0200
changeset 5816 7876c07931a7
parent 5646 cebc9b5ad138
permissions -rw-r--r--
#DOCUMENTATION by cg class: ComboListView class comment/format in: #documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1718
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
     1
"
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
     2
 COPYRIGHT (c) 1997 eXept Software AG
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
     3
              All Rights Reserved
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
     4
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
     5
 This software is furnished under a license and may be used
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
     6
 only in accordance with the terms of that license and with the
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
     8
 be provided or otherwise made available to, or used by, any
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
     9
 other person.  No title to or ownership of the software is
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    10
 hereby transferred.
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    11
"
5646
cebc9b5ad138 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2767
diff changeset
    12
"{ Package: 'stx:libwidg2' }"
1718
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    13
5646
cebc9b5ad138 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2767
diff changeset
    14
"{ NameSpace: Smalltalk }"
1981
5975d3dd7314 Define resources
Stefan Vogel <sv@exept.de>
parents: 1718
diff changeset
    15
1299
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    16
View subclass:#UpDownButton
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    17
	instanceVariableNames:'orientation upButton downButton'
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
    18
	classVariableNames:''
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Views-Interactors'
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
!UpDownButton class methodsFor:'documentation'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
1718
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    25
copyright
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    26
"
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    27
 COPYRIGHT (c) 1997 eXept Software AG
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    28
              All Rights Reserved
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    29
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    30
 This software is furnished under a license and may be used
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    31
 only in accordance with the terms of that license and with the
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    33
 be provided or otherwise made available to, or used by, any
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    34
 other person.  No title to or ownership of the software is
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    35
 hereby transferred.
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    36
"
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    37
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    38
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    39
!
33c03d41f04e copyrights
Claus Gittinger <cg@exept.de>
parents: 1436
diff changeset
    40
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
documentation
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    an up/down button - simply two buttons in one view.
1436
1a63b1db144d comment
Claus Gittinger <cg@exept.de>
parents: 1435
diff changeset
    44
    This is also called SpinButton.
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    [author:]
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
        Claus Gittinger
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    [see also:]
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
        ArrowButton
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
        ComboUpDownView
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
"
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
examples
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
"
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
                                                                [exBegin]
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
     |top ud|
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
     top := StandardSystemView new.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
     top extent:(300 @ 200).
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
     ud := UpDownButton in:top.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
     ud origin:(10 @ 10).
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
     ud upAction:[Transcript showCR:'up'].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
     ud downAction:[Transcript showCR:'down'].
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
     top open.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
                                                                [exEnd]
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    70
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    71
                                                                [exBegin]
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    72
     |top ud|
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    73
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    74
     top := StandardSystemView new.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    75
     top extent:(300 @ 200).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    76
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    77
     ud := UpDownButton in:top.
1299
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    78
     ud origin:(10 @ 10).
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    79
     ud model:[:arg| Transcript showCR:arg].
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    80
     top open.
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    81
                                                                [exEnd]
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    82
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    83
                                                                [exBegin]
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    84
     |top ud|
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    85
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    86
     top := StandardSystemView new.
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    87
     top extent:(300 @ 200).
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    88
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
    89
     ud := UpDownButton in:top.
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    90
     ud orientation:#horizontal.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    91
     ud origin:(10 @ 10).
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    92
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    93
     ud upAction:[Transcript showCR:'up'].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    94
     ud downAction:[Transcript showCR:'down'].
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    95
     top open.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
    96
                                                                [exEnd]
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
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
! !
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
!UpDownButton methodsFor:'accessing-behavior'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
downAction:aBlock
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   104
    "set the down-action"
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   105
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
    downButton action:aBlock
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
1299
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   109
enabled
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   110
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   111
    ^ upButton enabled.
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   112
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   113
    "Created: / 30.3.1999 / 17:01:43 / stefan"
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   114
!
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   115
1299
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   116
enabled:aBoolean
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   117
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   118
    upButton enabled:aBoolean.
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   119
    downButton enabled:aBoolean.
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   120
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   121
    "Created: / 30.3.1999 / 15:47:11 / stefan"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   122
!
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   123
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
upAction:aBlock
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   125
    "set the up-action"
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   126
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
    upButton action:aBlock
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
! !
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   130
!UpDownButton methodsFor:'accessing-channels'!
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   131
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   132
backgroundChannel
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   133
    "return a valueHolder for the background color"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   134
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   135
    ^ upButton backgroundChannel
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   136
!
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   137
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   138
backgroundChannel: aValueHolder
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   139
    "set a valueHolder for the background color"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   140
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   141
    upButton backgroundChannel: aValueHolder.
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   142
    downButton backgroundChannel: aValueHolder
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   143
!
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   144
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   145
enableChannel
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   146
    "return a valueHolder for the enabled-state"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   147
1299
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   148
    ^ upButton enableChannel
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   149
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   150
    "Modified: / 30.3.1999 / 16:56:32 / stefan"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   151
!
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   152
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   153
enableChannel: aValueHolder
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   154
    "set a valueHolder for the enabled-state"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   155
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   156
    upButton enableChannel: aValueHolder.
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   157
    downButton enableChannel: aValueHolder
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   158
!
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   159
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   160
foregroundChannel
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   161
    "return a valueHolder for the foreground color"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   162
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   163
    ^ upButton foregroundChannel
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   164
!
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   165
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   166
foregroundChannel: aValueHolder
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   167
    "set a valueHolder for the foreground color"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   168
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   169
    upButton foregroundChannel: aValueHolder.
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   170
    downButton foregroundChannel: aValueHolder
1299
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   171
!
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   172
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   173
model:aModel
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   174
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   175
    |m|
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   176
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   177
    aModel notNil ifTrue:[
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   178
        m := self.
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   179
        upButton changeMessage:#changeUp:.
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   180
        downButton changeMessage:#changeDown:.
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   181
    ].
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   182
    upButton model:m.
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   183
    downButton model:m.
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   184
    ^ super model:aModel
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   185
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   186
    "Modified: / 30.3.1999 / 17:45:59 / stefan"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   187
! !
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   188
5646
cebc9b5ad138 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2767
diff changeset
   189
!UpDownButton methodsFor:'accessing-color & font'!
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   190
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   191
backgroundColor
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   192
    "return the backgroundColor"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   193
852
89c5dd6f6809 wrong color accessings
tz
parents: 818
diff changeset
   194
    ^upButton backgroundColor
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   195
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   196
!
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   197
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   198
backgroundColor:aColor
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   199
    "set the backgroundColor"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   200
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   201
    aColor ~~ upButton backgroundColor ifTrue:[
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   202
        upButton backgroundColor:aColor.
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   203
        downButton backgroundColor:aColor.
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   204
        self invalidateRepairNow:true
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   205
    ]
912
e4b45ee7df6d redrawNow, when colors change.
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   206
e4b45ee7df6d redrawNow, when colors change.
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   207
    "Modified: / 6.6.1998 / 19:53:50 / cg"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   208
!
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   209
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   210
foregroundColor
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   211
    "return the foregroundColor"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   212
852
89c5dd6f6809 wrong color accessings
tz
parents: 818
diff changeset
   213
    ^upButton foregroundColor
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   214
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   215
!
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   216
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   217
foregroundColor:aColor
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   218
    "set the foregroundColor"
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   219
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   220
    aColor ~~ upButton foregroundColor ifTrue:[
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   221
        upButton foregroundColor:aColor.
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   222
        downButton foregroundColor:aColor.
2659
3af857eb52fb invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2212
diff changeset
   223
        self invalidateRepairNow:true
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   224
    ]
912
e4b45ee7df6d redrawNow, when colors change.
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   225
e4b45ee7df6d redrawNow, when colors change.
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
   226
    "Modified: / 6.6.1998 / 19:53:44 / cg"
2212
db7871a125b7 viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
   227
!
db7871a125b7 viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
   228
db7871a125b7 viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
   229
viewBackground:aColor
db7871a125b7 viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
   230
    upButton viewBackground:aColor.
db7871a125b7 viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
   231
    downButton viewBackground:aColor.
db7871a125b7 viewBackground setting fixed (I hope)
Claus Gittinger <cg@exept.de>
parents: 2175
diff changeset
   232
    super viewBackground:aColor.
818
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   233
! !
fbd05e92d506 revised for the docu
tz
parents: 788
diff changeset
   234
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
!UpDownButton methodsFor:'accessing-components'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   237
downButton
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   238
    "return the downButton"
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   239
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   240
    ^ downButton
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
upButton
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   244
    "return the upButton"
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   245
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
    ^ upButton
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
! !
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   249
!UpDownButton methodsFor:'accessing-look'!
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   250
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   251
orientation
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   252
    "return the orientation (a symbol)"
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   253
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   254
    ^ orientation
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   255
!
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   256
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   257
orientation:aSymbol
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   258
    "set the orientation (#horizontal or #vertical)"
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   259
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   260
    orientation := aSymbol.
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   261
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   262
    self initializeButtonDimensions.
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   263
    self initializeButtonForms
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   264
! !
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   265
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   266
!UpDownButton methodsFor:'change & update'!
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   267
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   268
sizeChanged:how
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   269
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   270
    super sizeChanged:how.
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   271
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   272
    self initializeButtonDimensions
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   273
! !
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   274
868
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   275
!UpDownButton methodsFor:'event handling'!
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   276
1299
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   277
changeDown:aValue
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   278
    "down button was pressed, send to my model"
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   279
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   280
    self sendChangeMessageWith:#down
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   281
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   282
    "Modified: / 30.3.1999 / 17:28:50 / stefan"
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   283
!
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   284
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   285
changeUp:aValue
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   286
    "up button was pressed, send to my model"
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   287
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   288
    self sendChangeMessageWith:#up
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   289
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   290
    "Created: / 30.3.1999 / 17:28:26 / stefan"
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   291
!
f088a69429be Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1264
diff changeset
   292
868
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   293
keyPress:aKey x:x y:y
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   294
    "simulate a buttonPress/release"
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   295
1985
1e21a6928dfb stc does not understand + and - in resources.
Stefan Vogel <sv@exept.de>
parents: 1981
diff changeset
   296
    <resource: #keyboard (#CursorRight #CursorUp #CursorLeft #CursorDown)>
1981
5975d3dd7314 Define resources
Stefan Vogel <sv@exept.de>
parents: 1718
diff changeset
   297
5975d3dd7314 Define resources
Stefan Vogel <sv@exept.de>
parents: 1718
diff changeset
   298
   |theButton theController|
868
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   299
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   300
    ((aKey == #CursorUp)
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   301
    or:[aKey == #CursorRight
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   302
    or:[aKey == $+]]) ifTrue:[
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   303
        theButton := upButton
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   304
    ] ifFalse:[
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   305
        ((aKey == #CursorDown)
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   306
        or:[aKey == #CursorLeft 
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   307
        or:[aKey == $-]]) ifTrue:[
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   308
            theButton := downButton
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   309
        ].
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   310
    ].
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   311
    theButton notNil ifTrue:[
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   312
        theController := theButton controller.
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   313
        theController pressed:true.
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   314
        theController pressed:false.
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   315
        ^ self
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   316
    ].
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   317
    ^ super keyPress:aKey x:x y:y
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   318
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   319
    "Created: / 21.4.1998 / 19:48:28 / cg"
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   320
    "Modified: / 21.4.1998 / 19:56:28 / cg"
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   321
! !
0fa479aee842 handle cursorUp/Down and +/-
Claus Gittinger <cg@exept.de>
parents: 852
diff changeset
   322
1264
dda5fc818ef0 category change
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   323
!UpDownButton methodsFor:'focus handling'!
dda5fc818ef0 category change
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   324
dda5fc818ef0 category change
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   325
showFocus:explicit 
dda5fc818ef0 category change
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   326
    "display myself as having-focus"
dda5fc818ef0 category change
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   327
dda5fc818ef0 category change
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   328
    (upButton enabled or:[downButton enabled]) ifTrue: [
dda5fc818ef0 category change
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   329
        super showFocus:explicit
dda5fc818ef0 category change
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   330
    ]
dda5fc818ef0 category change
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   331
! !
dda5fc818ef0 category change
Claus Gittinger <cg@exept.de>
parents: 912
diff changeset
   332
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
!UpDownButton methodsFor:'initialization'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
initialize
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   336
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   337
    orientation := #vertical.
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   338
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
    super initialize.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
    self initializeButtons
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   341
!
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   342
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   343
initializeButtonDimensions
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   344
    |upOrigin downOrigin upCorner downCorner|
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   345
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   346
    orientation == #vertical ifTrue:[
1435
6343d644bf32 oops - up/down was reversed when orientation==horizontal
Claus Gittinger <cg@exept.de>
parents: 1299
diff changeset
   347
        upOrigin := 0@0.
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   348
        upCorner := (width - 1) @ (height // 2).
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   349
        downOrigin := 0 @ (height // 2 + 1).
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   350
        downCorner := (width - 1) @ (height - 1)
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   351
    ] ifFalse:[
1435
6343d644bf32 oops - up/down was reversed when orientation==horizontal
Claus Gittinger <cg@exept.de>
parents: 1299
diff changeset
   352
        downOrigin := 0@0.
6343d644bf32 oops - up/down was reversed when orientation==horizontal
Claus Gittinger <cg@exept.de>
parents: 1299
diff changeset
   353
        downCorner := (width // 2) @ (height - 1).
6343d644bf32 oops - up/down was reversed when orientation==horizontal
Claus Gittinger <cg@exept.de>
parents: 1299
diff changeset
   354
        upOrigin := (width // 2 + 1) @ 0.
6343d644bf32 oops - up/down was reversed when orientation==horizontal
Claus Gittinger <cg@exept.de>
parents: 1299
diff changeset
   355
        upCorner := (width - 1) @ (height - 1)
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   356
    ].
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   357
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   358
    upButton   origin:upOrigin.
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   359
    upButton   corner:upCorner.
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   360
    downButton origin:downOrigin.
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   361
    downButton corner:downCorner.
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   362
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   363
!
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   364
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   365
initializeButtonForms
2175
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   366
    |upLabel downLabel upPref downPref prefW prefH|
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   367
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   368
    orientation == #vertical ifTrue:[
2175
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   369
        upLabel := ArrowButton defaultWIN32ArrowButtonFormForDirection:#up onDevice:nil. 
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   370
        downLabel := ArrowButton defaultWIN32ArrowButtonFormForDirection:#down onDevice:nil.
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   371
    ] ifFalse:[
2175
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   372
        downLabel := ArrowButton defaultWIN32ArrowButtonFormForDirection:#left onDevice:nil.
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   373
        upLabel := ArrowButton defaultWIN32ArrowButtonFormForDirection:#right onDevice:nil.
340
c02e5db9b6f5 added left-right orientation.
Claus Gittinger <cg@exept.de>
parents: 338
diff changeset
   374
    ].
899
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   375
    upButton label:upLabel.
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   376
    downButton label:downLabel.
68770c9d162d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   377
2175
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   378
    upPref := upButton preferredExtent.
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   379
    downPref := downButton preferredExtent.
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   380
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   381
    orientation == #vertical ifTrue:[
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   382
        prefW := upPref x max:(downPref x).
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   383
        prefH := upPref y + (downPref y).
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   384
    ] ifFalse:[
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   385
        prefW := upPref x + (downPref x).
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   386
        prefH := upPref y max: (downPref y).
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   387
    ].
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   388
b7388c30badf always use win95 style arrows
Claus Gittinger <cg@exept.de>
parents: 1985
diff changeset
   389
    self preferredExtent:prefW@prefH.
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   391
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
initializeButtons
2767
42ea3925fe0e u/dButtons form is independent of viewStyle
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
   393
    upButton := Button in:self "ArrowButton upIn:self".
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
    upButton autoRepeat:true.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
2767
42ea3925fe0e u/dButtons form is independent of viewStyle
Claus Gittinger <cg@exept.de>
parents: 2659
diff changeset
   396
    downButton := Button in:self "ArrowButton downIn:self".
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
    downButton autoRepeat:true.
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
788
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   399
    self initializeButtonDimensions.
826f9374823b take forms from the ArrowButton + resizing behavior added
tz
parents: 779
diff changeset
   400
    self initializeButtonForms
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
! !
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   403
!UpDownButton class methodsFor:'documentation'!
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   404
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   405
version
5646
cebc9b5ad138 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2767
diff changeset
   406
    ^ '$Header$'
338
d779aad63356 intitial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   407
! !
5646
cebc9b5ad138 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 2767
diff changeset
   408