text: /****************************************************************************
  Copyright (c) 2010-2012 cocos2d-x.org
  Copyright (c) 2008-2011 Ricardo Quesada
  Copyright (c) 2011      Zynga Inc.
  
  http://www.cocos2d-x.org
  
  Permission is hereby granted, free of charge, to any person obtaining a copy
  of this software and associated documentation files (the "Software"), to deal
  in the Software without restriction, including without limitation the rights
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  copies of the Software, and to permit persons to whom the Software is
  furnished to do so, subject to the following conditions:
  
  The above copyright notice and this permission notice shall be included in
  all copies or substantial portions of the Software.
  
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  THE SOFTWARE.
  ****************************************************************************/
  
  #ifndef __CCMENU_ITEM_H__
  #define __CCMENU_ITEM_H__
  
  #include "base_nodes/CCNode.h"
  #include "CCProtocols.h"
  #include "cocoa/CCArray.h"
  
  NS_CC_BEGIN
  
  /**
   * @addtogroup GUI
   * @{
   * @addtogroup menu
   * @{
   */
  
  /** @brief CCMenuItem base class
   *
   *  Subclass CCMenuItem (or any subclass) to create your custom CCMenuItem objects.
   */
  class CC_DLL CCMenuItem : public CCNode
  {
  protected:
      /** whether or not the item is selected
       @since v0.8.2
       */
      bool m_bSelected;
      bool m_bEnabled;
  
  public:
  	enum
  	{
  		TapBegan,
  		Tapped,
  		TapEnded
  	};
      CCMenuItem();
      /** Creates a CCMenuItem with no target/selector */
      static CCMenuItem* create();
      /** Creates a CCMenuItem with a target/selector */
      static CCMenuItem* create(CCObject *rec, SEL_MenuHandler selector);
      /** Initializes a CCMenuItem with a target/selector */
      bool initWithTarget(CCObject *rec, SEL_MenuHandler selector);
      /** Returns the outside box */
      CCRect rect();
      /** Activate the item */
      virtual void activate();
      /** The item was selected (not activated), similar to "mouse-over" */
      virtual void selected();
      /** The item was unselected */
      virtual void unselected();
  	virtual void cleanup();
  
      virtual bool isEnabled();
      //@note: It's 'setIsEnable' in cocos2d-iphone. 
      virtual void setEnabled(bool value);
      virtual bool isSelected();
      
      /** set the target/selector of the menu item*/
      void setTarget(CCObject *rec, SEL_MenuHandler selector);
  
  protected:
      CCObject* m_pListener;
      SEL_MenuHandler m_pfnSelector;
  	CC_LUA_TYPE(CCMenuItem)
  };
  
  // end of GUI group
  /// @}
  /// @}
  
  NS_CC_END
  
  #endif //__CCMENU_ITEM_H__
  