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