Documentation | InterfaceKit | OutlineListView
SYNOPSIS
Perl
use HaikuR1::OutlineListView qw(B_SINGLE_SELECTION_LIST B_MULTIPLE_SELECTION_LIST B_POP_UP_BEHAVIOR B_NO_OP B_REPLACE_OP B_MOVE_OP B_SWAP_OP); my $listview = HaikuR1::OutlineListView->new( frame => $frame, name => $name, type => $type, resizingMode => $resizingMode, flags => $flags, ); $window->AddChild($listview);
Python
from HaikuR1.InterfaceKit import OutlineListView, B_SINGLE_SELECTION_LIST, B_MULTIPLE_SELECTION_LIST, B_POP_UP_BEHAVIOR, B_NO_OP, B_REPLACE_OP, B_MOVE_OP, B_SWAP_OP listview = OutlineListView( frame = frame, name = name, type = type, resizingMode = resizingMode, flags = flags, ) window.AddChild(listview)
DESCRIPTION
Exposes the BOutlineListView
object.
For more information on OutlineListView, see the Be Book class description, the Be Book overview, and the Haiku Book class description.
METHODS
Constructor
Creates an OutlineListView.
Perl
HaikuR1::OutlineListView->new( frame => $frame, name => $name, type => $type, resizingMode => $resizingMode, flags => $flags, ); HaikuR1::OutlineListView->new($archive);
Python
OutlineListView( frame = frame, name = name, type = type, resizingMode = resizingMode, flags = flags, ) OutlineListView(archive)
frame
A Rect that indicates where on the parent Window the View should be. You should not specify a frame on a View that will be added to a parent which uses a Layout.
name
A string, the ListView's internal name.
type
An integer, one of the ListView type constants.
resizingMode
An integer, the resizing mode. (See the resizing mode constants.) Should only be specified when there is a frame. Defaults to
B_FOLLOW_NONE
.flags
An integer, view flags. (See the view flag constants.)
archive
A Message, contains an archived version of the ListView.
AddUnder
Add an item under an existing item.
This method can also be called as a hook.
Perl
$outlinelistview->AddUnder($item, $superItem);
Python
outlinelistview.AddUnder(item, superItem)
Expanding and collapsing
Expand
Collapse
IsExpanded
These methods do what you expect.
Note that Expand
and Collapse
take a ListItem, while IsExpanded
takes an index.
Perl
$outlinelistview->Expand($item); $outlinelistview->Collapse($item); $outlinelistview->IsExpanded($fullListIndex);
Python
outlinelistview.Expand(item) outlinelistview.Collapse(item) outlinelistview.IsExpanded(fullListIndex)
Full list operations
FullListItemAt
FullListIndexOf
FullListFirstItem
FullListLastItem
FullListHasItem
FullListCountItems
FullListCurrentSelection
FullListIsEmpty
FullListDoForEach
FullListSortItems
These methods are like the similarly named methods without the FullList
prefix. They operate on the entire list, not just the visible items.
Perl
$outlinelistview->FullListItemAt($fullListIndex, $class); $outlinelistview->FullListIndexOf($point); $outlinelistview->FullListIndexOf($item); $outlinelistview->FullListFirstItem($class); $outlinelistview->FullListLastItem($class); $outlinelistview->FullListHasItem($item); $outlinelistview->FullListCountItems(); $outlinelistview->FullListCurrentSelection($index); $outlinelistview->FullListIsEmpty(); $outlinelistview->FullListDoForEach($func); $outlinelistview->FullListDoForEach($func, $arg); $outlinelistview->FullListSortItems($cmp);
Python
outlinelistview.FullListItemAt(fullListIndex, class) outlinelistview.FullListIndexOf(point) outlinelistview.FullListIndexOf(item) outlinelistview.FullListFirstItem(class) outlinelistview.FullListLastItem(class) outlinelistview.FullListHasItem(item) outlinelistview.FullListCountItems() outlinelistview.FullListCurrentSelection(index) outlinelistview.FullListIsEmpty() outlinelistview.FullListDoForEach(func) outlinelistview.FullListDoForEach(func, arg) outlinelistview.FullListSortItems(cmp)
class
Optional; a class for the native wrapper object returned by the method; defaults to
ListItem
. (SinceListItem
is not a fully functional class, you probably want to useStringItem
here, unless you create your own ListItem subclass.)index
An integer, the zero-based index of the item.
point
A Point, the location (in the ListView's coordinate space) of the desired item.
item
A ListItem, the item in question.
func
A function that will be called for each item. The item will be passed to the function. The function should return true to stop iterating over the items, false to continue iterating.
arg
An optional argument; if provided, it will be passed to the
DoForEach
function as a second parameter.cmp
A function that will be called to compare two items; the items will be passed as parameters. The function should return a negative number if the first item should be sorted before the second, zero if the two items are equivalent, and a positive number if the second item should come first.
Subitem operations
EachItemUnder
SortItemsUnder
CountItemsUnder
ItemUnderAt
These methods are similar to DoForEach
and SortItems
, except that they
act on the items under a given item.
Perl
$outlinelistview->EachItemUnder( superItem => $superItem, oneLevelOnly => $oneLevelOnly, func => $func, arg => $arg, ); $outlinelistview->SortItemsUnder($superItem, $oneLevelOnly, $cmp); $outlinelistview->CountItemsUnder($superItem, $oneLevelOnly); $outlinelistview->ItemUnderAt($superItem, $oneLevelOnly, $index);
Python
outlinelistview.EachItemUnder( superItem = superItem, oneLevelOnly = oneLevelOnly, func = func, arg = arg, ) outlinelistview.SortItemsUnder(superItem, oneLevelOnly, cmp) outlinelistview.CountItemsUnder(superItem, oneLevelOnly) outlinelistview.ItemUnderAt(superItem, oneLevelOnly, index)
superItem
The parent ListItem.
oneLevelOnly
A boolean; if true, it will only process items immediately under the given item; if false, it will continue down the tree recursively.
func
A function that will be called for each item. The item will be passed to the function. The function should return true to stop iterating over the items, false to continue iterating.
arg
An optional argument; if provided, it will be passed to the
DoForEach
function as a second parameter.cmp
A function that will be called to compare two items; the items will be passed as parameters. The function should return a negative number if the first item should be sorted before the second, zero if the two items are equivalent, and a positive number if the second item should come first.
index
An integer, the zero-based index of the item.
Superitem
Returns the parent item for the given item.
Perl
$outlinelistview->Superitem($item);
Python
outlinelistview.Superitem(item)
item
The ListItem to find the parent for.
ARCHIVABLE INTERFACE
OutlineListView
inherits the methods and hooks of Archivable.
HANDLER INTERFACE
OutlineListView
inherits the methods and hooks of Handler.
VIEW INTERFACE
OutlineListView
inherits the methods and hooks of View.
LISTVIEW INTERFACE
OutlineListView
inherits the methods and hooks of ListView.
The following differ from the ListView
version:
ItemAt
IndexOf
FirstItem
LastItem
HasItem
CountItems
CurrentSelection
IsEmpty
DoForEach
SortItems
These methods operate only on the visible items. That is, the indexes they accept or return are indexes into the set of visible items.
HOOKS
DrawItem
Called when the an item needs to be drawn.
Perl
$outlinelistview->DrawItem($item, $itemRect, $complete);
Python
outlinelistview.DrawItem(item, itemRect, complete)
item
The ListItem to draw.
itemRect
The frame Rect the item should be drawn into.
complete
A boolean; indicates whether the item should draw the entire frame itself; if false, then the owning View has already drawn the background.
DrawLatch
Called when the item needs to draw the "latch", the symbol that indicates whether the item is expanded or collapsed.
Perl
$outlinelistview->DrawLatch( itemRect => $itemRect, level => $level, collapsed => $collapsed, highlighted => $highlighted, misTracked => $misTracked, );
Python
outlinelistview.DrawLatch( itemRect = itemRect, level = level, collapsed = collapsed, highlighted = highlighted, misTracked = misTracked, )
itemRect
The frame Rect for the entire item.
level
An integer, the item's indent level.
collapsed
A boolean, indicates whether the item is collapsed (true) or expanded (false).
highlighted
A boolean, indicates whether the item is highlighted (true) or not (false).
misTracked
A boolean, indicates whether the item is mistracked (true) or not (false). (It's not entirely clear what this is for; the current implementation always passes false.
ExpandOrCollapse
Called when an item is expanded or collapsed.
Perl
$outlinelistview->ExpandOrCollapse($superItem, $expand);
Python
outlinelistview.ExpandOrCollapse(superItem, expand)
superItem
A ListItem, the parent of the tree to expand or collapse.
expand
A boolean; if true, the tree is being expanded; if false, it is being collapsed.
LatchRect
Called when the item is drawn to determine how much space is needed for the latch.
You should return the frame Rect for the latch.
Perl
$outlinelistview->LatchRect($itemRect, $level);
Python
outlinelistview.LatchRect(itemRect, level)
itemRect
The frame Rect for the entire item.
level
An integer, the item's indent level.
SCRIPTING SUITE
OutlineListView inherits the following suites: