eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Menu':

Home

everywhere
www.exept.de
for:
[back]

Class: Menu


Inheritance:

   Object
   |
   +--Menu

Package:
stx:libview2
Category:
Views-Support
Version:
rev: 1.74 date: 2009/12/04 13:38:27
user: cg
file: Menu.st directory: libview2
module: stx stc-classLibrary: libview2
Author:
Claus Gittinger

Description:


not yet finished Menu class - this will eventually replace
most of the MenuView and PopUpMenu stuff.
(and hopefully be ST-80 compatible ...)

For now, only a subset of the full protocol is implemented.


Related information:

    MenuItem
    PopUpMenu

Class protocol:

instance creation
o  labelArray: arrayOfString lines: linesArray values: valueArrayOrNil
return a menu with menu items built with labels from arrayOfString (not Symbols).
The linesArray describes which menu items are the last menu item in their group.
The valueArray contains value objects for each menu item
(or is nil if no value objects are specified).

o  labelArray: arrayOfString values: valueArrayOrNil
return a menu with menu items built with labels from arrayOfString (not Symbols).
The valueArray contains value objects for each menu item
(or is nil if no value objects are specified).

o  labelList: arrayOfGroupStrings values: valueArrayOrNil

o  labels: aString lines: linesArray values: valueArrayOrNil

o  labels: aString values: valueArrayOrNil


Instance protocol:

Compatibility-ST80
o  addLine

o  indexOfMenuItem: anItem

o  indexOfMenuItemForWhich: aBlock

o  menuButtons
ST-80 seems to use a special menuButton class here.
Here, kludge a collection of menuItems.

Compatibility-Squeak
o  add: label target: target selector: selector

o  balloonTextForLastItem: aString

o  labels: labels lines: lines selections: selections

accessing
o  atNameKey: aNameKey
return the menuItem for the given nameKey; nil if no such item is in the menu.
Searches in allItems (i.e. also in subMenus)

o  groupSizes

o  groupSizes: something

o  items

o  labelAt: anIndex
gets the label of the menu item at the given index or nil

o  labelAtValue: aValue
gets the label of the menu item assigned to value

o  labels
return a collection of labels from my items

o  lastItem
returns the last item or nil, if there are none

o  lines
return the indexes of the menu items that are the last menu item in their group (except the very last).

o  menuItemAt: index
gets the menu item at the given index. When the index is out of bounds
nil is returned

o  menuItemLabeled: anItemLabel
return the menuItem for the given nameKey; nil if no such item is in the menu.
Searches all items (i.e. also submenu items)

o  menuItemWithValue: aValue
return the menuItem for the given value; nil if no such item is in the menu.
Searches all items (i.e. also submenu items)

o  menuItems

o  menuItems: aCollectionOfMenuItems menuItemGroups: sizes values: values

o  menuPerformer: something
set the receiver of the menu messages

o  numberOfItems
return the number of items in this menu

o  receiver
return the receiver of the menu messages

o  receiver: something
set the receiver of the menu messages

o  valueAt: index
return a collection of values from my items

o  valueAt: anIndex put: aValue
put value an an index

o  values
return a collection of values from my items

o  values: aCollectionOfValues
return a collection of values from my items

o  visibleMenuItemGroups

accessing-resource
o  findGuiResourcesIn: aResourceContainerOrApplication
setup a resource owner

o  findGuiResourcesIn: aResourceContainerOrApplication rememberResourcesIn: aValueHolderOrNil
setup a resource owner

adding & removing
o  addItem: aMenuItem
add a menuItem at the end;
useful to build a menu programmatically (or, to add more items dynamically)

o  addItem: aMenuItem beforeIndex: anIndex
add a menuItem at some position;
useful to build a menu programmatically (or, to add more items dynamically)

o  addItem: aMenuItem value: aValue

o  addItemGroup: aGroup
add a group of items at the end;
useful to build a menu programmatically (or, to add more items dynamically)

o  addItemGroup: aGroup values: values
add a group of items at the end;
useful to build a menu programmatically (or, to add more items dynamically)

o  addItemGroupLabels: labels values: values
add a group of items at the end;
useful to build a menu programmatically (or, to add more items dynamically)

o  addItemLabel: label value: value
add an item at the end;
useful to build a menu programmatically (or, to add more items dynamically)

o  addSeparator
add a separating line item at the end;
useful to build a menu programmatically (or, to add more items dynamically)

o  removeItem: aMenuItem
remove an item from the menu

o  removeItemAt: anIndex
remove item at an index

converting
o  asOldStylePopUpMenuFor: anApplicationOrNil
a temporary kludge - will vanish, when oldStyle MenuView and PopUpMenu are gone

o  fromLiteralArrayEncoding: aLiteralEncodedArray
read my contents from a aLiteralEncodedArray

o  literalArrayEncoding
return myself encoded as a literal array

enumerating
o  allItemsDetect: aOneArgBlock ifNone: exceptionalValue
find an element amongst each item and submenu items

o  allItemsDo: aOneArgBlock
evaluate block on each item and submenu items

o  detectItem: aBlock
evaluate the argument, aBlock for each item in the menu until the
block returns true; in this case return the item which caused the
true evaluation.
If none of the evaluations returns true, return the result of the
evaluation of the exceptionBlock

o  detectItem: aBlock ifNone: exceptionBlock
evaluate the argument, aBlock for each item in the menu until the
block returns true; in this case return the item which caused the
true evaluation.
If none of the evaluations returns true, return the result of the
evaluation of the exceptionBlock

o  itemsDo: aOneArgBlock
evaluate the block for each item in the current menu

o  menuAndSubmenusDetectItem: aOneArgBlock
evaluate the block for each item in the current menu and all
submenus. In case that the block returns a non nil argument,
the item will be returned

kludged fixes
o  destroy
dummy to allow a menu to be used where a MenuView used to be

menu items
o  removeAllAccelerators

o  someMenuItemLabeled: aLabel
get the menu item with that label; in case that the label
is not found, nil is returned

o  someMenuItemLabeled: aLabel ifNone: exceptionBlock
get the menu item labeled aLabel; in case that the value
is not found, the given exceptionBlock is executed and its value returned

o  someMenuItemWithValue: aValue
get the menu item assigned with the value; in case that the value
is not found nil is returned

o  someMenuItemWithValue: aValue ifNone: exceptionBlock
get the menu item assigned with the value; in case that the value
is not found, the given exceptionBlock is executed and returned

queries
o  hasHiddenItems
test whether any item is hidden

o  hasItems
test whether there are any menu-items

o  hasSubMenuAt: anIndex
test whether the menu item at the given index has a submenu

startup
o  show
realize the menu at its last position; returns the value associated with the
selected item, 0 if none was selected

o  showAt: aPoint
realize the menu at aPoint; returns the value associated with the
selected item, 0 if none was selected

o  showAt: aPoint resizing: aBoolean
realize the menu at aPoint; returns the value associated with the
selected item, 0 if none was selected

o  showAtPointer
realize the menu at the current pointer position; returns the value associated with the
selected item, 0 if none was selected

o  showCenteredIn: aView
realize the menu visible at the aView center; returns the value associated with the
selected item, 0 if none was selected

o  startUp
display the menu as a popUp; returns the value associated with the
selected item, nil if none was selected.
(should we return 0 form ST-80 compatibility ?)

o  startUpAt: aPoint
display the menu as a popUp at aPoint; returns the value associated with the
selected item, 0 if none was selected

o  startUpFor: originatingWidget
display the menu as a popUp; returns the value associated with the
selected item, nil if none was selected.
(should we return 0 for ST-80 compatibility ?)

o  startUpOrNil
display the menu as a popUp; returns the value associated with the
selected item, nil if none was selected



ST/X 6.1.1; WebServer 1.620 at exept:8081; Tue, 22 May 2012 21:08:58 GMT