WIP: GUI Toolkit

This commit is contained in:
2015-03-09 01:11:13 +01:00
parent ffbc59140a
commit 9d7dd452c7
24 changed files with 1003 additions and 134 deletions

37
TextWidget.hh Normal file
View File

@@ -0,0 +1,37 @@
#ifndef __OPENGLPLAYGROUND_TEXTWIDGET_HH__
#define __OPENGLPLAYGROUND_TEXTWIDGET_HH__
#include <string>
#include "common.hh"
#include "Widget.hh"
class Font;
class TextWidget final : public Widget {
public:
TextWidget(Font& font, std::string text = "",
int width = WRAP_CONTENT, int height = WRAP_CONTENT);
TextWidget(TextWidget const& copy) = delete;
TextWidget& operator=(TextWidget const& copy) = delete;
~TextWidget();
void setText(std::string text);
std::string const& getText() const { return text_; }
void setForegroundColor(SDL_Color fg) override;
void render(SDL_Surface *dst, SDL_Rect *dstRect) const override;
protected:
void layout() override;
private:
std::string text_;
Font& font_;
SDLSurfaceUPtr textSurf_;
};
#endif