当前位置: 首页>>代码示例>>C++>>正文


C++ PageView::getItems方法代码示例

本文整理汇总了C++中PageView::getItems方法的典型用法代码示例。如果您正苦于以下问题:C++ PageView::getItems方法的具体用法?C++ PageView::getItems怎么用?C++ PageView::getItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PageView的用法示例。


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

示例1: refreshLayout


//.........这里部分代码省略.........
            ownerPosition.x = _leftMargin + ownerAnchor.x * ownerSize.width;
            break;
        case HorizontalEdge::Right:
            if (_isPercentOnly)
                break;
            if (_usingPercentWidth || _usingStretchWidth)
                ownerSize.width = parentSize.width * _percentWidth;
            ownerPosition.x = parentSize.width - (_rightMargin + (1 - ownerAnchor.x) * ownerSize.width);
            break;
        case HorizontalEdge::Center:
            if (_isPercentOnly)
                break;
            if (_usingStretchWidth)
            {
                ownerSize.width = parentSize.width - _leftMargin - _rightMargin;
                if (ownerSize.width < 0)
                    ownerSize.width = 0;
                ownerPosition.x = _leftMargin + ownerAnchor.x * ownerSize.width;
            }
            else
            {
                if (_usingPercentWidth)
                    ownerSize.width = parentSize.width * _percentWidth;
                ownerPosition.x = parentSize.width * _positionPercentX;
            }
            break;
        default:
            break;
        }

        switch (this->_verticalEdge)
        {
        case VerticalEdge::None:
            if (_usingStretchHeight && !_isPercentOnly)
            {
                ownerSize.height = parentSize.height * _percentHeight;
                ownerPosition.y = _bottomMargin + ownerAnchor.y * ownerSize.height;
            }
            else
            {
                if (_usingPositionPercentY)
                    ownerPosition.y = parentSize.height * _positionPercentY;
                if (_usingPercentHeight)
                    ownerSize.height = parentSize.height * _percentHeight;
            }
            break;
        case VerticalEdge::Bottom:
            if (_isPercentOnly)
                break;
            if (_usingPercentHeight || _usingStretchHeight)
                ownerSize.height = parentSize.height * _percentHeight;
            ownerPosition.y = _bottomMargin + ownerAnchor.y * ownerSize.height;
            break;
        case VerticalEdge::Top:
            if (_isPercentOnly)
                break;
            if (_usingPercentHeight || _usingStretchHeight)
                ownerSize.height = parentSize.height * _percentHeight;
            ownerPosition.y = parentSize.height - (_topMargin + (1 - ownerAnchor.y) * ownerSize.height);
            break;
        case VerticalEdge::Center:
            if (_isPercentOnly)
                break;
            if (_usingStretchHeight)
            {
                ownerSize.height = parentSize.height - _topMargin - _bottomMargin;
                if (ownerSize.height < 0)
                    ownerSize.height = 0;
                ownerPosition.y = _bottomMargin + ownerAnchor.y * ownerSize.height;
            }
            else
            {
                if (_usingPercentHeight)
                    ownerSize.height = parentSize.height * _percentHeight;
                ownerPosition.y = parentSize.height* _positionPercentY;
            }
            break;
        default:
            break;
        }

        _owner->setPosition(ownerPosition);
        _owner->setContentSize(ownerSize);

        if (typeid(*_owner) == typeid(PageView))
        {
            PageView* page = static_cast<PageView*>(_owner);
            page->forceDoLayout();

            Vector<Widget*> _widgetVector = page->getItems();
            for(auto& item : _widgetVector)
            {
                ui::Helper::doLayout(item);
            }
        }
        else
        {
            ui::Helper::doLayout(_owner);
        }
    }
开发者ID:1414648814,项目名称:AStar-Cocos2dx,代码行数:101,代码来源:UILayoutComponent.cpp


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