|
Class: Menu
Object
|
+--Model
|
+--Menu
- Package:
- stx:libview2
- Category:
- Views-Support
- Version:
- rev:
1.125
date: 2023/04/18 10:43:00
- user: stefan
- file: Menu.st directory: libview2
- module: stx stc-classLibrary: libview2
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)
copyrightCOPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
instance creation
-
labelArray: arrayOfStrings
-
return a menu with menu items built with labels from arrayOfStrings (not Symbols)
-
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).
-
labelArray: arrayOfStrings values: valueArrayOrNil
-
return a menu with menu items built with labels from arrayOfStrings (not Symbols).
The valueArray contains value objects for each menu item
(or is nil if no value objects are specified).
-
labelList: arrayOfGroupStrings values: valueArrayOrNil
-
-
labels: aString
-
-
labels: aString lines: linesArray values: valueArrayOrNil
-
-
labels: aString values: valueArrayOrNil
-
Compatibility-ST80
-
addLine
-
-
indexOfMenuItem: anItem
-
-
indexOfMenuItemForWhich: aBlock
-
-
menuButtons
-
ST-80 seems to use a special menuButton class here.
Here, kludge a collection of menuItems.
Compatibility-Squeak
-
add: label target: target selector: selector
-
-
balloonTextForLastItem: aString
-
-
labels: labels lines: lines selections: selections
-
accessing
-
atMenuItemLabeled: aString putSubmenu: aMenu visible: visible
-
-
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)
-
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.
-
groupSizes
-
-
groupSizes: something
-
-
itemAtValue: aValue
-
gets the item which has aValue as value
-
items
-
-
items: aCollectionOfMenuItems
-
-
labelAt: anIndex
-
gets the label of the menu item at the given index or nil
-
labelAtValue: aValue
-
gets the label of the menu item which has aValue as value
-
labels
-
return a collection of labels from my items
-
lastItem
-
returns the last item or nil, if there are none
-
lines
-
return the indexes of the menu items that are the last menu item in their group (except the very last).
-
menuItemAt: index
-
gets the menu item at the given index.
When the index is out of bounds, nil is returned
-
menuItemLabeled: anItemLabel
-
return the menuItem for the given label string; nil if no such item is in the menu.
Searches all items (i.e. also submenu items)
-
menuItemWithArgument: aValue
-
return the menuItem for the given argument; nil if no such item is in the menu.
Searches all items (i.e. also submenu items)
-
menuItemWithKey: aNameKey
-
return the menuItem for the given key; nil if no such item is in the menu.
Searches all items (i.e. also submenu items)
-
menuItemWithValue: aValue
-
return the menuItem for the given itemValue; nil if no such item is in the menu.
Searches all items (i.e. also submenu items)
-
menuItems
-
-
menuItems: aCollectionOfMenuItems menuItemGroups: sizes values: values
-
-
menuPerformer: something
-
set the receiver of the menu messages
-
numberOfItems
-
return the number of items in this menu
-
receiver
-
return the receiver of the menu messages
-
receiver: something
-
set the receiver of the menu messages
-
valueAt: index
-
return the value of an item
-
valueAt: anIndex put: aValue
-
put value at an index
-
values
-
return a collection of values from my items
-
values: aCollectionOfValues
-
set the collection of values in my items
-
visibleMenuItemGroups
-
Remove the hidden items.
accessing-resource
-
findGuiResourcesIn: aResourceContainerOrApplication
-
resolve national language translations from aResourceContainerOrApplication.
Unless already set, remember aResourceContainerOrApplication as menu receiver
-
findGuiResourcesIn: aResourceContainerOrApplication for: aViewOrNil
-
resolve national language translations from aResourceContainerOrApplication.
Unless already set, remember aResourceContainerOrApplication as menu receiver
-
findGuiResourcesIn: aResourceContainerOrApplication for: aViewOrNil rememberResourcesIn: aValueHolderOrNil
-
resolve national language translations from aResourceContainerOrApplication
-
findGuiResourcesIn: aResourceContainerOrApplication rememberResourcesIn: aValueHolderOrNil
-
resolve national language translations from aResourceContainerOrApplication
adding & removing
-
addItem: aMenuItem
-
add a menuItem at the end;
useful to build a menu programmatically (or, to add more items dynamically)
-
addItem: aMenuItem beforeIndex: anIndex
-
add a menuItem at some position;
useful to build a menu programmatically (or, to add more items dynamically)
-
addItem: aMenuItem value: aValue
-
-
addItemGroup: aGroup
-
add a group of items at the end;
useful to build a menu programmatically (or, to add more items dynamically)
-
addItemGroup: aGroup values: values
-
add a group of items at the end;
useful to build a menu programmatically (or, to add more items dynamically)
-
addItemGroupLabels: labels values: values
-
add a group of items at the end;
useful to build a menu programmatically (or, to add more items dynamically)
-
addItemLabel: label value: value
-
add an item at the end;
useful to build a menu programmatically (or, to add more items dynamically)
-
addItemLabel: label value: value enabled: enabled
-
add an item at the end;
useful to build a menu programmatically (or, to add more items dynamically)
-
addItems: collection
-
Add all items in given collection.
Useful to build a menu programmatically (or, to add more items dynamically)
-
addItemsFrom: anotherMenu
-
Add all items from another menu.
Useful to build a menu programmatically (or, to add more items dynamically)
-
addLabel: aLabel selector: aSelector action: aBlock
-
-
addSeparator
-
add a separating line item at the end;
useful to build a menu programmatically (or, to add more items dynamically)
-
addSeparatorIfAppropriate
-
add a separator, but avoid consecutive separators.
-
removeItem: aMenuItem
-
remove an item from the menu
-
removeItemAt: anIndex
-
remove item at an index
converting
-
asOldStylePopUpMenuFor: anApplicationOrNil
-
a temporary kludge - will vanish, when oldStyle MenuView and PopUpMenu are gone
-
fromLiteralArrayEncoding: aLiteralEncodedArray
-
read my contents from a aLiteralEncodedArray
-
literalArrayEncoding
-
return myself encoded as a literal array
enumerating
-
allItemsBreadthFirstDo: aOneArgBlock
-
recursively evaluate block on each item and submenu items.
This searches in breadth first order
-
allItemsDepthsFirstDo: aOneArgBlock
-
recursively evaluate block on each item and submenu items.
This searches in depth first order
-
allItemsDetect: aOneArgBlock ifNone: exceptionalValue
-
recursively find an element amongst each item and submenu items
-
allItemsDo: aOneArgBlock
-
recursively evaluate block on each item and submenu items.
This searches higher level items first
-
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
-
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
-
detectItemForLabel: aLabel
-
-
detectItemForNameKey: aKey
-
-
do: aOneArgBlock
-
recursively evaluate block on each item and submenu items
-
itemsDo: aOneArgBlock
-
evaluate the block for each item in the current menu
-
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
-
destroy
-
dummy to allow a menu to be used where a MenuView used to be
menu items
-
removeAllAccelerators
-
-
someMenuItemLabeled: aLabel
-
get the menu item with that label; in case that the label
is not found, nil is returned
-
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
-
someMenuItemWithValue: aValue
-
get the menu item assigned with the value; in case that the value
is not found nil is returned
-
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
-
hasHiddenItems
-
test whether any item is hidden
-
hasItems
-
test whether there are any menu-items
-
hasSubMenuAt: anIndex
-
test whether the menu item at the given index has a submenu
startup
-
show
-
realize the menu at its last position; returns the value associated with the
selected item, 0 if none was selected
-
showAt: aPoint
-
realize the menu at aPoint; returns the value associated with the
selected item, 0 if none was selected
-
showAt: aPoint resizing: aBoolean
-
realize the menu at aPoint; returns the value associated with the
selected item, 0 if none was selected
-
showAtPointer
-
realize the menu at the current pointer position;
returns the value associated with the selected item, 0 if none was selected
-
showCenteredIn: aView
-
realize the menu visible at the aView center; returns the value associated with the
selected item, 0 if none was selected
-
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 ?)
Usage example(s):
|m|
m := #(#Menu #(
#(#MenuItem
#rawLabel: 'left'
#value: #left )
#(#MenuItem
#rawLabel: 'center'
#value: #center )
#(#MenuItem
#rawLabel: 'right'
#value: #right ) )
#(2)
nil
) decodeAsLiteralArray.
Transcript showCR:(m startUp)
|
-
startUpAt: aPoint
-
display the menu as a popUp at aPoint; returns the value associated with the
selected item, 0 if none was selected
Usage example(s):
|m|
m := #(#Menu #(
#(#MenuItem
#rawLabel: 'left'
#value: #left )
#(#MenuItem
#rawLabel: 'center'
#value: #center )
#(#MenuItem
#rawLabel: 'right'
#value: #right ) )
#(2)
nil
) decodeAsLiteralArray.
Transcript showCR:(m startUpAt:100@100)
|
-
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 ?)
-
startUpOrNil
-
display the menu as a popUp; returns the value associated with the
selected item, nil if none was selected
utilities
-
replaceArgument: oldValue with: newValue
-
Recusively Replace argument in menu items where
current argument is equal to oldValue by newValue
NeedResourcesQuery
|