1 /******************************************************************************* 2 / 3 / File: Dragger.h 4 / 5 / Description: BDragger represents a replicant "handle." 6 / 7 / Copyright 1997-98, Be Incorporated, All Rights Reserved 8 / 9 *******************************************************************************/ 10 11 #ifndef _DRAGGER_H 12 #define _DRAGGER_H 13 14 #include <BeBuild.h> 15 #include <Locker.h> 16 #include <List.h> 17 #include <View.h> 18 19 class BBitmap; 20 class BMessage; 21 class BShelf; 22 23 /*----------------------------------------------------------------*/ 24 /*----- BDragger class -------------------------------------------*/ 25 26 class BDragger : public BView { 27 public: 28 BDragger(BRect bounds, 29 BView *target, 30 uint32 rmask = B_FOLLOW_NONE, 31 uint32 flags = B_WILL_DRAW); 32 BDragger(BMessage *data); 33 34 virtual ~BDragger(); 35 static BArchivable *Instantiate(BMessage *data); 36 virtual status_t Archive(BMessage *data, bool deep = true) const; 37 38 virtual void AttachedToWindow(); 39 virtual void DetachedFromWindow(); 40 virtual void Draw(BRect update); 41 virtual void MouseDown(BPoint where); 42 virtual void MouseUp(BPoint pt); 43 virtual void MouseMoved(BPoint pt, uint32 code, const BMessage *msg); 44 virtual void MessageReceived(BMessage *msg); 45 virtual void FrameMoved(BPoint new_position); 46 virtual void FrameResized(float new_width, float new_height); 47 48 static status_t ShowAllDraggers(); /* system wide!*/ 49 static status_t HideAllDraggers(); /* system wide!*/ 50 static bool AreDraggersDrawn(); 51 52 virtual BHandler *ResolveSpecifier(BMessage *msg, 53 int32 index, 54 BMessage *specifier, 55 int32 form, 56 const char *property); 57 virtual status_t GetSupportedSuites(BMessage *data); 58 virtual status_t Perform(perform_code d, void *arg); 59 60 virtual void ResizeToPreferred(); 61 virtual void GetPreferredSize(float *width, float *height); 62 virtual void MakeFocus(bool state = true); 63 virtual void AllAttached(); 64 virtual void AllDetached(); 65 66 status_t SetPopUp(BPopUpMenu *context_menu); 67 BPopUpMenu *PopUp() const; 68 69 bool InShelf() const; 70 BView *Target() const; 71 72 virtual BBitmap *DragBitmap(BPoint *offset, drawing_mode *mode); 73 74 protected: 75 bool IsVisibilityChanging() const; 76 77 /*----- Private or reserved -----------------------------------------*/ 78 private: 79 80 friend class _TContainerViewFilter_; 81 friend class _rep_data_; 82 friend class BShelf; 83 friend void _toggle_handles_(bool); 84 85 //+virtual void _ReservedDragger1(); 86 virtual void _ReservedDragger2(); 87 virtual void _ReservedDragger3(); 88 virtual void _ReservedDragger4(); 89 90 BDragger &operator=(const BDragger &); 91 92 void ListManage(bool); 93 status_t determine_relationship(); 94 status_t SetViewToDrag(BView *target); 95 void SetShelf(BShelf *); 96 void SetZombied(bool state); 97 void BuildDefaultPopUp(); 98 void ShowPopUp(BView *target, BPoint where); 99 static bool sVisible; 100 static bool sInited; 101 static BLocker sLock; 102 static BList sList; 103 104 enum relation { 105 TARGET_UNKNOWN, 106 TARGET_IS_CHILD, 107 TARGET_IS_PARENT, 108 TARGET_IS_SIBLING 109 }; 110 111 BView *fTarget; 112 relation fRelation; 113 BShelf *fShelf; 114 bool fTransition; 115 bool fIsZombie; 116 char fErrCount; 117 bool _unused2; 118 BBitmap *fBitmap; 119 BPopUpMenu *fPopUp; 120 uint32 _reserved[3]; /* was 4 */ 121 }; 122 123 /*-------------------------------------------------------------*/ 124 /*-------------------------------------------------------------*/ 125 126 #endif /* _DRAGGER_H */ 127