mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
Canvas: continuing move of cBox functionality into ConstraintPacker
This commit is contained in:
parent
4e82279ce4
commit
1b66890547
4 changed files with 458 additions and 557 deletions
|
|
@ -37,54 +37,15 @@ public:
|
|||
cBox (Canvas *, Orientation);
|
||||
cBox (Item *, Orientation);
|
||||
|
||||
void set_spacing (double s);
|
||||
void set_padding (double top, double right = -1.0, double bottom = -1.0, double left = -1.0);
|
||||
void set_margin (double top, double right = -1.0, double bottom = -1.0, double left = -1.0);
|
||||
|
||||
/* aliases so that CSS box model terms work */
|
||||
void set_border_width (double w) { set_outline_width (w); }
|
||||
void set_border_color (Gtkmm2ext::Color c) { set_outline_color (c); }
|
||||
|
||||
void remove (Item*);
|
||||
|
||||
BoxConstrainedItem* pack_start (Item*, PackOptions primary_axis_packing = PackOptions (0), PackOptions secondary_axis_packing = PackOptions (PackExpand|PackFill));
|
||||
BoxConstrainedItem* pack_end (Item*, PackOptions primary_axis_packing = PackOptions (0), PackOptions secondary_axis_packing = PackOptions (PackExpand|PackFill));
|
||||
|
||||
void add_vertical_box_constraints (kiwi::Solver& solver, BoxConstrainedItem* ci, BoxConstrainedItem* prev, double main_dimenion, double second_dimension, kiwi::Variable& alloc_var);
|
||||
void add_horizontal_box_constraints (kiwi::Solver& solver, BoxConstrainedItem* ci, BoxConstrainedItem* prev, double main_dimenion, double second_dimension, kiwi::Variable& alloc_var);
|
||||
|
||||
void set_collapse_on_hide (bool);
|
||||
void set_homogenous (bool);
|
||||
|
||||
void preferred_size(Duple& minimum, Duple& natural) const;
|
||||
void size_allocate (Rect const &);
|
||||
|
||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const;
|
||||
|
||||
protected:
|
||||
Orientation orientation;
|
||||
|
||||
double _spacing;
|
||||
double _top_padding;
|
||||
double _bottom_padding;
|
||||
double _left_padding;
|
||||
double _right_padding;
|
||||
double _top_margin;
|
||||
double _bottom_margin;
|
||||
double _left_margin;
|
||||
double _right_margin;
|
||||
|
||||
void child_changed (bool bbox_changed);
|
||||
void update_constraints ();
|
||||
|
||||
private:
|
||||
typedef std::list<BoxConstrainedItem*> Order;
|
||||
Order order;
|
||||
bool collapse_on_hide;
|
||||
bool homogenous;
|
||||
kiwi::Variable expanded_item_size;
|
||||
|
||||
BoxConstrainedItem* pack (Item*, PackOptions primary_axis_packing, PackOptions secondary_axis_packing);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,15 @@ public:
|
|||
ConstraintPacker (Canvas *, Orientation o = Horizontal);
|
||||
ConstraintPacker (Item *, Orientation o = Horizontal);
|
||||
|
||||
void set_spacing (double s);
|
||||
void set_padding (double top, double right = -1.0, double bottom = -1.0, double left = -1.0);
|
||||
void set_margin (double top, double right = -1.0, double bottom = -1.0, double left = -1.0);
|
||||
|
||||
/* aliases so that CSS box model terms work */
|
||||
void set_border_width (double w) { set_outline_width (w); }
|
||||
void set_border_color (Gtkmm2ext::Color c) { set_outline_color (c); }
|
||||
|
||||
|
||||
void add (Item *);
|
||||
void add_front (Item *);
|
||||
void remove (Item *);
|
||||
|
|
@ -56,12 +65,27 @@ public:
|
|||
void preferred_size (Duple& mininum, Duple& natural) const;
|
||||
void size_allocate (Rect const &);
|
||||
|
||||
void render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const;
|
||||
|
||||
kiwi::Variable width;
|
||||
kiwi::Variable height;
|
||||
|
||||
protected:
|
||||
void child_changed (bool bbox_changed);
|
||||
|
||||
Orientation _orientation;
|
||||
double _spacing;
|
||||
double _top_padding;
|
||||
double _bottom_padding;
|
||||
double _left_padding;
|
||||
double _right_padding;
|
||||
double _top_margin;
|
||||
double _bottom_margin;
|
||||
double _left_margin;
|
||||
double _right_margin;
|
||||
|
||||
kiwi::Variable expanded_item_size;
|
||||
|
||||
typedef std::map<Item*,ConstrainedItem*> ConstrainedItemMap;
|
||||
ConstrainedItemMap constrained_map;
|
||||
typedef std::list<kiwi::Constraint> ConstraintList;
|
||||
|
|
@ -77,13 +101,15 @@ public:
|
|||
void non_const_preferred_size (Duple& mininum, Duple& natural);
|
||||
virtual void update_constraints ();
|
||||
|
||||
void add_vertical_box_constraints (kiwi::Solver& solver, BoxConstrainedItem* ci, BoxConstrainedItem* prev, double main_dimenion, double second_dimension, kiwi::Variable& alloc_var);
|
||||
void add_horizontal_box_constraints (kiwi::Solver& solver, BoxConstrainedItem* ci, BoxConstrainedItem* prev, double main_dimenion, double second_dimension, kiwi::Variable& alloc_var);
|
||||
|
||||
private:
|
||||
Orientation _orientation;
|
||||
typedef std::list<BoxConstrainedItem*> BoxPackedItems;
|
||||
BoxPackedItems vpacked;
|
||||
BoxPackedItems hpacked;
|
||||
BoxPackedItems packed;
|
||||
|
||||
BoxConstrainedItem* pack (Item*, PackOptions primary_axis_packing, PackOptions secondary_axis_packing);
|
||||
void box_preferred_size (Duple& mininum, Duple& natural) const;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue