Squeak Class Documentation category index | class index  
 
MenuItemMorph
  category: Morphic-Menus
  superclass: StringMorph
  subclasses: UpdatingMenuItemMorph

I represent an item in a menu.

Instance variables:
isEnabled <Boolean> True if the menu item can be executed.
subMenu <MenuMorph | nil> The submenu to activate automatically when the user mouses over the item.
isSelected <Boolean> True if the item is currently selected.
target <Object> The target of the associated action.
selector <Symbol> The associated action.
arguments <Array> The arguments for the associated action.

instance methods
  accessing
  adaptToWorld:
allWordingsNotInSubMenu:
arguments
arguments:
contentString
contentString:
contents:
contents:withMarkers:
contents:withMarkers:inverse:
hasSubMenu
hasSubMenu:
isEnabled
isEnabled:
isStayUpItem
itemWithWording:
selector
selector:
subMenu
subMenu:
target
target:

  copying
  veryDeepFixupWith:
veryDeepInner:

  drawing
  drawOn:

  events
  activateOwnerMenu:
activateSubmenu:
deselectTimeOut:
doButtonAction
handleMouseUp:
handlesMouseDown:
handlesMouseOver:
handlesMouseOverDragging:
invokeWithEvent:
mouseDown:
mouseEnter:
mouseEnterDragging:
mouseLeave:
mouseLeaveDragging:
mouseUp:

  grabbing
  aboutToBeGrabbedBy:
duplicateMorph:

  initialization
  deleteIfPopUp:
initialize

  layout
  minHeight
minWidth

  layout-properties
  hResizing
vResizing

  meta actions
  wantsHaloFromClick

  object fileIn
 

  private
  notObsolete
offImage
onImage

  selecting
  deselect:
isSelected:
select:

class methods
  class initialization
  additionsToViewerCategories
initialize

instance methods
  accessing 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


 

allWordingsNotInSubMenu:

Answer a collection of the wordings of all items and subitems, but omit the stay-up item, and also any items in a submenu whose tag is given by verbotenSubmenuContents


 

arguments


 

arguments:


 

contentString


 

contentString:


 

contents:


 

contents:withMarkers:


 

contents:withMarkers:inverse:

Set the menu item entry. If aBool is true, parse aString for embedded markers.


 

hasSubMenu

Return true if the receiver has a submenu


 

hasSubMenu:


 

isEnabled


 

isEnabled:


 

isStayUpItem


 

itemWithWording:

If any of the receiver's items or submenu items have the given wording (case-blind comparison done), then return it, else return nil.


 

selector


 

selector:


 

subMenu


 

subMenu:


 

target


 

target:


  copying top  
 

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:


  events top  
 

activateOwnerMenu:

Activate our owner menu; e.g., pass control to it


 

activateSubmenu:

Activate our submenu; e.g., pass control to it


 

deselectTimeOut:

Deselect timout. Now really deselect


 

doButtonAction

Called programattically, this should trigger the action for which the receiver is programmed


 

handleMouseUp:

The handling of control between menu item requires them to act on mouse up even if not the current focus. This is different from the default behavior which really only wants to handle mouse ups when they got mouse downs before


 

handlesMouseDown:

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


 

handlesMouseOver:

Do I want to receive mouseEnter: and mouseLeave: when the button is up and the hand is empty? The default response is false, except if you have added sensitivity to mouseEnter: or mouseLeave:, using the on:send:to: mechanism.


 

handlesMouseOverDragging:

Return true if I want to receive mouseEnterDragging: and mouseLeaveDragging: when the hand drags something over me (button up or button down), or when the mouse button is down but there is no mouseDown recipient. The default response is false, except if you have added sensitivity to mouseEnterLaden: or mouseLeaveLaden:, using the on:send:to: mechanism.


 

invokeWithEvent:

Perform the action associated with the given menu item.


 

mouseDown:

Handle a mouse down event. Menu items get activated when the mouse is over them.


 

mouseEnter:

Handle a mouseEnter event, meaning the mouse just entered my bounds with no button pressed. The default response is to let my eventHandler, if any, handle it.


 

mouseEnterDragging:

The mouse entered the receiver. Do nothing if we're not in a 'valid menu transition', meaning that the current hand focus must be aimed at the owning menu.


 

mouseLeave:

The mouse has left the interior of the receiver...


 

mouseLeaveDragging:

The mouse left the receiver. Do nothing if we're not in a 'valid menu transition', meaning that the current hand focus must be aimed at the owning menu.


 

mouseUp:

Handle a mouse up event. Menu items get activated when the mouse is over them. Do nothing if we're not in a 'valid menu transition', meaning that the current hand focus must be aimed at the owning menu.


  grabbing top  
 

aboutToBeGrabbedBy:

Don't allow the receiver to act outside a Menu


 

duplicateMorph:

Make and return a duplicate of the receiver's argument


  initialization top  
 

deleteIfPopUp:

Recurse up for nested pop ups


 

initialize


  layout top  
 

minHeight


 

minWidth


  layout-properties top  
 

hResizing

Default to #spaceFill


 

vResizing

Default to #shrinkWrap


  meta actions top  
 

wantsHaloFromClick

Only if I'm not a lonely submenu


  object fileIn top  

  private top  
 

notObsolete

Provide backward compatibility with messages being sent to the Hand. Remove this when no projects made prior to 2.9 are likely to be used. If this method is removed early, the worst that can happen is a notifier when invoking an item in an obsolete menu.


 

offImage

Return the form to be used for indicating an '<off>' marker


 

onImage

Return the form to be used for indicating an '<off>' marker


  selecting top  
 

deselect:


 

isSelected:


 

select:


class methods
  class initialization top  
 

additionsToViewerCategories

Answer a list of (<categoryName> <list of category specs>) pairs that characterize the phrases this kind of morph wishes to add to various Viewer categories.


 

initialize

MenuItemMorph initialize