|
#include <tests/interfaces/wt/tests/paint_test_widget.h>
|
|
|
|
#include <Wt/WPainter>
|
|
#include <Wt/WPaintDevice>
|
|
|
|
|
|
paint_test_widget::paint_test_widget(WContainerWidget *parent__ )
|
|
: WPaintedWidget(parent__)
|
|
{
|
|
max_heigth_ = 500;
|
|
max_width_ = 500;
|
|
|
|
this->setHeight(max_heigth_);
|
|
this->setWidth(max_width_);
|
|
this->setMinimumSize(WLength::Auto, WLength::Auto); // HAS TO BE SET!!!!
|
|
this->setMaximumSize(WLength::Auto, WLength::Auto);
|
|
|
|
this->setHeight(100); // removeme
|
|
this->setStyleClass("paint_test_widget");
|
|
printf("test_constructor\n");
|
|
}
|
|
|
|
void paint_test_widget::paintEvent(WPaintDevice *paintDevice__) {
|
|
WPainter painter__(paintDevice__);
|
|
painter__.setBrush(WColor(145,172,188));
|
|
painter__.setPen(WColor(145,172,188));
|
|
max_width_ = paintDevice__->width().toPixels();
|
|
max_heigth_ = (1.0 / (double)max_width_) * 500000;
|
|
printf("height: %i width: %i\n", max_heigth_, max_width_);
|
|
container->setHeight(max_heigth_);
|
|
painter__.drawRect(0, 0, max_width_, max_heigth_);
|
|
}
|
|
|
|
|
|
void paint_test_widget::set_container_widget(WContainerWidget *container__)
|
|
{
|
|
container=container__;
|
|
}
|