13
0

Canvas: add second constraint tester

This commit is contained in:
Paul Davis 2020-06-19 14:02:24 -06:00
parent 0d5725a63b
commit 94b44ceb52
2 changed files with 15 additions and 2 deletions

View File

@ -120,7 +120,8 @@ main (int argc, char* argv[])
r4->name = "r4"; r4->name = "r4";
r5->name = "r5"; r5->name = "r5";
r6->name = "r6"; r6->name = "r6";
hbox1->pack_start (r4, PackOptions(PackExpand|PackFill));
ConstrainedItem* rbi = hbox1->pack_start (r4, PackOptions(PackExpand|PackFill));
hbox1->pack_start (r5, PackOptions(PackExpand|PackFill)); hbox1->pack_start (r5, PackOptions(PackExpand|PackFill));
hbox1->pack_start (r6, PackOptions(PackExpand|PackFill)); hbox1->pack_start (r6, PackOptions(PackExpand|PackFill));
@ -129,6 +130,8 @@ main (int argc, char* argv[])
hb1 = vbox->pack_start (hbox1, PackOptions (PackExpand|PackFill)); hb1 = vbox->pack_start (hbox1, PackOptions (PackExpand|PackFill));
rbi->add_constraint (rbi->width() == hb1->width() / 2.);
Circle* circle = new Circle (c); Circle* circle = new Circle (c);
circle->name = "circle"; circle->name = "circle";
//circle->set_radius (30); //circle->set_radius (30);
@ -137,6 +140,7 @@ main (int argc, char* argv[])
ci = vbox->pack_start (circle, PackOptions (PackExpand|PackFill)); ci = vbox->pack_start (circle, PackOptions (PackExpand|PackFill));
ci->add_constraint (ci->height() == 0.5 * hb1->height()); ci->add_constraint (ci->height() == 0.5 * hb1->height());
ci->add_constraint (ci->center_x() == rbi->center_x());
cBox* hbox2 = new cBox (c, Horizontal); cBox* hbox2 = new cBox (c, Horizontal);
hbox2->name = "hbox2"; hbox2->name = "hbox2";
@ -149,7 +153,7 @@ main (int argc, char* argv[])
Pango::FontDescription font ("Sans"); Pango::FontDescription font ("Sans");
txt->set_font_description (font); txt->set_font_description (font);
txt->set ("hello, world"); txt->set ("hello world");
ConstrainedItem* ti = hbox2->pack_start (txt, PackExpand); ConstrainedItem* ti = hbox2->pack_start (txt, PackExpand);
ti->add_constraint (ti->left() == 25); ti->add_constraint (ti->left() == 25);

View File

@ -173,6 +173,15 @@ def build(bld):
constraint_test.target = 'constraint_test' constraint_test.target = 'constraint_test'
constraint_test.install_path = '' constraint_test.install_path = ''
constraint_test2_src = [ 'constraint_test2.cc' ]
constraint_test2 = bld (features = 'cxx cxxprogram')
constraint_test2.source = constraint_test2_src
constraint_test2.includes = obj.includes + ['../pbd', '../gtkmm2ext']
constraint_test2.use = [ 'GTKMM', 'libcanvas', 'libgtkmm2ext' ]
constraint_test2.name = 'constraint_test2'
constraint_test2.target = 'constraint_test2'
constraint_test2.install_path = ''
def shutdown(): def shutdown():
autowaf.shutdown() autowaf.shutdown()