21
21
#ifndef ARTISTICTEXTSHAPECONFIGWIDGET_H
22
22
#define ARTISTICTEXTSHAPECONFIGWIDGET_H
24
#include "ui_ArtisticTextShapeConfigWidget.h"
24
#include <ui_ArtisticTextShapeConfigWidget.h>
26
26
#include "ArtisticTextShape.h"
28
28
#include <KoShapeConfigWidgetBase.h>
30
#include <QUndoCommand>
33
30
class ArtisticTextShape;
35
class ArtisticTextShapeConfigWidget : public KoShapeConfigWidgetBase
32
class ArtisticTextShapeConfigWidget : public QWidget
39
36
ArtisticTextShapeConfigWidget();
41
virtual void open(KoShape *shape);
45
virtual bool showOnShapeCreate() { return false; }
47
virtual QUndoCommand * createCommand();
50
class ChangeFont : public QUndoCommand
53
ChangeFont( ArtisticTextShapeConfigWidget *widget, const QFont &font )
54
: m_widget( widget ), m_font( font )
56
m_shape = widget->m_shape;
57
setText( i18n("Change font") );
62
m_shape->setFont( m_oldFont );
63
m_widget->open( m_shape );
69
m_oldFont = m_shape->font();
70
m_shape->setFont( m_font );
71
m_widget->open( m_shape );
75
ArtisticTextShapeConfigWidget *m_widget;
76
ArtisticTextShape *m_shape;
80
class ChangeText : public QUndoCommand
83
ChangeText( ArtisticTextShapeConfigWidget *widget, const QString &text )
84
: m_widget( widget ), m_text( text )
86
m_shape = widget->m_shape;
87
setText( i18n("Change text") );
92
m_shape->setText( m_oldText );
93
m_widget->open( m_shape );
99
m_oldText = m_shape->text();
100
m_shape->setText( m_text );
101
m_widget->open( m_shape );
105
ArtisticTextShapeConfigWidget *m_widget;
106
ArtisticTextShape *m_shape;
110
class ChangeAnchor : public QUndoCommand
113
ChangeAnchor( ArtisticTextShapeConfigWidget *widget, ArtisticTextShape::TextAnchor anchor )
114
: m_widget( widget ), m_anchor( anchor )
116
m_shape = widget->m_shape;
117
setText( i18n("Change text anchor") );
122
m_shape->setTextAnchor( m_oldAnchor );
123
m_widget->open( m_shape );
129
m_oldAnchor = m_shape->textAnchor();
130
m_shape->setTextAnchor( m_anchor );
131
m_widget->open( m_shape );
135
ArtisticTextShapeConfigWidget *m_widget;
136
ArtisticTextShape *m_shape;
137
ArtisticTextShape::TextAnchor m_anchor;
138
ArtisticTextShape::TextAnchor m_oldAnchor;
39
/// initializes widget from given shape
40
void initializeFromShape(ArtisticTextShape *shape, KoCanvasBase *canvas);
42
/// updates the widget form the current one
46
void propertyChanged();
142
49
void blockChildSignals( bool block );
143
50
Ui::ArtisticTextShapeConfigWidget widget;
144
51
ArtisticTextShape * m_shape;
52
KoCanvasBase * m_canvas;
145
53
QButtonGroup * m_anchorGroup;