Beispiel #1
0
void ValuesController::willExitResponderChain(Responder * nextFirstResponder) {
  if (nextFirstResponder == tabController()) {
    selectableTableView()->deselectTable();
    selectableTableView()->scrollToCell(0,0);
    header()->setSelectedButton(-1);
  }
}
void CalculationController::tableViewDidChangeSelection(SelectableTableView * t, int previousSelectedCellX, int previousSelectedCellY) {
  /* To prevent selecting cell with no content (top left corner of the table),
   * as soon as the selected cell is the top left corner, we either reselect
   * the previous cell or select the tab controller depending on from which cell
   * the selection comes. This trick does not create an endless loop as the
   * previous cell cannot be the top left corner cell if it also is the
   * selected one. */
  if (t->selectedRow() == 0 && t->selectedColumn() == 0) {
    if (previousSelectedCellX == 0 && previousSelectedCellY == 1) {
      selectableTableView()->deselectTable();
      app()->setFirstResponder(tabController());
    } else {
      t->selectCellAtLocation(0, 1);
    }
  }
  if (t->selectedColumn() > 0 && t->selectedRow() >= 0 && t->selectedRow() <= k_totalNumberOfDoubleBufferRows) {
    EvenOddDoubleBufferTextCellWithSeparator * myCell = (EvenOddDoubleBufferTextCellWithSeparator *)t->selectedCell();
    bool firstSubCellSelected = true;
    if (previousSelectedCellX > 0 && previousSelectedCellY >= 0 && previousSelectedCellY <= k_totalNumberOfDoubleBufferRows) {
      EvenOddDoubleBufferTextCellWithSeparator * myPreviousCell = (EvenOddDoubleBufferTextCellWithSeparator *)t->cellAtLocation(previousSelectedCellX, previousSelectedCellY);
      firstSubCellSelected = myPreviousCell->firstTextSelected();
    }
    myCell->selectFirstText(firstSubCellSelected);
  }
}
bool CalculationController::handleEvent(Ion::Events::Event event) {
  if (event == Ion::Events::Up) {
    selectableTableView()->deselectTable();
    app()->setFirstResponder(tabController());
    return true;
  }
  return false;
}
void HistogramController::willExitResponderChain(Responder * nextFirstResponder) {
  if (nextFirstResponder == nullptr || nextFirstResponder == tabController()) {
    if (selectedSeriesIndex() >= 0) {
      m_view.dataViewAtIndex(selectedSeriesIndex())->setForceOkDisplay(false);
    }
  }
  MultipleDataViewController::willExitResponderChain(nextFirstResponder);
}
Beispiel #5
0
void TabSwitcherObject::handleEvent(UserEvent event)
{
    if ((event.type == UserEvent::MouseDown) && (event.button == Qt::LeftButton))
    {
        if (embryoRect().contains(event.mousePosition))
        {
            emit tabController()->tabToBeAdded();
        }
        else
        {
            TabDrawMap map = tabDrawMap();
            int index = hitCloseButton(event.mousePosition, map);
            if (index >= 0)
            {
                emit tabController()->tabToBeRemoved(index);
                return;
            }

            QPointF offset;
            index = hitTab(event.mousePosition, map, offset);
            if (index >= 0)
            {
                if (data().currentIndex != index)
                {
                    emit tabController()->tabToBeActivated(index);
                }
                m_clickPoint = event.mousePosition;
                m_clickOffset = offset;
                m_clickTabUid = data().items[index].uid;
                m_isDragging = false;
                return;
            }
        }
    }
    if ((event.type == UserEvent::MouseMove) && (!m_clickTabUid.isNull()))
    {
        if (!m_isDragging)
        {
            m_isDragging = ((event.mousePosition - m_clickPoint).manhattanLength() < QApplication::startDragDistance());
            if (m_isDragging)
            {
                emit tabController()->tabToBeginDragging(m_clickTabUid);
            }
        }
        if (m_isDragging)
        {
            emit tabController()->tabToContinueDragging(m_clickTabUid, supervisor()->positionFromLocalToGlobal(event.mousePosition) - m_clickOffset);
        }
    }
    if (event.type == UserEvent::MouseUp)
    {
        if (m_isDragging)
        {
            emit tabController()->tabToBeDropped(m_clickTabUid, supervisor()->positionFromLocalToGlobal(event.mousePosition) - m_clickOffset);
        }
        m_clickTabUid = QUuid();
        m_isDragging = false;
    }
}
Beispiel #6
0
bool ValuesController::handleEvent(Ion::Events::Event event) {
  if (event == Ion::Events::Down) {
    if (selectedRow() == -1) {
      header()->setSelectedButton(-1);
      selectableTableView()->selectCellAtLocation(0,0);
      app()->setFirstResponder(selectableTableView());
      return true;
    }
    return false;
  }

  if (event == Ion::Events::Up) {
    if (selectedRow() == -1) {
      header()->setSelectedButton(-1);
      app()->setFirstResponder(tabController());
      return true;
    }
    selectableTableView()->deselectTable();
    header()->setSelectedButton(0);
    return true;
  }
  if (event == Ion::Events::Backspace && selectedRow() > 0 &&
      (selectedRow() < numberOfRows()-1 || m_interval->numberOfElements() == Interval::k_maxNumberOfElements)) {
    m_interval->deleteElementAtIndex(selectedRow()-1);
    selectableTableView()->reloadData();
    return true;
  }
  if (event == Ion::Events::OK || event == Ion::Events::EXE) {
    if (selectedRow() == -1) {
      return header()->handleEvent(event);
    }
    if (selectedRow() == 0) {
      if (selectedColumn() == 0) {
        configureAbscissa();
        return true;
      }
      configureFunction();
      return true;
    }
    return false;
  }
  if (selectedRow() == -1) {
    return header()->handleEvent(event);
  }
  return false;
}
Beispiel #7
0
Responder * ValuesController::defaultController() {
  return tabController();
}
Responder * CalculationController::defaultController() {
  return tabController();
}
Beispiel #9
0
void TabTableController::willExitResponderChain(Responder * nextFirstResponder) {
  if (nextFirstResponder == tabController()) {
    selectableTableView()->deselectTable();
    selectableTableView()->scrollToCell(0,0);
  }
}