Esempio n. 1
0
void ofxUITextInput::mousePressed(int x, int y, int button)
{
    if(rect->inside(x, y))
    {
        if(state == OFX_UI_STATE_OVER)
        {
            clicked = true;
            theta = 0;
            hit = true;
        }
#ifdef OFX_UI_TARGET_TOUCH
        clicked = true;
        theta = 0;
        hit = true;
#endif
        cursorPosition = label->getLabel().length();
        
        state = OFX_UI_STATE_DOWN;
        inputTriggerType = OFX_UI_TEXTINPUT_ON_FOCUS;
        
        if(triggerOnClick)
        {
            triggerEvent(this);
        }
    }
    else
    {
        state = OFX_UI_STATE_NORMAL;
        if(clicked)
        {
            unClick();
        }
    }
    stateChange();
}
Esempio n. 2
0
void ofxUITextInput::setFocus(bool _focus)
{
    if(_focus)
    {
        cursorPosition = 0;
        state = OFX_UI_STATE_DOWN;
        inputTriggerType = OFX_UI_TEXTINPUT_ON_FOCUS;
        clicked = true;
        stateChange();
        triggerEvent(this);
    }
    else
    {
        cursorPosition = textstring.length();
        stateChange();
        unClick();
    }
}
bool ofxUITextInput::mousePressed(ofMouseEventArgs &e)
{
    if(rect->inside(e.x, e.y))
    {
        //mili
        hitPoint.set(e.x - rect->getX(), e.y - rect->getY());
        //
        if(state == OFX_UI_STATE_OVER)
        {
            clicked = true;
            theta = 0;
            hit = true;
        }
#ifdef OFX_UI_TARGET_TOUCH
        clicked = true;
        theta = 0;
        hit = true;
#endif
        cursorPosition = label->getLabel().length();
        
        state = OFX_UI_STATE_DOWN;
        inputTriggerType = OFX_UI_TEXTINPUT_ON_FOCUS;
        
        if(triggerOnClick)
        {
            triggerEvent(this);
        }
    }
    else
    {
        state = OFX_UI_STATE_NORMAL;
        if(clicked)
        {
            unClick();
        }
    }
    stateChange();
    return hit;
}