Ejemplo n.º 1
0
void QDragManager::updateCursor()
{
#ifndef QT_NO_CURSOR
    if (willDrop) {
        if (qt_qws_dnd_deco)
            qt_qws_dnd_deco->show();
        if (currentActionForOverrideCursor != global_accepted_action) {
            QApplication::changeOverrideCursor(QCursor(dragCursor(global_accepted_action), 0, 0));
            currentActionForOverrideCursor = global_accepted_action;
        }
    } else {
        QCursor *overrideCursor = QApplication::overrideCursor();
        if (!overrideCursor || overrideCursor->shape() != Qt::ForbiddenCursor) {
            QApplication::changeOverrideCursor(QCursor(Qt::ForbiddenCursor));
            currentActionForOverrideCursor = Qt::IgnoreAction;
        }
#ifndef EMSCRIPTEN
        // Hiding the pixmap feels weird, and doesn't match the desktop behaving;
        // so I've disabled it for Emscripten.
        if (qt_qws_dnd_deco)
            qt_qws_dnd_deco->hide();
#endif
    }
#endif
}
Ejemplo n.º 2
0
void DragEffectBitmapButton::OnMouseLeftDown (wxMouseEvent& event)
{
    if (mEffect == nullptr) {
        return;
    }
    wxString data;
    wxTextDataObject dragData(data);

    //unselect any running effect to make sure the notebook change won't effect it
    wxCommandEvent unselectEffect(EVT_UNSELECTED_EFFECT);
    wxPostEvent(GetParent(), unselectEffect);

    int id = mEffect->GetId();
    
    // Change the Choicebook to correct page
    wxCommandEvent eventEffectChanged(EVT_SELECTED_EFFECT_CHANGED);
    eventEffectChanged.SetInt(id);
    // We are only changing choicebook not populating effect panel with settings
    eventEffectChanged.SetClientData(nullptr);
    wxPostEvent(GetParent(), eventEffectChanged);

#ifdef __linux__
    wxIcon dragCursor;
    dragCursor.CopyFromBitmap(mEffect->GetEffectIcon(16, true));
#else
    wxCursor dragCursor(mEffect->GetEffectIcon(16, true).ConvertToImage());
#endif

    wxDropSource dragSource(this,dragCursor,dragCursor,dragCursor );

    dragSource.SetData( dragData );
    dragSource.DoDragDrop( wxDragMove );
}
Ejemplo n.º 3
0
void QDragManager::updateCursor()
{
#ifndef QT_NO_CURSOR
    if (willDrop) {
        if (qt_qws_dnd_deco)
            qt_qws_dnd_deco->show();
        if (currentActionForOverrideCursor != global_accepted_action) {
            QApplication::changeOverrideCursor(QCursor(dragCursor(global_accepted_action), 0, 0));
            currentActionForOverrideCursor = global_accepted_action;
        }
    } else {
        QCursor *overrideCursor = QApplication::overrideCursor();
        if (!overrideCursor || overrideCursor->shape() != Qt::ForbiddenCursor) {
            QApplication::changeOverrideCursor(QCursor(Qt::ForbiddenCursor));
            currentActionForOverrideCursor = Qt::IgnoreAction;
        }
        if (qt_qws_dnd_deco)
            qt_qws_dnd_deco->hide();
    }
#endif
}