1//============================================================================
2//
3// SSSS tt lll lll
4// SS SS tt ll ll
5// SS tttttt eeee ll ll aaaa
6// SSSS tt ee ee ll ll aa
7// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
8// SS SS tt ee ll ll aa aa
9// SSSS ttt eeeee llll llll aaaaa
10//
11// Copyright (c) 1995-2019 by Bradford W. Mott, Stephen Anthony
12// and the Stella Team
13//
14// See the file "License.txt" for information on usage and redistribution of
15// this file, and for a DISCLAIMER OF ALL WARRANTIES.
16//============================================================================
17
18#ifndef INPUT_DIALOG_HXX
19#define INPUT_DIALOG_HXX
20
21class OSystem;
22class GuiObject;
23class TabWidget;
24class EventMappingWidget;
25class CheckboxWidget;
26class EditTextWidget;
27class JoystickDialog;
28class PopUpWidget;
29class SliderWidget;
30class StaticTextWidget;
31namespace GUI {
32 class MessageBox;
33}
34
35#include "Dialog.hxx"
36#include "bspf.hxx"
37
38class InputDialog : public Dialog
39{
40 public:
41 InputDialog(OSystem& osystem, DialogContainer& parent,
42 const GUI::Font& font, int max_w, int max_h);
43 virtual ~InputDialog();
44
45 protected:
46 // disable repeat during and directly after mapping events
47 bool repeatEnabled() override;
48
49 private:
50 void handleKeyDown(StellaKey key, StellaMod mod, bool repeated) override;
51 void handleKeyUp(StellaKey key, StellaMod mod) override;
52 void handleJoyDown(int stick, int button, bool longPress) override;
53 void handleJoyUp(int stick, int button) override;
54 void handleJoyAxis(int stick, JoyAxis axis, JoyDir adir, int button) override;
55 bool handleJoyHat(int stick, int hat, JoyHatDir hdir, int button) override;
56 void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
57
58 void loadConfig() override;
59 void saveConfig() override;
60 void setDefaults() override;
61
62 void addDevicePortTab(const GUI::Font& font);
63
64 void eraseEEPROM();
65 void UpdateDejitter();
66
67 private:
68 enum {
69 kDeadzoneChanged = 'DZch',
70 kDejitterChanged = 'Pjch',
71 kDPSpeedChanged = 'PDch',
72 kMPSpeedChanged = 'PMch',
73 kTBSpeedChanged = 'TBch',
74 kDBButtonPressed = 'DBbp',
75 kEEButtonPressed = 'EEbp',
76 kConfirmEEEraseCmd = 'EEcf'
77 };
78
79 TabWidget* myTab;
80
81 EventMappingWidget* myEmulEventMapper;
82 EventMappingWidget* myMenuEventMapper;
83
84 CheckboxWidget* mySAPort;
85 PopUpWidget* myMouseControl;
86 PopUpWidget* myCursorState;
87
88 EditTextWidget* myAVoxPort;
89
90 SliderWidget* myDeadzone;
91 StaticTextWidget* myDeadzoneLabel;
92 SliderWidget* myDejitterBase;
93 SliderWidget* myDejitterDiff;
94 SliderWidget* myDPaddleSpeed;
95 SliderWidget* myMPaddleSpeed;
96 SliderWidget* myTrackBallSpeed;
97 StaticTextWidget* myDejitterLabel;
98 StaticTextWidget* myDPaddleLabel;
99 StaticTextWidget* myMPaddleLabel;
100 StaticTextWidget* myTrackBallLabel;
101 CheckboxWidget* myAllowAll4;
102 CheckboxWidget* myGrabMouse;
103 CheckboxWidget* myModCombo;
104
105 ButtonWidget* myJoyDlgButton;
106 ButtonWidget* myEraseEEPROMButton;
107
108 // Show the list of joysticks that the eventhandler knows about
109 unique_ptr<JoystickDialog> myJoyDialog;
110
111 // Show a message about the dangers of using this function
112 unique_ptr<GUI::MessageBox> myConfirmMsg;
113
114 // Maximum width and height for this dialog
115 int myMaxWidth, myMaxHeight;
116
117 private:
118 // Following constructors and assignment operators not supported
119 InputDialog() = delete;
120 InputDialog(const InputDialog&) = delete;
121 InputDialog(InputDialog&&) = delete;
122 InputDialog& operator=(const InputDialog&) = delete;
123 InputDialog& operator=(InputDialog&&) = delete;
124};
125
126#endif
127