예제 #1
0
파일: box.cpp 프로젝트: 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);
        }
    }
}
예제 #2
0
파일: box.cpp 프로젝트: 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);
        }
    }
}