00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef _PO_BASE_VIEW_
00025 #define _PO_BASE_VIEW_
00026
00027 #include <Inventor/nodekits/SoBaseKit.h>
00028 #include <Inventor/fields/SoSFVec2f.h>
00029 #include <Inventor/SbViewportRegion.h>
00030 #include <Inventor/Gui/SoGui.h>
00031
00032 class SoGuiViewer;
00033
00098 class PoBaseView : public SoBaseKit
00099 {
00100 SO_KIT_ABSTRACT_HEADER(PoBaseView);
00101
00102
00103 SO_KIT_CATALOG_ENTRY_HEADER(cameraKit);
00104
00105 public:
00106
00114 SoSFVec2f viewportOrigin;
00115
00124 SoSFVec2f viewportSize;
00125
00130 SbBool isPointWithinViewport(float x, float y) const;
00131
00142 void setCamera( SoGuiViewer* viewer );
00143
00147 void sensitiveOnEvents(SbBool flag)
00148 { m_isSensitiveOnEvents = flag; }
00149
00153 SbBool isSensitiveOnEvents() const
00154 { return m_isSensitiveOnEvents; }
00155
00171 static PoBaseView* getView( SoGuiViewer* viewer, int mouseX, int mouseY );
00172
00173 #if 1 SoDEPRECATED
00179 static SbBool viewingEventCB( void* SO_UNUSED_PARAM(viewer), void* SO_UNUSED_PARAM(anyEvent) ) { return FALSE; }
00180
00181 #endif
00183
00184 private:
00185 static void initClasses();
00186 static void initClass();
00187 static void exitClass() ;
00188 static void exitClasses() ;
00189
00190
00191 static PoBaseView* getViewCore(SoGuiViewer* viewer, int mouseX, int mouseY, bool testSensitiveToEvents = true);
00192
00193 virtual SbBool getViewportIsEnabled() const;
00194 virtual const SbVec2f getViewportOrigin() const;
00195 virtual const SbVec2f getViewportSize() const;
00196
00197 private:
00198
00199 virtual void setDefaultOnNonWritingFields();
00200
00201
00202 PoBaseView();
00203
00204
00205 virtual ~PoBaseView();
00206
00207 private:
00208
00209 SO_KIT_CATALOG_ENTRY_HEADER(catchActionCallback);
00210
00211
00212 static void catchActionCB(void *, SoAction *);
00213 static void normalizeMousePoint( SoGuiViewer* viewer,
00214 int mouseX, int mouseY,
00215 float& x, float& y );
00216
00217
00218 static SbVec4f m_vvPortion;
00219 static SbVec2s m_currentLogicalViewportSize;
00220 SbBool m_isSensitiveOnEvents;
00221 };
00222
00223
00224
00225 #endif
00226
00227
00228