2006-08-11 23:26:37 +04:00
|
|
|
/*
|
2009-08-27 15:12:41 +04:00
|
|
|
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
2006-08-11 23:26:37 +04:00
|
|
|
*/
|
2002-10-23 17:54:44 +04:00
|
|
|
#ifndef _DRAGGER_H
|
|
|
|
#define _DRAGGER_H
|
|
|
|
|
2006-08-11 23:26:37 +04:00
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
#include <Locker.h>
|
|
|
|
#include <List.h>
|
|
|
|
#include <View.h>
|
|
|
|
|
|
|
|
class BBitmap;
|
|
|
|
class BMessage;
|
2007-10-16 00:13:55 +04:00
|
|
|
class BPopUpMenu;
|
2002-10-23 17:54:44 +04:00
|
|
|
class BShelf;
|
|
|
|
|
2006-08-11 23:26:37 +04:00
|
|
|
namespace BPrivate {
|
2020-03-22 05:22:06 +03:00
|
|
|
struct replicant_data;
|
2006-08-11 23:26:37 +04:00
|
|
|
class ShelfContainerViewFilter;
|
|
|
|
};
|
|
|
|
|
2002-10-23 17:54:44 +04:00
|
|
|
|
|
|
|
class BDragger : public BView {
|
2009-08-26 14:45:36 +04:00
|
|
|
public:
|
2012-12-22 06:24:46 +04:00
|
|
|
BDragger(BRect frame, BView* target,
|
2012-12-22 06:22:54 +04:00
|
|
|
uint32 resizingMode = B_FOLLOW_NONE,
|
2009-08-26 14:45:36 +04:00
|
|
|
uint32 flags = B_WILL_DRAW);
|
2014-10-11 13:16:25 +04:00
|
|
|
BDragger(BView* target,
|
|
|
|
uint32 flags = B_WILL_DRAW);
|
2009-08-26 14:45:36 +04:00
|
|
|
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 code, void* data);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
class Private;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool IsVisibilityChanging() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class BPrivate::ShelfContainerViewFilter;
|
2020-03-22 05:22:06 +03:00
|
|
|
friend struct BPrivate::replicant_data;
|
2009-08-26 14:45:36 +04:00
|
|
|
friend class Private;
|
|
|
|
friend class BShelf;
|
|
|
|
|
|
|
|
virtual void _ReservedDragger2();
|
|
|
|
virtual void _ReservedDragger3();
|
|
|
|
virtual void _ReservedDragger4();
|
|
|
|
|
|
|
|
static void _UpdateShowAllDraggers(bool visible);
|
|
|
|
|
|
|
|
BDragger& operator=(const BDragger& other);
|
|
|
|
|
2011-03-17 23:25:44 +03:00
|
|
|
void _InitData();
|
2009-08-26 14:45:36 +04:00
|
|
|
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);
|
|
|
|
|
|
|
|
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 fPopUpIsCustom;
|
|
|
|
BBitmap* fBitmap;
|
|
|
|
BPopUpMenu* fPopUp;
|
|
|
|
uint32 _reserved[3];
|
2002-10-23 17:54:44 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* _DRAGGER_H */
|