Lumiera
0.pre.03
»edit your freedom«
|
Go to the source code of this file.
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
Definition in file element-box-widget.cpp.
#include "stage/gtk-base.hpp"
#include "stage/widget/element-box-widget.hpp"
#include "stage/style-scheme.hpp"
#include "lib/util.hpp"
Functions | |
void | initIconSizeHeuristic (Gtk::Widget const &icon) |
template<class FUN > | |
bool | maybeShow (Gtk::Button &icon, int w, int h, FUN &reCheck) |
attempt to use available space to show more content More... | |
template<class FUN > | |
bool | maybeShow (Gtk::Label &label, int w, int h, FUN &reCheck) |
int | queryNaturalHeight (Gtk::Widget const &widget) |
void | queryNaturalSize (Gtk::Widget const &widget, Gtk::Requisition &natSize) |
Helper to retrieve what GTK effectively uses as minimal extension of a widget. More... | |
int | queryNaturalWidth (Gtk::Widget const &widget) |
int | reduce (Gtk::Button &icon) |
attempt to reduce space consumption More... | |
int | reduce (Gtk::Label &label, int goal) |
Variables | |
const double | HYSTERESIS = 1.6 |
excess factor used to prevent "layout flickering" More... | |
Gtk::Requisition | ICON_SIZ {} |
point of reference for layout computations | |
Namespaces | |
stage | |
Lumiera GTK UI implementation root. | |
stage::widget | |
Lumiera custom widgets. | |