13
0

canvasL Item gets packing options similar to GTK

This commit is contained in:
Paul Davis 2021-07-29 12:19:08 -06:00
parent aa46a91b0c
commit 1a70cf5b8e
3 changed files with 15 additions and 4 deletions

View File

@ -236,6 +236,9 @@ public:
void lower_child_to_bottom (Item *);
virtual void child_changed (bool bbox_changed);
PackOptions pack_options () const { return _pack_options; }
void set_pack_options (PackOptions);
static int default_items_per_cell;
@ -330,6 +333,7 @@ public:
mutable Rect _bounding_box;
/** true if _bounding_box might be out of date, false if its definitely not */
mutable bool _bounding_box_dirty;
PackOptions _pack_options;
void bb_clean () const;

View File

@ -195,10 +195,14 @@ struct LIBCANVAS_API Rect
};
enum PackOptions {
PackExpand = 0x1,
PackFill = 0x2,
PackFromStart = 0x4,
PackFromEnd = 0x8
PackExpand = 0x1, /* use all available space ... */
PackFill = 0x2, /* if PackExpand set, this means actually
expand size of Item; if PackExpand not
set, this does nothing.
*/
PackShrink = 0x4, /* allow Item to be smaller than its natural size */
PackFromStart = 0x8,
PackFromEnd = 0x10
};
extern LIBCANVAS_API std::ostream & operator<< (std::ostream &, Rect const &);

View File

@ -43,6 +43,7 @@ Item::Item (Canvas* canvas)
, _scroll_parent (0)
, _visible (true)
, _bounding_box_dirty (true)
, _pack_options (PackOptions (0))
, _layout_sensitive (false)
, _intrinsic_width (-1.)
, _intrinsic_height(-1.)
@ -63,6 +64,7 @@ Item::Item (Item* parent)
, _scroll_parent (0)
, _visible (true)
, _bounding_box_dirty (true)
, _pack_options (PackOptions (0))
, _layout_sensitive (false)
, _intrinsic_width (-1.)
, _intrinsic_height(-1.)
@ -90,6 +92,7 @@ Item::Item (Item* parent, Duple const& p)
, _position (p)
, _visible (true)
, _bounding_box_dirty (true)
, _pack_options (PackOptions (0))
, _layout_sensitive (false)
, _intrinsic_width (-1.)
, _intrinsic_height(-1.)