MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PiuViewAdjustAux

Function PiuViewAdjustAux

modules/piu/PC/lin/piuView.c:425–469  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423};
424
425static void PiuViewAdjustAux(GtkWidget *widget, gpointer it)
426{
427 PiuView* self = it;
428 GtkFixed* gtkFixed = (*self)->gtkFixed;
429 GtkWidget* gtkView = (*self)->gtkView;
430 if (gtkView == widget) {
431 PiuApplication* application = (*self)->application;
432 gtk_fixed_move(gtkFixed, widget, 0, 0);
433 gtk_widget_set_size_request(widget, (*application)->bounds.width, (*application)->bounds.height);
434 }
435 else {
436 GtkPiuClip* gtkClip = GTK_PIU_CLIP(widget);
437 PiuContent* content = gtkClip->piuContent;
438 PiuRectangleRecord bounds = (*content)->bounds;
439 PiuRectangleRecord clipBounds = bounds;
440 PiuContainer* container = (*content)->container;
441 GtkRequisition minimum;
442 GtkRequisition natural;
443
444 while (container) {
445 bounds.x += (*container)->bounds.x;
446 bounds.y += (*container)->bounds.y;
447 clipBounds.x += (*container)->bounds.x;
448 clipBounds.y += (*container)->bounds.y;
449 if ((*container)->flags & piuClip)
450 PiuRectangleIntersect(&clipBounds, &clipBounds, &(*container)->bounds);
451 container = (*container)->container;
452 }
453 double x = clipBounds.x;
454 double y = clipBounds.y;
455 gtk_fixed_move(gtkFixed, widget, x, y);
456 gtk_widget_set_size_request(widget, clipBounds.width, clipBounds.height);
457 gtk_widget_set_size_request(gtkClip->widget, bounds.width, bounds.height);
458 if (PiuRectangleContains(&clipBounds, &bounds)) {
459 gtk_widget_show(gtkClip->widget);
460 gtk_widget_get_preferred_size(gtkClip->widget, &minimum, &natural);
461 if (minimum.height > bounds.height) {
462 y -= (minimum.height - bounds.height) / 2;
463 gtk_fixed_move(gtkFixed, widget, x, y);
464 }
465 }
466 else
467 gtk_widget_hide(gtkClip->widget);
468 }
469}
470
471
472void PiuViewAdjust(PiuView* self)

Callers

nothing calls this directly

Calls 2

PiuRectangleIntersectFunction · 0.85
PiuRectangleContainsFunction · 0.85

Tested by

no test coverage detected