2025-07-06 20:43:53 +03:00
|
|
|
#pragma once
|
2026-03-27 09:51:53 +03:00
|
|
|
#include "GUIStuffHelpers.hpp"
|
2025-07-06 20:43:53 +03:00
|
|
|
|
|
|
|
|
namespace GUIStuff {
|
2026-03-27 09:51:53 +03:00
|
|
|
class GUIManager;
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
class Element {
|
|
|
|
|
public:
|
|
|
|
|
Element(GUIManager& initGUI);
|
2026-03-05 23:34:30 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
virtual void clay_draw(SkCanvas* canvas, UpdateInputData& io, Clay_RenderCommand* command, bool skiaAA);
|
|
|
|
|
virtual bool collides_with_point(const Vector2f& p) const;
|
2025-11-11 19:52:45 +03:00
|
|
|
|
2026-03-31 17:33:09 +03:00
|
|
|
void set_bounding_box_from_elem_data(const Clay_ElementData& elemData);
|
2026-04-01 21:49:44 +03:00
|
|
|
void set_parent_clipping_region(const std::optional<SCollision::AABB<float>>& bb);
|
2026-03-27 09:51:53 +03:00
|
|
|
const std::optional<SCollision::AABB<float>>& get_bb() const;
|
|
|
|
|
virtual ~Element() = default;
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
int16_t zIndex;
|
2026-04-02 21:57:26 +03:00
|
|
|
bool mouseHovering = false;
|
|
|
|
|
bool childMouseHovering = false;
|
|
|
|
|
|
|
|
|
|
Element* parent = nullptr;
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2026-04-08 17:34:50 +03:00
|
|
|
virtual void update();
|
2026-04-09 16:30:28 +03:00
|
|
|
virtual void deselect();
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2026-04-04 17:52:43 +03:00
|
|
|
virtual void input_paste_callback(const CustomEvents::PasteEventData& paste);
|
2026-04-03 23:02:33 +03:00
|
|
|
virtual void input_text_key_callback(const InputManager::KeyCallbackArgs& key);
|
2026-04-04 17:52:43 +03:00
|
|
|
virtual void input_text_callback(const InputManager::TextCallbackArgs& text);
|
2026-04-02 21:57:26 +03:00
|
|
|
virtual void input_mouse_button_callback(const InputManager::MouseButtonCallbackArgs& button);
|
|
|
|
|
virtual void input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion);
|
|
|
|
|
virtual void input_mouse_wheel_callback(const InputManager::MouseWheelCallbackArgs& wheel);
|
2026-03-27 09:51:53 +03:00
|
|
|
virtual void input_key_callback(const InputManager::KeyCallbackArgs& key);
|
|
|
|
|
protected:
|
|
|
|
|
static SCollision::AABB<float> get_bb_from_command(Clay_RenderCommand* command);
|
|
|
|
|
std::optional<SCollision::AABB<float>> boundingBox;
|
2026-04-01 21:49:44 +03:00
|
|
|
std::optional<SCollision::AABB<float>> parentClippingRegion;
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2026-03-27 09:51:53 +03:00
|
|
|
GUIManager& gui;
|
|
|
|
|
};
|
2025-07-06 20:43:53 +03:00
|
|
|
}
|