FredKiefer@gmx.de
)khelekir@encomix.es
)mhanni@sprintmail.com
)Copyright: (C) 1999 Free Software Foundation, Inc.
- Declared in:
- AppKit/NSMenuView.h
- Conforms to:
- NSCoding
- NSMenuView
Standards:
- MacOS-X
- OpenStep
- GNUstep
The NSMenu class uses an object implementing the
NSMenuView protocol to do the actual drawing.
Normally there is no good reason to
write your own class implementing this protocol.
However if you want to customize your menus you
should implement this protocol to ensure that it works
nicely together with sub/super menus not using your
custom menu representation.
How menus are drawn
This class implements several menu look and feels at the
same time. The looks and feels implemented are:
Returns the height of the menu bar.
Attach submenu if the item at index is a submenu. It will figure out if the new submenu should be transient or not.
Returns visible attached submenu.
Returns menu view associated with visible attached submenu.
Detaches currently visible submenu window from main menu.
Returns the default font used to draw the menu text.
Returns the index of the highlighted item. Returns -1 if there is no highlighted item.
Returns horizontal space used for padding between menu item elements (state image, title image, title, key equivalent, submenu arrow image).
Returns the starting horizontal position for drawing the image and title.
Returns the width of the image and title section. Tis section contains image and text of menu item.
Returns the index of the item below point. Returns -1 if mouse is not above a menu item.
Creates new instance and sets menu to torn off state with NSMenu's setTornOff:.
Returns bounds rectangle of the menu view. It is smaller by 1 pixel in width than menu window (dark gray border at left).
Returns YES
, if this object is an
visivle attached submenu's view. Returns
NO
otherwise.
Returns YES
if menu items are
displayed horizontally, NO
if
vertically.
Returns YES
, if this object is
associated with torn off menu (menu with a close
button on title bar).
Creates new item cell for the newly created menu item, marks cell and menu view as needing to be resized. This method is invoked when NSMenuDidAddItemNotification received. The notification parameter contains index of changed menu item and can be accessed with NSMenuItemIndex key.
Marks menu item cell associated with the menu item and menu view as needing to be resized. This method is invoked when NSMenuDidChangeItemNotification received. The notification parameter contains index of changed menu item and can be accessed with NSMenuItemIndex key.
Removes cell associated with removed menu item, removes highlighting if removed menu item was highlighted, marks cell and menu view as needing to be resized. This method is invoked when NSMenuDidRemoveItemNotification received. The notification parameter contains index of changed menu item and can be accessed with NSMenuItemIndex key.
Returns the starting position for drawing the key equivalent. Key equivalent can be submenu arrow if menu item has submenu.
Returns the width of key equivalent text. Key equivalent can be submenu arrow if menu item has submenu
Returns the correct frame origin for aSubmenu based on the location of the receiver. This location may depend on the current NSInterfaceStyle.
Returns the NSMenu associated with this menu view.
Returns cell associated with item at index.
Return YES
if menu view contents
changed and needs to be resized.
Description forthcoming.
Returns frame rectangle of menu item cell. It is smaller by 1 pixel in width than menu window (dark gray border).
Sets the default font to use when drawing the menu text.
Highlights item with at index. If index is -1 all highlighing is removed.
Sets menu orientation. If YES
menu items
are displayed from left to right, if NO
from top to bottom (vertically). By default, menu
items are displayed vertically.
Sets amount of pixels added between menu item elements to pad.
Sets the menu to be displayed in to menu. Also this method adds this menu view to the menu's list of observers, mark view to force recalculation of layout with setNeedsSizing:YES, and updates itself with update method.
Replaces item cell at index with cell. Highlighting of item is preserved.
Calls setNeedsDisplayInRect: for rectangle occupied by item at index.
Sets the flag whether layout needs to be
resized. Set it to YES
if menu
contents changed and layout needs to be
recalculated. This method is used internally.
Yout should not invoke it directly from applications.
Resize menu view frame to be appropriate in size to
attach to screenRect at preferredEdge.
For popup's menu, if selectedItemIndex is
other than -1, position view so selected item covers
the NSPopUpButton.
NOTE: preffered edge positioning doesn't
implemented yet!
Description forthcoming.
Returns the starting horizontal position for drawing the state image.
Returns the width of the state image.
This method is responsible for tracking the mouse
while this menu is on the screen and the user is busy
navigating the menu or one of it submenus.
Responsible does not mean that this method does
it all. For submenus for example it will call,
indirectly, itself for submenu under
consideration. It will return
YES
if user released mouse, not above a
submenu item. NO
in all other
circumstances. Implementation detail:
YES
when a new submenu is attached.
The effect is that the highlighting / attaching /
detaching is supressed for this menu. This is
done so the user is given a change to move the
mouse pointer into the newly attached submenu.
Otherwise it would immediately be removed as
the mouse pointer move over another item. The logic
for resetting the flag is rather adhoc.
Adds title view for application menu and submenus, removes title view if menu is owned by NSPopUpButton, adds close button to title view for torn off menus and removes it for other type of menu.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.
Warning the underscore at the start of the name of this instance variable indicates that, even though it is not technically private, it is intended for internal use within the package, and you should not use the variable in other code.