2013-08-16 14:48:43 +00:00
|
|
|
// Copyright (c) 2013- PPSSPP Project.
|
|
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, version 2.0 or later versions.
|
|
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License 2.0 for more details.
|
|
|
|
|
|
|
|
// A copy of the GPL 2.0 should have been included with the program.
|
|
|
|
// If not, see http://www.gnu.org/licenses/
|
|
|
|
|
|
|
|
// Official git repository and contact information can be found at
|
|
|
|
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
|
|
|
|
2013-09-07 15:29:44 +00:00
|
|
|
#pragma once
|
|
|
|
|
2014-06-08 13:38:13 +00:00
|
|
|
#include <vector>
|
2013-08-17 08:34:38 +00:00
|
|
|
#include "base/functional.h"
|
2013-08-16 14:48:43 +00:00
|
|
|
#include "ui/view.h"
|
|
|
|
#include "ui/ui_screen.h"
|
|
|
|
|
2013-08-17 08:34:38 +00:00
|
|
|
#include "UI/MiscScreens.h"
|
|
|
|
|
2014-06-08 13:38:13 +00:00
|
|
|
class ControlMapper;
|
|
|
|
|
2013-08-17 10:09:50 +00:00
|
|
|
class ControlMappingScreen : public UIDialogScreenWithBackground {
|
2013-08-16 14:48:43 +00:00
|
|
|
public:
|
2013-08-17 08:34:38 +00:00
|
|
|
ControlMappingScreen() {}
|
2014-06-08 13:38:13 +00:00
|
|
|
void KeyMapped(int pspkey); // Notification to let us refocus the same one after recreating views.
|
2013-08-17 08:34:38 +00:00
|
|
|
protected:
|
2014-06-15 11:04:59 +00:00
|
|
|
virtual void CreateViews() override;
|
|
|
|
virtual void sendMessage(const char *message, const char *value) override;
|
2013-08-17 08:34:38 +00:00
|
|
|
private:
|
2013-08-17 22:41:19 +00:00
|
|
|
UI::EventReturn OnDefaultMapping(UI::EventParams ¶ms);
|
2013-08-17 08:34:38 +00:00
|
|
|
UI::EventReturn OnClearMapping(UI::EventParams ¶ms);
|
2014-05-19 21:29:35 +00:00
|
|
|
UI::EventReturn OnAutoConfigure(UI::EventParams ¶ms);
|
2014-09-05 21:21:07 +00:00
|
|
|
UI::EventReturn OnTestAnalogs(UI::EventParams ¶ms);
|
2014-05-19 21:29:35 +00:00
|
|
|
|
|
|
|
virtual void dialogFinished(const Screen *dialog, DialogResult result) override;
|
2014-06-08 13:38:13 +00:00
|
|
|
|
|
|
|
UI::ScrollView *rightScroll_;
|
|
|
|
std::vector<ControlMapper *> mappers_;
|
2013-08-16 14:48:43 +00:00
|
|
|
};
|
|
|
|
|
2013-08-16 15:16:11 +00:00
|
|
|
class KeyMappingNewKeyDialog : public PopupScreen {
|
2013-08-16 14:48:43 +00:00
|
|
|
public:
|
2013-08-19 22:49:25 +00:00
|
|
|
explicit KeyMappingNewKeyDialog(int btn, bool replace, std::function<void(KeyDef)> callback)
|
2014-06-08 13:38:13 +00:00
|
|
|
: PopupScreen("Map Key", "Cancel", ""), callback_(callback), mapped_(false) {
|
2013-08-16 14:48:43 +00:00
|
|
|
pspBtn_ = btn;
|
|
|
|
}
|
2013-08-16 15:16:11 +00:00
|
|
|
|
2014-06-15 11:04:59 +00:00
|
|
|
virtual bool key(const KeyInput &key) override;
|
|
|
|
virtual bool axis(const AxisInput &axis) override;
|
2013-08-16 14:48:43 +00:00
|
|
|
|
|
|
|
protected:
|
2014-06-15 11:04:59 +00:00
|
|
|
void CreatePopupContents(UI::ViewGroup *parent) override;
|
2013-08-16 15:16:11 +00:00
|
|
|
|
2014-06-15 11:04:59 +00:00
|
|
|
virtual bool FillVertical() const override { return false; }
|
|
|
|
virtual bool ShowButtons() const override { return true; }
|
|
|
|
virtual void OnCompleted(DialogResult result) override {}
|
2013-08-17 08:34:38 +00:00
|
|
|
|
2013-08-16 14:48:43 +00:00
|
|
|
private:
|
|
|
|
int pspBtn_;
|
2013-08-16 19:25:01 +00:00
|
|
|
bool replace_;
|
2013-08-17 08:34:38 +00:00
|
|
|
std::function<void(KeyDef)> callback_;
|
2014-06-08 13:38:13 +00:00
|
|
|
bool mapped_; // Prevent double registrations
|
2013-08-16 14:48:43 +00:00
|
|
|
};
|
2014-09-05 21:21:07 +00:00
|
|
|
|
|
|
|
class AnalogTestScreen : public UIDialogScreenWithBackground {
|
|
|
|
public:
|
|
|
|
AnalogTestScreen() {}
|
|
|
|
|
2015-01-03 16:55:15 +00:00
|
|
|
bool key(const KeyInput &key) override;
|
2015-08-27 23:22:45 +00:00
|
|
|
bool axis(const AxisInput &axis) override;
|
2015-01-03 16:55:15 +00:00
|
|
|
|
2014-09-05 21:21:07 +00:00
|
|
|
protected:
|
|
|
|
virtual void CreateViews() override;
|
2015-01-03 16:55:15 +00:00
|
|
|
|
|
|
|
UI::TextView *lastKeyEvent_;
|
2015-08-27 23:22:45 +00:00
|
|
|
};
|