1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-20 11:53:53 +00:00
openmw/apps/opencs/view/widget/scenetoolshapebrush.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

130 lines
3.2 KiB
C++
Raw Normal View History

2019-09-11 09:59:15 +00:00
#ifndef CSV_WIDGET_SCENETOOLSHAPEBRUSH_H
#define CSV_WIDGET_SCENETOOLSHAPEBRUSH_H
#include <QFrame>
#include <QGroupBox>
#include <QSlider>
#include <QSpinBox>
#ifndef Q_MOC_RUN
2019-10-06 23:57:09 +00:00
#include "brushshapes.hpp"
2019-09-11 09:59:15 +00:00
#include "scenetool.hpp"
#endif
2022-10-19 17:02:00 +00:00
class QComboBox;
class QDragEnterEvent;
class QDropEvent;
class QModelIndex;
class QObject;
class QPoint;
class QPushButton;
class QWidget;
namespace CSMDoc
{
class Document;
}
2019-09-11 09:59:15 +00:00
class QTableWidget;
namespace CSVRender
{
class TerrainShapeMode;
}
namespace CSVWidget
{
2022-10-19 17:02:00 +00:00
class SceneToolbar;
2019-09-11 09:59:15 +00:00
/// \brief Layout-box for some brush button settings
class ShapeBrushSizeControls : public QGroupBox
{
Q_OBJECT
public:
ShapeBrushSizeControls(const QString& title, QWidget* parent);
private:
QSlider* mBrushSizeSlider = new QSlider(Qt::Horizontal);
QSpinBox* mBrushSizeSpinBox = new QSpinBox;
2019-09-11 09:59:15 +00:00
friend class SceneToolShapeBrush;
friend class CSVRender::TerrainShapeMode;
};
/// \brief Brush settings window
class ShapeBrushWindow : public QFrame
{
Q_OBJECT
public:
2020-11-13 07:39:47 +00:00
ShapeBrushWindow(CSMDoc::Document& document, QWidget* parent = nullptr);
2019-09-11 09:59:15 +00:00
void configureButtonInitialSettings(QPushButton* button);
2022-09-22 18:26:05 +00:00
2019-09-11 09:59:15 +00:00
const QString toolTipPoint = "Paint single point";
const QString toolTipSquare = "Paint with square brush";
const QString toolTipCircle = "Paint with circle brush";
2019-10-06 23:57:09 +00:00
const QString toolTipCustom = "Paint with custom brush, defined by terrain selection";
2022-09-22 18:26:05 +00:00
2019-09-11 09:59:15 +00:00
private:
CSVWidget::BrushShape mBrushShape = CSVWidget::BrushShape_Point;
int mBrushSize = 1;
2019-09-11 09:59:15 +00:00
CSMDoc::Document& mDocument;
QGroupBox* mHorizontalGroupBox;
QComboBox* mToolSelector;
QSlider* mToolStrengthSlider;
QPushButton* mButtonPoint;
QPushButton* mButtonSquare;
QPushButton* mButtonCircle;
QPushButton* mButtonCustom;
ShapeBrushSizeControls* mSizeSliders;
friend class SceneToolShapeBrush;
friend class CSVRender::TerrainShapeMode;
public slots:
void setBrushShape();
void setBrushSize(int brushSize);
signals:
void passBrushSize(int brushSize);
2019-10-06 23:57:09 +00:00
void passBrushShape(CSVWidget::BrushShape brushShape);
2019-09-11 09:59:15 +00:00
};
class SceneToolShapeBrush : public SceneTool
{
Q_OBJECT
QString mToolTip;
CSMDoc::Document& mDocument;
QFrame* mPanel;
QTableWidget* mTable;
ShapeBrushWindow* mShapeBrushWindow;
private:
void adjustToolTips();
2022-09-22 18:26:05 +00:00
public:
2019-09-11 09:59:15 +00:00
SceneToolShapeBrush(SceneToolbar* parent, const QString& toolTip, CSMDoc::Document& document);
void showPanel(const QPoint& position) override;
2019-09-11 09:59:15 +00:00
void updatePanel();
void dropEvent(QDropEvent* event) override;
void dragEnterEvent(QDragEnterEvent* event) override;
2019-09-11 09:59:15 +00:00
friend class CSVRender::TerrainShapeMode;
public slots:
2019-10-06 23:57:09 +00:00
void setButtonIcon(CSVWidget::BrushShape brushShape);
2019-09-11 09:59:15 +00:00
void clicked(const QModelIndex& index);
void activate() override;
2019-09-11 09:59:15 +00:00
signals:
void passEvent(QDropEvent* event);
void passEvent(QDragEnterEvent* event);
};
}
#endif