Woopsi 1.3
Nintendo DS Gui Framework
libwoopsi/include/scrollingtextbox.h
00001 #ifndef _SCROLLING_TEXTBOX_H_
00002 #define _SCROLLING_TEXTBOX_H_
00003 
00004 #include <nds.h>
00005 #include "multilinetextbox.h"
00006 #include "gadgeteventhandler.h"
00007 #include "gadgetstyle.h"
00008 #include "woopsistring.h"
00009 #include "scrollablebase.h"
00010 
00011 namespace WoopsiUI {
00012 
00013     class ScrollbarVertical;
00014 
00020     class ScrollingTextBox : public TextBoxBase, public Gadget, public ScrollableBase, public GadgetEventHandler {
00021     public:
00022 
00040         ScrollingTextBox(s16 x, s16 y, u16 width, u16 height, const WoopsiString& text, s16 maxRows = 0, GadgetStyle* style = NULL);
00041 
00046         virtual void setTextAlignmentHoriz(MultiLineTextBox::TextAlignmentHoriz alignment);
00047 
00052         virtual void setTextAlignmentVert(MultiLineTextBox::TextAlignmentVert alignment);
00053 
00060         virtual const u16 getPageCount() const;
00061 
00067         virtual const u16 getCurrentPage() const;
00068 
00076         virtual const Document* getDocument() const;
00077 
00082         virtual void setText(const WoopsiString& text);
00083 
00089         virtual void appendText(const WoopsiString& text);
00090         
00095         virtual void removeText(const u32 startIndex);
00096 
00103         virtual void removeText(const u32 startIndex, const u32 count);
00104 
00109         virtual void setFont(FontBase* font);
00110 
00115         virtual const u32 getTextLength() const;
00116 
00120         virtual void showCursor();
00121 
00125         virtual void hideCursor();
00126         
00133         virtual void moveCursorToPosition(const s32 position);
00134 
00140         virtual const s32 getCursorPosition() const;
00141 
00147         virtual void insertText(const WoopsiString& text, const u32 index);
00148         
00153         virtual void insertTextAtCursor(const WoopsiString& text);
00154 
00159         virtual void handleValueChangeEvent(const GadgetEventArgs& e);
00160 
00165         virtual void handleScrollEvent(const GadgetEventArgs& e);
00166 
00171         bool opensKeyboard() const { return _textbox->opensKeyboard(); };
00172 
00176         void disableKeyboardPopup() { _textbox->disableKeyboardPopup(); };
00177 
00181         void enableKeyboardPopup() { _textbox->enableKeyboardPopup(); };
00182 
00187         virtual const s32 getCanvasX() const;
00188         
00193         virtual const s32 getCanvasY() const;
00194 
00199         virtual const s32 getCanvasWidth() const;
00200         
00205         virtual const s32 getCanvasHeight() const;
00206 
00212         virtual void scroll(s32 dx, s32 dy);
00213         
00219         virtual void jump(s32 x, s32 y);
00220 
00225         virtual void setAllowsVerticalScroll(bool allow);
00226 
00231         virtual void setAllowsHorizontalScroll(bool allow);
00232 
00237         virtual void setCanvasWidth(const s32 width);
00238         
00243         virtual void setCanvasHeight(const s32 height);
00244 
00249         virtual bool allowsVerticalScroll() const;
00250 
00255         virtual bool allowsHorizontalScroll() const;
00256 
00257     protected:
00258         MultiLineTextBox* _textbox;                     
00259         ScrollbarVertical* _scrollbar;                  
00260         u8 _scrollbarWidth;                             
00265         void updateScrollbar();
00266 
00273         virtual void drawContents(GraphicsPort* port);
00274 
00280         virtual void onResize(u16 width, u16 height);
00281         
00285         virtual inline ~ScrollingTextBox() { };
00286 
00290         inline ScrollingTextBox(const ScrollingTextBox& scrollingTextBox) : Gadget(scrollingTextBox) { };
00291     };
00292 }
00293 
00294 #endif
 All Classes Functions Variables Enumerations Enumerator