eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Menu':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Menu


Inheritance:

   Object
   |
   +--Model
      |
      +--Menu

Package:
stx:libview2
Category:
Views-Support
Version:
rev: 1.110 date: 2019/08/17 20:14:11
user: cg
file: Menu.st directory: libview2
module: stx stc-classLibrary: libview2
Author:
Claus Gittinger

Description:


Menu (aka MenuSpec, that's what it is!).

similar to UISpecifications, this describes the look, feel and behavior of
popUpMenus, toolbarMenus and window menus.

Instances of me are usually created from menuSpec methods, which return a literal
array description of me.
Instances of me are processed by MenuBuilders, which create a real MenuView/MenuPanel
from that into a window. 

Should be relatively VisualWorks compatible (clean room development, by emulating the
protocol needed by some public domain VW applications)



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  atMenuItemLabeled: aString putSubmenu: aMenu visible: visible

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  atNameKey: aNameKey ifPresentDo: aBlock
look for a menuItem with the given nameKey. If one is found, aBlock is evaluated for it.
If not, nothing is done.
Searches in allItems (i.e. also in subMenus).
Returns the item or nil.

o  groupSizes

o  groupSizes: something

o  itemAtValue: aValue
gets the item which has aValue assigned as value

o  items

o  items: aCollectionOfMenuItems

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  menuItemWithArgument: 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  menuItemWithKey: aValue
return the menuItem for the given key; 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 the value of an item

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

o  values
return a collection of values from my items

o  values: aCollectionOfValues
set the collection of values in my items

o  visibleMenuItemGroups
Remove the hidden items.

accessing-resource
o  findGuiResourcesIn: aResourceContainerOrApplication
resolve national language translations from aResourceContainerOrApplication.
Unless already set, remember aResourceContainerOrApplication as menu receiver

o  findGuiResourcesIn: aResourceContainerOrApplication for: aViewOrNil
resolve national language translations from aResourceContainerOrApplication.
Unless already set, remember aResourceContainerOrApplication as menu receiver

o  findGuiResourcesIn: aResourceContainerOrApplication for: aViewOrNil rememberResourcesIn: aValueHolderOrNil
resolve national language translations from aResourceContainerOrApplication

o  findGuiResourcesIn: aResourceContainerOrApplication rememberResourcesIn: aValueHolderOrNil
resolve national language translations from aResourceContainerOrApplication

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  addItems: collection
Add all items in given collection.
Useful to build a menu programmatically (or, to add more items dynamically)

o  addItemsFrom: anotherMenu
Add all items from another menu.
Useful to build a menu programmatically (or, to add more items dynamically)

o  addLabel: aLabel selector: aSelector action: aBlock

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
recursively find an element amongst each item and submenu items

o  allItemsDo: aOneArgBlock
recursively 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: exceptionValue
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 value from exceptionValue

o  do: aOneArgBlock
recursively evaluate block on each item and submenu items

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

utilities
o  replaceArgument: oldValue with: newValue
Recusively Replace argument in menu items where
current argument is equal to oldValue by newValue


Private classes:

    NeedResourcesQuery


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 28 Mar 2024 13:35:40 GMT