Pioneer
SystemInfoView.h
Go to the documentation of this file.
1 // Copyright © 2008-2021 Pioneer Developers. See AUTHORS.txt for details
2 // Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3 
4 #ifndef _SYSTEMINFOVIEW_H
5 #define _SYSTEMINFOVIEW_H
6 
7 #include "Color.h"
8 #include "galaxy/SystemPath.h"
10 
11 #include "pigui/PiGuiView.h"
12 #include <vector>
13 
14 class Game;
15 class StarSystem;
16 class SystemBody;
17 
18 namespace Graphics {
19  class Renderer;
20  class RenderState;
21 } // namespace Graphics
22 
23 class SystemInfoView : public PiGuiView {
24 public:
25  SystemInfoView(Game *game);
26  virtual void Update();
27  virtual void Draw3D();
28 
29 protected:
30  virtual void OnSwitchTo();
31 
32 private:
33  class BodyIcon : public Gui::ImageRadioButton {
34  public:
35  BodyIcon(const char *img, Graphics::Renderer *);
36  virtual void Draw();
37  virtual void OnActivate();
38  bool HasStarport() { return m_hasStarport; }
39  void SetHasStarport() { m_hasStarport = true; }
40  void SetSelectColor(const Color &color) { m_selectColor = color; }
41 
42  private:
44  Graphics::RenderState *m_renderState;
45  Graphics::Drawables::Lines m_selectBox;
46  std::unique_ptr<Graphics::Drawables::Circle> m_circle;
47  bool m_hasStarport;
48  Color m_selectColor;
49  };
50 
51  enum RefreshType {
52  REFRESH_NONE,
53  REFRESH_SELECTED_BODY,
54  REFRESH_ALL
55  };
56 
57  RefreshType NeedsRefresh();
58  void SystemChanged(const SystemPath &path);
59  void OnBodyViewed(SystemBody *b);
60  void OnBodySelected(SystemBody *b);
61  void OnClickBackground(Gui::MouseButtonEvent *e);
62  void PutBodies(SystemBody *body, Gui::Fixed *container, int dir, float pos[2], int &majorBodies, int &starports, int &onSurface, float &prevSize);
63  void UpdateIconSelections();
64 
65  Game *m_game;
66 
67  Gui::VBox *m_infoBox;
68  Gui::Fixed *m_sbodyInfoTab;
69 
70  Gui::Tabbed *m_tabs;
72  SystemPath m_selectedBodyPath;
73  RefreshType m_refresh;
74  //map is not enough to associate icons as each tab has their own. First element is the body index of SystemPath (names are not unique)
75  std::vector<std::pair<Uint32, BodyIcon *>> m_bodyIcons;
76  bool m_unexplored;
77 };
78 
79 #endif /* _SYSTEMINFOVIEW_H */
Definition: Game.h:39
Definition: Drawables.h:79
Definition: RenderState.h:25
Definition: Renderer.h:39
virtual void Draw()
Definition: GuiContainer.cpp:191
Definition: GuiFixed.h:14
Definition: GuiImageRadioButton.h:14
Definition: GuiTabbed.h:10
Definition: GuiBox.h:42
virtual void OnActivate()
Definition: GuiWidget.h:57
Definition: PiGuiView.h:11
Definition: StarSystem.h:27
Definition: SystemBody.h:19
Definition: SystemInfoView.h:23
virtual void Update()
Definition: SystemInfoView.cpp:335
virtual void Draw3D()
Definition: SystemInfoView.cpp:278
SystemInfoView(Game *game)
Definition: SystemInfoView.cpp:22
virtual void OnSwitchTo()
Definition: SystemInfoView.cpp:353
Definition: SystemPath.h:13
Graphics::Renderer * m_renderer
Definition: View.h:43
Definition: Background.h:13
Definition: Color.h:66
Definition: GuiEvents.h:8