bool ofxUIButton::mouseReleased(ofMouseEventArgs &e)
{
    if(hit)
    {
#ifdef OFX_UI_TARGET_TOUCH
        state = OFX_UI_STATE_NORMAL;
#else
        if(rect->inside(e.x, e.y) || (label->isVisible() && label->getPaddingRect()->inside(e.x, e.y)))
        {
            state = OFX_UI_STATE_OVER;
        }
        else
        {
            state = OFX_UI_STATE_NORMAL;
        }
#endif
        toggleValue();
        if(triggerType & OFX_UI_TRIGGER_END)
        {
            triggerEvent(this);
        }
    }
    else
    {
        state = OFX_UI_STATE_NORMAL;
    }
    stateChange();
    hit = false;
    return false;
}
示例#2
0
void ofxUIButton::mouseReleased(int x, int y, int button)
{
    if(hit)
    {
#ifdef OFX_UI_TARGET_TOUCH
        state = OFX_UI_STATE_NORMAL;
#else
        if(rect->inside(x, y) || (label->isVisible() && label->getPaddingRect()->inside(x, y)))
        {
            state = OFX_UI_STATE_OVER;
        }
        else
        {
            state = OFX_UI_STATE_NORMAL;
        }
#endif
        toggleValue();
        triggerEvent(this);
    }
    else
    {
        state = OFX_UI_STATE_NORMAL;
    }
    stateChange();
    hit = false;
}
void ofxUIToggle::keyPressed(int key)
{
    if(getIsBindedToKey(key) && !bKeyHit)
    {
        bKeyHit = true;
        toggleValue();
        triggerEvent(this);
    }
}
void ofxUIButton::keyReleased(int key)
{
    if(getIsBindedToKey(key) && bKeyHit)
    {
        bKeyHit = false; 
        toggleValue();
        if(triggerType & OFX_UI_TRIGGER_END)
        {
            triggerEvent(this);
        }
    }
}
void ofxUIButton::keyPressed(int key)
{
    if(getIsBindedToKey(key) && !bKeyHit)
    {
        bKeyHit = true;
        toggleValue();
        if(triggerType & OFX_UI_TRIGGER_BEGIN)
        {
            triggerEvent(this);
        }
    }
}
示例#6
0
void ofxUIButton::mousePressed(int x, int y, int button)
{
    if(rect->inside(x, y) || (label->isVisible() && label->getPaddingRect()->inside(x, y)))
    {
        hit = true;
        state = OFX_UI_STATE_DOWN;
        toggleValue();
        triggerEvent(this);
    }
    else
    {
        state = OFX_UI_STATE_NORMAL;
    }
    stateChange();
}
bool ofxUIButton::mousePressed(ofMouseEventArgs &e)
{
    if(rect->inside(e.x, e.y) || (label->isVisible() && label->getPaddingRect()->inside(e.x, e.y)))
    {
        hit = true;
        state = OFX_UI_STATE_DOWN;
        toggleValue();
        if(triggerType & OFX_UI_TRIGGER_BEGIN)
        {
            triggerEvent(this);
        }
    }
    else
    {
        state = OFX_UI_STATE_NORMAL;
    }
    stateChange();
    return hit;
}
ConnectorTypeWidget::ConnectorTypeWidget(Connector::ConnectorType type, QWidget *parent)
	: QFrame(parent)
{
	m_isSelected = false;
	m_noEditionModeWidget = new QLabel(this);
	m_editionModeWidget = new QPushButton(this);
	connect(
		m_editionModeWidget, SIGNAL(clicked()),
		this, SLOT(toggleValue())
	);
	m_noEditionModeWidget->setFixedWidth(30);
	m_editionModeWidget->setFixedWidth(30);

	QVBoxLayout *layout = new QVBoxLayout(this);
	layout->setMargin(2);
	layout->setSpacing(0);
	layout->addWidget(m_noEditionModeWidget);
	layout->addWidget(m_editionModeWidget);

	setType(type);
}
bool ofxUIButton::mouseDragged(ofMouseEventArgs &e)
{
    if(hit)
    {
        if(rect->inside(e.x, e.y) || (label->isVisible() && label->getPaddingRect()->inside(e.x, e.y)))
        {
            state = OFX_UI_STATE_DOWN;
        }
        else
        {
            hit = false;
            state = OFX_UI_STATE_NORMAL;
            toggleValue();
            if(triggerType & OFX_UI_TRIGGER_END)
            {
                triggerEvent(this);
            }
        }
        stateChange();
    }
    return hit;
}