Big cleanup, rewrote Shelf.h.
Fixed bug in BShelf::ReplicantAt() - it is supposed to test if any of the variables passed in is NULL before writing to them. Got rid of the _PR3_COMPATIBLE_ stuff - we definitely don't need that :) Refactored the code a bit - moved the identical parts of the three DeleteReplicant() variants into a separate method _DeleteReplicant(), moved _rep_data_ code out of the class definition, replaced names like "fView2" and "aBool" with something more meaningful. Prefixed private methods with '_'. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13471 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+88
-118
@@ -1,145 +1,115 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: Shelf.h
|
||||
/
|
||||
/ Description: BShelf stores replicant views that are dropped onto it
|
||||
/
|
||||
/ Copyright 1996-98, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SHELF_H
|
||||
#define _SHELF_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
|
||||
#include <Handler.h>
|
||||
#include <List.h>
|
||||
|
||||
class BDataIO;
|
||||
class BView;
|
||||
|
||||
class BEntry;
|
||||
extern "C" void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
|
||||
const BMessage*, const BView*);
|
||||
struct entry_ref;
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- BShelf class ---------------------------------------------*/
|
||||
class _rep_data_;
|
||||
|
||||
class BShelf : public BHandler {
|
||||
public:
|
||||
BShelf(BView *view,
|
||||
bool allow_drags = true,
|
||||
const char *shelf_type = NULL);
|
||||
BShelf(const entry_ref *ref,
|
||||
BView *view,
|
||||
bool allow_drags = true,
|
||||
const char *shelf_type = NULL);
|
||||
BShelf(BDataIO *stream,
|
||||
BView *view,
|
||||
bool allow_drags = true,
|
||||
const char *shelf_type = NULL);
|
||||
BShelf(BMessage *data);
|
||||
virtual ~BShelf();
|
||||
public:
|
||||
BShelf(BView* view, bool allowDrags = true, const char* shelfType = NULL);
|
||||
BShelf(const entry_ref* ref, BView* view, bool allowDrags = true,
|
||||
const char* shelfType = NULL);
|
||||
BShelf(BDataIO* stream, BView* view, bool allowDrags = true,
|
||||
const char* shelfType = NULL);
|
||||
BShelf(BMessage *data);
|
||||
virtual ~BShelf();
|
||||
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
static BArchivable *Instantiate(BMessage *data);
|
||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||
static BArchivable* Instantiate(BMessage* archive);
|
||||
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
status_t Save();
|
||||
virtual void SetDirty(bool state);
|
||||
bool IsDirty() const;
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
status_t Save();
|
||||
virtual void SetDirty(bool state);
|
||||
bool IsDirty() const;
|
||||
|
||||
virtual BHandler *ResolveSpecifier(BMessage *msg,
|
||||
int32 index,
|
||||
BMessage *specifier,
|
||||
int32 form,
|
||||
const char *property);
|
||||
virtual status_t GetSupportedSuites(BMessage *data);
|
||||
virtual BHandler* ResolveSpecifier(BMessage *msg,
|
||||
int32 index, BMessage *specifier,
|
||||
int32 form, const char *property);
|
||||
virtual status_t GetSupportedSuites(BMessage* data);
|
||||
|
||||
virtual status_t Perform(perform_code d, void *arg);
|
||||
bool AllowsDragging() const;
|
||||
void SetAllowsDragging(bool state);
|
||||
bool AllowsZombies() const;
|
||||
void SetAllowsZombies(bool state);
|
||||
bool DisplaysZombies() const;
|
||||
void SetDisplaysZombies(bool state);
|
||||
bool IsTypeEnforced() const;
|
||||
void SetTypeEnforced(bool state);
|
||||
virtual status_t Perform(perform_code d, void *arg);
|
||||
bool AllowsDragging() const;
|
||||
void SetAllowsDragging(bool state);
|
||||
bool AllowsZombies() const;
|
||||
void SetAllowsZombies(bool state);
|
||||
bool DisplaysZombies() const;
|
||||
void SetDisplaysZombies(bool state);
|
||||
bool IsTypeEnforced() const;
|
||||
void SetTypeEnforced(bool state);
|
||||
|
||||
status_t SetSaveLocation(BDataIO *data_io);
|
||||
status_t SetSaveLocation(const entry_ref *ref);
|
||||
BDataIO *SaveLocation(entry_ref *ref) const;
|
||||
status_t SetSaveLocation(BDataIO *data_io);
|
||||
status_t SetSaveLocation(const entry_ref *ref);
|
||||
BDataIO* SaveLocation(entry_ref *ref) const;
|
||||
|
||||
status_t AddReplicant(BMessage *data, BPoint location);
|
||||
status_t DeleteReplicant(BView *replicant);
|
||||
status_t DeleteReplicant(BMessage *data);
|
||||
status_t DeleteReplicant(int32 index);
|
||||
int32 CountReplicants() const;
|
||||
BMessage *ReplicantAt(int32 index,
|
||||
BView **view = NULL,
|
||||
uint32 *uid = NULL,
|
||||
status_t *perr = NULL) const;
|
||||
int32 IndexOf(const BView *replicant_view) const;
|
||||
int32 IndexOf(const BMessage *archive) const;
|
||||
int32 IndexOf(uint32 id) const;
|
||||
status_t AddReplicant(BMessage *data, BPoint location);
|
||||
status_t DeleteReplicant(BView *replicant);
|
||||
status_t DeleteReplicant(BMessage *data);
|
||||
status_t DeleteReplicant(int32 index);
|
||||
int32 CountReplicants() const;
|
||||
BMessage* ReplicantAt(int32 index,
|
||||
BView **view = NULL,
|
||||
uint32 *uid = NULL,
|
||||
status_t *perr = NULL) const;
|
||||
int32 IndexOf(const BView *replicantView) const;
|
||||
int32 IndexOf(const BMessage *archive) const;
|
||||
int32 IndexOf(uint32 id) const;
|
||||
|
||||
protected:
|
||||
virtual bool CanAcceptReplicantMessage(BMessage*) const;
|
||||
virtual bool CanAcceptReplicantView(BRect, BView*, BMessage*) const;
|
||||
virtual BPoint AdjustReplicantBy(BRect, BMessage*) const;
|
||||
protected:
|
||||
virtual bool CanAcceptReplicantMessage(BMessage*) const;
|
||||
virtual bool CanAcceptReplicantView(BRect, BView*, BMessage*) const;
|
||||
virtual BPoint AdjustReplicantBy(BRect, BMessage*) const;
|
||||
|
||||
virtual void ReplicantDeleted(int32 index,
|
||||
const BMessage *archive,
|
||||
const BView *replicant);
|
||||
virtual void ReplicantDeleted(int32 index, const BMessage *archive,
|
||||
const BView *replicant);
|
||||
|
||||
/*----- Private or reserved -----------------------------------------*/
|
||||
private:
|
||||
friend class _TContainerViewFilter_;
|
||||
friend void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
|
||||
const BMessage*, const BView*);
|
||||
|
||||
virtual void _ReservedShelf2();
|
||||
virtual void _ReservedShelf3();
|
||||
virtual void _ReservedShelf4();
|
||||
virtual void _ReservedShelf5();
|
||||
private:
|
||||
friend class _TContainerViewFilter_;
|
||||
|
||||
#if !_PR3_COMPATIBLE_
|
||||
virtual void _ReservedShelf6();
|
||||
virtual void _ReservedShelf7();
|
||||
virtual void _ReservedShelf8();
|
||||
#endif
|
||||
BShelf(const BShelf&);
|
||||
BShelf &operator=(const BShelf &);
|
||||
virtual void _ReservedShelf2();
|
||||
virtual void _ReservedShelf3();
|
||||
virtual void _ReservedShelf4();
|
||||
virtual void _ReservedShelf5();
|
||||
virtual void _ReservedShelf6();
|
||||
virtual void _ReservedShelf7();
|
||||
virtual void _ReservedShelf8();
|
||||
|
||||
status_t _Archive(BMessage *data) const;
|
||||
void InitData(BEntry *entry,
|
||||
BDataIO *stream,
|
||||
BView *view,
|
||||
bool allow_drags);
|
||||
status_t RealAddReplicant(BMessage *data,
|
||||
BPoint *loc,
|
||||
uint32 uid);
|
||||
status_t GetProperty(BMessage *msg, BMessage *reply);
|
||||
BShelf(const BShelf& other);
|
||||
BShelf& operator=(const BShelf& other);
|
||||
|
||||
BView *fContainerView;
|
||||
BDataIO *fStream;
|
||||
BEntry *fEntry;
|
||||
BList fReplicants;
|
||||
_TContainerViewFilter_ *fFilter;
|
||||
uint32 fGenCount;
|
||||
bool fAllowDragging;
|
||||
bool fDirty;
|
||||
bool fDisplayZombies;
|
||||
bool fAllowZombies;
|
||||
bool fTypeEnforced;
|
||||
status_t _Archive(BMessage* data) const;
|
||||
void _InitData(BEntry* entry, BDataIO* stream,
|
||||
BView* view, bool allowDrags);
|
||||
status_t _DeleteReplicant(_rep_data_* replicant);
|
||||
status_t _RealAddReplicant(BMessage* data,
|
||||
BPoint* location, uint32 uniqueID);
|
||||
status_t _GetProperty(BMessage* message, BMessage* reply);
|
||||
|
||||
uint32 _reserved[3]; /* was 5 */
|
||||
#if !_PR3_COMPATIBLE_
|
||||
uint32 _more_reserved[5];
|
||||
#endif
|
||||
private:
|
||||
BView* fContainerView;
|
||||
BDataIO* fStream;
|
||||
BEntry* fEntry;
|
||||
BList fReplicants;
|
||||
_TContainerViewFilter_* fFilter;
|
||||
uint32 fGenCount;
|
||||
bool fAllowDragging;
|
||||
bool fDirty;
|
||||
bool fDisplayZombies;
|
||||
bool fAllowZombies;
|
||||
bool fTypeEnforced;
|
||||
|
||||
uint32 _reserved[8];
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _SHELF_H */
|
||||
#endif /* _SHELF_H */
|
||||
|
||||
Reference in New Issue
Block a user