Project

General

Profile

Bug #1188 ยป test2.cpp

Boris Nagaev, 03/16/2012 03:06 PM

 

#include <Wt/WApplication>
#include <Wt/WPointF>
#include <Wt/WRectF>
#include <Wt/WPaintedWidget>
#include <Wt/WContainerWidget>
#include <Wt/WPaintDevice>
#include <Wt/WPainter>

using namespace Wt;

const int RENDERER_WIDTH = 500;
const int RENDERER_HEIGHT = 500;

class EllipsePainted : public WPaintedWidget {
public:
EllipsePainted(WContainerWidget* p = 0) :
WPaintedWidget(p) {
resize(RENDERER_WIDTH, RENDERER_HEIGHT);
}
protected:
void paintEvent(WPaintDevice* device) {
WPainter painter(device);
painter.drawEllipse(WRectF(WPointF(270,30),WPointF(400, 100)));
}
};

class SomePaintedApp : public WApplication {
public:
SomePaintedApp(const WEnvironment& env):
WApplication(env) {
new EllipsePainted(root());
}
};

WApplication* createSomePaintedApp(const WEnvironment& env) {
return new SomePaintedApp(env);
}

int main(int argc, char** argv) {
return WRun(argc, argv, &createSomePaintedApp);
}

    (1-1/1)