]> git.tdb.fi Git - libs/gltk.git/blobdiff - source/layout.cpp
Simplify constructors with C++11
[libs/gltk.git] / source / layout.cpp
index 200801f36285b7c3d9ed55402fd764a27f0a8813..b6248e6ad8511bb8dbaa9bc0d1ba5b1eaeaa18ba 100644 (file)
@@ -37,11 +37,11 @@ private:
                Column();
        };
 
-       unsigned n_columns;
-       unsigned n_rows;
+       unsigned n_columns = 1;
+       unsigned n_rows = 1;
        std::vector<Column> columns;
-       bool solved;
-       bool infeasible;
+       bool solved = false;
+       bool infeasible = false;
 
 public:
        LinearProgram(unsigned);
@@ -85,17 +85,6 @@ Layout::Pointers Layout::pointers[2] =
 } };
 
 
-Layout::Layout():
-       container(0),
-       n_active_slots(0),
-       margin(8),
-       row_spacing(5),
-       col_spacing(4)
-{
-       n_slack_vars[0] = 0;
-       n_slack_vars[1] = 0;
-}
-
 Layout::~Layout()
 {
        for(Slot *s: slots)
@@ -481,23 +470,13 @@ void Layout::solve_constraints(int dir, SolveMode mode)
 
 Layout::Constraint::Constraint(ConstraintType t, Slot &s):
        type(t),
-       target(s),
-       spacing(-1)
-{ }
-
-
-Layout::Packing::Packing():
-       gravity(-1),
-       expand(false)
+       target(s)
 { }
 
 
 Layout::Slot::Slot(Layout &l, Widget &w):
        layout(l),
-       index(0),
-       widget(w),
-       ghost(false),
-       floating(false)
+       widget(w)
 {
        vert_pack.gravity = 1;
        widget.signal_autosize_changed.connect(sigc::mem_fun(this, &Slot::autosize_changed));
@@ -647,10 +626,7 @@ void operator>>(const LexicalConverter &conv, Layout::ConstraintType &ctype)
 
 Layout::LinearProgram::LinearProgram(unsigned s):
        n_columns(s),
-       n_rows(1),
-       columns(n_columns),
-       solved(false),
-       infeasible(false)
+       columns(n_columns)
 { }
 
 Layout::LinearProgram::Row Layout::LinearProgram::add_row()