21 set_overflow(Gtk::Overflow::HIDDEN);
31Bin::Bin(BaseObjectType *cobject, Glib::RefPtr<Gtk::Builder>
const &)
32 :
Gtk::Widget(cobject)
36 _child = get_first_child();
37 assert(!
_child || !
_child->get_next_accessible_sibling());
59 Gtk::Widget::size_allocate_vfunc(
width,
height, baseline);
62 int min_width, min_height, ignore;
63 _child->measure(Gtk::Orientation::HORIZONTAL, -1, min_width, ignore, ignore, ignore);
64 _child->measure(Gtk::Orientation::VERTICAL, -1, min_height, ignore, ignore, ignore);
65 _child->size_allocate({0, 0, std::max(
width, min_width), std::max(
height, min_height)}, baseline);
71 return _child ?
_child->get_request_mode() : Gtk::SizeRequestMode::CONSTANT_SIZE;
74void Bin::measure_vfunc(Gtk::Orientation orientation,
int for_size,
int &min,
int &nat,
int &min_baseline,
int &nat_baseline)
const
77 _child->measure(orientation, for_size, min, nat, min_baseline, nat_baseline);
79 min = nat = min_baseline = nat_baseline = 0;
Bin: widget that can hold one child, useful as a base class of custom widgets.
void containerize(Gtk::Widget &widget)
Make a custom widget implement sensible memory management for its children.