void GameRankLayer::initTabs() { // Friend Tab CCScale9Sprite* ptrTabFriendsSelected = GameUtils::createScale9("new_blue_bg.png", CCRectMake(0,0,200,82),CCRectMake(35,35,125,10)); ptrTabFriendsSelected->setContentSize(CCSizeMake(204,82)); CCScale9Sprite* ptrTabFriendsDisabled = GameUtils::createScale9("new_blue_bg.png", CCRectMake(0,0,200,82),CCRectMake(35,35,125,10)); ptrTabFriendsDisabled->setContentSize(CCSizeMake(204,82)); CCNode* ptrTabFriendsNormal = CCNode::create(); ptrTabFriendsNormal->setContentSize(ptrTabFriendsSelected->getContentSize()); m_ptrTabFriends = CCMenuItemSprite::create(ptrTabFriendsNormal, ptrTabFriendsSelected, ptrTabFriendsDisabled, this, menu_selector(GameRankLayer::tabFriendsCallback)); m_ptrBg->addChild(m_ptrTabFriends); LayoutUtil::layoutParentLeftTop(m_ptrTabFriends, -5, -27); registerMenuItem(m_ptrTabFriends); m_ptrLbFriends = CCLabelBMFont::create(LOCALIZED_STRING("word_friends"), FontConstant::BMFONT_GOTHIC725_BLK_BT_BLUE); m_ptrLbFriends->setScale(0.6f); m_ptrTabFriends->addChild(m_ptrLbFriends); LayoutUtil::layoutParentBottom(m_ptrLbFriends,6,22); // Global Tab CCScale9Sprite* ptrTabGlobalSelected = GameUtils::createScale9("new_blue_bg.png", CCRectMake(0,0,200,82),CCRectMake(35,35,125,10)); ptrTabGlobalSelected->setContentSize(CCSizeMake(204,82)); CCScale9Sprite* ptrTabGlobalDisabled = GameUtils::createScale9("new_blue_bg.png", CCRectMake(0,0,200,82),CCRectMake(35,35,125,10)); ptrTabGlobalDisabled->setContentSize(CCSizeMake(204,82)); CCNode* ptrTabGlobalNormal = CCNode::create(); ptrTabGlobalNormal->setContentSize(ptrTabGlobalSelected->getContentSize()); m_ptrTabGolbal = CCMenuItemSprite::create(ptrTabGlobalNormal, ptrTabGlobalSelected, ptrTabGlobalDisabled,this, menu_selector(GameRankLayer::tabGlobalCallback)); m_ptrBg->addChild(m_ptrTabGolbal); LayoutUtil::layoutRight(m_ptrTabGolbal,m_ptrTabFriends,-44); registerMenuItem(m_ptrTabGolbal); m_ptrLbGlobal = CCLabelBMFont::create(LOCALIZED_STRING("word_global"), FontConstant::BMFONT_GOTHIC725_BLK_BT_BLUE); m_ptrLbGlobal->setScale(0.6f); m_ptrTabGolbal->addChild(m_ptrLbGlobal); LayoutUtil::layoutParentBottom(m_ptrLbGlobal,5,22); tabFriendsCallback(NULL); }
void NotificationBar::initBtnClose() { CCMenuItem* ptrBtnClose = MenuItemImage::create("btn_close.png","btn_close_down.png", this,menu_selector(NotificationBar::btnCloseCallback)); m_ptrBg->addChild(ptrBtnClose); LayoutUtil::layoutParentRight(ptrBtnClose,-6,14); registerMenuItem(ptrBtnClose); }
void GameLotteryLayer::chargeNewDay() { // disable button according to lastLottery date if (!GameUtils::s_myInfo.getHasFreeLottery()) { if (m_bIsFree) { m_iChoiceDiamond = decideDefaultSelect(); } initBtnGo(); selectBtnByIndex(m_iChoiceDiamond); } else { m_bIsFree = true; m_iChoiceDiamond = decideDefaultSelect(); for (int i=0; i<CIRCLE_CONTENT_COUNT; i++) { m_ptrLbMutilply[i]->setString((LOCALIZED_STRING("multiplication_sign") + Utils::itoa(MUlTIPLE_COUNT[m_iChoiceDiamond])).c_str()); } // init the free button // Normal Sprite CCSprite* ptrBtnFreeNormal = CREATE_SPRITE(this, "btn_go.png", true); CCSprite* ptrBtnFreeLight = CREATE_SPRITE(this,"btn_go_light.png",false); ptrBtnFreeLight->runAction(CCRepeatForever::create( CCSequence::create(CCFadeOut::create(1.0f),CCFadeIn::create(1.0f),NULL))); ptrBtnFreeNormal->addChild(ptrBtnFreeLight); LayoutUtil::layoutParentCenter(ptrBtnFreeLight, 0, 1); CCSprite* ptrBtnTxt = CREATE_SPRITE(this, "btn_txt_free.png", true); ptrBtnFreeNormal->addChild(ptrBtnTxt); LayoutUtil::layoutParentCenter(ptrBtnTxt); // Selected Sprite CCSprite* ptrBtnFreeSelected = CREATE_SPRITE(this, "btn_go_down.png", true); ptrBtnTxt = CREATE_SPRITE(this, "btn_txt_free_down.png", true); ptrBtnFreeSelected->addChild(ptrBtnTxt); LayoutUtil::layoutParentCenter(ptrBtnTxt); // Disabled Sprite CCSprite* ptrBtnFreeDisable = CREATE_SPRITE(this, "btn_go_down.png", true); ptrBtnTxt = CREATE_SPRITE(this, "btn_txt_free_down.png", true); ptrBtnFreeDisable->addChild(ptrBtnTxt); LayoutUtil::layoutParentCenter(ptrBtnTxt); // Menu m_ptrMenuGo = CCMenuItemSprite::create(ptrBtnFreeNormal, ptrBtnFreeSelected, ptrBtnFreeDisable, this, menu_selector(GameLotteryLayer::onBtnGoCallback)); m_ptrBg->addChild(m_ptrMenuGo); LayoutUtil::layoutCenter(m_ptrMenuGo, m_ptrCircle); registerMenuItem(m_ptrMenuGo); selectBtnByIndex(m_iChoiceDiamond); m_ptrBtnMinus->setEnabled(false); m_ptrBtnPlus->setEnabled(false); } }
void GameLotteryLayer::initUI() { // Circle m_ptrCircle = CREATE_SPRITE(this, "Images/circle_game.png", true); m_ptrBg->addChild(m_ptrCircle); LayoutUtil::layoutParentTop(m_ptrCircle, 0, 78); CCSprite* ptrCircleFront = CREATE_SPRITE(this, "Images/circle_front.png", true); m_ptrBg->addChild(ptrCircleFront); LayoutUtil::layoutCenter(ptrCircleFront,m_ptrCircle); // Plus Button m_ptrBtnPlus = MenuItemImage::create("btn_blue_round.png","btn_blue_round.png", this, menu_selector(GameLotteryLayer::onBtnPlusCallback)); CCSprite* ptrBtnPlusCover = CREATE_SPRITE(this,"btn_blue_round_selected.png",true); m_ptrBtnPlus->getSelectedImage()->addChild(ptrBtnPlusCover); LayoutUtil::layoutParentCenter(ptrBtnPlusCover); m_ptrBg->addChild(m_ptrBtnPlus); LayoutUtil::layoutParentLeftBottom(m_ptrBtnPlus, 38); registerMenuItem(m_ptrBtnPlus); CCSprite* ptrPlus = CREATE_SPRITE(this, "btn_plus.png", true); m_ptrBtnPlus->addChild(ptrPlus); LayoutUtil::layoutParentCenter(ptrPlus); // Minus Button m_ptrBtnMinus = MenuItemImage::create("btn_blue_round.png","btn_blue_round.png", this, menu_selector(GameLotteryLayer::onBtnMinusCallback)); CCSprite* ptrBtnMinusCover = CREATE_SPRITE(this,"btn_blue_round_selected.png",true); m_ptrBtnMinus->getSelectedImage()->addChild(ptrBtnMinusCover); LayoutUtil::layoutParentCenter(ptrBtnMinusCover); m_ptrBg->addChild(m_ptrBtnMinus); LayoutUtil::layoutParentRightBottom(m_ptrBtnMinus, -40); registerMenuItem(m_ptrBtnMinus); CCSprite* ptrMinus = CREATE_SPRITE(this, "btn_minus.png", true); m_ptrBtnMinus->addChild(ptrMinus); LayoutUtil::layoutParentCenter(ptrMinus); }
CCMenuItemSprite* BetControler::createRadioButton(const char* label,const char* normal,const char* selected,const char* disabled/*=NULL*/,const char* disabledLabel/*=NULL*/){ if(normal==NULL){ return NULL; } CCNode* node = CCNode::create(); CCSprite* sprite = ResourceManager::getInstance()->createSprite(this, normal); CCSprite* labelSprite = ResourceManager::getInstance()->createSprite(this, label); node->setContentSize(CCSizeMake(90+labelSprite->getContentSize().width, 110)); node->addChild(sprite); node->addChild(labelSprite); LayoutUtil::layoutParentLeft(sprite); LayoutUtil::layoutParentLeft(labelSprite,90); CCNode* downNode=node; if(selected!=NULL){ downNode = CCNode::create(); CCSprite* downSprite = ResourceManager::getInstance()->createSprite(this, selected); CCSprite* labeldownSprite = ResourceManager::getInstance()->createSprite(this, label); downNode->setContentSize(CCSizeMake(90+labeldownSprite->getContentSize().width, 110)); downNode->addChild(downSprite); downNode->addChild(labeldownSprite); LayoutUtil::layoutParentLeft(downSprite); LayoutUtil::layoutParentLeft(labeldownSprite,90); } CCNode* disabledNode=NULL; if(disabled!=NULL){ disabledNode = CCNode::create(); disabledNode->setContentSize(CCSizeMake(104, 104)); CCSprite* disabledSprite = ResourceManager::getInstance()->createSprite(this, disabled); CCSprite* labelDisabledSprite = ResourceManager::getInstance()->createSprite(this, disabledLabel); disabledNode->addChild(disabledSprite); disabledNode->addChild(labelDisabledSprite); LayoutUtil::layoutParentLeft(disabledSprite); LayoutUtil::layoutParentLeft(labelDisabledSprite,90); } CCMenuItemSprite* button=NULL; if(disabledNode==NULL){ button=CCMenuItemSprite::create(node,downNode, this, menu_selector(BetControler::radioButtonsCallback)); }else{ button=CCMenuItemSprite::create(node,downNode,disabledNode, this, menu_selector(BetControler::radioButtonsCallback)); } registerMenuItem(button); this->addChild(button); //button->unselected(); button->setVisible(false); return button; }
void GameLotteryLayer::initBackBtn() { CCSprite* ptrBtnMenuBackNormal = CREATE_SPRITE(this,"game_lottery_arrow.png",false); m_ptrMenuBack = ScaleMenuItemSprite::create(ptrBtnMenuBackNormal, ptrBtnMenuBackNormal, this, menu_selector(GameLotteryLayer::onBtnBackCallback),1.0f,1.1f); m_ptrBg->addChild(m_ptrMenuBack); LayoutUtil::layoutParentTop(m_ptrMenuBack, 0, 132); registerMenuItem(m_ptrMenuBack); CCLabelBMFont* ptrLbSpin = CCLabelBMFont::create(LOCALIZED_STRING("menu_lottery"), FontConstant::BMFONT_GOTHIC725_BLK_BT_BLUE); ptrLbSpin->setScale(0.375f); m_ptrMenuBack->addChild(ptrLbSpin); LayoutUtil::layoutParentTop(ptrLbSpin,3,-18); }
void GameLotteryLayer::initBtnGo() { m_bIsFree = false; if (m_ptrMenuGo) { unRegisterMenuItem(m_ptrMenuGo); m_ptrMenuGo->removeFromParent(); m_ptrMenuGo = NULL; } // Normal Sprite CCSprite* ptrBtnGoNormal = CREATE_SPRITE(this, "btn_go.png", true); CCSprite* ptrBtnGoLight = CREATE_SPRITE(this,"btn_go_light.png",false); ptrBtnGoLight->runAction(CCRepeatForever::create( CCSequence::create(CCFadeOut::create(1.0f),CCFadeIn::create(1.0f),NULL))); ptrBtnGoNormal->addChild(ptrBtnGoLight); LayoutUtil::layoutParentCenter(ptrBtnGoLight, 0, 1); CCSprite* ptrDiamond = CREATE_SPRITE(this,"diamond.png",true); ptrBtnGoNormal->addChild(ptrDiamond); LayoutUtil::layoutParentCenter(ptrDiamond,0,25); m_ptrLbBtnGoDiamond[0] = CCLabelTTF::create("",FontConstant::TTF_IMPACT,30); ptrBtnGoNormal->addChild(m_ptrLbBtnGoDiamond[0]); LayoutUtil::layoutParentCenter(m_ptrLbBtnGoDiamond[0],0,-15); // Selected Sprite CCSprite* ptrBtnGoSelected = CREATE_SPRITE(this, "btn_go_down.png", true); ptrDiamond = CREATE_SPRITE(this,"diamond.png",true); ptrBtnGoSelected->addChild(ptrDiamond); LayoutUtil::layoutParentCenter(ptrDiamond, 0, 25); m_ptrLbBtnGoDiamond[1] = CCLabelTTF::create("",FontConstant::TTF_IMPACT,30); ptrBtnGoSelected->addChild(m_ptrLbBtnGoDiamond[1]); LayoutUtil::layoutParentCenter(m_ptrLbBtnGoDiamond[1],0,-15); // Disabled Sprite CCSprite* ptrBtnGoDisabled = CREATE_SPRITE(this, "btn_go_down.png", true); ptrDiamond = CREATE_SPRITE(this,"diamond.png",true); ptrBtnGoDisabled->addChild(ptrDiamond); LayoutUtil::layoutParentCenter(ptrDiamond, 0, 25); m_ptrLbBtnGoDiamond[2] = CCLabelTTF::create("",FontConstant::TTF_IMPACT,30); ptrBtnGoDisabled->addChild(m_ptrLbBtnGoDiamond[2]); LayoutUtil::layoutParentCenter(m_ptrLbBtnGoDiamond[2],0,-15); // Go m_ptrMenuGo = CCMenuItemSprite::create(ptrBtnGoNormal, ptrBtnGoSelected, ptrBtnGoDisabled, this, menu_selector(GameLotteryLayer::onBtnGoCallback)); m_ptrBg->addChild(m_ptrMenuGo); LayoutUtil::layoutCenter(m_ptrMenuGo, m_ptrCircle); registerMenuItem(m_ptrMenuGo); }
void GameRankLayer::initBtnBack() { CCSprite* ptrBtnBackNormal = CREATE_SPRITE(this, "sliding.png", false); ptrBtnBackNormal->setCascadeOpacityEnabled(true); CCSprite* ptrArrow = CREATE_SPRITE(this, "arrow_up.png", false); ptrArrow->setScale(0.8f); ptrArrow->setRotation(-90); ptrArrow->setCascadeOpacityEnabled(true); ptrBtnBackNormal->addChild(ptrArrow); LayoutUtil::layoutParentCenter(ptrArrow, -7, 0); m_ptrBtnBack = ScaleMenuItemSprite::create(ptrBtnBackNormal, ptrBtnBackNormal, this, menu_selector(GameRankLayer::btnBackCallback),1.0f,1.0f); m_ptrBg->addChild(m_ptrBtnBack); LayoutUtil::layoutParentRight(m_ptrBtnBack, 40, 0); registerMenuItem(m_ptrBtnBack); }
void GameLotteryLayer::setGoResult(int type) { CCSprite* ptrBtnGoLarge = NULL; CCLabelTTF* ptrLbUp = NULL; CCLabelTTF* ptrLbDown1 = NULL; CCLabelTTF* ptrLbDown2 = NULL; CCLabelTTF* ptrLbDown3 = NULL; vector<string> reminder; int iReward = 0; switch (type) { case DIAMOND_NOT_ENOUGH: ptrBtnGoLarge = CREATE_SPRITE(this, "btn_go_large.png", false); Utils::SeperateString(LOCALIZED_STRING("reminder_diamond_not_enough"), ' ', reminder); ptrLbUp = CCLabelTTF::create(reminder.at(0).c_str(), FontConstant::TTF_IMPACT, 35); ptrLbDown1 = CCLabelTTF::create(reminder.at(1).c_str(), FontConstant::TTF_IMPACT, 25); // to adjust the line height ptrLbDown2 = CCLabelTTF::create(reminder.at(2).c_str(), FontConstant::TTF_IMPACT, 25); ptrLbDown3 = CCLabelTTF::create(reminder.at(3).c_str(), FontConstant::TTF_IMPACT, 25); ptrBtnGoLarge->addChild(ptrLbUp); ptrBtnGoLarge->addChild(ptrLbDown1); ptrBtnGoLarge->addChild(ptrLbDown2); ptrBtnGoLarge->addChild(ptrLbDown3); #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID LayoutUtil::layoutParentTop(ptrLbUp, 0, -10); LayoutUtil::layoutBottom(ptrLbDown1, ptrLbUp, 0, 13); LayoutUtil::layoutBottom(ptrLbDown2, ptrLbDown1, 0, 13); LayoutUtil::layoutBottom(ptrLbDown3, ptrLbDown2, 0, 13); #else LayoutUtil::layoutParentTop(ptrLbUp, 0, -18); LayoutUtil::layoutBottom(ptrLbDown1, ptrLbUp, 0, 5); LayoutUtil::layoutBottom(ptrLbDown2, ptrLbDown1, 0, 7); LayoutUtil::layoutBottom(ptrLbDown3, ptrLbDown2, 0, 7); #endif m_ptrMenuHint = CCMenuItemSprite::create(ptrBtnGoLarge, ptrBtnGoLarge, this, menu_selector(GameLotteryLayer::onBtnRewardCallback)); m_ptrBg->addChild(m_ptrMenuHint, 1); LayoutUtil::layoutCenter(m_ptrMenuHint, m_ptrCircle); registerMenuItem(m_ptrMenuHint); break; case WIN_CHIPS: iReward = CircleContent[m_iCurLottery] * MUlTIPLE_COUNT[m_iChoiceDiamond]; ptrBtnGoLarge = CREATE_SPRITE(this, "btn_go_large.png", false); Utils::SeperateString(LOCALIZED_STRING("reminder_win_chips"), ' ', reminder); ptrLbUp = CCLabelTTF::create(reminder.at(0).c_str(), FontConstant::TTF_IMPACT, 40); ptrLbDown1 = CCLabelTTF::create(Utils::num2strF(iReward, 9).c_str(), FontConstant::TTF_IMPACT, 25); ptrLbDown2 = CCLabelTTF::create(reminder.at(2).c_str(), FontConstant::TTF_IMPACT, 25); ptrBtnGoLarge->addChild(ptrLbUp); ptrBtnGoLarge->addChild(ptrLbDown1); ptrBtnGoLarge->addChild(ptrLbDown2); #if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID LayoutUtil::layoutParentTop(ptrLbUp, 0, -20); LayoutUtil::layoutBottom(ptrLbDown1, ptrLbUp, 0, 10); LayoutUtil::layoutBottom(ptrLbDown2, ptrLbDown1, 0, 10); #else LayoutUtil::layoutParentTop(ptrLbUp, 0, -25); LayoutUtil::layoutBottom(ptrLbDown1, ptrLbUp, 0, 5); LayoutUtil::layoutBottom(ptrLbDown2, ptrLbDown1, 0, 5); #endif m_ptrMenuHint = CCMenuItemSprite::create(ptrBtnGoLarge, ptrBtnGoLarge, this, menu_selector(GameLotteryLayer::onBtnRewardCallback)); m_ptrBg->addChild(m_ptrMenuHint, 1); LayoutUtil::layoutCenter(m_ptrMenuHint, m_ptrCircle); registerMenuItem(m_ptrMenuHint); break; default: break; } }
HRESULT __stdcall moeShell::QueryContextMenu(HMENU hmenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) { if ( (uFlags & CMF_DEFAULTONLY) || (uFlags & CMF_VERBSONLY) || (uFlags & CMF_NOVERBS) ) { return MAKE_HRESULT(SEVERITY_SUCCESS, 0, 0); } UINT icmd = idCmdFirst; MENUITEMINFO mii = { sizeof(mii) }; mii.fMask = MIIM_BITMAP; mii.hbmpItem = bmp2_; cmd_indexes_.clear(); menu_cmds_.clear(); // menu item #1 ::InsertMenu( hmenu, indexMenu, MF_STRING|MF_BYPOSITION, icmd, _T("open with moe") ); ::SetMenuItemInfo(hmenu, indexMenu, TRUE, &mii); registerMenuItem(icmd,_T("moe:"),_T("open with moe") ); indexMenu++; // submenu for menu item #2 mol::Menu menu; menu.createContext(); menu.addItem(icmd,_T("open as ...")); registerMenuItem(icmd,_T("moe-open:"),_T("open as ...") ); menu.addItem(icmd,_T("show HTML")); registerMenuItem(icmd,_T("moe-html:"),_T("show in moes HTML viewer") ); menu.addItem(icmd,_T("show RTF")); registerMenuItem(icmd,_T("moe-rtf:"),_T("show in moes RTF viewer") ); menu.addItem(icmd,_T("show hexdump")); registerMenuItem(icmd,_T("moe-hex:"),_T("show in moes hexdump viewer") ); menu.addItem(icmd,_T("tail -f log")); registerMenuItem(icmd,_T("moe-tail:"),_T("tail -f log") ); // menu item #2 ::InsertMenu( hmenu, indexMenu, MF_STRING|MF_BYPOSITION|MF_POPUP, (UINT_PTR)(HMENU)(menu), _T("open with moe as ...") ); ::SetMenuItemInfo(hmenu, indexMenu, TRUE, &mii); registerMenuItem(icmd,_T(""),_T("open with moe as ...") ); // done menu.detach(); return MAKE_HRESULT( SEVERITY_SUCCESS, FACILITY_NULL, icmd-idCmdFirst ); }