- Main Page
- Classes
- Files

- File List

# 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
    00041                 ScrollingTextBox(s16 x, s16 y, u16 width, u16 height, const WoopsiString& text, u32 flags, s16 maxRows = 0, GadgetStyle* style = NULL);
    00042
    00047                 virtual void setTextAlignmentHoriz(MultiLineTextBox::TextAlignmentHoriz alignment);
    00048
    00053                 virtual void setTextAlignmentVert(MultiLineTextBox::TextAlignmentVert alignment);
    00054
    00061                 virtual const u16 getPageCount() const;
    00062
    00068                 virtual const u16 getCurrentPage() const;
    00069
    00077                 virtual const Text* getText() const;
    00078
    00083                 virtual void setText(const WoopsiString& text);
    00084
    00090                 virtual void appendText(const WoopsiString& text);
    00091
    00096                 virtual void removeText(const u32 startIndex);
    00097
    00104                 virtual void removeText(const u32 startIndex, const u32 count);
    00105
    00110                 virtual void setFont(FontBase* font);
    00111
    00116                 virtual const u32 getTextLength() const;
    00117
    00121                 virtual void showCursor();
    00122
    00126                 virtual void hideCursor();
    00127
    00134                 virtual void moveCursorToPosition(const s32 position);
    00135
    00141                 virtual const s32 getCursorPosition() const;
    00142
    00148                 virtual void insertText(const WoopsiString& text, const u32 index);
    00149
    00154                 virtual void insertTextAtCursor(const WoopsiString& text);
    00155
    00160                 virtual void handleValueChangeEvent(const GadgetEventArgs& e);
    00161
    00166                 virtual void handleScrollEvent(const GadgetEventArgs& e);
    00167
    00172                 bool opensKeyboard() const { return _textbox->opensKeyboard(); };
    00173
    00177                 void disableKeyboardPopup() { _textbox->disableKeyboardPopup(); };
    00178
    00182                 void enableKeyboardPopup() { _textbox->enableKeyboardPopup(); };
    00183
    00188                 virtual const s32 getCanvasX() const;
    00189
    00194                 virtual const s32 getCanvasY() const;
    00195
    00200                 virtual const s32 getCanvasWidth() const;
    00201
    00206                 virtual const s32 getCanvasHeight() const;
    00207
    00213                 virtual void scroll(s32 dx, s32 dy);
    00214
    00220                 virtual void jump(s32 x, s32 y);
    00221
    00226                 virtual void setAllowsVerticalScroll(bool allow);
    00227
    00232                 virtual void setAllowsHorizontalScroll(bool allow);
    00233
    00238                 virtual void setCanvasWidth(const s32 width);
    00239
    00244                 virtual void setCanvasHeight(const s32 height);
    00245
    00250                 virtual bool allowsVerticalScroll() const;
    00251
    00256                 virtual bool allowsHorizontalScroll() const;
    00257
    00258         protected:
    00259                 MultiLineTextBox* _textbox;
    00260                 ScrollbarVertical* _scrollbar;
    00261                 u8 _scrollbarWidth;
    00269                 virtual void drawContents(GraphicsPort* port);
    00270
    00276                 virtual void onResize(u16 width, u16 height);
    00277
    00281                 virtual inline ~ScrollingTextBox() { };
    00282
    00286                 inline ScrollingTextBox(const ScrollingTextBox& scrollingTextBox) : Gadget(scrollingTextBox) { };
    00287         };
    00288 }
    00289
    00290 #endif