diff options
author | Paul Gilbert | 2016-04-22 22:32:28 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-07-10 16:11:45 -0400 |
commit | f79ebfa3e26cc748ef495a96da8acb9e005b3324 (patch) | |
tree | c4f9867aab26b6ef9072bc4edf2ad0200b2d02c7 /engines/titanic/pet_control/pet_slider.cpp | |
parent | 4915f8900aff374b2a71545e788cb95d9da7138a (diff) | |
download | scummvm-rg350-f79ebfa3e26cc748ef495a96da8acb9e005b3324.tar.gz scummvm-rg350-f79ebfa3e26cc748ef495a96da8acb9e005b3324.tar.bz2 scummvm-rg350-f79ebfa3e26cc748ef495a96da8acb9e005b3324.zip |
TITANIC: Added PET Sound tab setup
Diffstat (limited to 'engines/titanic/pet_control/pet_slider.cpp')
-rw-r--r-- | engines/titanic/pet_control/pet_slider.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/engines/titanic/pet_control/pet_slider.cpp b/engines/titanic/pet_control/pet_slider.cpp index bb43cf5741..3e579a4b33 100644 --- a/engines/titanic/pet_control/pet_slider.cpp +++ b/engines/titanic/pet_control/pet_slider.cpp @@ -26,7 +26,7 @@ namespace Titanic { CPetSlider::CPetSlider() { - _flags = 0; + _orientation = 0; _thumbWidth = 0; _thumbHeight = 0; _sliderOffset = 0; @@ -53,12 +53,9 @@ bool CPetSlider::resetThumbFocus() { return result; } -void CPetSlider::proc10() { - -} - -void CPetSlider::proc11() { - +void CPetSlider::proc10(const Point &pt) { + int newOffset = calcSliderOffset(pt); + setOffsetPixels(newOffset); } bool CPetSlider::proc12(const Point &pt) { @@ -68,30 +65,22 @@ bool CPetSlider::proc12(const Point &pt) { return false; int newOffset = calcSliderOffset(pt); - setSliderOffset(newOffset); + setOffsetPixels(newOffset); return true; } -void CPetSlider::proc13() { - -} - -void CPetSlider::proc14() { - -} - bool CPetSlider::contains(const Point &pt) const { return thumbContains(pt) || containsPt(pt); } double CPetSlider::getOffsetPixels() const { int maxVal = 0, minVal = 0; - if (_flags & ORIENTATION_HORIZONTAL) { + if (_orientation & ORIENTATION_HORIZONTAL) { maxVal = _slidingRect.right; minVal = _slidingRect.left; } - if (_flags & ORIENTATION_VERTICAL) { + if (_orientation & ORIENTATION_VERTICAL) { maxVal = _slidingRect.bottom; minVal = _slidingRect.top; } @@ -103,10 +92,10 @@ double CPetSlider::getOffsetPixels() const { } void CPetSlider::setSliderOffset(double offset) { - if (_flags & ORIENTATION_HORIZONTAL) + if (_orientation & ORIENTATION_HORIZONTAL) _sliderOffset = offset * (_slidingRect.right - _slidingRect.left); - if (_flags & ORIENTATION_VERTICAL) + if (_orientation & ORIENTATION_VERTICAL) _sliderOffset = offset * (_slidingRect.bottom - _slidingRect.top); } @@ -136,12 +125,12 @@ Point CPetSlider::getThumbDrawPos() { Point CPetSlider::getThumbCentroidPos() const { Point pt; - if (_flags & ORIENTATION_HORIZONTAL) { + if (_orientation & ORIENTATION_HORIZONTAL) { pt = Point(_slidingRect.left + _sliderOffset, _slidingRect.top + _slidingRect.height() / 2); } - if (_flags & ORIENTATION_VERTICAL) { + if (_orientation & ORIENTATION_VERTICAL) { pt = Point(_slidingRect.left + _slidingRect.width() / 2, _slidingRect.top + _sliderOffset); } @@ -164,17 +153,21 @@ Rect CPetSlider::getThumbRect() const { int CPetSlider::calcSliderOffset(const Point &pt) const { int result = 0; - if (_flags & ORIENTATION_HORIZONTAL) { + if (_orientation & ORIENTATION_HORIZONTAL) { result = CLIP(pt.x, _slidingRect.left, _slidingRect.right) - _slidingRect.left; } - if (_flags & ORIENTATION_VERTICAL) { + if (_orientation & ORIENTATION_VERTICAL) { result = CLIP(pt.y, _slidingRect.top, _slidingRect.bottom) - _slidingRect.top; } return result; } +void CPetSlider::setOrientation(SliderOrientation orientation) { + _orientation |= orientation; +} + /*------------------------------------------------------------------------*/ void CPetSoundSlider::setupBackground(const CString &name, CPetControl *petControl) { |