# The Interface Kit: BSeparatorItem

Derived from: public BMenuItem

Declared in: be/interface/MenuItem.h

Library: libbe.so

## 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, 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()`

## Constructor and Destructor

### BSeparatorItem()

          BSeparatorItem(void)
          BSeparatorItem(BMessage *archive)

Initializes the BSeparatorItem and disables it.

### ~BSeparatorItem()

          virtual ~BSeparatorItem()

Does nothing.

## Static Functions

### Instantiate()

          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()`

## Member Functions

### Draw()

          virtual void Draw(void)

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

### GetContentSize()

          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.

### Instantiate() see Archive()

### SetEnabled()

          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 BeOS Release 3.

Copyright © 1998 Be, Inc. All rights reserved.

Last modified March 26, 1998.