示例#1
0
void Flcc_ValueBox::layout()
{
    if(layout_damage() & FL_LAYOUT_WH) {
        generate();
    }

    Fl_Widget::layout();
}
示例#2
0
void Icon::layout(void)
{
	if(layout_damage()&FL_LAYOUT_XYWH && icon_img)
	{
		if(icon_img) 
		{
			icon_img->mask_type(MASK_ALPHA);
			icon_img->threshold(128);
		}
	}

	Fl_Widget::layout();
}
示例#3
0
void Icon::layout()
{
    if(layout_damage()&FL_LAYOUT_XYWH && icon_im)
    {
#if 0
        // Alpha blends image to bg!
        // This sucks, cause if icon overlaps another, it will
        // draw bg top of overlapped icon...
        if(icon_im->format()->Amask)
        {
            if(desktop->bg_image) {
                int pitch = icon_im->pitch();

                uint8 *data = new uint8[h()*pitch];

                int X=x(),Y=y(),W=w(),H=h();
                if(X<0) X=0;
                if(Y<0) Y=0;
                if(X+W>desktop->w()) X=desktop->w()-W;
                if(Y+H>desktop->h()) Y=desktop->h()-H;

                Fl_Rect r(X,Y,W,H);
                Fl_Rect r2(0,0,W,H);
                Fl_Renderer::blit(desktop->bg_image->data(), &r, desktop->bg_image->format(), desktop->bg_image->pitch(),
                                  data, &r2, icon_im->format(), pitch, 0);

                if(im) delete im;
                im = new Fl_Image(W, H, icon_im->format(), data);

                // Blit image data to our bg_image
                Fl_Renderer::alpha_blit(icon_im->data(), &r2, icon_im->format(), icon_im->pitch(),
                                        im->data(), &r2, im->format(), im->pitch(),
                                        0);
            } else {
                //blend to color
                im = icon_im->back_blend(desktop->bg_color);
            }
        }
        else
#endif
        {
            if(icon_im) {
                icon_im->mask_type(MASK_ALPHA);
                icon_im->threshold(128);
            }
        }
    }

    Fl_Widget::layout();
}
示例#4
0
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);
}