Loading...
Searching...
No Matches
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.
 
 BSeparatorItem (BMessage *data)
 Archive constructor.
 
virtual ~BSeparatorItem ()
 Destructor, does nothing.
 
virtual void SetEnabled (bool enable)
 Does nothing, this method is defined to override the default BMenuItem behavior.
 
- Public Member Functions inherited from BMenuItem
 BMenuItem (BMenu *menu, BMessage *message=NULL)
 Creates a new BMenuItem object with the specified menu and message.
 
 BMenuItem (BMessage *data)
 Archive constructor.
 
 BMenuItem (const char *label, BMessage *message, char shortcut=0, uint32 modifiers=0)
 Creates a new BMenuItem object with the specified label and message.
 
virtual ~BMenuItem ()
 Destructor.
 
BRect Frame () const
 Returns the bounds rectangle of the menu item.
 
bool IsEnabled () const
 Returns whether or not the item is enabled.
 
bool IsMarked () const
 Returns whether or not the item is marked.
 
const char * Label () const
 Returns the item's label.
 
BMenuMenu () const
 Returns a pointer to the menu that the item is attached to.
 
virtual void SetEnabled (bool enable)
 Enables or disables the menu item.
 
virtual void SetLabel (const char *name)
 Sets the menu item label to string.
 
virtual void SetMarked (bool mark)
 Marks or unmarks the menu item.
 
virtual void SetShortcut (char shortcut, uint32 modifiers)
 Set the keyboard shortcut of the menu item.
 
virtual void SetTrigger (char trigger)
 Set the character that activates this menu item. The triggered character is drawn underlined in the menu.
 
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.
 
BMenuSubmenu () const
 Returns a pointer to the attached menu.
 
char Trigger () const
 Returns the item's trigger character.
 
- Public Member Functions inherited from BArchivable
 BArchivable ()
 Constructor. Does nothing.
 
 BArchivable (BMessage *from)
 Constructor. Does important behind-the-scenes work in the unarchiving process.
 
virtual ~BArchivable ()
 Destructor. Does nothing.
 
virtual status_t AllArchived (BMessage *archive) const
 Method relating to the use of BArchiver.
 
virtual status_t AllUnarchived (const BMessage *archive)
 Method relating to the use of BUnarchiver.
 
virtual status_t Archive (BMessage *into, bool deep=true) const
 Archive the object into a BMessage.
 
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.
 
 BInvoker (BMessage *message, BMessenger target)
 Initializes the BInvoker with message and sets the target messenger where the message is sent when Invoke() is called.
 
 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.
 
virtual ~BInvoker ()
 Destructor method, deletes the BMessage object if set.
 
uint32 Command () const
 Returns the message's what data member.
 
BHandlerHandlerForReply () const
 Returns the previously set reply handler or NULL if not set.
 
virtual status_t Invoke (BMessage *message=NULL)
 Sends the message to the invoker's target.
 
status_t InvokeNotify (BMessage *message, uint32 kind=B_CONTROL_INVOKED)
 Sends the message to its target, using the notification code specified by kind.
 
bool IsTargetLocal () const
 Returns whether or not the invoker and its target belong to the same team.
 
BMessageMessage () const
 Returns a pointer to the invoker's message object.
 
BMessenger Messenger () const
 Returns the BMessenger object that the invoker uses to send its messages.
 
virtual status_t SetHandlerForReply (BHandler *handler)
 Sets the BHandler object responsible for handling reply messages.
 
virtual status_t SetMessage (BMessage *message)
 Assigns message to the invoker, deleting any previously assigned message.
 
virtual status_t SetTarget (BMessenger messenger)
 Sets the invoker's target to messenger.
 
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.
 
status_t SetTimeout (bigtime_t timeout)
 Sets the timeout to use when sending the message to the target.
 
BHandlerTarget (BLooper **_looper=NULL) const
 Invoke BMessenger::Target() on the internal messenger.
 
bigtime_t Timeout () const
 Returns the current timeout value.
 

Protected Member Functions

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

Archiving

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

Additional Inherited Members

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

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 or vertical line depending on menu layout 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 or B_ITEMS_IN_ROW 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 or vertical 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.