Woopsi 1.3
Nintendo DS Gui Framework
libwoopsi/include/scrollingpanel.h
00001 #ifndef _SCROLLING_PANEL_H_
00002 #define _SCROLLING_PANEL_H_
00003 
00004 #include <cstdlib>
00005 #include <nds.h>
00006 #include "gadget.h"
00007 #include "scrollablebase.h"
00008 #include "gadgetstyle.h"
00009 
00010 namespace WoopsiUI {
00011 
00017     class ScrollingPanel : public Gadget, public ScrollableBase {
00018     public:
00019 
00031         ScrollingPanel(s16 x, s16 y, u16 width, u16 height, GadgetStyle* style = NULL);
00032 
00038         virtual void scroll(s32 dx, s32 dy);
00039         
00045         virtual void jump(s32 x, s32 y);
00046 
00051         inline bool allowsVerticalScroll() const { return _allowVerticalScroll; };
00052 
00057         inline bool allowsHorizontalScroll() const { return _allowHorizontalScroll; };
00058 
00063         virtual inline const s32 getCanvasX() const { return _canvasX; };
00064         
00069         virtual inline const s32 getCanvasY() const { return _canvasY; };
00070 
00075         virtual inline const s32 getCanvasWidth() const { return _canvasWidth; };
00076         
00081         virtual inline const s32 getCanvasHeight() const { return _canvasHeight; };
00082 
00087         inline void setAllowsVerticalScroll(bool allow) { _allowVerticalScroll = allow; };
00088 
00093         inline void setAllowsHorizontalScroll(bool allow) { _allowHorizontalScroll = allow; };
00094 
00104         inline void setContentScrolled(bool scrolled) { _isContentScrolled = scrolled; };
00105 
00111         inline bool IsContentScrolled() { return _isContentScrolled; };
00112 
00117         virtual inline void setCanvasWidth(const s32 width) { _canvasWidth = width; };
00118         
00123         virtual inline void setCanvasHeight(const s32 height) { _canvasHeight = height; };
00124 
00125     protected:
00126         s32 _canvasX;                       
00127         s32 _canvasY;                       
00128         s32 _canvasWidth;                   
00129         s32 _canvasHeight;                  
00130         bool _allowVerticalScroll;          
00131         bool _allowHorizontalScroll;        
00132         bool _isContentScrolled;            
00142         virtual void drawContents(GraphicsPort* port);
00143 
00150         virtual void drawBorder(GraphicsPort* port);
00151 
00159         virtual void onDrag(s16 x, s16 y, s16 vX, s16 vY);
00160         
00166         virtual void onClick(s16 x, s16 y);
00167 
00174         void scrollChildren(s32 dx, s32 dy);
00175         
00180         void drawChildren(Rect clipRect);
00181 
00185         virtual ~ScrollingPanel() { };
00186 
00190         inline ScrollingPanel(const ScrollingPanel& scrollingPanel) : Gadget(scrollingPanel) { };
00191     };
00192 }
00193 
00194 #endif
 All Classes Functions Variables Enumerations Enumerator