MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / SettingsWindow

Class SettingsWindow

source/modes/SettingsWindow.h:29–102  ·  view source on GitHub ↗

\brief This class is creating a setting window gui child to the current gui context and populates its widgets with the current game, video, audio values. It also permits to change them.

Source from the content-addressed store, hash-verified

27//! and populates its widgets with the current game, video, audio values.
28//! It also permits to change them.
29class SettingsWindow
30{
31public:
32 //! \brief Settings window constructor
33 //! \param rootWindow The main CEGUI window used as background to the current mode.
34 //! Used to load and later show the settings window.
35 SettingsWindow(CEGUI::Window* rootWindow);
36
37 ~SettingsWindow();
38
39 void show();
40
41 void hide();
42
43 bool isVisible() const
44 {
45 if (mSettingsWindow)
46 return mSettingsWindow->isVisible();
47 return false;
48 }
49
50 //! \brief Called when pushing the cancel button on the settings window.
51 bool onCancelSettings(const CEGUI::EventArgs& e = {});
52
53private:
54 //! \brief Vector of cegui event bindings to be cleared on exiting the mode
55 std::vector<CEGUI::Event::Connection> mEventConnections;
56
57 //! \brief The Settings window.
58 CEGUI::Window* mSettingsWindow;
59
60 //! \brief The apply change pop-up
61 CEGUI::Window* mApplyWindow;
62
63 //! \brief The root window.
64 CEGUI::Window* mRootWindow;
65
66 //! \brief The temporary video comboboxes and texts created depending on the video settings.
67 std::vector<CEGUI::Window*> mCustomVideoComboBoxes;
68 std::vector<CEGUI::Window*> mCustomVideoTexts;
69
70 //! \brief Set the different widget values according to current config.
71 void initConfig();
72
73 //! \brief Save the config, potentially stopping the application if it needs to.
74 void saveConfig();
75
76 //! \brief Adds an event binding to be cleared on exiting the mode.
77 inline void addEventConnection(CEGUI::Event::Connection conn)
78 {
79 mEventConnections.emplace_back(conn);
80 }
81
82 //! \brief Called when pushing the apply button on the settings window.
83 bool onApplySettings(const CEGUI::EventArgs&);
84
85 //! \brief Called when pushing the cancel button on the change appliance popup.
86 bool onPopupCancelApplySettings(const CEGUI::EventArgs&);

Callers 3

MenuModeMainMethod · 0.85
GameModeMethod · 0.85
EditorModeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected