00001
00032 #ifndef LL_LLSCROLLCONTAINER_H
00033 #define LL_LLSCROLLCONTAINER_H
00034
00035 #include "lluictrl.h"
00036 #ifndef LL_V4COLOR_H
00037 #include "v4color.h"
00038 #endif
00039 #include "stdenums.h"
00040 #include "llcoord.h"
00041 #include "llscrollbar.h"
00042
00043
00044 class LLViewBorder;
00045 class LLUICtrlFactory;
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 class LLScrollableContainerView : public LLUICtrl
00056 {
00057 public:
00058
00059
00060 enum SCROLL_ORIENTATION { VERTICAL, HORIZONTAL, SCROLLBAR_COUNT };
00061
00062 LLScrollableContainerView( const LLString& name, const LLRect& rect,
00063 LLView* scrolled_view, BOOL is_opaque = FALSE,
00064 const LLColor4& bg_color = LLColor4(0,0,0,0) );
00065 LLScrollableContainerView( const LLString& name, const LLRect& rect,
00066 LLUICtrl* scrolled_ctrl, BOOL is_opaque = FALSE,
00067 const LLColor4& bg_color = LLColor4(0,0,0,0) );
00068 virtual ~LLScrollableContainerView( void );
00069
00070 void setScrolledView(LLView* view) { mScrolledView = view; }
00071
00072 virtual void setValue(const LLSD& value) { mInnerRect.setValue(value); }
00073
00074 void calcVisibleSize( S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
00075 void calcVisibleSize( const LLRect& doc_rect, S32 *visible_width, S32 *visible_height, BOOL* show_h_scrollbar, BOOL* show_v_scrollbar ) const;
00076 void setBorderVisible( BOOL b );
00077
00078 void scrollToShowRect( const LLRect& rect, const LLCoordGL& desired_offset );
00079 void setReserveScrollCorner( BOOL b ) { mReserveScrollCorner = b; }
00080 const LLRect& getScrolledViewRect() const { return mScrolledView->getRect(); }
00081 void pageUp(S32 overlap = 0);
00082 void pageDown(S32 overlap = 0);
00083 void goToTop();
00084 void goToBottom();
00085 S32 getBorderWidth() const;
00086
00087 BOOL needsToScroll(S32 x, S32 y, SCROLL_ORIENTATION axis) const;
00088
00089
00090 virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
00091 virtual BOOL handleKeyHere(KEY key, MASK mask);
00092 virtual BOOL handleScrollWheel( S32 x, S32 y, S32 clicks );
00093 virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
00094 EDragAndDropType cargo_type,
00095 void* cargo_data,
00096 EAcceptance* accept,
00097 LLString& tooltip_msg);
00098
00099 virtual BOOL handleToolTip(S32 x, S32 y, LLString& msg, LLRect* sticky_rect);
00100 virtual void draw();
00101
00102 virtual LLXMLNodePtr getXML(bool save_children = true) const;
00103 static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory);
00104
00105 private:
00106 void init();
00107
00108
00109 virtual void scrollHorizontal( S32 new_pos );
00110 virtual void scrollVertical( S32 new_pos );
00111 void updateScroll();
00112
00113 LLScrollbar* mScrollbar[SCROLLBAR_COUNT];
00114 LLView* mScrolledView;
00115 S32 mSize;
00116 BOOL mIsOpaque;
00117 LLColor4 mBackgroundColor;
00118 LLRect mInnerRect;
00119 LLViewBorder* mBorder;
00120 BOOL mReserveScrollCorner;
00121 BOOL mAutoScrolling;
00122 F32 mAutoScrollRate;
00123 };
00124
00125
00126 #endif // LL_LLSCROLLCONTAINER_H