zoukankan      html  css  js  c++  java
  • ENGINE_API CXSroll

    #ifndef __XSROLL_H__
    #define __XSROLL_H__
    
    #include "CocoHead.h"
    #include "XWindow.h"
    
    
    class ENGINE_API CXSroll : public CXWindow
    {
    public:
        enum XSrollType
        {
            _SrollDirectionVertical        = 0,        //垂直
            _SrollDirectionHorizontal    = 1,        //水平    
            _SrollVerticalTable            = 2,        //垂直选项(Table类型)
            _SrollHorizontalTable        = 3,        //水平选项(Table类型)
            _SrollDirectionBoth            = 4,
        };
    
    public:
        CXSroll();
        virtual ~CXSroll();
    
        static CXSroll*        create(int nId, CCPoint tPos, CCRect rect, const char* psPic = NULL, CXWindow* pParentWnd = NULL);
    
        virtual bool        init( int nId, CCPoint tPos, CCRect rect, const char* psPic = NULL, CXWindow* pParentWnd = NULL );
    
        virtual UI_TYPE        getUIType();
    
        void                setSrollType(CXSroll::XSrollType eSrollType);
        CXSroll::XSrollType getSrollType();
    
        void                addItem(CXWindow* pWnd);
        void                addItem(CXWindow* pWnd, int nZOrder);
    
        void                setBounds(float fBounds);
        float                getBounds();
    
        CXWindow*            getItemChildById(int nItemId, int nChildId);
        deque<CXWindow*>*    getItemDequeById(int nItemId);
        map<CXWindow*, deque<CXWindow*> >&    getMapItem();
        
    
        void                setTouchDistribute(bool bDistribute);
    
        void                setItemEnabled(unsigned int wIndex,unsigned int wCount);
    
        void                setDisableDrag(bool bDisable);
    
    protected:
    
        virtual void        visit();
    
        virtual bool        onMouseDown(CCTouch *pTouch, CCEvent *pEvent);
        virtual void        onMouseUp(CCTouch *pTouch, CCEvent *pEvent);
        virtual void        onMouseMove(CCTouch *pTouch, CCEvent *pEvent);
    
    
        void                setItemPos(CXWindow* pWnd);
    
        void                deaccelerateScrolling(float dt);
    
        void                clippingToBounds(float dt);
    
    private:
        CCNode*                        m_pContainer;
        map<CXWindow*, deque<CXWindow*> >    m_mapItem; //集装箱字典
        deque<CXWindow*>                    m_dequeItem;
        vector<CXWindow*>                    m_vecItem;//防止m_mapItem无序
    
        XSrollType                    m_eSrollType;
        float                        m_fItemPosLenght;    //总长度
    
        bool                        m_bSelected;
        CCPoint                        m_tUnitMoveDist;
        CCPoint                        m_tOriginalPos;
        CCPoint                        m_tEndPos;
        
        CCPoint                        m_tContainerDownPos;
        CCPoint                        m_tContainerUpPos;
        CCPoint                        m_tContainerDragDist;
    
        unsigned int                m_nTableFocusIndex;
        float                        m_fBounds;
        int                            m_nTableDragDistFold;
    
        //
        CXWindow*                    m_pFocusWnd;
        bool                        m_bFocusWndClick;
        bool                        m_bDistributeTouch;
    
        bool                        m_bDisableDrag;
    
    
    };
    
    #endif//__XSROLL_H__
  • 相关阅读:
    3.2 Program Encodings 程序编码
    Describe your home
    Building vs solution in command line
    找到适合自己的人生轨迹 Angkor:
    每个月总有那么几天不想学习,不想写代码 Angkor:
    Linux下的Memcache安装
    敏捷开发之 12条敏捷原则
    为什么要用NIO
    memcached server LRU 深入分析
    Linux 脚本编写基础
  • 原文地址:https://www.cnblogs.com/newlist/p/3151201.html
Copyright © 2011-2022 走看看