13
0

first steps in merging cBox into constraint packer

This commit is contained in:
Paul Davis 2020-07-10 13:33:14 -06:00
parent 860d43697c
commit af60c50990
2 changed files with 13 additions and 4 deletions

View File

@ -30,12 +30,13 @@ namespace ArdourCanvas
class Rectangle; class Rectangle;
class ConstrainedItem; class ConstrainedItem;
class BoxConstrainedItem;
class LIBCANVAS_API ConstraintPacker : public Container class LIBCANVAS_API ConstraintPacker : public Container
{ {
public: public:
ConstraintPacker (Canvas *); ConstraintPacker (Canvas *, Orientation o = Horizontal);
ConstraintPacker (Item *); ConstraintPacker (Item *, Orientation o = Horizontal);
void add (Item *); void add (Item *);
void add_front (Item *); void add_front (Item *);
@ -72,6 +73,12 @@ public:
void non_const_preferred_size (Duple& mininum, Duple& natural); void non_const_preferred_size (Duple& mininum, Duple& natural);
virtual void update_constraints (); virtual void update_constraints ();
private:
Orientation _orientation;
typedef std::list<BoxConstrainedItem*> BoxPackedItems;
BoxPackedItems vpacked;
BoxPackedItems hpacked;
}; };
} }

View File

@ -37,12 +37,13 @@ using std::vector;
using kiwi::Constraint; using kiwi::Constraint;
using namespace kiwi; using namespace kiwi;
ConstraintPacker::ConstraintPacker (Canvas* canvas) ConstraintPacker::ConstraintPacker (Canvas* canvas, Orientation o)
: Container (canvas) : Container (canvas)
, width (X_("packer width")) , width (X_("packer width"))
, height (X_("packer height")) , height (X_("packer height"))
, in_alloc (false) , in_alloc (false)
, _need_constraint_update (false) , _need_constraint_update (false)
, _orientation (o)
{ {
set_fill (false); set_fill (false);
set_outline (false); set_outline (false);
@ -52,12 +53,13 @@ ConstraintPacker::ConstraintPacker (Canvas* canvas)
_solver.addEditVariable (height, kiwi::strength::strong); _solver.addEditVariable (height, kiwi::strength::strong);
} }
ConstraintPacker::ConstraintPacker (Item* parent) ConstraintPacker::ConstraintPacker (Item* parent, Orientation o)
: Container (parent) : Container (parent)
, width (X_("packer width")) , width (X_("packer width"))
, height (X_("packer height")) , height (X_("packer height"))
, in_alloc (false) , in_alloc (false)
, _need_constraint_update (false) , _need_constraint_update (false)
, _orientation (o)
{ {
set_fill (false); set_fill (false);
set_outline (false); set_outline (false);