casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Annotation.h
Go to the documentation of this file.
1 /*
2  * Annotation.h
3  *
4  * Created on: Sep 27, 2012
5  * Author: slovelan
6  */
7 
8 #ifndef ANNOTATION_H_
9 #define ANNOTATION_H_
12 #include <QColor>
13 #include <QObject>
14 class QPainter;
15 
16 namespace casa {
17 
18  class Annotation : public PropertyListener {
19  public:
20  Annotation( QWidget* parent = NULL );
21 
26  void setDimensionsPosition( int locationX, int locationY );
27  void setDimensions( int width, int height );
28 
32  void move( int positionX, int positionY );
33 
40  bool registerMousePosition( int mouseX, int mouseY );
41 
47  void mousePositionMoved( int mouseX, int mouseY );
48  void draw( QPainter* painter );
49  void setSelected( bool selected );
50  bool isSelected() const;
51  bool contains( int posX, int posY) const;
52  virtual void drawAnnotation( QPainter* painter ) = 0;
53  void showEditor( );
54  virtual ~Annotation();
55  void propertiesChanged();
56 
57  protected:
59  void init();
60  //Top left corner of the annotation
61  int pixelX;
62  int pixelY;
63  int width;
64  int height;
65 
66  //Stored reference point for later calculation move amounts
69 
70  private:
72  bool isInCorner( int cornerX, int cornerY, int mouseX, int mouseY ) const;
73  void drawCorner( MouseLocation cornerLocation, QPainter* painter, int cornerX, int cornerY );
74 
75  bool selected;
77  const int CORNER_SIZE;
78  const int MIN_WIDTH;
79  const int MIN_HEIGHT;
81  };
82 
83 } /* namespace casa */
84 #endif /* ANNOTATION_H_ */
Annotation(QWidget *parent=NULL)
void mousePositionMoved(int mouseX, int mouseY)
(mouseX,mouseY) are the new position of the mouse.
virtual void drawAnnotation(QPainter *painter)=0
bool isInCorner(int cornerX, int cornerY, int mouseX, int mouseY) const
int mouseDownX
Stored reference point for later calculation move amounts.
Definition: Annotation.h:67
const int CORNER_SIZE
Definition: Annotation.h:77
AnnotationEditor annotationEditor
Definition: Annotation.h:58
QColor foregroundColor
Definition: Annotation.h:76
bool isSelected() const
virtual ~Annotation()
void draw(QPainter *painter)
const int MIN_HEIGHT
Definition: Annotation.h:79
int pixelX
Top left corner of the annotation.
Definition: Annotation.h:61
MouseLocation mouseLocation
Definition: Annotation.h:80
void setDimensions(int width, int height)
void move(int positionX, int positionY)
Moves the top left corner of the annotation to (positionX, positionY);.
bool registerMousePosition(int mouseX, int mouseY)
Stores the passed in values as reference points so that they can be later used to calculate how much ...
bool contains(int posX, int posY) const
const int MIN_WIDTH
Definition: Annotation.h:78
void drawCorner(MouseLocation cornerLocation, QPainter *painter, int cornerX, int cornerY)
void propertiesChanged()
void setDimensionsPosition(int locationX, int locationY)
Changes the size of the annotation.
void setSelected(bool selected)