The Interface Kit: BSeparatorItem

Derived from: public BMenuItem

Declared in: <interface/MenuItem.h>


Overview

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, posts 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()


Constructor and Destructor


BSeparatorItem()

      BSeparatorItem(void) 

Initializes the BSeparatorItem and disables it.


~BSeparatorItem()

      virtual ~BSeparatorItem(void)

Does nothing.


Member Functions


Draw()

protected:

      virtual void Draw(void)

Draws the item as a horizontal line across the width of the menu.


GetContentSize()

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.


SetEnabled()

      virtual void SetEnabled(bool flag)

Does nothing. A BSeparatorItem is disabled when it's constructed and must stay that way.






The Be Book, HTML Edition, for Developer Release 8 of the Be Operating System.

Copyright © 1996 Be, Inc. All rights reserved.

Be, the Be logo, BeBox, BeOS, BeWare, and GeekPort are trademarks of Be, Inc.

Last modified September 6, 1996.