#include <QApplication> 
#include <QWidget>

#include "Chart.h"
#if defined(_UNICODE) || defined(UNICODE)
#	pragma comment(lib,"CChartu.lib")
#else
#	pragma comment(lib,"CChart.lib")
#endif
using namespace NsCChart;

#pragma comment(lib,"user32.lib")

class PaintedWidget : public QWidget 
{ 
public: 
        PaintedWidget(); 
 
protected: 
        void paintEvent(QPaintEvent *event); 
	CChartWnd m_ChartWnd;
};

PaintedWidget::PaintedWidget() 
{ 
        resize(800, 600); 
        setWindowTitle(tr("Paint Demo")); 
	m_ChartWnd.Attach((HWND)this->winId(), kTypeXY);
	m_ChartWnd.GetChart()->AddPoint2D(1, 1);
	m_ChartWnd.GetChart()->AddPoint2D(2, 2);
	//m_ChartWnd.GetChart()->SetBuffered(false);
}

void PaintedWidget::paintEvent(QPaintEvent *event) 
{ 
	//m_ChartWnd.ReDraw();
	HWND hWnd = this->winId();
	RECT rect;
	GetClientRect(hWnd, &rect);
	InvalidateRect(hWnd, &rect, TRUE);
} 


int main(int argc, char *argv[]) 
{ 
        QApplication app(argc, argv); 
        PaintedWidget w; 
        w.show(); 
        return app.exec(); 
} 


