23#include "../lout/msg.h"
24#include "../lout/debug.hh"
43 widget->getPaddingArea (x, y, width, height);
49 widget->getPaddingArea (xRef, yRef, widthRef, heightRef);
54 return widget->getStyle ();
59 widget->queueDrawArea (x - widget->allocation.x, y - widget->allocation.y,
142 DBG_OBJ_ENTER (
"draw", 0,
"intersects",
"%p, [%d, %d, %d * %d]",
147 *intersection = *area;
154 for (
Widget *widget =
this; r && widget != refWidget;
155 widget = widget->
parent) {
156 assert (widget != NULL);
159 widgetArea.
x = widget->allocation.x;
160 widgetArea.
y = widget->allocation.y;
161 widgetArea.
width = widget->allocation.width;
162 widgetArea.
height = widget->getHeight ();
164 if (intersection->
intersectsWith (&widgetArea, &newIntersection)) {
165 DBG_OBJ_MSGF (
"draw", 1,
"new intersection: %d, %d, %d * %d",
166 newIntersection.
x, newIntersection.
y,
168 *intersection = newIntersection;
179 DBG_OBJ_MSGF (
"draw", 1,
"final intersection: %d, %d, %d * %d",
180 intersection->
x, intersection->
y,
190 intersection->
x, intersection->
y,
206 draw (view, &thisArea, context);
228 return widgetAtPoint;
251 if (widget->isPossibleContainer ())
290 x, y, width, height);
292 _MSG(
"Widget::queueDrawArea alloc(%d %d %d %d) wid(%d %d %d %d)\n",
295 x, y, width, height);
313 fast ?
"true" :
"false");
319 Flags resizeFlag, extremesFlag, totalFlags;
337 totalFlags = resizeFlag;
340 totalFlags = (
Flags)(totalFlags | extremesFlag);
360 for (widget2 =
parent, child =
this; widget2;
361 child = widget2, widget2 = widget2->
parent) {
362 if (
layout && !widget2->resizeQueued ())
365 DBG_OBJ_MSGF (
"resize", 2,
"setting %s and ALLOCATE_QUEUED for %p",
367 "RESIZE_QUEUED" :
"NEEDS_RESIZE",
370 widget2->setFlags (resizeFlag);
371 widget2->markSizeChange (child->
parentRef);
375 widget2->setFlags (extremesFlag);
376 widget2->markExtremesChange (child->
parentRef);
382 "checking parent %p: (%d & %d) [= %d] == %d?",
383 widget2->parent, widget2->parent->flags,
384 totalFlags, widget2->parent->flags & totalFlags,
388 if (widget2->parent &&
389 (widget2->parent->flags & totalFlags) == totalFlags) {
390 widget2->parent->markSizeChange (widget2->parentRef);
392 widget2->parent->markExtremesChange (widget2->parentRef);
469 DBG_OBJ_ENTER (
"resize", 0,
"affectsSizeChangeContainerChild",
"%p", child);
535 Widget **references,
int *x,
int *y)
539 DBG_OBJ_ENTER (
"resize", 0,
"sizeRequest",
"%d, ...", numPos);
543 for(
int i = 0; i < numPos; i++)
545 i, references[i], x[i], y[i]);
560 SizeParams newRequisitionParams (numPos, references, x, y);
608 DBG_OBJ_ENTER (
"resize", 0,
"getMinWidth",
"[%d (%d) / %d (%d)], %s",
611 forceValue ?
"true" :
"false");
614 forceValue ?
"true" :
"false");
652 forceValue ?
"true" :
"false");
657 DBG_OBJ_MSG (
"resize", 1,
"no parent, regarding viewport");
668 width = viewportWidth;
677 DBG_OBJ_MSG (
"resize", 1,
"delegated to quasiParent");
699 forceValue ?
"true" :
"false");
704 DBG_OBJ_MSG (
"resize", 1,
"no parent, regarding viewport");
734 DBG_OBJ_MSG (
"resize", 1,
"delegated to quasiParent");
745 void (*splitHeightFun) (
int,
int *,
int *),
746 bool allowDecreaseWidth,
747 bool allowDecreaseHeight)
752 "%d * (%d + %d), ..., %s, %s",
758 DBG_OBJ_MSG (
"resize", 1,
"no parent, regarding viewport");
762 if (!allowDecreaseWidth && limitMinWidth < requisition->width)
790 if (minHeight != -1 &&
794 if (maxHeight != -1 &&
805 allowDecreaseHeight);
808 DBG_OBJ_MSG (
"resize", 1,
"delegated to quasiParent");
813 allowDecreaseHeight);
823 DBG_OBJ_ENTER (
"resize", 0,
"correctExtremes",
"%d (%d) / %d (%d)",
828 DBG_OBJ_MSG (
"resize", 1,
"no parent, regarding viewport");
838 limitMinWidth,
false);
840 limitMinWidth,
false);
842 limitMinWidth,
false);
844 DBG_OBJ_MSGF (
"resize", 1,
"width = %d, minWidth = %d, maxWidth = %d",
845 width, minWidth, maxWidth);
861 DBG_OBJ_MSG (
"resize", 1,
"delegated to quasiParent");
884 int limitMinWidth,
bool forceValue)
887 cssValue, refWidth, refWidget, limitMinWidth);
889 assert (refWidth != -1 || refWidget != NULL);
906 if (availWidth != -1) {
907 int containerWidth = availWidth - refWidget->
boxDiffWidth ();
928 Widget *refWidget,
int limitMinWidth,
929 bool forceValue,
int *finalWidth)
931 DBG_OBJ_ENTER (
"resize", 0,
"calcFinalWidth",
"..., %d, %p, %d, [%d]",
932 refWidth, refWidget, limitMinWidth, *finalWidth);
937 limitMinWidth, forceValue);
939 limitMinWidth, forceValue);
941 DBG_OBJ_MSGF (
"resize", 1,
"width = %d, minWidth = %d, maxWidth = %d",
942 width, minWidth, maxWidth);
950 if (maxWidth != -1 && (*finalWidth == -1 || *finalWidth > maxWidth))
951 *finalWidth = maxWidth;
952 if (minWidth != -1 && (*finalWidth == -1 || *finalWidth < minWidth))
953 *finalWidth = minWidth;
959 int refHeight,
Widget *refWidget,
bool forceValue)
964 DBG_OBJ_ENTER (
"resize", 0,
"calcHeight",
"0x%x, %s, %d, %p",
965 cssValue, usePercentage ?
"true" :
"false", refHeight,
968 assert (refHeight != -1 || refWidget != NULL);
986 if (availHeight != -1) {
987 int containerHeight = availHeight - refWidget->
boxDiffHeight ();
1007 if (!allowDecreaseHeight && *height != -1 && *height < ascent + descent)
1008 *height = ascent + descent;
1019 DBG_OBJ_ENTER (
"resize", 0,
"getExtremes",
"%d, ...", numPos);
1039 SizeParams newParams (numPos, references, x, y);
1133 DBG_OBJ_ENTER (
"resize", 0,
"sizeAllocate",
"%d, %d; %d * (%d + %d)",
1138 "old allocation (%d, %d; %d * (%d + %d)); needsAllocate: %s",
1139 this->allocation.
x, this->allocation.y, this->allocation.width,
1140 this->allocation.ascent, this->allocation.descent,
1166 this->allocation.width,
1167 this->allocation.ascent + this->allocation.descent,
1245 this->style->
unref ();
1249 this->style =
style;
1314 "table-header-group" :
1316 "table-footer-group" :
1352 while (widget != NULL) {
1371 while (widget != NULL) {
1389 int x,
int y,
int width,
int height,
bool inverse)
1399 width, height,
style, inverse);
1409 int xPad, yPad, widthPad, heightPad;
1412 (view,
layout, &canvasArea,
1437 int xMar, yMar, widthMar, heightMar;
1440 heightMar,
style, inverse);
1442 int xPad, yPad, widthPad, heightPad;
1461 xPad, yPad, widthPad, heightPad,
1462 xPad, yPad, widthPad, heightPad,
1548 Widget *widget1 =
this, *widget2 = otherWidget;
1549 int level1 = widget1->
getLevel (), level2 = widget2->getLevel();
1552 while (level1 > level2) {
1553 widget1 = widget1->
parent;
1557 while (level2 > level1) {
1558 widget2 = widget2->
parent;
1563 while (widget1 != widget2) {
1564 if (widget1->
parent == NULL) {
1565 MSG_WARN(
"widgets in different trees\n");
1569 widget1 = widget1->
parent;
1570 widget2 = widget2->
parent;
1577 int x,
int y,
int width,
int height)
1619 Widget **references,
int *x,
int *y)
1634 Widget **references,
int *x,
int *y)
1702 DBG_OBJ_ENTER (
"resize", 0,
"getAvailWidthOfChild",
"%p, %s",
1703 child, forceValue ?
"true" :
"false");
1717 -1,
this, -1,
false);
1718 if (maxWidth != -1 && width > maxWidth)
1722 -1,
this, -1,
false);
1723 if (minWidth != -1 && width < minWidth)
1737 if (effContainer ==
this) {
1742 DBG_OBJ_MSG (
"resize", 1,
"delegated to (effective) container");
1760 DBG_OBJ_ENTER (
"resize", 0,
"getAvailHeightOfChild",
"%p, %s",
1761 child, forceValue ?
"true" :
"false");
1776 if (effContainer ==
this) {
1789 if (availHeight == -1)
1799 DBG_OBJ_MSG (
"resize", 1,
"delegated to (effective) container");
1811 void (*splitHeightFun) (
int,
int*,
1813 bool allowDecreaseWidth,
1814 bool allowDecreaseHeight)
1828 if (effContainer ==
this) {
1831 allowDecreaseHeight);
1833 DBG_OBJ_MSG (
"resize", 1,
"delegated to (effective) container");
1838 allowDecreaseHeight);
1847 bool allowDecreaseWidth)
1850 "%p, %d * (%d + %d), %s",
1856 int limitMinWidth = child->
getMinWidth (NULL,
true);
1857 if (!allowDecreaseWidth && limitMinWidth < requisition->width)
1868 void (*splitHeightFun) (
int,
int*,
int*),
1869 bool allowDecreaseHeight)
1898 if (minHeight != -1 &&
1902 if (maxHeight != -1 &&
1912 bool useAdjustmentWidth)
1917 "%p, %d (%d) / %d (%d)",
1925 if (effContainer ==
this) {
1929 limitMinWidth,
false);
1931 limitMinWidth,
false);
1933 limitMinWidth,
false);
1935 DBG_OBJ_MSGF (
"resize", 1,
"width = %d, minWidth = %d, maxWidth = %d",
1936 width, minWidth, maxWidth);
1945 DBG_OBJ_MSG (
"resize", 1,
"delegated to (effective) container");
1948 useAdjustmentWidth);
2029 DBG_OBJ_ENTER_S (
"resize", 1,
"splitHeightPreserveAscent",
"%d, %d, %d",
2030 height, *ascent, *descent);
2032 *descent = height - *ascent;
2043 DBG_OBJ_ENTER_S (
"resize", 1,
"splitHeightPreserveDescent",
"%d, %d, %d",
2044 height, *ascent, *descent);
2046 *ascent = height - *descent;
Set at the top when drawing.
Rectangle * getToplevelArea()
Represents a enter or leave notify event.
Represents a mouse motion event.
Set at the top when getting the widget at the point.
Iterators are used to iterate through the contents of a widget.
virtual void unref()
Delete the iterator.
virtual bool next()=0
Move iterator forward and store content it.
void queueDraw(int x, int y, int width, int height)
style::Color * getBgColor()
void queueDrawExcept(int x, int y, int width, int height, int ex, int ey, int ewidth, int eheight)
lout::container::typed::Vector< Widget > * queueResizeList
void scrollTo(HPosition hpos, VPosition vpos, int x, int y, int width, int height)
Scrolls all viewports, so that the region [x, y, width, height] is seen, according to hpos and vpos.
void queueResize(bool extremesChanged)
dw::core::Shape implemtation for simple rectangles.
bool intersectsWith(Rectangle *otherRect, Rectangle *dest)
Return whether this rectangle and otherRect intersect.
Hold arguments passed to dw::core::Widget::sizeRequest and dw::core::Widget::getExtremes,...
bool isEquivalent(SizeParams *other)
Compares two instances, but considers a change in the order of the reference widgets as equivalent.
See Handling stacking contexts.
static bool isEstablishingStackingContext(Widget *widget)
void addChildSCWidget(Widget *widget)
void addWidgetProcessedAsInterruption(Widget *widget)
An interface to encapsulate platform dependent drawing.
StyleImage * backgroundImage
bool sizeDiffs(StyleAttrs *otherStyleAttrs)
This method returns whether something may change its size, when its style changes from this style to ...
void putExternalImgRenderer(ImgRenderer *ir)
Add an additional ImgRenderer, especially used for drawing.
void removeExternalImgRenderer(ImgRenderer *ir)
Remove a previously added additional ImgRenderer.
void registerName(const char *className, int *classId)
This method must be called in the constructor for the sub class.
#define DBG_OBJ_LEAVE_VAL_S(fmt,...)
#define DBG_OBJ_ENTER_S(aspect, prio, funname, fmt,...)
#define DBG_OBJ_ENTER0(aspect, prio, funname)
#define DBG_OBJ_CREATE(klass)
#define DBG_OBJ_SET_COL(var, val)
#define DBG_OBJ_SET_SYM(var, val)
#define DBG_OBJ_MSG_END()
#define DBG_OBJ_MSGF(aspect, prio, fmt,...)
#define DBG_OBJ_SET_NUM(var, val)
#define DBG_OBJ_MSG(aspect, prio, msg)
#define DBG_OBJ_ENTER(aspect, prio, funname, fmt,...)
#define DBG_OBJ_MSG_START()
#define DBG_OBJ_ASSOC_PARENT(parent)
#define DBG_OBJ_ASSOC_CHILD(child)
#define DBG_OBJ_SET_PTR(var, val)
#define DBG_OBJ_LEAVE_VAL0(val)
#define DBG_OBJ_LEAVE_VAL(fmt,...)
int multiplyWithPerLength(int x, Length l)
Multiply an int with a percentage length, returning int.
void drawBackground(View *view, Layout *layout, Rectangle *area, int x, int y, int width, int height, int xRef, int yRef, int widthRef, int heightRef, Style *style, Color *bgColor, bool inverse, bool atTop)
Draw the background (content plus padding) of a region in window, according to style.
@ DISPLAY_TABLE_HEADER_GROUP
@ DISPLAY_TABLE_ROW_GROUP
@ DISPLAY_TABLE_FOOTER_GROUP
int Length
Type for representing all lengths within dw::core::style.
double perLengthVal_useThisOnlyForDebugging(Length l)
Returns the value of a percentage, relative to 1, as a double.
void drawBorder(View *view, Layout *layout, Rectangle *area, int x, int y, int width, int height, Style *style, bool inverse)
Draw the border of a region in window, according to style.
bool isPerLength(Length l)
Returns true if l is a percentage.
bool isAbsLength(Length l)
Returns true if l is an absolute length.
int absLengthVal(Length l)
Returns the value of a length in pixels, as an integer.
@ LENGTH_AUTO
Represents "auto" lengths.
void splitHeightPreserveDescent(int height, int *ascent, int *descent)
void splitHeightPreserveAscent(int height, int *ascent, int *descent)
Dw is in this namespace, or sub namespaces of this one.
Miscellaneous stuff, which does not fit anywhere else.
void notImplemented(const char *name)
const char * boolToStr(bool b)
Here, some common classes (or interfaces) are defined, to standardize the access to other classes.
Represents the allocation, i.e.
@ WIDGET_IN_FLOW
widget in normal flow, so that this widget (containing this content) is both container (parent) and g...
@ WIDGET_OOF_CONT
widget out of flow (OOF); this widget (containing this content) is only the container (parent),...