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
53private Q_SLOTS:
54 void showContextMenu(const QPoint& pos);
55 void disableSelectionActionsPanel();
56 void configureSelectionActionsPanel();
57 void configChanged(bool skipResettingOffset = false);
58 void canvasStateChanged();
59 void themeChanged();
60
61private:
62 void recalculateDimensions();
63
65 QPoint getFixedPosition() const;
66
67 QRectF getWidgetSelectionRect() const;
68
69 QPoint horizontalFreeFloatingTopLeftPosition(bool calculateOnlyAnchor = false) const;
70 QPoint verticalFreeFloatingTopLeftPosition(bool calculateOnlyAnchor = false) const;
71 QPoint freeFloatingInitialTopLeftPosition(bool calculateOnlyAnchor = false) const;
72
73 QPoint clipPositionToCanvasBoundaries(QPoint position, QWidget *canvasWidget) const;
74
75 QPoint currentTopLeftPosition() const;
77
78
79 void drawAnchorWhileMoving(QPainter &painter) const;
80 void drawActionBarBackground(QPainter &gc, const KoColorDisplayRendererInterface *displayRendererInterface) const;
81
82 void drawDebugRectangle(QPainter &painter, Position position);
83 void drawDebugRectanglesForFreeFloatingBehaviour(QPainter &painter);
84
85 bool handlePress(QEvent *event, const QPoint &pos, Qt::MouseButton button = Qt::LeftButton);
86 bool handleMove(QEvent *event, const QPoint &pos);
87 bool handleRelease(QEvent *event);
88
90 void movePanelWidgets();
91
92 QPoint mouseEventPos(const QMouseEvent *mouseEvent);
93 QPoint tabletEventPos(const QTabletEvent *tabletEvent);
94 // Touch events can have zero touch points when pressing an entire palm on
95 // the screen on Android, so this returns false if this is a non-touch.
96 bool touchEventPos(const QTouchEvent *touchEvent, QPoint &outPos);
97
98 QPoint transformHandleCoords(QPoint pos);
99
100 struct Private;
101 QScopedPointer<Private> d;
102};
103
104#endif
SelectionActionsBarPosition
Definition kis_config.h:780
SelectionActionsBarBehavior
Definition kis_config.h:775
SelectionActionsBarOrientation
Definition kis_config.h:791
KisSharedPtr< KisSelectionActionsPanel > KisSelectionActionsPanelSP
QString button(const QWheelEvent &ev)