A list item of a text string used as a member of a BListView or BOutlineListView. More...
Inherits BListItem.
Public Member Functions | |
BStringItem (BMessage *archive) | |
Archive constructor. | |
BStringItem (const char *text, uint32 outlineLevel=0, bool expanded=true) | |
Creates a new BStringItem object which displays the text string. | |
virtual | ~BStringItem () |
Destructor, frees the memory used by the string. | |
virtual void | DrawItem (BView *owner, BRect frame, bool complete=false) |
Hook method called when the string item is drawn. | |
virtual status_t | Perform (perform_code code, void *arg) |
Performs an action give a perform_code and arg. (Internal Method) | |
virtual void | SetText (const char *text) |
Sets the text string displayed by the item. The memory used by the old string is freed. | |
const char * | Text () const |
virtual void | Update (BView *owner, const BFont *font) |
Hook method that's called when the owner changes. | |
Public Member Functions inherited from BListItem | |
BListItem (BMessage *archive) | |
Create a new list item from archived message. | |
BListItem (uint32 outlineLevel=0, bool expanded=true) | |
Create a new list item with the specified level. | |
virtual | ~BListItem () |
Destroy the list item freeing any memory used. | |
void | Deselect () |
Unselect the list item. | |
float | Height () const |
Return the height of the list item. | |
bool | IsEnabled () const |
Returns whether or not the list item is currently enabled. | |
bool | IsExpanded () const |
Returns whether or not the list item is currently expanded. | |
bool | IsSelected () const |
Return whether or not the list item is currently selected. | |
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. | |
virtual status_t | Perform (perform_code code, void *arg) |
Performs an action give a perform_code and arg. (Internal Method) | |
void | Select () |
Select the list item. | |
virtual void | SetEnabled (bool enabled) |
Enable or disable the list item. | |
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. | |
void | SetHeight (float height) |
Set the height of the list item to height. | |
void | SetOutlineLevel (uint32 level) |
Set the outline level of the list item. | |
void | SetWidth (float width) |
Set the width of the list item to width. | |
virtual void | Update (BView *owner, const BFont *font) |
Hook method that's called when the owner changes. | |
float | Width () const |
Return the width of the list item. | |
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). | |
Protected Member Functions | |
float | BaselineOffset () const |
Returns the offset from the top of the frame to the base line of the text. | |
Archiving | |
virtual status_t | Archive (BMessage *archive, bool deep=true) const |
Archives the the BStringItem object into the archive message. | |
static BArchivable * | Instantiate (BMessage *archive) |
Creates a new BStringItem object from an archive message. | |
Additional Inherited Members | |
Static Public Member Functions inherited from BArchivable | |
static BArchivable * | Instantiate (BMessage *archive) |
Static member to restore objects from messages. | |
A list item of a text string used as a member of a BListView or BOutlineListView.
BStringItem::BStringItem | ( | const char * | text, |
uint32 | level = 0 , |
||
bool | expanded = true |
||
) |
Creates a new BStringItem object which displays the text string.
The level and expanded parameters only apply to string items attached to a BOutlineListView and are passed unchanged to the BListItem constructor.
text | The text to display. |
level | The level of the item in a BOutlineListView. |
expanded | Whether or not the item is expanded in a BOutlineListView. |
BStringItem::BStringItem | ( | BMessage * | archive | ) |
Archive constructor.
archive | The message archive to construct the string item from. |
|
virtual |
Destructor, frees the memory used by the string.
Archives the the BStringItem object into the archive message.
archive | A pointer to the BMessage to archive the object into. |
deep | This parameter has no effect for this class. |
B_OK
if everything went well or an error code otherwise. B_OK | The object was archived successfully. |
B_NO_MEMORY | Ran out of memory while archiving the object. |
Reimplemented from BListItem.
|
protected |
Returns the offset from the top of the frame to the base line of the text.
The baseline is the line upon which the letters "sit" and below which descenders extend. This value is set in the Update() method.
This may be overridden by derived classes to set the base line offset.
Hook method called when the string item is drawn.
The background is drawn either B_LIST_BACKGROUND_COLOR
or B_LIST_SELECTED_BACKGROUND_COLOR
depending on whether the item is selected or not.
Similarly, the text is drawn either B_LIST_ITEM_TEXT_COLOR
or B_LIST_SELECTED_ITEM_TEXT_COLOR
.
The text is drawn in a lighter color if the item is disabled to indicate that it may not be selected. A darker color is used instead if B_LIST_BACKGROUND_COLOR
is set to a dark color.
owner | The string item's parent. |
frame | The frame to draw in. |
complete | Whether or not to draw the background in addition to the item's contents. |
Implements BListItem.
|
static |
Creates a new BStringItem object from an archive message.
NULL
if the message doesn't contain an archived BStringItem.
|
virtual |
Performs an action give a perform_code and arg. (Internal Method)
d | The perform code. |
arg | A pointer to some data to perform on. |
Reimplemented from BListItem.
|
virtual |
Sets the text string displayed by the item. The memory used by the old string is freed.
text | The text string to set in a C-string. |
const char * BStringItem::Text | ( | ) | const |
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.
owner | The list item's new owner. |
font | The font set to the list item's current owner. |
Reimplemented from BListItem.