2 * Copyright 2001-2010 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
7 * Marc Flerackers (mflerackers@androme.be)
18 BListItem::BListItem(uint32 level
, bool expanded
)
34 BListItem::BListItem(BMessage
* data
)
47 data
->FindBool("_sel", &fSelected
);
49 if (data
->FindBool("_disable", &fEnabled
) != B_OK
)
54 data
->FindBool("_li_expanded", &fExpanded
);
55 data
->FindInt32("_li_outline_level", (int32
*)&fLevel
);
59 BListItem::~BListItem()
65 BListItem::Archive(BMessage
* archive
, bool deep
) const
67 status_t status
= BArchivable::Archive(archive
, deep
);
68 if (status
== B_OK
&& fSelected
)
69 status
= archive
->AddBool("_sel", true);
71 if (status
== B_OK
&& !fEnabled
)
72 status
= archive
->AddBool("_disable", true);
74 if (status
== B_OK
&& fExpanded
)
75 status
= archive
->AddBool("_li_expanded", true);
77 if (status
== B_OK
&& fLevel
!= 0)
78 status
= archive
->AddInt32("_li_outline_level", fLevel
);
85 BListItem::Height() const
92 BListItem::Width() const
99 BListItem::IsSelected() const
113 BListItem::Deselect()
120 BListItem::SetEnabled(bool on
)
127 BListItem::IsEnabled() const
134 BListItem::SetHeight(float height
)
141 BListItem::SetWidth(float width
)
148 BListItem::Update(BView
* owner
, const BFont
* font
)
151 font
->GetHeight(&fh
);
153 SetWidth(owner
->Bounds().Width());
154 SetHeight(ceilf(fh
.ascent
+ fh
.descent
+ fh
.leading
));
159 BListItem::Perform(perform_code d
, void* arg
)
161 return BArchivable::Perform(d
, arg
);
166 BListItem::SetExpanded(bool expanded
)
168 fExpanded
= expanded
;
173 BListItem::IsExpanded() const
180 BListItem::OutlineLevel() const
187 BListItem::SetOutlineLevel(uint32 level
)
194 BListItem::HasSubitems() const
200 void BListItem::_ReservedListItem1() {}
201 void BListItem::_ReservedListItem2() {}
205 BListItem::IsItemVisible() const
212 BListItem::SetTop(float top
)
219 BListItem::SetItemVisible(bool visible
)