Public Member Functions | Protected Member Functions | List of all members
BSeparatorItem Class Reference

Display separator item for BMenu class. More...

Inherits BMenuItem.

Public Member Functions

 BSeparatorItem ()
 Creates a new BSeparatorItem object. More...
 
 BSeparatorItem (BMessage *data)
 Archive constructor. More...
 
virtual ~BSeparatorItem ()
 Destructor, does nothing. More...
 
virtual void SetEnabled (bool enable)
 Does nothing, this method is defined to override the default BMenuItem behavior. More...
 
- Public Member Functions inherited from BMenuItem
 BMenuItem (const char *label, BMessage *message, char shortcut=0, uint32 modifiers=0)
 Creates a new BMenuItem object with the specified label and message. More...
 
 BMenuItem (BMenu *menu, BMessage *message=NULL)
 Creates a new BMenuItem object with the specified menu and message. More...
 
 BMenuItem (BMessage *data)
 Archive constructor. More...
 
virtual ~BMenuItem ()
 Destructor. More...
 
BRect Frame () const
 Returns the bounds rectangle of the menu item. More...
 
bool IsEnabled () const
 Returns whether or not the item is enabled. More...
 
bool IsMarked () const
 Returns whether or not the item is marked. More...
 
const char * Label () const
 Returns the item's label. More...
 
BMenuMenu () const
 Returns a pointer to the menu that the item is attached to. More...
 
virtual void SetLabel (const char *name)
 Sets the menu item label to string. More...
 
virtual void SetMarked (bool mark)
 Marks or unmarks the menu item. More...
 
virtual void SetShortcut (char shortcut, uint32 modifiers)
 Set the keyboard shortcut of the menu item. More...
 
virtual void SetTrigger (char trigger)
 Set the character that activates this menu item. The triggered character is drawn underlined in the menu. More...
 
char Shortcut (uint32 *_modifiers=NULL) const
 Returns the currently set shortcut and fills out modifiers with a bitmap of the modifier keys required to invoke the item. More...
 
BMenuSubmenu () const
 Returns a pointer to the attached menu. More...
 
char Trigger () const
 Returns the item's trigger character. More...
 
- Public Member Functions inherited from BArchivable
 BArchivable (BMessage *from)
 Constructor. Does important behind-the-scenes work in the unarchiving process. More...
 
 BArchivable ()
 Constructor. Does nothing. More...
 
virtual ~BArchivable ()
 Destructor. Does nothing. More...
 
virtual status_t AllArchived (BMessage *archive) const
 Method relating to the use of BArchiver. More...
 
virtual status_t AllUnarchived (const BMessage *archive)
 Method relating to the use of BUnarchiver. More...
 
virtual status_t Perform (perform_code d, void *arg)
 Perform some action (Internal method defined for binary compatibility purposes).
 
- Public Member Functions inherited from BInvoker
 BInvoker ()
 Initializes a BInvoker without a message or target. More...
 
 BInvoker (BMessage *message, const BHandler *handler, const BLooper *looper=NULL)
 Initializes the BInvoker with message and sets the target to either a local handler or as the preferred handler of a local looper where the message is sent when Invoke() is called. More...
 
 BInvoker (BMessage *message, BMessenger target)
 Initializes the BInvoker with message and sets the target messenger where the message is sent when Invoke() is called. More...
 
virtual ~BInvoker ()
 Destructor method, deletes the BMessage object if set. More...
 
uint32 Command () const
 Returns the message's what data member. More...
 
BHandlerHandlerForReply () const
 Returns the previously set reply handler or NULL if not set. More...
 
status_t InvokeNotify (BMessage *message, uint32 kind=B_CONTROL_INVOKED)
 Sends the message to its target, using the notification code specified by kind. More...
 
bool IsTargetLocal () const
 Returns whether or not the invoker and its target belong to the same team. More...
 
BMessageMessage () const
 Returns a pointer to the invoker's message object. More...
 
BMessenger Messenger () const
 Returns the BMessenger object that the invoker uses to send its messages. More...
 
virtual status_t SetHandlerForReply (BHandler *handler)
 Sets the BHandler object responsible for handling reply messages. More...
 
virtual status_t SetMessage (BMessage *message)
 Assigns message to the invoker, deleting any previously assigned message. More...
 
virtual status_t SetTarget (const BHandler *handler, const BLooper *looper=NULL)
 Sets the target to either a local handler or as the preferred handler of a local looper. More...
 
virtual status_t SetTarget (BMessenger messenger)
 Sets the invoker's target to messenger. More...
 
status_t SetTimeout (bigtime_t timeout)
 Sets the timeout to use when sending the message to the target. More...
 
bigtime_t Timeout () const
 Returns the current timeout value. More...
 

Protected Member Functions

virtual void Draw ()
 Hook method used to draw the menu items. More...
 
virtual void GetContentSize (float *_width, float *_height)
 Fills out _width and _height with the content rectangle dimensions. More...
 
- Protected Member Functions inherited from BMenuItem
BPoint ContentLocation () const
 Returns the top-left point of the content rectangle. More...
 
virtual void DrawContent ()
 Hook method used to draw the menu items contents. More...
 
virtual void Highlight (bool highlight)
 Highlights or unhighlights the menu item. More...
 
virtual status_t Invoke (BMessage *message=NULL)
 Sends a copy of the model message to the target. More...
 
bool IsSelected () const
 Returns whether or not the item is selected. More...
 
virtual void TruncateLabel (float maxWidth, char *newLabel)
 Truncates the label and stashes it into newLabel. More...
 
- Protected Member Functions inherited from BInvoker
void BeginInvokeNotify (uint32 kind=B_CONTROL_INVOKED)
 Implement this method to set up an InvokeNotify() context. More...
 
void EndInvokeNotify ()
 Implement this method to tear down an InvokeNotify() context. More...
 
uint32 InvokeKind (bool *_notify=NULL)
 Returns the kind set by InvokeNotify(). More...
 

Archiving

virtual status_t Archive (BMessage *data, bool deep=true) const
 Archives the the BSeparatorItem object into the data message. More...
 
static BArchivableInstantiate (BMessage *data)
 Creates a new BSeparatorItem object from an data message. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from BMenuItem
static BArchivableInstantiate (BMessage *archive)
 Creates a new BMenuItem object from an data message. More...
 
- Static Public Member Functions inherited from BArchivable
static BArchivableInstantiate (BMessage *archive)
 Static member to restore objects from messages. More...
 

Detailed Description

Display separator item for BMenu class.

A BSeparatorItem is used to separate groups of menu items in a BMenu. It is drawn as a horizontal line and cannot be selected or highlighted.

Warning
BSeparatorItems are only meant to be used with menus whose items are arranged in a B_ITEMS_IN_COLUMN layout.
Since
BeOS R3

Constructor & Destructor Documentation

◆ BSeparatorItem() [1/2]

BSeparatorItem::BSeparatorItem ( )

Creates a new BSeparatorItem object.

The creates a new BSeparatorItem from BMenuItem with a blank label and NULL message, then disables it.

Since
BeOS R3

◆ BSeparatorItem() [2/2]

BSeparatorItem::BSeparatorItem ( BMessage data)

Archive constructor.

Parameters
dataThe message data to construct the separator item from.
Since
BeOS R3

◆ ~BSeparatorItem()

BSeparatorItem::~BSeparatorItem ( )
virtual

Destructor, does nothing.

Since
BeOS R3

Member Function Documentation

◆ Archive()

status_t BSeparatorItem::Archive ( BMessage data,
bool  deep = true 
) const
virtual

Archives the the BSeparatorItem object into the data message.

Parameters
dataA pointer to the BMessage to archive the object into.
deepThis parameter has no effect for this class.
Returns
A status code, B_OK if everything went well or an error code otherwise.
Return values
B_OKThe object was archived successfully.
B_NO_MEMORYRan out of memory while archiving the object.
Since
BeOS R3

Reimplemented from BMenuItem.

◆ Draw()

void BSeparatorItem::Draw ( )
protectedvirtual

Hook method used to draw the menu items.

This method is called by automatically by BMenu::Draw(). You should not need to call this method yourself but you may want to override it in a derived class to do something other than the default.

The default draws a light grey horizontal line through the middle of the item.

Since
BeOS R3

Reimplemented from BMenuItem.

◆ GetContentSize()

void BSeparatorItem::GetContentSize ( float *  _width,
float *  _height 
)
protectedvirtual

Fills out _width and _height with the content rectangle dimensions.

You only need to call this method if you're implementing your own DrawContent() method to override how the contents of the separator are drawn.

Parameters
_widthFilled out with the width of the content rectangle.
_heightFilled out with the height of the content rectangle.
See also
ContentLocation()
DrawContent()
Since
BeOS R3

Reimplemented from BMenuItem.

◆ Instantiate()

BArchivable * BSeparatorItem::Instantiate ( BMessage data)
static

Creates a new BSeparatorItem object from an data message.

Returns
A newly created BSeparatorItem object or NULL if the message doesn't contain an archived BSeparatorItem.
Since
BeOS R3

◆ SetEnabled()

void BSeparatorItem::SetEnabled ( bool  enable)
virtual

Does nothing, this method is defined to override the default BMenuItem behavior.

Parameters
enableNot used.
Since
BeOS R3

Reimplemented from BMenuItem.