MeVisLabToolboxReference
MeVisLab/Standard/Sources/Inventor/SoUtils/SoFocusElement.h
Go to the documentation of this file.
00001 // **InsertLicense** code
00002 //----------------------------------------------------------------------------------
00004 
00011 //----------------------------------------------------------------------------------
00012 
00013 #ifndef __SoFocusElement_H
00014 #define __SoFocusElement_H
00015 
00016 #ifndef __SoUtilsSystem_H
00017 #include "SoUtilsSystem.h"
00018 #endif
00019 
00020 #include <Inventor/elements/SoReplacedElement.h>
00021 #include <Inventor/events/SoEvent.h>
00022 
00024 enum FocusState {
00025   FS_FOCUS,   
00026   FS_NO_FOCUS,
00027 };
00029 class SbFocusInfo
00030 {
00031   public:
00033     FocusState state;
00034 
00039     SbVec2f normClickCoords;
00040          
00042     SbFocusInfo() {
00043       state = FS_NO_FOCUS;
00044       normClickCoords = SbVec2f(0,0);
00045     }
00046     
00048     SbFocusInfo(FocusState state, SbVec2f normClickCoords) {
00049       this->state = state;
00050       this->normClickCoords = normClickCoords;
00051     }
00052     
00054     int operator==(const SbFocusInfo &i) const {
00055       return ( (state == i.state) &&
00056                (normClickCoords == i.normClickCoords));
00057     }
00058 };
00059 
00061 class SOUTILS_EXPORT SoFocusElement : public SoReplacedElement {
00062 
00063     SO_ELEMENT_HEADER(SoFocusElement);
00064 
00065   public:
00067     virtual void init(SoState *state);
00068 
00071     static const SbFocusInfo& get(SoState *state);
00072 
00074     SbFocusInfo getDefault();
00075 
00077     static void set(SoState *state, SoNode *node, const SbFocusInfo& focusInfo);
00078 
00079   SoINTERNAL public:
00081     static void     initClass();
00082 
00083   protected:
00085     SbFocusInfo _focusInfo;
00086 };
00087 
00088 #endif