예제 #1
0
XIBObject *GetButtonContent(NIBWriter *writer, XIBObject *obj, char *mode)
{
    XIBObject *buttonContent = new XIBObject();
    buttonContent->_className = "UIButtonContent";
    buttonContent->_outputClassName = "UIButtonContent";
    buttonContent->_needsConversion = false;

    char szName[255];
    XIBObject *findObj;

    sprintf(szName, "IBUI%sTitle", mode);
    findObj = obj->FindMember(szName);
    if ( findObj ) {
        buttonContent->AddOutputMember(writer, "UITitle", findObj);
    }

    sprintf(szName, "IBUI%sImage", mode);
    findObj = obj->FindMember(szName);
    if ( findObj ) {
        buttonContent->AddOutputMember(writer, "UIImage", findObj);
    }

    sprintf(szName, "IBUI%sBackgroundImage", mode);
    findObj = obj->FindMember(szName);
    if ( findObj ) {
        buttonContent->AddOutputMember(writer, "UIBackgroundImage", findObj);
    }

    sprintf(szName, "IBUI%sTitleShadowColor", mode);
    findObj = obj->FindMember(szName);
    if ( findObj ) {
        buttonContent->AddOutputMember(writer, "UIShadowColor", findObj);
    }

    sprintf(szName, "IBUI%sTitleColor", mode);
    findObj = obj->FindMember(szName);
    if ( findObj ) {
        buttonContent->AddOutputMember(writer, "UITitleColor", findObj);
    } else {
        if ( strcmp(mode, "Normal") != 0 && buttonContent->_outputMembers.size() > 0 ) {
            //findObj = obj->FindMember("IBUINormalTitleColor");
            //buttonContent->AddOutputMember(writer, "UITitleColor", findObj);
        } else if ( strcmp(mode, "Normal") == 0 ) {
            UIColor *color = new UIColor(4, 4, 0.0f, 0.0f, 0.0f, 0.0f, "whiteColor");
            buttonContent->AddOutputMember(writer, "UITitleColor", color->CreateObject(writer));
        }
    }

    return buttonContent;
}
예제 #2
0
static XIBObject* GetButtonContentStoryboard(NIBWriter* writer, XIBObject* obj, char* mode) {
    XIBObject* buttonContent = new XIBObject();
    buttonContent->_className = "UIButtonContent";
    buttonContent->_outputClassName = "UIButtonContent";
    buttonContent->_needsConversion = false;

    obj = obj->FindMemberAndHandle(mode);
    if (!obj) {
        return buttonContent;
    }

    if (obj->getAttrib("image") != NULL) {
        UICustomResource* image = new UICustomResource();
        image->_imageName = obj->getAttrAndHandle("image");
        buttonContent->AddOutputMember(writer, "UIImage", image);
    }

    if (obj->getAttrib("backgroundImage") != NULL) {
        UICustomResource* image = new UICustomResource();
        image->_imageName = obj->getAttrAndHandle("backgroundImage");
        buttonContent->AddOutputMember(writer, "UIBackgroundImage", image);
    }

    if (obj->getAttrib("title") != NULL) {
        buttonContent->AddOutputMember(writer, "UITitle", new XIBObjectString(obj->getAttrAndHandle("title")));
    }

    if (obj->FindMember("titleShadowColor") != NULL) {
        buttonContent->AddOutputMember(writer, "UIShadowColor", obj->FindMemberAndHandle("titleShadowColor"));
    }

    if (obj->FindMember("titleColor") != NULL) {
        buttonContent->AddOutputMember(writer, "UITitleColor", obj->FindMemberAndHandle("titleColor"));
    } else if (strcmp(mode, "normal") == 0) {
        UIColor* color = new UIColor(0, 4, 0.0f, 0.47f, 0.84f, 1.0f, NULL);
        color->_isStory = true;
        buttonContent->AddOutputMember(writer, "UITitleColor", color);
    }

    return buttonContent;
}