MCPcopy Create free account
hub / github.com/NanoMichael/MicroTeX / VerticalBox

Method VerticalBox

src/atom/box.cpp:346–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

344/************************************* vertical box implementation ********************************/
345
346VerticalBox::VerticalBox(const sptr<Box>& b, float rest, int alignment)
347 : _leftMostPos(F_MAX), _rightMostPos(F_MIN) {
348 add(b);
349 if (alignment == ALIGN_CENTER) {
350 sptr<Box> s(new StrutBox(0, rest / 2, 0, 0));
351 Box::add(0, s);
352 _height += rest / 2.f;
353 _depth += rest / 2.f;
354 Box::add(s);
355 } else if (alignment == ALIGN_TOP) {
356 _depth += rest;
357 sptr<Box> s(new StrutBox(0, rest, 0, 0));
358 Box::add(s);
359 } else if (alignment == ALIGN_BOTTOM) {
360 _height += rest;
361 sptr<Box> s(new StrutBox(0, rest, 0, 0));
362 Box::add(0, s);
363 }
364}
365
366void VerticalBox::recalculateWidth(const Box& b) {
367 _leftMostPos = min(_leftMostPos, b._shift);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected