コード例 #1
0
ファイル: MuiScrollBar.cpp プロジェクト: Andy-Amoy/sumatrapdf
void ScrollBar::SetFilled(float perc) {
    CrashIf((perc < 0.f) || (perc > 1.f));
    int prev = IntFromPerc(pos.Width, filledPerc);
    int curr = IntFromPerc(pos.Width, perc);
    filledPerc = perc;
    if (prev != curr)
        RequestRepaint(this);
}
コード例 #2
0
// (x, y) is in the coordinates of w
void EbookController::ClickedProgress(Control *c, int x, int y)
{
    CrashIf(c != ctrls->progress);
    float perc = ctrls->progress->GetPercAt(x);
    int pageCount = (int)GetPages()->Count();
    int newPageNo = IntFromPerc(pageCount, perc) + 1;
    GoToPage(newPageNo, true);
}
コード例 #3
0
// (x, y) is in the coordinates of w
void EbookController::ClickedProgress(Control *c, int x, int y)
{
    CrashIf(c != ctrls->progress);
    float perc = ctrls->progress->GetPercAt(x);
    // TODO: shouldn't be active if we don't have pages from
    // beginnign, but happened in real life, crash 1096004
    if (!GetPagesFromBeginning())
        return;
    int pageCount = GetPagesFromBeginning()->Count();
    int newPageNo = IntFromPerc(pageCount, perc) + 1;
    GoToPage(newPageNo);
}
コード例 #4
0
ファイル: MuiScrollBar.cpp プロジェクト: Andy-Amoy/sumatrapdf
void ScrollBar::Paint(Graphics *gfx, int offX, int offY) {
    CrashIf(!IsVisible());
    // TODO: take padding into account
    CachedStyle *s = cachedStyle;

    int dy = inactiveDy;
    if (IsMouseOver())
        dy = onOverDy;

    Rect r(offX, offY + pos.Height - dy, pos.Width, dy);
    Brush *br = BrushFromColorData(s->bgColor, r);
    gfx->FillRectangle(br, r);

    int filledDx = IntFromPerc(pos.Width, filledPerc);
    if (0 == filledDx)
        return;

    r.Width = filledDx;
    br = BrushFromColorData(s->color, r);
    gfx->FillRectangle(br, r);
}