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:
@@ -1,12 +1,12 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// File: ListItem.h
|
||||
//
|
||||
// Description: BListView represents a one-dimensional list view.
|
||||
//
|
||||
// Copyright 2001, Ulrich Wimboeck
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: ListItem.h
|
||||
/
|
||||
/ Description: BListView represents a one-dimensional list view.
|
||||
/
|
||||
/ Copyright 1996-98, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _LIST_ITEM_H
|
||||
#define _LIST_ITEM_H
|
||||
@@ -15,89 +15,104 @@
|
||||
#include <Archivable.h>
|
||||
#include <Rect.h>
|
||||
|
||||
class BFont ;
|
||||
class BMessage ;
|
||||
class BOutlineListView ;
|
||||
class BView ;
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS
|
||||
{
|
||||
#endif
|
||||
class BFont;
|
||||
class BMessage;
|
||||
class BOutlineListView;
|
||||
class BView;
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- BListItem class ------------------------------------------*/
|
||||
|
||||
/**
|
||||
* 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
|
||||
{
|
||||
class BListItem : public BArchivable {
|
||||
public:
|
||||
BListItem(uint32 outlineLevel = 0, bool expanded = true) ;
|
||||
BListItem(BMessage* data) ;
|
||||
virtual ~BListItem() ;
|
||||
BListItem(uint32 outlineLevel = 0, bool expanded = true);
|
||||
BListItem(BMessage *data);
|
||||
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 ;
|
||||
float Width() const ;
|
||||
bool IsSelected() const ;
|
||||
void Select() ;
|
||||
void Deselect() ;
|
||||
virtual void SetEnabled(bool on);
|
||||
bool IsEnabled() const;
|
||||
|
||||
virtual void SetEnabled(bool on) ;
|
||||
bool IsEnabled() const ;
|
||||
void SetHeight(float height);
|
||||
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) ;
|
||||
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);
|
||||
|
||||
virtual status_t Perform(perform_code d, void* arg) ;
|
||||
|
||||
bool IsExpanded() const ;
|
||||
void SetExpanded(bool expanded) ;
|
||||
uint32 OutlineLevel() const ;
|
||||
bool IsExpanded() const;
|
||||
void SetExpanded(bool expanded);
|
||||
uint32 OutlineLevel() const;
|
||||
|
||||
/*----- Private or reserved -----------------------------------------*/
|
||||
private:
|
||||
friend class BOutlineListView ;
|
||||
friend class BOutlineListView;
|
||||
|
||||
BListItem(const BListItem&) ;
|
||||
|
||||
BListItem& operator=(const BListItem&) ;
|
||||
bool HasSubitems() const;
|
||||
|
||||
float fWidth ;
|
||||
float fHeight ;
|
||||
uint32 fLevel ;
|
||||
bool fSelected ;
|
||||
bool fEnabled ;
|
||||
virtual void _ReservedListItem1();
|
||||
virtual void _ReservedListItem2();
|
||||
|
||||
bool fExpanded ;
|
||||
bool fHasSubItems ;
|
||||
bool fVisible ;
|
||||
} ;
|
||||
BListItem(const BListItem &);
|
||||
BListItem &operator=(const BListItem &);
|
||||
|
||||
// in the interface kit the BStringItem class is declared within ListItem.h
|
||||
#ifndef USE_OPENBEOS_NAMESPACE
|
||||
#include "StringItem.h"
|
||||
#endif
|
||||
/* calls used by BOutlineListView*/
|
||||
bool IsItemVisible() const;
|
||||
void SetItemVisible(bool);
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
uint32 _reserved[2];
|
||||
float fWidth;
|
||||
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 */
|
||||
|
||||
Reference in New Issue
Block a user