|
|
Class: MenuPanel
Object
|
+--GraphicsContext
|
+--DeviceGraphicsContext
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--MenuPanel
|
+--ColorMenu
|
+--FontMenu
- Package:
- stx:libwidg2
- Category:
- Views-Menus
- Version:
- rev:
1.503
date: 2010/03/09 12:10:03
- user: cg
- file: MenuPanel.st directory: libwidg2
- module: stx stc-classLibrary: libwidg2
- Author:
- Claus Atzkern
a menu panel used for both pull-down-menus and pop-up-menus.
this will eventually replace most of the MenuView and PopUpMenu stuff.
(and hopefully be ST-80 compatible ...)
To create a menu, there exists a MenuEditor which will generate
a menu specification.
Notice:
This is going to replace the obsolete MenuView.
cg: this code is so ugly - needs a complete rewrite...
Menu
MenuItem
MenuEditor
class initialization
-
initialize
-
-
preSnapshot
-
remove all resources
default icons
-
delayedMenuIndicator
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
-
iconIndicationDisabledOff
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
-
iconIndicationDisabledOn
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
-
iconIndicationOff
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
-
iconIndicationOn
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
-
iconRadioGroupDisabledOff
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
-
iconRadioGroupDisabledOn
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
-
iconRadioGroupEnteredOff
-
-
iconRadioGroupEnteredOn
-
-
iconRadioGroupOff
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
-
iconRadioGroupOn
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
-
menuIndicator
-
This resource specification was automatically generated
by the ImageEditor of ST/X.
defaults
-
defaultBackgroundColor
-
-
defaultLevel
-
-
delayedMenuIndicatorOffset
-
returns an additional offset between the label and the
delayedMenu indication (i.e. the down-arrow icon)
-
maxShortCutSearchLevel
-
1 means: only search in top items.
2 means: search one level of menus.
used to be 10
-
maxShortCutSearchLevel: anInteger
-
1 means: only search in top items.
2 means: search one level of menus.
-
menuIndicatorOffset
-
returns an additional offset between the label and the
delayedMenu indication (i.e. the down-arrow icon)
-
mnemonicIdentifier
-
returns the identifier each mnemonic starts with;
ex:
&File mnemonic := Cmdf
F&ile mnemonic := Cmdi
.....
-
updateStyleCache
-
extract values from the styleSheet and cache them in class variables
image registration
-
image: anImage onDevice: aDevice
-
Images := nil
-
lightenedImage: anImage onDevice: aDevice
-
LigthenedImages := nil
instance creation
-
fromSpec: aSpec
-
-
fromSpec: aSpec receiver: aReceiver
-
-
labels: labels
-
-
labels: labels nameKeys: nameKeys
-
-
labels: labels nameKeys: nameKeys receiver: aReceiver
-
-
labels: labels receiver: aReceiver
-
-
menu: aMenu
-
-
menu: aMenu receiver: aReceiver
-
private
-
subMenu: aSubMenu
-
create a submenu; can be redifined in derived classes
accepting
-
accept
-
accept current selected item
-
accept: anItem
-
this is the topMenu: accept item
-
accept: anItem index: anIndex toggle: aState receiver: aReceiver
-
accept an item
-
acceptItem: anItem inMenu: aMenu
-
-
lastItemAccepted
-
returns last item selected or nil
-
lastValueAccepted
-
returns last value accepted or nil
accessing
-
accessCharacterPositionAt: stringOrNumber
-
get the access character position for a textLabel
-
accessCharacterPositionAt: stringOrNumber put: anIndexOrNil
-
get the access character position for a textLabel
-
accessCharacterPositions
-
returns a collection of accessCharacterPositions or nil
-
accessCharacterPositions: something
-
define accessCharacterPositions for each item
-
args
-
returns a collection of arguments or nil
-
args: something
-
define arguments for each item
-
argsAt: stringOrNumber
-
gets the argument of an item or nil
-
argsAt: stringOrNumber put: anArgument
-
sets the argument of an item
-
doAccessCharacterTranslation
-
true if &-chars in a label are to be treated as accessCharacter indicators.
Can be set to false to leave labels unchanged
-
doAccessCharacterTranslation: aBoolean
-
true if &-chars in a label are to be treated as accessCharacter indicators.
Can be set to false to leave labels unchanged
-
enteredItem
-
return the item over which the mouse pointer is located;
nil if the mouse is not over any item
-
groupSizes
-
gets collection of group sizes
-
groupSizes: aGroupSizes
-
sets collection of group sizes
-
hideOnRelease
-
-
hideOnRelease: aBoolean
-
-
labelAt: stringOrNumber
-
gets the label of an item or nil
-
labelAt: stringOrNumber put: aLabel
-
sets the label of an item
-
labels
-
returns a collection of labels's or nil
-
labels: labels
-
define labels for each item
-
menuPerformer: anObject
-
set the menu-receiver. Thats the one who gets the messages ( both from myself and
from all submenus no specific receiver is defined ).
-
nameKeyAt: stringOrNumber
-
gets the nameKey of an item or nil
-
nameKeyAt: stringOrNumber put: aNameKey
-
sets the nameKey of an item
-
nameKeys
-
returns a collection of nameKeyss or nil
-
nameKeys: something
-
define nameKeys for each item
-
numberOfItems
-
gets number of items
-
originator
-
-
receiver
-
get the menu-receiver. Thats the one who gets the messages ( both from myself and
from all submenus no specific receiver is defined ).
-
receiver: anObject
-
set the menu-receiver. Thats the one who gets the messages ( both from myself and
from all submenus no specific receiver is defined ).
-
shortcutKeyAt: stringOrNumber
-
gets the shortCutKey of an item or nil
-
shortcutKeyAt: stringOrNumber put: aKey
-
sets the shortCutKey of an item
-
shortcutKeys
-
returns a collection of shortcutKeys or nil
-
shortcutKeys: something
-
define shortcutKeys for each item
-
valueAt: stringOrNumber
-
gets value of an item; a block, valueHolder, ...
-
valueAt: stringOrNumber put: someThing
-
sets value of an item; a block, valueHolder, ...
-
values: something
-
define values for each item
accessing-behavior
-
disableAll
-
disable all items; not the menu in case of enabled
-
disableAll: collectionOfIndicesOrNames
-
disable an collection of items
-
enableAll
-
enable all items; not the menu in case of disabled
-
enableAll: collectionOfIndicesOrNames
-
enable an collection of items
-
enabled
-
returns enabled state
-
enabled: aState
-
change enabled state of menu
-
enabledAt: stringOrNumber
-
gets the enabled state of an item or false
-
enabledAt: stringOrNumber put: aState
-
sets the enabled state of an item
-
exclusivePointer: aBoolean
-
Do nothing here. Compatibility with PopUpListController
-
isEnabled: stringOrNumber
-
gets the enabled state of an item or false
accessing-channels
-
enableChannel: aValueHolder
-
set my enableChannel
-
menuChannel
-
-
menuHolder: aValueHolder
-
set my menuHolder
accessing-color & font
-
activeBackgroundColor
-
get the background drawing color used to highlight selection
-
activeForegroundColor
-
get the foreground color used to highlight selections
-
backgroundColor
-
return the background color
-
backgroundColor: aColor
-
set the background drawing color. You should not use this method;
instead, leave the value as defined in the styleSheet.
-
buttonActiveBackgroundColor
-
get the background drawing color used to highlight button selection
-
buttonActiveForegroundColor
-
get the foreground drawing color used to highlight button selection
-
buttonEdgeStyle
-
get the button edge style
-
buttonEnteredBackgroundColor
-
get the background drawing color used to highlight entered button items
-
buttonEnteredLevel
-
get the 3D-level used to highlight entered button items
-
buttonHalfLightColor
-
get the background drawing color used to half light button frame
-
buttonHalfShadowColor
-
get the background drawing color used to half shadow button frame
-
buttonLightColor
-
get the background drawing color used to light button frame
-
buttonPassiveBackgroundColor
-
get the background drawing color used for button
-
buttonShadowColor
-
get the background drawing color used to shadow button frame
-
disabledEtchedForegroundColor
-
return the color used for etching disabled items.
If nil, no 3D effect is drawn.
-
disabledForegroundColor
-
return the foreground color used by disabled items
-
enteredBackgroundColor
-
return the background color for entered items
-
enteredForegroundColor
-
return the foreground color for entered items
-
font: aFont
-
set the font
-
foregroundColor
-
return the passive foreground color
-
foregroundColor: aColor
-
set the foregroundColor drawing color. You should not use this method;
instead leave the value as defined in the styleSheet.
-
maxAbsoluteButtonLevel
-
returns the maximum absolute button level; used to compute the preferred
extent of a button
-
selectionFrameBrightColor
-
get the selection frame bright color
-
selectionFrameDarkColor
-
get the selection frame dark color
-
setFont: aFont
-
set the font if the argument is nonNil;
Return nil, if the font was unchanged; otherwise, return the old font
-
viewBackground: aColor
-
accessing-dimensions
-
height
-
default height
-
maxExtent
-
-
preferredExtent
-
compute and returns my preferred extent
-
preferredExtentOfItems
-
compute and returns my preferred extent including all items
!!! changes have influence on method #rearrangeItems !!!
-
preferredWidth: aWidthOrNil
-
used for example by combo box to setup the preferred width for the popup menu.
If nil (default), the width is computed from the contained items.
If not nil, the width is the maximum from the contained items and the required width.
-
shortKeyInset
-
left inset of shortcutKey
-
stringOffsetXfor: anItem
-
return the x offset for a MenuItem where to draw the text
-
subMenuIndicationWidth
-
accessing-interactors
-
iconIndicationDisabledOff
-
-
iconIndicationDisabledOn
-
-
iconIndicationOff
-
-
iconIndicationOn
-
-
iconRadioGroupDisabledOff
-
-
iconRadioGroupDisabledOn
-
-
iconRadioGroupEnteredOff
-
-
iconRadioGroupEnteredOn
-
-
iconRadioGroupOff
-
-
iconRadioGroupOn
-
accessing-items
-
itemAt: stringOrNumber do: aOneArgBlock
-
evaluate the block for an item and return the result from the block. In case that
the item does not exist nil is returned
-
itemAt: stringOrNumber do: aOneArgBlock ifAbsent: exceptionBlock
-
evaluate teh block for an item and return the result from the block. In case that
the item does not exists the result of the exception block is returned (no arguments)
-
itemAtIndex: anIndex
-
returns item at an index or nil
-
items
-
returns list of items or nil
accessing-look
-
buttonActiveLevel
-
get the buttons active level
-
buttonPassiveLevel
-
get the buttons passive level
-
centerItems
-
-
centerItems: aBoolean
-
-
fitFirstPanel
-
gets true if the first panel in the menu hierarchy must be fit
to the extent of its superView
NOT SUPPORTED
-
fitFirstPanel: aState
-
sets true if the first panel in the menu hierarchy must be fit
to the extent of its superView
NOT SUPPORTED
-
level: anInt
-
-
rightArrow
-
-
rightArrowShadow
-
-
showGroupDivider
-
get the enabled flag for showing groupDiveders
-
showGroupDivider: aState
-
set the enabled flag for showing groupDiveders
-
showSeparatingLines
-
gets true if drawing of separating lines is enabled.
-
showSeparatingLines: aState
-
turn on/off drawing of separating lines.
-
verticalLayout
-
get the layout: vertical( true ) or horizontal( false )
-
verticalLayout: aState
-
set the layout: vertical( true ) or horizontal( false )
accessing-style
-
buttonInsetX
-
returns the verical button space
-
buttonInsetY
-
returns the verical button space
-
drawMenuIndicatorSeparatorLine
-
-
enteredLevel
-
returns the enter-level for an unselected item moved through
-
groupDividerSize
-
returns the width of a group divider
-
itemMargin
-
returns the margin of an item
-
itemSpace
-
returns the additional space for an item in a (vertical) panel
-
menuIndicatorVerticalPosition
-
#center, #top or #bottom
-
selectionFollowsMouse
-
returns true if the selection follows the mouse
-
shortcutKeyOffset
-
returns the offset for a shortcutKey
accessing-submenu
-
subMenuAt: stringOrNumber
-
gets the current submenu of an item; if the submenu is nil, the
submenu is generated if specified otherwise nil is returned.
-
subMenuAt: stringOrNumber put: aSubMenu
-
sets the submenu of an item
-
subMenuShown
-
return the currently visible submenu - or nil if there is none
activation & deactivation
-
closeMenus
-
close all menus without accepting
-
hide
-
hide the view, leave its modal event loop
-
show
-
realize the view at its last position;
return the value of the selectedItem or nil, of none was selected
(unless the menu has already performed its action, by sending an appropriate message
to some performer)
-
showAt: aPoint
-
realize the view at aPoint.
return the value of the selectedItem or nil, of none was selected
(unless the menu has already performed its action, by sending an appropriate message
to some performer)
-
showAt: aPoint resizing: aBoolean
-
realize the view at aPoint; return nil if no item was selected,
or if I have already performed.
Return the items value, otherwise.
Notice, that this is returned back to the one who started this
menu (i.e. the view or controller), which will perform the action
if a non-nil is returned.
-
showAtPointer
-
realize the view at the current pointer position.
return the value of the selectedItem or nil, of none was selected
(unless the menu has already performed its action, by sending an appropriate message
to some performer)
-
showCenteredIn: aView
-
make myself visible at the screen center.
return the value of the selectedItem or nil, of none was selected
(unless the menu has already performed its action, by sending an appropriate message
to some performer)
-
startUp
-
realize the menu at the current pointer position
return the value of the selectedItem or nil, of none was selected
(unless the menu has already performed its action, by sending an appropriate message
to some performer)
-
startUpAt: aPoint
-
realize the menu at aPoint
return the value of the selectedItem or nil, of none was selected
(unless the menu has already performed its action, by sending an appropriate message
to some performer)
-
startUpFor: originatingWidget
-
realize the menu at the current pointer position
return the value of the selectedItem or nil, of none was selected
(unless the menu has already performed its action, by sending an appropriate message
to some performer)
-
startUpOrNil
-
realize the menu at the current pointer position
return the value of the selectedItem or nil, of none was selected
(unless the menu has already performed its action, by sending an appropriate message
to some performer)
adding & removing
-
createAtIndex: anIndexOrNil
-
create an item and add this item to the index. In case of nil, the item
is added to the end. If the index is not valid nil is returned;
otherwise the new created item is returned.
-
remove: stringOrNumber
-
remove the first item which is assigned to stringOrNumber;
if found, remove and return it
-
removeAll
-
remove all items and submenus
change & update
-
update: something with: aParameter from: changedObject
-
converting
-
asMenu
-
convert contents to a menu
-
fromSpec: aMenuSpec
-
build from spec
-
menu: aMenu
-
convert to Menu
dependents access
-
addDependencies
-
add all dependencies
-
removeDependencies
-
remove all dependencies
drawing
-
disabledRedrawDo: aBlock
-
evaluate a block without redrawing within the block; after processing
of the block a redraw might be performed
-
drawButtonEdgesFor: anItem level: aLevel
-
-
drawFocusForItem: anItem
-
-
drawItemsX: x y: y width: w height: h
-
redraw items and groups in a damage
-
drawLabelEdgeFor: anItem selected: isSelected
-
-
drawScrollerAt: aDirection bounds: bounds
-
draw a scroller
-
invalidateItem: anItem repairNow: aBool
-
an item changed; invalidate the items layout
-
mustRearrange
-
force rearrange (i.e. set the rearrange flag)
-
rearrangeGroups
-
implements the groupIdentifier #right/#conditionalRight in a horizontal menu
-
rearrangeItems
-
recompute the layout of each item
!!! changes have influence on method #preferredExtentOfItems !!!
-
rearrangeItemsIfItemVisibilityChanged
-
check for items which can change its visibility;
if at least one item exists, rearrange all items
-
redrawX: x y: y width: w height: h
-
redraw a damage
-
updateEnteredItem
-
enumerting & searching
-
collect: aOneArgBlock
-
evaluate the argument, aOneArgBlock for every item in the menuPanel
and return a collection of the results
-
do: aOneArgBlock
-
evaluate the argument, aOneArgBlock for every item in the menuPanel.
-
findFirst: aOneArgBlock
-
find the index of the first item, for which evaluation of the argument, aOneArgBlock
returns true; return its index or 0 if none detected.
-
findLast: aOneArgBlock
-
find the last item, for which evaluation of the argument, aOneArgBlock
returns true; return its index or 0 if none detected.
-
firstItemSelectable
-
returns the first item which is selectable or nil
-
indexOf: something
-
returns index of an item assigned to an index, nameKey, textLabel or value if symbol.
If no item match 0 is returned. No range checks are performed on a number argument
-
indexOfItem: anItem
-
returns the index of the item or 0
-
keysAndValuesDo: aTwoArgBlock
-
evaluate the argument, aTwoArgBlock for every item in the menuPanel.
event handling
-
buttonMotion: state x: x y: y
-
open or close the corresponding submenu
-
buttonPress: button x: x y: y
-
any button pressed; open or close the corresponding submenus
-
buttonRelease: button x: x y: y
-
button release action; accept selection and close all views
-
handleSizeChanged: how
-
used to handle the scrollers and groups in a none popUpView
-
keyPress: key x: x y: y
-
any key is pressed
-
mapped
-
-
mouseWheelMotion: buttonState x: x y: y amount: amount deltaTime: dTime
-
mousewheel action
-
pointerLeave: state
-
-
sizeChanged: how
-
redraw #right groups
event handling-processing
-
clearImplicitGrab
-
-
dispatchEvent: ev withFocusOn: focusView delegate: doDelegate
-
dispatch and handle an event
-
handleButtonMotion: state atPoint: motionPoint
-
open or close the corresponding submenus
-
handleButtonPress: button atPoint: aPoint
-
a button pressed; open or close the corresponding submenus
-
handleCursorKey: aKey
-
handle a cursor key
-
handleKeyPress: key
-
any key is pressed
-
handlePointerLeave: state
-
-
handleReturnPressed
-
any key is pressed
-
pointerEntersItem: anItemOrNil
-
the pointer moves over an item or nil; restore the old item and
redraw the new item highlighted.
focus handling
-
canTab
-
depends whether I'am a toolbar and selectable items exists
-
focusComesByTab
-
returns true if focus comes by tab and should be drawn
-
focusComesByTab: aBoolean
-
only handled for toolBars
-
hasKeyboardFocus: aBoolean
-
notification from the windowGroup that I got/lost the keyboard focus.
-
showFocus: focusComesByTab
-
-
showNoFocus: focusByTab
-
-
supportsFocusOnTab
-
returns true if focus is supported
-
wantsFocusWithButtonPress
-
needs only the focus if I'am a toolbar; all events are delegated
to my subMenus
grabbing
-
doGrab
-
-
doUngrab: forceDo
-
-
grabKeyboard
-
grap the keyboard; keep previous grab
-
grabMouseAndKeyboard
-
get exclusive access to pointer and keyboard
-
grabPointerWithCursor: aCursorOrNil
-
grap the pointer; keep previous grab
-
ungrabKeyboard
-
ungrap the keyboard; restore previous grab
-
ungrabMouseAndKeyboard
-
ungrab resources (mouse and keyboard)
-
ungrabPointer
-
ungrap the pointer; restore previous grab
help
-
flyByHelpSpec
-
allows subclasses to provide texts
-
flyByHelpTextAt: aPoint
-
return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
If there is a selection, that items helpText is used (ignoring the given point).
-
flyByHelpTextForItem: anItem
-
returns the helpText for an item (empty if none)
-
flyByHelpTextForKey: aKey
-
-
helpText
-
return the helpText for the currently selected item (empty if none)
-
helpTextAt: aPoint
-
return the helpText for aPoint (i.e. when mouse-pointer is moved over an item).
If there is a selection, that items helpText is used (ignoreing the given point).
-
helpTextForItem: anItem
-
returns the helpText for an item (empty if none)
-
withMenuAndItemAt: srcPoint do: aBlock
-
image registration
-
imageOnMyDevice: anImage
-
returns image registered on device
-
lightenedImageOnDevice: anImage
-
returns lightened image registered on device
initialization & release
-
addToCurrentProject
-
ignored here
-
create
-
create the shadow view for a none contained submenu
-
destroy
-
destroy items and shadowView; remove dependencies
-
fetchDeviceResources
-
fetch device colors, to avoid reallocation at redraw time
-
initStyle
-
initialize style specific stuff
-
initialize
-
set default configuration
-
map
-
grab the pointer here, when visible (but not if control has already been lost).
If the grab fails, try again and unmap myself if that fails too.
-
realize
-
realize menu and shadowView
-
recreate
-
this is called after a snapin or a migration.
If the image was saved with an active menu, hide the menu
-
reinitStyle
-
handle style change while being open (win32 only - for now)
-
unmap
-
unmap the view - the view stays created (but invisible), and can be remapped again later.
If we have a popup supermenu, it will get all keyboard and mouse events.
-
updateLevelAndBorder
-
update level & border
keyboard control
-
mnemonicViewNext: aKeyEvent
-
a mnemonicKey event as forwarded from the keyboardProcessor - if there
is the mnemonic-key defined for any menuItem, handle the menuItem and
return the topMenu otherwise nil.
-
openMenusFromItemIndices: anItemIndiceList
-
open all menus derived from sequence of item indices
-
processCollectedIndices: indices
-
-
processShortcut: aKeyEvent
-
a shortcutKey event as forwarded from the keyboardProcessor.
If there is a shortcut-key defined, process it and return true.
Otherwise return false.
-
selectItemIndicesFor: aOneArgBlock maxDepth: maxDepth from: aStart to: aStop ignoreSubmenuBlock: ignoreSubmenueBlock
-
returns the sequence of indices up to the item for which the block returns true.
The first entry is the topmenu, the last entry the item for which the block returns
true. If no item is detected, nil is returned.
If the ignoreSubmenueBlock is not nil, the menu under the item (argument to the block)
is created and passed through if the block returns false.
Otherwise the item is not asked for its submenu.
misc
-
raiseDeiconified
-
-
superMenu
-
returns supermenu or nil
-
topMenu
-
returns the topMenu; the one having no superMenu
printing & storing
-
printOn: aStream
-
private
-
application
-
optimize access to retrive the application
-
detectItem: aBlock
-
returns the item for which aBlock returns true.
-
detectItemForKey: aKey
-
returns the item assigned to a key, accessCharacter or starts with.
if no item is detected nil is returned.
-
detectItemForLabel: aLabel
-
-
detectItemForNameKey: aKey
-
-
menuAdornmentAt: aSymbol
-
returns a value derived from adornment
-
menuAdornmentAt: aSymbol put: something
-
sets a value for the specific menu
-
onEachPerform: aSelector withArgList: aList
-
on each item perform selector with an argument derived from aList
-
registerImageOnDevice: anImage
-
-
superMenu: aSuperMenu
-
set my supermenu from which i'am activated
private-activation
-
activeMenu
-
returns the current active menu or self (the top menu)
-
activeMenu: aMenu
-
set the current active menu
-
becomesActiveMenu
-
submenu becomes the active menu
-
clearLastActiveMenu
-
reset the current active menu
-
mapTime
-
get the time the menu was activated or nil
-
mapTime: aTimestamp
-
set the time the menu was activated
private-scrolling
-
hasScrollerAt: aDirection
-
returns true if a visible scroller at a direction exists
-
hasScrollers
-
returns true if scrollers are needed
-
indexOfItemAtScroller: aDirection
-
returns the index of the item under the scroller or 0
-
makeItemVisible: anItem
-
make an item visible
-
scrollActivity
-
returns the one and only scrollActivity - data holder
for a menu and all contained submenus
-
scrollerBoundsAt: aDirection
-
returns the bounds of the scroller at a direction
-
scrollerDirectionAtPoint: aPoint
-
returns the scroller-direction at aPoint, or nil
private-searching
-
detectGrabMenu
-
returns the menu which is responsible for the grap; the last opened menu
-
detectMenuAtGrabPoint: aGrabPoint
-
returns the menu which contains the grab-point
-
detectViewAtX: x y: y in: aTopView
-
detect view at x@y
-
itemAt: stringOrNumberOrPoint
-
returns item assigned to an index, nameKey, textLabel or value if symbol.
If no item match nil is returned.
-
itemAtPoint: aPoint
-
returns the item at aPoint or nil if none detected
-
superMenuAtPoint: aPoint
-
returns the superMenu which contains aPoint, or nil if none detected
queries
-
container: aView
-
-
containsPoint: aPoint
-
returns true if the argument, aPoint is contained by the view
-
containsPointX: x y: y
-
returns true if point is contained by the view
-
hasGroupDividerAt: anIndex
-
returns true if a divider is defined at an index
-
hasGroupDividers
-
returns true if any group divider exists
-
isActive
-
true, if I have the focus (w.r.t the windowing system);
i.e. if one of my subViews actually has the real focus.
With click-to-focus behavior, this is obviously the current application.
Use this query with caution, for example, to suppress tooltips for inactive apps.
This should be only in TowView, but apparently MenuPanel is used as a TopView
-
isFitPanel
-
returns true if the panel is the first in the menu hierarchy in must
be fit to the extent of its superView;
NOT SUPPORTED
-
isPopUpView
-
return true if view is a popup view; without decoration
and popUp to top immediately
-
isVerticalLayout
-
returns true if vertical layout otherwise false( horizontal layout )
-
isViewWrapper
-
-
type
-
selection
-
hasSelection
-
returns true if a selection exists
-
openDelayed: anItem
-
-
openDelayed: anItem afterSeconds: seconds
-
-
selection
-
returns current selected item or nil
-
selection: anItemOrNil
-
change selection to an item or nil
if the item has a submenu the first item might be selected (style-sheet)
-
selection: anItemOrNil openMenu: openMenu
-
change selection to an item or nil
-
selectionIndex
-
returns index of current selection or 0
-
selectionIndex: anIndex
-
set selection at an index
translation
-
translateGrabPoint: aGrabPoint
-
translate the grab point into self
-
translateMenuPoint: aPoint toMenu: aMenu
-
translate a point into another menu its point
-
translatePoint: aPoint to: anotherWindowOrNilForScreen
-
translate a point in my window to anotherWindowOrNilForScreen (or root window if nil)
Item
ScrollActivity
start as PullDownMenu
|top subView mview desc s1 s2 s3 img lbs labels|
top := StandardSystemView new.
mview := MenuPanel in:top.
labels := #( 'foo' 'bar' 'baz' 'test' 'claus' ).
mview level:2.
mview verticalLayout:false.
img := Image fromFile:'bitmaps/SBrowser.xbm'.
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test' with:'ludwig'.
mview labels:lbs.
mview shortcutKeyAt:2 put:#Cut.
mview accessCharacterPositionAt:1 put:1.
mview accessCharacterPositionAt:2 put:2.
mview enabledAt:5 put:false.
mview groupSizes:#( 2 2 ).
s1 := MenuPanel labels:labels.
s1 accessCharacterPositionAt:1 put:1.
s1 accessCharacterPositionAt:2 put:2.
s1 groupSizes:#( 2 2 ).
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
s3 := MenuPanel labels:lbs.
s1 subMenuAt:2 put:s2.
s1 subMenuAt:3 put:(MenuPanel labels:lbs).
s2 subMenuAt:3 put:s3.
s3 subMenuAt:3 put:(MenuPanel labels:labels).
s3 shortcutKeyAt:3 put:$q.
mview subMenuAt:1 put:s1.
mview subMenuAt:4 put:(MenuPanel labels:lbs).
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
s1 shortcutKeyAt:1 put:#Copy.
s1 shortcutKeyAt:3 put:#Paste.
mview subMenuAt:2 put:(MenuPanel labels:labels).
top extent:(mview preferredExtent).
top open.
|
|top menu view item|
top := StandardSystemView extent:240@100.
menu := MenuPanel in:top.
menu labels:#( 'foo' 'Application' 'Clock' ).
menu verticalLayout:false.
menu subMenuAt:1 put:(MenuPanel labels:#( 'bar' 'baz' )).
menu subMenuAt:2 put:(MenuPanel labels:#( 'foo' 'bar' 'baz' )).
view := ClockView new.
view preferredExtent:100@100.
item := menu itemAt:3.
item submenu:view.
view := SimpleView new.
view client:(CodingExamples_GUI::GUIDemoExtendedComboBox new).
view preferredExtent:(400@50).
item := menu itemAt:2.
item submenu:view.
menu origin:0@0 corner:1.0@30.
top open.
|
start as PopUpMenu
|subView mview desc s1 s2 s3 img lbs labels|
mview := MenuPanel new.
labels := #( 'foo' 'bar' 'baz' ).
mview level:2.
img := Image fromFile:'bitmaps/SBrowser.xbm'.
lbs := Array with:'foo' with:'bar' with:img with:'baz' with:'test'.
mview labels:lbs.
s1 := MenuPanel labels:labels.
s2 := MenuPanel labels:#( '1' nil '2' '-' '3' '=' '4' ' ' '5' ).
s3 := MenuPanel labels:lbs.
s1 subMenuAt:2 put:s2.
s1 subMenuAt:3 put:(MenuPanel labels:lbs).
s2 subMenuAt:3 put:s3.
s3 subMenuAt:3 put:(MenuPanel labels:labels).
s3 shortcutKeyAt:3 put:$q.
mview subMenuAt:1 put:s1.
mview subMenuAt:4 put:(MenuPanel labels:lbs).
(mview subMenuAt:4) shortcutKeyAt:3 put:#Copy.
s1 shortcutKeyAt:1 put:#Copy.
s1 shortcutKeyAt:3 put:#Paste.
mview subMenuAt:2 put:(MenuPanel labels:labels).
mview startUp
|
start from menu spec
|menu|
menu := MenuPanel menu:
#(#Menu #( #(#MenuItem
#label: 'File'
#submenu:
#(#Menu #(#(#MenuItem #label: 'quit' #value:#quit )
(#MenuItem
#label: 'edit'
#submenu:
#(#Menu #( #(#MenuItem #label: 'edit' #value:#edit )
#(#MenuItem #label: 'close' #value:#close)
)
nil
nil
)
)
#(#MenuItem #label: 'help' #value:#help )
)
nil
nil
)
)
#(#MenuItem #label: 'Inspect' #value:#inspectMenu )
#(#MenuItem #label: 'Bar'
#submenu:
#(#Menu #( #(#MenuItem #label: 'bar 1' #value:#bar1 )
#(#MenuItem #label: 'bar 2' #value:#bar2 )
)
nil
nil
)
)
)
#( 2 )
nil
) decodeAsLiteralArray.
menu verticalLayout:false.
Transcript showCR:(menu startUp).
|
|