aboutsummaryrefslogtreecommitdiff
path: root/extension/src/openvic-extension/classes/GUINode.hpp
diff options
context:
space:
mode:
author hop311 <hop3114@gmail.com>2023-12-19 00:38:54 +0100
committer hop311 <hop3114@gmail.com>2023-12-25 19:06:13 +0100
commit4e9764ee29fb7b453862835d5aa3a081b0f9a269 (patch)
treea59c5b960a706a383b8ebd1dbcfb704067a5b51b /extension/src/openvic-extension/classes/GUINode.hpp
parentd26c990d9a5596a3ef3b32ba1cb0f99950cd6d34 (diff)
Back to UI Work
- UIAdapter -> UITools with cleaner API - GUIOverlappingElementsBox (for core and modifier icons) - Improved GUINode API - Province building slots - TypeHints for files in the GameSession folder - Incorporate SIM strong colour types
Diffstat (limited to 'extension/src/openvic-extension/classes/GUINode.hpp')
-rw-r--r--extension/src/openvic-extension/classes/GUINode.hpp50
1 files changed, 31 insertions, 19 deletions
diff --git a/extension/src/openvic-extension/classes/GUINode.hpp b/extension/src/openvic-extension/classes/GUINode.hpp
index 1671547..e38ed1f 100644
--- a/extension/src/openvic-extension/classes/GUINode.hpp
+++ b/extension/src/openvic-extension/classes/GUINode.hpp
@@ -12,42 +12,54 @@
#include "openvic-extension/classes/GFXIconTexture.hpp"
#include "openvic-extension/classes/GFXMaskedFlagTexture.hpp"
#include "openvic-extension/classes/GFXPieChartTexture.hpp"
+#include "openvic-extension/classes/GUIOverlappingElementsBox.hpp"
namespace OpenVic {
class GUINode : public godot::Control {
GDCLASS(GUINode, godot::Control)
- template<std::derived_from<godot::Node> T>
- T* _get_cast_node(godot::NodePath const& path) const;
-
- template<std::derived_from<godot::Texture2D> T>
- godot::Ref<T> _get_cast_texture_from_node(godot::NodePath const& path) const;
-
protected:
static void _bind_methods();
public:
- GUINode() = default;
+ GUINode();
+
+ static godot::Control* generate_gui_element(
+ godot::String const& gui_file, godot::String const& gui_element, godot::String const& name = ""
+ );
- godot::Error _add_gui_element(GUI::Element const* element, godot::String const& name);
godot::Error add_gui_element(
godot::String const& gui_file, godot::String const& gui_element, godot::String const& name = ""
);
- godot::Button* get_button_node(godot::NodePath const& path) const;
- godot::CheckBox* get_check_box_node(godot::NodePath const& path) const;
- godot::Label* get_label_node(godot::NodePath const& path) const;
- godot::Panel* get_panel_node(godot::NodePath const& path) const;
- godot::TextureProgressBar* get_progress_bar_node(godot::NodePath const& path) const;
- godot::TextureRect* get_texture_rect_node(godot::NodePath const& path) const;
+ static godot::Button* get_button_from_node(godot::Node* node);
+ static godot::CheckBox* get_check_box_from_node(godot::Node* node);
+ static godot::Label* get_label_from_node(godot::Node* node);
+ static godot::Panel* get_panel_from_node(godot::Node* node);
+ static godot::TextureProgressBar* get_progress_bar_from_node(godot::Node* node);
+ static godot::TextureRect* get_texture_rect_from_node(godot::Node* node);
+ static GUIOverlappingElementsBox* get_gui_overlapping_elements_box_from_node(godot::Node* node);
+
+ godot::Button* get_button_from_nodepath(godot::NodePath const& path) const;
+ godot::CheckBox* get_check_box_from_nodepath(godot::NodePath const& path) const;
+ godot::Label* get_label_from_nodepath(godot::NodePath const& path) const;
+ godot::Panel* get_panel_from_nodepath(godot::NodePath const& path) const;
+ godot::TextureProgressBar* get_progress_bar_from_nodepath(godot::NodePath const& path) const;
+ godot::TextureRect* get_texture_rect_from_nodepath(godot::NodePath const& path) const;
+ GUIOverlappingElementsBox* get_gui_overlapping_elements_box_from_nodepath(godot::NodePath const& path) const;
/* Helper functions to get textures from TextureRects and Buttons. */
- godot::Ref<godot::Texture2D> get_texture_from_node(godot::NodePath const& path) const;
- godot::Ref<GFXIconTexture> get_gfx_icon_texture_from_node(godot::NodePath const& path) const;
- godot::Ref<GFXMaskedFlagTexture> get_gfx_masked_flag_texture_from_node(godot::NodePath const& path) const;
- godot::Ref<GFXPieChartTexture> get_gfx_pie_chart_texture_from_node(godot::NodePath const& path) const;
+ static godot::Ref<godot::Texture2D> get_texture_from_node(godot::Node* node);
+ static godot::Ref<GFXIconTexture> get_gfx_icon_texture_from_node(godot::Node* node);
+ static godot::Ref<GFXMaskedFlagTexture> get_gfx_masked_flag_texture_from_node(godot::Node* node);
+ static godot::Ref<GFXPieChartTexture> get_gfx_pie_chart_texture_from_node(godot::Node* node);
+
+ godot::Ref<godot::Texture2D> get_texture_from_nodepath(godot::NodePath const& path) const;
+ godot::Ref<GFXIconTexture> get_gfx_icon_texture_from_nodepath(godot::NodePath const& path) const;
+ godot::Ref<GFXMaskedFlagTexture> get_gfx_masked_flag_texture_from_nodepath(godot::NodePath const& path) const;
+ godot::Ref<GFXPieChartTexture> get_gfx_pie_chart_texture_from_nodepath(godot::NodePath const& path) const;
godot::Error hide_node(godot::NodePath const& path) const;
- godot::Error hide_nodes(godot::Array const& paths) const;
+ godot::Error hide_nodes(godot::TypedArray<godot::NodePath> const& paths) const;
};
}