Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
element-box-widget.cpp File Reference

Implementation details of the UI building block to display an ID label. More...

Go to the source code of this file.

Description

Implementation details of the UI building block to display an ID label.

A special twist arises from the requirement to show the temporal extension of media, leading to a display on a time calibrated canvas, where a given time span corresponds to some fixed pixel count, according to the current zoom factor. Such a layout stands in contradiction to the fundamental design principles of GTK — the assumption being that all widget layout shall be determined dynamically, to adopt to screen resolution, system fonts and user provided styles and themes.

This conflict can be reconciled by representing this time-to-size calibration in the form of a desired minimal extension reported by the individual widget. Since GTK only ever expands the widget provided size request (e.g. to accommodate for additional borders and padding from CSS), our timeline canvas can be sure to get at least the necessary extension. Moreover, we can assure, with the help of our custom style sheet, that those size constrained widgets do not require any additional decoration, borders or margin. Accordingly, we choose Gtk::Frame as the base class, so the border is drawn as part of the widget's content, with the identification label placed on top.

However, after declaring to GTK that the widget can be rendered within the specific size constraint, it now becomes our responsibility to enforce this size constraint onto any child widgets used as part of the ElementBoxWidget — especially we have to query the size required to represent the name-ID label, possibly taking measures to reduce this size to fit

Todo:
as of 9/2022 we just hide the label text completely to comply with the constraints; it is conceivable to use a more elaborate approach and to shorten the label text to fit.
Todo:
WIP-WIP as of 09/2022 ///////////////////////////////////////////////////////////////////////TICKET #1185

Definition in file element-box-widget.cpp.

Namespaces

namespace  stage
 Lumiera GTK UI implementation root.
 
namespace  stage::widget
 Lumiera custom widgets.
 
namespace  stage::widget::anonymous_namespace{element-box-widget.cpp}
 

Functions

void queryNaturalSize (Gtk::Widget const &widget, Gtk::Requisition &natSize)
 Helper to retrieve what GTK effectively uses as minimal extension of a widget.
 
int queryNaturalHeight (Gtk::Widget const &widget)
 
int queryNaturalWidth (Gtk::Widget const &widget)
 
void initIconSizeHeuristic (Gtk::Widget const &icon)
 
int reduce (Gtk::Button &icon)
 attempt to reduce space consumption
 
int reduce (Gtk::Label &label, int goal)
 
template<class FUN >
bool maybeShow (Gtk::Button &icon, int w, int h, FUN &reCheck)
 attempt to use available space to show more content
 
template<class FUN >
bool maybeShow (Gtk::Label &label, int w, int h, FUN &reCheck)
 

Variables

Gtk::Requisition ICON_SIZ {}
 point of reference for layout computations
 
const double HYSTERESIS = 1.6
 excess factor used to prevent "layout flickering"