• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

XnVSelectableSlider2D.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 *                                                                              *
00003 *   PrimeSense NITE 1.3                                                        *
00004 *   Copyright (C) 2010 PrimeSense Ltd.                                         *
00005 *                                                                              *
00006 *******************************************************************************/
00007 
00008 
00009 #ifndef _XNV_SELECTABLE_SLIDER_2D_H_
00010 #define _XNV_SELECTABLE_SLIDER_2D_H_
00011 
00012 #include <XnOpenNI.h>
00013 #include "XnVNiteDefs.h"
00014 #include "XnVPointControl.h"
00015 #include "XnVDirection.h"
00016 #include "XnVSlider2D.h"
00017 #include "XnVMultiItemHysteresis2D.h"
00018 #include "XnVSlider1D.h"
00019 #include "XnVMultiItemHysteresis1D.h"
00020 
00021 class XnVBorderScrollController2D;
00022 
00029 class XNV_NITE_API XnVSelectableSlider2D :
00030     public XnVPointControl
00031 {
00032 public:
00036     typedef void (XN_CALLBACK_TYPE *ItemHoverCB)(XnInt32 nXIndex, XnInt32 nYIndex, void* pUserCxt);
00040     typedef void (XN_CALLBACK_TYPE *ItemSelectCB)(XnInt32 nXIndex, XnInt32 nYIndex, XnVDirection eDir, void* pUserCxt);
00044     typedef void (XN_CALLBACK_TYPE *OffAxisMovementCB)(XnVDirection eDir, void* pUserCxt);
00049     typedef void (XN_CALLBACK_TYPE *ValueChangeCB)(XnFloat fXValue, XnFloat fYValue, void* pUserCxt);
00054     typedef void (XN_CALLBACK_TYPE *ScrollCB)(XnFloat fXValue, XnFloat fYValue, void* pUserCxt);
00055 
00067     XnVSelectableSlider2D(XnInt32 nXItems, XnInt32 nYItems,
00068         XnFloat fSliderSizeX = ms_fDefaultSliderSize, XnFloat fSliderSizeY = ms_fDefaultSliderSize,
00069         XnFloat fBorderWidth = 0, const XnChar* strName = "XnVSelectableSlider2D");
00070     virtual ~XnVSelectableSlider2D();
00071 
00078     void OnPrimaryPointCreate(const XnVHandPointContext* pContext, const XnPoint3D& ptFocus);
00085     void OnPrimaryPointUpdate(const XnVHandPointContext* pContext);
00091     void OnPrimaryPointDestroy(XnUInt32 nID);
00092 
00101     XnCallbackHandle RegisterItemHover(void* cxt, ItemHoverCB CB);
00110     XnCallbackHandle RegisterScroll(void* cxt, ScrollCB CB);
00119     XnCallbackHandle RegisterValueChange(void* cxt, ValueChangeCB CB);
00128     XnCallbackHandle RegisterItemSelect(void* cxt, ItemSelectCB CB);
00137     XnCallbackHandle RegisterOffAxisMovement(void* cxt, OffAxisMovementCB CB);
00138 
00144     void UnregisterItemHover(XnCallbackHandle hCB);
00150     void UnregisterScroll(XnCallbackHandle hCB);
00156     void UnregisterValueChange(XnCallbackHandle hCB);
00162     void UnregisterItemSelect(XnCallbackHandle hCB);
00168     void UnregisterOffAxisMovement(XnCallbackHandle hCB);
00169 
00170     static const XnFloat ms_fDefaultSliderSize; // = 450
00171 
00177     void Reposition(const XnPoint3D& ptCenter);
00178     void GetCenter(XnPoint3D& ptCenter) const;
00179 
00186     void GetSliderSize(XnFloat& fSliderXSize, XnFloat& fSliderYSize) const;
00193     void SetSliderSize(XnFloat fSliderXSize, XnFloat fSliderYSize);
00194 
00200     XnUInt32 GetItemXCount() const;
00206     XnUInt32 GetItemYCount() const;
00213     void SetItemCount(XnUInt32 nItemXCount, XnUInt32 nItemYCount);
00219     void SetItemXCount(XnUInt32 nItemXCount);
00225     void SetItemYCount(XnUInt32 nItemYCount);
00226 
00232     void SetValueChangeOnOffAxis(XnBool bReport);
00236     XnBool GetValueChangeOnOffAxis() const;
00237 
00243     XnFloat GetBorderWidth() const;
00249     XnStatus SetBorderWidth(XnFloat fWidth);
00256     void SetHysteresisRatio(XnFloat fRatio);
00262     XnFloat GetHysteresisRatio() const;
00263 protected:
00264     XN_DECLARE_EVENT_3ARG(XnVItemSelectSpecificEvent, XnVItemSelectEvent, XnInt32, nItemX, XnInt32, nItemY, XnVDirection, eDir);
00265 
00266     void UpdateSlider(XnFloat fXValue, XnFloat fYValue);
00267 
00268     void PointDeleted(XnBool bReason);
00269     void PointMoved(const XnPoint3D& pt, XnFloat fTime);
00270 
00271     // Invoke events
00272     void ItemHover(XnInt32 nXIndex, XnInt32 nYIndex);
00273     void Scroll(XnFloat fXValue, XnFloat fYValue);
00274     void ValueChange(XnFloat fXValue, XnFloat fYValue);
00275     void ItemSelect(XnVDirection eDir);
00276     void OffAxisMovement(XnVDirection eDir);
00277 
00278     // Callbacks
00279     static void XN_CALLBACK_TYPE Slider_ValueChange(XnFloat fXValue, XnFloat fYValue, void* pContext);
00280     static void XN_CALLBACK_TYPE Slider_OffAxis(XnVDirection eDir, void* cxt);
00281     static void XN_CALLBACK_TYPE Hysteresis_ItemSelected(XnInt32 nXItem, XnInt32 nYItem, void* pContext);
00282     static void XN_CALLBACK_TYPE Scroller2D_Scrolled(XnFloat fXValue, XnFloat fYValue, void *pContext);
00283 
00284     static void XN_CALLBACK_TYPE SecondarySlider_OffAxisMovement(XnVDirection eDir, void* cxt);
00285     static void XN_CALLBACK_TYPE SecondarySlider_ValueChange(XnFloat fValue, void* cxt);
00286     static void XN_CALLBACK_TYPE OffAxisHysteresis_ItemSelected(XnInt32 nItem, void* cxt);
00287 
00288     static const XnFloat ms_fSecondarySliderSize;
00289     XnBool m_bValueChangeWithoutBorders;
00290 
00291     XnBool m_bPositioned;
00292     XnInt32 m_nXItems, m_nYItems;
00293 
00294     XnBool m_bValueChangeOnOffAxis;
00295 
00296     XnFloat m_fSliderSizeX;
00297     XnFloat m_fSliderSizeY;
00298     XnFloat m_fBorderWidth;
00299     XnVSlider2D* m_pSlider;
00300     XnVMultiItemHysteresis2D* m_pHysteresis;
00301     XnVBorderScrollController2D* m_pScroller;
00302 
00303     XnBool m_bInOffAxis;
00304     XnVSlider1D* m_pSecondarySlider;
00305     XnVMultiItemHysteresis1D* m_pOffAxisHysteresis;
00306 
00307     XnPoint3D m_ptCenter;
00308 
00309     XnInt32 m_nXLastHover, m_nYLastHover;
00310 
00311     XnCallbackHandle m_hHysteresisItemSelect;
00312     XnCallbackHandle m_hScrollerScroll;
00313     XnCallbackHandle m_hSliderValueChange;
00314     XnCallbackHandle m_hSliderOffAxis;
00315 
00316     XnCallbackHandle m_hOffAxisHysteresisItemSelect;
00317     XnCallbackHandle m_hSecondarySliderValueChange;
00318     XnCallbackHandle m_hSecondarySliderOffAxis;
00319 
00320     XnVIntIntSpecificEvent m_ItemHoverCBs;
00321     XnVFloatFloatSpecificEvent m_ScrollCBs;
00322     XnVFloatFloatSpecificEvent m_ValueChangeCBs;
00323     XnVItemSelectSpecificEvent m_ItemSelectCBs;
00324     XnVDirectionSpecificEvent m_OffAxisMovementCBs;
00325 };
00326 
00327 #endif // _XNV_SELECTABLE_SLIDER_2D_H_

Generated on Tue Jul 19 2011 20:22:59 for NITE 1.4.1 - API Reference by  doxygen 1.7.1