72 Gtk::Requisition minDummy;
73 widget.get_preferred_size (minDummy, natSize);
79 int minDummy{0}, natHeight{0};
80 widget.get_preferred_height(minDummy, natHeight);
87 int minDummy{0}, natWidth{0};
88 widget.get_preferred_width(minDummy, natWidth);
134 return Gtk::ICON_SIZE_MENU;
142 if (widthConstraint_)
143 strategy.
getWidth = move(widthConstraint_);
144 if (heightConstraint_)
145 strategy.
getHeight = move(heightConstraint_);
151 :
Gtk::Box{
Gtk::ORIENTATION_HORIZONTAL}
152 , imgIcon_{
Gtk::StockID{iconID}, siz}
153 , imgMenu_{
Gtk::StockID{menuSymb}, siz}
166 name_.set_hexpand(
true);
169 initIconSizeHeuristic (
icon_);
176 name_.set_text(idCaption);
186 return name_.get_text();
193 , strategy_{config.buildLayoutStrategy(*this)}
194 , label_{config.getIconID()
195 ,config.getMenuSymb()
196 ,config.getIconSize()}
204 frame_.set_label_align (0.0, 0.0);
234 return Gtk::SizeRequestMode::SIZE_REQUEST_HEIGHT_FOR_WIDTH;
265 _Base::get_preferred_width_vfunc (minimum_width,natural_width);
278 _Base::get_preferred_height_vfunc (minimum_height,natural_height);
287 _Base::get_preferred_height_for_width_vfunc (width, minimum_height,natural_height);
306 _Base::on_size_allocate(availableSize);
349 int widthReduction{0};
350 if (icon.get_visible())
355 return widthReduction;
364 if (label.get_visible())
370 if (reduction < goal)
388 maybeShow(Gtk::Button& icon,
int w,
int h, FUN& reCheck)
390 if (icon.is_visible())
return true;
395 if (not (success=reCheck()))
403 maybeShow(Gtk::Label& label,
int w,
int h, FUN& reCheck)
412 int goal = width - w;
415 if (not (success=reCheck()))
439 int currH = queryNaturalHeight (*
this);
450 int currW = queryNaturalWidth (*
this);
453 int goal = currW - widthC;
455 if ((goal -= reduce(
name_, goal)) <= 0)
return;
456 if ((goal -= reduce(
menu_) ) <= 0)
return;
457 if ((goal -= reduce(
icon_) ) <= 0)
return;
458 currW = queryNaturalWidth(*
this);
459 goal = currW - widthC;
460 ENSURE (goal <= 0,
"IDLabel layout management floundered. "
461 "Removed all content, yet remaining width %d > %d"
466 int headroom = widthC - currW;
467 auto reCheck = [&]() ->
bool
469 currW = queryNaturalWidth (*
this);
470 currH = queryNaturalHeight(*
this);
471 headroom = widthC - currW;
472 return currH <= heightC
476 if (not maybeShow (
icon_, headroom, heightC, reCheck))
return;
477 if (not maybeShow (
menu_, headroom, heightC, reCheck))
return;
478 if (not maybeShow (
name_, headroom, heightC, reCheck))
return;
A set of basic GTK includes for the UI.
Lumiera GTK UI implementation root.
cuString CLASS_idlabel_menu
Literal ICON_arrow_hand_menu
cuString CLASS_background
opaque backdrop
cuString CLASS_elementbox
cuString CLASS_idlabel_name
cuString CLASS_elementbox_idlabel
only present on IDLabel widget within ElementBoxWidget
cuString CLASS_idlabel_icon
Definition of access keys for uniform UI styling.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...