Derived from: public BMenuItem
Declared in: <interface/MenuItem.h>
A BSeparatorItem is a menu item that serves only to separate the items that precede it in the menu list from the items that follow it. It's drawn as a horizontal line across the menu from the left border to the right. Although it has an indexed position in the menu list just like other items, it doesn't have a label, can't be selected, sends no messages, and is permanently disabled.
Since the separator is drawn horizontally, it's assumed that items in the menu are arranged in a column, as they are by default. It's inappropriate to use a separator in a menu bar or another menu where the items are arranged in a row.
A separator can be added to a BMenu by constructing an object of this class and calling BMenu's AddItem() function. As a shorthand, you can simply call BMenu's AddSeparatorItem() function, which constructs the object for you and adds it to the list.
A BSeparatorItem that's returned to you (by BMenu's ItemAt() function, for example) will always respond NULL to Message(), Command(), and Submenu() queries and false to IsEnabled().
See also: BMenu::AddSeparatorItem()
BSeparatorItem(void) BSeparatorItem(BMessage *archive)
Initializes the BSeparatorItem and disables it.
virtual ~BSeparatorItem(void)
Does nothing.
static BSeparatorItem *Instantiate(BMessage *archive)
Returns a new BSeparatorItem object, allocated by new and created with the version of the constructor that takes a BMessage archive. However, if the archive message doesn't contain data for a BSeparatorItem object, the return value is NULL.
See also: BArchivable::Instantiate(), instantiate_object(), BMenuItem::Archive()
protected:
virtual void Draw(void)
Draws the item as a horizontal line across the width of the menu.
protected:
virtual void GetContentSize(float *width, float *height)
Provides a minimal size for the item so that it won't constrain the size of the menu.
virtual void SetEnabled(bool flag)
Does nothing. A BSeparatorItem is disabled when it's constructed and must stay that way.
The Be Book, in lovely HTML, for the BeOS Preview Release.
Copyright © 1997 Be, Inc. All rights reserved.
Be is a registered trademark; BeOS, BeBox, BeWare, GeekPort, the Be logo, and the BeOS logo are trademarks of Be, Inc.
Last modified June 30, 1997.