• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ XIBObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中XIBObject的典型用法代码示例。如果您正苦于以下问题:C++ XIBObject类的具体用法?C++ XIBObject怎么用?C++ XIBObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了XIBObject类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: InitFromXIB

void UITextField::InitFromXIB(XIBObject* obj) {
    UIControl::InitFromXIB(obj);

    _shadowOffset = obj->GetSize("IBUIShadowOffset", 0.0, 0.0f);
    _text = obj->GetString("IBUIText", NULL);
    _textColor = obj->FindMember("IBUITextColor");
    _placeholder = obj->GetString("IBUIPlaceholder", NULL);
    _borderStyle = obj->GetInt("IBUIBorderStyle", 0);
    _font = (UIFont*)obj->FindMember("IBUIFontDescription");
    if (!_font) {
        _font = (UIFont*)obj->FindMember("IBUIFont");
    }

    XIBObject* inputTraits = obj->FindMember("IBUITextInputTraits");
    if (inputTraits) {
        _autoCorrectionType = inputTraits->GetInt("IBUIAutocorrectionType", 0);
        _returnKeyType = inputTraits->GetInt("IBUIReturnKeyType", 0);
    }

    _clearsOnBeginEditing = obj->GetBool("IBUIClearsOnBeginEditing", false);
    if (_clearsOnBeginEditing) {
        _clearButtonOffset.width = 3.0f;
        _clearButtonOffset.height = 1.0f;
    }
    obj->_outputClassName = "UITextField";
}
开发者ID:Dyndrilliac,项目名称:WinObjC,代码行数:26,代码来源:UITextField.cpp


示例2: IS_CONVERTER

XIBObject* ObjectConverter::ConverterForObject(const char* className, pugi::xml_node node) {
    XIBObject* ret = NULL;

    // NOTE: Legacy XIBs (pre-XCode5) are not really under active expansion. Developers can upgrade their XIBs to modern XIB format using ibtool
    IS_CONVERTER(ret, className, "IBCocoaTouchEventConnection", UIRuntimeEventConnection)
    IS_CONVERTER(ret, className, "IBCocoaTouchOutletConnection", UIRuntimeOutletConnection)
    IS_CONVERTER(ret, className, "IBCocoaTouchOutletCollectionConnection", UIRuntimeOutletCollectionConnection)
    IS_CONVERTER(ret, className, "IBUICustomObject", ObjectConverterSwapper)
    IS_CONVERTER(ret, className, "IBProxyObject", UIProxyObject)
    IS_CONVERTER(ret, className, "IBUIView", UIView)
    IS_CONVERTER(ret, className, "IBUIViewController", UIViewController)
    IS_CONVERTER(ret, className, "NSColor", UIColor)
    IS_CONVERTER(ret, className, "IBUIFontDescription", UIFont)
    IS_CONVERTER(ret, className, "NSFont", UIFont)
    IS_CONVERTER(ret, className, "IBUIButton", UIButton)
    IS_CONVERTER(ret, className, "NSCustomResource", UICustomResource)
    IS_CONVERTER(ret, className, "NSImage", UICustomResource)
    IS_CONVERTER(ret, className, "IBUIWindow", UIWindow)
    IS_CONVERTER(ret, className, "IBUIScrollView", UIScrollView)
    IS_CONVERTER(ret, className, "IBUITableView", UITableView)
    IS_CONVERTER(ret, className, "IBUINavigationBar", UINavigationBar)
    IS_CONVERTER(ret, className, "IBUINavigationItem", UINavigationItem)
    IS_CONVERTER(ret, className, "IBUIBarButtonItem", UIBarButtonItem)
    IS_CONVERTER(ret, className, "IBUIImageView", UIImageView)
    IS_CONVERTER(ret, className, "IBUILabel", UILabel)
    IS_CONVERTER(ret, className, "IBUIAccessibilityConfiguration", UIRuntimeAccessibilityConfiguration)
    IS_CONVERTER(ret, className, "IBUITableViewCell", UITableViewCell)
    IS_CONVERTER(ret, className, "IBUITextField", UITextField)
    IS_CONVERTER(ret, className, "IBUITextView", UITextView)
    IS_CONVERTER(ret, className, "IBUIPickerView", UIPickerView)
    IS_CONVERTER(ret, className, "IBUIPageControl", UIPageControl)
    IS_CONVERTER(ret, className, "IBUIActivityIndicatorView", UIActivityIndicatorView)
    IS_CONVERTER(ret, className, "IBUISwitch", UISwitch)
    IS_CONVERTER(ret, className, "IBUIWebView", UIWebView)
    IS_CONVERTER(ret, className, "IBUITabBarController", UITabBarController)
    IS_CONVERTER(ret, className, "IBUINavigationController", UINavigationController)
    IS_CONVERTER(ret, className, "IBUITableViewController", UITableViewController)
    IS_CONVERTER(ret, className, "IBUITabBar", UITabBar)
    IS_CONVERTER(ret, className, "IBUITabBarItem", UITabBarItem)
    IS_CONVERTER(ret, className, "IBUIToolbar", UIToolbar)
    IS_CONVERTER(ret, className, "IBUISegmentedControl", UISegmentedControl)
    IS_CONVERTER(ret, className, "IBUIDatePicker", UIDatePicker)
    IS_CONVERTER(ret, className, "IBUISearchBar", UISearchBar)
    IS_CONVERTER(ret, className, "IBMKMapView", MKMapView)
    IS_CONVERTER(ret, className, "IBUISearchDisplayController", UISearchDisplayController)
    IS_CONVERTER(ret, className, "IBUISlider", UISlider)
    IS_CONVERTER(ret, className, "IBNSLayoutConstraint", NSLayoutConstraint)

    // Stubbed implementation
    IS_CONVERTER(ret, className, "IBUIProgressView", UIProgressView)
    IS_CONVERTER(ret, className, "IBUIPongPressGestureRecognizer", UIPongPressGestureRecognizer)

    if (ret == NULL) {
        ret = new XIBObject();
    }

    ret->ScanXIBNode(node);

    return ret;
}
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:60,代码来源:ObjectConverter.cpp


示例3: findReference

void UIViewController::InitFromStory(XIBObject *obj)
{
    ObjectConverterSwapper::InitFromStory(obj);
    _view = (UIView *) obj->FindMember("view");

    if ( _connections ) {
        for ( int i = 0; i < _connections->count(); i ++ ) {
            XIBObject *curObj = _connections->objectAtIndex(i);
            if ( strcmp(curObj->_className, "segue") == 0 ) {
                const char *pDest = curObj->getAttrib("destination");
                const char *pKind = curObj->getAttrib("kind");

                XIBObject *newController = findReference(pDest);

                if ( newController && strcmp(pKind, "relationship") == 0 ) {
                    ((UIViewController *) newController)->_parentViewController = this;
                    _childViewControllers->AddMember(NULL, newController);
                    _viewControllers->AddMember(NULL, newController);
                }
            }
        }
    }

    _tabBarItem = (UITabBarItem *) FindMember("tabBarItem");
    _navigationItem = (UINavigationItem *) obj->FindMember("navigationItem");

    _outputClassName = "UIViewController";
}
开发者ID:Strongc,项目名称:WinObjC,代码行数:28,代码来源:UIViewController.cpp


示例4: IS_CONVERTER

XIBObject *ObjectConverter::ConverterForStoryObject(const char *className, pugi::xml_node node)
{
    XIBObject *ret = NULL;

    IS_CONVERTER(ret, className, "objects", XIBArray)
    IS_CONVERTER(ret, className, "subviews", XIBArray)
    IS_CONVERTER(ret, className, "constraints", XIBArray)
    IS_CONVERTER(ret, className, "variation", XIBVariation)
    IS_CONVERTER(ret, className, "items", XIBArray)
    IS_CONVERTER(ret, className, "connections", XIBArray)
    IS_CONVERTER(ret, className, "string", XIBObjectString)
    IS_CONVERTER(ret, className, "viewController", UIViewController)
    IS_CONVERTER(ret, className, "placeholder", UIProxyObject)
    IS_CONVERTER(ret, className, "tabBarController", UITabBarController)
    IS_CONVERTER(ret, className, "navigationItem", UINavigationItem)
    IS_CONVERTER(ret, className, "navigationBar", UINavigationBar)
    IS_CONVERTER(ret, className, "navigationController", UINavigationController)
    IS_CONVERTER(ret, className, "tabBarItem", UITabBarItem)
    IS_CONVERTER(ret, className, "tabBar", UITabBar)
    IS_CONVERTER(ret, className, "view", UIView)
    IS_CONVERTER(ret, className, "scrollView", UIScrollView)
    IS_CONVERTER(ret, className, "label", UILabel)
    IS_CONVERTER(ret, className, "toolbar", UIToolbar)
    IS_CONVERTER(ret, className, "color", UIColor)
    IS_CONVERTER(ret, className, "barButtonItem", UIBarButtonItem)
    IS_CONVERTER(ret, className, "outlet", UIRuntimeOutletConnection)
    IS_CONVERTER(ret, className, "segue", UIStoryboardSegue)
    IS_CONVERTER(ret, className, "fontDescription", UIFont)
    IS_CONVERTER(ret, className, "tableViewController", UITableViewController)
    IS_CONVERTER(ret, className, "tableView", UITableView)
    IS_CONVERTER(ret, className, "textField", UITextField)
    IS_CONVERTER(ret, className, "textView", UITextView)
    IS_CONVERTER(ret, className, "button", UIButton)
    IS_CONVERTER(ret, className, "webView", UIWebView)
    IS_CONVERTER(ret, className, "searchBar", UISearchBar)
    IS_CONVERTER(ret, className, "searchDisplayController", UISearchDisplayController)
    IS_CONVERTER(ret, className, "activityIndicatorView", UIActivityIndicatorView)
    IS_CONVERTER(ret, className, "imageView", UIImageView)
    IS_CONVERTER(ret, className, "action", UIRuntimeEventConnection)
    IS_CONVERTER(ret, className, "switch", UISwitch)
    IS_CONVERTER(ret, className, "constraint", NSLayoutConstraint)
    IS_CONVERTER(ret, className, "layoutGuides", XIBVariation)
    IS_CONVERTER(ret, className, "viewControllerLayoutGuide", _UILayoutGuide)
    IS_CONVERTER(ret, className, "datePicker", UIDatePicker)
    IS_CONVERTER(ret, className, "slider", UISlider)

    if ( ret == NULL ) {
#ifdef _DEBUG
        printf("Unrecognized tag <%s>\n", className);
#endif
        ret = new XIBObject();
    }

    ret->ScanStoryObjects(node);

    return ret;
}
开发者ID:Jinchenyuan,项目名称:WinObjC,代码行数:57,代码来源:ObjectConverter.cpp


示例5: IS_CONVERTER

XIBObject *ObjectConverter::ConverterForObject(const char *className, pugi::xml_node node)
{
    XIBObject *ret = NULL;

    IS_CONVERTER(ret, className, "IBCocoaTouchEventConnection", UIRuntimeEventConnection)
    IS_CONVERTER(ret, className, "IBCocoaTouchOutletConnection", UIRuntimeOutletConnection)
    IS_CONVERTER(ret, className, "IBCocoaTouchOutletCollectionConnection", UIRuntimeOutletCollectionConnection)
    IS_CONVERTER(ret, className, "IBUICustomObject", ObjectConverterSwapper)
    IS_CONVERTER(ret, className, "IBProxyObject", UIProxyObject)
    IS_CONVERTER(ret, className, "IBUIView", UIView)
    IS_CONVERTER(ret, className, "IBUIViewController", UIViewController)
    IS_CONVERTER(ret, className, "NSColor", UIColor)
    IS_CONVERTER(ret, className, "IBUIFontDescription", UIFont)
    IS_CONVERTER(ret, className, "NSFont", UIFont)
    IS_CONVERTER(ret, className, "IBUIButton", UIButton)
    IS_CONVERTER(ret, className, "NSCustomResource", UICustomResource)
    IS_CONVERTER(ret, className, "NSImage", UICustomResource)
    IS_CONVERTER(ret, className, "IBUIWindow", UIWindow)
    IS_CONVERTER(ret, className, "IBUIScrollView", UIScrollView)
    IS_CONVERTER(ret, className, "IBUITableView", UITableView)
    IS_CONVERTER(ret, className, "IBUINavigationBar", UINavigationBar)
    IS_CONVERTER(ret, className, "IBUINavigationItem", UINavigationItem)
    IS_CONVERTER(ret, className, "IBUIBarButtonItem", UIBarButtonItem)
    IS_CONVERTER(ret, className, "IBUIImageView", UIImageView)
    IS_CONVERTER(ret, className, "IBUILabel", UILabel)
    IS_CONVERTER(ret, className, "IBUIAccessibilityConfiguration", UIRuntimeAccessibilityConfiguration)
    IS_CONVERTER(ret, className, "IBUITableViewCell", UITableViewCell)
    IS_CONVERTER(ret, className, "IBUITextField", UITextField)
    IS_CONVERTER(ret, className, "IBUITextView", UITextView)
    IS_CONVERTER(ret, className, "IBUIPickerView", UIPickerView)
    IS_CONVERTER(ret, className, "IBUIPageControl", UIPageControl)
    IS_CONVERTER(ret, className, "IBUIActivityIndicatorView", UIActivityIndicatorView)
    IS_CONVERTER(ret, className, "IBUISwitch", UISwitch)
    IS_CONVERTER(ret, className, "IBUIWebView", UIWebView)
    IS_CONVERTER(ret, className, "IBUITabBarController", UITabBarController)
    IS_CONVERTER(ret, className, "IBUINavigationController", UINavigationController)
    IS_CONVERTER(ret, className, "IBUITableViewController", UITableViewController)
    IS_CONVERTER(ret, className, "IBUITabBar", UITabBar)
    IS_CONVERTER(ret, className, "IBUITabBarItem", UITabBarItem)
    IS_CONVERTER(ret, className, "IBUIToolbar", UIToolbar)
    IS_CONVERTER(ret, className, "IBUISegmentedControl", UISegmentedControl)
    IS_CONVERTER(ret, className, "IBUIDatePicker", UIDatePicker)
    IS_CONVERTER(ret, className, "IBUISearchBar", UISearchBar)
    IS_CONVERTER(ret, className, "IBMKMapView", MKMapView)
    IS_CONVERTER(ret, className, "IBUISearchDisplayController", UISearchDisplayController)
    IS_CONVERTER(ret, className, "IBUISlider", UISlider)
    IS_CONVERTER(ret, className, "IBNSLayoutConstraint", NSLayoutConstraint)

    if ( ret == NULL ) {
        ret = new XIBObject();
    }

    ret->ScanXIBNode(node);

    return ret;
}
开发者ID:Strongc,项目名称:WinObjC,代码行数:56,代码来源:ObjectConverter.cpp


示例6: printf

void NIBWriter::ExportController(const char *controllerId)
{
    char szFilename[255];

    XIBObject* controller = XIBObject::findReference(controllerId);
    UIViewController* uiViewController = dynamic_cast<UIViewController*>(controller);
    if (!uiViewController) {
        //object isn't really a controller
        printf("Object %s is not a controller\n", controller->stringValue());
        return;
    }

    const char* controllerIdentifier = uiViewController->_storyboardIdentifier;
    if (controllerIdentifier == NULL) {
        //not all viewcontrollers will have a storyboard identifier. If they don't use the controller Id for the key.
        controllerIdentifier = controllerId;
    }

    //  Check if we've already written out the controller
    if (_g_exportedControllers.find(controllerId) != _g_exportedControllers.end()) {
        return;
    }

    sprintf(szFilename, "%s.nib", controllerIdentifier);

    _g_exportedControllers[controllerIdentifier] = controllerIdentifier;

    XIBArray *objects = (XIBArray *) controller->_parent;

    printf("Writing %s\n", GetOutputFilename(szFilename).c_str());
    FILE *fpOut = fopen(GetOutputFilename(szFilename).c_str(), "wb");

    NIBWriter *writer = new NIBWriter(fpOut, NULL, NULL);

    XIBObject *firstResponderProxy = writer->AddProxy("IBFirstResponder");
    XIBObject *ownerProxy = writer->AddProxy("IBFilesOwner");
    XIBObject *storyboard = writer->AddProxy("UIStoryboardPlaceholder");

    XIBArray *arr = (XIBArray *) objects;
    for ( int i = 0; i < arr->count(); i ++ ) {
        XIBObject *curObj = arr->objectAtIndex(i);

        writer->ExportObject(curObj);
        if ( curObj->getAttrib("sceneMemberID") ) {
            if ( strcmp(curObj->getAttrib("sceneMemberID"), "viewController") == 0 ) {
                writer->AddOutletConnection(ownerProxy, curObj, "sceneViewController");
            }
        }
    }

    writer->WriteObjects();

    fclose(fpOut);
}
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:54,代码来源:NIBWriter.cpp


示例7: InitFromXIB

void UITextView::InitFromXIB(XIBObject *obj)
{
    UIScrollView::InitFromXIB(obj);

    _shadowOffset = obj->GetSize("IBUIShadowOffset", 0, 0.0f);
    _text = obj->GetString("IBUIText", NULL);
    _textColor = obj->FindMember("IBUITextColor");
    _font = (UIFont *) obj->FindMember("IBUIFontDescription");
    _editable = obj->GetBool("IBUIEditable", true);
    _dataDetectorTypes = obj->GetInt("IBUIDataDetectorTypes", 0);   
    if ( !_font ) _font = (UIFont *) obj->FindMember("IBUIFont");
    _textAlignment = 0;

    XIBObject *inputTraits = obj->FindMember("IBUITextInputTraits");
    if ( inputTraits ) {
        _autoCorrectionType = inputTraits->GetInt("IBUIAutocorrectionType", 0);
        _returnKeyType = inputTraits->GetInt("IBUIReturnKeyType", 0);
    }
    obj->_outputClassName = "UITextView";
}
开发者ID:netroby,项目名称:WinObjC,代码行数:20,代码来源:UITextView.cpp


示例8: sprintf

void NIBWriter::ExportController(const char *controllerId)
{
    static std::vector<char *> _exportedControllers;

    for ( std::vector<char *>::iterator cur = _exportedControllers.begin(); cur != _exportedControllers.end(); cur ++ ) {
        if ( strcmp(*cur, controllerId) == 0 ) {
            return;
        }
    }
    _exportedControllers.push_back(strdup(controllerId));
    XIBObject *controller = XIBObject::findReference(controllerId);
    XIBArray *objects = (XIBArray *) controller->_parent;

    char szFilename[255];
    sprintf(szFilename, "UIViewController-%s.nib", controllerId);   
    printf("Writing %s\n", szFilename);
    FILE *fpOut = fopen(szFilename, "wb");

    NIBWriter *writer = new NIBWriter(fpOut, NULL, NULL);

    XIBObject *firstResponderProxy = writer->AddProxy("IBFirstResponder");
    XIBObject *ownerProxy = writer->AddProxy("IBFilesOwner");
    XIBObject *storyboard = writer->AddProxy("UIStoryboardPlaceholder");

    XIBArray *arr = (XIBArray *) objects;
    for ( int i = 0; i < arr->count(); i ++ ) {
        XIBObject *curObj = arr->objectAtIndex(i);

        writer->ExportObject(curObj);
        if ( curObj->getAttrib("sceneMemberID") ) {
            if ( strcmp(curObj->getAttrib("sceneMemberID"), "viewController") == 0 ) {
                writer->AddOutletConnection(ownerProxy, curObj, "sceneViewController");
            }
        }
    }

    writer->WriteObjects();

    fclose(fpOut);
}
开发者ID:netroby,项目名称:WinObjC,代码行数:40,代码来源:NIBWriter.cpp


示例9: XIBObject

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;
}
开发者ID:netroby,项目名称:WinObjC,代码行数:50,代码来源:UIButton.cpp


示例10: GetButtonContentStoryboard

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;
}
开发者ID:Acorld,项目名称:WinObjC-Heading,代码行数:41,代码来源:UIButton.cpp


示例11: ConvertXIBToNib

void ConvertXIBToNib(FILE* fpOut, pugi::xml_document& doc) {
    pugi::xml_node dataNode = doc.first_element_by_path("/archive/data");

    XIBObject* root = new XIBObject();
    root->ScanXIBNode(dataNode);
    XIBObject::ParseAllXIBMembers();

    XIBObject* Objects = root->FindMember("IBDocument.Objects");
    XIBObject* objectRecords = Objects->FindMember("objectRecords");
    XIBDictionary* properties = (XIBDictionary*)Objects->FindMember("flattenedProperties");

    XIBObject* orderedObjects = objectRecords->FindMember("orderedObjects");

    //  Go through each ordered object to find replacements
    for (memberList::iterator cur = orderedObjects->_members.begin(); cur != orderedObjects->_members.end(); cur++) {
        XIBMember* curMember = *cur;
        XIBObject* curObject = curMember->_obj;

        if (strcmp(curObject->ClassName(), "IBObjectRecord") == 0) {
            XIBObject* obj = curObject->FindMember("object");

            if (obj) {
                XIBObject* objectId = curObject->FindMember("objectID");
                if (!objectId) {
                    objectId = curObject->FindMember("id");
                }
                int objId = objectId->intValue();

                //  Attempt to find any associated custom class name
                char szPropName[255];
                sprintf(szPropName, "%d.CustomClassName", objId);
                const char* pClassName = obj->ClassName();

                XIBObject* customName = properties->ObjectForKey(szPropName);
                if (customName) {
                    const char* pCustomName = customName->stringValue();
                    obj->SetSwappedClassName(pCustomName);
                }

                for (memberList::iterator prop = properties->_members.begin(); prop != properties->_members.end(); prop++) {
                    char szMeta[255];
                    sprintf(szMeta, "%d.", objId);
                    if (strncmp(szMeta, (*prop)->_name, strlen(szMeta)) == 0) {
                        obj->AddMember(&(*prop)->_name[strlen(szMeta)], (*prop)->_obj);
                    }
                }
            }
        }
    }

    //  Create connections list
    XIBArray* connections = new XIBArray();
    XIBObject* connectionrecords = Objects->FindMember("connectionRecords");

    for (memberList::iterator cur = connectionrecords->_members.begin(); cur != connectionrecords->_members.end(); cur++) {
        XIBMember* curMember = *cur;
        XIBObject* curObject = curMember->_obj;

        if (strcmp(curObject->ClassName(), "IBConnectionRecord") == 0) {
            XIBObject* obj = curObject->FindMember("connection");

            if (obj) {
                connections->AddMember(NULL, obj);
            }
        }
    }

    //  Sort connection records alphabetically using stable, uh, bubble sort
    for (;;) {
        bool didSwap = false;

        for (memberList::iterator cur = connections->_members.begin(); cur != connections->_members.end(); cur++) {
            if ((cur + 1) == connections->_members.end())
                break;
            XIBMember* curMember = (*cur);
            XIBMember* nextMember = (*(cur + 1));

            if (curMember->_name != NULL)
                continue;

            //  Event connections first
            if (strcmp(curMember->_obj->_className, "IBCocoaTouchOutletConnection") == 0 &&
                strcmp(nextMember->_obj->_className, "IBCocoaTouchEventConnection") == 0) {
                *cur = nextMember;
                *(cur + 1) = curMember;
                didSwap = true;
                continue;
            }

            if (strcmp(curMember->_obj->_className, nextMember->_obj->_className) == 0) {
                const char* label1 = curMember->_obj->FindMember("label")->stringValue();
                const char* label2 = nextMember->_obj->FindMember("label")->stringValue();

                if (strcmp(label1, label2) > 0) {
                    *cur = nextMember;
                    *(cur + 1) = curMember;
                    didSwap = true;
                }
            }
        }
//.........这里部分代码省略.........
开发者ID:GoogleInternetAuthorityG2SUNGHAN,项目名称:WinObjC,代码行数:101,代码来源:xib2nib.cpp


示例12: getAttrib

void UIView::InitFromStory(XIBObject *obj)
{
    ObjectConverterSwapper::InitFromStory(obj);

    _subviews = (XIBArray *) obj->FindMemberClass("subviews");
    if ( !_subviews ) _subviews = new XIBArray();

    _constraints = (XIBArray *)obj->FindMemberClass("constraints");
    if (!_constraints) _constraints = new XIBArray();

    if ( getAttrib("opaque") ) {
        const char *pVal = getAttrib("opaque");
        if ( strcmp(pVal, "NO") == 0 ) _opaque = false;
    }
    if ( getAttrib("multipleTouchEnabled") ) {
        if ( strcmp(getAttrib("multipleTouchEnabled"), "YES") == 0 ) _multipleTouchEnabled = true;
    }
    if ( getAttrib("clipsSubviews") ) {
        if ( strcmp(getAttrib("clipsSubviews"), "YES") == 0 ) _clipsToBounds = true;
    }
    if ( getAttrib("userInteractionEnabled") ) {
        if ( strcmp(getAttrib("userInteractionEnabled"), "NO") == 0 ) _userInteractionDisabled = true;
    }
    if ( getAttrib("clearsContextBeforeDrawing") ) {
        if ( strcmp(getAttrib("clearsContextBeforeDrawing"), "NO") == 0 ) _clearsContextBeforeDrawing = false;
    }
    if ( getAttrib("contentMode") ) {
        const char *mode = getAttrib("contentMode");
        if ( strcmp(mode, "left") == 0 ) {
            _contentMode = UIViewContentModeLeft;
        } else if ( strcmp(mode, "scaleToFill") == 0 ) {
            _contentMode = UIViewContentModeScaleToFill;
        } else if ( strcmp(mode, "center") == 0 ) {
            _contentMode = UIViewContentModeCenter;
        } else if ( strcmp(mode, "redraw") == 0 ) {
            _contentMode = UIViewContentModeRedraw;
        } else if ( strcmp(mode, "scaleAspectFill") == 0 ) {
            _contentMode = UIViewContentModeScaleAspectFill;
        } else if ( strcmp(mode, "scaleAspectFit") == 0 ) {
            _contentMode = UIViewContentModeScaleAspectFit;
        } else {
            assert(0);
        }
    }
    if ( getAttrib("hidden") ) {
        if ( strcmp(getAttrib("hidden"), "YES") == 0 ) _hidden = true;
    }
    XIBObject *frameRect = FindMember("frame");
    if ( frameRect ) {
        _bounds.x = 0;
        _bounds.y = 0;
        _bounds.width = strtod(frameRect->getAttrib("width"), NULL);
        _bounds.height = strtod(frameRect->getAttrib("height"), NULL);

        _center.x = strtod(frameRect->getAttrib("x"), NULL);
        _center.y = strtod(frameRect->getAttrib("y"), NULL);

        _center.x += _bounds.width / 2.0f;
        _center.y += _bounds.height / 2.0f;
    }

    XIBObject *resizeMask = FindMember("autoresizingMask");
    if ( resizeMask ) {
        if ( resizeMask->getAttrib("widthSizable") ) _autoresizingMask |= (int) UIViewAutoresizingFlexibleWidth;
        if ( resizeMask->getAttrib("heightSizable") ) _autoresizingMask |= (int) UIViewAutoresizingFlexibleHeight;
        if ( resizeMask->getAttrib("flexibleMinX") ) _autoresizingMask |= (int) UIViewAutoresizingFlexibleLeftMargin;
        if ( resizeMask->getAttrib("flexibleMaxX") ) _autoresizingMask |= (int) UIViewAutoresizingFlexibleRightMargin;
        if ( resizeMask->getAttrib("flexibleMinY") ) _autoresizingMask |= (int) UIViewAutoresizingFlexibleTopMargin;
        if ( resizeMask->getAttrib("flexibleMaxY") ) _autoresizingMask |= (int) UIViewAutoresizingFlexibleBottomMargin;
    }
    _backgroundColor = (UIColor *) FindMember("backgroundColor");

    if (getAttrib("translatesAutoresizingMaskIntoConstraints")) {
        if (strcmp(getAttrib("translatesAutoresizingMaskIntoConstraints"), "NO") == 0) _translatesAutoresizeToConstraints = false;
    }

    _outputClassName = "UIView";
}
开发者ID:richardhxy,项目名称:WinObjC,代码行数:78,代码来源:UIView.cpp


示例13: XIBArray

void NIBWriter::WriteObjects()
{
    XIBObject *nibRoot = new XIBArray();

    nibRoot->_className = "NSObject";
    nibRoot->_members.clear();
    nibRoot->AddMember("UINibTopLevelObjectsKey", _topObjects);
    nibRoot->AddMember("UINibObjectsKey", _allUIObjects);
    nibRoot->AddMember("UINibConnectionsKey", _connections);
    nibRoot->AddMember("UINibVisibleWindowsKey", _visibleWindows);
    nibRoot->AddMember("UINibAccessibilityConfigurationsKey", _accessibilityObjects);
    nibRoot->AddMember("UINibKeyValuePairsKey", new XIBArray());

    AddOutputObject(nibRoot);
    //  Sort connection records alphabetically using stable, uh, bubble sort
    for ( ;; ) {
        bool didSwap = false;

        for ( memberList::iterator cur = _connections->_outputMembers.begin(); cur != _connections->_outputMembers.end(); cur ++ ) {
            if ( (cur + 1) == _connections->_outputMembers.end() ) break;
            XIBMember *curMember = (*cur);
            XIBMember *nextMember = (*(cur + 1));

            if ( strcmp(curMember->_name, "UINibEncoderEmptyKey") != 0 ) continue;

            //  Event connections first
            if ( strcmp(curMember->_obj->_className, "UIRuntimeOutletConnection") == 0 &&
                 strcmp(nextMember->_obj->_className, "UIRuntimeEventConnection") == 0 ) {
                *cur = nextMember;
                *(cur + 1) = curMember;
                didSwap = true;
                continue;
            }

            if ( strcmp(curMember->_obj->_className, nextMember->_obj->_className) == 0 ) {
                const char *label1, *label2;

                if ( strcmp(curMember->_obj->_className, "UIRuntimeEventConnection") == 0 ) {
                    UIRuntimeEventConnection *conn1 = (UIRuntimeEventConnection *) curMember->_obj;
                    UIRuntimeEventConnection *conn2 = (UIRuntimeEventConnection *) nextMember->_obj;

                    label1 = conn1->_label;
                    label2 = conn2->_label;
                } else {
                    UIRuntimeOutletConnection *conn1 = (UIRuntimeOutletConnection *) curMember->_obj;
                    UIRuntimeOutletConnection *conn2 = (UIRuntimeOutletConnection *) nextMember->_obj;

                    label1 = conn1->_label;
                    label2 = conn2->_label;
                }

                if ( strcmp(label1, label2) > 0 ) {
                    *cur = nextMember;
                    *(cur + 1) = curMember;
                    didSwap = true;
                }
            }
        }

        if ( !didSwap ) break;
    }

    WriteData();
}
开发者ID:netroby,项目名称:WinObjC,代码行数:64,代码来源:NIBWriter.cpp



注:本文中的XIBObject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ XIRef类代码示例发布时间:2022-05-31
下一篇:
C++ XHTMLReader类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap