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