Ejemplo n.º 1
0
// Takes care of the SVET_CLICK events.
// Depending on the click_mode_ we are in, either do Point-to-Point drawing,
// point drawing, or draw text.
void SVPaint::ClickHandler(const SVEvent* sv_event) {
  switch (click_mode_) {
  case 1: //Point to Point
    if (has_start_point_) { window_->DrawTo(sv_event->x, sv_event->y);
    } else {
        has_start_point_ = true; 
        window_->SetCursor(sv_event->x, sv_event->y);
    }
    break;
  case 2: //Point Drawing..simulated by drawing a 1 pixel line.
    window_->Line(sv_event->x, sv_event->y, sv_event->x, sv_event->y);
    break;
  case 3: //Text
    // We show a modal input dialog on our window, then draw the input and
    // finally delete the input pointer.
    char* p = window_->ShowInputDialog("Text:");
    window_->Text(sv_event->x, sv_event->y, p);
    delete p;
    break;
  }
}