ImageView.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef ImageView_H
00019 #define ImageView_H
00020
00021 #include <Gui/MDIView.h>
00022 #include "GLImageBox.h"
00023
00024 class QSlider;
00025 class QAction;
00026 class QActionGroup;
00027 class QPopupMenu;
00028 class QToolBar;
00029
00030 namespace ImageGui
00031 {
00032
00033 class ImageGuiExport ImageView : public Gui::MDIView
00034 {
00035 Q_OBJECT
00036
00037 public:
00038 ImageView(QWidget* parent);
00039 virtual ~ImageView();
00040
00041 const char *getName(void) const {return "ImageView";}
00042 void onUpdate(void){};
00043
00044 bool onMsg(const char* pMsg,const char** ppReturn){ return true; }
00045 bool onHasMsg(const char* pMsg) const { return false; }
00046
00047 virtual void clearImage();
00048 virtual int createImageCopy(void* pSrcPixelData, unsigned long width, unsigned long height, int format, unsigned short numSigBitsPerSample, int displayMode = IV_DISPLAY_RESET);
00049 virtual int pointImageTo(void* pSrcPixelData, unsigned long width, unsigned long height, int format, unsigned short numSigBitsPerSample, bool takeOwnership, int displayMode = IV_DISPLAY_RESET);
00050
00051 virtual void EnableStatusBar(bool Enable);
00052 virtual void EnableToolBar(bool Enable);
00053 virtual void EnableMouseEvents(bool Enable);
00054 virtual void EnableOneToOneAction(bool Enable);
00055 virtual void EnableFitImageAction(bool Enable);
00056 virtual int createColorMap(int numEntriesReq = 0, bool Initialise = true);
00057 virtual void clearColorMap();
00058 virtual int getNumColorMapEntries() const;
00059 virtual int setColorMapRGBAValue(int index, float red, float green, float blue, float alpha = 1.0);
00060 virtual int setColorMapRedValue(int index, float value);
00061 virtual int setColorMapGreenValue(int index, float value);
00062 virtual int setColorMapBlueValue(int index, float value);
00063 virtual int setColorMapAlphaValue(int index, float value);
00064
00065 public Q_SLOTS:
00066 virtual void fitImage();
00067 virtual void oneToOneImage();
00068
00069 protected Q_SLOTS:
00070 virtual void drawGraphics();
00071
00072 protected:
00073 virtual void createActions();
00074 virtual void showOriginalColors();
00075 virtual void mousePressEvent(QMouseEvent* cEvent);
00076 virtual void mouseDoubleClickEvent(QMouseEvent* cEvent);
00077 virtual void mouseMoveEvent(QMouseEvent* cEvent);
00078 virtual void mouseReleaseEvent(QMouseEvent* cEvent);
00079 virtual void wheelEvent(QWheelEvent * cEvent);
00080 virtual void showEvent (QShowEvent * e);
00081
00082 virtual void updateStatusBar();
00083 virtual QString createStatusBarText();
00084
00085 virtual void startDrag();
00086 virtual void zoom(int prevX, int prevY, int currX, int currY);
00087 virtual void select(int currX, int currY);
00088 virtual void addSelect(int currX, int currY);
00089
00090
00091 enum {
00092 nothing = 0,
00093 panning,
00094 zooming,
00095 selection,
00096 addselection
00097 } _currMode;
00098
00099 GLImageBox* _pGLImageBox;
00100
00101 int _currX;
00102 int _currY;
00103 int dragStartWCx;
00104 int dragStartWCy;
00105
00106
00107 QAction* _pFitAct;
00108 QAction* _pOneToOneAct;
00109
00110
00111 QMenu* _pContextMenu;
00112
00113
00114 QToolBar* _pStdToolBar;
00115
00116
00117 bool _statusBarEnabled;
00118 bool _mouseEventsEnabled;
00119 };
00120
00121 }
00122
00123 #endif // ImageView_H