text: ﻿/****************************************************************************
  Copyright (c) 2014 Lijunlin - Jason lee
  
  Created by Lijunlin - Jason lee on 2014
  
  jason.lee.c@foxmail.com
  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 __CCWIDGET_IMAGEVIEWSCALE9_H__
  #define __CCWIDGET_IMAGEVIEWSCALE9_H__
  
  #include "cocos2d.h"
  #include "WidgetMacros.h"
  #include "Widget.h"
  #include "Scale9Sprite.h"
  #include "WidgetProtocol.h"
  
  NS_CC_WIDGET_BEGIN
  
  /**
   * class  : CImageViewScale9
   * author : Jason lee
   * email  : jason.lee.c@foxmail.com
   * descpt : image view scale 9 define 
   */
  class CImageViewScale9 : public CScale9Sprite
  , public CWidget
  , public CClickableProtocol
  , public CLongClickableProtocol
  {
  public:
  	CImageViewScale9();
  	virtual bool init();
  	static CImageViewScale9* create(const Size& size, const char* file);
  	static CImageViewScale9* create(const char* file, Rect rect,  Rect capInsets);
  	static CImageViewScale9* create(const char* file, Rect rect);
  	static CImageViewScale9* create(Rect capInsets, const char* file);
  	static CImageViewScale9* create(const char* file);
  	static CImageViewScale9* createWithSpriteFrame(SpriteFrame* spriteFrame, Rect capInsets);
  	static CImageViewScale9* createWithSpriteFrame(SpriteFrame* spriteFrame); 
  	static CImageViewScale9* createWithSpriteFrameName(const char*spriteFrameName, Rect capInsets);
  	static CImageViewScale9* createWithSpriteFrameName(const char*spriteFrameName);
  	static CImageViewScale9* createWithTexture(Texture2D* pTexture);
  	static CImageViewScale9* createWithTexture(Texture2D* pTexture, Rect capInsets);
  	static CImageViewScale9* create();
  
  public:
  	virtual CWidgetTouchModel onTouchBegan(Touch *pTouch);
  	virtual void onTouchMoved(Touch *pTouch, float fDuration);
  	virtual void onTouchEnded(Touch *pTouch, float fDuration);
  	virtual void onTouchCancelled(Touch *pTouch, float fDuration);
  
  	CC_WIDGET_LONGCLICK_SCHEDULE(CImageViewScale9);
  };
  
  NS_CC_WIDGET_END
  
  #endif //__CCWIDGET_IMAGEVIEWSCALE9_H__