• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

C:/CVUT/diplomka/Automata_editor/sources/label.h

Go to the documentation of this file.
00001 #ifndef LABEL_H_1316851651
00002 #define LABEL_H_1316851651
00003 
00004 #include "stringProcessor.h"
00005 #include <QGraphicsItem>
00006 
00007 class Transition;
00008 
00009 class LabelX : public QGraphicsItem
00010 {
00011 public:
00012     LabelX(Transition *tr, const QString &text, bool leftOriented, 
00013            int fontSize = EDGE_LABEL_SIZE*DEF_LABEL_SCALE, 
00014            const QColor &color = QColor("black"),
00015            float posParam = DEF_EDGE_LAB_POS, const QPointF &pos = QPoint(0,0));
00016 
00017     ~LabelX();
00018 
00019     virtual QRectF boundingRect() const;
00020     virtual QPainterPath shape() const;
00021     virtual void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
00022 
00023     const QString& text() const { return m_text; }
00024     //! check brace matching and if it's incorrect, change isn't applied
00025     bool setText(const QString& text);
00026     
00027     const QColor& color() const { return m_color; }
00028     void setColor(const QColor &color) { m_color = color; update(); }
00029 
00030     bool left() const { return m_leftOriented; }
00031     void setLeftOriented(bool leftOriented) { m_leftOriented = leftOriented;}
00032         
00033     float posParam() const { return m_posParam; }
00034     void setPosParam(float posParam) { m_posParam = posParam; }
00035 
00036     int getWidth() const;
00037     int getHeight() const;
00038 
00039     void setFontSize(int fontSize);
00040 
00041     Transition* getTransition() { return m_pTransition; }
00042 
00043     //! Support method, returns list of used characters in label text. 
00044     //! \sa StringProcessor::getCharacters()
00045     QStringList getCharacters() const;
00046     
00047     //! Support method, returns list of CharcterInfo parsed from label text.
00048     //! \sa StringProcessor::getCharacterList()
00049     StringProcessor::TCharacterList getCharacterList() const;    
00050 
00051 protected:
00052     Transition *m_pTransition;
00053     StringProcessor *m_pStringProcessor;
00054 
00055     virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
00056 
00057     QString m_text;
00058     bool    m_leftOriented;
00059     int     m_fontSize;    
00060     QColor  m_color;
00061     float   m_posParam;
00062 };
00063 
00064 #endif

Generated on Tue Jan 4 2011 03:03:23 for Autoamata editor by  doxygen 1.7.0