2026-05-11 23:06:39 +03:00
|
|
|
/*
|
|
|
|
|
* InfiniPaint
|
|
|
|
|
* Copyright (C) 2025-2026 Yousef Khadadeh
|
|
|
|
|
*
|
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-07-06 20:43:53 +03:00
|
|
|
#pragma once
|
2025-08-02 20:10:33 +03:00
|
|
|
#include "DrawingProgramToolBase.hpp"
|
2025-07-06 20:43:53 +03:00
|
|
|
#include <Helpers/SCollision.hpp>
|
2025-12-26 10:40:58 +03:00
|
|
|
#include "../../CanvasComponents/CanvasComponentContainer.hpp"
|
2025-07-06 20:43:53 +03:00
|
|
|
|
|
|
|
|
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;
|
2026-04-12 12:36:00 +03:00
|
|
|
virtual void gui_toolbox(Toolbar& t) override;
|
2026-04-30 12:09:03 +03:00
|
|
|
virtual void gui_phone_toolbox(PhoneDrawingProgramScreen& t) override;
|
2026-04-12 12:36:00 +03:00
|
|
|
virtual void right_click_popup_gui(Toolbar& t, Vector2f popupPos) override;
|
2025-12-30 19:46:08 +03:00
|
|
|
virtual void erase_component(CanvasComponentContainer::ObjInfo* erasedComp) override;
|
2025-08-02 20:10:33 +03:00
|
|
|
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;
|
2026-03-03 10:18:47 +03:00
|
|
|
virtual void input_mouse_button_on_canvas_callback(const InputManager::MouseButtonCallbackArgs& button) override;
|
|
|
|
|
virtual void input_mouse_motion_callback(const InputManager::MouseMotionCallbackArgs& motion) override;
|
2025-07-06 20:43:53 +03:00
|
|
|
private:
|
2026-05-18 18:35:40 +03:00
|
|
|
bool commitUpdate = false;
|
|
|
|
|
|
2025-07-06 20:43:53 +03:00
|
|
|
void commit();
|
2026-05-16 20:40:23 +03:00
|
|
|
void make_sure_textbox_is_big();
|
2025-07-06 20:43:53 +03:00
|
|
|
|
2025-12-15 15:36:42 +03:00
|
|
|
Vector2f startAt;
|
|
|
|
|
Vector2f endAt;
|
2025-12-30 23:12:30 +03:00
|
|
|
CanvasComponentContainer::ObjInfo* objInfoBeingEdited = nullptr;
|
2025-07-06 20:43:53 +03:00
|
|
|
};
|