Button.st
author Claus Gittinger <cg@exept.de>
Sat, 20 Jun 2009 10:47:07 +0200
changeset 3901 113dd960ba11
parent 3839 5cbf92d3aa64
child 3925 cd7aa2f275ac
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
4
88eb91574867 *** empty log message ***
claus
parents: 2
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
     3
	      All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
2253
d3f08d7565a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2137
diff changeset
    12
"{ Package: 'stx:libwidg' }"
d3f08d7565a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2137
diff changeset
    13
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    14
Label subclass:#Button
264
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    15
	instanceVariableNames:'activeLogo passiveLogo disabledLogo focusLogo onLevel offLevel
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
    16
		disabledFgColor disabledEtchedFgColor activeFgColor activeBgColor
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
    17
		enteredFgColor enteredBgColor isReturnButton shadowForm lightForm
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
    18
		formColor formShadowColor formLightColor edgeStyle
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
    19
		halfShadowColor halfLightColor defaultable enterLevel leaveLevel
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
    20
		enteredLogo'
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
    21
	classVariableNames:'ReturnForm ReturnLightForm ReturnShadowForm DefaultActiveLevel
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
    22
		DefaultPassiveLevel DefaultEdgeStyle DefaultBorderWidth
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
    23
		DefaultForegroundColor DefaultBackgroundColor
264
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    24
		DefaultDisabledForegroundColor DefaultDisabledBackgroundColor
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
    25
		DefaultDisabledEtchedForegroundColor
264
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    26
		DefaultEnteredForegroundColor DefaultEnteredBackgroundColor
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    27
		DefaultActiveForegroundColor DefaultActiveBackgroundColor
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    28
		DefaultReturnButtonHasImage DefaultReturnButtonHasBorder
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    29
		DefaultShadowColor DefaultLightColor DefaultHalfShadowColor
2137
2642e627bb2a eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents: 2078
diff changeset
    30
		DefaultHalfLightColor DefaultFocusHighlightStyle'
264
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    31
	poolDictionaries:''
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
    32
	category:'Views-Interactors'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    33
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    34
850
11c857edb53b comment
Claus Gittinger <cg@exept.de>
parents: 800
diff changeset
    35
!Button class methodsFor:'documentation'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    36
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    37
actionBlocksVersusModelChanges 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    38
"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    39
    You may ask yourself, why ST/X supports two different ways
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    40
    to trigger a buttons action (also true for sliders, selectionInListViews,
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    41
    toggles etc.) and when to use which mechanism.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    42
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    43
    There are two reasons:
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    44
	1) history - historically, ST/X used only actionBlocks
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    45
	   Basically, these provide the most general functionality
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    46
	   (you can of course send change-messages from those blocks)
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    47
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    48
	   Change-message notification was added later, to make porting
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    49
	   of existing applications easier.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    50
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    51
	2) for many (simple) applications, it is often easier, to simply
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    52
	   define an action block. This is especially true, if the button
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    53
	   triggers some action (such as ok-/abort-buttons) and does NOT
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    54
	   change some models internal value.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    55
	   (other smalltalks provide extra adapter-models for this,
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    56
	    in which you can set actionBlocks in much the same way).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    57
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    58
    In general:
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    59
	use model-change-messages, iff multiple views are possibly open
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    60
	on the same domain model, and changes can occur from multiple
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    61
	places. Or if a change has to be forwarded to multiple other objects
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    62
	(possible not foreseen).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    63
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    64
	For simplicity, better use actionBlocks for trigger-like actions
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    65
	(such as closing a view, ok/abort etc.) iff there is only a single
258
ae4b8f1a6738 interest is written with one 'r' (shame on me)
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
    66
	entity which is interested in that button press.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    67
"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    68
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
    69
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    70
copyright
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    71
"
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    72
 COPYRIGHT (c) 1989 by Claus Gittinger
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
    73
	      All Rights Reserved
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    74
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    75
 This software is furnished under a license and may be used
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    76
 only in accordance with the terms of that license and with the
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    77
 inclusion of the above copyright notice.   This software may not
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    78
 be provided or otherwise made available to, or used by, any
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    79
 other person.  No title to or ownership of the software is
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    80
 hereby transferred.
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    81
"
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    82
!
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
    83
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    84
documentation
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    85
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    86
    Buttons are Labels which do something when pressed/released.
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
    87
    Since they inherit from Label, read the documentation on Labels to 
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
    88
    see how color, layout, font, image or labelString are changed.
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
    89
133
claus
parents: 131
diff changeset
    90
    Buttons (and also instances of subclasses, such as toggles, checkToggles
claus
parents: 131
diff changeset
    91
    and radioButtons) perform some action when pressed, and optionally when
claus
parents: 131
diff changeset
    92
    released. Due to historic reasons, ST/X buttons support two mechanisms:
claus
parents: 131
diff changeset
    93
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
    94
    Actionblock operation:
133
claus
parents: 131
diff changeset
    95
      the button has an actionBlock (actually, it has two: a pressAction and
claus
parents: 131
diff changeset
    96
      a releaseAction) which is evaluated, when the button is pressed.
claus
parents: 131
diff changeset
    97
      The user of a button can set these action blocks via the #action:,
claus
parents: 131
diff changeset
    98
      #pressAction: or #releaseAction: messages.
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
    99
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   100
    Model-View interaction:
133
claus
parents: 131
diff changeset
   101
      buttons with a model will send change-messages to the model and also react 
claus
parents: 131
diff changeset
   102
      to changes in the model.
claus
parents: 131
diff changeset
   103
      You have to define the buttons labelMessage and an aspectSymbol.
claus
parents: 131
diff changeset
   104
      When changed, the model should send 'self changed:<aspect>' if it wants the
claus
parents: 131
diff changeset
   105
      label to change and return a string from the labelSymbol-message.
118
claus
parents: 113
diff changeset
   106
      By default, the labelMsg is nil, therefore no update of the label is done.
claus
parents: 113
diff changeset
   107
      (this behavior is inherited from label, see documentation there)
claus
parents: 113
diff changeset
   108
133
claus
parents: 131
diff changeset
   109
      When pressed, the button sends a changeMessage to the model.
118
claus
parents: 113
diff changeset
   110
      If the changeMsg is for a one-argument message, the current
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   111
      press-state is passed as argument (i.e. true if pressed, false if released).
118
claus
parents: 113
diff changeset
   112
      By default, the change-Message is #value: (for ST-80 compatibility).
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   113
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   114
        button model:aModel.
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   115
        button aspect:aspectSymbol.
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   116
        button change:changeSymbol.
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   117
        button labelMessage:labelSymbol.
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   118
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   119
        model sends #changed:aspectSymbol
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   120
        ---> button will redraw its label from value returned by model>>labelSymbol
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   121
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   122
        button changes state:
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   123
        ---> button sends changeSymbol / changeSymbol:state to the model
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   124
118
claus
parents: 113
diff changeset
   125
      By default (as inherited), the labelMsg is nil; therefore, buttons
claus
parents: 113
diff changeset
   126
      do not try to aquire a new labelString from the model.
claus
parents: 113
diff changeset
   127
      If you want this behavior, you must set labelMsg and aspectMsg
claus
parents: 113
diff changeset
   128
      as appropriate.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   129
133
claus
parents: 131
diff changeset
   130
    See examples.
claus
parents: 131
diff changeset
   131
claus
parents: 131
diff changeset
   132
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   133
    [Instance variables:]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   134
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
   135
      activeLogo              <StringOrImage> logo to show when active (pressed)
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
   136
      passiveLogo             <StringOrImage> logo to show when passive (released)
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   137
                                              default is nil for both, so the normal logo is used
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   138
                                              (see superclass: Label)
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   139
      onLevel                 <Integer>       level when pressed (3D only) (default: depends on style)
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   140
      offLevel                <Integer>       level when released (3D only) (default: depends on style)
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   141
      disabledFgColor         <Color>         color used to draw logo when disabled (default: depends on style)
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   142
      activeFgColor           <Color>         color to draw logo when pressed (default: depends on style)
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   143
      activeBgColor           <Color>         bg color when pressed (default: depends on style)
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   144
      enteredFgColor          <Color>         fg color to draw logo when cursor entered (default: depends on style)
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   145
      enteredBgColor          <Color>         bg color when cursor entered (default: depends on style)
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   146
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   147
      isReturnButton          <Boolean>       true if this button is also activated by the
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   148
                                              return key - if true, it will draw a return-bitmap 
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   149
                                              in addition to the logo (default: false)
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   150
1051
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
   151
      defaultable	      <Boolean>	      true, if this button can become a returnButton.
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
   152
					      (computes its default extent differently)
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
   153
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
   154
      shadowForm              <Form>          form to display in addition to buttons label (returnbutton only)
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
   155
      lightForm               <Form>          light part of shadowForm (returnbutton only)
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
   156
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
   157
      formColor               <Color>         color to draw form with (returnbutton only)
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
   158
      formShadowColor         <Color>         color for shadowing the form (3D only & return)
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   159
      formLightColor          <Color>         color for lighting the form (3D only)
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   160
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   161
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   162
    [styleSheet parameters:]
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   163
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   164
      buttonActiveLevel       <Integer>       level when on (ignored in 2D styles)
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   165
      buttonPassiveLevel      <Integer>       level when off (ignored in 2D styles)
74
9d0d6a11939e last version before introduction of controller
claus
parents: 62
diff changeset
   166
      buttonBorderWidth       <Integer>       default borderwidth
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   167
      buttonEdgeStyle         <Symbol>        style of edges (currently #soft or nil)
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   168
      buttonFont              <Font>          font to use for textual labels
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   169
      buttonForegroundColor   <Color>         color to draw foreground pixels (i.e. the string)
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   170
      buttonBackgroundColor   <Color>         color to draw background pixels
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   171
      buttonDisabledForegroundColor <Color>   same when disabled
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   172
      buttonDisabledBackgroundColor <Color>   same when disabled
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   173
      buttonEnteredForegroundColor  <Color>   same when mouse pointer is in
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   174
      buttonEnteredBackgroundColor  <Color>   same when mouse pointer is in
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   175
      buttonActiveForegroundColor   <Color>   same when button is active
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   176
      buttonActiveBackgroundColor   <Color>   same when button is active
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   177
      buttonShadowColor             <Color>   shadow color for edgaes (ignored in 2D styles)
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   178
      buttonLightColor              <Color>   light color for edgaes (ignored in 2D styles)
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   179
      buttonHalfShadowColor         <Color>   half shadow color; for soft edges only
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   180
      buttonHalfLightColor          <Color>   half light color; for soft edges only
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   181
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   182
      buttonReturnButtonHasImage    <Boolean> if true, return-buttons draw a return-key image
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   183
      buttonReturnButtonHasBorder   <Boolean> if true, return-buttons show a border
130
claus
parents: 128
diff changeset
   184
585
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   185
    [author:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   186
        Claus Gittinger
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   187
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   188
    [see also:]
8f395aba0173 documentation
Claus Gittinger <cg@exept.de>
parents: 440
diff changeset
   189
        Toggle CheckToggle CheckBox
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   190
        Dialog
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   191
        ValueHolder TriggerValue
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   192
        Block
133
claus
parents: 131
diff changeset
   193
"
claus
parents: 131
diff changeset
   194
!
claus
parents: 131
diff changeset
   195
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   196
examples 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   197
"
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   198
    You dont have to normally care for all the internals 
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   199
    (they allow many variations though). 
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   200
    For buttons with a stringLabel, the typical use is:
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   201
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   202
        b := Button label:'some logo' in:aView.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   203
        b action:[ .. things to do, when pressed ... ]
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   204
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   205
    and for bitmap/image buttons its:
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   206
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   207
        b := Button label:someImage in:aView.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   208
        b action:[ .. things to do, when pressed ... ]
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   209
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   210
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   211
133
claus
parents: 131
diff changeset
   212
    Of course, you can also setup things the ST-80 way, in first
claus
parents: 131
diff changeset
   213
    creating the button and later add it to some superview:
claus
parents: 131
diff changeset
   214
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   215
        b := Button new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   216
        b label:someImage.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   217
        b action:[ .. things to do, when pressed ... ]
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   218
        ...
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   219
        aSuperView add:b in:<frameRectangle>.
118
claus
parents: 113
diff changeset
   220
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   221
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   222
    Although you can specify most of the look of a button,
133
claus
parents: 131
diff changeset
   223
    you should use the defaults in most applications.
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   224
    As you specify more things in your program, 
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   225
    the styleSheet settings are more and more ignored.
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   226
    Also, even though it might look fancy, colorful
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   227
    button panels are usually not a good GUI design;
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   228
    they will attract the users attention - possibly to things
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   229
    which are not worth it.
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   230
    Finally, if you use fancy colors, always think of those poor users
133
claus
parents: 131
diff changeset
   231
    without color displays - the styleSheet allows those people to adjust things,
130
claus
parents: 128
diff changeset
   232
    while hard-coded colors cannot be fixed without changing the code.
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   233
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   234
    a simple button with default settings and no action:
133
claus
parents: 131
diff changeset
   235
    (you may want to try it with different viewStyle settings in effect):
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   236
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   237
          |top b|
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   238
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   239
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   240
          top extent:100@100.
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   241
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   242
          b := Button in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   243
          b label:'hello'.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   244
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   245
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   246
                                                                        [exEnd]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   247
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   248
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   249
    give it some action (watch the transcript):
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   250
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   251
          |top b|
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   252
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   253
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   254
          top extent:100@100.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   255
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   256
          b := Button in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   257
          b label:'hello'.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   258
          b action:[Transcript flash].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   259
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   260
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   261
                                                                        [exEnd]
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   262
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   263
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   264
    there is also a combined instance creation message:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   265
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   266
          |top b|
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   267
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   268
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   269
          top extent:100@100.
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   270
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   271
          b := Button label:'hello' action:[Transcript flash] in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   272
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   273
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   274
                                                                        [exEnd]
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   275
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   276
133
claus
parents: 131
diff changeset
   277
    a return button
claus
parents: 131
diff changeset
   278
    (in dialogs, you should setup things to have the return-key perform
claus
parents: 131
diff changeset
   279
     the ok action, and mark the corresponding button as being a returnButton):
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   280
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   281
          |top b|
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   282
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   283
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   284
          top extent:100@100.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   285
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   286
          b := Button label:'hello' action:[Transcript flash] in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   287
          b beReturnButton.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   288
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   289
                                                                        [exEnd]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   290
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   291
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   292
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   293
    multiple buttons in a panel:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   294
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   295
          |top panel b1 b2 b3|
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   296
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   297
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   298
          top extent:300@100.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   299
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   300
          panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
133
claus
parents: 131
diff changeset
   301
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   302
          b1 := Button label:'one'   in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   303
          b2 := Button label:'two'   in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   304
          b3 := Button label:'three' action:[Transcript flash] in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   305
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   306
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   307
                                                                        [exEnd]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   308
133
claus
parents: 131
diff changeset
   309
claus
parents: 131
diff changeset
   310
claus
parents: 131
diff changeset
   311
    enabling/disabling buttons via explicit messages:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   312
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   313
          |top panel b1 b2 b3|
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   314
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   315
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   316
          top extent:300@100.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   317
          panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
133
claus
parents: 131
diff changeset
   318
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   319
          b1 := Button label:'enable'  action:[b3 enable] in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   320
          b2 := Button label:'disable' action:[b3 disable] in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   321
          b3 := Button label:'flash'   action:[Transcript flash] in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   322
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   323
                                                                        [exEnd]
133
claus
parents: 131
diff changeset
   324
claus
parents: 131
diff changeset
   325
claus
parents: 131
diff changeset
   326
claus
parents: 131
diff changeset
   327
    enabling/disabling buttons via implicit value change of a valueHolder:
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   328
    The two views are only indirectly coupled (via the valueHolder);
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   329
    not knowing about each other.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   330
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   331
          |top panel ena t b1 b2 b3 check|
133
claus
parents: 131
diff changeset
   332
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   333
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   334
          top extent:300@100.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   335
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   336
          panel := HorizontalPanelView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
133
claus
parents: 131
diff changeset
   337
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   338
          ena := false asValue.
133
claus
parents: 131
diff changeset
   339
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   340
          t := Toggle label:'enable' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   341
          t model:ena.
133
claus
parents: 131
diff changeset
   342
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   343
          b1 := Button label:'button1' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   344
          b1 controller enableChannel:ena.
133
claus
parents: 131
diff changeset
   345
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   346
          b2 := Button label:'button2' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   347
          b2 controller enableChannel:ena.
133
claus
parents: 131
diff changeset
   348
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   349
          b3 := Button label:'button3' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   350
          b3 controller enableChannel:ena.
133
claus
parents: 131
diff changeset
   351
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   352
          top open.
133
claus
parents: 131
diff changeset
   353
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   354
          check := CheckBox model:ena.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   355
          check label:'also enable'.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   356
          check extent:(check preferredExtent + (5@5)).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   357
          check open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   358
                                                                        [exEnd]
133
claus
parents: 131
diff changeset
   359
claus
parents: 131
diff changeset
   360
claus
parents: 131
diff changeset
   361
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   362
    changing colors:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   363
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   364
          |top b|
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   365
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   366
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   367
          top extent:100@100.
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   368
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   369
          b := Button label:'hello' in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   370
          b action:[Transcript flash].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   371
          b activeForegroundColor:(Color white).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   372
          b activeBackgroundColor:(Color red).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   373
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   374
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   375
                                                                        [exEnd]
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   376
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   377
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   378
    changing more colors:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   379
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   380
          |top b|
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   381
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   382
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   383
          top extent:100@100.
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   384
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   385
          b := Button label:'hello' in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   386
          b action:[Transcript flash].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   387
          b enteredForegroundColor:(Color red).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   388
          b enteredBackgroundColor:(b backgroundColor).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   389
          b activeForegroundColor:(Color white).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   390
          b activeBackgroundColor:(Color red).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   391
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   392
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   393
                                                                        [exEnd]
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   394
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   395
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   396
    button with an image and different colors:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   397
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   398
          |top b|
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   399
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   400
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   401
          top extent:100@100.
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   402
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   403
          b := Button in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   404
          b label:(Image fromFile:'bitmaps/SBrowser.xbm').
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   405
          b action:[Transcript flash].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   406
          b enteredForegroundColor:(Color green darkened).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   407
          b enteredBackgroundColor:(b backgroundColor).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   408
          b activeForegroundColor:(Color white).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   409
          b activeBackgroundColor:(Color red).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   410
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   411
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   412
                                                                        [exEnd]
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   413
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   414
118
claus
parents: 113
diff changeset
   415
    changing the image when pressed:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   416
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   417
          |top b|
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   418
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   419
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   420
          top extent:100@100.
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   421
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   422
          b := Button in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   423
          b passiveLogo:(Image fromFile:'bitmaps/SBrowser.xbm').
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   424
          b activeLogo:(Image fromFile:'bitmaps/CBrowser.xbm').
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   425
          b action:[Transcript flash].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   426
          b enteredForegroundColor:(Color red).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   427
          b enteredBackgroundColor:(b backgroundColor).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   428
          b activeForegroundColor:(Color white).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   429
          b activeBackgroundColor:(Color red).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   430
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   431
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   432
                                                                        [exEnd]
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   433
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   434
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   435
    well, even that is possible (but you should NEVER do it):
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   436
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   437
          |top b|
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   438
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   439
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   440
          top extent:100@100.
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   441
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   442
          b := Button in:top.
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
   443
          b passiveLogo:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_tools/email.xpm').
1153
3d8eb61fad06 examples updated
Claus Gittinger <cg@exept.de>
parents: 1094
diff changeset
   444
          b activeLogo:'start'.
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   445
          b action:[Transcript flash].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   446
          b enteredForegroundColor:(Color red).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   447
          b enteredBackgroundColor:(b backgroundColor).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   448
          b activeForegroundColor:(Color white).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   449
          b activeBackgroundColor:(Color red).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   450
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   451
                                                                        [exEnd]
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   452
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   453
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   454
    more playing with colors:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   455
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   456
          |top b|
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   457
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   458
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   459
          top extent:100@100.
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   460
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   461
          b := Button in:top.
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
   462
          b logo:(Image fromFile:'../../goodies/bitmaps/xbmBitmaps/TicTacToe.xbm').
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   463
          b action:[Transcript flash].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   464
          b foregroundColor:(Color red:0 green:80 blue:20) darkened.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   465
          b backgroundColor:(Color grey:10).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   466
          b enteredForegroundColor:(Color red).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   467
          b activeForegroundColor:(Color red).
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
   468
          b activeBackgroundColor:(Color grey:50).
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   469
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   470
                                                                        [exEnd]
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   471
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   472
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   473
    fire on press (buttons in scrollbars do this, while normal buttons
133
claus
parents: 131
diff changeset
   474
    fire on release).
claus
parents: 131
diff changeset
   475
    To give the user a chance to change her mind
claus
parents: 131
diff changeset
   476
    and leave the button without action, you should not change the default 
claus
parents: 131
diff changeset
   477
    behavior and NOT use triggerOnDown-buttons in most applications:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   478
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   479
          |top b|
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   480
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   481
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   482
          top extent:100@100.
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   483
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   484
          b := Button label:'hello' in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   485
          b controller beTriggerOnDown.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   486
          b action:[Transcript flash].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   487
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   488
                                                                        [exEnd]
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   489
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   490
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   491
    To implement fun buttons (for games, show-demos etc.), you can
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   492
    access all internal parameters (and not take the viewStyle defaults)
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   493
    as in:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   494
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   495
          |b granite light shadow|
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   496
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   497
          b := Button label:'a nice one ?'.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   498
          granite := Image fromFile:'bitmaps/granite_small.tiff'.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   499
          light := granite lightened.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   500
          shadow := granite darkened darkened.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   501
          b backgroundColor:granite.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   502
          b foregroundColor:Color white.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   503
          b shadowColor:shadow.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   504
          b lightColor:light.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   505
          b enteredBackgroundColor:light.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   506
          b enteredForegroundColor:Color black.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   507
          b activeLevel:-3; passiveLevel:5.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   508
          b extent:(200 @ 50).
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   509
          b open
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   510
                                                                         [exEnd]
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   511
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   512
    However, in your application, you may want to read those bitmaps only once
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   513
    during startup and cache them for later reuse in some class variable
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
   514
    (reading, lightning & darkening of images is a bit slow)
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   515
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   516
118
claus
parents: 113
diff changeset
   517
    ST/X Buttons allow simulation of the ST-80 MVC way of interacting.
claus
parents: 113
diff changeset
   518
    To do so, instead (or in addition) to defining actionBlocks, set the
127
claus
parents: 125
diff changeset
   519
    buttons model to have this be informed (in addition):
118
claus
parents: 113
diff changeset
   520
claus
parents: 113
diff changeset
   521
    Model-View interaction (ST-80 style):
claus
parents: 113
diff changeset
   522
    (have a look at the models values in the inspector, as the toggles change)
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   523
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   524
        |bool1 bool2 b1 b2 panel top|
118
claus
parents: 113
diff changeset
   525
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   526
        bool1 := ValueHolder newBoolean.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   527
        bool2 := ValueHolder newBoolean value:true.
118
claus
parents: 113
diff changeset
   528
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   529
        top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   530
        top extent:200@100.
118
claus
parents: 113
diff changeset
   531
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   532
        panel := HorizontalPanelView 
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   533
                  origin:0.0 @ 0.0 corner:1.0 @ 50 in:top.
118
claus
parents: 113
diff changeset
   534
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   535
        b1 := Toggle label:'eat me' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   536
        b1 model:bool1.
118
claus
parents: 113
diff changeset
   537
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   538
        b2 := Toggle label:'drink me' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   539
        b2 model:bool2.
118
claus
parents: 113
diff changeset
   540
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   541
        top open.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   542
        bool1 inspect.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   543
        bool2 inspect.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   544
                                                                        [exEnd]
118
claus
parents: 113
diff changeset
   545
133
claus
parents: 131
diff changeset
   546
118
claus
parents: 113
diff changeset
   547
    Using a PluggableAdaptor (ST-80 style):
claus
parents: 113
diff changeset
   548
    (notice, that this is almost what ST/X buttons did originally,
127
claus
parents: 125
diff changeset
   549
     therefore, you may want use actionBlocks right away ...)
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   550
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   551
          |adaptor1 adaptor2 b1 b2 panel top|
118
claus
parents: 113
diff changeset
   552
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   553
          adaptor1 := PluggableAdaptor new 
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   554
                            getBlock:[:m | false] 
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   555
                            putBlock:[:m :v | Transcript showCR:'eat']
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   556
                            updateBlock:nil.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   557
          adaptor2 := PluggableAdaptor new 
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   558
                            getBlock:[:m | false] 
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   559
                            putBlock:[:m :v | Transcript showCR:'drink']
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   560
                            updateBlock:nil.
118
claus
parents: 113
diff changeset
   561
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   562
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   563
          top extent:200@100.
118
claus
parents: 113
diff changeset
   564
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   565
          panel := HorizontalPanelView 
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   566
                    origin:0.0 @ 0.0 corner:1.0 @ 50 in:top.
118
claus
parents: 113
diff changeset
   567
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   568
          b1 := Button label:'eat me' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   569
          b1 model:adaptor1.
118
claus
parents: 113
diff changeset
   570
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   571
          b2 := Button label:'drink me' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   572
          b2 model:adaptor2.
118
claus
parents: 113
diff changeset
   573
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   574
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   575
                                                                        [exEnd]
118
claus
parents: 113
diff changeset
   576
claus
parents: 113
diff changeset
   577
claus
parents: 113
diff changeset
   578
    as a reminder, the corresponding ST/X setup is:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   579
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   580
          |b1 b2 panel top|
118
claus
parents: 113
diff changeset
   581
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   582
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   583
          top extent:200@100.
118
claus
parents: 113
diff changeset
   584
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   585
          panel := HorizontalPanelView 
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   586
                    origin:0.0 @ 0.0 corner:1.0 @ 50 in:top.
118
claus
parents: 113
diff changeset
   587
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   588
          b1 := Button label:'eat me' in:panel.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   589
          b1 action:[Transcript showCR:'eat'].
118
claus
parents: 113
diff changeset
   590
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   591
          b2 := Button label:'drink me' in:panel.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   592
          b2 action:[Transcript showCR:'drink'].
118
claus
parents: 113
diff changeset
   593
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   594
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   595
                                                                        [exEnd]
118
claus
parents: 113
diff changeset
   596
claus
parents: 113
diff changeset
   597
130
claus
parents: 128
diff changeset
   598
    accessing multiple aspects of a complex model
claus
parents: 128
diff changeset
   599
    (using a plug here to simulate that model ...)
133
claus
parents: 131
diff changeset
   600
    (Notice, the next example shall demonstrate multiple aspects;
claus
parents: 131
diff changeset
   601
     for this kind of functionality, you'd better use actionBlocks in
claus
parents: 131
diff changeset
   602
     real applications)
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   603
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   604
          |myModel b1 b2 panel top|
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   605
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   606
          myModel := Plug new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   607
          myModel respondTo:#grow with:[top extent:200@300].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   608
          myModel respondTo:#shrink with:[top extent:200@100].
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   609
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   610
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   611
          top extent:200@100.
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   612
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   613
          panel := HorizontalPanelView 
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   614
                    origin:0.0 @ 0.0  
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   615
                    corner:1.0 @ 50
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   616
                    in:top.
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   617
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   618
          b1 := Button label:'eat me' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   619
          b1 model:myModel; change:#grow.
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   620
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   621
          b2 := Button label:'drink me' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   622
          b2 model:myModel; change:#shrink.
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   623
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   624
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   625
                                                                        [exEnd]
118
claus
parents: 113
diff changeset
   626
113
fdd18cfff57e *** empty log message ***
claus
parents: 97
diff changeset
   627
130
claus
parents: 128
diff changeset
   628
    aquiring the label from the model
claus
parents: 128
diff changeset
   629
    (this functionality is inherited from Label)
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   630
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   631
          |myModel b1 b2 b3 panel top currentLabel|
130
claus
parents: 128
diff changeset
   632
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   633
          currentLabel := 'foo'.
130
claus
parents: 128
diff changeset
   634
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   635
          myModel := Plug new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   636
          myModel respondTo:#getLabel with:[currentLabel].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   637
          myModel respondTo:#b0Pressed with:[].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   638
          myModel respondTo:#b1Pressed with:[currentLabel := 'bar'.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   639
                                             myModel changed:#labelAspect].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   640
          myModel respondTo:#b2Pressed with:[currentLabel := 'foo'.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   641
                                             myModel changed:#labelAspect].
130
claus
parents: 128
diff changeset
   642
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   643
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   644
          top extent:300@100.
130
claus
parents: 128
diff changeset
   645
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   646
          panel := HorizontalPanelView 
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   647
                    origin:0.0 @ 0.0  
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   648
                    corner:1.0 @ 50
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   649
                    in:top.
130
claus
parents: 128
diff changeset
   650
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   651
          b1 := Button label:'press me' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   652
          b1 model:myModel; change:#b0Pressed; 
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   653
             labelMessage:#getLabel; aspect:#labelAspect.
130
claus
parents: 128
diff changeset
   654
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   655
          b2 := Button label:'press for bar' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   656
          b2 model:myModel; change:#b1Pressed.
130
claus
parents: 128
diff changeset
   657
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   658
          b3 := Button label:'press for foo' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   659
          b3 model:myModel; change:#b2Pressed.
130
claus
parents: 128
diff changeset
   660
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   661
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   662
                                                                        [exEnd]
130
claus
parents: 128
diff changeset
   663
133
claus
parents: 131
diff changeset
   664
claus
parents: 131
diff changeset
   665
    the same, using actionBlocks:
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   666
    (notice, that we must disable changeMessages from the first button).
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   667
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   668
          |myModel b1 b2 b3 panel top currentLabel|
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   669
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   670
          currentLabel := 'foo'.
133
claus
parents: 131
diff changeset
   671
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   672
          myModel := Plug new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   673
          myModel respondTo:#getLabel with:[currentLabel].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   674
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   675
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   676
          top extent:300@100.
133
claus
parents: 131
diff changeset
   677
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   678
          panel := HorizontalPanelView origin:0.0 @ 0.0 corner:1.0 @ 50 in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   679
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   680
          b1 := Button label:'press me' in:panel.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   681
          b1 model:myModel; action:[Transcript showCR:'pressed']; 
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   682
             labelMessage:#getLabel; aspect:#labelAspect; change:nil.
133
claus
parents: 131
diff changeset
   683
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   684
          b2 := Button label:'press for bar' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   685
          b2 action:[currentLabel := 'bar'. myModel changed:#labelAspect].
133
claus
parents: 131
diff changeset
   686
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   687
          b3 := Button label:'press for foo' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   688
          b3 action:[currentLabel := 'foo'. myModel changed:#labelAspect].
133
claus
parents: 131
diff changeset
   689
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   690
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   691
                                                                        [exEnd]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   692
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   693
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   694
    the same, using a labelChannel:
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   695
                                                                        [exBegin]
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   696
          |b1 b2 b3 panel top labelHolder|
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   697
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   698
          labelHolder := 'press me' asValue.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   699
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   700
          top := StandardSystemView new.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   701
          top extent:350@100.
133
claus
parents: 131
diff changeset
   702
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   703
          panel := HorizontalPanelView origin:0.0 @ 0.0 corner:1.0 @ 50 in:top.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   704
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   705
          b1 := Button label:'none yet ' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   706
          b1 labelChannel:labelHolder.
655
acad3ef3a46c showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 610
diff changeset
   707
          b1 action:[Transcript showCR:'pressed'].
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   708
          b1 sizeFixed:true.
133
claus
parents: 131
diff changeset
   709
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   710
          b2 := Button label:'press for bar' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   711
          b2 action:[ labelHolder value:'bar' ].
133
claus
parents: 131
diff changeset
   712
420
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   713
          b3 := Button label:'press for foo' in:panel.
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   714
          b3 action:[ labelHolder value:'foo' ].
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   715
e57314f0ceb7 examples
Claus Gittinger <cg@exept.de>
parents: 392
diff changeset
   716
          top open.
593
86dd024ed773 examples
Claus Gittinger <cg@exept.de>
parents: 585
diff changeset
   717
                                                                        [exEnd]
133
claus
parents: 131
diff changeset
   718
88
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   719
    see 'doc/coding-examples' and 'doc/misc/quick_view_intro.doc' 
7560534e9026 *** empty log message ***
claus
parents: 82
diff changeset
   720
    for more variations on this theme.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   721
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   722
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   723
850
11c857edb53b comment
Claus Gittinger <cg@exept.de>
parents: 800
diff changeset
   724
!Button class methodsFor:'instance creation'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   725
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   726
abortButton
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   727
    "since abort-buttons are very common, here is a convenient
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   728
     method to create one ..."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   729
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   730
    |aButton|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   731
3277
065e0d75a384 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
   732
    aButton := Button label:(self classResources string:'Cancel').
3839
5cbf92d3aa64 name for okButton and abortButton
fm
parents: 3758
diff changeset
   733
    aButton name: 'abortButton'.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   734
    aButton cursor:(Cursor thumbsDown).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   735
    ^ aButton
366
27bf7d05650b renamed abort-button to cancel
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   736
27bf7d05650b renamed abort-button to cancel
Claus Gittinger <cg@exept.de>
parents: 346
diff changeset
   737
    "Modified: 20.2.1996 / 20:20:16 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   738
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   739
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   740
abortButtonIn:aView
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   741
    "since abort-buttons are very common, here is a convenient
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   742
     method to create one ..."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   743
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   744
    |b|
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   745
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   746
    aView addSubView:(b := self abortButton). 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   747
    ^ b
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   748
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   749
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   750
form:aForm action:aBlock in:aView
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   751
    "create and return a new Button with icon-label, aForm
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   752
     and pressAction, aBlock.  Button is placed into aView.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   753
     OBSOLETE: this is for backward compatibility; 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   754
     you can now pass an image or form in the #label:action:in: message."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   755
2971
7a54d308f3ac Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   756
    <resource:#obsolete>
7a54d308f3ac Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
   757
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   758
    ^ ((self in:aView) form:aForm) action:aBlock
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   759
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   760
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   761
label:aLabel action:aBlock
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   762
    "create and return a new Button with text-label, aString
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   763
     and pressAction, aBlock."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   764
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   765
    ^ (self label:aLabel) action:aBlock
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   766
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   767
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   768
label:aLabel action:aBlock in:aView
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   769
    "create and return a new Button with text-label, aString
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   770
     and pressAction, aBlock.  Button is placed into aView."
60
f3c738c24ce6 mostly style
claus
parents: 59
diff changeset
   771
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   772
    ^ ((self in:aView) label:aLabel) action:aBlock
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   773
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   774
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   775
okButton
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   776
    "since ok-buttons are very common, here is a convenient
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   777
     method to create one ..."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   778
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   779
    |aButton|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   780
3277
065e0d75a384 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 3122
diff changeset
   781
    aButton := Button label:(self classResources string:'OK').
3839
5cbf92d3aa64 name for okButton and abortButton
fm
parents: 3758
diff changeset
   782
    aButton name: 'okButton'.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   783
    aButton cursor:(Cursor thumbsUp).
219
dc928d57d5e9 added beReturnButton
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   784
    aButton beReturnButton.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   785
    ^ aButton
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
   786
!
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
   787
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   788
okButtonIn:aView
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   789
    "since ok-buttons are very common, here is a convenient
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   790
     method to create one ..."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   791
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   792
    |b|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   793
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   794
    aView addSubView:(b := self okButton).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   795
    ^ b
1196
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   796
! !
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   797
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   798
!Button class methodsFor:'ST-80 instance creation'!
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   799
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   800
switch
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   801
    "ST-80 compatibility: create & return a new radioButton"
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   802
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   803
    ^ RadioButton new.
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   804
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   805
    "Created: 18.4.1997 / 20:19:09 / cg"
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   806
    "Modified: 18.4.1997 / 20:28:10 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   807
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   808
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   809
toggle
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   810
    "ST-80 compatibility: create & return a new toggle."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   811
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   812
    ^ Toggle new
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   813
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   814
    "
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   815
     Button toggle label:'press me';
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   816
		   model:((PluggableAdaptor on:(Point new))
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   817
			    getSelector:#x putSelector:#x:)
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   818
    "
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   819
    "this is the same as"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   820
    "
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   821
     Toggle new label:'press me';
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   822
		model:((PluggableAdaptor on:(Point new))
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   823
			    getSelector:#x putSelector:#x:)
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   824
    "
1196
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   825
!
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   826
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   827
trigger
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   828
    "ST-80 compatibility: create & return a new button, which
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   829
     triggers on press."
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   830
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   831
    |b|
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   832
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   833
    b := Button new.
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   834
    b controller beTriggerOnDown.
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   835
    ^ b
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   836
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   837
    "Created: 18.4.1997 / 19:55:57 / cg"
42a10a56d284 added #switch & #trigger for ST-80 compatibility
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   838
    "Modified: 18.4.1997 / 19:56:52 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   839
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   840
850
11c857edb53b comment
Claus Gittinger <cg@exept.de>
parents: 800
diff changeset
   841
!Button class methodsFor:'defaults'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   842
1595
be3e49c260f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1594
diff changeset
   843
defaultDisabledForegroundColor
be3e49c260f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1594
diff changeset
   844
    ^  DefaultDisabledForegroundColor
be3e49c260f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1594
diff changeset
   845
be3e49c260f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1594
diff changeset
   846
    "Created: / 20.6.1998 / 15:18:28 / cg"
be3e49c260f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1594
diff changeset
   847
!
be3e49c260f6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1594
diff changeset
   848
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   849
returnFormOn:aDevice
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   850
    "return the form used for the return arrow in non-3D;
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   851
     cache the one for Display for the next round."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   852
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   853
    |f|
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   854
781
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   855
    (ReturnForm notNil and:[aDevice == ReturnForm graphicsDevice]) ifTrue:[
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   856
        ^ ReturnForm
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   857
    ].
2078
e0a827ea87db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2056
diff changeset
   858
    f := Smalltalk imageFromFileNamed:'Return.xbm' inPackage:#'stx:libwidg'.
2056
4b107f0ab7eb try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
   859
    f notNil ifTrue:[
4b107f0ab7eb try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
   860
        f := f onDevice:aDevice
4b107f0ab7eb try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
   861
    ] ifFalse:[
1387
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
   862
        f := Form width:24 height:14 fromArray:#[2r00000000 2r00000000 2r00000000
781
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   863
                                                 2r00000000 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   864
                                                 2r00000000 2r00000011 2r11100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   865
                                                 2r00000001 2r10000011 2r11100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   866
                                                 2r00000011 2r10000011 2r11100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   867
                                                 2r00000111 2r11111111 2r11100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   868
                                                 2r00001111 2r11111111 2r11100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   869
                                                 2r00011111 2r11111111 2r11100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   870
                                                 2r00001111 2r11111111 2r11100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   871
                                                 2r00000111 2r11111111 2r11100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   872
                                                 2r00000011 2r10000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   873
                                                 2r00000001 2r10000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   874
                                                 2r00000000 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   875
                                                 2r00000000 2r00000000 2r00000000]
3484
8340f372a1a2 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 3277
diff changeset
   876
                                              onDevice:aDevice
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   877
    ].
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   878
    ReturnForm := f.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   879
    ^ f
781
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   880
1387
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
   881
    "Modified: / 3.11.1997 / 09:12:37 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   882
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   883
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   884
returnLightFormOn:aDevice
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   885
    "return the form used for the return arrow light pixels (3D only);
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   886
     cache the one for Display for the next round"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   887
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   888
    |f|
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   889
781
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   890
    (ReturnLightForm notNil and:[aDevice == ReturnLightForm graphicsDevice]) ifTrue:[
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   891
        ^ ReturnLightForm
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   892
    ].
2078
e0a827ea87db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2056
diff changeset
   893
    f := Smalltalk imageFromFileNamed:'ReturnLight.xbm' inPackage:#'stx:libwidg'.
2056
4b107f0ab7eb try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
   894
    f notNil ifTrue:[
4b107f0ab7eb try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
   895
        f := f onDevice:aDevice
4b107f0ab7eb try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
   896
    ] ifFalse:[
1387
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
   897
        f := Form width:24 height:14 fromArray:#[2r00000000 2r00000000 2r00000000
781
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   898
                                                 2r00000000 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   899
                                                 2r00000000 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   900
                                                 2r00000000 2r00000000 2r00100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   901
                                                 2r00000000 2r00000000 2r00100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   902
                                                 2r00000000 2r00000000 2r00100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   903
                                                 2r00000000 2r00000000 2r00100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   904
                                                 2r00000000 2r00000000 2r00100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   905
                                                 2r00000000 2r00000000 2r00100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   906
                                                 2r00000000 2r11111111 2r11100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   907
                                                 2r00000000 2r10000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   908
                                                 2r00000000 2r10000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   909
                                                 2r00000000 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   910
                                                 2r00000000 2r00000000 2r00000000]
3484
8340f372a1a2 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 3277
diff changeset
   911
                                              onDevice:aDevice
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   912
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   913
    ReturnLightForm := f.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   914
    ^ f
781
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   915
1387
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
   916
    "Modified: / 3.11.1997 / 09:12:23 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   917
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   918
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   919
returnShadowFormOn:aDevice
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   920
    "return the form used for the return arrow shadow pixels (3D only);
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   921
     cache the one for Display for the next round."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   922
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   923
    |f|
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   924
781
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   925
    (ReturnShadowForm notNil and:[aDevice == ReturnShadowForm graphicsDevice]) ifTrue:[
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   926
        ^ ReturnShadowForm
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   927
    ].
2078
e0a827ea87db *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2056
diff changeset
   928
    f := Smalltalk imageFromFileNamed:'ReturnShadow.xbm' inPackage:#'stx:libwidg'.
2056
4b107f0ab7eb try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
   929
    f notNil ifTrue:[
4b107f0ab7eb try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
   930
        f := f onDevice:aDevice
4b107f0ab7eb try bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
   931
    ] ifFalse:[
1387
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
   932
        f := Form width:24 height:14 fromArray:#[2r00000000 2r00000000 2r00000000
781
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   933
                                                 2r00000000 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   934
                                                 2r00000000 2r00000011 2r11100000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   935
                                                 2r00000001 2r10000010 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   936
                                                 2r00000010 2r10000010 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   937
                                                 2r00000100 2r11111110 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   938
                                                 2r00001000 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   939
                                                 2r00010000 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   940
                                                 2r00001000 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   941
                                                 2r00000100 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   942
                                                 2r00000010 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   943
                                                 2r00000001 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   944
                                                 2r00000000 2r00000000 2r00000000
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   945
                                                 2r00000000 2r00000000 2r00000000]
3484
8340f372a1a2 Use Form class>>#width:height:fromArray:onDevice: instead of obsolete
Stefan Vogel <sv@exept.de>
parents: 3277
diff changeset
   946
                                              onDevice:aDevice
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   947
    ].
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
   948
    ReturnShadowForm := f.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   949
    ^ f
781
51741bd620ab use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 761
diff changeset
   950
1387
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
   951
    "Modified: / 3.11.1997 / 09:12:11 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   952
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   953
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   954
updateStyleCache
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
   955
    "extract values from the styleSheet and cache them in class variables"
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
   956
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   957
    <resource: #style (#'button.edgeStyle' #'button.font' #'button.borderWidth'
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   958
                       #'button.activeLevel' #'button.passiveLevel'
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   959
                       #'button.backgroundColor' #'button.foregroundColor'
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   960
                       #'button.activeBackgroundColor' #'button.activeForegroundColor'
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   961
                       #'button.enteredBackgroundColor' #'button.enteredForegroundColor'
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   962
                       #'button.disabledForegroundColor' #'button.disabledBackgroundColor'
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
   963
                       #'button.disabledEtchedForegroundColor' 
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   964
                       #'button.returnButtonHasImage'
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   965
                       #'button.returnButtonHasBorder' 
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   966
                       #'button.shadowColor' #'button.lightColor'
2137
2642e627bb2a eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents: 2078
diff changeset
   967
                       #'button.halfShadowColor' #'button.halfLightColor'
2642e627bb2a eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents: 2078
diff changeset
   968
                       #'focusHighlightStyle')>
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
   969
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   970
    |defaultLevel|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   971
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   972
    StyleSheet is3D ifTrue:[
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
   973
        defaultLevel := 1.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
   974
    ] ifFalse:[
440
2beb33cb0146 added style resource directive
Claus Gittinger <cg@exept.de>
parents: 420
diff changeset
   975
        defaultLevel := 0
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
   976
    ].
1866
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   977
    DefaultActiveLevel := StyleSheet at:#'button.activeLevel' default:(defaultLevel negated).
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   978
    DefaultPassiveLevel := StyleSheet at:#'button.passiveLevel' default:defaultLevel.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   979
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   980
    DefaultEdgeStyle := StyleSheet at:#'button.edgeStyle'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   981
    DefaultFont := StyleSheet fontAt:#'button.font'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   982
    DefaultBorderWidth := StyleSheet at:#'button.borderWidth'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   983
    DefaultForegroundColor := StyleSheet colorAt:#'button.foregroundColor'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   984
    DefaultBackgroundColor := StyleSheet colorAt:#'button.backgroundColor'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   985
    DefaultDisabledForegroundColor := StyleSheet colorAt:#'button.disabledForegroundColor' default:Color gray.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   986
    DefaultDisabledBackgroundColor := StyleSheet colorAt:#'button.disabledBackgroundColor'.
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
   987
    DefaultDisabledEtchedForegroundColor := StyleSheet colorAt:#'button.disabledEtchedForegroundColor'.
1866
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   988
    DefaultEnteredForegroundColor := StyleSheet colorAt:#'button.enteredForegroundColor'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   989
    DefaultEnteredBackgroundColor := StyleSheet colorAt:#'button.enteredBackgroundColor'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   990
    DefaultActiveForegroundColor := StyleSheet colorAt:#'button.activeForegroundColor'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   991
    DefaultActiveBackgroundColor := StyleSheet colorAt:#'button.activeBackgroundColor'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   992
    DefaultReturnButtonHasImage := StyleSheet at:#'button.returnButtonHasImage' default:true.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   993
    DefaultReturnButtonHasBorder := StyleSheet at:#'button.returnButtonHasBorder' default:false.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   994
    DefaultShadowColor := StyleSheet colorAt:#'button.shadowColor'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   995
    DefaultLightColor := StyleSheet colorAt:#'button.lightColor'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   996
    DefaultHalfShadowColor := StyleSheet colorAt:#'button.halfShadowColor'.
e022f4f77135 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1832
diff changeset
   997
    DefaultHalfLightColor := StyleSheet colorAt:#'button.halfLightColor'.
2137
2642e627bb2a eliminated styleSheet name = win95 queries
Claus Gittinger <cg@exept.de>
parents: 2078
diff changeset
   998
    DefaultFocusHighlightStyle := StyleSheet at:#'focusHighlightStyle'.
1355
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
   999
6725ab9cc6f5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1267
diff changeset
  1000
    "Modified: 20.10.1997 / 13:49:41 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1001
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1002
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1003
!Button methodsFor:'accessing-behavior'!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1004
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1005
action:aBlock
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1006
    "convenient method: depending on the setting of controllers triggerOnDown flag,
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1007
     either set the press-action and clear any release-action or
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1008
     vice versa, set the release-action and clear the press-action."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1009
2864
042251365010 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1010
    controller isNil ifTrue:[
042251365010 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1011
        'Button [error]: no controller in #action' errorPrintCR.
042251365010 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1012
    ] ifFalse:[
2515
6437799eada8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
  1013
        controller action:aBlock
2864
042251365010 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2671
diff changeset
  1014
    ].
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1015
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1016
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1017
autoRepeat
346
0f756ddc01bb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1018
    "turn on autorepeat OBSOLETE; use #autoRepeat:"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1019
2971
7a54d308f3ac Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
  1020
    <resource:#obsolete>
7a54d308f3ac Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 2913
diff changeset
  1021
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1022
    controller autoRepeat
346
0f756ddc01bb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1023
0f756ddc01bb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1024
    "Modified: 9.2.1996 / 22:42:37 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1025
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1026
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1027
autoRepeat:aBoolean
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1028
    "turn on/off autorepeat"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1029
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1030
    controller autoRepeat:aBoolean
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1031
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1032
    "Modified: 5.9.1995 / 22:06:13 / claus"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1033
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1034
264
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1035
enabled
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1036
    "return true if the button is enabled"
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1037
1812
e16f60e95217 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  1038
    ^ controller notNil and:[controller enabled]
264
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1039
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1040
    "Created: 17.12.1995 / 16:12:26 / cg"
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1041
!
b15f9244950b added enable-query method
Claus Gittinger <cg@exept.de>
parents: 258
diff changeset
  1042
1832
192a7e6fdbef Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1812
diff changeset
  1043
enabled:aBoolean
192a7e6fdbef Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1812
diff changeset
  1044
    "enable/disable the button"
192a7e6fdbef Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1812
diff changeset
  1045
2515
6437799eada8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
  1046
    controller notNil ifTrue:[
6437799eada8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
  1047
        controller enabled:aBoolean
6437799eada8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
  1048
    ]
1832
192a7e6fdbef Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1812
diff changeset
  1049
192a7e6fdbef Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1812
diff changeset
  1050
    "Created: / 30.3.1999 / 14:50:58 / stefan"
192a7e6fdbef Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1812
diff changeset
  1051
!
192a7e6fdbef Move common channels to View.
Stefan Vogel <sv@exept.de>
parents: 1812
diff changeset
  1052
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1053
pressAction
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1054
    "return the pressAction; thats the block which gets evaluated
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1055
     when the button is pressed (if non-nil)"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1056
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1057
    ^ controller pressAction
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1058
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1059
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1060
pressAction:aBlock
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1061
    "define the action to be performed on press"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1062
2515
6437799eada8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
  1063
    controller notNil ifTrue:[
6437799eada8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
  1064
        controller pressAction:aBlock
6437799eada8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
  1065
    ]
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1066
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1067
867
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1068
releaseAction
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1069
    "return the releaseAction; thats the block which gets evaluated
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1070
     when the button is relreased (if non-nil)"
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1071
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1072
    ^ controller releaseAction
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1073
!
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1074
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1075
releaseAction:aBlock
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1076
    "define the action to be performed on release"
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1077
2515
6437799eada8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
  1078
    controller notNil ifTrue:[
6437799eada8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
  1079
        controller releaseAction:aBlock
6437799eada8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2497
diff changeset
  1080
    ]
867
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1081
! !
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1082
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1083
!Button methodsFor:'accessing-channels'!
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1084
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1085
enableChannel
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1086
    "return a valueHolder for enable/disable"
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1087
1644
c2b849ce4552 care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents: 1630
diff changeset
  1088
    controller isNil ifTrue:[^ nil].
867
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1089
    ^ controller enableChannel
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1090
1644
c2b849ce4552 care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents: 1630
diff changeset
  1091
    "Modified: / 13.8.1998 / 12:04:46 / cg"
867
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1092
!
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1093
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1094
enableChannel:aValueHolderForBoolean
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1095
    "set the valueHolder used for enable/disable"
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1096
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1097
    controller enableChannel:aValueHolderForBoolean
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1098
!
3c2a15b41f56 category change
Claus Gittinger <cg@exept.de>
parents: 850
diff changeset
  1099
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1100
pressChannel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1101
    "return the pressChannel"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1102
1644
c2b849ce4552 care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents: 1630
diff changeset
  1103
    controller isNil ifTrue:[^ nil].
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1104
    ^ controller pressChannel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1105
1644
c2b849ce4552 care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents: 1630
diff changeset
  1106
    "Modified: / 7.9.1995 / 18:16:20 / claus"
c2b849ce4552 care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents: 1630
diff changeset
  1107
    "Modified: / 13.8.1998 / 12:04:51 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1108
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1109
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1110
pressChannel:aBlock
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1111
    "set the pressChannel"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1112
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1113
    controller pressChannel:aBlock
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1114
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1115
    "Modified: 7.9.1995 / 18:05:14 / claus"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1116
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1117
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1118
releaseChannel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1119
    "return the releaseChannel"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1120
1644
c2b849ce4552 care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents: 1630
diff changeset
  1121
    controller isNil ifTrue:[^ nil].
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1122
    ^ controller releaseChannel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1123
1644
c2b849ce4552 care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents: 1630
diff changeset
  1124
    "Modified: / 7.9.1995 / 18:15:24 / claus"
c2b849ce4552 care for non-existing controller when accessing channels.
Claus Gittinger <cg@exept.de>
parents: 1630
diff changeset
  1125
    "Modified: / 13.8.1998 / 12:04:55 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1126
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1127
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1128
releaseChannel:aBlock
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1129
    "set the releaseChannel"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1130
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1131
    controller releaseChannel:aBlock
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1132
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1133
    "Modified: 7.9.1995 / 18:05:21 / claus"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1134
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1135
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1136
!Button methodsFor:'accessing-look'!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1137
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1138
activeBackgroundColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1139
    "return the background color to be used when pressed"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1140
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1141
    ^ activeBgColor
164
Claus Gittinger <cg@exept.de>
parents: 163
diff changeset
  1142
!
Claus Gittinger <cg@exept.de>
parents: 163
diff changeset
  1143
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1144
activeBackgroundColor:aColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1145
    "set the background color to be used when pressed"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1146
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1147
    activeBgColor := aColor.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1148
    self redrawIfPressed
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1149
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1150
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1151
activeForegroundColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1152
    "return the foreground color to be used when pressed"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1153
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1154
    ^ activeFgColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1155
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1156
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1157
activeForegroundColor:aColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1158
    "set the foreground color to be used when pressed"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1159
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1160
    activeFgColor := aColor.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1161
    self redrawIfPressed
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1162
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1163
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1164
activeForegroundColor:fgColor backgroundColor:bgColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1165
    "set both fg and bg colors to be used when pressed"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1166
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1167
    activeFgColor := fgColor.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1168
    activeBgColor := bgColor.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1169
    self redrawIfPressed
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1170
!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1171
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1172
activeLevel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1173
    "return the level of the button when pressed"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1174
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1175
    ^ onLevel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1176
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1177
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1178
activeLevel:aNumber
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1179
    "set the level of the button when pressed (i.e. how deep)"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1180
1630
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1181
    onLevel ~~ aNumber ifTrue:[
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1182
        onLevel := aNumber.
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1183
        (controller notNil
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1184
        and:[controller pressed]) ifTrue:[
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1185
            self level:onLevel.
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1186
            margin := onLevel abs max:offLevel abs.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1187
            self invalidate. 
992
62c869350c73 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
  1188
        ]
1630
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1189
    ].
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1190
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1191
    "Modified: / 30.7.1998 / 22:29:01 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1192
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1193
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1194
activeLogo:anImageOrString
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1195
    "define the logo to be displayed while active -
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1196
     this is optional; the default is to display the same
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1197
     (logo) in both pressed and released states."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1198
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1199
    activeLogo := anImageOrString.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1200
    controller pressed ifTrue:[
3122
2b734c50d620 Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents: 3052
diff changeset
  1201
        self label:anImageOrString
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1202
    ]
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1203
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1204
3598
1d1a9f27dd20 allViewBackground: with optional condition
sr
parents: 3556
diff changeset
  1205
allViewBackground:something if:condition
1956
9467faaaf048 allViewBackground blocking moved from Label to here
Claus Gittinger <cg@exept.de>
parents: 1875
diff changeset
  1206
    "ignore here"
9467faaaf048 allViewBackground blocking moved from Label to here
Claus Gittinger <cg@exept.de>
parents: 1875
diff changeset
  1207
!
9467faaaf048 allViewBackground blocking moved from Label to here
Claus Gittinger <cg@exept.de>
parents: 1875
diff changeset
  1208
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1209
beImageButton
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1210
    "make mySelf an image button - that is turn off all levelChanges
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1211
     and logo spacing. This should be sent for buttons which use both
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1212
     passive and active logos, and the 3D effect comes from the bitmaps
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1213
     (i.e. windows buttons)."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1214
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1215
    self 
711
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1216
        extent:(labelWidth @ labelHeight);
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1217
        sizeFixed:true; 
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1218
        borderWidth:0;
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1219
        activeLevel:0; 
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1220
        passiveLevel:0; 
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1221
        horizontalSpace:0; 
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1222
        verticalSpace:0;
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1223
        newLayout.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1224
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1225
    "Created: 17.9.1995 / 20:41:47 / claus"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1226
    "Modified: 19.9.1995 / 16:34:08 / claus"
711
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1227
    "Modified: 28.5.1996 / 22:04:14 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1228
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1229
244
2f5faeddd130 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 232
diff changeset
  1230
beReturnButton
1051
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1231
    "show show a return-key image after the label.
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1232
     Same as 'isReturnButton:true' for ST-80 compatibility."
244
2f5faeddd130 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 232
diff changeset
  1233
2f5faeddd130 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 232
diff changeset
  1234
    self isReturnButton:true
2f5faeddd130 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 232
diff changeset
  1235
!
2f5faeddd130 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 232
diff changeset
  1236
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1237
beRoundRadioButton
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1238
    "setup myself for a round radioButton look.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1239
     this is a private method; do not use it. It is going to move into the
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1240
     RadioButton class."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1241
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1242
    self activeLogo:(Icon constantNamed:'RadioOn').
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1243
    self passiveLogo:(Icon constantNamed:'RadioOff').
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1244
    self activeLevel:0; 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1245
	 passiveLevel:0; 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1246
	 activeBackgroundColor:bgColor;
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1247
	 activeForegroundColor:fgColor;
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1248
	 borderWidth:0;
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1249
	 enteredBackgroundColor:bgColor.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1250
    self computeLabelSize.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1251
    self beImageButton.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1252
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1253
    "Created: 22.9.1995 / 15:48:05 / claus"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1254
    "Modified: 22.9.1995 / 17:07:46 / claus"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1255
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1256
1093
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1257
defaultable
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1258
    "return true, if the receiver is defaultable"
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1259
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1260
    ^ defaultable
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1261
!
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1262
1051
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1263
defaultable:aBoolean
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1264
    "set/clear the defaultable attribute. If defaultable,
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1265
     the preferredExtent is computed to include any additional
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1266
     space required when the receiver is a returnButton."
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1267
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1268
    defaultable ~~ aBoolean ifTrue:[
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1269
	defaultable := aBoolean.
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1270
	self newLayout
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1271
    ]
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1272
!
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1273
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1274
disabledForegroundColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1275
    "return the foreground color used when the button is disabled"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1276
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1277
    ^ disabledFgColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1278
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1279
2436
7c0da88f2af6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  1280
disabledForegroundColor:aColor
7c0da88f2af6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  1281
    "set the foreground color used when the button is disabled"
7c0da88f2af6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  1282
7c0da88f2af6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  1283
    disabledFgColor := aColor
7c0da88f2af6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  1284
!
7c0da88f2af6 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2415
diff changeset
  1285
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1286
disabledLogo:anImageOrString
2892
468c3ac7ed4a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2864
diff changeset
  1287
    "define the logo to be displayed while disabled -
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1288
     this is optional; the default is to display the same
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1289
     (logo) in both pressed and released states."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1290
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1291
    disabledLogo := anImageOrString.
2671
7fa1416edc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
  1292
    self enabled ifFalse:[
3122
2b734c50d620 Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents: 3052
diff changeset
  1293
        self label:anImageOrString
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1294
    ]
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1295
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1296
    "Created: 17.9.1995 / 19:50:17 / claus"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1297
    "Modified: 17.9.1995 / 19:50:34 / claus"
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1298
!
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1299
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1300
edgeStyle:aSymbol
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1301
    "set the edgestyle - currently only #soft or nil"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1302
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1303
    edgeStyle := aSymbol
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1304
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1305
1206
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1306
enterLevel
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1307
    "return the level to be used when the mouse
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1308
     pointer enters the button area"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1309
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1310
    ^ enterLevel
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1311
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1312
    "Created: 26.4.1997 / 20:48:53 / cg"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1313
    "Modified: 26.4.1997 / 20:49:29 / cg"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1314
!
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1315
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1316
enterLevel:aNumber
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1317
    "set the level to be used when the mouse
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1318
     pointer enters the button area"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1319
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1320
    enterLevel := aNumber
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1321
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1322
    "Created: 26.4.1997 / 20:49:10 / cg"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1323
    "Modified: 26.4.1997 / 20:49:35 / cg"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1324
!
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1325
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1326
enteredBackgroundColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1327
    "return the background color to be used when the mouse
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1328
     pointer enters the button area"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1329
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1330
    ^ enteredBgColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1331
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1332
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1333
enteredBackgroundColor:aColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1334
    "set the background color to be used when the mouse
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1335
     pointer enters the button area"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1336
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1337
    enteredBgColor := aColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1338
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1339
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1340
enteredForegroundColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1341
    "return the foreground color to be used when the mouse
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1342
     pointer enters the button area"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1343
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1344
    ^ enteredFgColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1345
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1346
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1347
enteredForegroundColor:aColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1348
    "set the foreground color to be used when the mouse
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1349
     pointer enters the button area"
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1350
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1351
    enteredFgColor := aColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1352
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1353
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  1354
enteredLogo:anImageOrString
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  1355
    "define the logo to be displayed while the mousePointer is in the button -
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  1356
     this is optional; the default is to display the same
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  1357
     (logo) in both entered and normal states."
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  1358
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  1359
    enteredLogo := anImageOrString.
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  1360
    controller entered ifTrue:[
3122
2b734c50d620 Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents: 3052
diff changeset
  1361
        self label:anImageOrString
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  1362
    ]
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  1363
!
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  1364
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1365
focusLogo:anImageOrString
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1366
    "define the logo to be displayed while active -
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1367
     this is optional; the default is to display the same
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1368
     (logo) in both pressed and released states."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1369
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1370
    focusLogo := anImageOrString.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1371
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1372
    "Created: 17.9.1995 / 19:50:17 / claus"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1373
    "Modified: 17.9.1995 / 20:00:43 / claus"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1374
!
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1375
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1376
isReturnButton:aBoolean
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1377
    "show/dont show a return-key image after the label"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1378
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1379
    isReturnButton ~~ aBoolean ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1380
	DefaultReturnButtonHasBorder ifTrue:[
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1381
	    self borderWidth:(aBoolean ifTrue:[1] ifFalse:[0])
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1382
	].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1383
	isReturnButton := aBoolean.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1384
	self newLayout
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1385
    ]
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1386
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1387
2309
dec2cce27586 shortcut-key support;
ca
parents: 2253
diff changeset
  1388
label:aStringOrImageOrForm
dec2cce27586 shortcut-key support;
ca
parents: 2253
diff changeset
  1389
    |xlatedLabel|
dec2cce27586 shortcut-key support;
ca
parents: 2253
diff changeset
  1390
dec2cce27586 shortcut-key support;
ca
parents: 2253
diff changeset
  1391
    xlatedLabel := self defineShortcutAndTranslateLabelStringFrom:aStringOrImageOrForm.
2415
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2309
diff changeset
  1392
    super label:xlatedLabel.
188fc1577a8d uppercase labels
Claus Gittinger <cg@exept.de>
parents: 2309
diff changeset
  1393
!
2309
dec2cce27586 shortcut-key support;
ca
parents: 2253
diff changeset
  1394
1206
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1395
leaveLevel
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1396
    "return the level to be used when the mouse
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1397
     pointer leaves the button area"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1398
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1399
    ^ leaveLevel
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1400
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1401
    "Created: 26.4.1997 / 20:48:26 / cg"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1402
    "Modified: 26.4.1997 / 20:49:47 / cg"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1403
!
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1404
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1405
leaveLevel:aNumber
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1406
    "set the level to be used when the mouse
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1407
     pointer leaves the button area"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1408
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1409
    leaveLevel := aNumber
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1410
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1411
    "Created: 26.4.1997 / 20:49:22 / cg"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1412
    "Modified: 26.4.1997 / 20:49:53 / cg"
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1413
!
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  1414
1094
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1415
loseDefault
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1416
    "ST-80 compatibility - clear isReturnButton attribute"
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1417
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1418
    self isReturnButton:false
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1419
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1420
    "Created: 3.3.1997 / 16:20:47 / cg"
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1421
    "Modified: 3.3.1997 / 18:12:06 / cg"
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1422
!
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1423
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1424
offLevel
3556
14bf0c73b00b Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3484
diff changeset
  1425
    <resource: #obsolete>
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1426
    "return the level of the button when released.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1427
     Historic leftover; use #passiveLevel."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1428
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1429
    ^ offLevel
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1430
!
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1431
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1432
offLevel:aNumber
3556
14bf0c73b00b Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3484
diff changeset
  1433
    <resource: #obsolete>
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1434
    "set the level of the button when released (i.e. how deep).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1435
     Historic leftover; use #passiveLevel:."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1436
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1437
    ^ self passiveLevel:aNumber
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1438
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1439
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1440
onLevel
3556
14bf0c73b00b Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3484
diff changeset
  1441
    <resource: #obsolete>
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1442
    "return the level of the button when pressed.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1443
     Historic leftover; use #activeLevel."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1444
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1445
    ^ onLevel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1446
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1447
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1448
onLevel:aNumber
3556
14bf0c73b00b Mark obsolete methods
Stefan Vogel <sv@exept.de>
parents: 3484
diff changeset
  1449
    <resource: #obsolete>
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1450
    "set the level of the button when pressed (i.e. how deep).
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1451
     Historic leftover; use #activeLevel:."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1452
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1453
    ^ self activeLevel:aNumber
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1454
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1455
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1456
passiveLevel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1457
    "return the level of the button when released"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1458
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1459
    ^ offLevel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1460
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1461
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1462
passiveLevel:aNumber
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1463
    "set the level of the button when not pressed (i.e. how high)"
118
claus
parents: 113
diff changeset
  1464
1630
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1465
    offLevel ~~ aNumber ifTrue:[
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1466
        offLevel := aNumber.
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1467
        (controller notNil
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1468
        and:[controller pressed not]) ifTrue:[
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1469
            self level:offLevel.
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1470
            margin := onLevel abs max:offLevel abs.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1471
            self invalidate.
992
62c869350c73 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
  1472
        ]
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1473
    ]
711
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  1474
1630
7e1f6d3e45f5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1595
diff changeset
  1475
    "Modified: / 30.7.1998 / 22:29:17 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1476
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1477
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1478
passiveLogo:anImageOrString
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1479
    "define the logo to be displayed while inactive -
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1480
     this is optional; the default is to display the same
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1481
     (logo) in both pressed and released states."
118
claus
parents: 113
diff changeset
  1482
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1483
    passiveLogo := anImageOrString.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1484
    controller pressed ifFalse:[
3122
2b734c50d620 Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents: 3052
diff changeset
  1485
        self label:anImageOrString
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1486
    ]
1094
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1487
!
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1488
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1489
takeDefault
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1490
    "ST-80 compatibility - set isReturnButton attribute"
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1491
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1492
    self isReturnButton:true
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1493
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1494
    "Created: 3.3.1997 / 16:20:52 / cg"
472652d88011 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1093
diff changeset
  1495
    "Modified: 3.3.1997 / 18:11:58 / cg"
1223
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1496
!
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1497
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1498
viewBackground:something
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1499
    super viewBackground:something.
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1500
    something isColor ifTrue:[
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1501
        device hasGrayscales ifTrue:[
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1502
            halfLightColor notNil ifTrue:[
1875
745aed60b0b2 when lighting/darkening colors, take the average in the topLeft
Claus Gittinger <cg@exept.de>
parents: 1866
diff changeset
  1503
                halfLightColor := (something averageColorIn:(0@0 corner:7@7)) lightened "on:device".
1223
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1504
            ].
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1505
            halfShadowColor notNil ifTrue:[
1875
745aed60b0b2 when lighting/darkening colors, take the average in the topLeft
Claus Gittinger <cg@exept.de>
parents: 1866
diff changeset
  1506
                halfShadowColor := (something averageColorIn:(0@0 corner:7@7)) darkened "on:device".
1223
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1507
            ]
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1508
        ]
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1509
    ].
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1510
840e31e3f140 care for halfLight & halfShadow, when the viewBackground changes.
Claus Gittinger <cg@exept.de>
parents: 1206
diff changeset
  1511
    "Modified: 3.5.1997 / 10:37:24 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1512
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1513
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1514
!Button methodsFor:'changing state'!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1515
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1516
toggle
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1517
    "toggle and perform the action"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1518
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1519
    controller toggle
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1520
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1521
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1522
toggleNoAction
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1523
    "toggle, but do NOT perform any action - can be used to change a toggle
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1524
     under program control (i.e. turn one toggle off from another one)"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1525
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1526
    controller toggleNoAction
118
claus
parents: 113
diff changeset
  1527
!
claus
parents: 113
diff changeset
  1528
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1529
turnOff
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1530
    "turn the button off (if not already off) do NOT perform actions/change notifications"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1531
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1532
    (controller notNil and:[controller pressed]) ifTrue:[
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1533
        offLevel ~~ level ifTrue:[
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1534
            self level:offLevel.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1535
        ].
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1536
        (passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[
3122
2b734c50d620 Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents: 3052
diff changeset
  1537
            self label:passiveLogo
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1538
        ].
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1539
        controller setPressed:false.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1540
        controller active:false.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1541
        level := offLevel.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1542
        margin := level abs.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1543
        self invalidate
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1544
    ]
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1545
992
62c869350c73 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
  1546
    "Modified: 8.2.1997 / 15:21:44 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1547
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1548
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1549
turnOffWithAction
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1550
    "turn the button off (if not already off) and perform any action/change notification"
118
claus
parents: 113
diff changeset
  1551
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1552
    (controller notNil and:[controller pressed]) ifTrue:[
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1553
        offLevel ~~ level ifTrue:[
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1554
            self level:offLevel.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1555
        ].
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1556
        (passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[
3122
2b734c50d620 Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents: 3052
diff changeset
  1557
            self label:passiveLogo
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1558
        ].
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1559
        self turnOffWithoutRedraw.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1560
        self invalidate
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1561
    ]
118
claus
parents: 113
diff changeset
  1562
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1563
    "Created: 15.11.1995 / 16:55:37 / cg"
992
62c869350c73 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
  1564
    "Modified: 8.2.1997 / 15:21:53 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1565
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1566
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1567
turnOffWithoutRedraw
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1568
    "turn the button off - no redraw but perform any action/change notification"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1569
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1570
    controller notNil ifTrue:[
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1571
        controller pressed:false.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1572
        controller active:false.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1573
    ].
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1574
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1575
    "do not use super level:offLevel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1576
     - because that one does redraw the edges.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1577
     Sure, this is no good coding style"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1578
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1579
    level := offLevel.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1580
    margin := level abs
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1581
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1582
    "Modified: 8.2.1996 / 15:28:53 / cg"
118
claus
parents: 113
diff changeset
  1583
!
claus
parents: 113
diff changeset
  1584
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1585
turnOn
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1586
    "turn the button on (if not already on) - do NOT perform any action/notification"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1587
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1588
    (controller notNil and:[controller pressed not]) ifTrue:[
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1589
        onLevel ~~ level ifTrue:[
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1590
            self level:onLevel.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1591
        ].
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1592
        (activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[
3122
2b734c50d620 Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents: 3052
diff changeset
  1593
            self label:activeLogo
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1594
        ].
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1595
        controller setPressed:true.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1596
        level := onLevel.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1597
        margin := level abs.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1598
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1599
        self invalidate
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1600
    ]
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1601
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1602
    "Created: 14.11.1995 / 22:00:45 / cg"
992
62c869350c73 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
  1603
    "Modified: 8.2.1997 / 15:22:01 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1604
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1605
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1606
turnOnWithAction
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1607
    "turn the button on (if not already on) and perform any change actions/notifications"
118
claus
parents: 113
diff changeset
  1608
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1609
    (controller notNil and:[controller pressed not]) ifTrue:[
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1610
        onLevel ~~ level ifTrue:[
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1611
            self level:onLevel.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1612
        ].
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1613
        (activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[
3122
2b734c50d620 Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents: 3052
diff changeset
  1614
            self label:activeLogo
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1615
        ].
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1616
        self turnOnWithoutRedraw.
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1617
        self invalidate
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1618
    ]
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1619
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1620
    "Created: 15.11.1995 / 16:55:56 / cg"
992
62c869350c73 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 959
diff changeset
  1621
    "Modified: 8.2.1997 / 15:22:09 / cg"
118
claus
parents: 113
diff changeset
  1622
!
claus
parents: 113
diff changeset
  1623
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1624
turnOnWithoutRedraw
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1625
    "turn the button on - no redraw but perform any change actions/notifications"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1626
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1627
    controller notNil ifTrue:[
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1628
        controller pressed:true.
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1629
    ].
118
claus
parents: 113
diff changeset
  1630
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1631
    "do not use super level:offLevel
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1632
     - because that one does redraw the edges.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1633
     Sure, this is no good coding style"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1634
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1635
    level := onLevel.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1636
    margin := level abs
328
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1637
6c4daccc6fb5 check for nil controller (turnOn/Off might be called after destroy)
Claus Gittinger <cg@exept.de>
parents: 315
diff changeset
  1638
    "Modified: 8.2.1996 / 15:29:23 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1639
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1640
1805
b555e7ddbeec comments
Claus Gittinger <cg@exept.de>
parents: 1782
diff changeset
  1641
!Button methodsFor:'focus handling'!
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1642
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
  1643
showFocus:explicit
1805
b555e7ddbeec comments
Claus Gittinger <cg@exept.de>
parents: 1782
diff changeset
  1644
    "the button got the keyboard focus 
1806
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
  1645
     (either explicit, via tabbing; or implicit, by pointer movement)
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
  1646
      - change any display attributes as req'd."
1805
b555e7ddbeec comments
Claus Gittinger <cg@exept.de>
parents: 1782
diff changeset
  1647
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1648
    focusLogo notNil ifTrue:[
2671
7fa1416edc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
  1649
        self enabled ifTrue:[
1170
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1650
            logo := focusLogo.  
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1651
            self invalidate.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1652
            ^ self.
1170
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1653
        ]
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1654
    ].
1681
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1655
    (styleSheet at:#'focus.showBorder' default:true) ifFalse:[
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1656
        self invalidate.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1657
        ^ self.
1681
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1658
    ].
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
  1659
    super showFocus:explicit
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1660
1681
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1661
    "Created: / 17.9.1995 / 19:58:50 / claus"
1721
f88dcfe07c87 removed some obsolete code.
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1662
    "Modified: / 19.11.1998 / 13:02:48 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1663
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1664
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
  1665
showNoFocus:explicit
1805
b555e7ddbeec comments
Claus Gittinger <cg@exept.de>
parents: 1782
diff changeset
  1666
    "the button lost the keyboard focus 
1806
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
  1667
     (either explicit, via tabbing; or implicit, by pointer movement)
fe6269361661 comment & category change
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
  1668
      - change any display attributes as req'd."
1805
b555e7ddbeec comments
Claus Gittinger <cg@exept.de>
parents: 1782
diff changeset
  1669
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1670
    focusLogo notNil ifTrue:[
1170
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1671
        disabledLogo notNil ifTrue:[
2671
7fa1416edc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
  1672
            self enabled ifTrue:[
1170
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1673
                logo := passiveLogo.  
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1674
            ] ifFalse:[
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1675
                logo := disabledLogo.  
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1676
            ].
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1677
        ] ifFalse:[
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1678
            logo := passiveLogo
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1679
        ].
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1680
        self invalidate.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1681
        ^ self
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1682
    ].
1681
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1683
    (styleSheet at:#'focus.showBorder' default:true) ifFalse:[
2913
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1684
        self invalidate.
bdf4fb09cfc0 invalidate checks itself for shown-flag
Claus Gittinger <cg@exept.de>
parents: 2892
diff changeset
  1685
        ^ self
1681
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1686
    ].
309
b5c9d68e95e1 new tabbing scheme (asking via #canTab); new focus change (passing explicit to showFocus/noFocus);
Claus Gittinger <cg@exept.de>
parents: 265
diff changeset
  1687
    super showNoFocus:explicit
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1688
1681
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1689
    "Created: / 17.9.1995 / 20:00:06 / claus"
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  1690
    "Modified: / 17.9.1995 / 20:26:32 / claus"
1721
f88dcfe07c87 removed some obsolete code.
Claus Gittinger <cg@exept.de>
parents: 1681
diff changeset
  1691
    "Modified: / 19.11.1998 / 13:02:44 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1692
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1693
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1694
!Button methodsFor:'initialization'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1695
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1696
defaultControllerClass
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1697
    ^ ButtonController
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1698
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1699
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  1700
fetchDeviceResources
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  1701
    "fetch device colors, to avoid reallocation at redraw time"
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  1702
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  1703
    super fetchDeviceResources.
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  1704
1995
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1705
    disabledFgColor notNil ifTrue:[disabledFgColor := disabledFgColor onDevice:device].
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
  1706
    disabledEtchedFgColor notNil ifTrue:[disabledEtchedFgColor := disabledEtchedFgColor onDevice:device].
1995
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1707
    activeFgColor notNil ifTrue:[activeFgColor := activeFgColor onDevice:device].
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1708
    activeBgColor notNil ifTrue:[activeBgColor := activeBgColor onDevice:device].
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1709
    enteredFgColor notNil ifTrue:[enteredFgColor := enteredFgColor onDevice:device].
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1710
    enteredBgColor notNil ifTrue:[enteredBgColor := enteredBgColor onDevice:device].
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1711
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1712
    formColor notNil ifTrue:[formColor := formColor onDevice:device].
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1713
    formLightColor notNil ifTrue:[formLightColor := formLightColor onDevice:device].
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1714
    formShadowColor notNil ifTrue:[formShadowColor := formShadowColor onDevice:device].
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1715
    halfShadowColor notNil ifTrue:[halfShadowColor := halfShadowColor onDevice:device].
cbbe9d803139 #on: -> #onDevice:
Claus Gittinger <cg@exept.de>
parents: 1956
diff changeset
  1716
    halfLightColor notNil ifTrue:[halfLightColor := halfLightColor onDevice:device].
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  1717
945
6888e5b26b47 fetch device resources early
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1718
    "Modified: 15.2.1997 / 17:14:16 / cg"
931
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  1719
!
a22726fd8e32 fetchDeviceResources added
Claus Gittinger <cg@exept.de>
parents: 899
diff changeset
  1720
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1721
initCursor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1722
    "set up a hand cursor"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1723
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1724
    cursor := Cursor hand
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1725
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1726
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1727
initEvents
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1728
    super initEvents.
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1729
    self enableEnterLeaveEvents
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1730
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1731
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1732
initStyle
959
331da6bc19ec commentary
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
  1733
    "setup viewStyle specifics"
331da6bc19ec commentary
Claus Gittinger <cg@exept.de>
parents: 955
diff changeset
  1734
761
5bd603d649d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1735
    <resource: #style (#name)>
5bd603d649d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1736
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1737
    |hasGreyscales nm|
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1738
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1739
    super initStyle.
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1740
392
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  1741
"/    DefaultFont notNil ifTrue:[font := DefaultFont on:device].
81343306d796 eliminated all DefaultFont classVars (are now classINSTvars)
Claus Gittinger <cg@exept.de>
parents: 366
diff changeset
  1742
74
9d0d6a11939e last version before introduction of controller
claus
parents: 62
diff changeset
  1743
    DefaultBorderWidth notNil ifTrue:[borderWidth := DefaultBorderWidth].
934
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1744
    DefaultForegroundColor notNil ifTrue:[fgColor := DefaultForegroundColor].
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1745
    DefaultBackgroundColor notNil ifTrue:[bgColor := DefaultBackgroundColor].
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1746
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1747
    edgeStyle := DefaultEdgeStyle.
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1748
    onLevel := DefaultActiveLevel.
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1749
    offLevel := DefaultPassiveLevel.
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1750
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1751
    DefaultDisabledForegroundColor notNil ifTrue:[
934
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1752
        disabledFgColor := DefaultDisabledForegroundColor
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1753
    ] ifFalse:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1754
        disabledFgColor := fgColor
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1755
    ].
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
  1756
    disabledEtchedFgColor := DefaultDisabledEtchedForegroundColor.
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1757
934
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1758
    DefaultEnteredForegroundColor notNil ifTrue:[enteredFgColor := DefaultEnteredForegroundColor].
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1759
    DefaultEnteredBackgroundColor notNil ifTrue:[enteredBgColor := DefaultEnteredBackgroundColor].
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1760
    DefaultActiveForegroundColor notNil ifTrue:[activeFgColor := DefaultActiveForegroundColor].
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1761
    DefaultActiveBackgroundColor notNil ifTrue:[activeBgColor := DefaultActiveBackgroundColor].
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1762
934
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1763
    DefaultShadowColor notNil ifTrue:[shadowColor := DefaultShadowColor].
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1764
    DefaultLightColor notNil ifTrue:[lightColor := DefaultLightColor].
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1765
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1766
    shadowColor isNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1767
        shadowColor := Black.
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1768
    ].
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1769
    lightColor isNil ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1770
        lightColor := White.
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1771
    ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1772
707
9e5ed6312943 grey vs. gray
Claus Gittinger <cg@exept.de>
parents: 705
diff changeset
  1773
    hasGreyscales := device hasGrayscales.
1651
b7f06a53ddd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1774
    (edgeStyle == #soft or:[edgeStyle == #softWin95]) ifTrue:[
934
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1775
        DefaultHalfShadowColor notNil ifTrue:[halfShadowColor := DefaultHalfShadowColor].
afed7a7f101d *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 932
diff changeset
  1776
        DefaultHalfLightColor notNil ifTrue:[halfLightColor := DefaultHalfLightColor].
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1777
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1778
        halfShadowColor isNil ifTrue:[
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1779
"/            hasGreyscales ifTrue:[
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1780
"/                halfShadowColor := Color darkGrey
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1781
"/            ] ifFalse:[
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1782
"/                halfShadowColor := shadowColor
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1783
"/            ]
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1784
            halfShadowColor := shadowColor lightened
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1785
        ]
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1786
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1787
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1788
    "
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1789
     actually, the stuf below should not be needed
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1790
     - the styleSheet should provide values for nonGreyscale displays too
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1791
    "
130
claus
parents: 128
diff changeset
  1792
    nm := styleSheet name.
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1793
    (nm == #iris) ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1794
        hasGreyscales ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1795
            DefaultEnteredBackgroundColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1796
                enteredBgColor := bgColor lightened "Color lightGray".
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1797
            ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1798
            DefaultActiveBackgroundColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1799
                activeBgColor := enteredBgColor.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1800
            ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1801
            DefaultActiveForegroundColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1802
                activeFgColor := enteredFgColor.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1803
            ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1804
        ] ifFalse:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1805
            DefaultEnteredBackgroundColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1806
                enteredBgColor := Color veryLightGray.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1807
            ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1808
            DefaultActiveBackgroundColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1809
                activeBgColor := Black.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1810
            ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1811
            DefaultActiveForegroundColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1812
                activeFgColor := White.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1813
            ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1814
        ].
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1815
    ] ifFalse:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1816
        nm == #motif ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1817
            lightColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1818
                lightColor := bgColor lightened
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1819
            ].
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1820
"/            hasGreyscales ifTrue:[
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1821
"/                lightColor := Color lightGrey
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1822
"/            ]
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1823
        ] ifFalse:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1824
            nm == #st80 ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1825
                hasGreyscales ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1826
                    DefaultActiveForegroundColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1827
                        activeFgColor := fgColor.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1828
                    ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1829
                    DefaultActiveBackgroundColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1830
                        activeBgColor := bgColor darkened.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1831
                    ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1832
                ] ifFalse:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1833
                    DefaultActiveForegroundColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1834
                        activeFgColor := White.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1835
                    ].
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1836
                    DefaultActiveBackgroundColor isNil ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1837
                        activeBgColor := Black
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1838
                    ]
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1839
                ]
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1840
            ]
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1841
        ]
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1842
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1843
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1844
    offLevel ~~ level ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1845
        self level:offLevel.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1846
        margin := (onLevel abs) max:(offLevel abs).
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1847
    ].
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1848
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1849
    DefaultReturnButtonHasImage ifTrue:[
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1850
        (styleSheet is3D and:[hasGreyscales]) ifTrue:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1851
            shadowForm := self class returnShadowFormOn:device.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1852
            lightForm := self class returnLightFormOn:device.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1853
            formColor := viewBackground.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1854
            formShadowColor := shadowColor.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1855
            formLightColor := lightColor
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1856
        ] ifFalse:[
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1857
            shadowForm := self class returnFormOn:device.
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1858
            formColor := Black
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1859
        ].
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1860
    ].
705
e2e7e718eb93 gray vs. grey
Claus Gittinger <cg@exept.de>
parents: 655
diff changeset
  1861
1651
b7f06a53ddd9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1644
diff changeset
  1862
    "Modified: / 20.8.1998 / 12:07:37 / cg"
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1863
!
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  1864
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1865
initialize
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1866
    super initialize.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1867
1051
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1868
    isReturnButton := defaultable := false.
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1869
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1870
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1871
reinitialize
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1872
    super reinitialize.
77
565b052f5277 *** empty log message ***
claus
parents: 74
diff changeset
  1873
    controller notNil ifTrue:[
1739
3cb6e85d42c0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1721
diff changeset
  1874
        controller reinitialize.
77
565b052f5277 *** empty log message ***
claus
parents: 74
diff changeset
  1875
    ]
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1876
! !
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1877
3035
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1878
!Button methodsFor:'native widget support'!
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1879
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1880
nativeWindowType
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1881
    "return a symbol describing my native window type 
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1882
     (may be used internally by the device as a native window creation hint)"
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1883
3041
d5f0a23033b5 *** empty log message ***
ca
parents: 3035
diff changeset
  1884
"/    self class == Button ifTrue:[
d5f0a23033b5 *** empty log message ***
ca
parents: 3035
diff changeset
  1885
"/        ^ #Button
d5f0a23033b5 *** empty log message ***
ca
parents: 3035
diff changeset
  1886
"/    ].
3035
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1887
    ^ nil
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1888
!
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1889
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1890
win32nativeWMCommand:commandID
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1891
    self controller performAction
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1892
! !
75cda50fe87b native widget support
ca
parents: 2971
diff changeset
  1893
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1894
!Button methodsFor:'private'!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1895
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1896
computeLabelOrigin
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1897
    "compute the origin of the text - if  I am a returnButton,
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1898
     shift it somwehat to the right (we have already allocated the
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1899
     real estate, since computeLabelSize returned some extra space
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1900
     before)."
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1901
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1902
    super computeLabelOrigin.
1093
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1903
    shadowForm notNil ifTrue:[
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1904
        isReturnButton ifTrue:[
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1905
            labelOriginX := labelOriginX + hSpace + hSpace.
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1906
        ].
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1907
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1908
        defaultable ifTrue:[
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1909
            labelOriginX < margin ifTrue:[
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1910
                labelOriginX := margin
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1911
            ]
cb7b2c99f5cc care for defaultable labels which fit while
Claus Gittinger <cg@exept.de>
parents: 1092
diff changeset
  1912
        ]
1663
c6cc4fe918ea nicer 3D effect (shift label down-right) when pressed.
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  1913
    ].
1669
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  1914
"/    self class == Button ifTrue:[
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  1915
"/        labelOriginY := labelOriginY + 1.
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  1916
"/        labelOriginX := labelOriginX + 1.
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  1917
"/    ]
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  1918
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  1919
    "Modified: / 9.9.1998 / 20:22:01 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1920
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1921
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1922
computeLabelSize
1051
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1923
    "compute the extent needed to hold the label (plus the return form)"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1924
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1925
    super computeLabelSize.
1051
52111b0631da *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1050
diff changeset
  1926
    ((isReturnButton or:[defaultable]) and:[shadowForm notNil]) ifTrue:[
1387
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1927
        labelWidth := labelWidth + (hSpace * 2) + shadowForm width.
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1928
        labelHeight := labelHeight max: (shadowForm height "+ vSpace")
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1929
    ]
1387
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1930
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  1931
    "Modified: / 3.11.1997 / 09:15:52 / cg"
2586
932f37c50f9f checkin from browser
penk
parents: 2515
diff changeset
  1932
!
932f37c50f9f checkin from browser
penk
parents: 2515
diff changeset
  1933
932f37c50f9f checkin from browser
penk
parents: 2515
diff changeset
  1934
shiftLabelWhenPressed
932f37c50f9f checkin from browser
penk
parents: 2515
diff changeset
  1935
    ^ self class == Button
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1936
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1937
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  1938
!Button methodsFor:'queries'!
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1939
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1940
is3D
850
11c857edb53b comment
Claus Gittinger <cg@exept.de>
parents: 800
diff changeset
  1941
    "return true, if the receiver is a 3D style view"
761
5bd603d649d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1942
850
11c857edb53b comment
Claus Gittinger <cg@exept.de>
parents: 800
diff changeset
  1943
    <resource: #style (#name)>
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1944
130
claus
parents: 128
diff changeset
  1945
    styleSheet name == #mswindows ifTrue:[^ true].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1946
    ^ super is3D
761
5bd603d649d6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 713
diff changeset
  1947
850
11c857edb53b comment
Claus Gittinger <cg@exept.de>
parents: 800
diff changeset
  1948
    "Modified: 22.10.1996 / 18:26:41 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1949
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1950
1782
b385efd8a4b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  1951
isDefault
b385efd8a4b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  1952
    "return true, if this is a default OK button"
b385efd8a4b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  1953
b385efd8a4b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  1954
    ^ isReturnButton
b385efd8a4b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  1955
!
b385efd8a4b9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1778
diff changeset
  1956
127
claus
parents: 125
diff changeset
  1957
isOn
claus
parents: 125
diff changeset
  1958
    "return true, if this button is currently pressed"
claus
parents: 125
diff changeset
  1959
claus
parents: 125
diff changeset
  1960
    ^ controller pressed
155
claus
parents: 149
diff changeset
  1961
!
claus
parents: 149
diff changeset
  1962
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1963
isReturnButton
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1964
    "return true, if this is a return button"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  1965
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  1966
    ^ isReturnButton
156
claus
parents: 155
diff changeset
  1967
!
claus
parents: 155
diff changeset
  1968
1370
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1969
isTriggerOnDown
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1970
    "return true, if I fire on press (instead of fire-on-release)"
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1971
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1972
    ^ controller isTriggerOnDown
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1973
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1974
    "Created: / 31.10.1997 / 19:33:56 / cg"
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1975
    "Modified: / 31.10.1997 / 19:34:34 / cg"
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1976
!
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  1977
130
claus
parents: 128
diff changeset
  1978
preferredExtent
claus
parents: 128
diff changeset
  1979
    "return my preferred extent - this is the minimum size I would like to have"
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
  1980
1021
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  1981
    |extraH extraV oldLogo wActive hActive wPassive hPassive
1664
0f66226e84dc oops - only shift label for buttons (not for checkToggles)
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
  1982
     wMax hMax anyLogo ext|
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
  1983
3758
ab385f00c199 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3681
diff changeset
  1984
    "/ If I have an explicit preferredExtent..
ab385f00c199 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3681
diff changeset
  1985
    explicitExtent notNil ifTrue:[
ab385f00c199 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3681
diff changeset
  1986
        ^ explicitExtent
ab385f00c199 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3681
diff changeset
  1987
    ].
ab385f00c199 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3681
diff changeset
  1988
ab385f00c199 changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents: 3681
diff changeset
  1989
    "/ If I have a cached preferredExtent value..
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  1990
    preferredExtent notNil ifTrue:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  1991
        ^ preferredExtent
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  1992
    ].
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  1993
1021
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  1994
    "/ compute the max-extent of both passive- and activeLogos
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  1995
    "/ (if any)
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  1996
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  1997
    wActive := wPassive := labelWidth.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  1998
    hActive := hPassive := labelHeight.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  1999
    oldLogo := logo.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2000
    anyLogo := false.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2001
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2002
    (activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2003
        logo := activeLogo.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2004
        self computeLabelSize.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2005
        wActive := labelWidth.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2006
        hActive := labelHeight.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2007
        anyLogo := true.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2008
    ].
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2009
    (passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2010
        logo := passiveLogo.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2011
        self computeLabelSize.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2012
        wPassive := labelWidth.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2013
        hPassive := labelHeight.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2014
        anyLogo := true.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2015
    ].
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2016
    oldLogo ~~ logo ifTrue:[
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2017
        logo := oldLogo.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2018
        self computeLabelSize.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2019
    ].
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2020
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2021
    wMax := wActive max:wPassive.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2022
    hMax := hActive max:hPassive.
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2023
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2024
    anyLogo ifTrue:[
131
claus
parents: 130
diff changeset
  2025
"
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  2026
        extraH := extraV := (onLevel abs max:offLevel abs) + ViewSpacing * 2.
131
claus
parents: 130
diff changeset
  2027
"
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  2028
        extraH := extraV := (onLevel abs max:offLevel abs).
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  2029
        extraH := (extraH + hSpace * 2).
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  2030
        extraV := (extraV + vSpace * 2).
131
claus
parents: 130
diff changeset
  2031
713
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  2032
        self is3D ifFalse:[
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  2033
            "add space for a frame around"
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  2034
            extraH := extraH + 2. extraV := extraV + 2.
0c38ad51016d care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents: 711
diff changeset
  2035
        ].
1021
73ec8663c4cb care for BOTH active- and passive logos,
Claus Gittinger <cg@exept.de>
parents: 992
diff changeset
  2036
1664
0f66226e84dc oops - only shift label for buttons (not for checkToggles)
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
  2037
        ext := (wMax + extraH) @ (hMax + extraV)
0f66226e84dc oops - only shift label for buttons (not for checkToggles)
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
  2038
    ] ifFalse:[
0f66226e84dc oops - only shift label for buttons (not for checkToggles)
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
  2039
        ext := super preferredExtent
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
  2040
    ].
1669
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  2041
"/    (self class == Button) ifTrue:[
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  2042
"/        self is3D ifTrue:[
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  2043
"/            ext := ext + (1@1)
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  2044
"/        ]
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  2045
"/    ].
1664
0f66226e84dc oops - only shift label for buttons (not for checkToggles)
Claus Gittinger <cg@exept.de>
parents: 1663
diff changeset
  2046
    ^ ext
1663
c6cc4fe918ea nicer 3D effect (shift label down-right) when pressed.
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2047
1669
8c48fac7e961 geometry again
Claus Gittinger <cg@exept.de>
parents: 1665
diff changeset
  2048
    "Modified: / 9.9.1998 / 20:21:29 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2049
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2050
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2051
specClass
1370
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  2052
    "redefined, since the name of my specClass is nonStandard (i.e. not ButtonSpec)"
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  2053
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2054
    self class == Button ifTrue:[^ ActionButtonSpec].
1050
2335acd8efb8 specClass query
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2055
    ^ super specClass
2335acd8efb8 specClass query
Claus Gittinger <cg@exept.de>
parents: 1021
diff changeset
  2056
1370
56b6ea4b8f57 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1355
diff changeset
  2057
    "Modified: / 31.10.1997 / 19:49:07 / cg"
162
claus
parents: 156
diff changeset
  2058
! !
claus
parents: 156
diff changeset
  2059
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2060
!Button methodsFor:'redrawing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2061
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2062
drawBottomEdge
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2063
    "draw bottom 3D edge into window frame"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2064
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2065
    self drawBottomEdgeLevel:level
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2066
		      shadow:shadowColor 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2067
		      light:lightColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2068
		      halfShadow:halfShadowColor 
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2069
		      halfLight:halfLightColor
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2070
		      style:edgeStyle.
133
claus
parents: 131
diff changeset
  2071
!
claus
parents: 131
diff changeset
  2072
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2073
drawEdges
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2074
    "draw all of my 3D edges"
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2075
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2076
    self drawEdgesForX:0 y:0 width:width height:height level:level 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2077
		shadow:shadowColor 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2078
		light:lightColor
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2079
		halfShadow:halfShadowColor 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2080
		halfLight:halfLightColor
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2081
		style:edgeStyle 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2082
!
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2083
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2084
drawLeftEdge
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2085
    "draw left 3D edge into window frame"
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2086
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2087
    self drawLeftEdgeLevel:level
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2088
		    shadow:shadowColor 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2089
		     light:lightColor
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2090
		     halfShadow:halfShadowColor 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2091
		     halfLight:halfLightColor
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2092
		     style:edgeStyle.
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2093
!
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2094
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2095
drawRightEdge
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2096
    "draw right 3D edge into window frame"
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2097
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2098
    self drawRightEdgeLevel:level
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2099
		     shadow:shadowColor 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2100
		      light:lightColor
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2101
		      halfShadow:halfShadowColor 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2102
		      halfLight:halfLightColor
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2103
		      style:edgeStyle.
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2104
!
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2105
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2106
drawTopEdge
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2107
    "draw top 3D edge into window frame"
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2108
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2109
    self drawTopEdgeLevel:level
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2110
		   shadow:shadowColor 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2111
		   light:lightColor
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2112
		   halfShadow:halfShadowColor 
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2113
		   halfLight:halfLightColor
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2114
		   style:edgeStyle.
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2115
!
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2116
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2117
drawWith:fg and:bg
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2118
    "redraw myself with fg/bg. Use super to draw the label, add
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2119
     the return-arrow here."
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2120
2671
7fa1416edc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
  2121
    |x y sColor lColor etchFg savLogo isEnabled|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2122
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  2123
    shown ifFalse:[^ self].
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
  2124
2671
7fa1416edc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
  2125
    isEnabled := self enabled.
7fa1416edc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
  2126
    isEnabled ifFalse:[
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
  2127
        etchFg := disabledEtchedFgColor.
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
  2128
    ].
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
  2129
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2130
    savLogo := logo.
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2131
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2132
    (controller active or:[controller pressed]) ifTrue:[
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2133
        logo := activeLogo ? enteredLogo ? savLogo. 
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2134
    ] ifFalse:[
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2135
        logo := passiveLogo ? savLogo.
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2136
        (enteredLogo notNil and:[controller entered]) ifTrue:[
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2137
            logo := enteredLogo.
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2138
        ].
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2139
    ].
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2140
    (disabledLogo notNil and:[isEnabled not]) ifTrue:[
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2141
        logo := disabledLogo.
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2142
    ].
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2143
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
  2144
    self drawWith:fg and:bg clearInside:true etchedFg:etchFg.   "this draws the text/image"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2145
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2146
    logo := savLogo.
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2147
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  2148
    (isReturnButton and:[shadowForm notNil]) ifTrue:[
932
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2149
        y := (height - shadowForm height) // 2.
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2150
        x := width - shadowForm width - (hSpace // 2).
59
450ce95a72a4 *** empty log message ***
claus
parents: 42
diff changeset
  2151
2586
932f37c50f9f checkin from browser
penk
parents: 2515
diff changeset
  2152
        (self shiftLabelWhenPressed and:[level < 0]) ifTrue:[
1665
085d9d2f0f1c geometry
Claus Gittinger <cg@exept.de>
parents: 1664
diff changeset
  2153
            x := x + 1.
085d9d2f0f1c geometry
Claus Gittinger <cg@exept.de>
parents: 1664
diff changeset
  2154
            y := y + 1
1663
c6cc4fe918ea nicer 3D effect (shift label down-right) when pressed.
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2155
        ].
c6cc4fe918ea nicer 3D effect (shift label down-right) when pressed.
Claus Gittinger <cg@exept.de>
parents: 1651
diff changeset
  2156
932
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2157
        formShadowColor isNil ifTrue:[
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2158
            self paint:fg on:bg.
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2159
            self displayOpaqueForm:shadowForm x:x y:y.
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2160
            ^ self
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2161
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2162
932
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2163
        "
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2164
         drawing form in 3d-style (i.e. with shadow and light)
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2165
        "
955
fb460392a553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 945
diff changeset
  2166
        (formShadowColor isColor and:[formShadowColor isDithered not
fb460392a553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 945
diff changeset
  2167
         and:[formLightColor isColor and:[formLightColor isDithered not
fb460392a553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 945
diff changeset
  2168
         and:[formColor isColor and:[formColor isDithered not]]]]])
932
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2169
        ifTrue:[
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2170
            sColor := formShadowColor.
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2171
            lColor := formLightColor.
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2172
        ] ifFalse:[
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2173
            sColor := device blackColor.
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2174
            lColor := device whiteColor.
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2175
        ].
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2176
        self foreground:sColor.
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2177
        self displayForm:shadowForm x:x y:y.
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
  2178
932
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2179
        lightForm notNil ifTrue:[
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2180
            self foreground:lColor.
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2181
            self displayForm:lightForm x:x y:y.
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2182
        ].
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2183
        self paint:fg.
1681
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  2184
    ].
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  2185
3681
6720fe8150a4 focus frame drawing
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
  2186
    "/ DefaultFocusHighlightStyle == #win95 ifTrue:[
6720fe8150a4 focus frame drawing
Claus Gittinger <cg@exept.de>
parents: 3680
diff changeset
  2187
    (styleSheet at:#focusHighlightStyle) == #win95 ifTrue:[
1681
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  2188
        self hasFocus ifTrue:[
3680
f6afac26fe7f focus drawing: only if via tab
Claus Gittinger <cg@exept.de>
parents: 3598
diff changeset
  2189
            self windowGroup focusCameByTab ifTrue:[
f6afac26fe7f focus drawing: only if via tab
Claus Gittinger <cg@exept.de>
parents: 3598
diff changeset
  2190
                self drawWin95FocusFrame
f6afac26fe7f focus drawing: only if via tab
Claus Gittinger <cg@exept.de>
parents: 3598
diff changeset
  2191
            ]
1681
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  2192
        ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2193
    ]
932
43879de4e75d use devices black/whiteColor instead of Black/White
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  2194
1681
7ce428bea95f focus drawing
Claus Gittinger <cg@exept.de>
parents: 1669
diff changeset
  2195
    "Modified: / 18.9.1998 / 16:55:38 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2196
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2197
1170
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  2198
redraw
82
6f2d05f1da80 *** empty log message ***
claus
parents: 77
diff changeset
  2199
    "redraw the button. 
6f2d05f1da80 *** empty log message ***
claus
parents: 77
diff changeset
  2200
     Thats like redrawing a label, but use different colors when pressed
6f2d05f1da80 *** empty log message ***
claus
parents: 77
diff changeset
  2201
     or entered."
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2202
1778
f04b56bcb611 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1739
diff changeset
  2203
    |fg bg entered noFrame lvl isEnabled|
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2204
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2205
    shown ifFalse:[^ self].
2671
7fa1416edc1a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2611
diff changeset
  2206
    isEnabled := self enabled.
35
83bd380c4383 clear entered-flag on realize
claus
parents: 24
diff changeset
  2207
2609
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2208
"/    disabledLogo notNil ifTrue:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2209
"/        isEnabled ifFalse:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2210
"/            logo := disabledLogo.
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2211
"/        ] ifTrue:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2212
"/            controller active ifTrue:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2213
"/                logo := activeLogo
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2214
"/            ] ifFalse:[
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2215
"/                logo := passiveLogo
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2216
"/            ].
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2217
"/        ].
c1f9be6ce48c redraw enhanced (XP)
Claus Gittinger <cg@exept.de>
parents: 2586
diff changeset
  2218
"/    ].
1092
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2219
265
76336839475b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2220
    noFrame := true.
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2221
    fg := fgColor.
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2222
    bg := bgColor.
1778
f04b56bcb611 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1739
diff changeset
  2223
    isEnabled ifFalse:[
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
  2224
        fg := disabledFgColor.
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2225
    ] ifTrue:[
1092
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2226
        entered := controller entered.
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2227
        entered ifTrue:[
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2228
            enteredFgColor notNil ifTrue:[fg := enteredFgColor].
1206
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2229
            enteredBgColor notNil ifTrue:[bg := enteredBgColor].
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2230
            lvl := enterLevel.
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2231
        ] ifFalse:[
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2232
            lvl := leaveLevel
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2233
        ].
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2234
        (enterLevel notNil and:[leaveLevel notNil]) ifTrue:[
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2235
            offLevel ~~ lvl ifTrue:[
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2236
                offLevel := lvl.
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2237
                offLevel ~~ level ifTrue:[
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2238
                    self level:offLevel
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2239
                ]
003498bf0349 added enter- and leaveLevels.
Claus Gittinger <cg@exept.de>
parents: 1196
diff changeset
  2240
            ]
1092
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2241
        ].
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2242
        (controller pressed and:[entered or:[controller isTriggerOnDown]]) ifTrue:[
1387
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2243
            noFrame := self is3D "false".
1092
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2244
            activeFgColor isNil ifTrue:[
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2245
                onLevel == offLevel ifTrue:[
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2246
                    fg := bgColor
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2247
                ]
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2248
            ] ifFalse:[
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2249
                fg := activeFgColor.
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2250
            ].
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2251
            activeBgColor isNil ifTrue:[
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2252
                onLevel == offLevel ifTrue:[
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2253
                    bg := fgColor
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2254
                ]
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2255
            ] ifFalse:[
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2256
                bg := activeBgColor
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2257
            ].
232
2fbe1b72e96a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 230
diff changeset
  2258
1092
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2259
            self is3D ifFalse:[
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2260
                noFrame := (fgColor = fg) and:[bgColor = bg].
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2261
            ].
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2262
        ].
62
7cc1e330da47 *** empty log message ***
claus
parents: 60
diff changeset
  2263
    ].
2497
e3e1a719e31d support etched color (win32 style)
Claus Gittinger <cg@exept.de>
parents: 2490
diff changeset
  2264
265
76336839475b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2265
    self drawWith:fg and:bg.
76336839475b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2266
    noFrame ifFalse:[
1092
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2267
        "
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2268
         draw a rectangle around (2D styles only)
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2269
        "
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2270
        self paint:fg.
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2271
        self displayRectangleX:0 y:0 width:width height:height.
ccd72fe62ef5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1051
diff changeset
  2272
        ^ self
265
76336839475b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2273
    ].
76336839475b *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 264
diff changeset
  2274
1387
98ec98a96dc6 slightly smaller returnForm
Claus Gittinger <cg@exept.de>
parents: 1370
diff changeset
  2275
    "Modified: / 3.11.1997 / 11:56:02 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2276
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2277
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2278
redrawIfPressed
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2279
    "redraw the button, but only if visible and currently being pressed"
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2280
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2281
    shown ifTrue:[
1170
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  2282
        controller pressed ifTrue:[
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  2283
            self redraw
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  2284
        ]
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2285
    ]
1170
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  2286
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  2287
    "Modified: 1.4.1997 / 13:26:27 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2288
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2289
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2290
redrawX:x y:y width:w height:h 
1170
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  2291
    self redraw.
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  2292
5864abd318f6 #redisplay is #redraw
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  2293
    "Modified: 1.4.1997 / 13:26:31 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2294
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2295
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2296
showActive
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2297
    "redraw myself as active (i.e. busy)"
162
claus
parents: 156
diff changeset
  2298
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2299
    onLevel ~~ level ifTrue:[
711
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2300
        self level:onLevel.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2301
    ].
3052
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2302
"/    (activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2303
"/        self logo:activeLogo
1952f628ae28 enteredlogo
Claus Gittinger <cg@exept.de>
parents: 3041
diff changeset
  2304
"/    ].
711
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2305
    self invalidate
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2306
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2307
    "Modified: 26.5.1996 / 18:08:52 / cg"
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2308
!
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2309
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2310
showPassive
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2311
    "redraw myself as passive"
162
claus
parents: 156
diff changeset
  2312
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2313
    offLevel ~~ level ifTrue:[
711
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2314
        self level:offLevel.
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2315
    ].
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2316
    (passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[
3122
2b734c50d620 Do not use obsolete message #logo:
Stefan Vogel <sv@exept.de>
parents: 3052
diff changeset
  2317
        self label:passiveLogo
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2318
    ].
711
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2319
    self invalidate.
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2320
c830bb66598b use new #invalidate instead of redraw
Claus Gittinger <cg@exept.de>
parents: 707
diff changeset
  2321
    "Modified: 26.5.1996 / 18:08:56 / cg"
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
  2322
! !
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2323
850
11c857edb53b comment
Claus Gittinger <cg@exept.de>
parents: 800
diff changeset
  2324
!Button class methodsFor:'documentation'!
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2325
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2326
version
3839
5cbf92d3aa64 name for okButton and abortButton
fm
parents: 3758
diff changeset
  2327
    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.142 2009-02-23 14:57:38 fm Exp $'
205
6814c0bf8df8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 178
diff changeset
  2328
! !