// Windows with layouts. #include #include #include #include #include void w_verBoxl() { auto&& win = new q::win; auto&& b = win->verBoxl(); auto lbl = [&](qstrc text) { b.add(new q::lbl(text)); }; lbl("A"); lbl("B"); lbl("C"); b.addStretch(); win->title("Vertical Box"); win->show(); } void w_horBoxl() { auto&& win = new q::win; auto&& b = win->horBoxl(); auto lbl = [&](qstrc text) { b.add(new q::lbl(text)); }; lbl("1"); lbl("2"); lbl("3"); lbl("4"); win->title("Horizontal Box"); win->show(); } void w_ctrGrid() { auto&& win = new q::win; auto&& g = win->ctrGrid(); auto lbl = [&](qstrc text, uint row, uint col) { g.add(new q::lbl(text), row, col); }; lbl("A1", 0, 0); lbl("A2", 0, 1); lbl("A3", 0, 2); lbl("A4", 0, 3); lbl("B1", 1, 0); lbl("B2", 1, 1); lbl("B3", 1, 2); lbl("B4", 1, 3); lbl("C1", 2, 0); lbl("C2", 2, 1); lbl("C3", 2, 2); lbl("C4", 2, 3); g.addColStretch(); win->title("Grid"); win->show(); } void w_horSplt() { auto&& win = new q::win; auto&& sp = win->horSplt(); auto lbl = [&](qstrc text) { sp.add(new q::lbl(text)); }; lbl("A"); lbl("B"); win->title("Horizontal Splitter"); win->show(); } void w_verSplt() { auto&& win = new q::win; auto&& sp = win->verSplt(); auto lbl = [&](qstrc text) { sp.add(new q::lbl(text)); }; lbl("1"); lbl("2"); win->title("Vertical Splitter"); win->show(); } void w_mix() { auto&& win = new q::win; auto&& hb = win->horBoxl(); hb.add(new q::lbl("A")); auto&& sp = hb.verSplt(); hb.add(new q::lbl("B")); sp.add(new q::lbl("1")); auto&& gr = sp.addPanel().ctrGrid(); gr.add(new q::lbl("A1"), 0, 0); gr.add(new q::lbl("B2"), 1, 1); gr.add(new q::lbl("C3"), 2, 2); win->title("Mix"); win->show(); } int main(int argc, pcstr argv[]) { q::app app(argc, argv, APP_NAME, nullptr, ORG_DOMAIN, nullptr); w_verBoxl(); w_horBoxl(); w_ctrGrid(); w_horSplt(); w_verSplt(); w_mix(); app.exec(); } // eof