Completely replaced the ListView.h header - the old one wasn't compatible
with Be's and in a strange style. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@1756 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
4c135d0948
commit
b2d5d0de15
@ -1,21 +1,20 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
//------------------------------------------------------------------------------
|
||||||
|
// Copyright (c) 2001-2002, OpenBeOS
|
||||||
|
// Distributed under the terms of the OpenBeOS license
|
||||||
//
|
//
|
||||||
// File: ListView.h
|
// File: ListView.h
|
||||||
//
|
// Author: Axel Doerfler
|
||||||
// Description: BListView represents a one-dimensional list view.
|
// Description: BListView represents a one-dimensional list view.
|
||||||
//
|
//
|
||||||
// Copyright 2001, Ulrich Wimboeck
|
//------------------------------------------------------------------------------
|
||||||
//
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef _LIST_VIEW_H
|
#ifndef _LIST_VIEW_H
|
||||||
#define _LIST_VIEW_H
|
#define _LIST_VIEW_H
|
||||||
|
|
||||||
#include <BeBuild.h>
|
|
||||||
#include <List.h>
|
|
||||||
#include <ListItem.h>
|
|
||||||
#include <Invoker.h>
|
#include <Invoker.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
|
#include <List.h>
|
||||||
|
#include <ListItem.h>
|
||||||
|
|
||||||
struct track_data;
|
struct track_data;
|
||||||
|
|
||||||
@ -25,32 +24,20 @@ enum list_view_type {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USE_OPENBEOS_NAMESPACE
|
#ifdef USE_OPENBEOS_NAMESPACE
|
||||||
namespace OpenBeOS
|
namespace OpenBeOS {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
//----- BListView class ------------------------------------------
|
||||||
/*----- BListView class ------------------------------------------*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A BListView displays a list of items the user can select and
|
|
||||||
* invoke. Each item is a kind of BListItem object. The BListView
|
|
||||||
* manages the layout of the list and the interaction with the user;
|
|
||||||
* it leaves the display of each item to the BListItem objects.
|
|
||||||
* A BListItem is not a view and draws only when called upon by
|
|
||||||
* the BListView.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class BListView : public BView, public BInvoker
|
class BListView : public BView, public BInvoker
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BListView(BRect frame, const char *name,
|
BListView(BRect frame, const char *name,
|
||||||
list_view_type type = B_SINGLE_SELECTION_LIST,
|
list_view_type type = B_SINGLE_SELECTION_LIST,
|
||||||
uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
uint32 resizeMask = B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
||||||
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);
|
uint32 flags = B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE);
|
||||||
|
|
||||||
BListView(BMessage *data);
|
BListView(BMessage *data);
|
||||||
|
|
||||||
virtual ~BListView() ;
|
virtual ~BListView() ;
|
||||||
|
|
||||||
static BArchivable *Instantiate(BMessage *data);
|
static BArchivable *Instantiate(BMessage *data);
|
||||||
@ -112,7 +99,6 @@ virtual void SelectionChanged() ;
|
|||||||
|
|
||||||
void SortItems(int (*cmp)(const void *, const void *));
|
void SortItems(int (*cmp)(const void *, const void *));
|
||||||
|
|
||||||
|
|
||||||
/* These functions bottleneck through DoMiscellaneous() */
|
/* These functions bottleneck through DoMiscellaneous() */
|
||||||
bool SwapItems(int32 a, int32 b);
|
bool SwapItems(int32 a, int32 b);
|
||||||
bool MoveItem(int32 from, int32 to);
|
bool MoveItem(int32 from, int32 to);
|
||||||
@ -123,21 +109,17 @@ virtual void FrameMoved(BPoint new_position) ;
|
|||||||
|
|
||||||
BRect ItemFrame(int32 index);
|
BRect ItemFrame(int32 index);
|
||||||
|
|
||||||
virtual BHandler* ResolveSpecifier(BMessage* msg,
|
virtual BHandler *ResolveSpecifier(BMessage *msg, int32 index,
|
||||||
int32 index,
|
BMessage *specifier, int32 form, const char *property);
|
||||||
BMessage* specifier,
|
|
||||||
int32 form,
|
|
||||||
const char* property) ;
|
|
||||||
virtual status_t GetSupportedSuites(BMessage *data);
|
virtual status_t GetSupportedSuites(BMessage *data);
|
||||||
|
|
||||||
virtual status_t Perform(perform_code d, void* arg) ;
|
virtual status_t Perform(perform_code code, void *arg);
|
||||||
|
|
||||||
virtual void WindowActivated(bool state);
|
virtual void WindowActivated(bool state);
|
||||||
virtual void MouseUp(BPoint pt) ;
|
virtual void MouseUp(BPoint point);
|
||||||
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage* msg) ;
|
virtual void MouseMoved(BPoint point, uint32 code, const BMessage *msg);
|
||||||
virtual void DetachedFromWindow();
|
virtual void DetachedFromWindow();
|
||||||
virtual bool InitiateDrag(BPoint pt, int32 itemIndex,
|
virtual bool InitiateDrag(BPoint point, int32 itemIndex, bool initialySelected);
|
||||||
bool initialySelected) ;
|
|
||||||
|
|
||||||
virtual void ResizeToPreferred();
|
virtual void ResizeToPreferred();
|
||||||
virtual void GetPreferredSize(float *width, float *height);
|
virtual void GetPreferredSize(float *width, float *height);
|
||||||
@ -145,7 +127,6 @@ virtual void AllAttached() ;
|
|||||||
virtual void AllDetached();
|
virtual void AllDetached();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
enum MiscCode { B_NO_OP, B_REPLACE_OP, B_MOVE_OP, B_SWAP_OP };
|
enum MiscCode { B_NO_OP, B_REPLACE_OP, B_MOVE_OP, B_SWAP_OP };
|
||||||
union MiscData {
|
union MiscData {
|
||||||
struct Spare { int32 data[5]; };
|
struct Spare { int32 data[5]; };
|
||||||
@ -156,10 +137,14 @@ protected:
|
|||||||
|
|
||||||
virtual bool DoMiscellaneous(MiscCode code, MiscData *data);
|
virtual bool DoMiscellaneous(MiscCode code, MiscData *data);
|
||||||
|
|
||||||
/*----- Private or reserved -----------------------------------------*/
|
//----- Private or reserved -----------------------------------------
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class BOutlineListView ; // try to remove friend classes
|
friend class BOutlineListView;
|
||||||
|
|
||||||
|
virtual void _ReservedListView2();
|
||||||
|
virtual void _ReservedListView3();
|
||||||
|
virtual void _ReservedListView4();
|
||||||
|
|
||||||
BListView &operator=(const BListView &);
|
BListView &operator=(const BListView &);
|
||||||
|
|
||||||
@ -178,8 +163,7 @@ private:
|
|||||||
bool TryInitiateDrag(BPoint where);
|
bool TryInitiateDrag(BPoint where);
|
||||||
int32 CalcFirstSelected(int32 after);
|
int32 CalcFirstSelected(int32 after);
|
||||||
int32 CalcLastSelected(int32 before);
|
int32 CalcLastSelected(int32 before);
|
||||||
virtual void DrawItem(BListItem* item, BRect itemRect,
|
virtual void DrawItem(BListItem *item, BRect itemRect, bool complete = false);
|
||||||
bool complete = false) ;
|
|
||||||
|
|
||||||
bool DoSwapItems(int32 a, int32 b);
|
bool DoSwapItems(int32 a, int32 b);
|
||||||
bool DoMoveItem(int32 from, int32 to);
|
bool DoMoveItem(int32 from, int32 to);
|
||||||
@ -197,13 +181,17 @@ virtual void DrawItem(BListItem* item, BRect itemRect,
|
|||||||
BMessage *fSelectMessage;
|
BMessage *fSelectMessage;
|
||||||
BScrollView *fScrollView;
|
BScrollView *fScrollView;
|
||||||
track_data *fTrack;
|
track_data *fTrack;
|
||||||
|
uint32 _reserved[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void BListView::ScrollTo(float x, float y)
|
|
||||||
/* OK, no private parts */
|
|
||||||
{ ScrollTo(BPoint(x, y)) ; }
|
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
inline void
|
||||||
|
BListView::ScrollTo(float x, float y)
|
||||||
|
{
|
||||||
|
/* OK, no private parts */
|
||||||
|
ScrollTo(BPoint(x, y));
|
||||||
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
/*-------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifdef USE_OPENBEOS_NAMESPACE
|
#ifdef USE_OPENBEOS_NAMESPACE
|
||||||
|
Loading…
Reference in New Issue
Block a user