Пример #1
0
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);
        }
    }
}
Пример #2
0
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);
        }
    }
}