* 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:
@@ -1,17 +1,11 @@
|
|||||||
/*******************************************************************************
|
/*
|
||||||
/
|
* Copyright 2006, Haiku, Inc. All Rights Reserved.
|
||||||
/ File: Dragger.h
|
* Distributed under the terms of the MIT License.
|
||||||
/
|
*/
|
||||||
/ Description: BDragger represents a replicant "handle."
|
|
||||||
/
|
|
||||||
/ Copyright 1997-98, Be Incorporated, All Rights Reserved
|
|
||||||
/
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#ifndef _DRAGGER_H
|
#ifndef _DRAGGER_H
|
||||||
#define _DRAGGER_H
|
#define _DRAGGER_H
|
||||||
|
|
||||||
#include <BeBuild.h>
|
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
#include <View.h>
|
#include <View.h>
|
||||||
@@ -20,50 +14,52 @@ class BBitmap;
|
|||||||
class BMessage;
|
class BMessage;
|
||||||
class BShelf;
|
class BShelf;
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
namespace BPrivate {
|
||||||
/*----- BDragger class -------------------------------------------*/
|
class replicant_data;
|
||||||
|
class ShelfContainerViewFilter;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class BDragger : public BView {
|
class BDragger : public BView {
|
||||||
public:
|
public:
|
||||||
BDragger(BRect bounds,
|
BDragger(BRect bounds, BView* target,
|
||||||
BView *target,
|
uint32 resizingMask = B_FOLLOW_NONE,
|
||||||
uint32 rmask = B_FOLLOW_NONE,
|
|
||||||
uint32 flags = B_WILL_DRAW);
|
uint32 flags = B_WILL_DRAW);
|
||||||
BDragger(BMessage* data);
|
BDragger(BMessage* data);
|
||||||
|
|
||||||
virtual ~BDragger();
|
virtual ~BDragger();
|
||||||
|
|
||||||
static BArchivable* Instantiate(BMessage* data);
|
static BArchivable* Instantiate(BMessage* data);
|
||||||
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void DetachedFromWindow();
|
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!*/
|
virtual void Draw(BRect updateRect);
|
||||||
static status_t HideAllDraggers(); /* system wide!*/
|
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();
|
static bool AreDraggersDrawn();
|
||||||
|
|
||||||
virtual BHandler *ResolveSpecifier(BMessage *msg,
|
virtual BHandler* ResolveSpecifier(BMessage* message, int32 index,
|
||||||
int32 index,
|
BMessage* specifier, int32 form,
|
||||||
BMessage *specifier,
|
|
||||||
int32 form,
|
|
||||||
const char* property);
|
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 d, void* arg);
|
||||||
|
|
||||||
virtual void ResizeToPreferred();
|
virtual void ResizeToPreferred();
|
||||||
virtual void GetPreferredSize(float *width, float *height);
|
virtual void GetPreferredSize(float* _width, float* _height);
|
||||||
virtual void MakeFocus(bool state = true);
|
virtual void MakeFocus(bool focus = true);
|
||||||
virtual void AllAttached();
|
virtual void AllAttached();
|
||||||
virtual void AllDetached();
|
virtual void AllDetached();
|
||||||
|
|
||||||
status_t SetPopUp(BPopUpMenu *context_menu);
|
status_t SetPopUp(BPopUpMenu* contextMenu);
|
||||||
BPopUpMenu* PopUp() const;
|
BPopUpMenu* PopUp() const;
|
||||||
|
|
||||||
bool InShelf() const;
|
bool InShelf() const;
|
||||||
@@ -74,30 +70,28 @@ virtual BBitmap *DragBitmap(BPoint *offset, drawing_mode *mode);
|
|||||||
protected:
|
protected:
|
||||||
bool IsVisibilityChanging() const;
|
bool IsVisibilityChanging() const;
|
||||||
|
|
||||||
/*----- Private or reserved -----------------------------------------*/
|
|
||||||
private:
|
private:
|
||||||
|
friend class BPrivate::ShelfContainerViewFilter;
|
||||||
friend class _TContainerViewFilter_;
|
friend class BPrivate::replicant_data;
|
||||||
friend class _rep_data_;
|
|
||||||
friend class BShelf;
|
friend class BShelf;
|
||||||
friend void _toggle_handles_(bool);
|
|
||||||
|
|
||||||
//+virtual void _ReservedDragger1();
|
|
||||||
virtual void _ReservedDragger2();
|
virtual void _ReservedDragger2();
|
||||||
virtual void _ReservedDragger3();
|
virtual void _ReservedDragger3();
|
||||||
virtual void _ReservedDragger4();
|
virtual void _ReservedDragger4();
|
||||||
|
|
||||||
BDragger &operator=(const BDragger &);
|
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);
|
||||||
|
|
||||||
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 sVisible;
|
||||||
static bool sInited;
|
static bool sVisibleInitialized;
|
||||||
static BLocker sLock;
|
static BLocker sLock;
|
||||||
static BList sList;
|
static BList sList;
|
||||||
|
|
||||||
@@ -114,13 +108,9 @@ static BList sList;
|
|||||||
bool fTransition;
|
bool fTransition;
|
||||||
bool fIsZombie;
|
bool fIsZombie;
|
||||||
char fErrCount;
|
char fErrCount;
|
||||||
bool _unused2;
|
|
||||||
BBitmap * fBitmap;
|
BBitmap * fBitmap;
|
||||||
BPopUpMenu* fPopUp;
|
BPopUpMenu* fPopUp;
|
||||||
uint32 _reserved[3]; /* was 4 */
|
uint32 _reserved[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
/*-------------------------------------------------------------*/
|
|
||||||
/*-------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#endif /* _DRAGGER_H */
|
#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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _SHELF_H
|
#ifndef _SHELF_H
|
||||||
@@ -14,8 +14,11 @@ class BView;
|
|||||||
class BEntry;
|
class BEntry;
|
||||||
struct entry_ref;
|
struct entry_ref;
|
||||||
|
|
||||||
class _rep_data_;
|
namespace BPrivate {
|
||||||
class _TContainerViewFilter_;
|
class replicant_data;
|
||||||
|
class ShelfContainerViewFilter;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class BShelf : public BHandler {
|
class BShelf : public BHandler {
|
||||||
public:
|
public:
|
||||||
@@ -76,7 +79,7 @@ class BShelf : public BHandler {
|
|||||||
const BView *replicant);
|
const BView *replicant);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class _TContainerViewFilter_;
|
friend class BPrivate::ShelfContainerViewFilter;
|
||||||
|
|
||||||
virtual void _ReservedShelf2();
|
virtual void _ReservedShelf2();
|
||||||
virtual void _ReservedShelf3();
|
virtual void _ReservedShelf3();
|
||||||
@@ -92,7 +95,7 @@ class BShelf : public BHandler {
|
|||||||
status_t _Archive(BMessage* data) const;
|
status_t _Archive(BMessage* data) const;
|
||||||
void _InitData(BEntry* entry, BDataIO* stream,
|
void _InitData(BEntry* entry, BDataIO* stream,
|
||||||
BView* view, bool allowDrags);
|
BView* view, bool allowDrags);
|
||||||
status_t _DeleteReplicant(_rep_data_* replicant);
|
status_t _DeleteReplicant(BPrivate::replicant_data* replicant);
|
||||||
status_t _AddReplicant(BMessage* data,
|
status_t _AddReplicant(BMessage* data,
|
||||||
BPoint* location, uint32 uniqueID);
|
BPoint* location, uint32 uniqueID);
|
||||||
status_t _GetProperty(BMessage* message, BMessage* reply);
|
status_t _GetProperty(BMessage* message, BMessage* reply);
|
||||||
@@ -102,7 +105,7 @@ class BShelf : public BHandler {
|
|||||||
BDataIO* fStream;
|
BDataIO* fStream;
|
||||||
BEntry* fEntry;
|
BEntry* fEntry;
|
||||||
BList fReplicants;
|
BList fReplicants;
|
||||||
_TContainerViewFilter_* fFilter;
|
BPrivate::ShelfContainerViewFilter* fFilter;
|
||||||
uint32 fGenCount;
|
uint32 fGenCount;
|
||||||
bool fAllowDragging;
|
bool fAllowDragging;
|
||||||
bool fDirty;
|
bool fDirty;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <ViewPrivate.h>
|
#include <ViewPrivate.h>
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
|
#include <Autolock.h>
|
||||||
#include <Beep.h>
|
#include <Beep.h>
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
#include <Dragger.h>
|
#include <Dragger.h>
|
||||||
@@ -25,8 +26,8 @@
|
|||||||
|
|
||||||
|
|
||||||
bool BDragger::sVisible;
|
bool BDragger::sVisible;
|
||||||
bool BDragger::sInited;
|
bool BDragger::sVisibleInitialized;
|
||||||
BLocker BDragger::sLock("BDragger_sLock");
|
BLocker BDragger::sLock("BDragger static");
|
||||||
BList BDragger::sList;
|
BList BDragger::sList;
|
||||||
|
|
||||||
const static rgb_color kZombieColor = {220, 220, 220, 255};
|
const static rgb_color kZombieColor = {220, 220, 220, 255};
|
||||||
@@ -133,15 +134,15 @@ BDragger::AttachedToWindow()
|
|||||||
SetViewColor(B_TRANSPARENT_COLOR);
|
SetViewColor(B_TRANSPARENT_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
determine_relationship();
|
_DetermineRelationship();
|
||||||
ListManage(true);
|
_AddToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BDragger::DetachedFromWindow()
|
BDragger::DetachedFromWindow()
|
||||||
{
|
{
|
||||||
ListManage(false);
|
_RemoveFromList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -186,8 +187,7 @@ BDragger::MouseDown(BPoint where)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ShowPopUp(fTarget, where);
|
_ShowPopUp(fTarget, where);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
bigtime_t time = system_time();
|
bigtime_t time = system_time();
|
||||||
bigtime_t clickSpeed = 0;
|
bigtime_t clickSpeed = 0;
|
||||||
@@ -232,14 +232,15 @@ BDragger::MouseDown(BPoint where)
|
|||||||
BPoint offset;
|
BPoint offset;
|
||||||
drawing_mode mode;
|
drawing_mode mode;
|
||||||
BBitmap *bitmap = DragBitmap(&offset, &mode);
|
BBitmap *bitmap = DragBitmap(&offset, &mode);
|
||||||
if (bitmap)
|
if (bitmap != NULL)
|
||||||
DragMessage(&archive, bitmap, mode, offset, this);
|
DragMessage(&archive, bitmap, mode, offset, this);
|
||||||
else
|
else {
|
||||||
DragMessage(&archive,
|
DragMessage(&archive,
|
||||||
ConvertFromScreen(fTarget->ConvertToScreen(fTarget->Bounds())),
|
ConvertFromScreen(fTarget->ConvertToScreen(fTarget->Bounds())),
|
||||||
this);
|
this);
|
||||||
|
}
|
||||||
} else
|
} else
|
||||||
ShowPopUp(fTarget, where);
|
_ShowPopUp(fTarget, where);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,20 +263,20 @@ void
|
|||||||
BDragger::MessageReceived(BMessage *msg)
|
BDragger::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
if (msg->what == B_TRASH_TARGET) {
|
if (msg->what == B_TRASH_TARGET) {
|
||||||
if (fShelf)
|
if (fShelf != NULL)
|
||||||
Window()->PostMessage(kDeleteReplicant, fTarget, NULL);
|
Window()->PostMessage(kDeleteReplicant, fTarget, NULL);
|
||||||
else
|
else {
|
||||||
(new BAlert("??",
|
(new BAlert("??",
|
||||||
"Can't delete this replicant from its original application. Life goes on.",
|
"Can't delete this replicant from its original application. Life goes on.",
|
||||||
"OK", NULL, NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT))->Go(NULL);
|
"OK", NULL, NULL, B_WIDTH_FROM_WIDEST, B_WARNING_ALERT))->Go(NULL);
|
||||||
|
}
|
||||||
} else if (msg->what == B_SCREEN_CHANGED) {
|
} else if (msg->what == B_SCREEN_CHANGED) {
|
||||||
|
// TODO: this code is to be called whenever the "are draggers drawn" option is changed
|
||||||
if (fRelation == TARGET_IS_CHILD) {
|
if (fRelation == TARGET_IS_CHILD) {
|
||||||
fTransition = true;
|
fTransition = true;
|
||||||
Invalidate();
|
Invalidate();
|
||||||
Flush();
|
Flush();
|
||||||
fTransition = false;
|
fTransition = false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if ((fShelf && (fShelf->AllowsDragging() && AreDraggersDrawn()))
|
if ((fShelf && (fShelf->AllowsDragging() && AreDraggersDrawn()))
|
||||||
|| AreDraggersDrawn())
|
|| AreDraggersDrawn())
|
||||||
@@ -321,16 +322,22 @@ BDragger::HideAllDraggers()
|
|||||||
bool
|
bool
|
||||||
BDragger::AreDraggersDrawn()
|
BDragger::AreDraggersDrawn()
|
||||||
{
|
{
|
||||||
|
BAutolock _(sLock);
|
||||||
|
|
||||||
|
if (!sVisibleInitialized) {
|
||||||
// TODO: Implement. Should ask the registrar or the app server
|
// TODO: Implement. Should ask the registrar or the app server
|
||||||
return true;
|
sVisible = true;
|
||||||
|
sVisibleInitialized = true;
|
||||||
|
}
|
||||||
|
return sVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BHandler*
|
BHandler*
|
||||||
BDragger::ResolveSpecifier(BMessage *msg, int32 index, BMessage *specifier,
|
BDragger::ResolveSpecifier(BMessage* message, int32 index, BMessage* specifier,
|
||||||
int32 form, const char* property)
|
int32 form, const char* property)
|
||||||
{
|
{
|
||||||
return BView::ResolveSpecifier(msg, index, specifier, form, property);
|
return BView::ResolveSpecifier(message, index, specifier, form, property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -356,9 +363,9 @@ BDragger::ResizeToPreferred()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BDragger::GetPreferredSize(float *width, float *height)
|
BDragger::GetPreferredSize(float* _width, float* _height)
|
||||||
{
|
{
|
||||||
BView::GetPreferredSize(width, height);
|
BView::GetPreferredSize(_width, _height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -386,7 +393,7 @@ BDragger::AllDetached()
|
|||||||
status_t
|
status_t
|
||||||
BDragger::SetPopUp(BPopUpMenu *menu)
|
BDragger::SetPopUp(BPopUpMenu *menu)
|
||||||
{
|
{
|
||||||
if (fPopUp != NULL && fPopUp != menu)
|
if (fPopUp != menu)
|
||||||
delete fPopUp;
|
delete fPopUp;
|
||||||
|
|
||||||
fPopUp = menu;
|
fPopUp = menu;
|
||||||
@@ -397,8 +404,8 @@ BDragger::SetPopUp(BPopUpMenu *menu)
|
|||||||
BPopUpMenu *
|
BPopUpMenu *
|
||||||
BDragger::PopUp() const
|
BDragger::PopUp() const
|
||||||
{
|
{
|
||||||
if (!fPopUp && fTarget)
|
if (fPopUp == NULL && fTarget)
|
||||||
const_cast<BDragger *>(this)->BuildDefaultPopUp();
|
const_cast<BDragger *>(this)->_BuildDefaultPopUp();
|
||||||
|
|
||||||
return fPopUp;
|
return fPopUp;
|
||||||
}
|
}
|
||||||
@@ -445,33 +452,35 @@ BDragger::operator=(const BDragger &)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BDragger::ListManage(bool add)
|
BDragger::_AddToList()
|
||||||
{
|
{
|
||||||
if (sLock.Lock()) {
|
BAutolock _(sLock);
|
||||||
bool drawn = AreDraggersDrawn();
|
|
||||||
|
|
||||||
if (add) {
|
|
||||||
bool dragging = true;
|
|
||||||
|
|
||||||
sList.AddItem(this);
|
sList.AddItem(this);
|
||||||
|
|
||||||
|
bool allowsDragging = true;
|
||||||
if (fShelf)
|
if (fShelf)
|
||||||
dragging = fShelf->AllowsDragging();
|
allowsDragging = fShelf->AllowsDragging();
|
||||||
|
|
||||||
if (!drawn && !dragging) {
|
if (!AreDraggersDrawn() || !allowsDragging) {
|
||||||
|
// The dragger is not shown - but we can't hide us in case we're the
|
||||||
|
// parent of the actual target view (because then you couldn't see
|
||||||
|
// it anymore).
|
||||||
if (fRelation != TARGET_IS_CHILD)
|
if (fRelation != TARGET_IS_CHILD)
|
||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
sList.RemoveItem(this);
|
|
||||||
|
|
||||||
sLock.Unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BDragger::_RemoveFromList()
|
||||||
|
{
|
||||||
|
BAutolock _(sLock);
|
||||||
|
sList.RemoveItem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BDragger::determine_relationship()
|
BDragger::_DetermineRelationship()
|
||||||
{
|
{
|
||||||
status_t err = B_OK;
|
status_t err = B_OK;
|
||||||
|
|
||||||
@@ -496,7 +505,7 @@ BDragger::determine_relationship()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BDragger::SetViewToDrag(BView *target)
|
BDragger::_SetViewToDrag(BView *target)
|
||||||
{
|
{
|
||||||
if (target->Window() != Window())
|
if (target->Window() != Window())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -504,21 +513,21 @@ BDragger::SetViewToDrag(BView *target)
|
|||||||
fTarget = target;
|
fTarget = target;
|
||||||
|
|
||||||
if (Window())
|
if (Window())
|
||||||
determine_relationship();
|
_DetermineRelationship();
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BDragger::SetShelf(BShelf *shelf)
|
BDragger::_SetShelf(BShelf *shelf)
|
||||||
{
|
{
|
||||||
fShelf = shelf;
|
fShelf = shelf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BDragger::SetZombied(bool state)
|
BDragger::_SetZombied(bool state)
|
||||||
{
|
{
|
||||||
fIsZombie = state;
|
fIsZombie = state;
|
||||||
|
|
||||||
@@ -530,7 +539,7 @@ BDragger::SetZombied(bool state)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BDragger::BuildDefaultPopUp()
|
BDragger::_BuildDefaultPopUp()
|
||||||
{
|
{
|
||||||
fPopUp = new BPopUpMenu("Shelf", false, false, B_ITEMS_IN_COLUMN);
|
fPopUp = new BPopUpMenu("Shelf", false, false, B_ITEMS_IN_COLUMN);
|
||||||
|
|
||||||
@@ -538,7 +547,6 @@ BDragger::BuildDefaultPopUp()
|
|||||||
BMessage *msg = new BMessage(B_ABOUT_REQUESTED);
|
BMessage *msg = new BMessage(B_ABOUT_REQUESTED);
|
||||||
|
|
||||||
const char *name = fTarget->Name();
|
const char *name = fTarget->Name();
|
||||||
|
|
||||||
if (name)
|
if (name)
|
||||||
msg->AddString("target", name);
|
msg->AddString("target", name);
|
||||||
|
|
||||||
@@ -552,12 +560,12 @@ BDragger::BuildDefaultPopUp()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BDragger::ShowPopUp(BView *target, BPoint where)
|
BDragger::_ShowPopUp(BView *target, BPoint where)
|
||||||
{
|
{
|
||||||
BPoint point = ConvertToScreen(where);
|
BPoint point = ConvertToScreen(where);
|
||||||
|
|
||||||
if (!fPopUp && fTarget)
|
if (!fPopUp && fTarget)
|
||||||
BuildDefaultPopUp();
|
_BuildDefaultPopUp();
|
||||||
|
|
||||||
fPopUp->SetTargetForItems(fTarget);
|
fPopUp->SetTargetForItems(fTarget);
|
||||||
|
|
||||||
|
|||||||
@@ -101,17 +101,19 @@ extern "C" void _ReservedShelf1__6BShelfFv(BShelf *const, int32,
|
|||||||
const BMessage*, const BView*);
|
const BMessage*, const BView*);
|
||||||
|
|
||||||
|
|
||||||
class _rep_data_ {
|
namespace BPrivate {
|
||||||
|
|
||||||
|
class replicant_data {
|
||||||
private:
|
private:
|
||||||
friend class BShelf;
|
friend class BShelf;
|
||||||
|
|
||||||
_rep_data_(BMessage *message, BView *view, BDragger *dragger,
|
replicant_data(BMessage *message, BView *view, BDragger *dragger,
|
||||||
BDragger::relation relation, unsigned long id, image_id image);
|
BDragger::relation relation, unsigned long id, image_id image);
|
||||||
_rep_data_();
|
replicant_data();
|
||||||
|
|
||||||
static _rep_data_* find(BList const *list, BMessage const *msg);
|
static replicant_data* find(BList const *list, BMessage const *msg);
|
||||||
static _rep_data_* find(BList const *list, BView const *view, bool allowZombie);
|
static replicant_data* find(BList const *list, BView const *view, bool allowZombie);
|
||||||
static _rep_data_* find(BList const *list, unsigned long id);
|
static replicant_data* find(BList const *list, unsigned long id);
|
||||||
|
|
||||||
static int32 index_of(BList const *list, BMessage const *msg);
|
static int32 index_of(BList const *list, BMessage const *msg);
|
||||||
static int32 index_of(BList const *list, BView const *view, bool allowZombie);
|
static int32 index_of(BList const *list, BView const *view, bool allowZombie);
|
||||||
@@ -127,20 +129,37 @@ class _rep_data_ {
|
|||||||
BView *fZombieView;
|
BView *fZombieView;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ShelfContainerViewFilter : public BMessageFilter {
|
||||||
class _TContainerViewFilter_ : public BMessageFilter {
|
|
||||||
public:
|
public:
|
||||||
_TContainerViewFilter_(BShelf *shelf, BView *view);
|
ShelfContainerViewFilter(BShelf *shelf, BView *view);
|
||||||
virtual ~_TContainerViewFilter_();
|
|
||||||
|
|
||||||
filter_result Filter(BMessage *msg, BHandler **handler);
|
filter_result Filter(BMessage *msg, BHandler **handler);
|
||||||
filter_result ObjectDropFilter(BMessage *msg, BHandler **handler);
|
|
||||||
|
|
||||||
protected:
|
private:
|
||||||
|
filter_result _ObjectDropFilter(BMessage *msg, BHandler **handler);
|
||||||
|
|
||||||
BShelf *fShelf;
|
BShelf *fShelf;
|
||||||
BView *fView;
|
BView *fView;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ReplicantViewFilter : public BMessageFilter {
|
||||||
|
public:
|
||||||
|
ReplicantViewFilter(BShelf *shelf, BView *view);
|
||||||
|
|
||||||
|
filter_result Filter(BMessage *message, BHandler **handler);
|
||||||
|
|
||||||
|
private:
|
||||||
|
BShelf *fShelf;
|
||||||
|
BView *fView;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
|
using BPrivate::replicant_data;
|
||||||
|
using BPrivate::ReplicantViewFilter;
|
||||||
|
using BPrivate::ShelfContainerViewFilter;
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
@@ -164,7 +183,7 @@ send_reply(BMessage* message, status_t status, uint32 uniqueID)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
_rep_data_::_rep_data_(BMessage *message, BView *view, BDragger *dragger,
|
replicant_data::replicant_data(BMessage *message, BView *view, BDragger *dragger,
|
||||||
BDragger::relation relation, unsigned long id, image_id image)
|
BDragger::relation relation, unsigned long id, image_id image)
|
||||||
:
|
:
|
||||||
fMessage(message),
|
fMessage(message),
|
||||||
@@ -179,7 +198,7 @@ _rep_data_::_rep_data_(BMessage *message, BView *view, BDragger *dragger,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_rep_data_::_rep_data_()
|
replicant_data::replicant_data()
|
||||||
:
|
:
|
||||||
fMessage(NULL),
|
fMessage(NULL),
|
||||||
fView(NULL),
|
fView(NULL),
|
||||||
@@ -194,12 +213,12 @@ _rep_data_::_rep_data_()
|
|||||||
|
|
||||||
|
|
||||||
//static
|
//static
|
||||||
_rep_data_ *
|
replicant_data *
|
||||||
_rep_data_::find(BList const *list, BMessage const *msg)
|
replicant_data::find(BList const *list, BMessage const *msg)
|
||||||
{
|
{
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
_rep_data_ *item;
|
replicant_data *item;
|
||||||
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
|
while ((item = (replicant_data*)list->ItemAt(i++)) != NULL) {
|
||||||
if (item->fMessage == msg)
|
if (item->fMessage == msg)
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@@ -209,12 +228,12 @@ _rep_data_::find(BList const *list, BMessage const *msg)
|
|||||||
|
|
||||||
|
|
||||||
//static
|
//static
|
||||||
_rep_data_ *
|
replicant_data *
|
||||||
_rep_data_::find(BList const *list, BView const *view, bool allowZombie)
|
replicant_data::find(BList const *list, BView const *view, bool allowZombie)
|
||||||
{
|
{
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
_rep_data_ *item;
|
replicant_data *item;
|
||||||
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
|
while ((item = (replicant_data*)list->ItemAt(i++)) != NULL) {
|
||||||
if (item->fView == view)
|
if (item->fView == view)
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
@@ -227,12 +246,12 @@ _rep_data_::find(BList const *list, BView const *view, bool allowZombie)
|
|||||||
|
|
||||||
|
|
||||||
//static
|
//static
|
||||||
_rep_data_ *
|
replicant_data *
|
||||||
_rep_data_::find(BList const *list, unsigned long id)
|
replicant_data::find(BList const *list, unsigned long id)
|
||||||
{
|
{
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
_rep_data_ *item;
|
replicant_data *item;
|
||||||
while ((item = (_rep_data_*)list->ItemAt(i++)) != NULL) {
|
while ((item = (replicant_data*)list->ItemAt(i++)) != NULL) {
|
||||||
if (item->fId == id)
|
if (item->fId == id)
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
@@ -243,11 +262,11 @@ _rep_data_::find(BList const *list, unsigned long id)
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
int32
|
int32
|
||||||
_rep_data_::index_of(BList const *list, BMessage const *msg)
|
replicant_data::index_of(BList const *list, BMessage const *msg)
|
||||||
{
|
{
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
_rep_data_ *item;
|
replicant_data *item;
|
||||||
while ((item = (_rep_data_*)list->ItemAt(i)) != NULL) {
|
while ((item = (replicant_data*)list->ItemAt(i)) != NULL) {
|
||||||
if (item->fMessage == msg)
|
if (item->fMessage == msg)
|
||||||
return i;
|
return i;
|
||||||
i++;
|
i++;
|
||||||
@@ -259,11 +278,11 @@ _rep_data_::index_of(BList const *list, BMessage const *msg)
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
int32
|
int32
|
||||||
_rep_data_::index_of(BList const *list, BView const *view, bool allowZombie)
|
replicant_data::index_of(BList const *list, BView const *view, bool allowZombie)
|
||||||
{
|
{
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
_rep_data_ *item;
|
replicant_data *item;
|
||||||
while ((item = (_rep_data_*)list->ItemAt(i)) != NULL) {
|
while ((item = (replicant_data*)list->ItemAt(i)) != NULL) {
|
||||||
if (item->fView == view)
|
if (item->fView == view)
|
||||||
return i;
|
return i;
|
||||||
|
|
||||||
@@ -278,11 +297,11 @@ _rep_data_::index_of(BList const *list, BView const *view, bool allowZombie)
|
|||||||
|
|
||||||
//static
|
//static
|
||||||
int32
|
int32
|
||||||
_rep_data_::index_of(BList const *list, unsigned long id)
|
replicant_data::index_of(BList const *list, unsigned long id)
|
||||||
{
|
{
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
_rep_data_ *item;
|
replicant_data *item;
|
||||||
while ((item = (_rep_data_*)list->ItemAt(i)) != NULL) {
|
while ((item = (replicant_data*)list->ItemAt(i)) != NULL) {
|
||||||
if (item->fId == id)
|
if (item->fId == id)
|
||||||
return i;
|
return i;
|
||||||
i++;
|
i++;
|
||||||
@@ -295,7 +314,7 @@ _rep_data_::index_of(BList const *list, unsigned long id)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
_TContainerViewFilter_::_TContainerViewFilter_(BShelf *shelf, BView *view)
|
ShelfContainerViewFilter::ShelfContainerViewFilter(BShelf *shelf, BView *view)
|
||||||
: BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
|
: BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
|
||||||
fShelf(shelf),
|
fShelf(shelf),
|
||||||
fView(view)
|
fView(view)
|
||||||
@@ -303,26 +322,21 @@ _TContainerViewFilter_::_TContainerViewFilter_(BShelf *shelf, BView *view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_TContainerViewFilter_::~_TContainerViewFilter_()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
filter_result
|
filter_result
|
||||||
_TContainerViewFilter_::Filter(BMessage *msg, BHandler **handler)
|
ShelfContainerViewFilter::Filter(BMessage *msg, BHandler **handler)
|
||||||
{
|
{
|
||||||
filter_result filter = B_DISPATCH_MESSAGE;
|
filter_result filter = B_DISPATCH_MESSAGE;
|
||||||
|
|
||||||
if (msg->what == B_ARCHIVED_OBJECT ||
|
if (msg->what == B_ARCHIVED_OBJECT
|
||||||
msg->what == B_ABOUT_REQUESTED)
|
|| msg->what == B_ABOUT_REQUESTED)
|
||||||
return ObjectDropFilter(msg, handler);
|
return _ObjectDropFilter(msg, handler);
|
||||||
|
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
filter_result
|
filter_result
|
||||||
_TContainerViewFilter_::ObjectDropFilter(BMessage *msg, BHandler **_handler)
|
ShelfContainerViewFilter::_ObjectDropFilter(BMessage *msg, BHandler **_handler)
|
||||||
{
|
{
|
||||||
BView *mouseView = NULL;
|
BView *mouseView = NULL;
|
||||||
if (*_handler)
|
if (*_handler)
|
||||||
@@ -380,20 +394,16 @@ _TContainerViewFilter_::ObjectDropFilter(BMessage *msg, BHandler **_handler)
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
class _TReplicantViewFilter_ : public BMessageFilter {
|
ReplicantViewFilter::ReplicantViewFilter(BShelf *shelf, BView *view)
|
||||||
public:
|
|
||||||
_TReplicantViewFilter_(BShelf *shelf, BView *view)
|
|
||||||
: BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
|
: BMessageFilter(B_ANY_DELIVERY, B_ANY_SOURCE),
|
||||||
fShelf(shelf),
|
fShelf(shelf),
|
||||||
fView(view)
|
fView(view)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ~_TReplicantViewFilter_()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
filter_result Filter(BMessage *message, BHandler **handler)
|
filter_result
|
||||||
|
ReplicantViewFilter::Filter(BMessage *message, BHandler **handler)
|
||||||
{
|
{
|
||||||
if (message->what == kDeleteReplicant) {
|
if (message->what == kDeleteReplicant) {
|
||||||
if (handler != NULL)
|
if (handler != NULL)
|
||||||
@@ -403,13 +413,6 @@ class _TReplicantViewFilter_ : public BMessageFilter {
|
|||||||
return B_DISPATCH_MESSAGE;
|
return B_DISPATCH_MESSAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
BShelf *fShelf;
|
|
||||||
BView *fView;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
@@ -836,9 +839,9 @@ BShelf::AddReplicant(BMessage *data, BPoint location)
|
|||||||
status_t
|
status_t
|
||||||
BShelf::DeleteReplicant(BView *replicant)
|
BShelf::DeleteReplicant(BView *replicant)
|
||||||
{
|
{
|
||||||
int32 index = _rep_data_::index_of(&fReplicants, replicant, true);
|
int32 index = replicant_data::index_of(&fReplicants, replicant, true);
|
||||||
|
|
||||||
_rep_data_ *item = (_rep_data_*)fReplicants.ItemAt(index);
|
replicant_data *item = (replicant_data*)fReplicants.ItemAt(index);
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
@@ -849,9 +852,9 @@ BShelf::DeleteReplicant(BView *replicant)
|
|||||||
status_t
|
status_t
|
||||||
BShelf::DeleteReplicant(BMessage *data)
|
BShelf::DeleteReplicant(BMessage *data)
|
||||||
{
|
{
|
||||||
int32 index = _rep_data_::index_of(&fReplicants, data);
|
int32 index = replicant_data::index_of(&fReplicants, data);
|
||||||
|
|
||||||
_rep_data_ *item = (_rep_data_*)fReplicants.ItemAt(index);
|
replicant_data *item = (replicant_data*)fReplicants.ItemAt(index);
|
||||||
if (!item)
|
if (!item)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
@@ -862,7 +865,7 @@ BShelf::DeleteReplicant(BMessage *data)
|
|||||||
status_t
|
status_t
|
||||||
BShelf::DeleteReplicant(int32 index)
|
BShelf::DeleteReplicant(int32 index)
|
||||||
{
|
{
|
||||||
_rep_data_ *item = (_rep_data_*)fReplicants.ItemAt(index);
|
replicant_data *item = (replicant_data*)fReplicants.ItemAt(index);
|
||||||
if (!item)
|
if (!item)
|
||||||
return B_BAD_INDEX;
|
return B_BAD_INDEX;
|
||||||
|
|
||||||
@@ -881,7 +884,7 @@ BMessage *
|
|||||||
BShelf::ReplicantAt(int32 index, BView **_view, uint32 *_uniqueID,
|
BShelf::ReplicantAt(int32 index, BView **_view, uint32 *_uniqueID,
|
||||||
status_t *_error) const
|
status_t *_error) const
|
||||||
{
|
{
|
||||||
_rep_data_ *item = (_rep_data_*)fReplicants.ItemAt(index);
|
replicant_data *item = (replicant_data*)fReplicants.ItemAt(index);
|
||||||
if (item == NULL) {
|
if (item == NULL) {
|
||||||
// no replicant found
|
// no replicant found
|
||||||
if (_view)
|
if (_view)
|
||||||
@@ -908,21 +911,21 @@ BShelf::ReplicantAt(int32 index, BView **_view, uint32 *_uniqueID,
|
|||||||
int32
|
int32
|
||||||
BShelf::IndexOf(const BView *replicant_view) const
|
BShelf::IndexOf(const BView *replicant_view) const
|
||||||
{
|
{
|
||||||
return _rep_data_::index_of(&fReplicants, replicant_view, false);
|
return replicant_data::index_of(&fReplicants, replicant_view, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
BShelf::IndexOf(const BMessage *archive) const
|
BShelf::IndexOf(const BMessage *archive) const
|
||||||
{
|
{
|
||||||
return _rep_data_::index_of(&fReplicants, archive);
|
return replicant_data::index_of(&fReplicants, archive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
BShelf::IndexOf(uint32 id) const
|
BShelf::IndexOf(uint32 id) const
|
||||||
{
|
{
|
||||||
return _rep_data_::index_of(&fReplicants, id);
|
return replicant_data::index_of(&fReplicants, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -955,8 +958,7 @@ BShelf::ReplicantDeleted(int32 index, const BMessage *archive,
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_ReservedShelf1__6BShelfFv(BShelf *const, int32, const BMessage*,
|
_ReservedShelf1__6BShelfFv(BShelf *const, int32, const BMessage*, const BView*)
|
||||||
const BView*)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1019,7 +1021,7 @@ BShelf::_InitData(BEntry *entry, BDataIO *stream, BView *view,
|
|||||||
else
|
else
|
||||||
fStream = stream;
|
fStream = stream;
|
||||||
|
|
||||||
fFilter = new _TContainerViewFilter_(this, fContainerView);
|
fFilter = new ShelfContainerViewFilter(this, fContainerView);
|
||||||
|
|
||||||
fContainerView->AddFilter(fFilter);
|
fContainerView->AddFilter(fFilter);
|
||||||
fContainerView->_SetShelf(this);
|
fContainerView->_SetShelf(this);
|
||||||
@@ -1050,7 +1052,7 @@ BShelf::_InitData(BEntry *entry, BDataIO *stream, BView *view,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BShelf::_DeleteReplicant(_rep_data_* item)
|
BShelf::_DeleteReplicant(replicant_data* item)
|
||||||
{
|
{
|
||||||
bool loadedImage = item->fMessage->FindBool("");
|
bool loadedImage = item->fMessage->FindBool("");
|
||||||
|
|
||||||
@@ -1064,7 +1066,7 @@ BShelf::_DeleteReplicant(_rep_data_* item)
|
|||||||
if (item->fDragger)
|
if (item->fDragger)
|
||||||
item->fDragger->RemoveSelf();
|
item->fDragger->RemoveSelf();
|
||||||
|
|
||||||
int32 index = _rep_data_::index_of(&fReplicants, item->fMessage);
|
int32 index = replicant_data::index_of(&fReplicants, item->fMessage);
|
||||||
|
|
||||||
// TODO: Test if it's ok here
|
// TODO: Test if it's ok here
|
||||||
ReplicantDeleted(index, item->fMessage, view);
|
ReplicantDeleted(index, item->fMessage, view);
|
||||||
@@ -1114,11 +1116,11 @@ BShelf::_AddReplicant(BMessage *data, BPoint *location, uint32 uniqueID)
|
|||||||
if (data->FindString("class", &_class) == B_OK
|
if (data->FindString("class", &_class) == B_OK
|
||||||
&& data->FindString("add_on", &add_on) == B_OK) {
|
&& data->FindString("add_on", &add_on) == B_OK) {
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
_rep_data_ *item;
|
replicant_data *item;
|
||||||
const char *rep_class = NULL;
|
const char *rep_class = NULL;
|
||||||
const char *rep_add_on = NULL;
|
const char *rep_add_on = NULL;
|
||||||
|
|
||||||
while ((item = (_rep_data_*)fReplicants.ItemAt(i++)) != NULL) {
|
while ((item = (replicant_data*)fReplicants.ItemAt(i++)) != NULL) {
|
||||||
if (item->fMessage->FindString("class", &rep_class) == B_OK
|
if (item->fMessage->FindString("class", &rep_class) == B_OK
|
||||||
&& item->fMessage->FindString("add_on", &rep_add_on) == B_OK
|
&& item->fMessage->FindString("add_on", &rep_add_on) == B_OK
|
||||||
&& !strcmp(_class, rep_class) && add_on && rep_add_on
|
&& !strcmp(_class, rep_class) && add_on && rep_add_on
|
||||||
@@ -1158,14 +1160,14 @@ BShelf::_AddReplicant(BMessage *data, BPoint *location, uint32 uniqueID)
|
|||||||
dragger = dynamic_cast<BDragger*>(instantiate_object(&widget, &draggerImage));
|
dragger = dynamic_cast<BDragger*>(instantiate_object(&widget, &draggerImage));
|
||||||
if (dragger != NULL) {
|
if (dragger != NULL) {
|
||||||
// Replicant is either a sibling or unknown
|
// Replicant is either a sibling or unknown
|
||||||
dragger->SetViewToDrag(replicant);
|
dragger->_SetViewToDrag(replicant);
|
||||||
relation = BDragger::TARGET_IS_SIBLING;
|
relation = BDragger::TARGET_IS_SIBLING;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Replicant is child of the dragger
|
// Replicant is child of the dragger
|
||||||
if ((dragger = dynamic_cast<BDragger*>(view)) != NULL) {
|
if ((dragger = dynamic_cast<BDragger*>(view)) != NULL) {
|
||||||
replicant = dragger->ChildAt(0);
|
replicant = dragger->ChildAt(0);
|
||||||
dragger->SetViewToDrag(replicant);
|
dragger->_SetViewToDrag(replicant);
|
||||||
relation = BDragger::TARGET_IS_CHILD;
|
relation = BDragger::TARGET_IS_CHILD;
|
||||||
} else {
|
} else {
|
||||||
// Replicant is parent of the dragger
|
// Replicant is parent of the dragger
|
||||||
@@ -1173,14 +1175,14 @@ BShelf::_AddReplicant(BMessage *data, BPoint *location, uint32 uniqueID)
|
|||||||
dragger = dynamic_cast<BDragger*>(replicant->FindView("_dragger_"));
|
dragger = dynamic_cast<BDragger*>(replicant->FindView("_dragger_"));
|
||||||
|
|
||||||
if (dragger)
|
if (dragger)
|
||||||
dragger->SetViewToDrag(replicant);
|
dragger->_SetViewToDrag(replicant);
|
||||||
|
|
||||||
relation = BDragger::TARGET_IS_PARENT;
|
relation = BDragger::TARGET_IS_PARENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dragger != NULL)
|
if (dragger != NULL)
|
||||||
dragger->SetShelf(this);
|
dragger->_SetShelf(this);
|
||||||
|
|
||||||
BRect frame;
|
BRect frame;
|
||||||
if (relation != BDragger::TARGET_IS_CHILD) {
|
if (relation != BDragger::TARGET_IS_CHILD) {
|
||||||
@@ -1211,7 +1213,7 @@ BShelf::_AddReplicant(BMessage *data, BPoint *location, uint32 uniqueID)
|
|||||||
if (relation == BDragger::TARGET_IS_SIBLING || relation == BDragger::TARGET_IS_CHILD)
|
if (relation == BDragger::TARGET_IS_SIBLING || relation == BDragger::TARGET_IS_CHILD)
|
||||||
fContainerView->AddChild(dragger);
|
fContainerView->AddChild(dragger);
|
||||||
|
|
||||||
replicant->AddFilter(new _TReplicantViewFilter_(this, replicant));
|
replicant->AddFilter(new ReplicantViewFilter(this, replicant));
|
||||||
} else if (fDisplayZombies && fAllowZombies) {
|
} else if (fDisplayZombies && fAllowZombies) {
|
||||||
// TODO: the zombies must be adjusted and moved as well!
|
// TODO: the zombies must be adjusted and moved as well!
|
||||||
BRect frame;
|
BRect frame;
|
||||||
@@ -1230,12 +1232,12 @@ BShelf::_AddReplicant(BMessage *data, BPoint *location, uint32 uniqueID)
|
|||||||
frame.OffsetTo(B_ORIGIN);
|
frame.OffsetTo(B_ORIGIN);
|
||||||
|
|
||||||
dragger = new BDragger(frame, zombie);
|
dragger = new BDragger(frame, zombie);
|
||||||
dragger->SetShelf(this);
|
dragger->_SetShelf(this);
|
||||||
dragger->SetZombied(true);
|
dragger->_SetZombied(true);
|
||||||
|
|
||||||
zombie->AddChild(dragger);
|
zombie->AddChild(dragger);
|
||||||
zombie->SetArchive(data);
|
zombie->SetArchive(data);
|
||||||
zombie->AddFilter(new _TReplicantViewFilter_(this, zombie));
|
zombie->AddFilter(new ReplicantViewFilter(this, zombie));
|
||||||
|
|
||||||
fContainerView->AddChild(zombie);
|
fContainerView->AddChild(zombie);
|
||||||
}
|
}
|
||||||
@@ -1244,7 +1246,7 @@ BShelf::_AddReplicant(BMessage *data, BPoint *location, uint32 uniqueID)
|
|||||||
data->RemoveName("_drop_point_");
|
data->RemoveName("_drop_point_");
|
||||||
data->RemoveName("_drop_offset_");
|
data->RemoveName("_drop_offset_");
|
||||||
|
|
||||||
_rep_data_ *item = new _rep_data_(data, replicant, dragger, relation,
|
replicant_data *item = new replicant_data(data, replicant, dragger, relation,
|
||||||
uniqueID, image);
|
uniqueID, image);
|
||||||
|
|
||||||
item->fError = B_OK;
|
item->fError = B_OK;
|
||||||
|
|||||||
Reference in New Issue
Block a user