mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-30 19:24:23 +01:00
Add +/- buttons to integer sliders for fine adjustment
This commit is contained in:
1 parent
26dfe75882
commit
59202a0dfc
3 files changed
+25
-3
No files matched your search
+18
-1
@@ -305,10 +305,27 @@ void PopupSliderChoiceFloat::Draw(UIContext &dc) {
|
||||
dc.DrawText(temp, bounds_.x2() - 12, bounds_.centerY(), 0xFFFFFFFF, ALIGN_RIGHT | ALIGN_VCENTER);
|
||||
}
|
||||
|
||||
EventReturn SliderPopupScreen::OnDecrease(EventParams ¶ms) {
|
||||
sliderValue_--;
|
||||
slider_->Clamp();
|
||||
return EVENT_DONE;
|
||||
}
|
||||
|
||||
EventReturn SliderPopupScreen::OnIncrease(EventParams ¶ms) {
|
||||
sliderValue_++;
|
||||
slider_->Clamp();
|
||||
return EVENT_DONE;
|
||||
}
|
||||
|
||||
void SliderPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
using namespace UI;
|
||||
sliderValue_ = *value_;
|
||||
slider_ = parent->Add(new Slider(&sliderValue_, minValue_, maxValue_, new LinearLayoutParams(UI::Margins(10, 5))));
|
||||
LinearLayout *lin = parent->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(UI::Margins(10, 5))));
|
||||
slider_ = new Slider(&sliderValue_, minValue_, maxValue_, new LinearLayoutParams(1.0f));
|
||||
lin->Add(slider_);
|
||||
lin->Add(new Button(" - "))->OnClick.Handle(this, &SliderPopupScreen::OnDecrease);
|
||||
lin->Add(new Button(" + "))->OnClick.Handle(this, &SliderPopupScreen::OnIncrease);
|
||||
|
||||
UI::SetFocusedView(slider_);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user