Ejemplo n.º 1
0
void ofxLayout::mouseMoved(ofMouseEventArgs &args){

    mouseMovedPt = ofPoint(args)*mouseTransformation;
    ofxLayoutElement* mouseMovedElement = hittest(mouseMovedPt);
    mouseMovedElement->mouseMoved(args);
    string evtStr = "mouseMoved";
    ofNotifyEvent(mouseMovedEvt, evtStr, mouseMovedElement);

}
Ejemplo n.º 2
0
 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
     x -= DX;
     y -= DY;
     for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); i++) {
         if (hittest(fPts[i], x, y)) {
             return new PtClick(this, (int)i);
         }
     }
     return this->INHERITED::onFindClickHandler(x, y, modi);
 }
Ejemplo n.º 3
0
void ofxLayout::mousePressed(ofMouseEventArgs &args){
    if (touchReady){
        mouseDraggedPt.set(ofPoint());
        mousePressedPt = ofPoint(args)*mouseTransformation;
        ofxLayoutElement* mousePressedElement = hittest(mousePressedPt);
        mousePressedElement->mousePressed(args);
        string evtStr = "mousePressed";
        ofNotifyEvent(mousePressedEvt, evtStr, mousePressedElement);
    }
}
Ejemplo n.º 4
0
void ofxLayout::tuioUpdated(ofxTuioCursor &tuioCursor)
{
    if(tuioCursor.getFingerId() == 0){
        if (touchReady){
            ofPoint loc = ofPoint(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
            mouseDraggedPt = ofPoint(loc)*mouseTransformation;
            ofxLayoutElement* mouseDraggedElement = hittest(mouseDraggedPt);
            mouseDraggedElement->fingerDragged(loc);
            string evtStr = "mouseDragged";
            ofNotifyEvent(mouseDraggedEvt, evtStr, mouseDraggedElement);
            ofNotifyEvent(tuioCursorUpdatedEvt, tuioCursor, mouseDraggedElement);
        }
    }
}
Ejemplo n.º 5
0
bool FlexHelperImplMac::eventFilter(QObject* obj, QEvent* evt)
{
    auto widget = qobject_cast<QWidget*>(obj);

    switch (evt->type())
    {
    case QEvent::WindowStateChange:
    {
        auto state = widget->windowState();

        if (state & Qt::WindowMaximized)
        {
            _buttons->maxButton()->setButton(Flex::Restore);
            _buttons->maxButton()->setToolTip(QWidget::tr("Restore"));
        }
        else
        {
            _buttons->maxButton()->setToolTip(QWidget::tr("Maximize"));
            _buttons->maxButton()->setButton(Flex::Maximize);
        }

        break;
    }
    case QEvent::MouseButtonPress:
    {
        if (widget->isMaximized())
        {
            break;
        }

        QMouseEvent* event = static_cast<QMouseEvent*>(evt);

        if (event->button() == Qt::LeftButton)
        {
            hittest(widget, event->pos());

            if (_hit >= 0)
            {
                widget->grabKeyboard();

                if (_hit == 0)
                {
                    _moving = true; QMetaObject::invokeMethod(widget, "enterMove", Q_ARG(QObject*, widget));
                }

                _old = event->globalPos();
            }
        }
Ejemplo n.º 6
0
void ofxLayout::tuioRemoved(ofxTuioCursor &tuioCursor)
{
    if(tuioCursor.getFingerId() == 0)
    {
        ofPoint loc = ofPoint(tuioCursor.getX()*ofGetWidth(),tuioCursor.getY()*ofGetHeight());
        mouseDraggedPt.set(ofPoint());
        mouseReleasedPt = loc*mouseTransformation;
        ofxLayoutElement* mouseReleasedElement = hittest(mouseReleasedPt);
        mouseReleasedElement->fingerReleased(loc);
        string evtStr = "mouseReleased";
        ofNotifyEvent(mouseReleasedEvt, evtStr, mouseReleasedElement);
        ofNotifyEvent(tuioCursorRemovedEvt, tuioCursor, mouseReleasedElement);
        
        touchReadyCheck();
    }
}
Ejemplo n.º 7
0
    virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y,
                                              unsigned modi) override {
        for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); ++i) {
            if (hittest(fPts[i], x, y)) {
                return new MyClick(this, (int)i);
            }
        }
        const SkRect& rectPt = SkRect::MakeXYWH(x, y, 1, 1);
        if (fWeightControl.contains(rectPt)) {
            return new MyClick(this, (int) SK_ARRAY_COUNT(fPts) + 1);
        }
#ifdef SK_DEBUG
        if (fErrorControl.contains(rectPt)) {
            return new MyClick(this, (int) SK_ARRAY_COUNT(fPts) + 2);
        }
#endif
        if (fWidthControl.contains(rectPt)) {
            return new MyClick(this, (int) SK_ARRAY_COUNT(fPts) + 3);
        }
        if (fCubicButton.fBounds.contains(rectPt)) {
            fCubicButton.fEnabled ^= true;
            return new MyClick(this, (int) SK_ARRAY_COUNT(fPts) + 4);
        }
        if (fConicButton.fBounds.contains(rectPt)) {
            fConicButton.fEnabled ^= true;
            return new MyClick(this, (int) SK_ARRAY_COUNT(fPts) + 5);
        }
        if (fQuadButton.fBounds.contains(rectPt)) {
            fQuadButton.fEnabled ^= true;
            return new MyClick(this, (int) SK_ARRAY_COUNT(fPts) + 6);
        }
        if (fRRectButton.fBounds.contains(rectPt)) {
            fRRectButton.fEnabled ^= true;
            return new MyClick(this, (int) SK_ARRAY_COUNT(fPts) + 7);
        }
        if (fCircleButton.fBounds.contains(rectPt)) {
            bool wasEnabled = fCircleButton.fEnabled;
            fCircleButton.fEnabled = !fCircleButton.fFill;
            fCircleButton.fFill = wasEnabled && !fCircleButton.fFill;
            return new MyClick(this, (int) SK_ARRAY_COUNT(fPts) + 8);
        }
        if (fTextButton.fBounds.contains(rectPt)) {
            fTextButton.fEnabled ^= true;
            return new MyClick(this, (int) SK_ARRAY_COUNT(fPts) + 9);
        }
        return this->INHERITED::onFindClickHandler(x, y, modi);
    }
Ejemplo n.º 8
0
 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) override {
     // holding down shift
     if (1 == modi) {
         return new PtClick(this, -1);
     }
     // holding down ctrl
     if (2 == modi) {
         return new PtClick(this, -2);
     }
     SkPoint clickPoint = {x, y};
     fInvMatrix.mapPoints(&clickPoint, 1);
     for (size_t i = 0; i < SK_ARRAY_COUNT(fPts); i++) {
         if (hittest(fPts[i], clickPoint.fX, clickPoint.fY)) {
             return new PtClick(this, (int)i);
         }
     }
     return this->INHERITED::onFindClickHandler(x, y, modi);
 }
 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y) {
     fDragIndex = hittest(x, y);
     return fDragIndex >= 0 ? new Click(this) : NULL;
 }