00001
00032
00033
00034 #ifndef LL_DRAGHANDLE_H
00035 #define LL_DRAGHANDLE_H
00036
00037 #include "llview.h"
00038 #include "v4color.h"
00039 #include "llrect.h"
00040 #include "llcoord.h"
00041
00042 class LLTextBox;
00043
00044 class LLDragHandle : public LLView
00045 {
00046 public:
00047 LLDragHandle(const LLString& name, const LLRect& rect, const LLString& title );
00048
00049 virtual void setValue(const LLSD& value);
00050
00051 void setForeground(BOOL b) { mForeground = b; }
00052 void setMaxTitleWidth(S32 max_width) {mMaxTitleWidth = llmin(max_width, mMaxTitleWidth); }
00053 void setTitleVisible(BOOL visible);
00054
00055 virtual void setTitle( const LLString& title ) = 0;
00056 virtual const LLString& getTitle() const = 0;
00057 virtual void draw() = 0;
00058 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE) = 0;
00059
00060 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
00061 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
00062 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
00063
00064 protected:
00065 S32 mDragLastScreenX;
00066 S32 mDragLastScreenY;
00067 S32 mLastMouseScreenX;
00068 S32 mLastMouseScreenY;
00069 LLCoordGL mLastMouseDir;
00070 LLColor4 mDragHighlightColor;
00071 LLColor4 mDragShadowColor;
00072 LLTextBox* mTitleBox;
00073 S32 mMaxTitleWidth;
00074 BOOL mForeground;
00075
00076
00077 static S32 sSnapMargin;
00078 };
00079
00080
00081
00082 class LLDragHandleTop
00083 : public LLDragHandle
00084 {
00085 public:
00086 LLDragHandleTop(const LLString& name, const LLRect& rect, const LLString& title );
00087
00088 virtual EWidgetType getWidgetType() const;
00089 virtual LLString getWidgetTag() const;
00090
00091 virtual void setTitle( const LLString& title );
00092 virtual const LLString& getTitle() const;
00093 virtual void draw();
00094 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
00095
00096 private:
00097 void reshapeTitleBox();
00098 };
00099
00100
00101
00102 class LLDragHandleLeft
00103 : public LLDragHandle
00104 {
00105 public:
00106 LLDragHandleLeft(const LLString& name, const LLRect& rect, const LLString& title );
00107
00108 virtual EWidgetType getWidgetType() const;
00109 virtual LLString getWidgetTag() const;
00110
00111 virtual void setTitle( const LLString& title );
00112 virtual const LLString& getTitle() const;
00113 virtual void draw();
00114 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
00115
00116 };
00117
00118 const S32 DRAG_HANDLE_HEIGHT = 16;
00119 const S32 DRAG_HANDLE_WIDTH = 16;
00120
00121 #endif // LL_DRAGHANDLE_H