- Main Page
- Classes
- Files

- File List

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

    00001 #ifndef _LABEL_H_
    00002 #define _LABEL_H_
    00003
    00004 #include <nds.h>
    00005 #include "textwriter.h"
    00006 #include "gadget.h"
    00007 #include "woopsistring.h"
    00008
    00009 namespace WoopsiUI {
    00010
    00015         class Label : public Gadget {
    00016         public:
    00017
    00021                 enum TextAlignmentHoriz {
    00022                         TEXT_ALIGNMENT_HORIZ_CENTRE = 0,
    00023                         TEXT_ALIGNMENT_HORIZ_LEFT = 1,
    00024                         TEXT_ALIGNMENT_HORIZ_RIGHT = 2
    00025                 };
    00026
    00030                 enum TextAlignmentVert {
    00031                         TEXT_ALIGNMENT_VERT_CENTRE = 0,
    00032                         TEXT_ALIGNMENT_VERT_TOP = 1,
    00033                         TEXT_ALIGNMENT_VERT_BOTTOM = 2
    00034                 };
    00035
    00045                 Label(s16 x, s16 y, u16 width, u16 height, const char* text, FontBase* font = NULL);
    00046
    00056                 Label(s16 x, s16 y, u16 width, u16 height, const char letter, FontBase* font = NULL);
    00057
    00063                 virtual void draw(Rect clipRect);
    00064
    00069                 virtual void setTextAlignmentHoriz(TextAlignmentHoriz alignment);
    00070
    00075                 virtual void setTextAlignmentVert(TextAlignmentVert alignment);
    00076
    00081                 virtual inline const char* getText() const { return _text->getCharArray(); };
    00082
    00087                 virtual void setText(const char* text);
    00088
    00093                 virtual void setText(const char text);
    00094
    00099                 virtual void appendText(const char* text);
    00100
    00105                 virtual void appendText(const char text);
    00106
    00112                 virtual void insertText(const char* text, const u32 index);
    00113
    00119                 virtual void insertText(const char text, const u32 index);
    00120
    00127                 virtual bool resize(u16 width, u16 height);
    00128
    00135                 virtual void getPreferredDimensions(Rect& rect) const;
    00136
    00137         protected:
    00138                 WoopsiString* _text;
    00139                 u16 _textX;
    00140                 u16 _textY;
    00141                 u8 _padding;
    00142                 TextAlignmentHoriz _hAlignment;
    00143                 TextAlignmentVert _vAlignment;
    00148                 virtual void calculateTextPosition();
    00149
    00153                 virtual inline ~Label() {
    00154                         delete _text;
    00155                         _text = NULL;
    00156                 };
    00157
    00161                 inline Label(const Label& label) : Gadget(label) { };
    00162         };
    00163 }
    00164
    00165 #endif

All Classes Functions Variables Enumerations Enumerator