Beispiel #1
0
bool CATextField::attachWithIME()
{
    bool bRet = CAIMEDelegate::attachWithIME();
    if (bRet)
    {
        // open keyboard
        CCEGLView * pGlView = CAApplication::getApplication()->getOpenGLView();
        if (pGlView)
        {
#if(CC_TARGET_PLATFORM==CC_PLATFORM_ANDROID||CC_TARGET_PLATFORM==CC_PLATFORM_IOS)
            if (getKeyboardType() ==KEY_BOARD_TYPE_NORMAL)
            {
                pGlView->setIMEKeyboardDefault();
            }
            else if (getKeyboardType() ==KEY_BOARD_TYPE_NUMBER)
            {
                pGlView->setIMEKeyboardNumber();
            }
            else if(getKeyboardType() ==KEY_BOARD_TYPE_ALPHABET)
            {
                pGlView->setIMEKeyboardAlphabet();
            }
#endif
            pGlView->setIMEKeyboardState(true);
        }
    }
    return bRet;
}
Beispiel #2
0
bool CATextField::attachWithIME()
{
    bool bRet = CAIMEDelegate::attachWithIME();
    if (bRet)
    {
        // open keyboard
        CCEGLView * pGlView = CAApplication::getApplication()->getOpenGLView();
        if (pGlView)
        {
#if(CC_TARGET_PLATFORM==CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM==CC_PLATFORM_IOS)
            if (getKeyboardType() ==KEY_BOARD_TYPE_NORMAL)
            {
                pGlView->setIMEKeyboardDefault();
            }
            else if (getKeyboardType() ==KEY_BOARD_TYPE_NUMBER)
            {
                pGlView->setIMEKeyboardNumber();
            }
            else if(getKeyboardType() ==KEY_BOARD_TYPE_ALPHABET)
            {
                pGlView->setIMEKeyboardAlphabet();
            }
            
            if (getKeyboardReturnType() ==KEY_BOARD_RETURN_SEND)
            {
                pGlView->setIMEKeyboardReturnSend();
            }
            else if (getKeyboardReturnType() ==KEY_BOARD_RETURN_SEARCH)
            {
                pGlView->setIMEKeyboardReturnSearch();
            }
            else if(getKeyboardReturnType() ==KEY_BOARD_RETURN_DONE)
            {
                pGlView->setIMEKeyboardReturnDone();
            }
#endif
            this->showCursorMark();
            m_pCursorMark->setCenterOrigin(CCPoint(getCursorX() + m_iHoriMargins, m_obContentSize.height / 2));
            pGlView->setIMEKeyboardState(true);
        }
    }
    return bRet;
}
Beispiel #3
0
bool CCTextFieldTTF::attachWithIME()
{
    bool bRet = CCIMEDelegate::attachWithIME();
    if (bRet)
    {
        // open keyboard
        CCEGLView * pGlView = CCDirector::sharedDirector()->getOpenGLView();
        if (pGlView)
        {
            if (getKeyboardType() ==KEY_BOARD_TYPE_NORMAL) {
                pGlView->setIMEKeyboardDefault();
            }
            else if (getKeyboardType() ==KEY_BOARD_TYPE_NUMBER) {
                pGlView->setIMEKeyboardNumber();
            }
            pGlView->setIMEKeyboardState(true);
        }
    }
    return bRet;
}
CCLayer* RemindLayer::createRLayer(const char *tStr, int remindType){
    CCLayer* layer = new CCLayer();
    int tagOpen = 0;
    int tagClose = 0;
    bool typeOn;
    switch (remindType) {
        case EN_REMIND_ACTIVITY:
            tagOpen = kActivityOnTag;
            tagClose = kActivityOffTag;
            typeOn = CGameData::Inst()->isActivityRemind;
            break;
        case EN_REMIND_TWOUP:
            tagOpen = kTwoupOnTag;
            tagClose = kTwoupOffTag;
            typeOn = CGameData::Inst()->isTwoUpRemind;
            break;
        case EN_REMIND_CNTRYCD:
            tagOpen = kCntryCdOnTag;
            tagClose = kCntryCdOffTag;
            typeOn = CGameData::Inst()->isCntryCdRemind;
            break;
        case EN_REMIND_POWER:{
            tagOpen = kPowerOnTag;
            tagClose = kPowerOffTag;
            typeOn = CGameData::Inst()->intPowerRemind;

            CCSprite* spMenu1 = CCSprite::spriteWithFile("pushConfig_tilizhi.png");
            CCSprite* spMenu2 = CCSprite::spriteWithFile("pushConfig_tilizhi.png");
            CCMenuItem* item = CCMenuItemImage::itemFromNormalSprite(spMenu1,spMenu2,
                                                                      this, menu_selector(RemindLayer::MoveUpKeyboard));
            item->setPosition(ccp(0,0));
            item->setAnchorPoint(CCPointZero);
            CCMenu *menu = CCMenu::menuWithItems (item, NULL);
            menu->setPosition(ccp(-50,20));
            layer->addChild(menu, 2);
            
            char buf[100];
            snprintf(buf, 99,"%d", CGameData::Inst()->intPowerRemind);
            powerNumber = CCTextFieldTTF::textFieldWithPlaceHolder(buf,CCSizeMake(100, 200) ,CCTextAlignmentCenter,"huakangfont.ttf", 32);
            powerNumber->setPosition(ccp(12, 40));
            powerNumber->setColor(ccWHITE);
            powerNumber->setDelegate(this);
            layer->addChild(powerNumber,10);
            CCEGLView * pGlView = CCDirector::sharedDirector()->getOpenGLView();
            pGlView->setIMEKeyboardNumber();
            break;
        }
        default:
            tagOpen = kActivityOnTag;
            tagClose = kActivityOffTag;
            typeOn = CGameData::Inst()->isCntryCdRemind;
            break;
    }
    CCSprite* spFrame = CCSprite::spriteWithFile("pushConfig_Bg.png");
    spFrame->setPosition(CCPointMake(2, 0));
    layer->addChild(spFrame);
    TextNode *remindLabel = TextNode::textWithString(tStr, 32);
    remindLabel->setColor(ccc3(255, 255, 255));
    remindLabel->setShadowColor(ccc3(0, 0, 0));
    remindLabel->setPosition(ccp(0,40));
    layer->addChild(remindLabel);
    
    CCSprite* spMenu1 = CCSprite::spriteWithSpriteFrameName("fr_open.png");
    CCSprite* spMenu2 = CCSprite::spriteWithSpriteFrameName("fr_open.png");
    CCSprite* spMenu3 = CCSprite::spriteWithSpriteFrameName("fr_open2.png");
    CCMenuItem* item1 = CCMenuItemImage::itemFromNormalSprite(spMenu1,spMenu2,spMenu3,
                                                          this, menu_selector(RemindLayer::switchOnOff));
    item1->setPosition(ccp(-170, -50));
    item1->setAnchorPoint(ccp(0, 0));
    item1->setTag(tagOpen);
    
    spMenu1 = CCSprite::spriteWithSpriteFrameName("fr_close.png");
    spMenu2 = CCSprite::spriteWithSpriteFrameName("fr_close.png");
    spMenu3 = CCSprite::spriteWithSpriteFrameName("fr_close2.png");
    CCMenuItem* item2 = CCMenuItemImage::itemFromNormalSprite(spMenu1,spMenu2,spMenu3,
                                                           this, menu_selector(RemindLayer::switchOnOff));
    item2->setPosition(ccp(30, -50));
    item2->setAnchorPoint(ccp(0, 0));
    item2->setTag(tagClose);
    
    item1->setIsEnabled(!typeOn);
    item2->setIsEnabled(typeOn);
    
    CCMenu *menu = CCMenu::menuWithItems (item1,item2,
                                          NULL);
    menu->setPosition(ccp(0, 0));
    layer->addChild(menu);
    return layer;
}