- Main Page
- Classes
- Files

- File List

# C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/multilinetextbox.h

    00001 #ifndef _MULTILINE_TEXTBOX_H_
    00002 #define _MULTILINE_TEXTBOX_H_
    00003
    00004 #include <nds.h>
    00005 #include "scrollingpanel.h"
    00006
    00007 namespace WoopsiUI {
    00008
    00009         class Text;
    00010
    00018         class MultiLineTextBox : public ScrollingPanel {
    00019         public:
    00020
    00024                 enum TextAlignmentHoriz {
    00025                         TEXT_ALIGNMENT_HORIZ_CENTRE = 0,
    00026                         TEXT_ALIGNMENT_HORIZ_LEFT = 1,
    00027                         TEXT_ALIGNMENT_HORIZ_RIGHT = 2
    00028                 };
    00029
    00033                 enum TextAlignmentVert {
    00034                         TEXT_ALIGNMENT_VERT_CENTRE = 0,
    00035                         TEXT_ALIGNMENT_VERT_TOP = 1,
    00036                         TEXT_ALIGNMENT_VERT_BOTTOM = 2
    00037                 };
    00038
    00054                 MultiLineTextBox(s16 x, s16 y, u16 width, u16 height, const char* text, u32 flags, s16 maxRows = 0, FontBase* font = NULL);
    00055
    00061                 virtual void draw(Rect clipRect);
    00062
    00067                 virtual void setTextAlignmentHoriz(TextAlignmentHoriz alignment);
    00068
    00073                 virtual void setTextAlignmentVert(TextAlignmentVert alignment);
    00074
    00081                 virtual const u16 getPageCount() const;
    00082
    00088                 virtual const u16 getCurrentPage() const;
    00089
    00097                 virtual const Text* getText() const;
    00098
    00103                 virtual void setText(const char* text);
    00104
    00109                 virtual void setText(const char text);
    00110
    00116                 virtual void appendText(const char* text);
    00117
    00122                 virtual void appendText(const char text);
    00123
    00128                 virtual void removeText(const u32 startIndex);
    00129
    00136                 virtual void removeText(const u32 startIndex, const u32 count);
    00137
    00142                 virtual void setFont(FontBase* font);
    00143
    00150                 virtual bool resize(u16 width, u16 height);
    00151
    00156                 virtual const u32 getTextLength() const;
    00157
    00161                 virtual void showCursor();
    00162
    00166                 virtual void hideCursor();
    00167
    00174                 virtual void moveCursorToPosition(const s32 position);
    00175
    00181                 virtual inline const s32 getCursorPosition() const { return _cursorPos; };
    00182
    00188                 virtual void insertText(const char* text, const u32 index);
    00189
    00195                 virtual void insertText(const char text, const u32 index);
    00196
    00201                 virtual void insertTextAtCursor(const char* text);
    00202
    00207                 virtual void insertTextAtCursor(const char text);
    00208
    00215                 virtual bool click(s16 x, s16 y);
    00216
    00222                 virtual bool keyPress(KeyCode keyCode);
    00223
    00224         protected:
    00225                 Text* _text;
    00226                 u8 _visibleRows;
    00227                 s16 _maxRows;
    00228                 u32 _topRow;
    00229                 u8 _padding;
    00230                 TextAlignmentHoriz _hAlignment;
    00231                 TextAlignmentVert _vAlignment;
    00232                 s32 _cursorPos;
    00233                 bool _showCursor;
    00241                 u8 getRowX(s32 row);
    00242
    00249                 s16 getRowY(s32 row);
    00250
    00254                 void calculateVisibleRows();
    00255
    00260                 void drawTextTop(Rect clipRect);
    00261
    00268                 void drawText(Rect clipRect, s32 topRow, s32 bottomRow);
    00269
    00274                 void drawCursor(Rect clipRect);
    00275
    00279                 virtual ~MultiLineTextBox();
    00280
    00284                 inline MultiLineTextBox(const MultiLineTextBox& multiLineTextBox) : ScrollingPanel(multiLineTextBox) { };
    00285         };
    00286 }
    00287
    00288 #endif

All Classes Functions Variables Enumerations Enumerator