Ejemplo n.º 1
0
void YSlider::allocate_thumb(const Allocation& a) {
    redraw_thumb();
    Allocation thumb_a;
    allot_thumb_major_axis(
        a, Dimension_Y, adjustable_, minimum_thumb_size(),
        yscale_, thumb_a.y_allotment()
    );
    allot_thumb_minor_axis(a.x_allotment(), thumb_a.x_allotment());
    reallocate_thumb(thumb_a);
}
Ejemplo n.º 2
0
void Slider::release(const Event& e) {
    SliderImpl& s = *impl_;
    if (s.dragging_) {
        if (s.showing_old_thumb_) {
            s.showing_old_thumb_ = false;
            s.old_thumb_->redraw();
        }
        s.dragging_ = false;
        if (s.aborted_) {
            s.aborted_ = false;
            return;
        }
        move_to(e.pointer_x() - s.xoffset_, e.pointer_y() - s.yoffset_);
        redraw_thumb();
        move(e);
        apply_adjustment(&Adjustable::commit_adjustment);
    } else if (s.stepper_ != nil) {
        s.stepper_->stop_stepping();
        s.stepper_ = nil;
        move(e);
    }
}
Ejemplo n.º 3
0
void Slider::release(const Event& e) {
    SliderImpl& s = *impl_;
    if (s.dragging_) {
        if (s.showing_old_thumb_) {
            s.showing_old_thumb_ = false;
            s.old_thumb_->redraw();
        }
        s.dragging_ = false;
        if (s.aborted_) {
            s.aborted_ = false;
            return;
        }
        Coord x, y;
        s.get_position(this, e, x, y);
        move_to(x - s.xoffset_, y - s.yoffset_);
        redraw_thumb();
        move(e);
        apply_adjustment(&Adjustable::commit_adjustment);
    } else if (s.stepper_ != nil) {
        s.stepper_->stop_stepping();
        s.stepper_ = nil;
        move(e);
    }
}