virtual void handleMouseDown( const Evasxx::MouseDownEvent& e ) { cout << "PA::mouseDown" << endl; mouseDown = true; Evasxx::Object* l = new Evasxx::Rectangle( mEvas, Rect (e.data->canvas.x, e.data->canvas.y, 2, 2) ); int b=200+(int) (55.0*rand()/(RAND_MAX+1.0)); l->setColor( Color (b, b, b, 255) ); l->show(); }
virtual void handleMouseMove( const Evasxx::MouseMoveEvent& e ) { cout << "PA::mouseMove" << endl; if ( mouseDown ) { int width = 2 + abs( e.data->cur.canvas.x - e.data->prev.canvas.x ); int height = 2 + abs( e.data->cur.canvas.y - e.data->prev.canvas.y ); cout << "width = " << width << ", height = " << height << endl; Evasxx::Object* l = new Evasxx::Rectangle( mEvas, Rect (e.data->cur.canvas.x - width/2, e.data->cur.canvas.y - height/2, width, height) ); int b=200+(int) (55.0*rand()/(RAND_MAX+1.0)); l->setColor( Color (b, b, b, 255) ); l->show(); } }