#include "PopupWidget.h"

void PopupWidget::setText( const char* t ){
    strcpy(_text, t );
	_needsMeasure = true;
	_dirty = true;
}

void PopupWidget::draw() {
    
		if( !_dsp ) return;

    _dsp->setClipping(_x, _y, _w, _h);

		if( _r ){
			_dsp->fillRoundRect(_x, _y, _w, _h, _r, _bgcl );
			_dsp->drawRoundRect( _x, _y, _w, _h, _r, _brcl );
		}else{
			_dsp->fillRect(_x, _y, _w, _h, _bgcl );
			_dsp->drawRect( _x, _y, _w, _h, _brcl );
		}

	applyFont();
    _dsp->setCursor(
        _x + (_w - tw) / 2,
        _y + (_h - th) / 2 - y1
    );
    _dsp->setTextColor( _fgcl );
    _dsp->print(_text);
    _dsp->clearClipping();
}
