16e0e4ca6SAxel Dörfler /* 289208c77SStephan Aßmus * Copyright 2006-2009, Haiku, Inc. All rights reserved. 389208c77SStephan Aßmus * Distributed under the terms of the MIT License. 46e0e4ca6SAxel Dörfler */ 5d734a8ceSbeveloper #ifndef _DRAGGER_H 6d734a8ceSbeveloper #define _DRAGGER_H 7d734a8ceSbeveloper 86e0e4ca6SAxel Dörfler 9d734a8ceSbeveloper #include <Locker.h> 10d734a8ceSbeveloper #include <List.h> 11d734a8ceSbeveloper #include <View.h> 12d734a8ceSbeveloper 13d734a8ceSbeveloper class BBitmap; 14d734a8ceSbeveloper class BMessage; 15f6e4cbb9SAxel Dörfler class BPopUpMenu; 16d734a8ceSbeveloper class BShelf; 17d734a8ceSbeveloper 186e0e4ca6SAxel Dörfler namespace BPrivate { 19*81521280SX512 struct replicant_data; 206e0e4ca6SAxel Dörfler class ShelfContainerViewFilter; 216e0e4ca6SAxel Dörfler }; 226e0e4ca6SAxel Dörfler 23d734a8ceSbeveloper 24d734a8ceSbeveloper class BDragger : public BView { 25d734a8ceSbeveloper public: 2678c12508SJohn Scipione BDragger(BRect frame, BView* target, 27aabb1481SJohn Scipione uint32 resizingMode = B_FOLLOW_NONE, 28d734a8ceSbeveloper uint32 flags = B_WILL_DRAW); 294cada380SAdrien Destugues BDragger(BView* target, 304cada380SAdrien Destugues uint32 flags = B_WILL_DRAW); 31d734a8ceSbeveloper BDragger(BMessage* data); 32d734a8ceSbeveloper virtual ~BDragger(); 336e0e4ca6SAxel Dörfler 34d734a8ceSbeveloper static BArchivable* Instantiate(BMessage* data); 35aaa6b122SStephan Aßmus virtual status_t Archive(BMessage* data, 36aaa6b122SStephan Aßmus bool deep = true) const; 37d734a8ceSbeveloper 38d734a8ceSbeveloper virtual void AttachedToWindow(); 39d734a8ceSbeveloper virtual void DetachedFromWindow(); 40d734a8ceSbeveloper 416e0e4ca6SAxel Dörfler virtual void Draw(BRect updateRect); 426e0e4ca6SAxel Dörfler virtual void MouseDown(BPoint where); 436e0e4ca6SAxel Dörfler virtual void MouseUp(BPoint where); 446e0e4ca6SAxel Dörfler virtual void MouseMoved(BPoint where, uint32 transit, 456e0e4ca6SAxel Dörfler const BMessage* dragMessage); 466e0e4ca6SAxel Dörfler virtual void MessageReceived(BMessage* message); 476e0e4ca6SAxel Dörfler virtual void FrameMoved(BPoint newPosition); 486e0e4ca6SAxel Dörfler virtual void FrameResized(float newWidth, float newHeight); 496e0e4ca6SAxel Dörfler 506e0e4ca6SAxel Dörfler static status_t ShowAllDraggers(); 516e0e4ca6SAxel Dörfler static status_t HideAllDraggers(); 52d734a8ceSbeveloper static bool AreDraggersDrawn(); 53d734a8ceSbeveloper 54aaa6b122SStephan Aßmus virtual BHandler* ResolveSpecifier(BMessage* message, 55aaa6b122SStephan Aßmus int32 index, BMessage* specifier, 56aaa6b122SStephan Aßmus int32 form, const char* property); 57d734a8ceSbeveloper virtual status_t GetSupportedSuites(BMessage* data); 58aaa6b122SStephan Aßmus virtual status_t Perform(perform_code code, void* data); 59d734a8ceSbeveloper 60d734a8ceSbeveloper virtual void ResizeToPreferred(); 61aaa6b122SStephan Aßmus virtual void GetPreferredSize(float* _width, 62aaa6b122SStephan Aßmus float* _height); 636e0e4ca6SAxel Dörfler virtual void MakeFocus(bool focus = true); 64d734a8ceSbeveloper virtual void AllAttached(); 65d734a8ceSbeveloper virtual void AllDetached(); 66d734a8ceSbeveloper 676e0e4ca6SAxel Dörfler status_t SetPopUp(BPopUpMenu* contextMenu); 68d734a8ceSbeveloper BPopUpMenu* PopUp() const; 69d734a8ceSbeveloper 70d734a8ceSbeveloper bool InShelf() const; 71d734a8ceSbeveloper BView* Target() const; 72d734a8ceSbeveloper 73d734a8ceSbeveloper virtual BBitmap* DragBitmap(BPoint* offset, drawing_mode* mode); 74d734a8ceSbeveloper 75cf2aeb20SAxel Dörfler class Private; 76cf2aeb20SAxel Dörfler 77d734a8ceSbeveloper protected: 78d734a8ceSbeveloper bool IsVisibilityChanging() const; 79d734a8ceSbeveloper 80d734a8ceSbeveloper private: 816e0e4ca6SAxel Dörfler friend class BPrivate::ShelfContainerViewFilter; 82*81521280SX512 friend struct BPrivate::replicant_data; 83cf2aeb20SAxel Dörfler friend class Private; 84d734a8ceSbeveloper friend class BShelf; 85d734a8ceSbeveloper 86d734a8ceSbeveloper virtual void _ReservedDragger2(); 87d734a8ceSbeveloper virtual void _ReservedDragger3(); 88d734a8ceSbeveloper virtual void _ReservedDragger4(); 89d734a8ceSbeveloper 90cf2aeb20SAxel Dörfler static void _UpdateShowAllDraggers(bool visible); 91cf2aeb20SAxel Dörfler 926e0e4ca6SAxel Dörfler BDragger& operator=(const BDragger& other); 93d734a8ceSbeveloper 944115645aSSiarzhuk Zharski void _InitData(); 956e0e4ca6SAxel Dörfler void _AddToList(); 966e0e4ca6SAxel Dörfler void _RemoveFromList(); 976e0e4ca6SAxel Dörfler status_t _DetermineRelationship(); 986e0e4ca6SAxel Dörfler status_t _SetViewToDrag(BView* target); 996e0e4ca6SAxel Dörfler void _SetShelf(BShelf* shelf); 1006e0e4ca6SAxel Dörfler void _SetZombied(bool state); 1016e0e4ca6SAxel Dörfler void _BuildDefaultPopUp(); 1026e0e4ca6SAxel Dörfler void _ShowPopUp(BView* target, BPoint where); 1036e0e4ca6SAxel Dörfler 104d734a8ceSbeveloper enum relation { 105d734a8ceSbeveloper TARGET_UNKNOWN, 106d734a8ceSbeveloper TARGET_IS_CHILD, 107d734a8ceSbeveloper TARGET_IS_PARENT, 108d734a8ceSbeveloper TARGET_IS_SIBLING 109d734a8ceSbeveloper }; 110d734a8ceSbeveloper 111d734a8ceSbeveloper BView* fTarget; 112d734a8ceSbeveloper relation fRelation; 113d734a8ceSbeveloper BShelf* fShelf; 114d734a8ceSbeveloper bool fTransition; 115d734a8ceSbeveloper bool fIsZombie; 116d734a8ceSbeveloper char fErrCount; 1179cfb11a5SAlexandre Deckner bool fPopUpIsCustom; 118d734a8ceSbeveloper BBitmap* fBitmap; 119d734a8ceSbeveloper BPopUpMenu* fPopUp; 1206e0e4ca6SAxel Dörfler uint32 _reserved[3]; 121d734a8ceSbeveloper }; 122d734a8ceSbeveloper 123d734a8ceSbeveloper #endif /* _DRAGGER_H */ 124