Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
void getNewSizes(size_t* origGlobalSize, size_t* origLocalSize,
                 size_t* newGlobalSize, size_t* newLocalSize,
                 const char* kernelName, size_t dimensions) {
  if(dimensions != 1 && dimensions != 2) {
    fprintf(stderr, "Wrong dimension value\n");
    exit(1);
  }

  if(origGlobalSize != NULL && newGlobalSize != NULL)
    setNewSize(origGlobalSize, newGlobalSize, "_GS", kernelName, dimensions);
  if(origLocalSize != NULL && newLocalSize != NULL)
    setNewSize(origLocalSize, newLocalSize, "_LS", kernelName, dimensions);
}
Ejemplo n.º 2
0
void BookmarkFolder::buttonClicked(Button* btnThatClicked)
{
    if (btnThatClicked == triBtn)
    {
        bExpanded = triBtn->getArrowDirection() == 0.0f;
    }
    bExpanded ? showChildren() : hideChildren();
    setNewSize();
}
Ejemplo n.º 3
0
bool windowManager::eventFilter(QObject* target, QEvent* event) {

  //    qDebug() << "e" << event->type();
  if (event->type() == QEvent::Resize) {
    QResizeEvent* resize = static_cast<QResizeEvent*>(event);
    setNewSize(resize->size());
    return true;
  }

  if (event->type() == QEvent::Move) {
    setNewPosition(static_cast<QWidget*>(target)->pos());
    return true;
  }
  return QObject::eventFilter(target, event);
}
Ejemplo n.º 4
0
void BookmarkFolderContainer::addChildrenFolders(var folders)
{
    int vsize = folders.size();
    if (vsize <= 0)
    {
        return;
    }
    for (int i = 0; i < vsize; ++i)
    {
        varfolders.append(folders[i]);
        folderContainer.push_back(ScopedPointer<BookmarkFolder>(new BookmarkFolder(folders[i])));
    }
    for (size_t i = 0; i < folderContainer.size(); ++i)
    {
        addAndMakeVisible(folderContainer[i]);
        folderContainer[i]->addSizeChangeListener(this);
    }
    ((BookmarkFolder*)getParentComponent())->showChildren();
    setNewSize();
}
Ejemplo n.º 5
0
BookmarkFolderContainer::BookmarkFolderContainer(var folders) 
    : varfolders(folders)
    , sizeListener(nullptr)
    , selectedFolderListener(nullptr)
{
    // In your constructor, you should add any child components, and
    // initialise any special settings that your component needs.

    int vsize = varfolders.size();
    for (int i = 0; i < vsize; ++i)
    {
        folderContainer.push_back(ScopedPointer<BookmarkFolder>(new BookmarkFolder(varfolders[i], false)));
    }
    for (int i = 0; i < vsize; ++i)
    {
        addAndMakeVisible(folderContainer[i]);
        folderContainer[i]->addSizeChangeListener(this);
    }
    setNewSize(); 
}
Ejemplo n.º 6
0
int Tiled::Internal::ResizeHelper::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: offsetChanged((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 1: offsetXChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: offsetYChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: offsetBoundsChanged((*reinterpret_cast< const QRect(*)>(_a[1]))); break;
        case 4: setOldSize((*reinterpret_cast< const QSize(*)>(_a[1]))); break;
        case 5: setNewSize((*reinterpret_cast< const QSize(*)>(_a[1]))); break;
        case 6: setOffset((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 7: setOffsetX((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 8: setOffsetY((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 9: setNewWidth((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 10: setNewHeight((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 11;
    }
    return _id;
}
Ejemplo n.º 7
0
void BookmarkFolderContainer::onNewSize()
{
    setNewSize();
}
Ejemplo n.º 8
0
void
GcWindow::mouseMoveEvent(QMouseEvent *e)
{
    if (!resizable()) return;

    if (dragState == None) {
        // set the cursor shape
        setCursorShape(spotHotSpot(e));
        return;
    }

    // work out the relative move x and y
    int relx = mapFromGlobal(QCursor::pos()).x() - mX;
    int rely = mapFromGlobal(QCursor::pos()).y() - mY;

    switch (dragState) {

    default:
    case Move :
        //move(oX + relx, oY + rely);
#if QT_VERSION < 0x040700
        setCursor(Qt::ClosedHandCursor);
#else
        setCursor(Qt::DragMoveCursor);
#endif
        emit moving(this);
        break;

    case TLCorner :
        {
            int newWidth = oWidth - relx;
            int newHeight = oHeight - rely;

            // need to move and resize
            if (newWidth > 30 && newHeight > 30) {
                move(oX + relx, oY + rely);
                setNewSize(newWidth, newHeight);
                emit resizing(this);
            }
        }
        break;

    case TRCorner :
        {
            int newWidth = oWidth + relx;
            int newHeight = oHeight - rely;

            // need to move and resize if changes on y plane
            if (newWidth > 30 && newHeight > 30) {
                move(oX, oY + rely);
                setNewSize(newWidth, newHeight);
                emit resizing(this);
            }
        }
        break;

    case BLCorner :
        {
            int newWidth = oWidth - relx;
            int newHeight = oHeight + rely;

            // need to move and resize
            if (newWidth > 30 && newHeight > 30) {
                move(oX + relx, oY);
                setNewSize(newWidth, newHeight);
                emit resizing(this);
            }
        }
        break;

    case BRCorner :
        {
            int newWidth = oWidth + relx;
            int newHeight = oHeight + rely;

            // need to move and resize
            if (newWidth > 30 && newHeight > 30) {
                setNewSize(newWidth, newHeight);
                emit resizing(this);
            }
        }
        break;

    case Top :
        {
            int newHeight = oHeight - rely;

            // need to move and resize
            if (newHeight > 30) {
                move (oX, oY + rely);
                setNewSize(oWidth, newHeight);
                emit resizing(this);
            }
        }
        break;

    case Bottom :
        {
            int newHeight = oHeight + rely;

            // need to move and resize
            if (newHeight > 30) {
                setNewSize(oWidth, newHeight);
                emit resizing(this);
            }
        }
        break;

    case Left :
        {
            int newWidth = oWidth - relx;

            // need to move and resize
            if (newWidth > 30) {
                move (oX + relx, oY);
                setNewSize(newWidth, oHeight);
                emit resizing(this);
            }
        }
        break;

    case Right :
        {
            int newWidth = oWidth + relx;

            // need to move and resize
            if (newWidth > 30) {
                setNewSize(newWidth, oHeight);
                emit resizing(this);
            }
        }
        break;
    }

    oX = pos().x();
    oY = pos().y();
    //repaint();
    //QApplication::processEvents(); // flicker...
}