Woopsi 1.0
GUI Framework for Nintendo DS Homebrew

scrollbarpanel.h

00001 #ifndef _SCROLLBAR_PANEL_H_
00002 #define _SCROLLBAR_PANEL_H_
00003 
00004 #include "gadget.h"
00005 #include "scrollingpanel.h"
00006 #include "gadgetstyle.h"
00007 #include "scrollbarvertical.h"
00008 #include "scrollbarhorizontal.h"
00009 #include "gadgeteventhandler.h"
00010 #include "scrollablebase.h"
00011 #include "graphicsport.h"
00012 
00013 namespace WoopsiUI {
00014 
00018         class ScrollbarPanel : public Gadget, public ScrollableBase, public GadgetEventHandler {
00019         public:
00020 
00033                 ScrollbarPanel(s16 x, s16 y, u16 width, u16 height, u32 flags, GadgetStyle* style = NULL);
00034 
00040                 virtual void scroll(s32 dx, s32 dy);
00041                 
00047                 virtual void jump(s32 x, s32 y);
00048 
00053                 virtual void setAllowsVerticalScroll(bool allow);
00054 
00059                 virtual void setAllowsHorizontalScroll(bool allow);
00060 
00065                 virtual void setCanvasWidth(const s32 width);
00066                 
00071                 virtual void setCanvasHeight(const s32 height);
00072 
00077                 virtual bool allowsVerticalScroll() const;
00078 
00083                 virtual bool allowsHorizontalScroll() const;
00084 
00089                 virtual const s32 getCanvasX() const;
00090                 
00095                 virtual const s32 getCanvasY() const;
00096 
00101                 virtual const s32 getCanvasWidth() const;
00102                 
00107                 virtual const s32 getCanvasHeight() const;
00108 
00113                 void handleScrollEvent(const GadgetEventArgs& e);
00114 
00119                 void handleValueChangeEvent(const GadgetEventArgs& e);
00120 
00126                 inline ScrollingPanel* getPanel() { return _panel; };
00127 
00128         protected:
00129                 ScrollingPanel* _panel;                                                 
00130                 ScrollbarHorizontal* _scrollbarHorizontal;              
00131                 ScrollbarVertical* _scrollbarVertical;                  
00132                 u8 _scrollbarWidth;                                                             
00133                 u8 _scrollbarHeight;                                                    
00134                 bool _hasVerticalScrollbar;                                             
00135                 bool _hasHorizontalScrollbar;                                   
00140                 void buildUI();
00141 
00148                 virtual void drawContents(GraphicsPort* port);
00149 
00153                 virtual ~ScrollbarPanel() { };
00154 
00158                 inline ScrollbarPanel(const ScrollbarPanel& scrollbarPanel) : Gadget(scrollbarPanel) { };
00159         };
00160 }
00161 
00162 #endif