Exemplo n.º 1
0
void LayoutLayer::allocate(Canvas* c, const Allocation& a, Extension& ext) {
    if (under_ != nil) {
	under_->allocate(c, a, ext);
    }
    MonoGlyph::allocate(c, a, ext);
    if (over_ != nil) {
	over_->allocate(c, a, ext);
    }
}
Exemplo n.º 2
0
void BevelFrame::allocate(Canvas* c, const Allocation& a, Extension& ext) {
    Glyph* g = body();
    if (g != nil) {
	if (hmargin_ || vmargin_) {
	    Allocation interior(a);
	    allocate_body(g, thickness(c), interior);
	    g->allocate(c, interior, ext);
	} else {
	    g->allocate(c, a, ext);
	}
    }
    ext.merge(c, a);
}
Exemplo n.º 3
0
Arquivo: box.cpp Projeto: PNCG/neuron
void BoxImpl::full_allocate(AllocationInfo& info) {
    Canvas* c = info.canvas();
    GlyphIndex n = box_->count();
    Allocation* a = info.component_allocations();
    Requisition* r = new Requisition[n];
    GlyphIndex i;
    for (i = 0; i < n; i++) {
        Glyph* g = box_->component(i);
        if (g != nil) {
            g->request(r[i]);
        }
    }
    layout_->allocate(info.allocation(), n, r, a);
    delete [] r;

    Extension& box = info.extension();
    Extension child;
    for (i = 0; i < n; i++) {
        Glyph* g = box_->component(i);
        if (g != nil) {
            child.clear();
            g->allocate(c, a[i], child);
            box.merge(child);
        }
    }
}
Exemplo n.º 4
0
void Layer::allocate( const Allocation & a)
{
    for( GlyphIndex i = 0; i < getCount(); i++ )
    {
        Glyph* g = getComponent( i );
        if( g )
            g->allocate( a );
    }
}
Exemplo n.º 5
0
void StripRuler2D::allocate( const Allocation& a ) 
{
    Glyph* g = getBody();
    if( g != nil ) 
	{
	    Allocation interior( a );
	    allocateBody( g, interior );
	    g->allocate( interior );
    }
}
Exemplo n.º 6
0
void Deck::allocate(Canvas* c, const Allocation& a, Extension& ext) {
    allocation_ = a;
    if (card_ >= 0 && card_ < count()) {
	Glyph* g = component(card_);
	if (g != nil) {
	    g->allocate(c, a, ext);
	}
	ext.merge(c, a);
    }
}
Exemplo n.º 7
0
void Border::allocate( const Allocation& a ) 
{
    Glyph* g = getBody();
    if( g != nil ) 
	{
	    Allocation interior( a );
	    allocateBody( g, d_thickness, interior );
	    g->allocate( interior );
    }
}
Exemplo n.º 8
0
void TBScrollBoxImpl::reallocate() {
    if (canvas_ == nil) {
	return;
    }
    ScrollBox* s = scrollbox_;
    GlyphIndex n = s->count();
    end_ = n;
    TBScrollBoxList& list = visible_;
    list.remove_all();
    Requisition req;
    TBScrollBoxInfo info;
    Extension e_i;
    const Requirement& r = req.y_requirement();
    Coord p = allocation_.top();
    Coord bottom = allocation_.bottom();
    bool found_start = false;
    for (GlyphIndex i = start_; i < n; i++) {
	Glyph* g = s->component(i);
	if (g != nil) {
	    g->request(req);
	    Coord span = r.natural();
	    if (!Math::equal(span, Coord(0), float(1e-2))) {
		if (!found_start) {
		    start_ = i;
		    found_start = true;
		}
		Coord alignment = r.alignment();
		p -= span;
		if (p < bottom) {
		    end_ = i;
		    break;
		}
		info.glyph_ = g;
		Allotment& ax = info.allocation_.x_allotment();
		ax = allocation_.x_allotment();
		Allotment& ay = info.allocation_.y_allotment();
		ay.span(span);
		ay.origin(p + Coord(alignment * span));
		ay.alignment(alignment);
		list.append(info);
		g->allocate(canvas_, info.allocation_, e_i);
	    }
	}
    }
}
Exemplo n.º 9
0
Arquivo: box.cpp Projeto: PNCG/neuron
void BoxImpl::offset_allocate(AllocationInfo& info, Coord dx, Coord dy) {
    Canvas* c = info.canvas();
    Allocation* a = info.component_allocations();
    Extension& box = info.extension();
    Extension child;
    GlyphIndex n = box_->count();
    for (GlyphIndex i = 0; i < n; i++) {
        Glyph* g = box_->component(i);
        if (g != nil) {
            Allocation& a_i = a[i];
            Allotment& ax = a_i.x_allotment();
            Allotment& ay = a_i.y_allotment();
            ax.offset(dx);
            ay.offset(dy);
            child.clear();
            g->allocate(c, a_i, child);
            box.merge(child);
        }
    }
}