el h / SimpleGUI

Fork of SimpleGUI by Duncan McIntyre

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers TextWidget.h Source File

TextWidget.h

00001 #ifndef SIMPLEGUI_TEXT_WIDGET_H
00002 #define SIMPLEGUI_TEXT_WIDGET_H
00003 
00004 #include "Widget.h"
00005 #include "Font.h"
00006 #include "FontRenderer.h"
00007 
00008 class TextWidget : public Widget
00009 {
00010 
00011 public:
00012 
00013     enum VAlign { TOP, MIDDLE, BOTTOM };
00014     enum HAlign { LEFT, CENTRE, RIGHT };
00015 
00016     TextWidget(GraphicsContext *context);
00017     TextWidget(GraphicsContext *context, FontRenderer* renderer);
00018     TextWidget(GraphicsContext *context, FontRenderer* renderer, Font* font);
00019 
00020     /**************************
00021     * Custom methods of this class
00022     **************************/
00023     virtual void setFont(Font* font);
00024     virtual void setText(char* text);
00025     virtual void setHAlign(HAlign alignment);
00026     virtual void setVAlign(VAlign alignment);
00027     
00028     virtual Font *getFont();
00029 
00030 protected:
00031 
00032     /**************************
00033     * Overrides of Widget
00034     **************************/
00035     virtual void _draw();
00036 
00037     /**************************
00038     * Custom data of this class
00039     **************************/
00040     char* _text;
00041     FontRenderer* _renderer;
00042     Font* _font;
00043     HAlign _halign;
00044     VAlign _valign;
00045 };
00046 
00047 #endif