Class TTreeListItem

Unit

Declaration

type TTreeListItem = class(TPersistent)

Description

This is an item which can contain subitems and items in the detail columns

Hierarchy

Overview

Fields

Public data:TItemDataRec;

Methods

Public constructor Create(const parent:TTreeListItem;const TreeListView:TTreeListView;const ACaption:string=''); overload;
Public function getBounds(column: longint):TRect;
Public function getMaxTextBounds(column: longint):TRect;
Public function GetItemAtPos(const listView:TTreeListView;const TestY:integer;var startY:integer):TTreeListItem;
Public function GetRecordItemAtPos(const listView:TTreeListView;TestX:integer):TTreeListRecordItem;
Public function GetMaxColumnWidth(const id:longint): longint;
Public procedure Expand;
Public procedure Collapse;
Public function GetNextItemIgnoringChildren:TTreeListItem;
Public function GetLastVisibleSubSubItem:TTreeListItem;
Public function GetLastSubSubItem:TTreeListItem;
Public function GetNextVisibleItem(Delta:longint=1):TTreeListItem;
Public function GetPrevVisibleItem(Delta:longint=1):TTreeListItem;
Public function GetNextItem():TTreeListItem;
Public function GetPrevItem():TTreeListItem;
Public function GetParentInList(List: TTreeListItems=nil):TTreeListItem;
Public procedure GetParentHierarchyStack(out stack:TItemHierarchyStack);
Public function GetNextFromHierarchyStack(var stack: TItemHierarchyStack; const mustBeVisible: boolean=false): TTreeListItem;
Public function ParentItems: TTreeListItems;
Public procedure Paint(const hierarchyStack: TItemHierarchyStack);
Public destructor Destroy; override;
Public function SeemsSelected:boolean;

Properties

Public property Parent: TTreeListItem read F_parent;
Public property TreeListView: TTreeListView read F_TreeListview;
Public property Indent: integer read F_Indent;
Public property Expanded: boolean read F_expanded write SetExpand;
Public property MouseSelected: boolean read F_MouseSelected write SetMouseSelected;
Public property RecordItemsText[i: Integer]: string read GetRecordItemsText write SetRecordItemsText;
Published property RecordItems: TRecordItemList read F_RecordItems write SetRecordItems;
Published property SubItems: TTreeListItems read F_SubItems write SetSubItems;
Published property ImageIndex: longint read F_ImageIndex write F_ImageIndex;
Published property ImageBitmap: graphics.TBitmap read F_ImageBitmap write F_ImageBitmap;
Published property Text: string read GetText write SetText;
Published property Selected: boolean read F_Selected write SetSelected;

Description

Fields

Public data:TItemDataRec;

This value can be used to store arbitrary integer values

Methods

Public constructor Create(const parent:TTreeListItem;const TreeListView:TTreeListView;const ACaption:string=''); overload;

This creates an item with given parent and caption in the given TreeListView

Public function getBounds(column: longint):TRect;

This returns the size of the displayed item

Returns

if column = -1 the size of the whole line is returned, otherwise the size of the given column

Public function getMaxTextBounds(column: longint):TRect;

This returns the maximal size of the displayed text
This is like getBounds but subtracts indentation and padding

Public function GetItemAtPos(const listView:TTreeListView;const TestY:integer;var startY:integer):TTreeListItem;

This returns the item in the given TreeListView at the position TestY which is a sub item (or/of) self
startY returns the top position of the found item

See also
TTreeListView.GetItemAtPos
Returns the item at position y
Public function GetRecordItemAtPos(const listView:TTreeListView;TestX:integer):TTreeListRecordItem;

This returns the record item at the given position

See also
TTreeListView.GetRecordItemAtPos
Returns the record item at position x,y
Notice that it doesn't check for visibility, e.g you can use negative coordinates or find items hidden by the scrollbars
Public function GetMaxColumnWidth(const id:longint): longint;

This returns the width of the largest record item in the column id of any sub item

Public procedure Expand;

This expands this item, to show all subitems

Public procedure Collapse;

This collapses this item, to hide all subitems

Public function GetNextItemIgnoringChildren:TTreeListItem;

Returns the next item which is no sub item of this
Notice that this runs in O(m), so don't use it in a loop

Public function GetLastVisibleSubSubItem:TTreeListItem;

Returns the latest visible item which is an (indirect) children of this

Public function GetLastSubSubItem:TTreeListItem;

Returns the latest item which is an (indirect) children of this

Public function GetNextVisibleItem(Delta:longint=1):TTreeListItem;

Returns the next visible item, or the Delta-th next item. Is Delta < 0 this is like a call to GetPrevVisibleItem
Notice that this runs in O(m), so don't use it in a loop. If the item doesn't exists the current item is returned!

Public function GetPrevVisibleItem(Delta:longint=1):TTreeListItem;

Returns the previous visible item, or the Delta-th previous item. Is Delta < 0 this is like a call to GetNextVisibleItem
Notice that this runs in O(m), so don't use it in a loop. If the item doesn't exists the current item is returned!

Public function GetNextItem():TTreeListItem;

Returns the next item
Notice that this runs in O(m), so don't use it in a loop. If the item doesn't exists the current item is returned!

Public function GetPrevItem():TTreeListItem;

Returns the previous item
Notice that this runs in O(m), so don't use it in a loop. If the item doesn't exists the current item is returned!

Public function GetParentInList(List: TTreeListItems=nil):TTreeListItem;

Returns the parent which is in the given list, or nil.
If List = nil then it takes TreeListView.Items
If self is in the list it returns self

Public procedure GetParentHierarchyStack(out stack:TItemHierarchyStack);
 
Public function GetNextFromHierarchyStack(var stack: TItemHierarchyStack; const mustBeVisible: boolean=false): TTreeListItem;

returns a stack you can use to enumerate all item iterative

Public function ParentItems: TTreeListItems;

This returns the list containing the item
It is either TreeListView.Items or Parent.SubItems

Public procedure Paint(const hierarchyStack: TItemHierarchyStack);

This draws the item
Don't call it direct

Parameters
hierarchyStack
list of parents
Public destructor Destroy; override;

Destroy

Public function SeemsSelected:boolean;

Returns if the items is drawn selected
When the user selects new items there new selection state can be previewed

Properties

Public property Parent: TTreeListItem read F_parent;

This is a parent of this item
This is Nil if the item is in TreeListView.Items

Public property TreeListView: TTreeListView read F_TreeListview;

This is the TreeListView showing this item

Public property Indent: integer read F_Indent;

Level of indentation
This value is not guaranteed to be correct (but it is during paint events)

Public property Expanded: boolean read F_expanded write SetExpand;

Specifies if the sub items are currently visible

Public property MouseSelected: boolean read F_MouseSelected write SetMouseSelected;

Controls if this item is selected or not

Public property RecordItemsText[i: Integer]: string read GetRecordItemsText write SetRecordItemsText;

Sets the value of the given column
Notice that this array is 0-based and RecordItemsText[0] is always the same as Text
Getting a not existing item will give you '', setting will create it

Published property RecordItems: TRecordItemList read F_RecordItems write SetRecordItems;

Items in the columns
Normally you can use RecordItemsText for easier access

Published property SubItems: TTreeListItems read F_SubItems write SetSubItems;

Indented child items

Published property ImageIndex: longint read F_ImageIndex write F_ImageIndex;

If this is > -1 then the image of the TreeListView.Images will be painted before this item
This property is ignored if ImageBitmap <> Nil or TreeListView.Images = Nil
Use ImageBitmap if you are in doubt (a image list may be better with regards to caching issues, but clipping is slower)

Published property ImageBitmap: graphics.TBitmap read F_ImageBitmap write F_ImageBitmap;

Bitmap which should be drawn before the item
This image is not freed when the item is destroyed, so you can use the same bitmap for multiple items

Published property Text: string read GetText write SetText;

Text in the first column of this item
This is always equal to RecordItemsText[0]

Published property Selected: boolean read F_Selected write SetSelected;

Controls if this item is selected or not


Generated by PasDoc 0.16.0.