* Fixed bug that let the dragger not hide in the Deskbar (was in ListManage(), now
in _AddToList()). * Cleaned up BDragger and BShelf a bit, moved private classes into the BPrivate namespace, renamed private methods to have the '_' prefix. * Rewrote Dragger.h. * Is that static dragger list needed at all? And if so, for what?` git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18487 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+101
-111
@@ -1,17 +1,11 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: Dragger.h
|
||||
/
|
||||
/ Description: BDragger represents a replicant "handle."
|
||||
/
|
||||
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
/*
|
||||
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _DRAGGER_H
|
||||
#define _DRAGGER_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
|
||||
#include <Locker.h>
|
||||
#include <List.h>
|
||||
#include <View.h>
|
||||
@@ -20,107 +14,103 @@ class BBitmap;
|
||||
class BMessage;
|
||||
class BShelf;
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- BDragger class -------------------------------------------*/
|
||||
|
||||
class BDragger : public BView {
|
||||
public:
|
||||
BDragger(BRect bounds,
|
||||
BView *target,
|
||||
uint32 rmask = B_FOLLOW_NONE,
|
||||
uint32 flags = B_WILL_DRAW);
|
||||
BDragger(BMessage *data);
|
||||
|
||||
virtual ~BDragger();
|
||||
static BArchivable *Instantiate(BMessage *data);
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
virtual void Draw(BRect update);
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseUp(BPoint pt);
|
||||
virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg);
|
||||
virtual void MessageReceived(BMessage *msg);
|
||||
virtual void FrameMoved(BPoint new_position);
|
||||
virtual void FrameResized(float new_width, float new_height);
|
||||
|
||||
static status_t ShowAllDraggers(); /* system wide!*/
|
||||
static status_t HideAllDraggers(); /* system wide!*/
|
||||
static bool AreDraggersDrawn();
|
||||
|
||||
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);
|
||||
|
||||
virtual void ResizeToPreferred();
|
||||
virtual void GetPreferredSize(float *width, float *height);
|
||||
virtual void MakeFocus(bool state = true);
|
||||
virtual void AllAttached();
|
||||
virtual void AllDetached();
|
||||
|
||||
status_t SetPopUp(BPopUpMenu *context_menu);
|
||||
BPopUpMenu *PopUp() const;
|
||||
|
||||
bool InShelf() const;
|
||||
BView *Target() const;
|
||||
|
||||
virtual BBitmap *DragBitmap(BPoint *offset, drawing_mode *mode);
|
||||
|
||||
protected:
|
||||
bool IsVisibilityChanging() const;
|
||||
|
||||
/*----- Private or reserved -----------------------------------------*/
|
||||
private:
|
||||
|
||||
friend class _TContainerViewFilter_;
|
||||
friend class _rep_data_;
|
||||
friend class BShelf;
|
||||
friend void _toggle_handles_(bool);
|
||||
|
||||
//+virtual void _ReservedDragger1();
|
||||
virtual void _ReservedDragger2();
|
||||
virtual void _ReservedDragger3();
|
||||
virtual void _ReservedDragger4();
|
||||
|
||||
BDragger &operator=(const BDragger &);
|
||||
|
||||
void ListManage(bool);
|
||||
status_t determine_relationship();
|
||||
status_t SetViewToDrag(BView *target);
|
||||
void SetShelf(BShelf *);
|
||||
void SetZombied(bool state);
|
||||
void BuildDefaultPopUp();
|
||||
void ShowPopUp(BView *target, BPoint where);
|
||||
static bool sVisible;
|
||||
static bool sInited;
|
||||
static BLocker sLock;
|
||||
static BList sList;
|
||||
|
||||
enum relation {
|
||||
TARGET_UNKNOWN,
|
||||
TARGET_IS_CHILD,
|
||||
TARGET_IS_PARENT,
|
||||
TARGET_IS_SIBLING
|
||||
};
|
||||
|
||||
BView *fTarget;
|
||||
relation fRelation;
|
||||
BShelf *fShelf;
|
||||
bool fTransition;
|
||||
bool fIsZombie;
|
||||
char fErrCount;
|
||||
bool _unused2;
|
||||
BBitmap *fBitmap;
|
||||
BPopUpMenu *fPopUp;
|
||||
uint32 _reserved[3]; /* was 4 */
|
||||
namespace BPrivate {
|
||||
class replicant_data;
|
||||
class ShelfContainerViewFilter;
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
class BDragger : public BView {
|
||||
public:
|
||||
BDragger(BRect bounds, BView* target,
|
||||
uint32 resizingMask = B_FOLLOW_NONE,
|
||||
uint32 flags = B_WILL_DRAW);
|
||||
BDragger(BMessage* data);
|
||||
virtual ~BDragger();
|
||||
|
||||
static BArchivable* Instantiate(BMessage* data);
|
||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void DetachedFromWindow();
|
||||
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MouseUp(BPoint where);
|
||||
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||
const BMessage* dragMessage);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
virtual void FrameMoved(BPoint newPosition);
|
||||
virtual void FrameResized(float newWidth, float newHeight);
|
||||
|
||||
static status_t ShowAllDraggers();
|
||||
static status_t HideAllDraggers();
|
||||
static bool AreDraggersDrawn();
|
||||
|
||||
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
|
||||
BMessage* specifier, int32 form,
|
||||
const char* property);
|
||||
virtual status_t GetSupportedSuites(BMessage* data);
|
||||
virtual status_t Perform(perform_code d, void* arg);
|
||||
|
||||
virtual void ResizeToPreferred();
|
||||
virtual void GetPreferredSize(float* _width, float* _height);
|
||||
virtual void MakeFocus(bool focus = true);
|
||||
virtual void AllAttached();
|
||||
virtual void AllDetached();
|
||||
|
||||
status_t SetPopUp(BPopUpMenu* contextMenu);
|
||||
BPopUpMenu* PopUp() const;
|
||||
|
||||
bool InShelf() const;
|
||||
BView* Target() const;
|
||||
|
||||
virtual BBitmap* DragBitmap(BPoint* offset, drawing_mode *mode);
|
||||
|
||||
protected:
|
||||
bool IsVisibilityChanging() const;
|
||||
|
||||
private:
|
||||
friend class BPrivate::ShelfContainerViewFilter;
|
||||
friend class BPrivate::replicant_data;
|
||||
friend class BShelf;
|
||||
|
||||
virtual void _ReservedDragger2();
|
||||
virtual void _ReservedDragger3();
|
||||
virtual void _ReservedDragger4();
|
||||
|
||||
BDragger& operator=(const BDragger& other);
|
||||
|
||||
void _AddToList();
|
||||
void _RemoveFromList();
|
||||
status_t _DetermineRelationship();
|
||||
status_t _SetViewToDrag(BView* target);
|
||||
void _SetShelf(BShelf* shelf);
|
||||
void _SetZombied(bool state);
|
||||
void _BuildDefaultPopUp();
|
||||
void _ShowPopUp(BView* target, BPoint where);
|
||||
|
||||
static bool sVisible;
|
||||
static bool sVisibleInitialized;
|
||||
static BLocker sLock;
|
||||
static BList sList;
|
||||
|
||||
enum relation {
|
||||
TARGET_UNKNOWN,
|
||||
TARGET_IS_CHILD,
|
||||
TARGET_IS_PARENT,
|
||||
TARGET_IS_SIBLING
|
||||
};
|
||||
|
||||
BView* fTarget;
|
||||
relation fRelation;
|
||||
BShelf* fShelf;
|
||||
bool fTransition;
|
||||
bool fIsZombie;
|
||||
char fErrCount;
|
||||
BBitmap * fBitmap;
|
||||
BPopUpMenu* fPopUp;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
|
||||
#endif /* _DRAGGER_H */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku Inc.
|
||||
* Copyright 2001-2006, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SHELF_H
|
||||
@@ -14,8 +14,11 @@ class BView;
|
||||
class BEntry;
|
||||
struct entry_ref;
|
||||
|
||||
class _rep_data_;
|
||||
class _TContainerViewFilter_;
|
||||
namespace BPrivate {
|
||||
class replicant_data;
|
||||
class ShelfContainerViewFilter;
|
||||
};
|
||||
|
||||
|
||||
class BShelf : public BHandler {
|
||||
public:
|
||||
@@ -76,7 +79,7 @@ class BShelf : public BHandler {
|
||||
const BView *replicant);
|
||||
|
||||
private:
|
||||
friend class _TContainerViewFilter_;
|
||||
friend class BPrivate::ShelfContainerViewFilter;
|
||||
|
||||
virtual void _ReservedShelf2();
|
||||
virtual void _ReservedShelf3();
|
||||
@@ -92,7 +95,7 @@ class BShelf : public BHandler {
|
||||
status_t _Archive(BMessage* data) const;
|
||||
void _InitData(BEntry* entry, BDataIO* stream,
|
||||
BView* view, bool allowDrags);
|
||||
status_t _DeleteReplicant(_rep_data_* replicant);
|
||||
status_t _DeleteReplicant(BPrivate::replicant_data* replicant);
|
||||
status_t _AddReplicant(BMessage* data,
|
||||
BPoint* location, uint32 uniqueID);
|
||||
status_t _GetProperty(BMessage* message, BMessage* reply);
|
||||
@@ -102,7 +105,7 @@ class BShelf : public BHandler {
|
||||
BDataIO* fStream;
|
||||
BEntry* fEntry;
|
||||
BList fReplicants;
|
||||
_TContainerViewFilter_* fFilter;
|
||||
BPrivate::ShelfContainerViewFilter* fFilter;
|
||||
uint32 fGenCount;
|
||||
bool fAllowDragging;
|
||||
bool fDirty;
|
||||
|
||||
Reference in New Issue
Block a user