Beispiel #1
0
HistoryDialog::HistoryDialog(const std::string& info,
                             const fw::State::Context& context)
: mWin(*(context.window)),
  mFrame(sf::Vector2f(DIALOG_WIDTH, DIALOG_HEIGHT)),
  mTitle(L"选中名单", context.fonts->get(Fonts::Chinese), DIALOG_TITLE_SIZE),
  mContent(info, context.fonts->get(Fonts::Chinese), DIALOG_TEXT_SIZE),
  mTopIndex(0),
  mBotIndex(0),
  p_mArrowUp(nullptr),
  p_mArrowDown(nullptr),
  mIsDisplay(false)
{
    mDisplayPos.x = .5f * context.window->getView().getSize().x;
    mDisplayPos.y = mFrame.getGlobalBounds().height * .5f + 20.f;
    mBeginPos.x = mDisplayPos.x;
    mBeginPos.y = -.5f * mFrame.getGlobalBounds().height;

    setPosition(mBeginPos);

    SimpleButton::Ptr arrow_up(new SimpleButton(14));
    SimpleButton::Ptr arrow_down(new SimpleButton(14));
    p_mArrowUp = arrow_up.get();
    p_mArrowDown = arrow_down.get();
    attachChild(std::move(arrow_up));
    attachChild(std::move(arrow_down));

    p_mArrowDown->setCallback([this]()
    {
        strScrollDown();
    });

    p_mArrowUp->setCallback([this]()
    {
        strScrollUp();
    });

    mFrame.setFillColor(DIALOG_BG_COLOR);
    mTitle.setColor(DIALOG_TITLE_COLOR);
    mContent.setColor(DIALOG_TEXT_COLOR);
    p_mArrowUp->setButtonColor(DIALOG_TITLE_COLOR);
    p_mArrowDown->setButtonColor(DIALOG_TITLE_COLOR);

    p_mArrowDown->setRotation(180.f);
    p_mArrowDown->setButtonSize(16.f, 26.f);
    p_mArrowUp->setButtonSize(16.f, 26.f);

    maxNoLines = getMaxNoLineToShow();
    pack();
}
Beispiel #2
0
void		ft_up_down(t_edit **lst, t_hist **hst, char *key, struct winsize ws)
{
    t_hist		*tmp;

    tmp = NULL;
    if (*hst)
    {
        tmp = *hst;
        if (ARROW && key[2] == 65 && key[3] == 0)
            arrow_up(&tmp, lst);
        else
            arrow_down(&tmp, lst);
        ft_tputs("rc");
        ft_tputs("cd");
        ft_print_lste(lst);
    }
    if (((ft_poscurseur(lst) + 4) % ws.ws_col) == 0)
        ft_tputs("do");
}