|
Class: MenuItem
Object
|
+--MenuItem
- Package:
- stx:libview2
- Category:
- Views-Support
- Version:
- rev:
1.156
date: 2024/03/19 09:04:30
- user: cg
- file: MenuItem.st directory: libview2
- module: stx stc-classLibrary: libview2
This together with MenuPanel 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.
new:
%(xx) in label text will be expanded by asking the application
for the xx labelFor:-aspect.
[instance variables:]
label: MUST be a CharacterArray.
copyrightCOPYRIGHT (c) 1998 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.
class initialization
-
initialize
-
(comment from inherited method)
called only once - initialize signals
constants
-
supportedStartGroupValues
-
start group #left #right #conditionalRight ...
At the moment only #left/nil, #right/#conditionalRight are implemented.
The meanings are:
nil - default under control of the menu
#left - left align
#right - place at the right far end
#conditionalRight - controlled by a styleSheet variable;
like #right under all non-win32 systems,
ignored on win32.
Use with help-menu, which should be at the far right on some
viewStyles, but not under win32.
instance creation
-
label: aString
-
create and return a new menuItem, given a label string
-
label: labelString argument: messageArg
-
create and return a new menuItem, given its label and value
and an argument to be passed with the action
-
label: labelString choice: choiceAspect choiceValue: selectorOrValue
-
create and return a new menuItem, given its label and choice/value.
This will create a Radio-Button-like item.
-
label: labelString itemValue: selectorOrValue
-
create and return a new menuItem, given its label and value (=action)
-
label: labelString itemValue: selectorOrValue argument: messageArg
-
create and return a new menuItem, given its label and value (=action)
and an argument to be passed with the action
-
label: labelString itemValue: selectorOrValue enabled: enabledHolder
-
create and return a new menuItem, given its label, value (=action)
and enabled holder, which can be a boolean, a boolean valueHolder,
a block or a selector (to be sent to the application)
-
label: labelString itemValue: selectorOrValue nameKey: nameKey
-
create and return a new menuItem, given its label, value (=action) and nameKey
-
label: labelString itemValue: selectorOrValue translateLabel: translateLabel
-
create and return a new menuItem, given its label, value (=action) and translateLabel flag
-
label: labelString submenu: aSymbolOrValueHolderOrBlock
-
create and return a new menuItem, given its label and submenu
-
label: labelString submenu: aSymbolOrValueHolderOrBlock enabled: enabledArg
-
create and return a new menuItem, given its label and submenu
-
label: labelString submenuChannel: aSymbolOrValueHolder
-
create and return a new menuItem, given its label and value
-
label: labelString value: selectorOrValue
-
create and return a new menuItem, given its label and value
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
label: labelString value: selectorOrValue argument: messageArg
-
create and return a new menuItem, given its label and value
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
label: labelString value: selectorOrValue enabled: enabledHolder
-
create and return a new menuItem, given its label and value
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
labeled: aString
-
create and return a new menuItem, given a label string
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
separator
-
create and return a new menuItem for a '----' separator
-
separator2
-
create and return a new menuItem for a '====' separator
-
separator: sepString
-
create and return a new menuItem for a separator
-
untranslatedLabel: labelString
-
create and return a new menuItem, given a label string
-
untranslatedLabel: labelString itemValue: selectorOrValue
-
create and return a new menuItem, given its label and value (=action)
-
untranslatedLabel: labelString itemValue: selectorOrValue argument: arg
-
create and return a new menuItem, given its label and value (=action)
Compatibility-ST80
-
enablementSelector: aSymbol
-
dummy for now - for visualworks compatibility (specs)
-
helpText: aString
-
dummy for now - for visualworks compatibility (specs)
-
indicationSelector: aSymbol
-
dummy for now - for visualworks compatibility (specs)
-
isEnabled: aBoolean
-
an enabled holder; either a block, boolean or value holder.
If the menu is permanently visible, it should be a valueHolder,
as the value is otherwise only checked before the menu is opened
or the pointer enters the item (which makes it look strange)
-
shortcutModifiers: something
-
dummy for now - for visualworks compatibility (specs)
-
value
-
obsolete - value is bad: it prevents us from using a valueHolder
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
value: something
-
obsolete - value is bad: it prevents us from using a valueHolder
** This is an obsolete interface - do not use it (it may vanish in future versions) **
accessing
-
accessCharacterPosition
-
get the index of the access character in the label text or string, or nil if none
-
accessCharacterPosition: index
-
set the index of the access character in the label text or string, or nil if none
-
activeHelpKey
-
the key used as index (and argument) to the helpSpec.
New: may also be an association; then the assoc's key is the help-text provider,
and the assoc's value is the key in that provider's helpspec.
-
activeHelpKey: aSymbolicKeyOrClassPlusSymbolAssoc
-
the key used as index (and argument) to the helpSpec.
New: may also be an association; then the assoc's key is the help-text provider,
and the assoc's value is the key in that provider's helpspec.
-
argument
-
get argument given to the value (selector)
-
argument: something
-
set argument given to the value (selector)
-
auxValue
-
an additional, arbitrary value
-
auxValue: something
-
set the auxValue - an arbitrary user value
-
choice: something
-
-
choiceValue
-
-
choiceValue: something
-
-
hierarchicalUUID
-
-
ignoreMnemonicKeys
-
if true, mnemonic (access character) in the submenus under the item are ignored;
Set this to speedup accelerator key processing for slow dynamci menus.
The default is set to false
Usage example(s):
ignoreMnemonicKeys ? false
|
-
ignoreMnemonicKeys: aBoolean
-
if true, mnemonic (access character) in the submenus under the item are ignored;
Set this to speedup accelerator key processing for slow dynamci menus.
The default is false
-
ignoreShortcutKeys
-
if true, shortcutKeys (accelerators) in the submenus under the item are ignored;
the default is set to false
Usage example(s):
ignoreShortcutKeys ? false
|
-
ignoreShortcutKeys: aBoolean
-
if true, shortcutKeys (accelerators) in the submenus under the item are ignored;
the default is set to false
-
indication
-
value of the items on/off indicator (CheckToggle).
Usually a valueHolder
-
indication: someValueHolder
-
value of the items on/off indicator (CheckToggle).
someValueHolder is usually a value holder
-
isVisible
-
a visibility holder; either a block, boolean or value holder.
If the menu is permanently visible, it should be a valueHolder,
as the value is otherwise only checked before the menu is opened
-
isVisible: something
-
a visibility holder; either a block, boolean or value holder.
If the menu is permanently visible, it should be a valueHolder,
as the value is otherwise only checked before the menu is opened
-
itemValue
-
the item's action; if it is a block, that is evaluated;
if a symbol, that message is sent to the menu's receiver
-
itemValue: aBlockOrSymbol
-
set the item's action; if it is a block, that is evaluated;
if a symbol, that message is sent to the menu's receiver
-
itemValue: selectorOrBlock argument: anArgument
-
set the item's action and an argument; if it is ablock, that is evaluated;
if a symbol, that message is sent to the menu's receiver
-
label: labelStringOrNil argument: someArgument
-
-
label: labelStringOrNil icon: anImage
-
Modified (format): / 27-12-2018 / 16:22:54 / Claus Gittinger
-
label: labelStringOrNil itemValue: selectorOrBlock
-
-
label: labelStringOrNil itemValue: selectorOrBlock argument: something
-
define label, value and an argument to be passed with the action
-
label: labelStringOrNil itemValue: selectorOrBlock enabled: enabledHolder
-
define label, value
and enabled holder, which can be a boolean, a boolean valueHolder,
a block or a selector (to be sent to the application)
-
label: labelStringOrNil itemValue: selectorOrBlock nameKey: nameKeyArg
-
-
label: labelStringOrNil itemValue: selectorOrBlock translateLabel: translateLabelBoolean
-
-
labelFromApplication
-
if true, the label is actually the name of a message to be sent to the appliction
to retrieve the label
-
labelFromApplication: aBoolean
-
if true, the label is actually the name of a message to be sent to the appliction
to retrieve the label
-
labelImage
-
-
labelImage: anImage
-
VW compatibility: if I have a label also,
-
nameKey
-
nameKey can be used to identify menu items independent of any language translated labels;
used as a tag or ID
(iff the menuItem is to be referred to later programmatically eg. to change its enabled state
or its icon)
-
nameKey: aNameKey
-
nameKey can be used to identify menu items independent of any language translated labels;
used as a tag or ID
(iff the menuItem is to be referred to later programmatically eg. to change its enabled state
or its icon)
-
rawLabel
-
-
rawLabel: aString
-
-
resourceRetriever
-
-
resourceRetriever: aRetriever
-
-
shortcutKey
-
get the key to press to select the menu item from the keyboard
-
shortcutKey: something
-
set the key to press to select the menu item from the keyboard
-
shortcutKeyCharacter
-
Backward compatibility; same as #shortcutKey.
get the key to press to select the menu item from the keyboard
-
shortcutKeyCharacter: something
-
Backward compatibility; same as #shortcutKey:.
set the key to press to select the menu item from the keyboard
-
submenu
-
get the submenu or nil
-
submenu: aMenu
-
set the submenu or nil
-
submenuProvider
-
useful if a sub-menu is plugged in from another application (i.e. when
a submenu is fetched via a channel AND the top-menus application cannot provide
it
-
submenuProvider: something
-
useful if a sub-menu is plugged in from another application (i.e. when
a submenu is fetched via a channel AND the top-menus application cannot provide
it
-
uuid
-
automationID
return my uuid component to be used for resource-access.
This is a unique and once-assigned-never-changed uuid by which
UI automators can access the menu item.
If it is defined, the generated Windows-Widget will get this automationID as
view-attribute.
-
uuid: aUUID
-
automationID
set my uuid component to be used for resource-access
(called by menuBuilder).
This is a unique and once-assigned-never-changed uuid by which
UI automators can access the menu item.
accessing-behavior
-
beOff
-
set indication off
-
beOn
-
set indication on
-
choice
-
return the menu items choice indicator (RadioButton)
-
disable
-
-
enable
-
-
enabled
-
returns a boolean, valueHolder or block
-
enabled: enabledHolder
-
enabledHolder can be a boolean, a boolean valueHolder,
a block or a selector (to be sent to the application)
-
hideMenuOnActivated
-
hide the menu when the item was activated; the default is true
Usage example(s):
hideMenuOnActivated ? true
|
-
hideMenuOnActivated: aBoolean
-
hide the menu when the item was activated; the default is true
-
keepLinkedMenu
-
if true, a linked submenu menu is only computed once (slightly faster),
but then, the linked menu cannot be dynamic
Usage example(s):
-
keepLinkedMenu: aBoolean
-
if true, a linked submenu menu is only computed once (slightly faster),
but then, the linked menu cannot be dynamic
-
sendToOriginator
-
if true, the message is sent to the originating widget;
otherwise (the default), it it sent to the receiver/application.
Usage example(s):
-
sendToOriginator: aBoolean
-
if true, the message is sent to the originating widget;
otherwise (the default), it it sent to the receiver/application.
-
showBusyCursorWhilePerforming
-
get the flag which controls if a busy cursor is to be shown
while performing the menu action. Defaults to false.
Usage example(s):
showBusyCursorWhilePerforming ? false
|
-
showBusyCursorWhilePerforming: aBoolean
-
set/clear the flag which controls if a busy cursor is to be shown
while performing the menu action. Defaults to false.
-
translateLabel
-
returns true if the label is to be translated.
The default is true
Usage example(s):
-
translateLabel: aBoolean
-
sets whether label is translated or not;
The default is true. You should disable translation IFF the item is showing
a value such as a name, fileName, etc.
-
triggerOnDown
-
returns true if the action is triggered when pressed.
The default is false (trigger when released)
Usage example(s):
-
triggerOnDown: aBoolean
-
controls if the action is triggered when pressed or released
accessing-channels
-
label: labelString submenu: aSymbolOrValueHolderOrBlockOrSubmenu
-
-
label: labelString submenu: aSymbolOrValueHolderOrBlockOrSubmenu enabled: enabledArg
-
-
label: labelString submenuChannel: aSymbolOrValueHolder
-
-
submenuChannel
-
get the submenuChannel or nil.
That is a submenu-value provider
-
submenuChannel: aMenuHolder
-
set the submenuChannel or nil.
That is a submenu-value provider
accessing-look
-
font
-
get the specific font for an item or nil
-
font: aFont
-
set a specific font for an item
-
hasMenuIndicator
-
returns whether item should always show a menu-indicator (arrow)
-
hasMenuIndicator: aBoolean
-
force the item to always show a menu-indicator (arrow)
-
horizontalLayout
-
by default, submenus have a vertical layout;
if true, the submenu has a horizontal layout.
Usage example(s):
-
horizontalLayout: aBoolean
-
by default, submenus have a vertical layout;
if true, the submenu has a horizontal layout.
-
icon: anImage
-
-
isButton
-
returns whether the item looks like a Button.
This is typically only used with toolbars
Usage example(s):
-
isButton: aBoolean
-
sets whether the item looks like a Button
This is typically only used with toolbars
-
isMenuSlice
-
returns true if the menu is a slice,
building its items into its container menu
Usage example(s):
-
isMenuSlice: aBoolean
-
isMenuSlice := aBoolean.
-
label
-
return the label without any &-chars
Usage example(s):
-
label: aStringOrMessageSelector
-
if labelFromApplication is true,
the label is actually the name of a message to be sent to the appliction
to retrieve the label
-
startGroup
-
start group #left #right #conditionalRight ... or nil
at the moment only #right and #conditionalRight are implemented
-
startGroup: aSymbol
-
start group #left #right #conditionalRight ...
at the moment only #right and #conditionalRight are implemented.
The meanings are:
nil - default under control of the menu
#left - left align
#right - place at the right far end
#conditionalRight - controlled by a styleSheet variable;
like #right under all non-win32 systems,
ignored on win32.
Use with help-menu, which should be at the far right on some
viewStyles, but not under win32.
accessing-resource
-
findGuiResourcesIn: aResourceContainerOrApplication
-
resolve national language translations from aResourceContainerOrApplication
-
findGuiResourcesIn: aResourceContainerOrApplication rememberResourcesIn: aValueHolderOrNil
-
resolve national language translations from aResourceContainerOrApplication.
In addition, expand %(xxx) by asking the application for an xxx aspect.
-
receiver: aReceiver perform: aSelector with: anArgument ifNone: aBlock
-
send the one-arg-message aSelector to the application;
the result returned from the send or nil is returned
-
resolveSliceMenuItemsIn: aReceiver for: originalReceiver rememberResourcesIn: aValueHolderOrNil
-
('MenuItem [info]: no aspect for slice ',submenuChannel) infoPrintCR.
-
resolveSliceMenuItemsIn: aReceiver rememberResourcesIn: aValueHolderOrNil
-
encoding & decoding
-
fromLiteralArrayEncoding: aLiteralEncodedArray
-
read my contents from a aLiteralEncodedArray
-
skippedInLiteralEncoding
-
define the inst-slots which are skipped when generating a literalArrayEncoding;
(to skip the ones with default values.)
-
virtualSlotsInLiteralEncoding
-
defines additional virtual slots in the literalEncoding.
These are not instvars, but accessed via getters and setters during
store and load.
Use this when flags encode values which were previously encoded as boolean instvars,
to remain backward compatible
printing & storing
-
printOn: aStream
-
(comment from inherited method)
append a user printed representation of the receiver to aStream.
The format is suitable for a human - not meant to be read back.
The default here is to output the receiver's class name.
BUT: this method is heavily redefined for objects which
can print prettier.
private-accessing
-
filteredLabel
-
return the label without any &-chars
queries
-
hasChoice
-
test whether choice exists
-
hasIndication
-
test whether indication on/off exists
-
hasSubmenu
-
-
isEnabled
-
an enabled holder; either a block, boolean or value holder.
If the menu is permanently visible, it should be a valueHolder,
as the value is otherwise only checked before the menu is opened
or the pointer enters the item (which makes it look strange)
-
isHidden
-
not yet supported
-
isMenuItem
-
-
isOff
-
test whether indication on/off exists and is off
-
isOn
-
test whether indication on/off exists and is on
-
isSeparatorItem
-
utilities
-
replaceArgument: oldValue with: newValue
-
Recusively replace argument in menu items where
current argument is equal to oldValue by newValue
|