Select Git revision
textwidget.cpp
textwidget.cpp 732 B
#include "textwidget.h"
using namespace std;
using namespace genv;
TextWidget::TextWidget(Palya* _p, int _x, int _y, int _w, int _h, string _content) : Widget(_p, _x, _y, _w, _h), content(_content)
{
kezdo_hossz = (w - gout.twidth(content))/8;
kezdo_mag = (h - (gout.cascent()+gout.cdescent()))/2;
}
void TextWidget::set_text(string vmi) {content = vmi;}
void TextWidget::draw(){
gout << color(0,0,0)<<move_to(x,y)<< box(w,h); //border
gout << color(0,0,0) << move_to(x+1,y+1)<<box(w-2,h-2); //fill
gout << color(255,255,255)<<move_to(x+kezdo_hossz,y+kezdo_mag) << text(content); //text
}
TextWidget::~TextWidget(){}