1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 09:23:53 +00:00
openmw/apps/opencs/view/widget/scenetooltexturebrush.hpp

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

139 lines
3.5 KiB
C++
Raw Normal View History

#ifndef CSV_WIDGET_SCENETOOLTEXTUREBRUSH_H
#define CSV_WIDGET_SCENETOOLTEXTUREBRUSH_H
#include <QFrame>
#include <QGroupBox>
#ifndef Q_MOC_RUN
#include "brushshapes.hpp"
#include "scenetool.hpp"
#endif
2018-05-16 08:34:58 +00:00
2024-06-12 15:09:28 +00:00
#include <components/esm/refid.hpp>
2018-05-10 18:58:36 +00:00
class QTableWidget;
2022-10-19 17:02:00 +00:00
class QDragEnterEvent;
class QDropEvent;
class QHBoxLayout;
class QLabel;
class QModelIndex;
class QObject;
class QPoint;
class QPushButton;
class QSlider;
class QSpinBox;
class QWidget;
2018-05-26 10:16:02 +00:00
namespace CSVRender
{
class TerrainTextureMode;
}
2022-10-19 17:02:00 +00:00
namespace CSMDoc
{
class Document;
}
namespace CSVWidget
{
2022-10-19 17:02:00 +00:00
class SceneToolbar;
2018-05-26 10:16:02 +00:00
/// \brief Layout-box for some brush button settings
class BrushSizeControls : public QGroupBox
{
Q_OBJECT
public:
BrushSizeControls(const QString& title, QWidget* parent);
private:
QHBoxLayout* mLayoutSliderSize;
2018-05-26 10:16:02 +00:00
QSlider* mBrushSizeSlider;
QSpinBox* mBrushSizeSpinBox;
friend class SceneToolTextureBrush;
friend class CSVRender::TerrainTextureMode;
};
/// \brief Brush settings window
class TextureBrushWindow : public QFrame
{
Q_OBJECT
public:
2020-11-13 07:39:47 +00:00
TextureBrushWindow(CSMDoc::Document& document, QWidget* parent = nullptr);
void configureButtonInitialSettings(QPushButton* button);
2022-09-22 18:26:05 +00:00
2018-05-26 10:16:02 +00:00
const QString toolTipPoint = "Paint single point";
const QString toolTipSquare = "Paint with square brush";
const QString toolTipCircle = "Paint with circle brush";
const QString toolTipCustom = "Paint custom selection (not implemented yet)";
2022-09-22 18:26:05 +00:00
2018-05-26 10:16:02 +00:00
private:
CSVWidget::BrushShape mBrushShape = CSVWidget::BrushShape_Point;
int mBrushSize = 1;
2024-06-12 15:09:28 +00:00
ESM::RefId mBrushTexture;
2018-05-16 08:34:58 +00:00
CSMDoc::Document& mDocument;
QLabel* mSelectedBrush;
QGroupBox* mHorizontalGroupBox;
std::string mBrushTextureLabel;
2018-05-26 10:16:02 +00:00
QPushButton* mButtonPoint;
QPushButton* mButtonSquare;
QPushButton* mButtonCircle;
QPushButton* mButtonCustom;
BrushSizeControls* mSizeSliders;
friend class SceneToolTextureBrush;
friend class CSVRender::TerrainTextureMode;
public slots:
2024-06-12 15:09:28 +00:00
void setBrushTexture(ESM::RefId brushTexture);
void setBrushShape();
void setBrushSize(int brushSize);
signals:
void passBrushSize(int brushSize);
void passBrushShape(CSVWidget::BrushShape brushShape);
2024-06-12 15:09:28 +00:00
void passTextureId(ESM::RefId brushTexture);
};
class SceneToolTextureBrush : public SceneTool
{
Q_OBJECT
QString mToolTip;
2018-05-16 08:34:58 +00:00
CSMDoc::Document& mDocument;
2018-05-10 18:58:36 +00:00
QFrame* mPanel;
QTableWidget* mTable;
2024-06-12 15:09:28 +00:00
std::vector<ESM::RefId> mBrushHistory;
2018-05-26 10:16:02 +00:00
TextureBrushWindow* mTextureBrushWindow;
private:
void adjustToolTips();
2022-09-22 18:26:05 +00:00
public:
2018-05-16 08:34:58 +00:00
SceneToolTextureBrush(SceneToolbar* parent, const QString& toolTip, CSMDoc::Document& document);
void showPanel(const QPoint& position) override;
2018-05-10 18:58:36 +00:00
void updatePanel();
void dropEvent(QDropEvent* event) override;
void dragEnterEvent(QDragEnterEvent* event) override;
2018-05-26 10:16:02 +00:00
friend class CSVRender::TerrainTextureMode;
public slots:
void setButtonIcon(CSVWidget::BrushShape brushShape);
2024-06-12 15:09:28 +00:00
void updateBrushHistory(ESM::RefId mBrushTexture);
2018-05-10 18:58:36 +00:00
void clicked(const QModelIndex& index);
void activate() override;
signals:
void passEvent(QDropEvent* event);
void passEvent(QDragEnterEvent* event);
2024-06-12 15:09:28 +00:00
void passTextureId(ESM::RefId brushTexture);
};
}
#endif