Beispiel #1
0
AnimatedTextBoxSkin::AnimatedTextBoxSkin(
    const std::shared_ptr<IRelativeBox>& box,
    const std::shared_ptr<IRelativeGeometry>& geom)
    : AnimatedObject(box, geom)
    , m_cursorOffsetX(0)
    , m_cursorPos(0)
    , m_drawCursor(false)
    , m_loaded(false)
    , m_cursor(std::make_shared<TextBoxCursor>())
    , m_text(std::make_shared<EditableLabel>(
        std::make_shared<RelativeBox>(RelativeValue(), RelativeValue())))
{}
Beispiel #2
0
AnimatedTextBoxSkin::AnimatedTextBoxSkin(
    const std::shared_ptr<IRelativeBox>& box,
    const std::shared_ptr<EditableLabel>& text,
    const std::shared_ptr<TextBoxCursor>& cursor,
    const std::shared_ptr<IRelativeGeometry>& geom)
    : AnimatedObject(box, geom)
    , m_shiftPeriod(DEFAULT_SHIFT_PERIOD)
    , m_cursorPos(0)
    , m_drawCursor(false)
    , m_loaded(false)
    , m_cursor(cursor ? cursor : std::make_shared<TextBoxCursor>())
    , m_text(text ? text : std::make_shared<EditableLabel>(
        std::make_shared<RelativeBox>(RelativeValue(), RelativeValue())))
{}
Beispiel #3
0
std::shared_ptr<ScrollBar> SimpleScrollableAreaSkin::createScrollBar(
    const std::shared_ptr<FloatValue>& controlledValue,
    Direction::Enum direction) const
{
    if (!m_scrollBarEnabled[direction])
        return nullptr;
    auto skin = std::make_shared<CommonScrollBarSkin>(
        createScrollBarBox(direction, m_scrollBarWidth),
        createDragBarBox(direction, m_scrollBarWidth),
        direction);
    skin->setAlwaysShow(false);
    skin->setStep(m_scrollStep);

    auto scrollBarBackground = std::make_shared<StaticFilledRect>(
        std::make_shared<RelativeBox>(RelativeValue(), RelativeValue()));
    scrollBarBackground->setColor(m_backgroundColor);
    skin->addElement(scrollBarBackground);
    
    auto decButtonSkin = std::make_shared<ArrowButtonSkin>(std::make_shared<SquareBox>());
    fillSkin(decButtonSkin.get());
    decButtonSkin->setArrowType(direction == Direction::Horizontal
        ? ArrowButtonSkin::Left : ArrowButtonSkin::Down);
    decButtonSkin->setArrowColor(m_arrowColor);
    decButtonSkin->setArrowPadding(m_arrowPadding);
    skin->setDecButtonSkin(decButtonSkin);

    auto incButtonSkin = std::make_shared<ArrowButtonSkin>(std::make_shared<SquareBox>());
    fillSkin(incButtonSkin.get());
    incButtonSkin->setArrowType(direction == Direction::Horizontal
        ? ArrowButtonSkin::Right : ArrowButtonSkin::Up);
    incButtonSkin->setArrowColor(m_arrowColor);
    incButtonSkin->setArrowPadding(m_arrowPadding);
    skin->setIncButtonSkin(incButtonSkin);

    auto dragBar = std::make_shared<SimpleRectangleButtonSkin>(
        std::make_shared<RelativeBox>(RelativeValue(), RelativeValue()));
    fillSkin(dragBar.get());
    skin->setDragBarSkin(dragBar);

    auto scrollBar = std::make_shared<ScrollBar>(skin, createScrollBarOffset(direction));
    scrollBar->setControlledValue(controlledValue);
    return scrollBar;
}