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