|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef DVTEXTEDIT_H
|
|
Toshihiro Shimizu |
890ddd |
#define DVTEXTEDIT_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Toshihiro Shimizu |
890ddd |
#pragma warning(disable : 4251)
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tpixel.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <qwidget></qwidget>
|
|
Toshihiro Shimizu |
890ddd |
#include <qstring></qstring>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtextedit></qtextedit>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class QLabel;
|
|
Toshihiro Shimizu |
890ddd |
class QLineEdit;
|
|
Toshihiro Shimizu |
890ddd |
class QToolBar;
|
|
Toshihiro Shimizu |
890ddd |
class QAction;
|
|
Toshihiro Shimizu |
890ddd |
class QActionGroup;
|
|
Toshihiro Shimizu |
890ddd |
class QFontComboBox;
|
|
Toshihiro Shimizu |
890ddd |
class QComboBox;
|
|
Toshihiro Shimizu |
890ddd |
class QImage;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TOONZQT_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace DVGui {
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class ColorField;
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DvMiniToolBar final : public QFrame {
|
|
Shinya Kitaoka |
120a6e |
QPoint m_dragPos;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
DvMiniToolBar(QWidget *parent = 0);
|
|
Shinya Kitaoka |
120a6e |
~DvMiniToolBar();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseMoveEvent(QMouseEvent *) override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DvTextEditButton final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
DvTextEditButton(QWidget *parent = 0);
|
|
Shinya Kitaoka |
120a6e |
~DvTextEditButton();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
void clicked();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI DvTextEdit final : public QTextEdit {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_paintMode;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_miniToolBarEnabled;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QPoint m_mousePos;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QComboBox *m_sizeComboBox;
|
|
Shinya Kitaoka |
120a6e |
QFontComboBox *m_fontComboBox;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QActionGroup *m_alignActionGroup;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QAction *m_boldAction, *m_italicAction, *m_underlineAction,
|
|
Shinya Kitaoka |
120a6e |
*m_alignLeftAction, *m_alignRightAction, *m_alignCenterAction;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ColorField *m_colorField;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
DvMiniToolBar *m_miniToolBar;
|
|
Shinya Kitaoka |
120a6e |
DvTextEditButton *m_button;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
DvTextEdit(QWidget *parent = 0);
|
|
Shinya Kitaoka |
120a6e |
~DvTextEdit();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setMiniToolBarEnabled(bool value) { m_miniToolBarEnabled = value; }
|
|
Shinya Kitaoka |
120a6e |
void changeFont(const QFont &f);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
void createActions();
|
|
Shinya Kitaoka |
120a6e |
void createMiniToolBar();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void showMiniToolBar(const QPoint &pos);
|
|
Shinya Kitaoka |
120a6e |
void hideMiniToolBar();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseMoveEvent(QMouseEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseReleaseEvent(QMouseEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void wheelEvent(QWheelEvent *) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void focusInEvent(QFocusEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void focusOutEvent(QFocusEvent *) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void dragMoveEvent(QDragMoveEvent *) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
void fontChanged(const QFont &f);
|
|
Shinya Kitaoka |
120a6e |
void colorChanged(const QColor &c);
|
|
Shinya Kitaoka |
120a6e |
void alignmentChanged(Qt::Alignment a);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onCurrentCharFormatChanged(const QTextCharFormat &format);
|
|
Shinya Kitaoka |
120a6e |
void onCursorPositionChanged();
|
|
Shinya Kitaoka |
120a6e |
void onSelectionChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onShowMiniToolBarClicked();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setTextFamily(const QString &);
|
|
Shinya Kitaoka |
120a6e |
void setTextColor(const TPixel32 &color, bool isDragging);
|
|
Shinya Kitaoka |
120a6e |
void setTextBold();
|
|
Shinya Kitaoka |
120a6e |
void setTextItalic();
|
|
Shinya Kitaoka |
120a6e |
void setTextUnderline();
|
|
Shinya Kitaoka |
120a6e |
void setTextSize(const QString &p);
|
|
Shinya Kitaoka |
120a6e |
void setTextAlign(QAction *);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void focusIn();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Shinya Kitaoka |
120a6e |
} // namespace DVGui
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // DVTEXTEDIT_H
|