2025-07-06 20:43:53 +03:00
|
|
|
#pragma once
|
|
|
|
|
#include "../DrawComponents/DrawTextBox.hpp"
|
2025-08-02 20:10:33 +03:00
|
|
|
#include "DrawingProgramToolBase.hpp"
|
2025-07-06 20:43:53 +03:00
|
|
|
#include <Helpers/SCollision.hpp>
|
|
|
|
|
#include <any>
|
|
|
|
|
|
|
|
|
|
class DrawingProgram;
|
|
|
|
|
|
2025-08-02 20:10:33 +03:00
|
|
|
class TextBoxTool : public DrawingProgramToolBase {
|
2025-07-06 20:43:53 +03:00
|
|
|
public:
|
|
|
|
|
TextBoxTool(DrawingProgram& initDrawP);
|
2025-08-02 20:10:33 +03:00
|
|
|
virtual DrawingProgramToolType get_type() override;
|
|
|
|
|
virtual void gui_toolbox() override;
|
|
|
|
|
virtual void tool_update() override;
|
|
|
|
|
virtual void draw(SkCanvas* canvas, const DrawData& drawData) override;
|
2025-08-02 20:39:21 +03:00
|
|
|
virtual void switch_tool(DrawingProgramToolType newTool) override;
|
2025-08-02 20:10:33 +03:00
|
|
|
virtual bool prevent_undo_or_redo() override;
|
2025-07-06 20:43:53 +03:00
|
|
|
private:
|
|
|
|
|
void edit_text(std::function<void()> toRun, const std::shared_ptr<DrawTextBox>& textBox);
|
|
|
|
|
void update_textbox_network(const std::shared_ptr<DrawTextBox>& textBox);
|
|
|
|
|
void commit();
|
|
|
|
|
|
|
|
|
|
struct TextBoxControls {
|
|
|
|
|
Vector2f startAt;
|
|
|
|
|
Vector2f endAt;
|
|
|
|
|
int drawStage = 0;
|
|
|
|
|
std::shared_ptr<DrawTextBox> intermediateItem;
|
|
|
|
|
} controls;
|
|
|
|
|
};
|