Woopsi 1.3
Nintendo DS Gui Framework
libwoopsi/include/label.h
00001 #ifndef _LABEL_H_
00002 #define _LABEL_H_
00003 
00004 #include <nds.h>
00005 #include "gadget.h"
00006 #include "gadgetstyle.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 
00048         Label(s16 x, s16 y, u16 width, u16 height, const WoopsiString& text, GadgetStyle* style = NULL);
00049 
00054         virtual void setTextAlignmentHoriz(TextAlignmentHoriz alignment);
00055         
00060         virtual void setTextAlignmentVert(TextAlignmentVert alignment);
00061         
00066         virtual inline const WoopsiString& getText() const { return _text; };
00067         
00072         virtual void setText(const WoopsiString& text);
00073         
00079         virtual void appendText(const WoopsiString& text);
00080 
00086         virtual void insertText(const WoopsiString& text, const u32 index);
00087 
00094         virtual void getPreferredDimensions(Rect& rect) const;
00095 
00100         virtual void setFont(FontBase* font);
00101 
00106         void setBorderless(bool isBorderless);
00107 
00108     protected:
00109         WoopsiString _text;                     
00110         s32 _textX;                             
00111         s32 _textY;                             
00112         TextAlignmentHoriz _hAlignment;         
00113         TextAlignmentVert _vAlignment;          
00121         virtual void drawContents(GraphicsPort* port);
00122 
00129         virtual void drawBorder(GraphicsPort* port);
00130 
00136         virtual void onResize(u16 width, u16 height);
00137         
00142         virtual void calculateTextPositionVertical();
00143         
00148         virtual void calculateTextPositionHorizontal();
00149 
00153         virtual void onTextChange();
00154 
00159         virtual void markTextRectDamaged();
00160 
00164         virtual inline ~Label() { };
00165 
00169         inline Label(const Label& label) : Gadget(label) { };
00170     };
00171 }
00172 
00173 #endif
 All Classes Functions Variables Enumerations Enumerator