void slider::set_maximum_value(const int maximum_value) { if(maximum_value == get_maximum_value()) { return; } /** @todo maybe make it a VALIDATE. */ assert(minimum_value_ <= maximum_value); const int value = get_value(); // The number of items needs to include the begin and end so distance + step // size. set_item_count(maximum_value - minimum_value_ + get_step_size()); if(value > maximum_value) { set_item_position(get_maximum_value()); } }
void tslider::set_maximum_value(const int maximum_value) { if(maximum_value == get_maximum_value()) { return; } /** @todo maybe make it a VALIDATE. */ VALIDATE(minimum_value_ < maximum_value, null_str); const int value = get_value(); // The number of items needs to include the begin and end so distance + 1. set_item_count(distance(minimum_value_, maximum_value) + 1); if(value > maximum_value) { set_item_position(get_maximum_value()); } else { set_item_position(minimum_value_ + value); } }
void tslider::set_minimum_value(const int minimum_value) { if(minimum_value == minimum_value_) { return; } /** @todo maybe make it a VALIDATE. */ assert(minimum_value <= get_maximum_value()); const int value = get_value(); const int maximum_value = get_maximum_value(); minimum_value_ = minimum_value; // The number of items needs to include the begin and end so distance + 1. set_item_count(distance(minimum_value_, maximum_value) + 1); if(value < minimum_value_) { set_item_position(0); } else { set_item_position(minimum_value_ + value); } }