aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GUIPieChart.hpp
blob: 3356dba017dcd6f8d88541b49b1c9ab340bc97b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include <godot_cpp/classes/texture_rect.hpp>

#include <openvic-simulation/interface/GFXSprite.hpp>

#include "openvic-extension/classes/GFXPieChartTexture.hpp"

namespace OpenVic {
   class GUIPieChart : public godot::TextureRect {
      GDCLASS(GUIPieChart, godot::TextureRect)

      godot::Ref<GFXPieChartTexture> gfx_pie_chart_texture;

      bool tooltip_active;
      godot::Vector2 tooltip_position;

      void _update_tooltip();

   protected:
      static void _bind_methods();

      void _notification(int what);

   public:
      void _gui_input(godot::Ref<godot::InputEvent> const& event) override;

      GUIPieChart();

      godot::Error set_gfx_pie_chart(GFX::PieChart const* gfx_pie_chart);

      godot::Ref<GFXPieChartTexture> get_gfx_pie_chart_texture() const;

      godot::Error set_gfx_pie_chart_name(godot::String const& gfx_pie_chart_name);

      godot::String get_gfx_pie_chart_name() const;

      godot::Error set_slices_array(GFXPieChartTexture::godot_pie_chart_data_t const& new_slices);
   };
}