Esempio n. 1
0
File: box.cpp Progetto: 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);
        }
    }
}
Esempio n. 2
0
File: box.cpp Progetto: PNCG/neuron
AllocationInfo& BoxImpl::info(Canvas* c, const Allocation& a, Extension& ext) {
    if (allocations_ == nil) {
        allocations_ = new AllocationTable(box_->count());
    }
    AllocationInfo* info = allocations_->find(c, a);
    if (info == nil) {
        Coord dx, dy;
        info = allocations_->find_same_size(c, a, dx, dy);
        if (info != nil) {
            info->extension(ext);
            offset_allocate(*info, dx, dy);
        } else {
            info = allocations_->allocate(c, a);
            info->extension(ext);
            full_allocate(*info);
        }
    }
    ext = info->extension();
    return *info;
}
Esempio n. 3
0
File: box.cpp Progetto: 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);
        }
    }
}