Warning, file /graphics/glaxnimate/src/gui/tools/draw_tool_base.hpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * SPDX-FileCopyrightText: 2019-2023 Mattia Basaglia <dev@dragon.best>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #pragma once
0008 
0009 #include "base.hpp"
0010 
0011 #include "model/shapes/fill.hpp"
0012 #include "model/shapes/group.hpp"
0013 #include "model/shapes/stroke.hpp"
0014 #include "command/shape_commands.hpp"
0015 
0016 #include "widgets/tools/shape_tool_widget.hpp"
0017 #include "command/undo_macro_guard.hpp"
0018 
0019 
0020 namespace glaxnimate::gui::tools {
0021 
0022 class DrawToolBase : public Tool
0023 {
0024 public:
0025     QCursor cursor() override { return Qt::CrossCursor; }
0026 
0027 protected:
0028     QWidget* on_create_widget() override
0029     {
0030         return new ShapeToolWidget();
0031     }
0032 
0033     void draw_shape(const PaintEvent& event, const QPainterPath& path);
0034 
0035     void create_shape(const QString& command_name, const Event& event,
0036                       std::unique_ptr<model::ShapeElement> shape);
0037 
0038     ShapeToolWidget* widget()
0039     {
0040         return static_cast<ShapeToolWidget*>(get_settings_widget());
0041     }
0042 
0043 
0044     void shape_style_change_event(const glaxnimate::gui::tools::Event & event) override;
0045 
0046 private:
0047 
0048     model::ShapeListProperty* get_container(glaxnimate::gui::SelectionManager* window)
0049     {
0050         return window->current_shape_container();
0051     }
0052 
0053 };
0054 
0055 } // namespace glaxnimate::gui::tools