Example #1
0
Button::Button(int style, char** label, float x, float y, float width, float height)
		: active(false),
		  selected(false),
		  normalImage(0),
		  focusImage(0),
		  selectedImage(0),
		  selectedFocusImage(0),
		  buttonText(label),
		  buttonStyle(style),
		  labelMode(LABEL_CENTER),
		  labelScissor(0),
		  StartTime(0),
		  x(x),
		  y(y),
		  width(width),
		  height(height),
		  fontSize(1.0),
		  clickedFunc(0),
		  returnFunc(0)
{
						//Focus color			Inactive color		  Active color			Selected color		  Label color
	GXColor colors[5] = {{255, 100, 100, 255}, {255, 255, 255,  70}, {255, 255, 255, 130}, {255, 255, 255, 255}, {255, 255, 255, 255}};

	setType(TYPE_BUTTON);
	switch(buttonStyle)
	{
	case BUTTON_DEFAULT:
		setNormalImage(Resources::getInstance().getImage(Resources::IMAGE_DEFAULT_BUTTON));
		setFocusImage(Resources::getInstance().getImage(Resources::IMAGE_DEFAULT_BUTTONFOCUS));
		setSelectedImage(Resources::getInstance().getImage(Resources::IMAGE_DEFAULT_BUTTONFOCUS));
		break;
	case BUTTON_STYLEA_NORMAL:
		setNormalImage(Resources::getInstance().getImage(Resources::IMAGE_STYLEA_BUTTON));
		setFocusImage(Resources::getInstance().getImage(Resources::IMAGE_STYLEA_BUTTONFOCUS));
		height = 56;
		break;
	case BUTTON_STYLEA_SELECT:
		setNormalImage(Resources::getInstance().getImage(Resources::IMAGE_STYLEA_BUTTONSELECTOFF));
		setFocusImage(Resources::getInstance().getImage(Resources::IMAGE_STYLEA_BUTTONSELECTOFFFOCUS));
		setSelectedImage(Resources::getInstance().getImage(Resources::IMAGE_STYLEA_BUTTONSELECTON));
		setSelectedFocusImage(Resources::getInstance().getImage(Resources::IMAGE_STYLEA_BUTTONSELECTONFOCUS));
		height = 56;
		break;
	}
	if (buttonStyle != BUTTON_DEFAULT)
	{
		colors[0] = (GXColor) {255, 255, 255, 255};
		colors[1] = (GXColor) {200, 200, 200, 255};
		colors[2] = (GXColor) {255, 255, 255, 255};
	}

	setButtonColors(colors);
}
Example #2
0
bool CommonButton::initWithNode(Node *  normalNode, Node *  selectedNode,
                                Node *  disabledNode, int nEventID,
                                const char *  btnStr, const char *  btnBottomStr){
	m_bEnabled = true;
	m_bSelected = false;
	setNormalImage(normalNode);
	setSelectedImage(selectedNode);
	setDisabledImage(disabledNode);

	float scaleEle = GameConfig::getInterface()->scaleEle;
	float scaleEleX = GameConfig::getInterface()->scaleEleX;

	if (g_defaultBtnFontType == 2){
		m_label = CCLabelBMFont::create(btnStr, g_defaultBtnStringTnf.c_str());
		m_pBottomlabel = CCLabelBMFont::create(btnBottomStr, g_defaultBtnStringTnf.c_str());
	}else{
		m_label = CCLabelTTF::create(btnStr, "黑体", 40);
		m_pBottomlabel = CCLabelTTF::create(btnBottomStr, "黑体", 40);
	}
    
	m_label->setPosition(ccp(getContentSize().width/2, getContentSize().height/2));
	m_pBottomlabel->setPosition(ccp((getContentSize().width/2) + 75, -20));
	setFontColor(ccWHITE);
	addChild(m_label, 100);
	addChild(m_pBottomlabel, 101);

	return true;
}
//--------------------------------------------------------------------
bool FKCW_UI_MenuItemProgressTimer::_Init(CCSprite* mask, CCSprite* normalSprite, CCSprite* disabledSprite,
			float interval, CCProgressTimerType type, CCObject* target, SEL_MenuHandler selector)
{
	assert(normalSprite);

	CCMenuItem::initWithTarget(target, selector);

	setNormalImage(normalSprite);
	setDisabledImage(disabledSprite);

	mProgressTimer = new CCProgressTimer();
	mInterval = interval;
	setMaskImage(mask);
	mProgressTimer->setPosition( ccp(normalSprite->getContentSize().width / 2,
		normalSprite->getContentSize().height / 2) );
	mProgressTimer->setType(type);
	mProgressTimer->setPercentage(0);

	this->addChild(mProgressTimer);

	mType = type;
	this->setContentSize(normalSprite->getContentSize());

	return true;
}
void CCMenuItemImageBMF::setNormalSpriteFrameName( const char* pszFrameName )
{
	if (pszFrameName)
	{
		setNormalImage(CCSprite::createWithSpriteFrameName(pszFrameName));
	}
}
Example #5
0
	bool CCMenuItemSprite::initFromNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, SelectorProtocol* target, SEL_MenuHandler selector)
	{
		assert(normalSprite != NULL);
		CCMenuItem::initWithTarget(target, selector); 
        setNormalImage(normalSprite);
        setSelectedImage(selectedSprite);
        setDisabledImage(disabledSprite);

		this->setContentSize(m_pNormalImage->getContentSize());
		return true;
	}
Example #6
0
void SkillItem::setEnableIcon(string icon)
{
    if(!FileUtils::getInstance()->isFileExist(icon.c_str()))
     return;
    
    m_enableIcon = icon;
    Sprite* sprite = Sprite::create(m_enableIcon.c_str());
    if(!sprite)
      return;
    
    setNormalImage(sprite);
}
Example #7
0
bool CCMenuItemSprite::initWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector)
{
    CCMenuItem::initWithTarget(target, selector); 
    setNormalImage(normalSprite);
    setSelectedImage(selectedSprite);
    setDisabledImage(disabledSprite);

    if(m_pNormalImage)
    {
        this->setContentSize(m_pNormalImage->getContentSize());
    }
    return true;
}
Example #8
0
bool CButton::initWithFile(const char* pNormal, const char* pSelected, const char* pDisabled)
{
	if( !pNormal || !strlen(pNormal) || !init() )
	{
		return false;
	}

	setScale9Enabled(false);
	setNormalImage(pNormal);
	setSelectedImage(pSelected);
	setDisabledImage(pDisabled);

	return true;
}
Example #9
0
bool CButton::initWith9Sprite(const Size& tSize, const char* pNormal, const char* pSelected, const char* pDisabled)
{
	if( !pNormal || !strlen(pNormal) || !init() )
	{
		return false;
	}

	setScale9Enabled(true);
	setContentSize(tSize);
	setNormalImage(pNormal);
	setSelectedImage(pSelected);
	setDisabledImage(pDisabled);

	return true;
}
Example #10
0
bool MenuItemSprite::initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, const ccMenuCallback& callback)
{
    MenuItem::initWithCallback(callback);
    setNormalImage(normalSprite);
    setSelectedImage(selectedSprite);
    setDisabledImage(disabledSprite);

    if(_normalImage)
    {
        this->setContentSize(_normalImage->getContentSize());
    }

    setCascadeColorEnabled(true);
    setCascadeOpacityEnabled(true);

    return true;
}
Example #11
0
bool CCMenuItemSprite::initWithNormalSprite(CCNode* normalSprite, CCNode* selectedSprite, CCNode* disabledSprite, CCObject* target, SEL_MenuHandler selector)
{
    CCMenuItem::initWithTarget(target, selector); 
    setNormalImage(normalSprite);
    setSelectedImage(selectedSprite);
    setDisabledImage(disabledSprite);

    if(m_pNormalImage)
    {
        this->setContentSize(m_pNormalImage->getContentSize());
        // #HLP_BEGIN
        // #resource_scale_fix
        if(getTag() != TAG_INTERNET_MENU_ITEM_IMAGE){
            setScale(getScale() * CC_CONTENT_SCALE_FACTOR() / CC_RESOURCE_SCALE_FACTOR());
        }
        // #HLP_END
    }
    
    setCascadeColorEnabled(true);
    setCascadeOpacityEnabled(true);
    
    return true;
}
Example #12
0
//
// Setter of sprite frames
//
void CCMenuItemImage::setNormalSpriteFrame(CCSpriteFrame * frame)
{
    setNormalImage(CCSprite::create(frame));
}
Example #13
0
void Rolelayer::drawCenter(){

	                float x_width= getDelwithint(200,0);
					//魔法物 人物 宠物
					string hero_str=ImageHelper::getUnitSpriteUIScene(hero.unit.ID)->getName();
					auto hero_default=MenuItemImage::create(hero_str,hero_str,CC_CALLBACK_1(Rolelayer::allCallbackm,this));
					menus.push_back(hero_default);
					hero_default->setTag(hero_ab);
					hero_default->setNormalImage(ImageHelper::getUnitSpriteUIScene(hero.unit.ID));
					hero_default->setSelectedImage(ImageHelper::getUnitSpriteUIScene(hero.unit.ID));
					//hero_default->setScale(0.85f);
					hero_default->setAnchorPoint(Vec2(0.5,0.0));
	                

					string namekl=hero_default->getName();
					hero_default->setPosition(Vec2(getContentSize().width*0.3+x_width,getContentSize().height*0.5));
					hero_default->setOpacity(0.0f);

					Layer* h_l=Layer::create();
					h_l->setTag(hero_layer);
					h_l->setPosition(hero_default->getPosition());
					addChild(h_l,1000);
					jianls.push_back(h_l);

					string arExportName, armatureName, animationData;
					getActorInfor(hero.unit.ID, arExportName, armatureName, animationData);
					playAnimationByname(h_l,"xiaoxiao_NG.ExportJson","xiaoxiao_NG",animationData,true,false,Vec2(hero_default->getContentSize().width/2,50));

					//阴影
					



					MenuItemImage* hero_default1=nullptr;
					Layer* pet_l=nullptr;

					if(pet.unit.ID!=unitID_None){
		
						pet_l=Layer::create();
						pet_l->setTag(pet_layer);

						string hero_str=pet.unit.imageFile;
						CCLOG("---->%s",hero_str.c_str());
						hero_default1=MenuItemImage::create(hero_str,hero_str,CC_CALLBACK_1(Rolelayer::allCallbackm,this));
		
						hero_default1->setTag(pet_ab);
						hero_default1->setNormalImage(Sprite::create(hero_str));
						hero_default1->setSelectedImage(Sprite::create(hero_str));
						hero_default1->setAnchorPoint(Vec2(0.0f,0.0f));
						hero_default1->setOpacity(0.0f);
						

						string namekl=hero_default1->getName();
						float pet_y=hero_default1->getPositionX()+hero_default1->getContentSize().width/2+hero_default1->getContentSize().width/2;


						float pet_yh=getContentSize().height*0.25;
						float pet_xh=getContentSize().width*0.1+x_width;
// 						if(pet.unit.ID==unitID_PiPiZhu){
// 							//animationData="limao";
// 							pet_y=hero_default1->getPositionX()+hero_default1->getContentSize().width/1.5;
// 			
// 						}else if(pet.unit.ID==unitID_XiXiaoYang ){
// 							//animationData="xiaoxiong";
// 							pet_y=hero_default1->getPositionX()+hero_default1->getContentSize().width/2;
// 		
// 						}else if(pet.unit.ID==unitID_BuGuNiao	){
// 							//animationData="maotouying";
// 							pet_y=hero_default1->getPositionX()+hero_default1->getContentSize().width/2;
// 						}
						hero_default1->setPosition(Vec2(pet_xh,pet_yh));
						pet_l->setPosition(hero_default1->getPosition());
						addChild(pet_l,1000);
						jianls.push_back(pet_l);
						menus.push_back(hero_default1);

						string arExportFilename, armatureName, animationName;
						getPetInfor(pet.unit.ID,arExportFilename, armatureName, animationName);
						playAnimationByname(pet_l,arExportFilename,armatureName,animationName,true,false,Vec2(hero_default1->getContentSize().width/2,50));


						//
						//
						vector<Achieve> allacives=*AchievementHelper::getHelper()->getAllAchievement();

						for(auto m:allacives){

							
                            bool isfinish=AchievementHelper::getHelper()->getAchieveByID(m.ID)->isOver;
					        bool islq=AchievementHelper::getHelper()->getIsGotAchievement(m.ID);
                            const AchieveSpecialAward* pa= AchievementHelper::getHelper()->getAchieveSpecialAwardInfo(m.ID);
							if(pa!=nullptr){
								if(isfinish==true&&islq==false&&(pa->award_unitID>=unitID_PiPiZhu&&pa->award_unitID<unitID_PetEnd)){

									bingbi=1;
									pet_l->setVisible(false);
									auto click=Sprite::create("UI_jiesuan_longdan.png");
									click->setPosition(Vec2(getContentSize().width*0.3+x_width,getContentSize().height*0.65));
									click->setTag(click_tag2);
									addChild(click);
									click->setLocalZOrder(1025);
									achiveId=m.ID;

									click->runAction(Sequence::create(Shake::create(0.5f,10),
										MoveTo::create(0.5f,Vec2(94,getContentSize().height*0.60)),
										ScaleTo::create(0.5f,0),
										CallFuncN::create(CC_CALLBACK_1(Rolelayer::Movedone,this)),
										nullptr));  

									break;

								}
							}

						}
					}

					MenuItemImage* hero_default2=nullptr;
					Layer* magic_l=nullptr;
					if(magic.unit.ID!=unitID_None){
		
						magic_l=Layer::create();
						magic_l->setTag(magic_layer);

						string magic_name="UI_modian_1.png";
						magic_name=__String::createWithFormat("UI_modian_%d.png",magic.level)->getCString();
					    

						hero_default2=MenuItemImage::create(magic_name,magic_name,CC_CALLBACK_1(Rolelayer::allCallbackm,this));
						hero_default2->setTag(magic_ab);
						hero_default2->setOpacity(0);
						
						
						if(hero.unit.ID==unitID_Actor2){
						   hero_default2->setPosition(Vec2((getContentSize().width)*0.15+x_width,getContentSize().height*0.875));
						}else{
						   hero_default2->setPosition(Vec2((getContentSize().width)*0.12+x_width,getContentSize().height*0.875));

						}
						string animationData=  CCString::createWithFormat("b_huxi%d", magic.level)->getCString();
						magic_l->setPosition(hero_default2->getPosition());
						addChild(magic_l,1000);
						jianls.push_back(magic_l);
						menus.push_back(hero_default2);
						playAnimationByname(magic_l,"book_ui.ExportJson","book_ui",animationData,true,false,Vec2(hero_default2->getContentSize().width/2,0));
					}

					auto menu0=Menu::create(hero_default2,hero_default,hero_default1,nullptr);
					menu0->setPosition(Vec2::ZERO);
					menu0->setTag(menu_zb0);
					addChild(menu0,1000);

}
Example #14
0
void comboUC::setNormalImage(LONG left, LONG top, LONG right, LONG bottom)
{
	assert(m_pImage);
	RECT rc = {left, top, right, bottom};
	setNormalImage(rc);
}
//
// Setter of sprite frames
//
void CMenuItemWithDesciption::setNormalSpriteFrame(SpriteFrame * frame)
{
	setNormalImage(Sprite::createWithSpriteFrame(frame));
}
Example #16
0
void KFileIVIDesktop::drawShadowedText( TQPainter *p, const TQColorGroup &cg )
{
  bool drawRoundedRect = TDEGlobalSettings::iconUseRoundedRect();

  int textX;
  if (drawRoundedRect == true)
    textX = textRect( FALSE ).x() + 4;
  else
    textX = textRect( FALSE ).x() + 2;
  int textY = textRect( FALSE ).y();
  int align = ((TDEIconView *) iconView())->itemTextPos() == TQIconView::Bottom
    ? AlignHCenter : AlignAuto;
  // FIXME
  // Work around incorrect shadow position detailed in Bug 1807
  bool rebuild = true; // shouldUpdateShadow(isSelected());

  KDesktopShadowSettings *settings = (KDesktopShadowSettings *) (m_shadow->shadowSettings());

  unsigned long uid = settings->UID();

  p->setFont(iconView()->font());
  paintFontUpdate(p);
  TQColor shadow;
  TQColor text;
  int spread = shadowThickness();

  if ( isSelected() && settings->selectionType() != KShadowSettings::InverseVideoOnSelection ) {
    text = cg.highlightedText();
    TQRect rect = textRect( false );
    rect.setRight( rect.right() - spread );
    rect.setBottom( rect.bottom() - spread + 1 );
    if (drawRoundedRect == true) {
      p->setBrush( TQBrush( cg.highlight() ) );
      p->setPen( TQPen( cg.highlight() ) );
      p->drawRoundRect( rect,
		      1000 / rect.width(),
		      1000 / rect.height() );
    }
    else {
      p->fillRect( textRect( false ), cg.highlight() );
    }
  }
  else {
    // use shadow
    if ( isSelected() ) {
      // inverse text and shadow colors
      shadow = settings->textColor();
      text = settings->bgColor();
      if ( rebuild ) {
        setSelectedImage( buildShadow( p, align, shadow ) );
        _selectedUID = uid;
      }
    }
    else {
      text = settings->textColor();
      shadow = ( settings->bgColor().isValid() ) ? settings->bgColor() :
               ( tqGray( text.rgb() ) > 127 ) ? black : white;
      if (rebuild) {
        setNormalImage(buildShadow(p, align, shadow));
        _normalUID = uid;
      }
    }

    // draw the shadow
    int shadowX = textX - spread + settings->offsetX();
    int shadowY = textY - spread + settings->offsetY();

    p->drawImage(shadowX, shadowY,
      (isSelected()) ? *selectedImage() : *normalImage(),
      0, 0, -1, -1, DITHER_FLAGS);
  }

  // draw the text
  p->setPen(text);
  wordWrap()->drawText( p, textX, textY, align | KWordWrap::Truncate );
}
Example #17
0
void comboUC::setAttribute(PCWSTR pstrName, PCWSTR pstrValue)
{
	PWSTR pstr = NULL;
	if( _tcscmp(pstrName, L"textpadding") == 0 ) {
		RECT rcTextPadding = { 0 };
		rcTextPadding.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcTextPadding.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcTextPadding.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcTextPadding.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);    
		setTextPadding(rcTextPadding);
	}
	else if( _tcscmp(pstrName, L"normalimage") == 0 )
	{
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setNormalImage(rcCell);
		//setNormalImage(pstrValue);
	}
	else if( _tcscmp(pstrName, L"hotimage") == 0 )
	{
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setHotImage(rcCell);
		//setHotImage(pstrValue);
	}
	else if( _tcscmp(pstrName, L"pushedimage") == 0 )
	{
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setPushedImage(rcCell);
		//SetPushedImage(pstrValue);
	}
	else if( _tcscmp(pstrName, L"focusedimage") == 0 )
	{
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setFocusedImage(rcCell);
		//SetFocusedImage(pstrValue);
	}
	else if( _tcscmp(pstrName, L"disabledimage") == 0 )
	{
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setDisabledImage(rcCell);
		//SetDisabledImage(pstrValue);
	}
	else if( _tcscmp(pstrName, L"dropbox") == 0 ) setDropBoxAttributeList(pstrValue);
	// 列表单元格属性
	else if( _tcscmp(pstrName, L"itemfont") == 0 ) setItemFont(_ttoi(pstrValue));
	else if( _tcscmp(pstrName, L"itemlinecolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemLineColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemshowhtml") == 0 ) setItemShowHtml(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"alternatebk") == 0 ) setAlternateBk(_tcscmp(pstrValue, L"true") == 0);
	else if( _tcscmp(pstrName, L"itemalign") == 0 ) {
		if( _tcsstr(pstrValue, L"left") != NULL ) {
			m_listInfo.uTextStyle &= ~(DT_CENTER | DT_RIGHT);
			m_listInfo.uTextStyle |= DT_LEFT;
		}
		if( _tcsstr(pstrValue, L"center") != NULL ) {
			m_listInfo.uTextStyle &= ~(DT_LEFT | DT_RIGHT);
			m_listInfo.uTextStyle |= DT_CENTER;
		}
		if( _tcsstr(pstrValue, L"right") != NULL ) {
			m_listInfo.uTextStyle &= ~(DT_LEFT | DT_CENTER);
			m_listInfo.uTextStyle |= DT_RIGHT;
		}
	}
	else if( _tcscmp(pstrName, L"itemendellipsis") == 0 ) {
		if( _tcscmp(pstrValue, L"true") == 0 ) m_listInfo.uTextStyle |= DT_END_ELLIPSIS;
		else m_listInfo.uTextStyle &= ~DT_END_ELLIPSIS;
	}
	else if( _tcscmp(pstrName, L"itemtextpadding") == 0 ) {
		RECT rcPadding = { 0 };
		rcPadding.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcPadding.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcPadding.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcPadding.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);    
		setItemTextPadding(rcPadding);
	}
	else if( _tcscmp(pstrName, L"itemtextcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemTextColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itembkcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemselectedtextcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemSelectedTextColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemselectedbkcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemSelectedBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemhottextcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemHotTextColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemhotbkcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemHotBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemcuttextcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemCutTextColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemcutbkcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemCutBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemdisabledtextcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemDisabledTextColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemdisabledbkcolor") == 0 ) {
		if( *pstrValue == L'#') pstrValue = ::CharNext(pstrValue);
		DWORD clrColor = _tcstoul(pstrValue, &pstr, 16);
		setItemDisabledBkColor(clrColor);
	}
	else if( _tcscmp(pstrName, L"itemimage") == 0 ) setItemImage(pstrValue);
	else if( _tcscmp(pstrName, L"itemnormalimage") == 0 ) {
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setItemNormalImage(rcCell);
	}
	else if( _tcscmp(pstrName, L"itemselectedimage") == 0 ) {
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setItemSelectedImage(rcCell);
	}
	else if( _tcscmp(pstrName, L"itemcutedimage") == 0 ) {
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setItemCutedImage(rcCell);
	}
	else if( _tcscmp(pstrName, L"itemhotimage") == 0 ) {
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setItemHotImage(rcCell);
	}
	else if( _tcscmp(pstrName, L"itemdisabledimage") == 0 ) {
		RECT rcCell = { 0 };
		rcCell.left = _tcstol(pstrValue, &pstr, 10);  assert(pstr);    
		rcCell.top = _tcstol(pstr + 1, &pstr, 10);    assert(pstr);    
		rcCell.right = _tcstol(pstr + 1, &pstr, 10);  assert(pstr);    
		rcCell.bottom = _tcstol(pstr + 1, &pstr, 10); assert(pstr);
		setItemDisabledImage(rcCell);
	}
	else containerUC::setAttribute(pstrName, pstrValue);
}
Example #18
0
//
// Setter of sprite frames
//
void MenuItemImage::setNormalSpriteFrame(SpriteFrame * frame)
{
    setNormalImage(Sprite::createWithSpriteFrame(frame));
}
void CCMenuItemImageBMF::setNormalSpriteFrame( cocos2d::CCSpriteFrame* pSpriteFrame )
{
	setNormalImage(CCSprite::createWithSpriteFrame(pSpriteFrame));
}