void AskAsFriendDialog::finish() { LangDef *lang = ResourceMgr::getInstance()->getLangDef(); BasButton *okButton = new BasButton; okButton->setButtonInfo(lang->getStringById(StringEnum::Ok).data(),"fonts/uifont24.fnt","default","buttonbg", CCSizeMake(0,0)); okButton->setClickCB(m_okListener,m_okFunc); this->addChild(okButton); okButton->setBottomMargin(m_edgeSize); okButton->setBottom("parent",uilib::Bottom); okButton->setHorizontal("parent",0.75); BasButton *rejectButton = new BasButton; rejectButton->setButtonInfo(lang->getStringById(StringEnum::Reject).data(),"fonts/uifont24.fnt","default","buttonbg", CCSizeMake(0,0)); rejectButton->setClickCB(m_rejectListener,m_rejectFunc); this->addChild(rejectButton); rejectButton->setBottomMargin(m_edgeSize); rejectButton->setBottom("parent",uilib::Bottom); rejectButton->setHorizontal("parent",0.25); BasWidget *headWidget; if(!m_askHead.empty()){ CCImage *img = new CCImage; img->initWithImageData((void*)m_askHead.c_str(),m_askHead.size(), CCImage::kFmtUnKnown); CCTexture2D *texture = new CCTexture2D; texture->initWithImage(img); delete img; CCSprite *sprite = CCSprite::create(); sprite->initWithTexture(texture); headWidget = new BasNodeDelegateWidget(sprite); this->addChild(headWidget); headWidget->setHorizontal("parent",0.5); headWidget->setVertical("parent",0.3); }else{ CCSprite *sprite = CCSprite::createWithSpriteFrameName("headdefault.png"); headWidget = new BasNodeDelegateWidget(sprite); this->addChild(headWidget); headWidget->setHorizontal("parent",0.5); headWidget->setVertical("parent",0.3); } m_askWord.insert(0," "); TextScrollArea *area = new TextScrollArea; area->setTheme("",""); area->setTextInfo(m_askWord,getSystemFont(),40,ccWHITE); this->addChild(area); area->setLeft("parent",uilib::Left); area->setRight("parent",uilib::Right); area->setLeftMargin(10); area->setRightMargin(10); area->setTop(headWidget->getName(),uilib::Bottom); area->setBottom(rejectButton->getName(),uilib::Top); }
void VNormalButton::parented(osgWidget::Window* parent) { osgWidget::Label::parented(parent); osg::Geode* geode = parent->getGeode(); if (!_toolTipTextNode.valid()) { osgText::Text* text = new osgText::Text; text->setFont(getSystemFont("msyhl.ttc")); text->setBackdropType(osgText::Text::DROP_SHADOW_BOTTOM_RIGHT); text->setAlignment(osgText::Text::CENTER_BOTTOM); geode->addDrawable(text); text->setColor(_textColor); text->setDataVariance(osg::Object::DYNAMIC); _toolTipTextNode = text; } }
QColorTabWidget::QColorTabWidget(QWidget *parent) : QWidget(parent) , m_sizeTabHeader(90,40) , m_rcChildArea(0,0,0,0) { m_bIsHovered = false; m_bIsMouseDown = false; m_bEnableTabChange = true; m_bNotifyTab = false; m_nBlinkCount = 0; m_TimerBlink = 0; m_nBarOffset = 0; m_eTabDirection = TabDirectionHorzLeftTop; m_nActiveTabIndex = -1; m_nHoverTabIndex = -1; m_pExtraWidget = NULL; m_nVisibleCount = 0; m_nMoveCount = 0; m_btnLeftTab.setParent( this ); m_btnLeftTab.setVisible( false ); m_btnLeftTab.setAutoRaise( true ); m_btnRightTab.setParent( this ); m_btnRightTab.setVisible( false ); m_btnRightTab.setAutoRaise( true ); m_fntTab = getSystemFont(this); m_fntTab.setPixelSize(11); setMouseTracking(true); // for mousemove event installEventFilter( this ); // for mousemove event! }
bool WindowController::handleMessage(UINT message, WPARAM wParam, LPARAM lParam, LRESULT& lResult) { switch (message) { case WM_CREATE: { std::shared_ptr<FontResource> fontResource; if (mWindow->font()) { fontResource = createFontResource (mWindow->font()); } else { fontResource = createFontResource (getSystemFont()); } setFontResource (fontResource); // Add owned controls for (auto control : mWindow->controls) { createController (shared_from_this(), control); } // Default button if (mWindow->defaultButton()) { updateDefaultButton(); } break; } case WM_ACTIVATE: { if (wParam == 0) { MessageLoop::getInstance().setActiveWindowHWnd (NULL); } else { MessageLoop::getInstance().setActiveWindowHWnd (mHWnd); } break; } case WM_SETTEXT: { std::string text ((LPCTSTR)lParam); mWindow->title (text); break; } case WM_WINDOWPOSCHANGED: { WINDOWPOS* windowPos = (WINDOWPOS*)lParam; if (!(windowPos->flags & SWP_NOSIZE)) { mWindow->width (windowPos->cx); mWindow->height (windowPos->cy); } if (!(windowPos->flags & SWP_NOMOVE)) { mWindow->left (windowPos->x); mWindow->top (windowPos->y); } break; } case WM_STYLECHANGED: { STYLESTRUCT* styleStruct = (STYLESTRUCT*)lParam; if ((styleStruct->styleOld & WS_VISIBLE) != (styleStruct->styleNew & WS_VISIBLE)) { mWindow->visible (styleStruct->styleNew & WS_VISIBLE); } } case WM_DESTROY: { WindowBase::destroy(); ::PostQuitMessage (0); break; } } return false; }
Common::Error ZVision::run() { initialize(); // Check if a saved game is to be loaded from the launcher if (ConfMan.hasKey("save_slot")) _saveManager->loadGame(ConfMan.getInt("save_slot")); bool foundAllFonts = true; // Before starting, make absolutely sure that the user has copied the needed fonts for (int i = 0; i < FONT_COUNT; i++) { FontStyle curFont = getSystemFont(i); Common::String freeFontBoldItalic = Common::String("Bold") + curFont.freeFontItalicName; const char *fontSuffixes[4] = { "", "bd", "i", "bi" }; const char *freeFontSuffixes[4] = { "", "Bold", curFont.freeFontItalicName, freeFontBoldItalic.c_str() }; const char *liberationFontSuffixes[4] = { "-Regular", "-Bold", "-Italic", "-BoldItalic" }; for (int j = 0; j < 4; j++) { Common::String fontName = curFont.fontBase; if (fontName == "censcbk" && j > 0) fontName = "schlbk"; fontName += fontSuffixes[j]; fontName += ".ttf"; if (fontName == "schlbkbd.ttf") fontName = "schlbkb.ttf"; if (fontName == "garabi.ttf") continue; if (fontName == "garai.ttf") fontName = "garait.ttf"; Common::String freeFontName = curFont.freeFontBase; freeFontName += freeFontSuffixes[j]; freeFontName += ".ttf"; Common::String liberationFontName = curFont.liberationFontBase; liberationFontName += liberationFontSuffixes[j]; liberationFontName += ".ttf"; if (!Common::File::exists(fontName) && !_searchManager->hasFile(fontName) && !Common::File::exists(liberationFontName) && !_searchManager->hasFile(liberationFontName) && !Common::File::exists(freeFontName) && !_searchManager->hasFile(freeFontName)) { foundAllFonts = false; break; } } if (!foundAllFonts) break; } if (!foundAllFonts) { GUI::MessageDialog dialog( "Before playing this game, you'll need to copy the required " "fonts into ScummVM's extras directory, or into the game directory. " "On Windows, you'll need the following font files from the Windows " "font directory: Times New Roman, Century Schoolbook, Garamond, " "Courier New and Arial. Alternatively, you can download the " "Liberation Fonts or the GNU FreeFont package. You'll need all the " "fonts from the font package you choose, i.e., LiberationMono, " "LiberationSans and LiberationSerif, or FreeMono, FreeSans and " "FreeSerif respectively." ); dialog.runModal(); quitGame(); return Common::kUnknownError; } // Main loop while (!shouldQuit()) { _clock.update(); uint32 currentTime = _clock.getLastMeasuredTime(); uint32 deltaTime = _clock.getDeltaTime(); _cursorManager->setItemID(_scriptManager->getStateValue(StateKey_InventoryItem)); processEvents(); _renderManager->updateRotation(); _scriptManager->update(deltaTime); _menu->process(deltaTime); // Render the backBuffer to the screen _renderManager->prepareBackground(); _renderManager->renderMenuToScreen(); _renderManager->processSubs(deltaTime); _renderManager->renderSceneToScreen(); // Update the screen if (canRender()) { _system->updateScreen(); _renderedFrameCount++; } else { _frameRenderDelay--; } // Calculate the frame delay based off a desired frame time int delay = _desiredFrameTime - int32(_system->getMillis() - currentTime); // Ensure non-negative delay = delay < 0 ? 0 : delay; if (_doubleFPS) { delay >>= 1; } if (canSaveGameStateCurrently() && shouldPerformAutoSave(_saveManager->getLastSaveTime())) { _saveManager->autoSave(); } _system->delayMillis(delay); } return Common::kNoError; }
void VInfoTreeWindow::setLabelStyle(TextLocation loc, const std::string& bgImage, float widthRelative, float heightRelative, const std::string& font, const osg::Vec4& color, osgText::Text::BackdropType bType, const osg::Vec4& bColor) { osg::ref_ptr<osg::Texture2D> tex = g_SystemContext._resourceLoader->getTextureByFileName(bgImage); TextLabelStruct* st = NULL; for (unsigned int i = 0; i < _labelList.size(); ++i) { if (_labelList[i]._loc == loc) { st = &_labelList[i]; break; } } if (!st) { std::string labelName = ""; switch (loc) { case VirtualDataSceneWidget::VInfoTreeWindow::LeftTop: labelName = EMTOSTR(LeftTop); break; case VirtualDataSceneWidget::VInfoTreeWindow::Top: labelName = EMTOSTR(Top); break; case VirtualDataSceneWidget::VInfoTreeWindow::RightTop: labelName = EMTOSTR(RightTop); break; case VirtualDataSceneWidget::VInfoTreeWindow::LeftCenter: labelName = EMTOSTR(LeftCenter); break; case VirtualDataSceneWidget::VInfoTreeWindow::Center: labelName = EMTOSTR(Center); break; case VirtualDataSceneWidget::VInfoTreeWindow::RightCenter: labelName = EMTOSTR(RightCenter); break; case VirtualDataSceneWidget::VInfoTreeWindow::LeftBottom: labelName = EMTOSTR(LeftBottom); break; case VirtualDataSceneWidget::VInfoTreeWindow::Bottom: labelName = EMTOSTR(Bottom); break; case VirtualDataSceneWidget::VInfoTreeWindow::RightBottom: labelName = EMTOSTR(RightBottom); break; default: break; } osg::ref_ptr<osgWidget::Label> label = createLabel(labelName); st = new TextLabelStruct; st->_label = label.get(); st->_loc = loc; _labelList.push_back(*st); st = &_labelList[_labelList.size() - 1]; } if (tex.valid()) st->_label->setTexture(tex.get(), true); st->_widthRelative = widthRelative; st->_heightRelative = heightRelative; st->_label->getText()->setFont(getSystemFont(font)); st->_label->getText()->setColor(color); st->_label->getText()->setBackdropType(bType); st->_label->getText()->setBackdropColor(bColor); }
bool StyledTTFont::loadFont(const Common::String &fontName, int32 point) { Common::String newFontName; Common::String freeFontName; Common::String liberationFontName; for (int i = 0; i < FONT_COUNT; i++) { FontStyle curFont = getSystemFont(i); if (fontName.matchString(curFont.zorkFont, true)) { newFontName = curFont.fontBase; freeFontName = curFont.freeFontBase; liberationFontName = curFont.liberationFontBase; if ((_style & STTF_BOLD) && (_style & STTF_ITALIC)) { newFontName += "bi"; freeFontName += "Bold"; freeFontName += curFont.freeFontItalicName; liberationFontName += "-BoldItalic"; } else if (_style & STTF_BOLD) { newFontName += "bd"; freeFontName += "Bold"; liberationFontName += "-Bold"; } else if (_style & STTF_ITALIC) { newFontName += "i"; freeFontName += curFont.freeFontItalicName; liberationFontName += "-Italic"; } else { liberationFontName += "-Regular"; } newFontName += ".ttf"; freeFontName += ".ttf"; liberationFontName += ".ttf"; break; } } if (newFontName.empty()) { debug("Could not identify font: %s. Reverting to Arial", fontName.c_str()); newFontName = "arial.ttf"; freeFontName = "FreeSans.ttf"; liberationFontName = "LiberationSans-Regular.ttf"; } bool sharp = (_style & STTF_SHARP) == STTF_SHARP; Common::File file; if (!file.open(newFontName) && !_engine->getSearchManager()->openFile(file, newFontName) && !file.open(liberationFontName) && !_engine->getSearchManager()->openFile(file, liberationFontName) && !file.open(freeFontName) && !_engine->getSearchManager()->openFile(file, freeFontName)) error("Unable to open font file %s (Liberation Font alternative: %s, FreeFont alternative: %s)", newFontName.c_str(), liberationFontName.c_str(), freeFontName.c_str()); Graphics::Font *_newFont = Graphics::loadTTFFont(file, point, 60, (sharp ? Graphics::kTTFRenderModeMonochrome : Graphics::kTTFRenderModeNormal)); // 66 dpi for 640 x 480 on 14" display if (_newFont) { if (!_font) delete _font; _font = _newFont; } _fntName = fontName; _lineHeight = point; if (_font) return true; return false; }
void ChatWidget::addChatInfo(UiMsgEv::ChatInfo *info,int group) { int type = info->m_chatType; if(type == UiMsgEv::MsgToUserPrivate && info->m_revId != m_userId){ //this is not for me return; } float fontSize = 30; float headWidth = 80; float rowHeight = 40; ccColor3B fHeadCC3,pHeadCC3,fContentCC3,pContentCC3; fHeadCC3 = ccGREEN; pHeadCC3 = ccWHITE; fContentCC3 = ccGREEN; pContentCC3 = ccBLUE; ccColor3B headColor,contentColor; if(type == UiMsgEv::MsgToUserPrivate) headColor = fHeadCC3; else headColor = pHeadCC3; if(type == UiMsgEv::MsgToUserPrivate) contentColor = fContentCC3; else contentColor = pContentCC3; float singleCharWidth = 16; float multiCharWidth = 30; float vscrollWidth = 10; float faceWidth = 60; float faceHeight = 60; float scrollWidth,scrollHeight; VerScrollWidget *scrollWidget = m_scrollWidgets[group]; scrollWidget->getAnchorSize(scrollWidth,scrollHeight); //16 is for ver scroll bar ChatWidgetLayer *layer = new ChatWidgetLayer(scrollWidth - 16); std::string head; head = info->m_senderNickName; if(head.empty()){ mailToNickName(info->m_senderMail,head); if(head.empty()) head = "Guest"; } head.insert(0,"["); /* blank for text edge */ head.append("]:"); #if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) CCLabelTTF *headLabel = CCLabelTTF::create(head.data(),getSystemFont(),fontSize ,CCSizeMake(0,rowHeight),kCCTextAlignmentCenter); #else //android if width ==0 && height != 0 lead to crash,fixed in cc 3.0 CCLabelTTF *headLabel = CCLabelTTF::create(head.data(),getSystemFont(),fontSize ,CCSizeMake(0,0),kCCTextAlignmentCenter); #endif headLabel->setColor(headColor); FSizeLabelDelegate *headDele = new FSizeLabelDelegate(headLabel, CCSizeMake(headLabel->getTexture()->getContentSize().width,rowHeight)); layer->setHeadWidget(headDele); layer->setHeadWidth(headWidth); if(m_headCanClicked){ headDele->setCanTouch(true); headDele->setClickCB(this,callfuncND_selector(ChatWidget::onHeadClicked)); ChaterInfo *chater = new ChaterInfo; chater->m_id = info->m_senderId; chater->m_mail = info->m_senderMail; chater->m_nick = info->m_senderNickName; m_chaterMap.insert(std::make_pair(headDele->getName(),chater)); } std::string content = info->m_chatContent; std::vector<ChatInfoFmt> chats; chatStringSplit(content,chats); std::string labelcontent; //need detract ver scroll width scrollWidth -= vscrollWidth; float spaceLeft = scrollWidth - headLabel->getTexture()->getContentSize().width; for(unsigned int i = 0;i < chats.size();i++){ ChatInfoFmt &info = chats[i]; if(info.m_type == TypeChar){ if((spaceLeft - singleCharWidth) > 0){ labelcontent.append(info.m_str); spaceLeft -= singleCharWidth; }else{ #if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) CCLabelTTF *cLabel = CCLabelTTF::create(labelcontent.data(),getSystemFont(),fontSize, CCSizeMake(0,rowHeight),kCCTextAlignmentCenter); #else CCLabelTTF *cLabel = CCLabelTTF::create(labelcontent.data(),getSystemFont(),fontSize, CCSizeMake(0,0),kCCTextAlignmentCenter); #endif cLabel->setColor(contentColor); FSizeLabelDelegate *deleLabel = new FSizeLabelDelegate(cLabel,cLabel->getTexture()->getContentSize()); layer->addContentWidget(deleLabel); spaceLeft = scrollWidth - headWidth; labelcontent.clear(); } }else if(info.m_type == TypeUtfChar){ if((spaceLeft - multiCharWidth) > 0){ labelcontent.append(info.m_str); spaceLeft -= multiCharWidth; }else{ #if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) CCLabelTTF *cLabel = CCLabelTTF::create(labelcontent.data(),getSystemFont(),fontSize, CCSizeMake(0,rowHeight),kCCTextAlignmentCenter); #else CCLabelTTF *cLabel = CCLabelTTF::create(labelcontent.data(),getSystemFont(),fontSize, CCSizeMake(0,0),kCCTextAlignmentCenter); #endif cLabel->setColor(contentColor); FSizeLabelDelegate *deleLabel = new FSizeLabelDelegate(cLabel,cLabel->getTexture()->getContentSize()); layer->addContentWidget(deleLabel); spaceLeft = scrollWidth - headWidth; labelcontent.clear(); } }else if(info.m_type == TypeFacing){ if(!labelcontent.empty()){ #if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) CCLabelTTF *cLabel = CCLabelTTF::create(labelcontent.data(),getSystemFont(),fontSize, CCSizeMake(0,rowHeight),kCCTextAlignmentCenter); #else CCLabelTTF *cLabel = CCLabelTTF::create(labelcontent.data(),getSystemFont(),fontSize, CCSizeMake(0,0),kCCTextAlignmentCenter); #endif cLabel->setColor(contentColor); FSizeLabelDelegate *deleLabel = new FSizeLabelDelegate(cLabel,cLabel->getTexture()->getContentSize()); layer->addContentWidget(deleLabel); spaceLeft -= cLabel->getTexture()->getContentSize().width; labelcontent.clear(); } std::string animName,firstFrame; animName = info.m_str; firstFrame = animName; ResourceMgr::getInstance()->getFrameSpriteFirstFrame(firstFrame); if(firstFrame.empty()) continue; BasAnimSprite *animSprite = new BasAnimSprite(animName,firstFrame); animSprite->start(); FSizeSpriteDelegate *faceDele = new FSizeSpriteDelegate(animSprite,CCSizeMake(faceWidth,faceHeight)); layer->addContentWidget(faceDele); if((spaceLeft - faceWidth) > 0){ spaceLeft -= faceWidth; }else{ spaceLeft = scrollWidth - headWidth; } } } if(!labelcontent.empty()){ #if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) CCLabelTTF *cLabel = CCLabelTTF::create(labelcontent.data(),getSystemFont(),fontSize, CCSizeMake(0,rowHeight),kCCTextAlignmentCenter); #else CCLabelTTF *cLabel = CCLabelTTF::create(labelcontent.data(),getSystemFont(),fontSize, CCSizeMake(0,0),kCCTextAlignmentCenter); #endif cLabel->setColor(contentColor); FSizeLabelDelegate *deleLabel = new FSizeLabelDelegate(cLabel,cLabel->getTexture()->getContentSize()); layer->addContentWidget(deleLabel); } layer->exec(); scrollWidget->addFixedSizeWidget(layer); scrollWidget->layout(true); if(m_autoScroll) scrollWidget->scrollToEnd(true); }
void Prop2GoldDialog::finish() { m_id = m_serverIface->getLoginAccountInfo()->m_id; std::stringstream ss; if(1){ //init gold has info m_goldHad = m_serverIface->getPropNumByUid(m_id,PropDef::Props_Gold); std::string goldImg; PropDef::getVirtualPropsName(PropDef::Props_Gold,goldImg); goldImg += ".png"; CCSprite *goldSprite = CCSprite::createWithSpriteFrameName(goldImg.data()); m_goldImgDele = new FSizeCCNodeDelegate(goldSprite); this->addChild(m_goldImgDele); m_goldImgDele->setLeft("parent",uilib::Left); m_goldImgDele->setTop("parent",uilib::Top); m_goldImgDele->setLeftMargin(m_edgeSize); m_goldImgDele->setTopMargin(m_edgeSize); m_goldImgDele->setLeftMargin(m_edgeSize); m_goldImgDele->setTopMargin(m_edgeSize); ss.str("");ss << "x" << m_goldHad; m_goldSprite = CCLabelBMFont::create(ss.str().data(),"fonts/font30.fnt"); FSizeCCNodeDelegate *numDele = new FSizeCCNodeDelegate(m_goldSprite); this->addChild(numDele); numDele->setLeft(m_goldImgDele->getName(),uilib::Right); numDele->setLeftMargin(2); numDele->setVertical(m_goldImgDele->getName(),0.5); } if(1){ //init confirmbutton LangDef *lang = ResourceMgr::getInstance()->getLangDef(); m_confirmButton = new BasButton(); m_confirmButton->setButtonInfo(lang->getStringById(StringEnum::SellOut),"default","buttonbg",CCSizeMake(0,0),"",getSystemFont(),24,ccWHITE); m_confirmButton->setClickCB(this,callfuncND_selector(Prop2GoldDialog::onSubmitButtonClicked)); this->addChild(m_confirmButton); m_confirmButton->setHorizontal("parent",0.5); m_confirmButton->setBottom("parent",uilib::Bottom); m_confirmButton->setBottomMargin(m_edgeSize); } if(1){ //init scroll widget m_scrollWidget = new VerScrollWidget; m_scrollWidget->setVerticalScrollPolicy(uilib::ScrollShow_Need); m_scrollWidget->setHorizontalScrollPolicy(uilib::ScrollShow_Never); this->addChild(m_scrollWidget); m_scrollWidget->setLeft("parent",uilib::Left); m_scrollWidget->setRight("parent",uilib::Right); m_scrollWidget->setTop(m_goldImgDele->getName(),uilib::Bottom); m_scrollWidget->setBottom(m_confirmButton->getName(),uilib::Top); m_scrollWidget->setBottomMargin(8); m_scrollWidget->setLeftMargin(m_edgeSize); m_scrollWidget->setRightMargin(m_edgeSize); int ruleCount = m_propRules->size(); float width = m_anchorWidth - m_edgeSize * 4; std::stringstream ss; std::string imgName; for(int i = 0;i < ruleCount;i++){ const UiMsgEv::PropExchangeRule &rule = m_propRules->at(i); if(rule.m_propType == PropDef::Props_Coin){ m_propExOn.push_back(0); m_propExLabel.push_back(0); m_propsNum.push_back(0); m_propLabel.push_back(0); continue; } BorderWidget *border = new BorderWidget; border->setTheme("default","propbg"); border->setWidth(width); border->setHeight(100); FSizeWidgetDelegate *dele = new FSizeWidgetDelegate(border,CCSizeMake(width,100)); m_scrollWidget->addFixedSizeWidget(dele); imgName = rule.m_propName + ".png"; CCSprite *propSprite = CCSprite::createWithSpriteFrameName(imgName.data()); int num = m_serverIface->getPropNumByUid(m_id,rule.m_propType); m_propsNum.push_back(num); ss.str("");ss << "x" << num; CCLabelBMFont *numSprite = CCLabelBMFont::create(ss.str().data(),"fonts/uifont24.fnt"); m_propLabel.push_back(numSprite); FSizeCCNodeDelegate *propDele = new FSizeCCNodeDelegate(propSprite); border->addChild(propDele); propDele->setLeft("parent",uilib::Left); propDele->setVertical("parent",0.5); propDele->setRightMargin(2); FSizeCCNodeDelegate *numDele = new FSizeCCNodeDelegate(numSprite); border->addChild(numDele); numDele->setLeft(propDele->getName(),uilib::Right); numDele->setVertical("parent",0.5); BasButton *incButton = new BasButton; incButton->setButtonIndex(i); incButton->setButtonInfo("","default","uiincrease",CCSizeMake(0,0)); incButton->setClickCB(this,callfuncND_selector(Prop2GoldDialog::onIncButtonClicked)); border->addChild(incButton); incButton->setRight("parent",uilib::Right); incButton->setRightMargin(2); incButton->setVertical("parent",0.5); incButton->setTouchInCB(this,callfuncND_selector(Prop2GoldDialog::onIncTouchBegin)); incButton->setTouchOutCB(this,callfuncND_selector(Prop2GoldDialog::onIncTouchEnd)); ss.str("");ss << "x" << m_goldHad; CCLabelBMFont *propNumLabel = CCLabelBMFont::create(ss.str().data(),"fonts/uifont24.fnt"); FSizeCCNodeDelegate *propNumDele = new FSizeCCNodeDelegate(propNumLabel); propNumLabel->setString("x0"); border->addChild(propNumDele); propNumDele->setRight(incButton->getName(),uilib::Left); propNumDele->setVertical("parent",0.5); m_propExOn.push_back(0); m_propExLabel.push_back(propNumLabel); BasButton *decButton = new BasButton; decButton->setButtonIndex(i); decButton->setButtonInfo("","default","uidecrease",CCSizeMake(0,0)); decButton->setClickCB(this,callfuncND_selector(Prop2GoldDialog::onDecButtonClicked)); border->addChild(decButton); decButton->setRight(propNumDele->getName(),uilib::Left); decButton->setVertical("parent",0.5); decButton->setTouchInCB(this,callfuncND_selector(Prop2GoldDialog::onDecTouchBegin)); decButton->setTouchOutCB(this,callfuncND_selector(Prop2GoldDialog::onDecTouchEnd)); } m_scrollWidget->setSpacing(20); } if(1){ std::string anim,first; anim = "uiloadinga"; first = anim; ResourceMgr::getInstance()->getFrameSpriteFirstFrame(first); m_busyAnim = new BasAnimSprite(anim,first); FSizeCCNodeDelegate *busyNode = new FSizeCCNodeDelegate(m_busyAnim); this->addChild(busyNode); busyNode->setCenterIn("parent"); m_busyAnim->setVisible(false); } }