HoverRace  2.0
SettingsScene.h
Go to the documentation of this file.
1 
2 // SettingsScene.h
3 //
4 // Copyright (c) 2014, 2015 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 #include "../../engine/Display/FlexGrid.h"
25 
26 #include "DialogScene.h"
27 
28 namespace HoverRace {
29  namespace Client {
30  class MessageScene;
31  }
32 }
33 
34 namespace HoverRace {
35 namespace Client {
36 
41 class SettingsScene : public DialogScene
42 {
43  using SUPER = DialogScene;
44 
45 public:
47  const std::string &parentTitle, const std::string &title,
48  const std::string &name);
49  virtual ~SettingsScene() { }
50 
51 protected:
53  virtual void LoadFromConfig() = 0;
54 
57  {
58  needsLoadFromConfig = true;
59  }
60 
62  virtual void ResetToDefaults() = 0;
63 
64 protected:
65  Display::FlexGrid *GetSettingsGrid() { return settingsGrid.get(); }
66 
67  Display::FlexGrid::CellProxy AddSetting(const std::string &label);
68 
69  std::shared_ptr<MessageScene> NewSoftRestartConfirmScene() const;
70  std::shared_ptr<MessageScene> NewMainMenuConfirmScene() const;
71 
72 protected:
73  void OnExtra() override;
74 
75 public:
76  void PrepareRender() override;
77 
78 protected:
79  static Vec2 SLIDER_SIZE;
80 
81 private:
82  std::shared_ptr<Display::FlexGrid> settingsGrid;
83  size_t curRow;
85  boost::signals2::scoped_connection confirmOkConn;
86  boost::signals2::scoped_connection saveConn;
87 };
88 
89 } // namespace Client
90 } // namespace HoverRace
void RequestLoadFromConfig()
Indicate that the form needs to be refreshed from the config.
Definition: SettingsScene.h:56
Interface for game client shells.
Definition: GameDirector.h:57
Display::FlexGrid * GetSettingsGrid()
Definition: SettingsScene.h:65
GameDirector & director
Definition: TestLabScene.cpp:160
Definition: Vec.h:38
Base class for scenes with a title and status area.
Definition: DialogScene.h:46
Base class for display managers.
Definition: Display.h:73
bool needsLoadFromConfig
Definition: SettingsScene.h:84
Base class for full-scene menus and the like.
Definition: FormScene.h:48
boost::signals2::scoped_connection confirmOkConn
Definition: SettingsScene.h:85
This is used to reference a cell of the grid without directly accessing it; useful for adding new wid...
Definition: FlexGrid.h:389
size_t curRow
Definition: SettingsScene.h:83
static Vec2 SLIDER_SIZE
Default size for settings sliders.
Definition: SettingsScene.h:79
A container that arranges components into a grid that is automatically sized to the contents...
Definition: FlexGrid.h:52
std::shared_ptr< Display::FlexGrid > settingsGrid
Definition: SettingsScene.h:82
Definition: Announcement.h:24
Base for settings pages.
Definition: SettingsScene.h:41
virtual ~SettingsScene()
Definition: SettingsScene.h:49
boost::signals2::scoped_connection saveConn
Definition: SettingsScene.h:86