65 const double ORG = 0.0;
66 const double PHI = (1.0 + sqrt(5)) / 2.0;
83 const double ARC_O_R = 8.0574801069408135;
89 const double ARC_I_R = 6.6978115661011230;
100 Pango::FontDescription font = style->get_font (Gtk::STATE_FLAG_NORMAL);
101 auto sizeSpec = double(font.get_size()) / PANGO_SCALE;
104 if (not font.get_size_is_absolute())
106 auto screen = style->get_screen();
108 double dpi = screen->get_resolution();
143 auto required = 2*
PHISQUARE + style->get_padding().get_top()
144 + style->get_padding().get_bottom();
145 auto maxScale = givenHeight / (required);
146 return min (maxScale,
baseWidth (style));
158 +style->get_padding().get_right()
159 +style->get_padding().get_left()
168 +style->get_padding().get_right()
169 +style->get_padding().get_left()
179 return style->get_padding().get_left()
189 return style->get_padding().get_top()
201 - (style->get_padding().get_bottom()
203 auto minHeight =
PHISQUARE*scale + style->get_padding().get_top();
204 return max (lowerAnchor, minHeight);
217 drawCap (
CairoC cox, Gdk::RGBA colour,
double ox,
double oy,
double scale,
bool upside=
true)
220 cox->translate (ox,oy);
221 cox->scale (scale, upside? scale:-scale);
222 cox->set_source_rgba(colour.get_red()
225 ,colour.get_alpha());
242 drawBar (
CairoC cox, Gdk::RGBA colour,
double leftX,
double upperY,
double lowerY,
double scale)
245 cox->translate (leftX, upperY);
246 cox->scale (scale, scale);
247 cox->set_source_rgba(colour.get_red()
250 ,colour.get_alpha());
252 double height = max (0.0, (lowerY - upperY)/scale);
270 ,
double leftX,
double upperY,
double lowerY,
double width,
double scale
271 ,std::vector<uint> connectors)
273 double limit = lowerY - upperY;
278 cox->translate (line, upperY);
280 cox->set_source_rgb(1 - 0.2*(colour.get_red())
281 ,1 - 0.2*(colour.get_green())
282 ,1 - 0.5*(1 - colour.get_blue()) );
284 for (
uint off : connectors)
287 cox->move_to(rad,off);
288 cox->arc ( 0,off, rad, 0, 2 * M_PI);
292 cox->fill_preserve();
293 cox->set_source_rgba(colour.get_red()
296 ,colour.get_alpha());
301 cox->translate(rad,0);
303 double len = width-line-rad-1;
307 for (
uint off : connectors)
310 cox->move_to(
ORG,off);
311 cox->line_to(arr,off);
313 cox->move_to(arr,off-bas);
314 cox->line_to(len,off);
315 cox->line_to(arr,off+bas);
318 cox->set_miter_limit(20);
319 cox->fill_preserve();
339 this->property_expand() =
false;
357 bool event_is_handled = _Base::on_draw (cox);
359 StyleC style = this->get_style_context();
360 auto colour = style->get_color (Gtk::STATE_FLAG_NORMAL);
361 int height = this->get_allocated_height();
362 int width = this->get_width();
363 double scale = determineScale (style, height);
364 double left = anchorLeft (style, scale);
365 double upper = anchorUpper (style,scale);
366 double lower = anchorLower (style, scale, height);
368 drawCap (cox, colour, left, upper, scale,
true);
369 drawCap (cox, colour, left, lower, scale,
false);
370 drawBar (cox, colour, left, upper, lower, scale);
371 connect (cox, colour, left, upper, lower, width, scale,
connectors_);
373 return event_is_handled;
381 return Gtk::SizeRequestMode::SIZE_REQUEST_WIDTH_FOR_HEIGHT;
392 StyleC style = this->get_style_context();
393 minimum_width = natural_width = calcRequiredWidth (style, givenHeight);
399 StyleC style = this->get_style_context();
400 minimum_width = natural_width = calcDesiredWidth (style);
PCairoContext const & CairoC
PStyleContext const & StyleC
Lumiera GTK UI implementation root.
cuString CLASS_fork_bracket
Definition of access keys for uniform UI styling.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...