All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
TextFrame.h
Go to the documentation of this file.
1 /* Copyright (C) 2011-2012 National Institute For Space Research (INPE) - Brazil.
2 
3  This file is part of TerraView - A Free and Open Source GIS Application.
4 
5  TerraView is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  TerraView is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with TerraLib Code Editor. See COPYING. If not, write to
17  TerraLib Team at <terralib-team@dpi.inpe.br>.
18  */
19 
20 /*!
21  \file terralib/qt/widgets/canvas/FrameData.h
22 
23  \brief The main class of FrameData.
24 */
25 
26 #ifndef __TERRALIB_QT_WIDGETS_INTERNAL_TEXT_FRAME_H
27 #define __TERRALIB_QT_WIDGETS_INTERNAL_TEXT_FRAME_H
28 
29 // TerraLib
30 #include "../Config.h"
31 #include "../canvas/MultiThreadMapDisplay.h"
32 #include "Frame.h"
33 
34 // Qt
35 #include <QPixmap>
36 #include <QRect>
37 #include <QRectF>
38 #include <QWidget>
39 
40 class QMenu;
41 class QAction;
42 
43 namespace te
44 {
45  namespace qt
46  {
47  namespace widgets
48  {
49  class LayoutEditor;
50  /*!
51  \class TextFrame
52 
53  \brief A TextFrame ....
54 
55  */
57  {
58  public:
59  TextFrame(const QPointF& p, const QString& s, const int& pointSize, te::qt::widgets::LayoutEditor* me, Qt::WindowFlags f = Qt::Widget);
60 
61  TextFrame(const TextFrame& rhs);
62 
63  virtual ~TextFrame();
64 
65  TextFrame& operator=(const TextFrame& rhs);
66 
67  // apos setar qualquer propriedade chame o metodo adjustSize() para desenhar o texto
68  QString getType();
69  void setText(const QString& t);
70  QString getText();
71  QString getFamily();
72  void setFamily(QString);
73  int getPointSize();
74  void setPointSize(int ps);
75  int getStretch();
76  void setStretch(int s);
77  int getAlign();
78  void setAlign(int);
79  QFont::Style getStyle();
80  void setStyle(QFont::Style);
81  QFont::Weight getWeight();
82  void setWeight(QFont::Weight);
83  QFont::Capitalization getCapitalization();
84  void setCapitalization(QFont::Capitalization);
85  bool getOverline();
86  void setOverline(bool);
87  bool getStrikeOut();
88  void setStrikeOut(bool);
89  bool getUnderline();
90  void setUnderline(bool);
91  double getLetterSpacing();
92  void setLetterSpacing(double);
93  double getWordSpacing();
94  void setWordSpacing(double);
95 
96  void calculateTextRect(QRectF&);
97  void adjust();
98  void adjustSize(QPointF& p);
99  void draw();
100  QRectF getTextRect();
101  QPixmap* getPixmap();
102  void rubberBand();
103  void paintEvent(QPaintEvent* event);
104  void getSelectionPoint(const QPoint& p);
105  QPoint getCenterSelected();
106  void verifyConstraints();
107  void showSelectionPoints();
108  void hideSelectionPoints();
109  QMatrix getAuxMatrix();
110  double getAngle(QPoint&);
111  void adjustAngleRange(double&);
112  void toolTip(const QPoint&, const QString&);
113  QPoint getGlobalPositionCenter();
114  void setCursor();
115  void createMenu();
116  void mousePressEvent(QMouseEvent*);
117  void mouseMoveEvent(QMouseEvent*);
118  void mouseReleaseEvent(QMouseEvent*);
119  void enterEvent(QEvent*);
120  void leaveEvent(QEvent*);
121 
122  public slots:
123  void changeFontFamily();
124  void changeTextColor();
125  void changeText();
126 
127  private:
128  QColor m_cor;
129  QPointF m_point; // text point (bottom left) em milimetros do papel
130  double m_angle; // degree
131  QString m_family;
132  int m_stretch; // default = 100 (normalmente usado entre 50 e 200)
133  int m_align; // Qt::AlignLeft, Qt::AlignHCenter, Qt::AlignRight
134  QFont::Style m_style; // QFont::StyleNormal, QFont::StyleItalic, QFont::StyleOblique
138  double m_letterSpacing; // A value of 100 will keep the spacing unchanged; a value of 200 will enlarge the spacing after a character by the width of the character itself
139  double m_wordSpacing; // A positive value increases the word spacing by a corresponding amount of pixels, while a negative value decreases the inter-word spacing accordingly.
140  QFont::Capitalization m_capitalization; // default = QFont::MixedCase, QFont::AllUppercase,QFont::AllLowercase,QFont::SmallCaps, QFont::Capitalize
141  QFont::Weight m_weight; // QFont::Light, QFont::Normal, QFont::DemiBold, QFont::Bold, QFont::Black
142  QString m_text;
143 
144  bool m_undo;
145  QFont* m_font;
148  double m_auxHeight;
149  double m_auxWidth;
150  double m_auxStretch;
151  double m_auxAngle;
152  double m_iniAngle;
153  double m_refAngle;
154  QPixmap m_pixmap;
155  QMenu *m_menu;
156  QAction *m_setTextAction;
161  };
162  } // end namespace widgets
163  } // end namespace qt
164 } // end namespace te
165 
166 #endif // __TERRALIB_QT_WIDGETS_INTERNAL_TEXT_FRAME_H
QFont::Weight m_weight
Definition: TextFrame.h:141
A TextFrame ....
Definition: TextFrame.h:56
#define TEQTWIDGETSEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:66
QFont::Capitalization m_capitalization
Definition: TextFrame.h:140