bool GTUtilsMSAEditorSequenceArea::isSequenceHightighted(HI::GUITestOpStatus &os, const QString &seqName){
    QStringList names = getVisibleNames(os);
    GT_CHECK_RESULT(names.contains(seqName), QString("sequence with name %1 not found").arg(seqName), false);

    int row = 0;
    while (names[row] != seqName) {
        row++;
    }
    QPoint center = convertCoordinates(os, QPoint(-5, row));
    QWidget* nameList = GTWidget::findWidget(os, "msa_editor_name_list");
    GT_CHECK_RESULT(nameList !=NULL, "name list is NULL", false);

    int initCoord = center.y() - getRowHeight(os)/2;
    int finalCoord = center.y() + getRowHeight(os)/2;

    for (int i = initCoord; i<finalCoord; i++){
        QPoint local = nameList->mapFromGlobal(QPoint(center.x(), i));
        QColor c = GTWidget::getColor(os, nameList,local);
        QString name = c.name();
        if(name == highlightningColorName){
            return true;
        }
    }

    return false;
}
Exemple #2
0
void ListBox::setSelected(const int selected)
{
    if (!mListModel)
    {
        mSelected = -1;
    }
    else
    {
        if (selected < 0)
            mSelected = -1;
        else if (selected >= mListModel->getNumberOfElements())
            mSelected = mListModel->getNumberOfElements() - 1;
        else
            mSelected = selected;
    }

    Rect scroll;

    if (mSelected < 0)
        scroll.y = 0;
    else
        scroll.y = getRowHeight() * mSelected;

    scroll.height = getRowHeight();
    showPart(scroll);

    distributeValueChangedEvent();
}
    int getBestHeight (const int preferredHeight)
    {
        const int extra = getOutlineThickness() * 2;

        return jmax (getRowHeight() * 2 + extra,
                     jmin (getRowHeight() * getNumRows() + extra,
                           preferredHeight));
    }
Exemple #4
0
void ListBox::mouseDragged(MouseEvent &event)
{
    if (event.getButton() != MouseButton::LEFT || getRowHeight() == 0)
        return;

    // Make list selection update on drag, but guard against negative y
    if (getRowHeight())
        setSelected(std::max(0, getSelectionByMouse(event.getY())));
}
Exemple #5
0
int GuiTable::getRowForY(int y) const
{
   int row = -1;

   if (getRowHeight() > 0)
       row = y / getRowHeight();

   if (row < 0 || row >= mModel->getRows())
       return -1;
   else
       return row;
}
Exemple #6
0
void ListBox::selectRowInternal (const int row,
                                 bool dontScroll,
                                 bool deselectOthersFirst,
                                 bool isMouseClick)
{
    if (! multipleSelection)
        deselectOthersFirst = true;

    if ((! isRowSelected (row))
         || (deselectOthersFirst && getNumSelectedRows() > 1))
    {
        if (isPositiveAndBelow (row, totalItems))
        {
            if (deselectOthersFirst)
                selected.clear();

            selected.addRange (Range<int> (row, row + 1));

            if (getHeight() == 0 || getWidth() == 0)
                dontScroll = true;

            viewport->selectRow (row, getRowHeight(), dontScroll,
                                 lastRowSelected, totalItems, isMouseClick);

            lastRowSelected = row;
            model->selectedRowsChanged (row);
        }
        else
        {
            if (deselectOthersFirst)
                deselectAllRows();
        }
    }
}
Exemple #7
0
 void ListBox::adjustSize()
 {
     if (mListModel != NULL)
     {
         setHeight(getRowHeight() * mListModel->getNumberOfElements());
     }
 }
int RowHeightController::getRowGlobalOffset(int rowIndex) const {
    int rowOffset = 0;
    for (int i = 0; i < rowIndex; i++) {
        rowOffset += getRowHeight(i);
    }
    return rowOffset;
}
TreePath FixedHeightTreeModelLayout::getPathClosestTo(const Pnt2f& Loc) const
{
    //Determine the row
    UInt32 Row(osgMin<UInt32>(Loc.y()/getRowHeight(),getRowCount()-1));

    //Get the Path for that row
    return getPathForRow(Row);
}
Exemple #10
0
 void ListBox::mousePressed(MouseEvent& mouseEvent)
 {
     if (mouseEvent.getButton() == MouseEvent::LEFT)
     {
         setSelected(mouseEvent.getY() / getRowHeight());
         distributeActionEvent();
     }
 }
Exemple #11
0
void ListBox::mouseDragged(gcn::MouseEvent &event)
{
    if (event.getButton() != gcn::MouseEvent::LEFT)
        return;

    // Make list selection update on drag, but guard against negative y
    int y = std::max(0, event.getY());
    setSelected(y / getRowHeight());
}
Exemple #12
0
void ListBox::resized()
{
    viewport->setBoundsInset (BorderSize<int> (outlineThickness + ((headerComponent != nullptr) ? headerComponent->getHeight() : 0),
                                               outlineThickness, outlineThickness, outlineThickness));

    viewport->setSingleStepSizes (20, getRowHeight());

    viewport->updateVisibleArea (false);
}
Exemple #13
0
void ListBox::mouseClicked(gcn::MouseEvent &mouseEvent)
{
    if (mouseEvent.getButton() == gcn::MouseEvent::LEFT)
    {
        setSelected(mouseEvent.getY() / getRowHeight());

        if (mouseEvent.getClickCount() == 2)
            distributeActionEvent();
    }
}
int RowHeightController::getRowGlobalOffset(int rowIndex, const QList<int> &rowIndexes) const {
    int rowOffset = 0;
    foreach (const int currentIndex, rowIndexes) {
        if (currentIndex != rowIndex) {
            rowOffset += getRowHeight(currentIndex);
        } else {
            return rowOffset;
        }
    }
    FAIL(false, 0);
}
QString GTUtilsMSAEditorSequenceArea::getColor(HI::GUITestOpStatus &os, QPoint p){
    MSAEditorSequenceArea *msaEditArea = qobject_cast<MSAEditorSequenceArea*>(GTWidget::findWidget(os, "msa_editor_sequence_area", GTUtilsMdi::activeWindow(os)));
    GT_CHECK_RESULT(msaEditArea != NULL, "MsaEditorSequenceArea not found", "");

    QPoint global = convertCoordinates(os, p);
    global.setY(global.y() + (getRowHeight(os)/2 - 1));
    QPoint local = msaEditArea->mapFromGlobal(global);
    QColor c = GTWidget::getColor(os, msaEditArea, local);
    QString name = c.name();
    return name;
}
Exemple #16
0
void CodeView::setPlainText(QString text)
{
    text.replace("\r", "");

    m_highlighter.colorize(text);

//    m_rows = text.split("\n");

    setMinimumSize(4000,getRowHeight()*m_highlighter.getRowCount());

    update();
}
Exemple #17
0
    void draw(gcn::Graphics *graphics)
    {
        if (!mListModel)
            return;

        ServersListModel *model = static_cast<ServersListModel*>(mListModel);

        updateAlpha();

        graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT,
                                                (int) (mAlpha * 255.0f)));
        graphics->setFont(getFont());

        const int height = getRowHeight();
        const gcn::Color unsupported =
                Theme::getThemeColor(Theme::SERVER_VERSION_NOT_SUPPORTED,
                                     (int) (mAlpha * 255.0f));

        // Draw filled rectangle around the selected list element
        if (mSelected >= 0)
            graphics->fillRectangle(gcn::Rectangle(0, height * mSelected,
                                                   getWidth(), height));

        // Draw the list elements
        for (int i = 0, y = 0; i < model->getNumberOfElements();
             ++i, y += height)
        {
            ServerInfo info = model->getServer(i);

            graphics->setColor(Theme::getThemeColor(Theme::TEXT));

            if (!info.name.empty())
            {
                graphics->setFont(boldFont);
                graphics->drawText(info.name, 2, y);
            }

            graphics->setFont(getFont());

            int top = y + height / 2;

            graphics->drawText(model->getElementAt(i), 2, top);

            if (info.version.first > 0)
            {
                graphics->setColor(unsupported);

                graphics->drawText(info.version.second,
                                   getWidth() - info.version.first - 2, top);
            }
        }
    }
Exemple #18
0
BOOL ListCtrl::calcRow()
{
	ULONG nOldStartRow = m_nStartRow;
	ULONG nOldEndRow = m_nEndRow;
	m_nStartRow = m_nEndRow = -1;
	Rect rcDraw = getClientRect();
	LONG nOffset = getVOffset();
	//TRACE(L"nOffset = %d", nOffset);
	ULONG nTotalRow = getTotalRows();
	LONG nSumHeight = 0;
	for (ULONG nRow = 0; nRow < nTotalRow; nRow++)
	{
		nSumHeight += getRowHeight(nRow);
		if (nSumHeight >= nOffset)
		{
			m_nStartRow = nRow;
			break;
		}
	}
	nSumHeight = 0;
	LONG nViewHeight = rcDraw.bottom - rcDraw.top;
	for (ULONG nRow = m_nStartRow; nRow < nTotalRow; nRow++)
	{
		nSumHeight += getRowHeight(nRow);
		if (nSumHeight > nViewHeight)
		{
			m_nEndRow = nRow;
			break;
		}
	}

	if (nSumHeight <= nViewHeight)
	{
		m_nEndRow = nTotalRow - 1;
	}
	//TRACE(L"m_nStartRow = %d", m_nStartRow);
	//TRACE(L"m_nEndRow = %d", m_nEndRow);
	return (m_nStartRow != nOldStartRow || m_nEndRow != nOldEndRow);
}
Exemple #19
0
    void ListBox::setSelected(int selected)
    {
        if (mListModel == NULL)
        {
            mSelected = -1;
        }
        else
        {
            if (selected < 0)
            {
                mSelected = -1;
            }
            else if (selected >= mListModel->getNumberOfElements())
            {
                mSelected = mListModel->getNumberOfElements() - 1;
            }
            else
            {
                mSelected = selected;
            }
        }
        
        Rectangle scroll;

        if (mSelected < 0)
        {
            scroll.y = 0;
        }
        else
        {
            scroll.y = getRowHeight() * mSelected;
        }

        scroll.height = getRowHeight();
        showPart(scroll);

        distributeValueChangedEvent();
    }
Exemple #20
0
/**
 * Returns the preferred size of the TextArea.  This is the
 * maximum of the size needed to display the text and the
 * size requested for the viewport.
 *
 * @return the size
 */
/*public*/ Dimension getPreferredSize() {
    Dimension d = super.getPreferredSize();
    d = (d == NULL) ? new Dimension(400,400) : d;
    Insets insets = getInsets();

    if (columns != 0) {
        d.width = Math.max(d.width, columns * getColumnWidth() +
                insets.left + insets.right);
    }
    if (rows != 0) {
        d.height = Math.max(d.height, rows * getRowHeight() +
                            insets.top + insets.bottom);
    }
    return d;
}
Exemple #21
0
void ListCtrl::calcVirtualSize( Size& sz )
{
	setVirtualSizeCached();
	sz.empty();
	int nTotalRow = getTotalRows();
	for (int i = 0; i < nTotalRow; i++)
	{
		sz.cy += getRowHeight(i);
	}
	int nTotalCol = getTotalColumns();
	for (int i = 0; i < nTotalCol; i++)
	{
		sz.cx += getColumnWidth(i);
	}
}
Exemple #22
0
    void draw(gcn::Graphics *gcnGraphics)
    {
        if (!mListModel)
            return;

        SkillModel* model = static_cast<SkillModel*>(mListModel);

        updateAlpha();

        Graphics *graphics = static_cast<Graphics*>(gcnGraphics);

        graphics->setColor(Theme::getThemeColor(Theme::HIGHLIGHT,
                                                (int) (mAlpha * 255.0f)));
        graphics->setFont(getFont());

        // Draw filled rectangle around the selected list element
        if (mSelected >= 0)
        {
            graphics->fillRectangle(gcn::Rectangle(0, getRowHeight() * mSelected,
                                                   getWidth(), getRowHeight()));
        }

        // Draw the list elements
        graphics->setColor(Theme::getThemeColor(Theme::TEXT));
        for (int i = 0, y = 1;
             i < model->getNumberOfElements();
             ++i, y += getRowHeight())
        {
            SkillInfo *e = model->getSkillAt(i);

            if (e)
            {
                e->draw(graphics, y, getWidth());
            }
        }
    }
Exemple #23
0
ColorPage::ColorPage(const Widget2 *const widget,
                     ListModel *const listModel,
                     const std::string &skin) :
    ListBox(widget, listModel, skin)
{
    mItemPadding = mSkin ? mSkin->getOption("itemPadding") : 1;
    mRowHeight = 13;
    const Font *const font = getFont();
    if (font)
        mRowHeight = font->getHeight() + 2 * mItemPadding;
    if (mListModel)
    {
        setHeight(getRowHeight() * mListModel->getNumberOfElements()
            + 2 * mPadding + 20);
    }
}
Exemple #24
0
ColorPage::ColorPage(const Widget2 *const widget,
                     ListModel *const listModel,
                     const std::string &skin) :
    ListBox(widget, listModel, skin)
{
    mItemPadding = mSkin != nullptr ? mSkin->getOption("itemPadding") : 1;
    const Font *const font = getFont();
    mRowHeight = CAST_U32(font->getHeight() +
        2 * mItemPadding);
    if (mListModel != nullptr)
    {
        setHeight(CAST_S32(getRowHeight()) *
            mListModel->getNumberOfElements()
            + 2 * mPadding + 20);
    }
}
Exemple #25
0
void ListCtrl::calcCellRect()
{
	WFX_CONDITION(m_nStartRow != -1);
	WFX_CONDITION(m_nEndRow != -1);
	WFX_CONDITION(m_nStartCol != -1);
	WFX_CONDITION(m_nEndCol != -1);
	WFX_CONDITION(m_nEndRow >= m_nStartRow);
	WFX_CONDITION(m_nEndCol >= m_nEndCol);
	m_rgRectFast.clear();
	m_rgRect.clear();
	m_rgRowNumRect.clear();
	ULONG nTotalRow = getTotalRows();
	ULONG nTotalCol = getTotalColumns();
	ULONG nSeqBarWidth = getRowNumBarWidth();
	ULONG nHeadHeight = getHeadHeight();
	Rect rcWid = getClientRect();
	Rect rcCell = rcWid;
	Rect rcRowNum = rcWid;
	ULONG nWidth = 0;
	ULONG nHeight = 0;
	rcRowNum.right = rcRowNum.left + nSeqBarWidth;
	rcCell.left += nSeqBarWidth + 1;
	rcCell.top += nHeadHeight + 1;
	m_rgRectFast.resize(m_nEndRow - m_nStartRow + 1);
	for (LONG nRow = m_nStartRow; nRow <= m_nEndRow; nRow++)
	{
		nHeight = getRowHeight(nRow);
		rcCell.bottom = rcCell.top + nHeight;
		rcRowNum.top = rcCell.top;
		rcRowNum.bottom = rcCell.bottom;
		m_rgRowNumRect.push_back(rcRowNum);
		if (rcCell.bottom > rcWid.bottom)
			rcCell.bottom = rcWid.bottom;
		m_rgRectFast[nRow - m_nStartRow].resize(m_nEndCol - m_nStartCol + 1);
		for (LONG nCol = m_nStartCol; nCol <= m_nEndCol; nCol++)
		{
			nWidth = getColumnWidth(nCol);
			rcCell.right = rcCell.left + nWidth;
			m_rgRect.insert(std::make_pair(CellID(nRow, nCol), rcCell));
			m_rgRectFast[nRow - m_nStartRow][nCol - m_nStartCol] = rcCell;
			rcCell.left += rcCell.right - rcCell.left;
		}
		rcCell.left = rcWid.left + nSeqBarWidth + 1;
		rcCell.top += rcCell.bottom - rcCell.top;
	}
}
Exemple #26
0
LRESULT ListCtrl::onKeyDown( UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled )
{
	if (getScrollBar(SB_VERT) != NULL)
	{
		LONG nHeight = 0;
		LONG nTotal = getEndRow() + 1;
		LONG nPos = 0;
		for (LONG n = 0; n < nTotal; n++)
		{
			nPos += getRowHeight(n);
		}
		getScrollBar(SB_VERT)->setPos(nPos);
		BOOL bh;
		getScrollBar(SB_VERT)->onSize(0, 0, 0, bh);
	}
	return 1;
}
void
MFXEditableTable::editItem(FXTableItem* item, FXint how) {
    if (item == 0) {
        editEnd();
        return;
    }
    if (myWriteProtectedCols.find(myEditedCol) != myWriteProtectedCols.end()) {
        editEnd();
        return;
    }
    FXTableItem* it = item;
    myPreviousText = item->getText();
    FXint x = getColumnX(myEditedCol) + getRowHeader()->getWidth() + xpos;
    FXint y = getRowY(myEditedRow) + getColumnHeader()->getHeight() + ypos;
    FXIcon* icon = item->getIcon();
    if (icon) {
        x += icon->getWidth() + 4;
    }
    FXint vw = getViewportWidth();
    if (vertical->shown()) {
        vw -= vertical->getWidth();
    }
    if (vw > getColumnWidth(myEditedCol)) {
        vw = getColumnWidth(myEditedCol) + x;
    }
    myEditor->setText(it->getText());
    myEditor->move(x, y);
    myEditor->resize(vw - x + 1, getRowHeight(myEditedRow) + 1);
    myEditor->show();
    myEditor->raise();
    myEditor->setFocus();
    if (how == 'I') {
        myEditor->killSelection();
        myEditor->setCursorPos(0);
    } else if (how == 'A') {
        myEditor->killSelection();
        myEditor->setCursorPos(myEditor->getText().length());
    } else {
        myEditor->selectAll();
    }
    myEditedItem = it;
}
Exemple #28
0
void GuiTable::recomputeDimensions()
{
    int rows_nr = mModel->getRows();
    int columns_nr = mModel->getColumns();
    int width = 0;
    int height = 0;

    if (mSelectedRow >= rows_nr)
        mSelectedRow = rows_nr - 1;

    if (mSelectedColumn >= columns_nr)
        mSelectedColumn = columns_nr - 1;

    for (int i = 0; i < columns_nr; i++)
        width += getColumnWidth(i);

    height = getRowHeight() * rows_nr;

    setWidth(width);
    setHeight(height);
}
void GuiTable::recomputeDimensions()
{
    if (!mModel)
        return;

    const int rows_nr = mModel->getRows();
    const int columns_nr = mModel->getColumns();
    int width = 0;

    if (mSelectable)
    {
        if (mSelectedRow >= rows_nr)
            mSelectedRow = rows_nr - 1;

        if (mSelectedColumn >= columns_nr)
            mSelectedColumn = columns_nr - 1;
    }

    for (int i = 0; i < columns_nr; i++)
        width += getColumnWidth(i);

    setWidth(width);
    setHeight(getRowHeight() * rows_nr);
}
Exemple #30
0
int ListBox::getSelectionByMouse(const int y) const
{
    if (y < mPadding)
        return -1;
    return static_cast<unsigned int>(y - mPadding) / getRowHeight();
}