Annotation.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef ANNOTATION_H_
00009 #define ANNOTATION_H_
00010 #include <display/QtPlotter/annotations/AnnotationEditor.qo.h>
00011 #include <display/QtPlotter/annotations/PropertyListener.h>
00012 #include <QColor>
00013 #include <QObject>
00014 class QPainter;
00015
00016 namespace casa {
00017
00018 class Annotation : public PropertyListener {
00019 public:
00020 Annotation( QWidget* parent = NULL );
00021
00026 void setDimensionsPosition( int locationX, int locationY );
00027 void setDimensions( int width, int height );
00028
00032 void move( int positionX, int positionY );
00033
00040 bool registerMousePosition( int mouseX, int mouseY );
00041
00047 void mousePositionMoved( int mouseX, int mouseY );
00048 void draw( QPainter* painter );
00049 void setSelected( bool selected );
00050 bool isSelected() const;
00051 bool contains( int posX, int posY) const;
00052 virtual void drawAnnotation( QPainter* painter ) = 0;
00053 void showEditor( );
00054 virtual ~Annotation();
00055 void propertiesChanged();
00056
00057 protected:
00058 AnnotationEditor annotationEditor;
00059 void init();
00060
00061 int pixelX;
00062 int pixelY;
00063 int width;
00064 int height;
00065
00066
00067 int mouseDownX;
00068 int mouseDownY;
00069
00070 private:
00071 enum MouseLocation {TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT, INTERIOR };
00072 bool isInCorner( int cornerX, int cornerY, int mouseX, int mouseY ) const;
00073 void drawCorner( MouseLocation cornerLocation, QPainter* painter, int cornerX, int cornerY );
00074
00075 bool selected;
00076 QColor foregroundColor;
00077 const int CORNER_SIZE;
00078 const int MIN_WIDTH;
00079 const int MIN_HEIGHT;
00080 MouseLocation mouseLocation;
00081 };
00082
00083 }
00084 #endif