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


C++ Fl_Widget::contains方法代码示例

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


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

示例1: layout

void Fl_Pack::layout()
{
        // we only need to do something special if the group is resized:
    if (!(layout_damage() & (FL_LAYOUT_WH|FL_LAYOUT_DAMAGE)) || !children())
    {
        Fl_Group::layout();
        if (!(layout_damage() & FL_LAYOUT_DAMAGE)) 
            return;
    }

        // clear the layout flags, so any resizes of children will set them again:
    Fl_Widget::layout();

        // This is the rectangle to lay out the remaining widgets in:
    int x = 0;
    int y = 0;
    int r = this->w();
    int b = this->h();
    box()->inset(x,y,r,b);

    bool saw_horizontal = false;
    bool saw_vertical = false;

        // layout all the top & left widgets (the ones before the resizable):
    int i; for (i = 0; i < children(); i++)
    {
        Fl_Widget* widget = child(i);
        if (widget->contains(resizable())) break;
        if (!widget->visible()) continue;
        if (is_vertical(widget))
        {
            widget->resize(x, y, widget->w(), b-y);
            widget->layout();
            x = widget->x() + widget->w() + layout_spacing();
            saw_vertical = true;
        }                    // put along top edge:
        else
        {
            widget->resize(x, y, r-x, widget->h());
            widget->layout();
            y = widget->y() + widget->h() + layout_spacing();
            saw_horizontal = true;
        }
    }

    int resizable_index = i;

        // layout all the bottom & right widgets by going backwards:
    for (i = children()-1; i > resizable_index; i--)
    {
        Fl_Widget* widget = child(i);
        if (!widget->visible()) continue;
        if (is_vertical(widget))
        {
            int W = widget->w();
            widget->resize(r-W, y, W, b-y);
            widget->layout();
            r = widget->x() - layout_spacing();
            saw_vertical = true;
        }                    // put along top edge:
        else
        {
            int H = widget->h();
            widget->resize(x, b-H, r-x, H);
            widget->layout();
            b = widget->y() - layout_spacing();
            saw_horizontal = true;
        }
    }

        // Lay out the resizable widget to fill the remaining space:
    if (resizable_index < children())
    {
        Fl_Widget* widget = child(resizable_index);
        widget->resize(x, y, r-x, b-y);
        widget->layout();
    }

        // A non-resizable widget will become the size of it's items:
    int W = w();
    if (r < x || !resizable() && !saw_horizontal) W -= (r-x);
    int H = h();
    if (b < y || !resizable() && !saw_vertical) H -= (b-y);
    size(W,H);
}
开发者ID:GustavoMOG,项目名称:efltk,代码行数:85,代码来源:Fl_Pack.cpp


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