void PaintBrush::mouseDown(const WMouseEvent& e)
{
    Coordinates c = e.widget();
    if (interactionCount_ % 2 == 0) {
        path_ = WPainterPath(WPointF(c.x, c.y));
        Vertex v;
        v.id = interactionCount_;
        v.x = c.x;
        v.y = c.y;
        vertexList_.push_back(v);
        interactionCount_++;
        path_.addRect(c.x, c.y, 1, 1);
        update(PaintUpdate);
    } else {
        path_.lineTo(c.x, c.y);
        Vertex v;
        v.id = interactionCount_;
        v.x = c.x;
        v.y = c.y;
        vertexList_.push_back(v);
        Edge e;
        e.v1 = v.id - 1;
        e.v2 = v.id;
        e.speed = currentSpeed_;
        edgeList_.push_back(e);
        interactionCount_++;
        path_.addRect(c.x, c.y, 1, 1);
        actions_.push_back(path_);
        update(PaintUpdate);
    }
}
Example #2
0
void PaintBrush::mouseDrag(const WMouseEvent& e)
{
  Coordinates c = e.widget();
  path_.lineTo(c.x, c.y);

  update(PaintUpdate);
}
Example #3
0
void PaintedSlider::onSliderClick(const WMouseEvent& event)
{
  int x = event.widget().x;
  int y = event.widget().y;

  if (WApplication::instance()->layoutDirection() == RightToLeft)
    x = (int)(w() - x);

  onSliderReleased(slider_->orientation() == Horizontal ? x : y);
}
Example #4
0
void PaintBrush::mouseDown(const WMouseEvent& e)
{
  Coordinates c = e.widget();
  path_ = WPainterPath(WPointF(c.x, c.y));
}
Example #5
0
void emit_clicked(MapImage::ClickSignal* signal, WMouseEvent& event) {
    signal->emit(event.widget());
}
Example #6
0
bool ShapesWidget::correctlyClicked(const WMouseEvent& me)
{
  return toSelect_->contains(WPointF(me.widget().x, me.widget().y));
}