2006-02-11 18:23:23 +03:00
|
|
|
/*
|
2007-10-16 00:13:55 +04:00
|
|
|
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
|
2006-02-11 18:23:23 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _LIST_ITEM_H
|
|
|
|
#define _LIST_ITEM_H
|
|
|
|
|
2006-02-11 18:23:23 +03:00
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <Archivable.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
|
2002-10-29 21:38:31 +03:00
|
|
|
class BFont;
|
2007-10-16 00:13:55 +04:00
|
|
|
class BList;
|
2002-10-29 21:38:31 +03:00
|
|
|
class BMessage;
|
|
|
|
class BOutlineListView;
|
|
|
|
class BView;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
|
2002-10-29 21:38:31 +03:00
|
|
|
class BListItem : public BArchivable {
|
2006-02-11 18:23:23 +03:00
|
|
|
public:
|
2008-02-24 17:15:28 +03:00
|
|
|
BListItem(uint32 outlineLevel = 0,
|
|
|
|
bool expanded = true);
|
2006-02-11 18:23:23 +03:00
|
|
|
BListItem(BMessage* archive);
|
|
|
|
virtual ~BListItem();
|
|
|
|
|
|
|
|
virtual status_t Archive(BMessage* archive, bool deep = true) const;
|
|
|
|
|
|
|
|
float Height() const;
|
|
|
|
float Width() const;
|
|
|
|
bool IsSelected() const;
|
|
|
|
void Select();
|
|
|
|
void Deselect();
|
|
|
|
|
|
|
|
virtual void SetEnabled(bool enabled);
|
|
|
|
bool IsEnabled() const;
|
|
|
|
|
|
|
|
void SetHeight(float height);
|
|
|
|
void SetWidth(float width);
|
|
|
|
virtual void DrawItem(BView* owner, BRect frame,
|
|
|
|
bool complete = false) = 0;
|
|
|
|
virtual void Update(BView* owner, const BFont* font);
|
|
|
|
|
|
|
|
virtual status_t Perform(perform_code code, void* arg);
|
|
|
|
|
|
|
|
bool IsExpanded() const;
|
|
|
|
void SetExpanded(bool expanded);
|
|
|
|
uint32 OutlineLevel() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class BOutlineListView;
|
2008-02-24 17:15:28 +03:00
|
|
|
friend class BListView;
|
2006-02-11 18:23:23 +03:00
|
|
|
bool HasSubitems() const;
|
|
|
|
|
|
|
|
virtual void _ReservedListItem1();
|
|
|
|
virtual void _ReservedListItem2();
|
|
|
|
|
|
|
|
BListItem(const BListItem& item);
|
|
|
|
BListItem& operator=(const BListItem& item);
|
|
|
|
|
|
|
|
bool IsItemVisible() const;
|
|
|
|
void SetItemVisible(bool visible);
|
2008-02-24 17:15:28 +03:00
|
|
|
inline float Top() const;
|
|
|
|
inline float Bottom() const;
|
|
|
|
void SetTop(float top);
|
2006-02-11 18:23:23 +03:00
|
|
|
private:
|
2008-02-24 17:15:28 +03:00
|
|
|
float fTop;
|
2006-02-11 18:23:23 +03:00
|
|
|
BList* fTemporaryList;
|
|
|
|
float fWidth;
|
|
|
|
float fHeight;
|
|
|
|
uint32 fLevel;
|
|
|
|
bool fSelected;
|
|
|
|
bool fEnabled;
|
|
|
|
bool fExpanded;
|
|
|
|
bool fHasSubitems : 1;
|
|
|
|
bool fVisible : 1;
|
2002-10-29 21:38:31 +03:00
|
|
|
};
|
|
|
|
|
2008-02-24 17:15:28 +03:00
|
|
|
inline float
|
|
|
|
BListItem::Top(void) const
|
|
|
|
{
|
|
|
|
return fTop;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline float
|
|
|
|
BListItem::Bottom(void) const
|
|
|
|
{
|
|
|
|
return (fTop + ceilf(fHeight) - 1.0);
|
|
|
|
}
|
|
|
|
|
2006-02-11 18:23:23 +03:00
|
|
|
#include <StringItem.h>
|
|
|
|
// to maintain source compatibility
|
2002-10-29 21:38:31 +03:00
|
|
|
|
2006-02-11 18:23:23 +03:00
|
|
|
#endif // _LIST_ITEM_H
|