mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 21:39:52 +00:00
Fix a potential crash bug with axis input. Remove ok/cancel buttons from popup lists.
This commit is contained in:
parent
357966447d
commit
e8d07b02c2
@ -97,7 +97,9 @@ void UIScreen::axis(const AxisInput &axis) {
|
||||
if (released & PAD_BUTTON_UP) key(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_DPAD_UP, KEY_UP));
|
||||
if (released & PAD_BUTTON_DOWN) key(KeyInput(DEVICE_ID_KEYBOARD, NKCODE_DPAD_DOWN, KEY_UP));
|
||||
hatDown_ = flags;
|
||||
UI::AxisEvent(axis, root_);
|
||||
if (root_) {
|
||||
UI::AxisEvent(axis, root_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -127,11 +129,13 @@ void PopupScreen::CreateViews() {
|
||||
|
||||
CreatePopupContents(box);
|
||||
|
||||
// And the two buttons at the bottom.
|
||||
ViewGroup *buttonRow = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(200, WRAP_CONTENT));
|
||||
buttonRow->Add(new Button("OK", new LinearLayoutParams(1.0f)))->OnClick.Handle(this, &PopupScreen::OnOK);
|
||||
buttonRow->Add(new Button("Cancel", new LinearLayoutParams(1.0f)))->OnClick.Handle(this, &PopupScreen::OnCancel);
|
||||
box->Add(buttonRow);
|
||||
if (ShowButtons()) {
|
||||
// And the two buttons at the bottom.
|
||||
ViewGroup *buttonRow = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(200, WRAP_CONTENT));
|
||||
buttonRow->Add(new Button("OK", new LinearLayoutParams(1.0f)))->OnClick.Handle(this, &PopupScreen::OnOK);
|
||||
buttonRow->Add(new Button("Cancel", new LinearLayoutParams(1.0f)))->OnClick.Handle(this, &PopupScreen::OnCancel);
|
||||
box->Add(buttonRow);
|
||||
}
|
||||
}
|
||||
|
||||
void PopupScreen::key(const KeyInput &key) {
|
||||
@ -160,14 +164,12 @@ void ListPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
|
||||
UI::EventReturn ListPopupScreen::OnListChoice(UI::EventParams &e) {
|
||||
adaptor_.SetSelected(e.a);
|
||||
callback_(adaptor_.GetSelected());
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
OnChoice.Dispatch(e);
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
void ListPopupScreen::OnCompleted() {
|
||||
callback_(adaptor_.GetSelected());
|
||||
}
|
||||
|
||||
void SliderPopupScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
using namespace UI;
|
||||
sliderValue_ = *value_;
|
||||
|
@ -49,6 +49,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual bool FillVertical() { return false; }
|
||||
virtual bool ShowButtons() { return true; }
|
||||
virtual void OnCompleted() {}
|
||||
|
||||
private:
|
||||
@ -69,7 +70,7 @@ public:
|
||||
|
||||
protected:
|
||||
virtual bool FillVertical() { return true; }
|
||||
virtual void OnCompleted();
|
||||
virtual bool ShowButtons() { return false; }
|
||||
void CreatePopupContents(UI::ViewGroup *parent);
|
||||
UI::StringVectorListAdaptor adaptor_;
|
||||
UI::ListView *listView_;
|
||||
|
Loading…
Reference in New Issue
Block a user