Squeak Class Documentation category index | class index  
 
ThreePhaseButtonMorph
  category: Morphic-Widgets
  superclass: ImageMorph
  subclasses: TrashCanMorph ToggleButtonMorph UpdatingThreePhaseButtonMorph

A button morph with separate images for on, off, and pressed with the mouse.

When the event actWhen occurs, send actionSelector with 'arguments' to target. For other events, default to my eventHandler. The current event is not supplied in the arguments to the actionSelector.

image (a.k.a. onImage) may not be nil. offImage and pressedImage may be nil. nil there means be transparent and show the underlying object.

Tools for debugging:
Display the images momentarily under program control (for positioning) (self is an instance).
self state: #on. self state: #off.
self state: #pressed. self state: #off.
Display a rectangle where the button is.
Display fillWithColor: bounds + (self world viewBox origin).
self invalidRect: bounds.

instance methods
  accessing
  actWhen:
actionSelector
actionSelector:
arguments
arguments:
authorModeOwner:
dragIfAuthoring:
offImage
offImage:
onImage
onImage:
pressedImage
pressedImage:
state:
target
target:

  copying
  updateReferencesUsing:
veryDeepFixupWith:
veryDeepInner:

  drawing
  drawOn:

  event handling
  doButtonAction
doButtonAction:
handlesMouseDown:
handlesMouseStillDown:
mouseDown:
mouseMove:
mouseStillDown:
mouseUp:

  geometry
  extent
extent:

  initialize-release
  adaptToWorld:
initialize

  printing
  printOn:

  stepping
  step
stepTime
wantsSteps

  testing
  isOn

class methods
  class initialization
  initialize

  instance creation
  checkBox
radioButton

instance methods
  accessing top  
 

actWhen:

Accepts symbols: #buttonDown, #buttonUp, and #whilePressed


 

actionSelector


 

actionSelector:


 

arguments


 

arguments:


 

authorModeOwner:


 

dragIfAuthoring:

Allow simple dragging if the class var is set to my owner.


 

offImage


 

offImage:


 

onImage


 

onImage:


 

pressedImage


 

pressedImage:


 

state:

Change the image and invalidate the rect.


 

target


 

target:


  copying top  
 

updateReferencesUsing:

If the arguments array points at a morph we are copying, then update it to point to the new copy. This method also copies the arguments array itself, which is important!


 

veryDeepFixupWith:

If target and arguments fields were weakly copied, fix them here. If they were in the tree being copied, fix them up, otherwise point to the originals!!


 

veryDeepInner:

Copy all of my instance variables. Some need to be not copied at all, but shared. Warning!! Every instance variable defined in this class must be handled. We must also implement veryDeepFixupWith:. See DeepCopier class comment.


  drawing top  
 

drawOn:


  event handling top  
 

doButtonAction

Perform the action of this button. Subclasses may override this method. The default behavior is to send the button's actionSelector to its target object with its arguments.


 

doButtonAction:

Perform the action of this button. Subclasses may override this method. The default behavior is to send the button's actionSelector to its target object with its arguments.


 

handlesMouseDown:

Do I want to receive mouseDown events (mouseDown:, mouseMove:, mouseUp:)?


 

handlesMouseStillDown:

Return true if the receiver wants to get repeated #mouseStillDown: messages between #mouseDown: and #mouseUp


 

mouseDown:

Handle a mouse down event. The default response is to let my eventHandler, if any, handle it.


 

mouseMove:

Handle a mouse move event. The default response is to let my eventHandler, if any, handle it.


 

mouseStillDown:

Handle a mouse move event. The default response is to let my eventHandler, if any, handle it.


 

mouseUp:

Allow on:send:to: to set the response to events other than actWhen


  geometry top  
 

extent

Do it normally


 

extent:

Do it normally


  initialize-release top  
 

adaptToWorld:

The receiver finds itself operating in a possibly-different new world. If any of the receiver's parts are world-dependent (such as a target of a SimpleButtonMorph, etc.), then have them adapt accordingly


 

initialize


  printing top  
 

printOn:

Append to the argument, aStream, a sequence of characters that
identifies the receiver.


  stepping top  
 

step

Do some periodic activity. Use startStepping/stopStepping to start and stop getting sent this message. The time between steps is specified by this morph's answer to the stepTime message. The generic version dispatches control to the player, if any. The nasty circumlocation about owner's transformation is necessitated by the flexing problem that the player remains in the properties dictionary both of the flex and the real morph. In the current architecture, only the top renderer's pointer to the player should actually be honored for the purpose of firing.


 

stepTime

Answer the desired time between steps in milliseconds. This default implementation requests that the 'step' method be called once every second.


 

wantsSteps

Return true if the receiver overrides the default Morph step method.


  testing top  
 

isOn


class methods
  class initialization top  
 

initialize

ThreePhaseButtonMorph initialize


  instance creation top  
 

checkBox

Answer a button pre-initialized with checkbox images.


 

radioButton

Answer a button pre-initialized with radiobutton images.