Public Member Functions | List of all members
BListItem Class Referenceabstract

A list item, a member of a BListView or BOutlineListView. More...

Inherits BArchivable.

Inherited by BStringItem.

Public Member Functions

 BListItem (uint32 outlineLevel=0, bool expanded=true)
 Create a new list item with the specified level. More...
 
 BListItem (BMessage *archive)
 Create a new list item from archived message. More...
 
virtual ~BListItem ()
 Destroy the list item freeing any memory used. More...
 
void Deselect ()
 Unselect the list item. More...
 
float Height () const
 Return the height of the list item. More...
 
bool IsEnabled () const
 Returns whether or not the list item is currently enabled. More...
 
bool IsExpanded () const
 Returns whether or not the list item is currently expanded. More...
 
bool IsSelected () const
 Return whether or not the list item is currently selected. More...
 
uint32 OutlineLevel () const
 Returns the current outline level of the list item. This only makes sense if the list item is part of a BOutlineListView. More...
 
virtual status_t Perform (perform_code code, void *arg)
 Performs an action give a perform_code and arg. (Internal Method) More...
 
void Select ()
 Select the list item. More...
 
virtual void SetEnabled (bool enabled)
 Enable or disable the list item. More...
 
void SetExpanded (bool expanded)
 Set the expanded state of the list item. This only makes sense if the list item is part of a BOutlineListView. More...
 
void SetHeight (float height)
 Set the height of the list item to height. More...
 
void SetOutlineLevel (uint32 level)
 Set the outline level of the list item. More...
 
void SetWidth (float width)
 Set the width of the list item to width. More...
 
virtual void Update (BView *owner, const BFont *font)
 Hook method that's called when the owner changes. More...
 
float Width () const
 Return the width of the list item. More...
 
Archiving
virtual status_t Archive (BMessage *archive, bool deep=true) const
 Archive the list item to a message. More...
 
virtual void DrawItem (BView *owner, BRect frame, bool complete=false)=0
 Hook method called when the item is drawn. 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from BArchivable
static BArchivableInstantiate (BMessage *archive)
 Static member to restore objects from messages. More...
 

Detailed Description

A list item, a member of a BListView or BOutlineListView.

Since
BeOS R3

Constructor & Destructor Documentation

◆ BListItem() [1/2]

BListItem::BListItem ( uint32  level = 0,
bool  expanded = true 
)

Create a new list item with the specified level.

The level and expanded arguments are only used if the item is added to a BOutlineListView.

Parameters
levelThe level to create the list item on, default level is 0.
expandedWhether or not the item is expanded.
See also
BOutlineListView::AddItem()
Since
BeOS R3

◆ BListItem() [2/2]

BListItem::BListItem ( BMessage data)

Create a new list item from archived message.

Parameters
dataThe message to create the list item from.
Since
BeOS R3

◆ ~BListItem()

BListItem::~BListItem ( )
virtual

Destroy the list item freeing any memory used.

The default destructor is empty.

Since
BeOS R3

Member Function Documentation

◆ Archive()

status_t BListItem::Archive ( BMessage archive,
bool  deep = true 
) const
virtual

Archive the list item to a message.

Parameters
archiveThe message to archive the list item to.
deepIf true also archive child views.
Since
BeOS R3

Reimplemented from BArchivable.

Reimplemented in BStringItem.

◆ Deselect()

void BListItem::Deselect ( )

Unselect the list item.

Since
BeOS R3

◆ DrawItem()

void BListItem::DrawItem ( BView owner,
BRect  frame,
bool  complete = false 
)
pure virtual

Hook method called when the item is drawn.

Parameters
ownerThe view that the list item is a child of.
frameThe frame of the item.
completeWhether or not to draw the background in addition to the item's contents.
Since
BeOS R3

Implemented in BStringItem.

◆ Height()

float BListItem::Height ( ) const

Return the height of the list item.

Returns
The height of the list item as a float.
Since
BeOS R3

◆ IsEnabled()

bool BListItem::IsEnabled ( ) const

Returns whether or not the list item is currently enabled.

Returns
true if the list item is enabled, false if it is disabled.
Since
BeOS R3

◆ IsExpanded()

bool BListItem::IsExpanded ( ) const

Returns whether or not the list item is currently expanded.

Returns
true if the list item is expanded, false if it is not expanded.
Since
BeOS R3

◆ IsSelected()

bool BListItem::IsSelected ( ) const

Return whether or not the list item is currently selected.

Returns
true if the list item is selected, false otherwise.
Since
BeOS R3

◆ OutlineLevel()

uint32 BListItem::OutlineLevel ( ) const

Returns the current outline level of the list item. This only makes sense if the list item is part of a BOutlineListView.

Returns
The current outline level of the list item.
Since
BeOS R3

◆ Perform()

status_t BListItem::Perform ( perform_code  d,
void *  arg 
)
virtual

Performs an action give a perform_code and arg. (Internal Method)

Parameters
dThe perform code.
argA pointer to some data to perform on.
Returns
A status code.
Since
Haiku R1

Reimplemented from BArchivable.

Reimplemented in BStringItem.

◆ Select()

void BListItem::Select ( )

Select the list item.

Since
BeOS R3

◆ SetEnabled()

void BListItem::SetEnabled ( bool  on)
virtual

Enable or disable the list item.

Parameters
onSet true to enable, false to disable the list item.
Since
BeOS R3

◆ SetExpanded()

void BListItem::SetExpanded ( bool  expanded)

Set the expanded state of the list item. This only makes sense if the list item is part of a BOutlineListView.

Parameters
expandedtrue to expand the list item, false to un-expand the list item.
Since
BeOS R3

◆ SetHeight()

void BListItem::SetHeight ( float  height)

Set the height of the list item to height.

Parameters
heightThe height to set the list item to.
Note
Unlike BeOS, if you change the height then you need to force the BListView to recalculate the cached tops of the item selection boxes, otherwise selection highlights will be drawn in the wrong places and mouse clicks will be misinterpreted. You can do this by adding and removing a dummy BListItem at the top of the list, or after hrev50780 by calling BListView::FrameResized() with the current Frame rectangle (though the FrameResized() method will additionally call BListItem::Update() for all items).
Since
BeOS R3

◆ SetOutlineLevel()

void BListItem::SetOutlineLevel ( uint32  level)

Set the outline level of the list item.

Parameters
levelThe outline level to set the list item to.
Since
BeOS R3

◆ SetWidth()

void BListItem::SetWidth ( float  width)

Set the width of the list item to width.

Parameters
widthThe width to set the list item to.
Since
BeOS R3

◆ Update()

void BListItem::Update ( BView owner,
const BFont font 
)
virtual

Hook method that's called when the owner changes.

This method gets called when the list item is added to the list view.

The default implementation sets the width of the list item to the width of owner and sets the height to fit font.

Parameters
ownerThe list item's new owner.
fontThe font set to the list item's current owner.
Since
BeOS R3

Reimplemented in BStringItem.

◆ Width()

float BListItem::Width ( ) const

Return the width of the list item.

Returns
The width of the list item as a float.
Since
BeOS R3