diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 059f2bbea..445933124 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -61,6 +61,7 @@ #include "CommandMenu.hxx" #include "HighScoresMenu.hxx" #include "MessageMenu.hxx" + #include "InputMenu.hxx" #include "DialogContainer.hxx" #include "Launcher.hxx" #include "TimeMachine.hxx" @@ -2154,12 +2155,20 @@ bool EventHandler::changeStateByEvent(Event::Type type) handled = false; break; - case Event::InputTextDialogMode: + case Event::InputTextDialogMode: // TODO rename + { + StringList labels; + + labels.push_back("Nick"); + myOSystem.inputMenu().setTitle("PlusROMs first start setup"); + myOSystem.inputMenu().setLabels(labels); + if(myState != EventHandlerState::INPUTMENU) enterMenuMode(EventHandlerState::INPUTMENU); else leaveMenuMode(); break; + } #endif case Event::TimeMachineMode: diff --git a/src/gui/InputMenu.cxx b/src/gui/InputMenu.cxx new file mode 100644 index 000000000..e1b6e6f78 --- /dev/null +++ b/src/gui/InputMenu.cxx @@ -0,0 +1,81 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2021 by Bradford W. Mott, Stephen Anthony +// and the Stella Team +// +// See the file "License.txt" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +//============================================================================ + +#include "Dialog.hxx" +#include "OSystem.hxx" +#include "FrameBuffer.hxx" +#include "InputTextDialog.hxx" +#include "InputMenu.hxx" + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +InputMenu::InputMenu(OSystem& osystem) + : DialogContainer(osystem) +{ +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +InputMenu::~InputMenu() +{ + delete myInputTextDialog; myInputTextDialog = nullptr; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +Dialog* InputMenu::baseDialog() +{ + StringList labels; + + labels.push_back("test"); + + if(myInputTextDialog == nullptr) + myInputTextDialog = new InputTextDialog(myOSystem, *this, myOSystem.frameBuffer().font(), labels); + + return myInputTextDialog; +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void InputMenu::setTitle(const string& title, bool yesNo) +{ + +} + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void InputMenu::setLabels(const StringList& text, bool yesNo) +{ + +} + + +//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +//void InputMenu::setMessage(const string& title, const StringList& text, bool yesNo) +//{ +// //myInputTextDialog->setMessage(title); +//} +// +//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +//void InputMenu::setMessage(const string& title, const string& text, bool yesNo) +//{ +// //myInputTextDialog->setMessage(title); +//} +// +//// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +//bool InputMenu::confirmed() +//{ +// //if(myInputTextDialog != nullptr) +// // return myInputTextDialog->confirmed(); +// +// return false; +//} diff --git a/src/gui/InputMenu.hxx b/src/gui/InputMenu.hxx new file mode 100644 index 000000000..9bcf7a8c1 --- /dev/null +++ b/src/gui/InputMenu.hxx @@ -0,0 +1,62 @@ +//============================================================================ +// +// SSSS tt lll lll +// SS SS tt ll ll +// SS tttttt eeee ll ll aaaa +// SSSS tt ee ee ll ll aa +// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator" +// SS SS tt ee ll ll aa aa +// SSSS ttt eeeee llll llll aaaaa +// +// Copyright (c) 1995-2021 by Bradford W. Mott, Stephen Anthony +// and the Stella Team +// +// See the file "License.txt" for information on usage and redistribution of +// this file, and for a DISCLAIMER OF ALL WARRANTIES. +//============================================================================ + +#ifndef INPUT_MENU_HXX +#define INPUT_MENU_HXX + +class OSystem; +class InputTextDialog; + +#include "DialogContainer.hxx" + +/** + The base dialog for all input menus in Stella. + + @author Thomas Jentzsch +*/ +class InputMenu : public DialogContainer +{ + public: + /** + Create a new menu stack + */ + explicit InputMenu(OSystem& osystem); + ~InputMenu() override; + + void setTitle(const string& title, bool yesNo = false); + void setLabels(const StringList& text, bool yesNo = false); + //bool confirmed(); + + private: + /** + Return (and possibly create) the bottom-most dialog of this container. + */ + Dialog* baseDialog() override; + + private: + InputTextDialog* myInputTextDialog{nullptr}; + + private: + // Following constructors and assignment operators not supported + InputMenu() = delete; + InputMenu(const InputMenu&) = delete; + InputMenu(InputMenu&&) = delete; + InputMenu& operator=(const InputMenu&) = delete; + InputMenu& operator=(InputMenu&&) = delete; +}; + +#endif diff --git a/src/gui/InputTextDialog.hxx b/src/gui/InputTextDialog.hxx index 49229aba5..fc7f4beb3 100644 --- a/src/gui/InputTextDialog.hxx +++ b/src/gui/InputTextDialog.hxx @@ -69,7 +69,7 @@ class InputTextDialog : public Dialog, public CommandSender vector myInput; StaticTextWidget* myMessage{nullptr}; - bool myEnableCenter{false}; + bool myEnableCenter{true}; bool myErrorFlag{false}; int myCmd{0};