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
00099 class PoBaseView : public SoBaseKit
00100 {
00101 SO_KIT_ABSTRACT_HEADER(PoBaseView);
00102
00103
00104 SO_KIT_CATALOG_ENTRY_HEADER(cameraKit);
00105
00106 public:
00107
00115 SoSFVec2f viewportOrigin;
00116
00125 SoSFVec2f viewportSize;
00126
00131 SbBool isPointWithinViewport(float x, float y) const;
00132
00143 void setCamera( SoGuiViewer* viewer );
00144
00148 void sensitiveOnEvents(SbBool flag)
00149 { m_isSensitiveOnEvents = flag; }
00150
00154 SbBool isSensitiveOnEvents() const
00155 { return m_isSensitiveOnEvents; }
00156
00172 static PoBaseView* getView( SoGuiViewer* viewer, int mouseX, int mouseY );
00173
00174 #if 1 SoDEPRECATED
00180 static SbBool viewingEventCB( void* SO_UNUSED_PARAM(viewer), void* SO_UNUSED_PARAM(anyEvent) ) { return FALSE; }
00181
00182 #endif
00184
00185 private:
00186 static void initClasses();
00187 static void initClass();
00188 static void exitClass() ;
00189 static void exitClasses() ;
00190
00191
00192 static PoBaseView* getViewCore(SoGuiViewer* viewer, int mouseX, int mouseY, bool testSensitiveToEvents = true);
00193
00194 virtual SbBool getViewportIsEnabled() const;
00195 virtual const SbVec2f getViewportOrigin() const;
00196 virtual const SbVec2f getViewportSize() const;
00197
00198 private:
00199
00200 virtual void setDefaultOnNonWritingFields();
00201
00202
00203 PoBaseView();
00204
00205
00206 virtual ~PoBaseView();
00207
00208 private:
00209
00210 SO_KIT_CATALOG_ENTRY_HEADER(catchActionCallback);
00211
00212
00213 static void catchActionCB(void *, SoAction *);
00214 static void normalizeMousePoint( SoGuiViewer* viewer,
00215 int mouseX, int mouseY,
00216 float& x, float& y );
00217
00218
00219 static SbVec4f m_vvPortion;
00220 static SbVec2s m_currentLogicalViewportSize;
00221 SbBool m_isSensitiveOnEvents;
00222 };
00223
00224
00225
00226 #endif
00227
00228
00229