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


C++ WindowList::size方法代码示例

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


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

示例1: getEmbeddedList

bool Window::getEmbeddedList(WindowList& wl) const {
    for(ConstIterator i = begin(); i != end(); i++) if(i->valid()) {
        EmbeddedWindow* ew = dynamic_cast<EmbeddedWindow*>(i->get());

        if(!ew || !ew->getWindow()) continue;

        else {
            wl.push_back(ew->getWindow());

            ew->getWindow()->getEmbeddedList(wl);
        }
    }

    return wl.size() != 0;
}
开发者ID:dev2dev,项目名称:OpenSceneGraph-port-to-IOS,代码行数:15,代码来源:Window.cpp

示例2: windowAt

WId QxtWindowSystem::windowAt(const QPoint& pos)
{
    Window result = 0;
    WindowList list = windows();
    for (int i = list.size() - 1; i >= 0; --i)
    {
        WId wid = list.at(i);
        if (windowGeometry(wid).contains(pos))
        {
            result = wid;
            break;
        }
    }
    return result;
}
开发者ID:kissthink,项目名称:vokoscreen,代码行数:15,代码来源:qxtwindowsystem_x11.cpp

示例3: stopRedraw

void        LinearLayout::Layout()
{
    if ( ! this->childWindows.size())
    {
        return;
    }

    RedrawLock stopRedraw(this);

    bool isVertical = (this->orientation == VerticalLayout);
    bool isHorizontal = ( ! isVertical);

    WindowList wrappedChildren;
    WindowList filledChildren;
    ChildSizeMap finalSizes;
    int wrappedSize = 0;
    float totalWeight = 0.0f;

    WindowList::iterator it, end;

    Size layoutSize = this->ClientSize();

    // PASS 1: figure out which windows are wrapped in direction of the
    // orientation, and which are filled. Also, calculate the correct
    // size of the child opposite to its orientation.
    it = this->childWindows.begin();
    end = this->childWindows.end();
    for ( ; it != end; it++)
    {
        Window* child = (*it);
        Size childSize = child->WindowSize();

        // map the child to its fill type
        if (((isVertical) && (child->LayoutHeight() == LayoutFillParent))
        || ((isHorizontal) && (child->LayoutWidth() == LayoutFillParent)))
        {
            filledChildren.push_back(child);
            totalWeight += child->LayoutWeight();
        }
        else
        {
            wrappedChildren.push_back(child);

            // figure out the space all of the wrapped children will occupy.
            wrappedSize += (isVertical ? childSize.height : childSize.width);
        }

        // fill direction opposite the orientation
        if ((isVertical) && (child->LayoutWidth() == LayoutFillParent))
        {
            childSize.width = layoutSize.width;
        }
        else if ((isHorizontal) && (child->LayoutHeight() == LayoutFillParent))
        {
            childSize.height = layoutSize.height;
        }
        //
        finalSizes[child] = childSize;
    }
    //
    wrappedSize += (this->spacing * ((int) this->childWindows.size() - 1));

    // PASS 2: determine final child size for the filled children based on
    // their specified LayoutWeight()'s.
    if (filledChildren.size())
    {
        int remainingSize = (isVertical)
            ? layoutSize.height - wrappedSize
            : layoutSize.width - wrappedSize;
        //
        int weightedSize = 0;
        //
        it = filledChildren.begin();
        end = filledChildren.end();
        for ( ; it != end; it++)
        {
            Window* child = (*it);
            Size childSize = finalSizes[child];
            float remainingRatio = (child->LayoutWeight() / totalWeight);
            int newSize = (int) ((float) remainingSize * remainingRatio);

            // using floating calculations may cause small rounding errors. give
            // give the last filled child whatever space may be left over
            weightedSize += newSize;
            if ((it + 1) == end)
            {
                newSize += (remainingSize - weightedSize);
            }

            isVertical
                ? childSize.height = newSize
                : childSize.width = newSize;

            finalSizes[child] = childSize;
        }
    }

    // PASS 3: layout everything out!
    it = this->childWindows.begin();
    end = this->childWindows.end();
//.........这里部分代码省略.........
开发者ID:LeonJavaAndroid,项目名称:musikcube,代码行数:101,代码来源:LinearLayout.cpp


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