Copied over the ListItem.h header with the original one for now (the old

one wasn't compatible and written in a strange style).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1757 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2002-10-29 18:38:31 +00:00
parent b2d5d0de15
commit 1c1ff60b97
+90 -75
View File
@@ -1,12 +1,12 @@
//////////////////////////////////////////////////////////////////////////////// /*******************************************************************************
// /
// File: ListItem.h / File: ListItem.h
// /
// Description: BListView represents a one-dimensional list view. / Description: BListView represents a one-dimensional list view.
// /
// Copyright 2001, Ulrich Wimboeck / Copyright 1996-98, Be Incorporated, All Rights Reserved
// /
//////////////////////////////////////////////////////////////////////////////// *******************************************************************************/
#ifndef _LIST_ITEM_H #ifndef _LIST_ITEM_H
#define _LIST_ITEM_H #define _LIST_ITEM_H
@@ -15,89 +15,104 @@
#include <Archivable.h> #include <Archivable.h>
#include <Rect.h> #include <Rect.h>
class BFont ; class BFont;
class BMessage ; class BMessage;
class BOutlineListView ; class BOutlineListView;
class BView ; class BView;
#ifdef USE_OPENBEOS_NAMESPACE
namespace OpenBeOS
{
#endif
/*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/
/*----- BListItem class ------------------------------------------*/ /*----- BListItem class ------------------------------------------*/
/** class BListItem : public BArchivable {
* A BListItem represents a single item in a BListView (or
* BOutlineListView). The BListItem object provides drawing
* instructions that can draw the item (through DrawItem()), and
* keeps track of the item's state. To use a BListItem, you must
* add it to a BListView through BListView::AddItem()
* (BOutlineListView provides additional item-adding functions).
* The BListView object provides the drawing context for the
* BListItem's DrawItem() function.
*
* BListItem is abstract; each subclass must implement DrawItem().
* BStringItem—the only BListItem subclass provided by
* Be—implements the function to draw the item as a line of text.
*/
class BListItem : public BArchivable
{
public: public:
BListItem(uint32 outlineLevel = 0, bool expanded = true) ; BListItem(uint32 outlineLevel = 0, bool expanded = true);
BListItem(BMessage* data) ; BListItem(BMessage *data);
virtual ~BListItem() ; virtual ~BListItem();
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual status_t Archive(BMessage* data, bool deep = true) const ; float Height() const;
float Width() const;
bool IsSelected() const;
void Select();
void Deselect();
float Height() const ; virtual void SetEnabled(bool on);
float Width() const ; bool IsEnabled() const;
bool IsSelected() const ;
void Select() ;
void Deselect() ;
virtual void SetEnabled(bool on) ; void SetHeight(float height);
bool IsEnabled() const ; void SetWidth(float width);
virtual void DrawItem(BView *owner,
BRect bounds,
bool complete = false) = 0;
virtual void Update(BView *owner, const BFont *font);
void SetHeight(float height) ; virtual status_t Perform(perform_code d, void *arg);
void SetWidth(float width) ;
virtual void DrawItem(BView* owner, BRect bounds, bool complete = false) = 0 ;
virtual void Update(BView* owner, const BFont* font) ;
virtual status_t Perform(perform_code d, void* arg) ; bool IsExpanded() const;
void SetExpanded(bool expanded);
bool IsExpanded() const ; uint32 OutlineLevel() const;
void SetExpanded(bool expanded) ;
uint32 OutlineLevel() const ;
/*----- Private or reserved -----------------------------------------*/ /*----- Private or reserved -----------------------------------------*/
private: private:
friend class BOutlineListView ; friend class BOutlineListView;
BListItem(const BListItem&) ; bool HasSubitems() const;
BListItem& operator=(const BListItem&) ;
float fWidth ; virtual void _ReservedListItem1();
float fHeight ; virtual void _ReservedListItem2();
uint32 fLevel ;
bool fSelected ;
bool fEnabled ;
bool fExpanded ; BListItem(const BListItem &);
bool fHasSubItems ; BListItem &operator=(const BListItem &);
bool fVisible ;
} ;
// in the interface kit the BStringItem class is declared within ListItem.h /* calls used by BOutlineListView*/
#ifndef USE_OPENBEOS_NAMESPACE bool IsItemVisible() const;
#include "StringItem.h" void SetItemVisible(bool);
#endif
#ifdef USE_OPENBEOS_NAMESPACE uint32 _reserved[2];
} float fWidth;
#endif float fHeight;
uint32 fLevel;
bool fSelected;
bool fEnabled;
bool fExpanded;
bool fHasSubitems : 1;
bool fVisible : 1;
};
/*----------------------------------------------------------------*/
/*----- BStringItem class ----------------------------------------*/
class BStringItem : public BListItem {
public:
BStringItem(const char *text,
uint32 outlineLevel = 0, bool expanded = true);
virtual ~BStringItem();
BStringItem(BMessage *data);
static BArchivable *Instantiate(BMessage *data);
virtual status_t Archive(BMessage *data, bool deep = true) const;
virtual void DrawItem(BView *owner, BRect frame, bool complete = false);
virtual void SetText(const char *text);
const char *Text() const;
virtual void Update(BView *owner, const BFont *font);
virtual status_t Perform(perform_code d, void *arg);
private:
virtual void _ReservedStringItem1();
virtual void _ReservedStringItem2();
BStringItem(const BStringItem &);
BStringItem &operator=(const BStringItem &);
char *fText;
float fBaselineOffset;
uint32 _reserved[2];
};
/*-------------------------------------------------------------*/
/*-------------------------------------------------------------*/
#endif /* _LIST_ITEM_H */ #endif /* _LIST_ITEM_H */