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
+59 -44
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
@@ -20,36 +20,14 @@ 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 Height() const;
@@ -63,7 +41,9 @@ virtual void SetEnabled(bool on) ;
void SetHeight(float height); void SetHeight(float height);
void SetWidth(float width); void SetWidth(float width);
virtual void DrawItem(BView* owner, BRect bounds, bool complete = false) = 0 ; virtual void DrawItem(BView *owner,
BRect bounds,
bool complete = false) = 0;
virtual void Update(BView *owner, const BFont *font); virtual void Update(BView *owner, const BFont *font);
virtual status_t Perform(perform_code d, void *arg); virtual status_t Perform(perform_code d, void *arg);
@@ -76,28 +56,63 @@ virtual status_t Perform(perform_code d, void* arg) ;
private: private:
friend class BOutlineListView; friend class BOutlineListView;
BListItem(const BListItem&) ; bool HasSubitems() const;
virtual void _ReservedListItem1();
virtual void _ReservedListItem2();
BListItem(const BListItem &);
BListItem &operator=(const BListItem &); BListItem &operator=(const BListItem &);
/* calls used by BOutlineListView*/
bool IsItemVisible() const;
void SetItemVisible(bool);
uint32 _reserved[2];
float fWidth; float fWidth;
float fHeight; float fHeight;
uint32 fLevel; uint32 fLevel;
bool fSelected; bool fSelected;
bool fEnabled; bool fEnabled;
bool fExpanded; bool fExpanded;
bool fHasSubItems ; bool fHasSubitems : 1;
bool fVisible ; bool fVisible : 1;
}; };
// in the interface kit the BStringItem class is declared within ListItem.h
#ifndef USE_OPENBEOS_NAMESPACE
#include "StringItem.h"
#endif
#ifdef USE_OPENBEOS_NAMESPACE /*----------------------------------------------------------------*/
} /*----- BStringItem class ----------------------------------------*/
#endif
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 */