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)
outlineLevelAn integer, the outline level (used for OutlineListView.
expandedA boolean, whether the item should be expanded; defaults to true (used for OutlineListView).
archiveA 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)
heightA 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)
widthA 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()
enabledA 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()
expandedA 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)
levelAn 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)
ownerThe View that owns the ListItem. Use View's drawing operations to draw the item.
frameA Rect, the frame (within the owning View's coordinate space) where the item should be drawn.
completeA 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.