예제 #1
0
bool StGLSwitchTextured::tryClick(const StPointD_t& theCursorZo, const int& theMouseBtn, bool& isItemClicked) {
    if(!isVisible()) {
        return false; // nothing to see - nothing to click...
    }
    if(!isItemClicked && isPointIn(theCursorZo)) {
        setClicked(theMouseBtn, true);
        isItemClicked = true;
        return true;
    }
    return false;
}
예제 #2
0
bool StGLRootWidget::tryClick(const StClickEvent& theEvent,
                              bool&               theIsItemClicked) {
    const StPointD_t aCursorBack = cursorZo;
    cursorZo = StPointD_t(theEvent.PointX, theEvent.PointY);
    if(isPointIn(cursorZo)) {
        setClicked(theEvent.Button, true);
    }
    const bool aResult = StGLWidget::tryClick(theEvent, theIsItemClicked);
    cursorZo = aCursorBack;
    return aResult;
}
예제 #3
0
bool StGLWidget::tryClick(const StPointD_t& cursorZo, const int& mouseBtn, bool& isItemClicked) {
    if(!isVisible()) {
        return false; // nothing to see - nothing to click... (all children too!)
    }
    for(StGLWidget *child(myChildren.getLast()), *childActive(NULL); child != NULL;) {
        childActive = child;
        child = child->getPrev();
        childActive->tryClick(cursorZo, mouseBtn, isItemClicked);
    }
    if(!isItemClicked && isPointIn(cursorZo)) {
        setClicked(mouseBtn, true);
        isItemClicked = signals.onMouseClick(mouseBtn);
        return true;
    }
    return false;
}
예제 #4
0
void phdPopupMenu::mouseReleased(ofMouseEventArgs& args) {
    updateHitTestInfo(args.x, args.y);
    if(hitTestInfo.infoType == pphInside && hitTestInfo.focusedIndex != -1) {
        setClicked(items[hitTestInfo.focusedIndex]);
    } else if(hitTestInfo.infoType == pphOutside) {
        bool _found = testInsideMeAndMySubMenus(args.x,args.y);
        setVisible(_found);
        if(!_found) { // click outside - pass menu
            phdPopupMenuEventData _pmed;
            _pmed.item = NULL;
            _pmed.menu = (phdPopupMenu*) this;
            _pmed.eventType = petClickOutside;
            ofNotifyEvent(popEvent, _pmed, this);
        }
    }
}
예제 #5
0
bool StGLSwitchTextured::tryUnClick(const StPointD_t& theCursorZo, const int& theMouseBtn, bool& isItemUnclicked) {
    if(!isVisible()) {
        return false; // nothing to see - nothing to click...
    }
    bool isSelfClicked = isClicked(theMouseBtn) && isPointIn(theCursorZo);
    setClicked(theMouseBtn, false);
    if(!isItemUnclicked && isSelfClicked) {
        isItemUnclicked = true;

        int32_t anActiveValue = myTrackValue->getValue();
        StGLRadioButtonTextured* aRadioBtn = NULL;
        for(StGLWidget* aChild = getChildren()->getStart(); aChild != NULL;) {
            /// TODO (Kirill Gavrilov#9) - adding children with another type is not allowed
            ///                            hovewer not protected thus this cast is not thread-safe!
            aRadioBtn = (StGLRadioButtonTextured* )aChild;
            aChild = aChild->getNext();

            if(anActiveValue == aRadioBtn->getValueOn()) {
                // switch to next
                while(aChild != NULL) {
                    aRadioBtn = (StGLRadioButtonTextured* )aChild;
                    if(!mySkipValues.contains(aRadioBtn->getValueOn())) {
                        myTrackValue->setValue(aRadioBtn->getValueOn());
                        break;
                    }
                    aChild = aChild->getNext();
                }
                if(aChild == NULL) {
                    // switch to first
                    aRadioBtn = (StGLRadioButtonTextured* )getChildren()->getStart();
                    myTrackValue->setValue(aRadioBtn->getValueOn());
                }
                break;
            }
        }
        return true;
    }
    return false;
}