//-------------------------------------------------------------------- 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::setDisabledSpriteFrameName( const char* pszFrameName ) { if (pszFrameName) { setDisabledImage(CCSprite::createWithSpriteFrameName(pszFrameName)); } }
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 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; }
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; }
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; }
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; }
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; }
void SkillItem::setDisableIcon(string icon) { if(!FileUtils::getInstance()->isFileExist(icon.c_str())) return; m_disableIcon = icon; Sprite* spriteSelected = Sprite::create(m_disableIcon.c_str()); if(!spriteSelected) return; Sprite* spriteDisabled = Sprite::create(m_disableIcon.c_str()); if(!spriteDisabled) return; setSelectedImage(spriteSelected); setDisabledImage(spriteDisabled); }
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; }
void MenuItemImage::setDisabledSpriteFrame(SpriteFrame * frame) { setDisabledImage(Sprite::createWithSpriteFrame(frame)); }
void CCMenuItemImageBMF::setDisabledSpriteFrame( cocos2d::CCSpriteFrame* pSpriteFrame ) { setDisabledImage(CCSprite::createWithSpriteFrame(pSpriteFrame)); }
void CMenuItemWithDesciption::setDisabledSpriteFrame(SpriteFrame * frame) { setDisabledImage(Sprite::createWithSpriteFrame(frame)); }
void Button::setDisabledImage(const std::string& Path, Vec2f Size) { ImageRefPtr LoadedImage = ImageFileHandler::the()->read(Path.c_str()); setDisabledImage(LoadedImage, Size); }
void CCMenuItemImage::setDisabledSpriteFrame(CCSpriteFrame * frame) { setDisabledImage(CCSprite::create(frame)); }
void comboUC::setDisabledImage(LONG left, LONG top, LONG right, LONG bottom) { assert(m_pImage); RECT rc = {left, top, right, bottom}; setDisabledImage(rc); }
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); }