Example #1
0
bool UILineEdit::onMousePress(const Point& mousePos, Fw::MouseButton button)
{
    if(button == Fw::MouseLeftButton) {
        int pos = getTextPos(mousePos);
        if(pos >= 0)
            setCursorPos(pos);
    }
    return true;
}
Example #2
0
bool UITextEdit::onMouseMove(const Point& mousePos, const Point& mouseMoved)
{
    if(m_selectable && isPressed()) {
        int pos = getTextPos(mousePos);
        if(pos >= 0) {
            setSelection(m_selectionReference, pos);
            setCursorPos(pos);
        }
        return true;
    }
    return UIWidget::onMouseMove(mousePos, mouseMoved);
}
Example #3
0
bool UITextEdit::onMousePress(const Point& mousePos, Fw::MouseButton button)
{
    if(UIWidget::onMousePress(mousePos, button))
        return true;

    if(button == Fw::MouseLeftButton) {
        int pos = getTextPos(mousePos);
        if(pos >= 0) {
            setCursorPos(pos);

            if(m_selectable) {
                m_selectionReference = pos;
                setSelection(pos, pos);
            }
        }
        return true;
    }

    return false;
}