CCKeypadDispatcher


#ifndef __CCKEYPAD_DISPATCHER_H__

#define __CCKEYPAD_DISPATCHER_H__


#include "CCKeypadDelegate.h"

#include "cocoa/CCArray.h"


NS_CC_BEGIN


/**

 * @addtogroup input

 * @{

 */


typedef enum {

    // the back key clicked msg

    kTypeBackClicked = 1,

    kTypeMenuClicked,

} ccKeypadMSGType;


struct _ccCArray;

/**

@class CCKeypadDispatcher

@brief Dispatch the keypad message from the phone

*/

class CC_DLL CCKeypadDispatcher : public CCObject

{

public:

    CCKeypadDispatcher();

    ~CCKeypadDispatcher();


    /**

    @brief add delegate to concern keypad msg

    */

    void addDelegate(CCKeypadDelegate* pDelegate);


    /**

    @brief remove the delegate from the delegates who concern keypad msg

    */

    void removeDelegate(CCKeypadDelegate* pDelegate);


    /**

    @brief force add the delegate

    */

    void forceAddDelegate(CCKeypadDelegate* pDelegate);


    /**

    @brief force remove the delegate

    */

    void forceRemoveDelegate(CCKeypadDelegate* pDelegate);


    /**

    @brief dispatch the key pad msg

    */

    bool dispatchKeypadMSG(ccKeypadMSGType nMsgType);


protected:


    CCArray* m_pDelegates;

    bool m_bLocked;

    bool m_bToAdd;

    bool m_bToRemove;


    struct _ccCArray *m_pHandlersToAdd;

    struct _ccCArray *m_pHandlersToRemove;

};


// end of input group

/// @} 


NS_CC_END


#endif //__CCKEYPAD_DISPATCHER_H__


posted @ 2014-05-21 19:08  sssssnian  阅读(128)  评论(0)    收藏  举报