static void CreateLayout(EbookControls *ctrls) { HorizontalLayout *topPart = new HorizontalLayout(); DirectionalLayoutData ld; ld.Set(ctrls->prev, SizeSelf, 1.f, GetElAlignCenter()); topPart->Add(ld); ld.Set(ctrls->page, 1.f, 1.f, GetElAlignTop()); topPart->Add(ld); ld.Set(ctrls->next, SizeSelf, 1.f, GetElAlignBottom()); topPart->Add(ld); VerticalLayout *l = new VerticalLayout(); ld.Set(topPart, 1.f, 1.f, GetElAlignTop()); l->Add(ld, true); ld.Set(ctrls->progress, SizeSelf, 1.f, GetElAlignCenter()); l->Add(ld); ld.Set(ctrls->status, SizeSelf, 1.f, GetElAlignCenter()); l->Add(ld); ctrls->mainWnd->layout = l; }
static HorizontalLayout* HorizontalLayoutFromDef(ParsedMui& parsed, TxtNode* structDef) { CrashIf(!structDef->IsStructWithName("HorizontalLayout")); HorizontalLayoutDef* def = DeserializeHorizontalLayoutDef(structDef); HorizontalLayout* l = new HorizontalLayout(); l->SetName(def->name); Vec<DirectionalLayoutDataDef*>* children = def->children; DirectionalLayoutData ld; for (size_t i = 0; children && i < children->size(); i++) { SetDirectionalLayouData(ld, parsed, children->at(i)); l->Add(ld); } FreeHorizontalLayoutDef(def); return l; }