Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- File List

# 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
    00032                 ScrollingPanel(s16 x, s16 y, u16 width, u16 height, u32 flags, GadgetStyle* style = NULL);
    00033
    00039                 virtual void scroll(s32 dx, s32 dy);
    00040
    00046                 virtual void jump(s32 x, s32 y);
    00047
    00052                 inline bool allowsVerticalScroll() const { return _allowVerticalScroll; };
    00053
    00058                 inline bool allowsHorizontalScroll() const { return _allowHorizontalScroll; };
    00059
    00064                 virtual inline const s32 getCanvasX() const { return _canvasX; };
    00065
    00070                 virtual inline const s32 getCanvasY() const { return _canvasY; };
    00071
    00076                 virtual inline const s32 getCanvasWidth() const { return _canvasWidth; };
    00077
    00082                 virtual inline const s32 getCanvasHeight() const { return _canvasHeight; };
    00083
    00088                 inline void setAllowsVerticalScroll(bool allow) { _allowVerticalScroll = allow; };
    00089
    00094                 inline void setAllowsHorizontalScroll(bool allow) { _allowHorizontalScroll = allow; };
    00095
    00105                 inline void setContentScrolled(bool scrolled) { _isContentScrolled = scrolled; };
    00106
    00112                 inline bool IsContentScrolled() { return _isContentScrolled; };
    00113
    00118                 virtual inline void setCanvasWidth(const s32 width) { _canvasWidth = width; };
    00119
    00124                 virtual inline void setCanvasHeight(const s32 height) { _canvasHeight = height; };
    00125
    00126         protected:
    00127                 s32 _canvasX;
    00128                 s32 _canvasY;
    00129                 s32 _canvasWidth;
    00130                 s32 _canvasHeight;
    00131                 bool _allowVerticalScroll;
    00132                 bool _allowHorizontalScroll;
    00133                 bool _isContentScrolled;
    00143                 virtual void drawContents(GraphicsPort* port);
    00144
    00151                 virtual void drawBorder(GraphicsPort* port);
    00152
    00160                 virtual void onDrag(s16 x, s16 y, s16 vX, s16 vY);
    00161
    00167                 virtual void onClick(s16 x, s16 y);
    00168
    00175                 void scrollChildren(s32 dx, s32 dy);
    00176
    00181                 void drawChildren(Rect clipRect);
    00182
    00186                 virtual ~ScrollingPanel() { };
    00187
    00191                 inline ScrollingPanel(const ScrollingPanel& scrollingPanel) : Gadget(scrollingPanel) { };
    00192         };
    00193 }
    00194
    00195 #endif