Documentation | InterfaceKit | ListItem
SYNOPSIS
Perl
use HaikuR1::ListItem; # define MyListItem subclass here my $item = MyListItem->new(); $listview->AddItem($item);
Python
from HaikuR1.SupportKit import ListItem # define MyListItem subclass here item = MyListItem() listview.AddItem(item)
DESCRIPTION
Exposes the BListItem
object.
For more information on ListItem, see the Be Book class description, the Be Book overview, and the Haiku Book class description.
METHODS
Constructor
Creates a ListItem.
Perl
HaikuR1::ListItem->new($outlineLevel, $expanded); HaikuR1::ListItem->new($archive);
Python
ListItem(outlineLevel, expanded) ListItem(archive)
outlineLevel
An integer, the outline level (used for OutlineListView.
expanded
A boolean, whether the item should be expanded; defaults to true (used for OutlineListView).
archive
A Message, contains an archived version of the ListItem.
Height
SetHeight
These methods do what you expect.
Perl
$listitem->Height(); $listitem->SetHeight($height);
Python
listitem.Height() listitem.SetHeight(height)
height
A floating point number, the new height.
Width
SetWidth
These methods do what you expect.
Perl
$listitem->Width(); $listitem->SetWidth($width);
Python
listitem.Width() listitem.SetWidth(width)
width
A floating point number, the new width.
Select
Deselect
IsSelected
These methods do what you expect.
Perl
$listitem->Select(); $listitem->Deselect(); $listitem->IsSelected();
Python
listitem.Select() listitem.Deselect() listitem.IsSelected()
Enabled state
SetEnabled
IsEnabled
These methods do what you expect. SetEnabled
can also be called as a hook.
Perl
$listitem->SetEnabled($enabled); $listitem->IsEnabled();
Python
listitem.SetEnabled(enabled) listitem.IsEnabled()
enabled
A boolean, indicates whether the item is enabled or not.
Expanded state
SetExpanded
IsExpanded
These methods do what you expect. Used for items in an OutlineListView.
Perl
$listitem->SetExpanded($expanded); $listitem->IsExpanded();
Python
listitem.SetExpanded(expanded) listitem.IsExpanded()
expanded
A boolean, indicates whether the item is expanded or not.
OutlineLevel
SetOutlineLevel
These methods do what you expect. Used for items in an OutlineListView.
Perl
$listitem->OutlineLevel(); $listitem->SetOutlineLevel($level);
Python
listitem.OutlineLevel() listitem.SetOutlineLevel(level)
level
An integer, the new outline level
HOOKS
DrawItem
Called when the item needs to be drawn. ListItem does not provide a default version, so subclasses must provide this method.
Perl
$listitem->DrawItem($owner, $frame, $complete);
Python
listitem.DrawItem(owner, frame, complete)
owner
The View that owns the ListItem. Use View's drawing operations to draw the item.
frame
A Rect, the frame (within the owning View's coordinate space) where the item should be drawn.
complete
A boolean; indicates whether the item should draw the entire frame itself; if false, then the owning View has already drawn the background.
Update
Called when the owning View's state changes in a way that affects the item, including when the item is added to the View. The default version sets the width to the owner's width and the height so it will fit the owner's Font.
Perl
$listitem->Update($owner, $font);
Python
listitem.Update(owner, font)
ARCHIVABLE INTERFACE
ListItem
inherits the methods and hooks of Archivable.