Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_selection_actions_panel.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2025 Ross Rosales <ross.erosales@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef _KIS_SELECTION_ACTIONS_PANEL_H_
8#define _KIS_SELECTION_ACTIONS_PANEL_H_
9
10#include "kis_config.h"
11#include "kis_types.h"
12#include <QColor>
13#include <QObject>
14#include <QPointF>
15#include <QPushButton>
16
17#include "KoPointerEvent.h"
18#include "KoSnapGuide.h"
20#include "kis_icon_utils.h"
22#include <kritaui_export.h>
23
24class KisCanvas2;
26class KisViewManager;
28
31
35
36class KRITAUI_EXPORT KisSelectionActionsPanel : public QObject
37{
38 Q_OBJECT
39public:
43
44 void draw(QPainter &painter, const KoColorDisplayRendererInterface *displayRendererInterface);
45 void setVisible(bool visible);
46 void setEnabled(bool enabled);
47 bool eventFilter(QObject *obj, QEvent *event) override;
48 void setOrientation(Orientation orientation);
49 void setHandleEnabled(bool enabled);
50
51 void canvasWidgetChanged(KisCanvasWidgetBase* canvas);
52
53 void updatePositioning();
54
55private Q_SLOTS:
56 void showContextMenu(const QPoint& pos);
57 void disableSelectionActionsPanel();
58 void configureSelectionActionsPanel();
59 void configChanged(bool skipResettingOffset = false);
60 void canvasStateChanged();
61 void themeChanged();
62
63private:
64 void recalculateDimensions();
65
67 QPoint getFixedPosition() const;
68
69 QRectF getWidgetSelectionRect() const;
70
71 QPoint horizontalFreeFloatingTopLeftPosition(bool calculateOnlyAnchor = false) const;
72 QPoint verticalFreeFloatingTopLeftPosition(bool calculateOnlyAnchor = false) const;
73 QPoint freeFloatingInitialTopLeftPosition(bool calculateOnlyAnchor = false) const;
74
75 QPoint clipPositionToCanvasBoundaries(QPoint position, QWidget *canvasWidget) const;
76
77 QPoint currentTopLeftPosition() const;
79
80
81 void drawAnchorWhileMoving(QPainter &painter) const;
82 void drawActionBarBackground(QPainter &gc, const KoColorDisplayRendererInterface *displayRendererInterface) const;
83
84 void drawDebugRectangle(QPainter &painter, Position position);
85 void drawDebugRectanglesForFreeFloatingBehaviour(QPainter &painter);
86
87 bool handlePress(QEvent *event, const QPoint &pos, Qt::MouseButton button = Qt::LeftButton);
88 bool handleMove(QEvent *event, const QPoint &pos);
89 bool handleRelease(QEvent *event);
90
92 void movePanelWidgets();
93
94 QPoint mouseEventPos(const QMouseEvent *mouseEvent);
95 QPoint tabletEventPos(const QTabletEvent *tabletEvent);
96 // Touch events can have zero touch points when pressing an entire palm on
97 // the screen on Android, so this returns false if this is a non-touch.
98 bool touchEventPos(const QTouchEvent *touchEvent, QPoint &outPos);
99
100 QPoint transformHandleCoords(QPoint pos);
101
102 struct Private;
103 QScopedPointer<Private> d;
104};
105
106#endif
SelectionActionsBarPosition
Definition kis_config.h:802
SelectionActionsBarBehavior
Definition kis_config.h:797
SelectionActionsBarOrientation
Definition kis_config.h:813
KisSharedPtr< KisSelectionActionsPanel > KisSelectionActionsPanelSP
QString button(const QWheelEvent &ev)