mirror of https://gitlab.com/nakst/essence
				
				
				
			rename EsElement::currentStyle to style
This commit is contained in:
		
							parent
							
								
									028b3e6ddc
								
							
						
					
					
						commit
						88351dbf9e
					
				| 
						 | 
					@ -295,7 +295,7 @@ bool ReorderItemDragged(ReorderItem *item, int mouseX) {
 | 
				
			||||||
		list->items.Delete(currentIndex);
 | 
							list->items.Delete(currentIndex);
 | 
				
			||||||
		list->items.Insert(item, draggedIndex);
 | 
							list->items.Insert(item, draggedIndex);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (uintptr_t i = 0, x = list->currentStyle->insets.l; i < childCount; i++) {
 | 
							for (uintptr_t i = 0, x = list->style->insets.l; i < childCount; i++) {
 | 
				
			||||||
			ReorderItem *child = (ReorderItem *) list->items[i];
 | 
								ReorderItem *child = (ReorderItem *) list->items[i];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if ((int) i != draggedIndex) {
 | 
								if ((int) i != draggedIndex) {
 | 
				
			||||||
| 
						 | 
					@ -326,7 +326,7 @@ void ReorderItemDragComplete(ReorderItem *item) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ReorderList *list = (ReorderList *) item->parent;
 | 
						ReorderList *list = (ReorderList *) item->parent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (uintptr_t i = 0, x = list->currentStyle->insets.l; i < list->items.Length(); i++) {
 | 
						for (uintptr_t i = 0, x = list->style->insets.l; i < list->items.Length(); i++) {
 | 
				
			||||||
		if (list->items[i] == item) {
 | 
							if (list->items[i] == item) {
 | 
				
			||||||
			int oldPosition = item->offsetX, newPosition = x + item->offsetProgress;
 | 
								int oldPosition = item->offsetX, newPosition = x + item->offsetProgress;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -344,8 +344,8 @@ void ReorderItemDragComplete(ReorderItem *item) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int ReorderListLayout(ReorderList *list, int additionalRightMargin, bool clampDraggedItem, bool preventTabSizeAnimation) {
 | 
					int ReorderListLayout(ReorderList *list, int additionalRightMargin, bool clampDraggedItem, bool preventTabSizeAnimation) {
 | 
				
			||||||
	EsRectangle bounds = list->GetBounds();
 | 
						EsRectangle bounds = list->GetBounds();
 | 
				
			||||||
	bounds.l += list->currentStyle->insets.l;
 | 
						bounds.l += list->style->insets.l;
 | 
				
			||||||
	bounds.r -= list->currentStyle->insets.r;
 | 
						bounds.r -= list->style->insets.r;
 | 
				
			||||||
	bounds.r -= additionalRightMargin;
 | 
						bounds.r -= additionalRightMargin;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size_t childCount = list->items.Length();
 | 
						size_t childCount = list->items.Length();
 | 
				
			||||||
| 
						 | 
					@ -358,7 +358,7 @@ int ReorderListLayout(ReorderList *list, int additionalRightMargin, bool clampDr
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (uintptr_t i = 0; i < childCount; i++) {
 | 
						for (uintptr_t i = 0; i < childCount; i++) {
 | 
				
			||||||
		ReorderItem *child = list->items[i];
 | 
							ReorderItem *child = list->items[i];
 | 
				
			||||||
		totalWidth += child->currentStyle->metrics->maximumWidth + list->currentStyle->metrics->gapMinor;
 | 
							totalWidth += child->style->metrics->maximumWidth + list->style->metrics->gapMinor;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool widthClamped = false;
 | 
						bool widthClamped = false;
 | 
				
			||||||
| 
						 | 
					@ -395,7 +395,7 @@ int ReorderListLayout(ReorderList *list, int additionalRightMargin, bool clampDr
 | 
				
			||||||
	for (uintptr_t i = 0; i < childCount; i++) {
 | 
						for (uintptr_t i = 0; i < childCount; i++) {
 | 
				
			||||||
		ReorderItem *child = list->items[i];
 | 
							ReorderItem *child = list->items[i];
 | 
				
			||||||
		int width = (i == childCount - 1 && widthClamped) ? (totalWidth - x) : child->sizeProgress;
 | 
							int width = (i == childCount - 1 && widthClamped) ? (totalWidth - x) : child->sizeProgress;
 | 
				
			||||||
		int gap = list->currentStyle->metrics->gapMinor;
 | 
							int gap = list->style->metrics->gapMinor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (child->dragging) {
 | 
							if (child->dragging) {
 | 
				
			||||||
			int p = child->dragPosition;
 | 
								int p = child->dragPosition;
 | 
				
			||||||
| 
						 | 
					@ -730,10 +730,10 @@ int WindowTabMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
			message->hitTest.inside = (bounds.b - message->hitTest.y) * 14 < (bounds.r - message->hitTest.x) * bounds.b;
 | 
								message->hitTest.inside = (bounds.b - message->hitTest.y) * 14 < (bounds.r - message->hitTest.x) * bounds.b;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (message->type == ES_MSG_LAYOUT) {
 | 
						} else if (message->type == ES_MSG_LAYOUT) {
 | 
				
			||||||
		int closeButtonWidth = tab->closeButton->currentStyle->preferredWidth;
 | 
							int closeButtonWidth = tab->closeButton->style->preferredWidth;
 | 
				
			||||||
		Rectangle16 insets = tab->currentStyle->metrics->insets;
 | 
							Rectangle16 insets = tab->style->metrics->insets;
 | 
				
			||||||
		EsElementSetHidden(tab->closeButton, tab->currentStyle->gapWrap * 2 + closeButtonWidth >= tab->width);
 | 
							EsElementSetHidden(tab->closeButton, tab->style->gapWrap * 2 + closeButtonWidth >= tab->width);
 | 
				
			||||||
		EsElementMove(tab->closeButton, tab->width - tab->currentStyle->gapWrap - closeButtonWidth, 
 | 
							EsElementMove(tab->closeButton, tab->width - tab->style->gapWrap - closeButtonWidth, 
 | 
				
			||||||
				insets.t, closeButtonWidth, tab->height - insets.t - insets.b);
 | 
									insets.t, closeButtonWidth, tab->height - insets.t - insets.b);
 | 
				
			||||||
	} else if (message->type == ES_MSG_PAINT) {
 | 
						} else if (message->type == ES_MSG_PAINT) {
 | 
				
			||||||
		EsDrawContent(message->painter, element, ES_RECT_2S(message->painter->width, message->painter->height), 
 | 
							EsDrawContent(message->painter, element, ES_RECT_2S(message->painter->width, message->painter->height), 
 | 
				
			||||||
| 
						 | 
					@ -774,7 +774,7 @@ int WindowTabMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
				// TODO Sometimes the tab ends up a few pixels off?
 | 
									// TODO Sometimes the tab ends up a few pixels off?
 | 
				
			||||||
				newTab->window->pressed = newTab;
 | 
									newTab->window->pressed = newTab;
 | 
				
			||||||
				newTab->window->dragged = newTab;
 | 
									newTab->window->dragged = newTab;
 | 
				
			||||||
				newTab->dragOffset = dragOffset + 2 * hoverContainer->tabBand->currentStyle->insets.l;
 | 
									newTab->dragOffset = dragOffset + 2 * hoverContainer->tabBand->style->insets.l;
 | 
				
			||||||
				newTab->dragging = true;
 | 
									newTab->dragging = true;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
| 
						 | 
					@ -788,9 +788,9 @@ int WindowTabMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
				// TODO Moving a tab directly from one container to another.
 | 
									// TODO Moving a tab directly from one container to another.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// If we dragged the tab off the left or right side of the band, put it at the start of the new tab band.
 | 
									// If we dragged the tab off the left or right side of the band, put it at the start of the new tab band.
 | 
				
			||||||
				bool putAtStart = tab->dragPosition < band->currentStyle->insets.l 
 | 
									bool putAtStart = tab->dragPosition < band->style->insets.l 
 | 
				
			||||||
					|| tab->dragPosition + tab->width > band->width - band->currentStyle->insets.r;
 | 
										|| tab->dragPosition + tab->width > band->width - band->style->insets.r;
 | 
				
			||||||
				int32_t putAtStartClickX = band->currentStyle->insets.l + tab->dragOffset;
 | 
									int32_t putAtStartClickX = band->style->insets.l + tab->dragOffset;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				// End the drag on this container.
 | 
									// End the drag on this container.
 | 
				
			||||||
				EsMessage m = { .type = ES_MSG_MOUSE_LEFT_UP };
 | 
									EsMessage m = { .type = ES_MSG_MOUSE_LEFT_UP };
 | 
				
			||||||
| 
						 | 
					@ -803,7 +803,7 @@ int WindowTabMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
					// Transfer the drag to the new container.
 | 
										// Transfer the drag to the new container.
 | 
				
			||||||
					EsSyscall(ES_SYSCALL_WINDOW_TRANSFER_PRESS, band->window->handle, newTab->window->handle, 0, 0);
 | 
										EsSyscall(ES_SYSCALL_WINDOW_TRANSFER_PRESS, band->window->handle, newTab->window->handle, 0, 0);
 | 
				
			||||||
					ReorderItemDragged(newTab, 0);
 | 
										ReorderItemDragged(newTab, 0);
 | 
				
			||||||
					newTab->dragPosition = putAtStart ? band->currentStyle->insets.l : previousTabOffsetX;
 | 
										newTab->dragPosition = putAtStart ? band->style->insets.l : previousTabOffsetX;
 | 
				
			||||||
					newTab->window->pressed = newTab;
 | 
										newTab->window->pressed = newTab;
 | 
				
			||||||
					newTab->window->dragged = newTab;
 | 
										newTab->window->dragged = newTab;
 | 
				
			||||||
					gui.lastClickX = putAtStart ? putAtStartClickX : mousePosition.x;
 | 
										gui.lastClickX = putAtStart ? putAtStartClickX : mousePosition.x;
 | 
				
			||||||
| 
						 | 
					@ -910,10 +910,10 @@ int WindowTabBandMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int x = ReorderListLayout(band, band->GetChild(0)->currentStyle->preferredWidth + 10 * theming.scale, 
 | 
							int x = ReorderListLayout(band, band->GetChild(0)->style->preferredWidth + 10 * theming.scale, 
 | 
				
			||||||
				true, band->preventNextTabSizeAnimation);
 | 
									true, band->preventNextTabSizeAnimation);
 | 
				
			||||||
		band->GetChild(0)->InternalMove(band->GetChild(0)->currentStyle->preferredWidth, 
 | 
							band->GetChild(0)->InternalMove(band->GetChild(0)->style->preferredWidth, 
 | 
				
			||||||
				band->GetChild(0)->currentStyle->preferredHeight, x + 10 * theming.scale, 4 * theming.scale);
 | 
									band->GetChild(0)->style->preferredHeight, x + 10 * theming.scale, 4 * theming.scale);
 | 
				
			||||||
		band->preventNextTabSizeAnimation = false;
 | 
							band->preventNextTabSizeAnimation = false;
 | 
				
			||||||
	} else if (message->type == ES_MSG_MOUSE_LEFT_DOWN) {
 | 
						} else if (message->type == ES_MSG_MOUSE_LEFT_DOWN) {
 | 
				
			||||||
	} else if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
 | 
						} else if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										256
									
								
								desktop/gui.cpp
								
								
								
								
							
							
						
						
									
										256
									
								
								desktop/gui.cpp
								
								
								
								
							| 
						 | 
					@ -136,7 +136,7 @@ struct EsElement : EsElementPublic {
 | 
				
			||||||
	uint16_t previousStyleState; // Set by RefreshStyleState.
 | 
						uint16_t previousStyleState; // Set by RefreshStyleState.
 | 
				
			||||||
	uint16_t transitionDurationMs, transitionTimeMs;
 | 
						uint16_t transitionDurationMs, transitionTimeMs;
 | 
				
			||||||
	uint64_t lastTimeStamp;
 | 
						uint64_t lastTimeStamp;
 | 
				
			||||||
	UIStyle *currentStyle; 
 | 
						UIStyle *style; 
 | 
				
			||||||
	UIStyleKey currentStyleKey;
 | 
						UIStyleKey currentStyleKey;
 | 
				
			||||||
	ThemeAnimation animation; 
 | 
						ThemeAnimation animation; 
 | 
				
			||||||
	EsPaintTarget *previousTransitionFrame; 
 | 
						EsPaintTarget *previousTransitionFrame; 
 | 
				
			||||||
| 
						 | 
					@ -372,15 +372,15 @@ struct EsPanel : EsElement {
 | 
				
			||||||
	MeasurementCache measurementCache;
 | 
						MeasurementCache measurementCache;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int GetGapMajor() {
 | 
						int GetGapMajor() {
 | 
				
			||||||
		return currentStyle->gapMajor;
 | 
							return style->gapMajor;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int GetGapMinor() {
 | 
						int GetGapMinor() {
 | 
				
			||||||
		return currentStyle->gapMinor;
 | 
							return style->gapMinor;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EsRectangle GetInsets() {
 | 
						EsRectangle GetInsets() {
 | 
				
			||||||
		return currentStyle->insets;
 | 
							return style->insets;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int GetInsetWidth() {
 | 
						int GetInsetWidth() {
 | 
				
			||||||
| 
						 | 
					@ -830,7 +830,7 @@ int ProcessRootMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
					EsElementMove(toolbar, 0, 0, bounds.r, bounds.b);
 | 
										EsElementMove(toolbar, 0, 0, bounds.r, bounds.b);
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					int toolbarHeight = toolbar->GetChildCount() ? toolbar->GetHeight(bounds.r) 
 | 
										int toolbarHeight = toolbar->GetChildCount() ? toolbar->GetHeight(bounds.r) 
 | 
				
			||||||
						: toolbar->currentStyle->metrics->minimumHeight;
 | 
											: toolbar->style->metrics->minimumHeight;
 | 
				
			||||||
					EsElementMove(window->GetChild(0), 0, toolbarHeight, bounds.r, bounds.b - toolbarHeight);
 | 
										EsElementMove(window->GetChild(0), 0, toolbarHeight, bounds.r, bounds.b - toolbarHeight);
 | 
				
			||||||
					EsElementMove(toolbar, 0, 0, bounds.r, toolbarHeight);
 | 
										EsElementMove(toolbar, 0, 0, bounds.r, toolbarHeight);
 | 
				
			||||||
					EsElementMove(window->GetChild(2), 0, 0, bounds.r, bounds.b);
 | 
										EsElementMove(window->GetChild(2), 0, 0, bounds.r, bounds.b);
 | 
				
			||||||
| 
						 | 
					@ -939,7 +939,7 @@ EsWindow *EsWindowCreate(EsInstance *instance, EsWindowStyle style) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EsElementStartTransition(window, ES_TRANSITION_FADE_IN);
 | 
							EsElementStartTransition(window, ES_TRANSITION_FADE_IN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, ES_WINDOW_SOLID_TRUE, (uintptr_t) &panel->currentStyle->insets, ES_WINDOW_PROPERTY_SOLID);
 | 
							EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, ES_WINDOW_SOLID_TRUE, (uintptr_t) &panel->style->insets, ES_WINDOW_PROPERTY_SOLID);
 | 
				
			||||||
		EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, BLEND_WINDOW_MATERIAL_GLASS, 0, ES_WINDOW_PROPERTY_MATERIAL);
 | 
							EsSyscall(ES_SYSCALL_WINDOW_SET_PROPERTY, window->handle, BLEND_WINDOW_MATERIAL_GLASS, 0, ES_WINDOW_PROPERTY_MATERIAL);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1030,7 +1030,7 @@ void EsMenuShow(EsMenu *menu, int fixedWidth, int fixedHeight) {
 | 
				
			||||||
	menu->source->MaybeRefreshStyle();
 | 
						menu->source->MaybeRefreshStyle();
 | 
				
			||||||
	menu->source->window->targetMenu = menu;
 | 
						menu->source->window->targetMenu = menu;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EsRectangle menuInsets = menu->GetChild(0)->currentStyle->insets;
 | 
						EsRectangle menuInsets = menu->GetChild(0)->style->insets;
 | 
				
			||||||
	if (fixedWidth) fixedWidth += menuInsets.l + menuInsets.r;
 | 
						if (fixedWidth) fixedWidth += menuInsets.l + menuInsets.r;
 | 
				
			||||||
	if (fixedHeight) fixedHeight += menuInsets.t + menuInsets.b;
 | 
						if (fixedHeight) fixedHeight += menuInsets.t + menuInsets.b;
 | 
				
			||||||
	int width = fixedWidth ?: menu->GetChild(0)->GetWidth(fixedHeight);
 | 
						int width = fixedWidth ?: menu->GetChild(0)->GetWidth(fixedHeight);
 | 
				
			||||||
| 
						 | 
					@ -1314,7 +1314,7 @@ void EsElementStartTransition(EsElement *element, EsTransitionType transitionTyp
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (~flags & ES_ELEMENT_TRANSITION_ENTRANCE) {
 | 
						if (~flags & ES_ELEMENT_TRANSITION_ENTRANCE) {
 | 
				
			||||||
		EsRectangle paintOutsets = element->currentStyle->paintOutsets;
 | 
							EsRectangle paintOutsets = element->style->paintOutsets;
 | 
				
			||||||
		int width = element->width + paintOutsets.l + paintOutsets.r;
 | 
							int width = element->width + paintOutsets.l + paintOutsets.r;
 | 
				
			||||||
		int height = element->height + paintOutsets.t + paintOutsets.b;
 | 
							int height = element->height + paintOutsets.t + paintOutsets.b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1364,8 +1364,8 @@ void EsElement::Repaint(bool all, EsRectangle region) {
 | 
				
			||||||
	// TODO Optimisation: don't paint if overlapped by an opaque child or sibling.
 | 
						// TODO Optimisation: don't paint if overlapped by an opaque child or sibling.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (all) {
 | 
						if (all) {
 | 
				
			||||||
		region.l = -currentStyle->paintOutsets.l, region.r =  width + currentStyle->paintOutsets.r;
 | 
							region.l = -style->paintOutsets.l, region.r =  width + style->paintOutsets.r;
 | 
				
			||||||
		region.t = -currentStyle->paintOutsets.t, region.b = height + currentStyle->paintOutsets.b;
 | 
							region.t = -style->paintOutsets.t, region.b = height + style->paintOutsets.b;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		region = Translate(region, -internalOffsetLeft, -internalOffsetTop);
 | 
							region = Translate(region, -internalOffsetLeft, -internalOffsetTop);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1375,8 +1375,8 @@ void EsElement::Repaint(bool all, EsRectangle region) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		region = Translate(region, offsetX + parentBounds.l, offsetY + parentBounds.t);
 | 
							region = Translate(region, offsetX + parentBounds.l, offsetY + parentBounds.t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (parent->currentStyle->metrics->clipEnabled) {
 | 
							if (parent->style->metrics->clipEnabled) {
 | 
				
			||||||
			Rectangle16 clipInsets = parent->currentStyle->metrics->clipInsets;
 | 
								Rectangle16 clipInsets = parent->style->metrics->clipInsets;
 | 
				
			||||||
			region = EsRectangleIntersection(region, EsRectangleAddBorder(parentBounds, RECT16_TO_RECT(clipInsets)));
 | 
								region = EsRectangleIntersection(region, EsRectangleAddBorder(parentBounds, RECT16_TO_RECT(clipInsets)));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -1409,10 +1409,10 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		EsRectangle area; 
 | 
							EsRectangle area; 
 | 
				
			||||||
		area.l = pOffsetX - currentStyle->paintOutsets.l;
 | 
							area.l = pOffsetX - style->paintOutsets.l;
 | 
				
			||||||
		area.r = pOffsetX + width + currentStyle->paintOutsets.r;
 | 
							area.r = pOffsetX + width + style->paintOutsets.r;
 | 
				
			||||||
		area.t = pOffsetY - currentStyle->paintOutsets.t;
 | 
							area.t = pOffsetY - style->paintOutsets.t;
 | 
				
			||||||
		area.b = pOffsetY + height + currentStyle->paintOutsets.b;
 | 
							area.b = pOffsetY + height + style->paintOutsets.b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!THEME_RECT_VALID(EsRectangleIntersection(area, painter->clip))) {
 | 
							if (!THEME_RECT_VALID(EsRectangleIntersection(area, painter->clip))) {
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
| 
						 | 
					@ -1426,9 +1426,9 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EsPainter oldPainter = *painter;
 | 
						EsPainter oldPainter = *painter;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	UIStyle *style = ThemeAnimationComplete(&animation) ? currentStyle : ThemeStyleInterpolate(currentStyle, &animation);
 | 
						UIStyle *interpolatedStyle = ThemeAnimationComplete(&animation) ? style : ThemeStyleInterpolate(style, &animation);
 | 
				
			||||||
	EsDefer(if (style != currentStyle) EsHeapFree(style));
 | 
						EsDefer(if (interpolatedStyle != style) EsHeapFree(interpolatedStyle));
 | 
				
			||||||
	painter->style = style;
 | 
						painter->style = interpolatedStyle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	painter->offsetX = pOffsetX, painter->offsetY = pOffsetY;
 | 
						painter->offsetX = pOffsetX, painter->offsetY = pOffsetY;
 | 
				
			||||||
	painter->width = width, painter->height = height;
 | 
						painter->width = width, painter->height = height;
 | 
				
			||||||
| 
						 | 
					@ -1454,9 +1454,9 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (paintFlags & PAINT_SHADOW) {
 | 
						if (paintFlags & PAINT_SHADOW) {
 | 
				
			||||||
		style->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_SHADOW);
 | 
							interpolatedStyle->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_SHADOW);
 | 
				
			||||||
	} else if (paintFlags & PAINT_OVERLAY) {
 | 
						} else if (paintFlags & PAINT_OVERLAY) {
 | 
				
			||||||
		style->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_OVERLAY);
 | 
							interpolatedStyle->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_OVERLAY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Paint layout bounds, if active.
 | 
							// Paint layout bounds, if active.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1469,7 +1469,7 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
 | 
				
			||||||
		EsRectangle bounds = EsPainterBoundsClient(painter);
 | 
							EsRectangle bounds = EsPainterBoundsClient(painter);
 | 
				
			||||||
		EsPaintTarget target;
 | 
							EsPaintTarget target;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EsRectangle paintOutsets = currentStyle->paintOutsets;
 | 
							EsRectangle paintOutsets = style->paintOutsets;
 | 
				
			||||||
		int targetWidth = width + paintOutsets.l + paintOutsets.r;
 | 
							int targetWidth = width + paintOutsets.l + paintOutsets.r;
 | 
				
			||||||
		int targetHeight = height + paintOutsets.t + paintOutsets.b;
 | 
							int targetHeight = height + paintOutsets.t + paintOutsets.b;
 | 
				
			||||||
		bounds.l -= paintOutsets.l, bounds.r += paintOutsets.r;
 | 
							bounds.l -= paintOutsets.l, bounds.r += paintOutsets.r;
 | 
				
			||||||
| 
						 | 
					@ -1504,15 +1504,15 @@ void EsElement::InternalPaint(EsPainter *painter, int paintFlags) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!EsMessageSend(this, &m)) {
 | 
							if (!EsMessageSend(this, &m)) {
 | 
				
			||||||
			// TODO Optimisation: don't paint if overlapped by an opaque child.
 | 
								// TODO Optimisation: don't paint if overlapped by an opaque child.
 | 
				
			||||||
			style->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_BACKGROUND);
 | 
								interpolatedStyle->PaintLayers(painter, ES_RECT_2S(painter->width, painter->height), childType, THEME_LAYER_MODE_BACKGROUND);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Apply the clipping insets.
 | 
							// Apply the clipping insets.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EsRectangle oldClip = painter->clip;
 | 
							EsRectangle oldClip = painter->clip;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (currentStyle->metrics->clipEnabled && (~flags & ES_ELEMENT_NO_CLIP)) {
 | 
							if (style->metrics->clipEnabled && (~flags & ES_ELEMENT_NO_CLIP)) {
 | 
				
			||||||
			Rectangle16 insets = currentStyle->metrics->clipInsets;
 | 
								Rectangle16 insets = style->metrics->clipInsets;
 | 
				
			||||||
			EsRectangle content = ES_RECT_4(painter->offsetX + insets.l, painter->offsetX + width - insets.r, 
 | 
								EsRectangle content = ES_RECT_4(painter->offsetX + insets.l, painter->offsetX + width - insets.r, 
 | 
				
			||||||
					painter->offsetY + insets.t, painter->offsetY + height - insets.b);
 | 
										painter->offsetY + insets.t, painter->offsetY + height - insets.b);
 | 
				
			||||||
			painter->clip = EsRectangleIntersection(content, painter->clip);
 | 
								painter->clip = EsRectangleIntersection(content, painter->clip);
 | 
				
			||||||
| 
						 | 
					@ -1741,7 +1741,7 @@ bool EsElement::RefreshStyleState() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool observedBitsChanged = false;
 | 
						bool observedBitsChanged = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!currentStyle || currentStyle->IsStateChangeObserved(styleStateFlags, previousStyleState)) {
 | 
						if (!style || style->IsStateChangeObserved(styleStateFlags, previousStyleState)) {
 | 
				
			||||||
		observedBitsChanged = true;
 | 
							observedBitsChanged = true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1765,19 +1765,19 @@ void EsElement::RefreshStyle(UIStyleKey *_oldStyleKey, bool alreadyRefreshStyleS
 | 
				
			||||||
	currentStyleKey.stateFlags = styleStateFlags;
 | 
						currentStyleKey.stateFlags = styleStateFlags;
 | 
				
			||||||
	currentStyleKey.scale = theming.scale;
 | 
						currentStyleKey.scale = theming.scale;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!force && 0 == EsMemoryCompare(¤tStyleKey, &oldStyleKey, sizeof(UIStyleKey)) && currentStyle) {
 | 
						if (!force && 0 == EsMemoryCompare(¤tStyleKey, &oldStyleKey, sizeof(UIStyleKey)) && style) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (~state & UI_STATE_ENTERED) {
 | 
						if (~state & UI_STATE_ENTERED) {
 | 
				
			||||||
		if (currentStyle) currentStyle->CloseReference();
 | 
							if (style) style->CloseReference();
 | 
				
			||||||
		oldStyleKey = currentStyleKey;
 | 
							oldStyleKey = currentStyleKey;
 | 
				
			||||||
		oldStyleKey.stateFlags |= THEME_STATE_BEFORE_ENTER;
 | 
							oldStyleKey.stateFlags |= THEME_STATE_BEFORE_ENTER;
 | 
				
			||||||
		currentStyle = GetStyle(oldStyleKey, false);
 | 
							style = GetStyle(oldStyleKey, false);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	UIStyle *oldStyle = currentStyle;
 | 
						UIStyle *oldStyle = style;
 | 
				
			||||||
	currentStyle = GetStyle(currentStyleKey, false); // TODO Forcing new styles if force flag set.
 | 
						style = GetStyle(currentStyleKey, false); // TODO Forcing new styles if force flag set.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	state &= ~UI_STATE_USE_MEASUREMENT_CACHE;
 | 
						state &= ~UI_STATE_USE_MEASUREMENT_CACHE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1790,7 +1790,7 @@ void EsElement::RefreshStyle(UIStyleKey *_oldStyleKey, bool alreadyRefreshStyleS
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (oldStyle) {
 | 
						if (oldStyle) {
 | 
				
			||||||
		if (oldStyle->style == currentStyle->style && api.global->animationTimeMultiplier > 0.01f) {
 | 
							if (oldStyle->style == style->style && api.global->animationTimeMultiplier > 0.01f) {
 | 
				
			||||||
			ThemeAnimationBuild(&animation, oldStyle, oldStyleKey.stateFlags, currentStyleKey.stateFlags);
 | 
								ThemeAnimationBuild(&animation, oldStyle, oldStyleKey.stateFlags, currentStyleKey.stateFlags);
 | 
				
			||||||
			animate = !ThemeAnimationComplete(&animation);
 | 
								animate = !ThemeAnimationComplete(&animation);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
| 
						 | 
					@ -1828,10 +1828,10 @@ void EsElement::SetStyle(const EsStyle *part, bool refreshIfChanged) {
 | 
				
			||||||
EsRectangle LayoutCell(EsElement *element, int width, int height) {
 | 
					EsRectangle LayoutCell(EsElement *element, int width, int height) {
 | 
				
			||||||
	uint64_t layout = element->flags;
 | 
						uint64_t layout = element->flags;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int maximumWidth  = element->currentStyle->metrics->maximumWidth  ?: ES_PANEL_BAND_SIZE_DEFAULT;
 | 
						int maximumWidth  = element->style->metrics->maximumWidth  ?: ES_PANEL_BAND_SIZE_DEFAULT;
 | 
				
			||||||
	int minimumWidth  = element->currentStyle->metrics->minimumWidth  ?: ES_PANEL_BAND_SIZE_DEFAULT;
 | 
						int minimumWidth  = element->style->metrics->minimumWidth  ?: ES_PANEL_BAND_SIZE_DEFAULT;
 | 
				
			||||||
	int maximumHeight = element->currentStyle->metrics->maximumHeight ?: ES_PANEL_BAND_SIZE_DEFAULT;
 | 
						int maximumHeight = element->style->metrics->maximumHeight ?: ES_PANEL_BAND_SIZE_DEFAULT;
 | 
				
			||||||
	int minimumHeight = element->currentStyle->metrics->minimumHeight ?: ES_PANEL_BAND_SIZE_DEFAULT;
 | 
						int minimumHeight = element->style->metrics->minimumHeight ?: ES_PANEL_BAND_SIZE_DEFAULT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (layout & ES_CELL_H_EXPAND) maximumWidth = INT_MAX;
 | 
						if (layout & ES_CELL_H_EXPAND) maximumWidth = INT_MAX;
 | 
				
			||||||
	if (layout & ES_CELL_H_SHRINK) minimumWidth = 0;
 | 
						if (layout & ES_CELL_H_SHRINK) minimumWidth = 0;
 | 
				
			||||||
| 
						 | 
					@ -2011,8 +2011,8 @@ void LayoutTable(EsPanel *panel, EsMessage *message) {
 | 
				
			||||||
			int totalGapSize = (bandSpan - 1) * gapSize;
 | 
								int totalGapSize = (bandSpan - 1) * gapSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			int preferredSizePerBand = (size - totalGapSize) / bandSpan;
 | 
								int preferredSizePerBand = (size - totalGapSize) / bandSpan;
 | 
				
			||||||
			int maximumSizeValue = axis ? child->currentStyle->metrics->maximumHeight : child->currentStyle->metrics->maximumWidth;
 | 
								int maximumSizeValue = axis ? child->style->metrics->maximumHeight : child->style->metrics->maximumWidth;
 | 
				
			||||||
			int minimumSizeValue = axis ? child->currentStyle->metrics->minimumHeight : child->currentStyle->metrics->minimumWidth;
 | 
								int minimumSizeValue = axis ? child->style->metrics->minimumHeight : child->style->metrics->minimumWidth;
 | 
				
			||||||
			int maximumSizePerBand = maximumSizeValue ? (((int) maximumSizeValue - totalGapSize) / bandSpan) : ES_PANEL_BAND_SIZE_DEFAULT;
 | 
								int maximumSizePerBand = maximumSizeValue ? (((int) maximumSizeValue - totalGapSize) / bandSpan) : ES_PANEL_BAND_SIZE_DEFAULT;
 | 
				
			||||||
			int minimumSizePerBand = maximumSizeValue ? (((int) minimumSizeValue - totalGapSize) / bandSpan) : ES_PANEL_BAND_SIZE_DEFAULT;
 | 
								int minimumSizePerBand = maximumSizeValue ? (((int) minimumSizeValue - totalGapSize) / bandSpan) : ES_PANEL_BAND_SIZE_DEFAULT;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2385,36 +2385,36 @@ void LayoutStack(EsPanel *panel, EsMessage *message) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int EsElement::GetWidth(int height) {
 | 
					int EsElement::GetWidth(int height) {
 | 
				
			||||||
	if (currentStyle->preferredWidth) return currentStyle->preferredWidth;
 | 
						if (style->preferredWidth) return style->preferredWidth;
 | 
				
			||||||
	if (!height) height = currentStyle->preferredHeight;
 | 
						if (!height) height = style->preferredHeight;
 | 
				
			||||||
	else if (currentStyle->preferredHeight && currentStyle->preferredHeight > height && (~flags & (ES_CELL_V_SHRINK))) height = currentStyle->preferredHeight;
 | 
						else if (style->preferredHeight && style->preferredHeight > height && (~flags & (ES_CELL_V_SHRINK))) height = style->preferredHeight;
 | 
				
			||||||
	else if (currentStyle->preferredHeight && currentStyle->preferredHeight < height && (~flags & (ES_CELL_V_EXPAND))) height = currentStyle->preferredHeight;
 | 
						else if (style->preferredHeight && style->preferredHeight < height && (~flags & (ES_CELL_V_EXPAND))) height = style->preferredHeight;
 | 
				
			||||||
	else if (currentStyle->metrics->minimumHeight && currentStyle->metrics->minimumHeight > height) height = currentStyle->metrics->minimumHeight;
 | 
						else if (style->metrics->minimumHeight && style->metrics->minimumHeight > height) height = style->metrics->minimumHeight;
 | 
				
			||||||
	else if (currentStyle->metrics->maximumHeight && currentStyle->metrics->maximumHeight < height) height = currentStyle->metrics->maximumHeight;
 | 
						else if (style->metrics->maximumHeight && style->metrics->maximumHeight < height) height = style->metrics->maximumHeight;
 | 
				
			||||||
	if (height) height -= internalOffsetTop + internalOffsetBottom;
 | 
						if (height) height -= internalOffsetTop + internalOffsetBottom;
 | 
				
			||||||
	EsMessage m = { ES_MSG_GET_WIDTH };
 | 
						EsMessage m = { ES_MSG_GET_WIDTH };
 | 
				
			||||||
	m.measure.height = height;
 | 
						m.measure.height = height;
 | 
				
			||||||
	EsMessageSend(this, &m);
 | 
						EsMessageSend(this, &m);
 | 
				
			||||||
	int width = m.measure.width + internalOffsetLeft + internalOffsetRight;
 | 
						int width = m.measure.width + internalOffsetLeft + internalOffsetRight;
 | 
				
			||||||
	if (currentStyle->metrics->minimumWidth && currentStyle->metrics->minimumWidth > width) width = currentStyle->metrics->minimumWidth;
 | 
						if (style->metrics->minimumWidth && style->metrics->minimumWidth > width) width = style->metrics->minimumWidth;
 | 
				
			||||||
	if (currentStyle->metrics->maximumWidth && currentStyle->metrics->maximumWidth < width) width = currentStyle->metrics->maximumWidth;
 | 
						if (style->metrics->maximumWidth && style->metrics->maximumWidth < width) width = style->metrics->maximumWidth;
 | 
				
			||||||
	return width;
 | 
						return width;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int EsElement::GetHeight(int width) {
 | 
					int EsElement::GetHeight(int width) {
 | 
				
			||||||
	if (currentStyle->preferredHeight) return currentStyle->preferredHeight;
 | 
						if (style->preferredHeight) return style->preferredHeight;
 | 
				
			||||||
	if (!width) width = currentStyle->preferredWidth;
 | 
						if (!width) width = style->preferredWidth;
 | 
				
			||||||
	else if (currentStyle->preferredWidth && currentStyle->preferredWidth > width && (~flags & (ES_CELL_H_SHRINK))) width = currentStyle->preferredWidth;
 | 
						else if (style->preferredWidth && style->preferredWidth > width && (~flags & (ES_CELL_H_SHRINK))) width = style->preferredWidth;
 | 
				
			||||||
	else if (currentStyle->preferredWidth && currentStyle->preferredWidth < width && (~flags & (ES_CELL_H_EXPAND))) width = currentStyle->preferredWidth;
 | 
						else if (style->preferredWidth && style->preferredWidth < width && (~flags & (ES_CELL_H_EXPAND))) width = style->preferredWidth;
 | 
				
			||||||
	else if (currentStyle->metrics->minimumWidth && currentStyle->metrics->minimumWidth > width) width = currentStyle->metrics->minimumWidth;
 | 
						else if (style->metrics->minimumWidth && style->metrics->minimumWidth > width) width = style->metrics->minimumWidth;
 | 
				
			||||||
	else if (currentStyle->metrics->maximumWidth && currentStyle->metrics->maximumWidth < width) width = currentStyle->metrics->maximumWidth;
 | 
						else if (style->metrics->maximumWidth && style->metrics->maximumWidth < width) width = style->metrics->maximumWidth;
 | 
				
			||||||
	if (width) width -= internalOffsetLeft + internalOffsetRight;
 | 
						if (width) width -= internalOffsetLeft + internalOffsetRight;
 | 
				
			||||||
	EsMessage m = { ES_MSG_GET_HEIGHT };
 | 
						EsMessage m = { ES_MSG_GET_HEIGHT };
 | 
				
			||||||
	m.measure.width = width;
 | 
						m.measure.width = width;
 | 
				
			||||||
	EsMessageSend(this, &m);
 | 
						EsMessageSend(this, &m);
 | 
				
			||||||
	int height = m.measure.height + internalOffsetTop + internalOffsetBottom;
 | 
						int height = m.measure.height + internalOffsetTop + internalOffsetBottom;
 | 
				
			||||||
	if (currentStyle->metrics->minimumHeight && currentStyle->metrics->minimumHeight > height) height = currentStyle->metrics->minimumHeight;
 | 
						if (style->metrics->minimumHeight && style->metrics->minimumHeight > height) height = style->metrics->minimumHeight;
 | 
				
			||||||
	if (currentStyle->metrics->maximumHeight && currentStyle->metrics->maximumHeight < height) height = currentStyle->metrics->maximumHeight;
 | 
						if (style->metrics->maximumHeight && style->metrics->maximumHeight < height) height = style->metrics->maximumHeight;
 | 
				
			||||||
	return height;
 | 
						return height;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2473,7 +2473,7 @@ void EsElement::InternalMove(int _width, int _height, int _offsetX, int _offsetY
 | 
				
			||||||
			// Clear the old position.
 | 
								// Clear the old position.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (parent) {
 | 
								if (parent) {
 | 
				
			||||||
				EsRectangle paintOutsets = currentStyle->paintOutsets;
 | 
									EsRectangle paintOutsets = style->paintOutsets;
 | 
				
			||||||
				EsRectangle rectangle = ES_RECT_4(oldOffsetX - paintOutsets.l, oldOffsetX + width + paintOutsets.r,
 | 
									EsRectangle rectangle = ES_RECT_4(oldOffsetX - paintOutsets.l, oldOffsetX + width + paintOutsets.r,
 | 
				
			||||||
						oldOffsetY - paintOutsets.t, oldOffsetY + height + paintOutsets.b);
 | 
											oldOffsetY - paintOutsets.t, oldOffsetY + height + paintOutsets.b);
 | 
				
			||||||
				parent->Repaint(false, rectangle);
 | 
									parent->Repaint(false, rectangle);
 | 
				
			||||||
| 
						 | 
					@ -2517,7 +2517,7 @@ void EsElement::InternalMove(int _width, int _height, int _offsetX, int _offsetY
 | 
				
			||||||
EsRectangle EsElementGetPreferredSize(EsElement *element) {
 | 
					EsRectangle EsElementGetPreferredSize(EsElement *element) {
 | 
				
			||||||
	EsMessageMutexCheck();
 | 
						EsMessageMutexCheck();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return ES_RECT_4(0, element->currentStyle->preferredWidth, 0, element->currentStyle->preferredHeight);
 | 
						return ES_RECT_4(0, element->style->preferredWidth, 0, element->style->preferredHeight);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EsElementRelayout(EsElement *element) {
 | 
					void EsElementRelayout(EsElement *element) {
 | 
				
			||||||
| 
						 | 
					@ -2539,11 +2539,11 @@ void EsElementUpdateContentSize(EsElement *element, uint32_t flags) {
 | 
				
			||||||
		element->state &= ~UI_STATE_USE_MEASUREMENT_CACHE;
 | 
							element->state &= ~UI_STATE_USE_MEASUREMENT_CACHE;
 | 
				
			||||||
		EsElementRelayout(element);
 | 
							EsElementRelayout(element);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (element->currentStyle->preferredWidth || ((element->flags & ES_CELL_H_FILL) == ES_CELL_H_FILL)) {
 | 
							if (element->style->preferredWidth || ((element->flags & ES_CELL_H_FILL) == ES_CELL_H_FILL)) {
 | 
				
			||||||
			flags &= ~ES_ELEMENT_UPDATE_CONTENT_WIDTH;
 | 
								flags &= ~ES_ELEMENT_UPDATE_CONTENT_WIDTH;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (element->currentStyle->preferredHeight || ((element->flags & ES_CELL_V_FILL) == ES_CELL_V_FILL)) {
 | 
							if (element->style->preferredHeight || ((element->flags & ES_CELL_V_FILL) == ES_CELL_V_FILL)) {
 | 
				
			||||||
			flags &= ~ES_ELEMENT_UPDATE_CONTENT_HEIGHT;
 | 
								flags &= ~ES_ELEMENT_UPDATE_CONTENT_HEIGHT;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2573,8 +2573,8 @@ void ScrollbarLayout(EsScrollbar *scrollbar) {
 | 
				
			||||||
		if (scrollbar->horizontal) {
 | 
							if (scrollbar->horizontal) {
 | 
				
			||||||
			scrollbar->thumbSize = scrollbar->viewportSize * (bounds.r - scrollbar->height * 2) / scrollbar->contentSize;
 | 
								scrollbar->thumbSize = scrollbar->viewportSize * (bounds.r - scrollbar->height * 2) / scrollbar->contentSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (scrollbar->thumbSize < scrollbar->thumb->currentStyle->preferredWidth) {
 | 
								if (scrollbar->thumbSize < scrollbar->thumb->style->preferredWidth) {
 | 
				
			||||||
				scrollbar->thumbSize = scrollbar->thumb->currentStyle->preferredWidth;
 | 
									scrollbar->thumbSize = scrollbar->thumb->style->preferredWidth;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (scrollbar->thumbSize > Width(bounds) - scrollbar->height * 2) {
 | 
								if (scrollbar->thumbSize > Width(bounds) - scrollbar->height * 2) {
 | 
				
			||||||
| 
						 | 
					@ -2584,16 +2584,16 @@ void ScrollbarLayout(EsScrollbar *scrollbar) {
 | 
				
			||||||
			scrollbar->thumbPosition = LinearMap(0, scrollbar->contentSize - scrollbar->viewportSize, 
 | 
								scrollbar->thumbPosition = LinearMap(0, scrollbar->contentSize - scrollbar->viewportSize, 
 | 
				
			||||||
					scrollbar->height, bounds.r - scrollbar->thumbSize - scrollbar->height, scrollbar->smoothScrollTarget);
 | 
										scrollbar->height, bounds.r - scrollbar->thumbSize - scrollbar->height, scrollbar->smoothScrollTarget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			EsElementMove(scrollbar->up, 0, 0, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2, scrollbar->thumb->currentStyle->preferredHeight);
 | 
								EsElementMove(scrollbar->up, 0, 0, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2, scrollbar->thumb->style->preferredHeight);
 | 
				
			||||||
			EsElementMove(scrollbar->thumb, (int) scrollbar->thumbPosition, 0, scrollbar->thumbSize, scrollbar->thumb->currentStyle->preferredHeight);
 | 
								EsElementMove(scrollbar->thumb, (int) scrollbar->thumbPosition, 0, scrollbar->thumbSize, scrollbar->thumb->style->preferredHeight);
 | 
				
			||||||
			EsElementMove(scrollbar->down, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2, 0,
 | 
								EsElementMove(scrollbar->down, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2, 0,
 | 
				
			||||||
					bounds.r - scrollbar->thumbSize / 2 - (int) scrollbar->thumbPosition, 
 | 
										bounds.r - scrollbar->thumbSize / 2 - (int) scrollbar->thumbPosition, 
 | 
				
			||||||
					scrollbar->thumb->currentStyle->preferredHeight);
 | 
										scrollbar->thumb->style->preferredHeight);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			scrollbar->thumbSize = scrollbar->viewportSize * (bounds.b - scrollbar->width * 2) / scrollbar->contentSize;
 | 
								scrollbar->thumbSize = scrollbar->viewportSize * (bounds.b - scrollbar->width * 2) / scrollbar->contentSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (scrollbar->thumbSize < scrollbar->thumb->currentStyle->preferredHeight) {
 | 
								if (scrollbar->thumbSize < scrollbar->thumb->style->preferredHeight) {
 | 
				
			||||||
				scrollbar->thumbSize = scrollbar->thumb->currentStyle->preferredHeight;
 | 
									scrollbar->thumbSize = scrollbar->thumb->style->preferredHeight;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (scrollbar->thumbSize > Height(bounds) - scrollbar->width * 2) {
 | 
								if (scrollbar->thumbSize > Height(bounds) - scrollbar->width * 2) {
 | 
				
			||||||
| 
						 | 
					@ -2603,10 +2603,10 @@ void ScrollbarLayout(EsScrollbar *scrollbar) {
 | 
				
			||||||
			scrollbar->thumbPosition = LinearMap(0, scrollbar->contentSize - scrollbar->viewportSize, 
 | 
								scrollbar->thumbPosition = LinearMap(0, scrollbar->contentSize - scrollbar->viewportSize, 
 | 
				
			||||||
					scrollbar->width, bounds.b - scrollbar->thumbSize - scrollbar->width, scrollbar->smoothScrollTarget);
 | 
										scrollbar->width, bounds.b - scrollbar->thumbSize - scrollbar->width, scrollbar->smoothScrollTarget);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			EsElementMove(scrollbar->up, 0, 0, scrollbar->thumb->currentStyle->preferredWidth, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2);
 | 
								EsElementMove(scrollbar->up, 0, 0, scrollbar->thumb->style->preferredWidth, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2);
 | 
				
			||||||
			EsElementMove(scrollbar->thumb, 0, (int) scrollbar->thumbPosition, scrollbar->thumb->currentStyle->preferredWidth, scrollbar->thumbSize);
 | 
								EsElementMove(scrollbar->thumb, 0, (int) scrollbar->thumbPosition, scrollbar->thumb->style->preferredWidth, scrollbar->thumbSize);
 | 
				
			||||||
			EsElementMove(scrollbar->down, 0, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2,
 | 
								EsElementMove(scrollbar->down, 0, (int) scrollbar->thumbPosition + scrollbar->thumbSize / 2,
 | 
				
			||||||
					scrollbar->thumb->currentStyle->preferredWidth, 
 | 
										scrollbar->thumb->style->preferredWidth, 
 | 
				
			||||||
					bounds.b - scrollbar->thumbSize / 2 - (int) scrollbar->thumbPosition);
 | 
										bounds.b - scrollbar->thumbSize / 2 - (int) scrollbar->thumbPosition);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -2873,7 +2873,7 @@ void ScrollPane::ReceivedMessage(EsMessage *message) {
 | 
				
			||||||
			EsMessage m = {};
 | 
								EsMessage m = {};
 | 
				
			||||||
			m.type = ES_MSG_GET_WIDTH;
 | 
								m.type = ES_MSG_GET_WIDTH;
 | 
				
			||||||
			EsMessageSend(parent, &m);
 | 
								EsMessageSend(parent, &m);
 | 
				
			||||||
			parent->internalOffsetBottom = (m.measure.width + fixedViewport[0] > message->measure.width) ? bar[0]->currentStyle->preferredHeight : 0;
 | 
								parent->internalOffsetBottom = (m.measure.width + fixedViewport[0] > message->measure.width) ? bar[0]->style->preferredHeight : 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (message->type == ES_MSG_GET_WIDTH) {
 | 
						} else if (message->type == ES_MSG_GET_WIDTH) {
 | 
				
			||||||
		if (message->measure.width && (mode[1] == ES_SCROLL_MODE_AUTO) && (mode[0] != ES_SCROLL_MODE_AUTO)) {
 | 
							if (message->measure.width && (mode[1] == ES_SCROLL_MODE_AUTO) && (mode[0] != ES_SCROLL_MODE_AUTO)) {
 | 
				
			||||||
| 
						 | 
					@ -2881,7 +2881,7 @@ void ScrollPane::ReceivedMessage(EsMessage *message) {
 | 
				
			||||||
			EsMessage m = {};
 | 
								EsMessage m = {};
 | 
				
			||||||
			m.type = ES_MSG_GET_HEIGHT;
 | 
								m.type = ES_MSG_GET_HEIGHT;
 | 
				
			||||||
			EsMessageSend(parent, &m);
 | 
								EsMessageSend(parent, &m);
 | 
				
			||||||
			parent->internalOffsetRight = (m.measure.height + fixedViewport[1] > message->measure.height) ? bar[1]->currentStyle->preferredWidth : 0;
 | 
								parent->internalOffsetRight = (m.measure.height + fixedViewport[1] > message->measure.height) ? bar[1]->style->preferredWidth : 0;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (message->type == ES_MSG_SCROLL_WHEEL) {
 | 
						} else if (message->type == ES_MSG_SCROLL_WHEEL) {
 | 
				
			||||||
		SetPosition(0, position[0] + 60 * message->scrollWheel.dx / ES_SCROLL_WHEEL_NOTCH, true);
 | 
							SetPosition(0, position[0] + 60 * message->scrollWheel.dx / ES_SCROLL_WHEEL_NOTCH, true);
 | 
				
			||||||
| 
						 | 
					@ -2932,7 +2932,7 @@ bool ScrollPane::RefreshLimit(int axis, int64_t *contentSize) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (mode[axis] == ES_SCROLL_MODE_AUTO && limit[axis] > 0 && !(*internalOffset)) {
 | 
							if (mode[axis] == ES_SCROLL_MODE_AUTO && limit[axis] > 0 && !(*internalOffset)) {
 | 
				
			||||||
			*internalOffset = axis ? bar[axis]->currentStyle->preferredWidth : bar[axis]->currentStyle->preferredHeight;
 | 
								*internalOffset = axis ? bar[axis]->style->preferredWidth : bar[axis]->style->preferredHeight;
 | 
				
			||||||
			return true;
 | 
								return true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -2945,8 +2945,8 @@ void ScrollPane::Refresh() {
 | 
				
			||||||
		InspectorNotifyElementEvent(parent, "scroll", "Refreshing scroll pane...\n");
 | 
							InspectorNotifyElementEvent(parent, "scroll", "Refreshing scroll pane...\n");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	parent->internalOffsetRight = mode[1] == ES_SCROLL_MODE_FIXED ? bar[1]->currentStyle->preferredWidth : 0;
 | 
						parent->internalOffsetRight = mode[1] == ES_SCROLL_MODE_FIXED ? bar[1]->style->preferredWidth : 0;
 | 
				
			||||||
	parent->internalOffsetBottom = mode[0] == ES_SCROLL_MODE_FIXED ? bar[0]->currentStyle->preferredHeight : 0;
 | 
						parent->internalOffsetBottom = mode[0] == ES_SCROLL_MODE_FIXED ? bar[0]->style->preferredHeight : 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int64_t contentWidth = 0, contentHeight = 0;
 | 
						int64_t contentWidth = 0, contentHeight = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2968,16 +2968,16 @@ void ScrollPane::Refresh() {
 | 
				
			||||||
		SetPosition(1, position[1], true);
 | 
							SetPosition(1, position[1], true);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EsRectangle border = parent->currentStyle->borders;
 | 
						EsRectangle border = parent->style->borders;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bar[0]) {
 | 
						if (bar[0]) {
 | 
				
			||||||
		bar[0]->InternalMove(parent->width - parent->internalOffsetRight - border.r - border.l, bar[0]->currentStyle->preferredHeight, 
 | 
							bar[0]->InternalMove(parent->width - parent->internalOffsetRight - border.r - border.l, bar[0]->style->preferredHeight, 
 | 
				
			||||||
				border.l, parent->height - parent->internalOffsetBottom - border.b);
 | 
									border.l, parent->height - parent->internalOffsetBottom - border.b);
 | 
				
			||||||
		enabled[0] = ~bar[0]->flags & ES_ELEMENT_DISABLED;
 | 
							enabled[0] = ~bar[0]->flags & ES_ELEMENT_DISABLED;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (bar[1]) {
 | 
						if (bar[1]) {
 | 
				
			||||||
		bar[1]->InternalMove(bar[1]->currentStyle->preferredWidth, parent->height - parent->internalOffsetBottom - border.b - border.t, 
 | 
							bar[1]->InternalMove(bar[1]->style->preferredWidth, parent->height - parent->internalOffsetBottom - border.b - border.t, 
 | 
				
			||||||
				parent->width - parent->internalOffsetRight - border.r, border.t);
 | 
									parent->width - parent->internalOffsetRight - border.r, border.t);
 | 
				
			||||||
		enabled[1] = ~bar[1]->flags & ES_ELEMENT_DISABLED;
 | 
							enabled[1] = ~bar[1]->flags & ES_ELEMENT_DISABLED;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -3345,11 +3345,11 @@ int ProcessPanelMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
					EsElement *child = panel->children[position];
 | 
										EsElement *child = panel->children[position];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (panel->flags & ES_PANEL_HORIZONTAL) {
 | 
										if (panel->flags & ES_PANEL_HORIZONTAL) {
 | 
				
			||||||
						if (child->offsetX + child->width + child->currentStyle->paintOutsets.r < message->beforeZOrder.clip.l) {
 | 
											if (child->offsetX + child->width + child->style->paintOutsets.r < message->beforeZOrder.clip.l) {
 | 
				
			||||||
							break;
 | 
												break;
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					} else {
 | 
										} else {
 | 
				
			||||||
						if (child->offsetY + child->height + child->currentStyle->paintOutsets.b < message->beforeZOrder.clip.t) {
 | 
											if (child->offsetY + child->height + child->style->paintOutsets.b < message->beforeZOrder.clip.t) {
 | 
				
			||||||
							break;
 | 
												break;
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
| 
						 | 
					@ -3366,11 +3366,11 @@ int ProcessPanelMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
				EsElement *child = panel->children[position];
 | 
									EsElement *child = panel->children[position];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (panel->flags & ES_PANEL_HORIZONTAL) {
 | 
									if (panel->flags & ES_PANEL_HORIZONTAL) {
 | 
				
			||||||
					if (child->offsetX - child->currentStyle->paintOutsets.l > message->beforeZOrder.clip.r) {
 | 
										if (child->offsetX - child->style->paintOutsets.l > message->beforeZOrder.clip.r) {
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					if (child->offsetY - child->currentStyle->paintOutsets.t > message->beforeZOrder.clip.b) {
 | 
										if (child->offsetY - child->style->paintOutsets.t > message->beforeZOrder.clip.b) {
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					@ -3415,9 +3415,9 @@ int ProcessSpacerMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
	EsSpacer *spacer = (EsSpacer *) element;
 | 
						EsSpacer *spacer = (EsSpacer *) element;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (message->type == ES_MSG_GET_WIDTH) {
 | 
						if (message->type == ES_MSG_GET_WIDTH) {
 | 
				
			||||||
		message->measure.width = spacer->width * spacer->currentStyle->scale;
 | 
							message->measure.width = spacer->width * spacer->style->scale;
 | 
				
			||||||
	} else if (message->type == ES_MSG_GET_HEIGHT) {
 | 
						} else if (message->type == ES_MSG_GET_HEIGHT) {
 | 
				
			||||||
		message->measure.height = spacer->height * spacer->currentStyle->scale;
 | 
							message->measure.height = spacer->height * spacer->style->scale;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					@ -3753,7 +3753,7 @@ int ProcessCanvasPaneMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
		if (!canvas) return 0;
 | 
							if (!canvas) return 0;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		EsRectangle bounds = element->GetBounds();
 | 
							EsRectangle bounds = element->GetBounds();
 | 
				
			||||||
		EsRectangle insets = element->currentStyle->insets;
 | 
							EsRectangle insets = element->style->insets;
 | 
				
			||||||
		bounds.l += insets.l, bounds.r -= insets.r;
 | 
							bounds.l += insets.l, bounds.r -= insets.r;
 | 
				
			||||||
		bounds.t += insets.t, bounds.b -= insets.b;
 | 
							bounds.t += insets.t, bounds.b -= insets.b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3934,16 +3934,16 @@ int ProcessButtonMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
	} else if (message->type == ES_MSG_GET_WIDTH) {
 | 
						} else if (message->type == ES_MSG_GET_WIDTH) {
 | 
				
			||||||
		if (!button->measurementCache.Get(message, &button->state)) {
 | 
							if (!button->measurementCache.Get(message, &button->state)) {
 | 
				
			||||||
			EsTextStyle textStyle;
 | 
								EsTextStyle textStyle;
 | 
				
			||||||
			button->currentStyle->GetTextStyle(&textStyle);
 | 
								button->style->GetTextStyle(&textStyle);
 | 
				
			||||||
			int stringWidth = TextGetStringWidth(button, &textStyle, button->label, button->labelBytes);
 | 
								int stringWidth = TextGetStringWidth(button, &textStyle, button->label, button->labelBytes);
 | 
				
			||||||
			int iconWidth = button->iconID ? button->currentStyle->metrics->iconSize : 0;
 | 
								int iconWidth = button->iconID ? button->style->metrics->iconSize : 0;
 | 
				
			||||||
			int contentWidth = stringWidth + iconWidth + ((stringWidth && iconWidth) ? button->currentStyle->gapMinor : 0)
 | 
								int contentWidth = stringWidth + iconWidth + ((stringWidth && iconWidth) ? button->style->gapMinor : 0)
 | 
				
			||||||
				+ button->currentStyle->insets.l + button->currentStyle->insets.r;
 | 
									+ button->style->insets.l + button->style->insets.r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (button->flags & ES_BUTTON_DROPDOWN) {
 | 
								if (button->flags & ES_BUTTON_DROPDOWN) {
 | 
				
			||||||
				int64_t width = 0;
 | 
									int64_t width = 0;
 | 
				
			||||||
				GetPreferredSizeFromStylePart(ES_STYLE_MARKER_DOWN_ARROW, &width, nullptr);
 | 
									GetPreferredSizeFromStylePart(ES_STYLE_MARKER_DOWN_ARROW, &width, nullptr);
 | 
				
			||||||
				contentWidth += width + button->currentStyle->gapMinor;
 | 
									contentWidth += width + button->style->gapMinor;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			int minimumReportedWidth = GetConstantNumber("pushButtonMinimumReportedWidth");
 | 
								int minimumReportedWidth = GetConstantNumber("pushButtonMinimumReportedWidth");
 | 
				
			||||||
| 
						 | 
					@ -4232,12 +4232,12 @@ int ProcessMenuItemMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
		MenuItemGetKeyboardShortcutString(button->command, &buffer);
 | 
							MenuItemGetKeyboardShortcutString(button->command, &buffer);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EsTextStyle textStyle;
 | 
							EsTextStyle textStyle;
 | 
				
			||||||
		button->currentStyle->GetTextStyle(&textStyle);
 | 
							button->style->GetTextStyle(&textStyle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int stringWidth = TextGetStringWidth(button, &textStyle, button->label, button->labelBytes);
 | 
							int stringWidth = TextGetStringWidth(button, &textStyle, button->label, button->labelBytes);
 | 
				
			||||||
		int keyboardShortcutWidth = TextGetStringWidth(button, &textStyle, (const char *) _buffer, buffer.position);
 | 
							int keyboardShortcutWidth = TextGetStringWidth(button, &textStyle, (const char *) _buffer, buffer.position);
 | 
				
			||||||
		int contentWidth = stringWidth + button->currentStyle->insets.l + button->currentStyle->insets.r 
 | 
							int contentWidth = stringWidth + button->style->insets.l + button->style->insets.r 
 | 
				
			||||||
			+ (keyboardShortcutWidth ? (keyboardShortcutWidth + button->currentStyle->gapMinor) : 0);
 | 
								+ (keyboardShortcutWidth ? (keyboardShortcutWidth + button->style->gapMinor) : 0);
 | 
				
			||||||
		message->measure.width = MaximumInteger(GetConstantNumber("menuItemMinimumReportedWidth"), contentWidth);
 | 
							message->measure.width = MaximumInteger(GetConstantNumber("menuItemMinimumReportedWidth"), contentWidth);
 | 
				
			||||||
	} else if (message->type == ES_MSG_DESTROY) {
 | 
						} else if (message->type == ES_MSG_DESTROY) {
 | 
				
			||||||
		EsHeapFree(button->label);
 | 
							EsHeapFree(button->label);
 | 
				
			||||||
| 
						 | 
					@ -4958,9 +4958,9 @@ struct SplitBar : EsElement {
 | 
				
			||||||
		EsSplitter *splitter = (EsSplitter *) parent;
 | 
							EsSplitter *splitter = (EsSplitter *) parent;
 | 
				
			||||||
		EsElement *panelBefore = nullptr, *panelAfter = nullptr;
 | 
							EsElement *panelBefore = nullptr, *panelAfter = nullptr;
 | 
				
			||||||
		int barBefore = 0, barAfter;
 | 
							int barBefore = 0, barAfter;
 | 
				
			||||||
		if (splitter->horizontal) barAfter = EsRectangleAddBorder(splitter->GetBounds(), splitter->currentStyle->borders).r  - currentStyle->preferredWidth;
 | 
							if (splitter->horizontal) barAfter = EsRectangleAddBorder(splitter->GetBounds(), splitter->style->borders).r - style->preferredWidth;
 | 
				
			||||||
		else                      barAfter = EsRectangleAddBorder(splitter->GetBounds(), splitter->currentStyle->borders).b - currentStyle->preferredHeight;
 | 
							else                      barAfter = EsRectangleAddBorder(splitter->GetBounds(), splitter->style->borders).b - style->preferredHeight;
 | 
				
			||||||
		int preferredSize = splitter->horizontal ? currentStyle->preferredWidth : currentStyle->preferredHeight;
 | 
							int preferredSize = splitter->horizontal ? style->preferredWidth : style->preferredHeight;
 | 
				
			||||||
		splitter->resizeStartSizes.Free();
 | 
							splitter->resizeStartSizes.Free();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (uintptr_t i = 0; i < splitter->GetChildCount(); i++) {
 | 
							for (uintptr_t i = 0; i < splitter->GetChildCount(); i++) {
 | 
				
			||||||
| 
						 | 
					@ -4983,25 +4983,25 @@ struct SplitBar : EsElement {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EsAssert(panelBefore && panelAfter); // Could not find split bar in parent.
 | 
							EsAssert(panelBefore && panelAfter); // Could not find split bar in parent.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		barBefore -= splitter->horizontal ? currentStyle->borders.l  : currentStyle->borders.t;
 | 
							barBefore -= splitter->horizontal ? style->borders.l : style->borders.t;
 | 
				
			||||||
		barAfter  += splitter->horizontal ? currentStyle->borders.r : currentStyle->borders.b;
 | 
							barAfter  += splitter->horizontal ? style->borders.r : style->borders.b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int minimumPosition, maximumPosition, minimumPosition1, maximumPosition1, minimumPosition2, maximumPosition2;
 | 
							int minimumPosition, maximumPosition, minimumPosition1, maximumPosition1, minimumPosition2, maximumPosition2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (splitter->horizontal) {
 | 
							if (splitter->horizontal) {
 | 
				
			||||||
			minimumPosition1 = barBefore + panelBefore->currentStyle->metrics->minimumWidth;
 | 
								minimumPosition1 = barBefore + panelBefore->style->metrics->minimumWidth;
 | 
				
			||||||
			maximumPosition1 = barAfter  - panelAfter ->currentStyle->metrics->minimumWidth;
 | 
								maximumPosition1 = barAfter  - panelAfter ->style->metrics->minimumWidth;
 | 
				
			||||||
			minimumPosition2 = barAfter  - panelAfter ->currentStyle->metrics->maximumWidth;
 | 
								minimumPosition2 = barAfter  - panelAfter ->style->metrics->maximumWidth;
 | 
				
			||||||
			maximumPosition2 = barBefore + panelBefore->currentStyle->metrics->maximumWidth;
 | 
								maximumPosition2 = barBefore + panelBefore->style->metrics->maximumWidth;
 | 
				
			||||||
			if (!panelAfter ->currentStyle->metrics->maximumWidth) minimumPosition2 = INT_MIN;
 | 
								if (!panelAfter ->style->metrics->maximumWidth) minimumPosition2 = INT_MIN;
 | 
				
			||||||
			if (!panelBefore->currentStyle->metrics->maximumWidth) maximumPosition2 = INT_MAX;
 | 
								if (!panelBefore->style->metrics->maximumWidth) maximumPosition2 = INT_MAX;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			minimumPosition1 = barBefore + panelBefore->currentStyle->metrics->minimumHeight;
 | 
								minimumPosition1 = barBefore + panelBefore->style->metrics->minimumHeight;
 | 
				
			||||||
			maximumPosition1 = barAfter  - panelAfter ->currentStyle->metrics->minimumHeight;
 | 
								maximumPosition1 = barAfter  - panelAfter ->style->metrics->minimumHeight;
 | 
				
			||||||
			minimumPosition2 = barAfter  - panelAfter ->currentStyle->metrics->maximumHeight;
 | 
								minimumPosition2 = barAfter  - panelAfter ->style->metrics->maximumHeight;
 | 
				
			||||||
			maximumPosition2 = barBefore + panelBefore->currentStyle->metrics->maximumHeight;
 | 
								maximumPosition2 = barBefore + panelBefore->style->metrics->maximumHeight;
 | 
				
			||||||
			if (!panelAfter ->currentStyle->metrics->maximumHeight) minimumPosition2 = INT_MIN;
 | 
								if (!panelAfter ->style->metrics->maximumHeight) minimumPosition2 = INT_MIN;
 | 
				
			||||||
			if (!panelBefore->currentStyle->metrics->maximumHeight) maximumPosition2 = INT_MAX;
 | 
								if (!panelBefore->style->metrics->maximumHeight) maximumPosition2 = INT_MAX;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		minimumPosition = minimumPosition1 > minimumPosition2 ? minimumPosition1 : minimumPosition2;
 | 
							minimumPosition = minimumPosition1 > minimumPosition2 ? minimumPosition1 : minimumPosition2;
 | 
				
			||||||
| 
						 | 
					@ -5078,7 +5078,7 @@ int ProcessSplitterMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (message->type == ES_MSG_LAYOUT && splitter->GetChildCount()) {
 | 
						if (message->type == ES_MSG_LAYOUT && splitter->GetChildCount()) {
 | 
				
			||||||
		EsRectangle client = splitter->GetBounds();
 | 
							EsRectangle client = splitter->GetBounds();
 | 
				
			||||||
		EsRectangle bounds = EsRectangleAddBorder(client, splitter->currentStyle->insets);
 | 
							EsRectangle bounds = EsRectangleAddBorder(client, splitter->style->insets);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		size_t childCount = splitter->GetChildCount();
 | 
							size_t childCount = splitter->GetChildCount();
 | 
				
			||||||
		EsAssert(childCount & 1); // Expected split bars between each EsSplitter child.
 | 
							EsAssert(childCount & 1); // Expected split bars between each EsSplitter child.
 | 
				
			||||||
| 
						 | 
					@ -5103,7 +5103,7 @@ int ProcessSplitterMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
		if (newSize != splitter->previousSize && childCount > 1) {
 | 
							if (newSize != splitter->previousSize && childCount > 1) {
 | 
				
			||||||
			// Step 1: Make a list of current sizes.
 | 
								// Step 1: Make a list of current sizes.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			int64_t barSize = splitter->horizontal ? splitter->GetChild(1)->currentStyle->preferredWidth : splitter->GetChild(1)->currentStyle->preferredHeight;
 | 
								int64_t barSize = splitter->horizontal ? splitter->GetChild(1)->style->preferredWidth : splitter->GetChild(1)->style->preferredHeight;
 | 
				
			||||||
			int64_t previousPosition = 0;
 | 
								int64_t previousPosition = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (!splitter->resizeStartSizes.Length()) {
 | 
								if (!splitter->resizeStartSizes.Length()) {
 | 
				
			||||||
| 
						 | 
					@ -5178,12 +5178,12 @@ int ProcessSplitterMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
			for (uintptr_t i = 1; i < childCount; i += 2) {
 | 
								for (uintptr_t i = 1; i < childCount; i += 2) {
 | 
				
			||||||
				SplitBar *bar = (SplitBar *) splitter->GetChild(i);
 | 
									SplitBar *bar = (SplitBar *) splitter->GetChild(i);
 | 
				
			||||||
				bar->position = previousPosition + currentSizes[i >> 1];
 | 
									bar->position = previousPosition + currentSizes[i >> 1];
 | 
				
			||||||
				previousPosition = bar->position + barSize - (splitter->horizontal ? bar->currentStyle->borders.l : bar->currentStyle->borders.t);
 | 
									previousPosition = bar->position + barSize - (splitter->horizontal ? bar->style->borders.l : bar->style->borders.t);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (bar->position == 0) {
 | 
									if (bar->position == 0) {
 | 
				
			||||||
					bar->position -= splitter->horizontal ? bar->currentStyle->borders.l  : bar->currentStyle->borders.t;
 | 
										bar->position -= splitter->horizontal ? bar->style->borders.l  : bar->style->borders.t;
 | 
				
			||||||
				} else if (bar->position == newSize - barSize) {
 | 
									} else if (bar->position == newSize - barSize) {
 | 
				
			||||||
					bar->position += splitter->horizontal ? bar->currentStyle->borders.r : bar->currentStyle->borders.b;
 | 
										bar->position += splitter->horizontal ? bar->style->borders.r : bar->style->borders.b;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -5201,11 +5201,11 @@ int ProcessSplitterMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (i & 1) {
 | 
								if (i & 1) {
 | 
				
			||||||
				if (splitter->horizontal) {
 | 
									if (splitter->horizontal) {
 | 
				
			||||||
					int size = child->currentStyle->preferredWidth;
 | 
										int size = child->style->preferredWidth;
 | 
				
			||||||
					EsElementMove(child, position, client.t, size, client.b - client.t);
 | 
										EsElementMove(child, position, client.t, size, client.b - client.t);
 | 
				
			||||||
					position += size;
 | 
										position += size;
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					int size = child->currentStyle->preferredHeight;
 | 
										int size = child->style->preferredHeight;
 | 
				
			||||||
					EsElementMove(child, client.l, position, client.r - client.l, size);
 | 
										EsElementMove(child, client.l, position, client.r - client.l, size);
 | 
				
			||||||
					position += size;
 | 
										position += size;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					@ -5458,7 +5458,7 @@ int ProcessSliderPointMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
	EsSlider *slider = (EsSlider *) EsElementGetLayoutParent(element);
 | 
						EsSlider *slider = (EsSlider *) EsElementGetLayoutParent(element);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
 | 
						if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
 | 
				
			||||||
		double range = slider->width - slider->point->currentStyle->preferredWidth;
 | 
							double range = slider->width - slider->point->style->preferredWidth;
 | 
				
			||||||
		slider->inDrag = true;
 | 
							slider->inDrag = true;
 | 
				
			||||||
		EsSliderSetValue(slider, (message->mouseDragged.newPositionX + element->offsetX - slider->dragOffset) / range);
 | 
							EsSliderSetValue(slider, (message->mouseDragged.newPositionX + element->offsetX - slider->dragOffset) / range);
 | 
				
			||||||
	} else if (message->type == ES_MSG_MOUSE_LEFT_UP && slider->inDrag) {
 | 
						} else if (message->type == ES_MSG_MOUSE_LEFT_UP && slider->inDrag) {
 | 
				
			||||||
| 
						 | 
					@ -5480,8 +5480,8 @@ int ProcessSliderMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
	EsSlider *slider = (EsSlider *) element;
 | 
						EsSlider *slider = (EsSlider *) element;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (message->type == ES_MSG_LAYOUT) {
 | 
						if (message->type == ES_MSG_LAYOUT) {
 | 
				
			||||||
		int pointWidth = slider->point->currentStyle->preferredWidth;
 | 
							int pointWidth = slider->point->style->preferredWidth;
 | 
				
			||||||
		int pointHeight = slider->point->currentStyle->preferredHeight;
 | 
							int pointHeight = slider->point->style->preferredHeight;
 | 
				
			||||||
		slider->point->InternalMove(pointWidth, pointHeight, (slider->width - pointWidth) * slider->value, (slider->height - pointHeight) / 2);
 | 
							slider->point->InternalMove(pointWidth, pointHeight, (slider->width - pointWidth) * slider->value, (slider->height - pointHeight) / 2);
 | 
				
			||||||
	} else if (message->type == ES_MSG_FOCUSED_START) {
 | 
						} else if (message->type == ES_MSG_FOCUSED_START) {
 | 
				
			||||||
		slider->point->customStyleState |= THEME_STATE_FOCUSED_ITEM;
 | 
							slider->point->customStyleState |= THEME_STATE_FOCUSED_ITEM;
 | 
				
			||||||
| 
						 | 
					@ -5857,7 +5857,7 @@ bool EsElement::InternalDestroy() {
 | 
				
			||||||
		EsHeapFree(userData.p);
 | 
							EsHeapFree(userData.p);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (currentStyle) currentStyle->CloseReference();
 | 
						if (style) style->CloseReference();
 | 
				
			||||||
	if (previousTransitionFrame) EsPaintTargetDestroy(previousTransitionFrame);
 | 
						if (previousTransitionFrame) EsPaintTargetDestroy(previousTransitionFrame);
 | 
				
			||||||
	ThemeAnimationDestroy(&animation);
 | 
						ThemeAnimationDestroy(&animation);
 | 
				
			||||||
	if (window == this) UIWindowDestroy(window); // Windows are deallocated after receiving ES_MSG_WINDOW_DESTROYED.
 | 
						if (window == this) UIWindowDestroy(window); // Windows are deallocated after receiving ES_MSG_WINDOW_DESTROYED.
 | 
				
			||||||
| 
						 | 
					@ -5912,7 +5912,7 @@ EsRectangle EsWindowGetBounds(EsWindow *window) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EsRectangle EsElementGetInsetBounds(EsElement *element) {
 | 
					EsRectangle EsElementGetInsetBounds(EsElement *element) {
 | 
				
			||||||
	EsMessageMutexCheck();
 | 
						EsMessageMutexCheck();
 | 
				
			||||||
	EsRectangle insets = element->currentStyle->insets;
 | 
						EsRectangle insets = element->style->insets;
 | 
				
			||||||
	return ES_RECT_4(insets.l, element->width - insets.r, 
 | 
						return ES_RECT_4(insets.l, element->width - insets.r, 
 | 
				
			||||||
			insets.t, element->height - insets.b);
 | 
								insets.t, element->height - insets.b);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -5920,7 +5920,7 @@ EsRectangle EsElementGetInsetBounds(EsElement *element) {
 | 
				
			||||||
EsRectangle EsElementGetInsetSize(EsElement *element) {
 | 
					EsRectangle EsElementGetInsetSize(EsElement *element) {
 | 
				
			||||||
	EsMessageMutexCheck();
 | 
						EsMessageMutexCheck();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EsRectangle insets = element->currentStyle->insets;
 | 
						EsRectangle insets = element->style->insets;
 | 
				
			||||||
	return ES_RECT_4(0, element->width - insets.l - insets.r, 
 | 
						return ES_RECT_4(0, element->width - insets.l - insets.r, 
 | 
				
			||||||
			0, element->height - insets.t - insets.b);
 | 
								0, element->height - insets.t - insets.b);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -6209,7 +6209,7 @@ void EsElementInsertAfter(EsElement *element) {
 | 
				
			||||||
	gui.insertAfter = element;
 | 
						gui.insertAfter = element;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EsElement::Initialise(EsElement *_parent, uint64_t _flags, EsUICallback _classCallback, const EsStyle *style) {
 | 
					void EsElement::Initialise(EsElement *_parent, uint64_t _flags, EsUICallback _classCallback, const EsStyle *_style) {
 | 
				
			||||||
	EsMessageMutexCheck();
 | 
						EsMessageMutexCheck();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// EsPrint("New element '%z' %x with parent %x.\n", _debugName, this, _parent);
 | 
						// EsPrint("New element '%z' %x with parent %x.\n", _debugName, this, _parent);
 | 
				
			||||||
| 
						 | 
					@ -6271,20 +6271,20 @@ void EsElement::Initialise(EsElement *_parent, uint64_t _flags, EsUICallback _cl
 | 
				
			||||||
		EsElementUpdateContentSize(parent);
 | 
							EsElementUpdateContentSize(parent);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SetStyle(style, false);
 | 
						SetStyle(_style, false);
 | 
				
			||||||
	RefreshStyle();
 | 
						RefreshStyle();
 | 
				
			||||||
	InspectorNotifyElementCreated(this);
 | 
						InspectorNotifyElementCreated(this);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EsRectangle EsElementGetInsets(EsElement *element) {
 | 
					EsRectangle EsElementGetInsets(EsElement *element) {
 | 
				
			||||||
	EsMessageMutexCheck();
 | 
						EsMessageMutexCheck();
 | 
				
			||||||
	return element->currentStyle->insets;
 | 
						return element->style->insets;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
EsThemeMetrics EsElementGetMetrics(EsElement *element) {
 | 
					EsThemeMetrics EsElementGetMetrics(EsElement *element) {
 | 
				
			||||||
	EsMessageMutexCheck();
 | 
						EsMessageMutexCheck();
 | 
				
			||||||
	EsThemeMetrics m = {};
 | 
						EsThemeMetrics m = {};
 | 
				
			||||||
	ThemeMetrics *metrics = element->currentStyle->metrics;
 | 
						ThemeMetrics *metrics = element->style->metrics;
 | 
				
			||||||
#define RECTANGLE_8_TO_ES_RECTANGLE(x) { (int32_t) (x).l, (int32_t) (x).r, (int32_t) (x).t, (int32_t) (x).b }
 | 
					#define RECTANGLE_8_TO_ES_RECTANGLE(x) { (int32_t) (x).l, (int32_t) (x).r, (int32_t) (x).t, (int32_t) (x).b }
 | 
				
			||||||
	m.insets = RECTANGLE_8_TO_ES_RECTANGLE(metrics->insets);
 | 
						m.insets = RECTANGLE_8_TO_ES_RECTANGLE(metrics->insets);
 | 
				
			||||||
	m.clipInsets = RECTANGLE_8_TO_ES_RECTANGLE(metrics->clipInsets);
 | 
						m.clipInsets = RECTANGLE_8_TO_ES_RECTANGLE(metrics->clipInsets);
 | 
				
			||||||
| 
						 | 
					@ -6479,7 +6479,7 @@ void EsElementGetSize(EsElement *element, int *width, int *height) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EsElementGetTextStyle(EsElement *element, EsTextStyle *style) {
 | 
					void EsElementGetTextStyle(EsElement *element, EsTextStyle *style) {
 | 
				
			||||||
	element->currentStyle->GetTextStyle(style);
 | 
						element->style->GetTextStyle(style);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void EsElementRepaint(EsElement *element, const EsRectangle *region) {
 | 
					void EsElementRepaint(EsElement *element, const EsRectangle *region) {
 | 
				
			||||||
| 
						 | 
					@ -7193,7 +7193,7 @@ bool UISetCursor(EsWindow *window) {
 | 
				
			||||||
		if (ES_HANDLED == EsMessageSend(element, &m)) {
 | 
							if (ES_HANDLED == EsMessageSend(element, &m)) {
 | 
				
			||||||
			cursorStyle = m.cursorStyle;
 | 
								cursorStyle = m.cursorStyle;
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			cursorStyle = (EsCursorStyle) element->currentStyle->metrics->cursor;
 | 
								cursorStyle = (EsCursorStyle) element->style->metrics->cursor;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7916,7 +7916,7 @@ void InspectorNotifyElementPainted(EsElement *element, EsPainter *painter) {
 | 
				
			||||||
			painter->offsetY, painter->offsetY + painter->height);
 | 
								painter->offsetY, painter->offsetY + painter->height);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (entry->element == element) {
 | 
						if (entry->element == element) {
 | 
				
			||||||
		EsDrawRectangle(painter, bounds, 0x607F7FFF, 0x60FFFF7F, element->currentStyle->insets);
 | 
							EsDrawRectangle(painter, bounds, 0x607F7FFF, 0x60FFFF7F, element->style->insets);
 | 
				
			||||||
	} else if (entry->element->parent == element) {
 | 
						} else if (entry->element->parent == element) {
 | 
				
			||||||
		if ((element->flags & ES_CELL_FILL) != ES_CELL_FILL) {
 | 
							if ((element->flags & ES_CELL_FILL) != ES_CELL_FILL) {
 | 
				
			||||||
			EsRectangle rectangle = entry->givenBounds;
 | 
								EsRectangle rectangle = entry->givenBounds;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -102,7 +102,7 @@ struct EsListView : EsElement {
 | 
				
			||||||
		EsRectangle bounds = GetBounds();
 | 
							EsRectangle bounds = GetBounds();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (columnHeader) {
 | 
							if (columnHeader) {
 | 
				
			||||||
			bounds.t += columnHeader->currentStyle->preferredHeight;
 | 
								bounds.t += columnHeader->style->preferredHeight;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		return bounds;
 | 
							return bounds;
 | 
				
			||||||
| 
						 | 
					@ -209,10 +209,10 @@ struct EsListView : EsElement {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void GetItemPosition(EsListViewIndex groupIndex, EsListViewIndex index, int64_t *_position, int64_t *_itemSize) {
 | 
						void GetItemPosition(EsListViewIndex groupIndex, EsListViewIndex index, int64_t *_position, int64_t *_itemSize) {
 | 
				
			||||||
		int64_t gapBetweenGroup = currentStyle->gapMajor,
 | 
							int64_t gapBetweenGroup = style->gapMajor,
 | 
				
			||||||
			gapBetweenItems = (flags & ES_LIST_VIEW_TILED) ? currentStyle->gapWrap : currentStyle->gapMinor,
 | 
								gapBetweenItems = (flags & ES_LIST_VIEW_TILED) ? style->gapWrap : style->gapMinor,
 | 
				
			||||||
			fixedSize       = (flags & ES_LIST_VIEW_VARIABLE_SIZE) ? 0 : (flags & ES_LIST_VIEW_HORIZONTAL ? fixedWidth : fixedHeight),
 | 
								fixedSize       = (flags & ES_LIST_VIEW_VARIABLE_SIZE) ? 0 : (flags & ES_LIST_VIEW_HORIZONTAL ? fixedWidth : fixedHeight),
 | 
				
			||||||
			startInset 	= flags & ES_LIST_VIEW_HORIZONTAL ? currentStyle->insets.l : currentStyle->insets.t;
 | 
								startInset 	= flags & ES_LIST_VIEW_HORIZONTAL ? style->insets.l : style->insets.t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int64_t position = (flags & ES_LIST_VIEW_HORIZONTAL ? -scroll.position[0] : -scroll.position[1]) + startInset, 
 | 
							int64_t position = (flags & ES_LIST_VIEW_HORIZONTAL ? -scroll.position[0] : -scroll.position[1]) + startInset, 
 | 
				
			||||||
			itemSize = 0;
 | 
								itemSize = 0;
 | 
				
			||||||
| 
						 | 
					@ -302,8 +302,8 @@ struct EsListView : EsElement {
 | 
				
			||||||
	void EnsureItemVisible(EsListViewIndex groupIndex, EsListViewIndex index, bool alignTop) {
 | 
						void EnsureItemVisible(EsListViewIndex groupIndex, EsListViewIndex index, bool alignTop) {
 | 
				
			||||||
		EsRectangle contentBounds = GetListBounds();
 | 
							EsRectangle contentBounds = GetListBounds();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int64_t startInset = flags & ES_LIST_VIEW_HORIZONTAL ? currentStyle->insets.l : currentStyle->insets.t,
 | 
							int64_t startInset = flags & ES_LIST_VIEW_HORIZONTAL ? style->insets.l : style->insets.t,
 | 
				
			||||||
			endInset = flags & ES_LIST_VIEW_HORIZONTAL ? currentStyle->insets.r : currentStyle->insets.b,
 | 
								endInset = flags & ES_LIST_VIEW_HORIZONTAL ? style->insets.r : style->insets.b,
 | 
				
			||||||
			contentSize = flags & ES_LIST_VIEW_HORIZONTAL ? Width(contentBounds) : Height(contentBounds);
 | 
								contentSize = flags & ES_LIST_VIEW_HORIZONTAL ? Width(contentBounds) : Height(contentBounds);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int64_t position, itemSize;
 | 
							int64_t position, itemSize;
 | 
				
			||||||
| 
						 | 
					@ -329,8 +329,8 @@ struct EsListView : EsElement {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EsMessage FindFirstVisibleItem(int64_t *_position, int64_t position, ListViewItem *reference, bool *noItems) {
 | 
						EsMessage FindFirstVisibleItem(int64_t *_position, int64_t position, ListViewItem *reference, bool *noItems) {
 | 
				
			||||||
		int64_t gapBetweenGroup = currentStyle->gapMajor,
 | 
							int64_t gapBetweenGroup = style->gapMajor,
 | 
				
			||||||
			gapBetweenItems = (flags & ES_LIST_VIEW_TILED) ? currentStyle->gapWrap : currentStyle->gapMinor,
 | 
								gapBetweenItems = (flags & ES_LIST_VIEW_TILED) ? style->gapWrap : style->gapMinor,
 | 
				
			||||||
			fixedSize       = (flags & ES_LIST_VIEW_VARIABLE_SIZE) ? 0 : (flags & ES_LIST_VIEW_HORIZONTAL ? fixedWidth : fixedHeight);
 | 
								fixedSize       = (flags & ES_LIST_VIEW_VARIABLE_SIZE) ? 0 : (flags & ES_LIST_VIEW_HORIZONTAL ? fixedWidth : fixedHeight);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		// Find the group.
 | 
							// Find the group.
 | 
				
			||||||
| 
						 | 
					@ -483,7 +483,7 @@ struct EsListView : EsElement {
 | 
				
			||||||
	void Populate() {
 | 
						void Populate() {
 | 
				
			||||||
#if 0
 | 
					#if 0
 | 
				
			||||||
		EsPrint("--- Before Populate() ---\n");
 | 
							EsPrint("--- Before Populate() ---\n");
 | 
				
			||||||
		EsPrint("Scroll: %i\n", (int) (scroll.position[1] - currentStyle->insets.t));
 | 
							EsPrint("Scroll: %i\n", (int) (scroll.position[1] - style->insets.t));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (uintptr_t i = 0; i < visibleItems.Length(); i++) {
 | 
							for (uintptr_t i = 0; i < visibleItems.Length(); i++) {
 | 
				
			||||||
			EsMessage m = { ES_MSG_LIST_VIEW_GET_CONTENT };
 | 
								EsMessage m = { ES_MSG_LIST_VIEW_GET_CONTENT };
 | 
				
			||||||
| 
						 | 
					@ -509,8 +509,8 @@ struct EsListView : EsElement {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EsRectangle contentBounds = GetListBounds();
 | 
							EsRectangle contentBounds = GetListBounds();
 | 
				
			||||||
		int64_t contentSize = flags & ES_LIST_VIEW_HORIZONTAL ? Width(contentBounds) : Height(contentBounds);
 | 
							int64_t contentSize = flags & ES_LIST_VIEW_HORIZONTAL ? Width(contentBounds) : Height(contentBounds);
 | 
				
			||||||
		int64_t scroll = EsCRTfloor(flags & ES_LIST_VIEW_HORIZONTAL ? (this->scroll.position[0] - currentStyle->insets.l) 
 | 
							int64_t scroll = EsCRTfloor(flags & ES_LIST_VIEW_HORIZONTAL ? (this->scroll.position[0] - style->insets.l) 
 | 
				
			||||||
				: (this->scroll.position[1] - currentStyle->insets.t));
 | 
									: (this->scroll.position[1] - style->insets.t));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int64_t position = 0;
 | 
							int64_t position = 0;
 | 
				
			||||||
		bool noItems = false;
 | 
							bool noItems = false;
 | 
				
			||||||
| 
						 | 
					@ -521,10 +521,10 @@ struct EsListView : EsElement {
 | 
				
			||||||
		int64_t fixedMinorSize = (flags & ES_LIST_VIEW_HORIZONTAL) ? fixedHeight : fixedWidth;
 | 
							int64_t fixedMinorSize = (flags & ES_LIST_VIEW_HORIZONTAL) ? fixedHeight : fixedWidth;
 | 
				
			||||||
		intptr_t itemsPerBand = GetItemsPerBand();
 | 
							intptr_t itemsPerBand = GetItemsPerBand();
 | 
				
			||||||
		intptr_t itemInBand = 0;
 | 
							intptr_t itemInBand = 0;
 | 
				
			||||||
		int64_t computedMinorGap = currentStyle->gapMinor;
 | 
							int64_t computedMinorGap = style->gapMinor;
 | 
				
			||||||
		int64_t minorPosition = 0;
 | 
							int64_t minorPosition = 0;
 | 
				
			||||||
		int64_t centerOffset = (flags & ES_LIST_VIEW_CENTER_TILES) 
 | 
							int64_t centerOffset = (flags & ES_LIST_VIEW_CENTER_TILES) 
 | 
				
			||||||
			? (wrapLimit - itemsPerBand * (fixedMinorSize + currentStyle->gapMinor) + currentStyle->gapMinor) / 2 : 0;
 | 
								? (wrapLimit - itemsPerBand * (fixedMinorSize + style->gapMinor) + style->gapMinor) / 2 : 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		while (visibleIndex < visibleItems.Length()) {
 | 
							while (visibleIndex < visibleItems.Length()) {
 | 
				
			||||||
			// Remove visible items no longer visible, before the viewport.
 | 
								// Remove visible items no longer visible, before the viewport.
 | 
				
			||||||
| 
						 | 
					@ -633,10 +633,10 @@ struct EsListView : EsElement {
 | 
				
			||||||
			if ((flags & ES_LIST_VIEW_TILED) && !visibleItem->isHeader && !visibleItem->isFooter) {
 | 
								if ((flags & ES_LIST_VIEW_TILED) && !visibleItem->isHeader && !visibleItem->isFooter) {
 | 
				
			||||||
				if (flags & ES_LIST_VIEW_HORIZONTAL) {
 | 
									if (flags & ES_LIST_VIEW_HORIZONTAL) {
 | 
				
			||||||
					visibleItem->element->InternalMove(fixedWidth, fixedHeight, 
 | 
										visibleItem->element->InternalMove(fixedWidth, fixedHeight, 
 | 
				
			||||||
							position + contentBounds.l, minorPosition + currentStyle->insets.t + contentBounds.t + centerOffset);
 | 
												position + contentBounds.l, minorPosition + style->insets.t + contentBounds.t + centerOffset);
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					visibleItem->element->InternalMove(fixedWidth, fixedHeight, 
 | 
										visibleItem->element->InternalMove(fixedWidth, fixedHeight, 
 | 
				
			||||||
							minorPosition + currentStyle->insets.l + contentBounds.l + centerOffset, position + contentBounds.t);
 | 
												minorPosition + style->insets.l + contentBounds.l + centerOffset, position + contentBounds.t);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				minorPosition += computedMinorGap + fixedMinorSize;
 | 
									minorPosition += computedMinorGap + fixedMinorSize;
 | 
				
			||||||
| 
						 | 
					@ -649,33 +649,33 @@ struct EsListView : EsElement {
 | 
				
			||||||
					minorPosition = 0;
 | 
										minorPosition = 0;
 | 
				
			||||||
					itemInBand = 0;
 | 
										itemInBand = 0;
 | 
				
			||||||
					position += (flags & ES_LIST_VIEW_HORIZONTAL) ? visibleItem->element->width : visibleItem->element->height;
 | 
										position += (flags & ES_LIST_VIEW_HORIZONTAL) ? visibleItem->element->width : visibleItem->element->height;
 | 
				
			||||||
					if (!endOfGroup || (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER)) position += currentStyle->gapWrap;
 | 
										if (!endOfGroup || (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER)) position += style->gapWrap;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				if (flags & ES_LIST_VIEW_HORIZONTAL) {
 | 
									if (flags & ES_LIST_VIEW_HORIZONTAL) {
 | 
				
			||||||
					visibleItem->element->InternalMove(
 | 
										visibleItem->element->InternalMove(
 | 
				
			||||||
						visibleItem->size, 
 | 
											visibleItem->size, 
 | 
				
			||||||
						Height(contentBounds) - currentStyle->insets.t - currentStyle->insets.b - visibleItem->indent * currentStyle->gapWrap,
 | 
											Height(contentBounds) - style->insets.t - style->insets.b - visibleItem->indent * style->gapWrap,
 | 
				
			||||||
						position + contentBounds.l, 
 | 
											position + contentBounds.l, 
 | 
				
			||||||
						currentStyle->insets.t - this->scroll.position[1] + visibleItem->indent * currentStyle->gapWrap + contentBounds.t);
 | 
											style->insets.t - this->scroll.position[1] + visibleItem->indent * style->gapWrap + contentBounds.t);
 | 
				
			||||||
					position += visibleItem->element->width;
 | 
										position += visibleItem->element->width;
 | 
				
			||||||
				} else if ((flags & ES_LIST_VIEW_COLUMNS) && ((~flags & ES_LIST_VIEW_CHOICE_SELECT) || (this->scroll.enabled[0]))) {
 | 
									} else if ((flags & ES_LIST_VIEW_COLUMNS) && ((~flags & ES_LIST_VIEW_CHOICE_SELECT) || (this->scroll.enabled[0]))) {
 | 
				
			||||||
					int indent = visibleItem->indent * currentStyle->gapWrap;
 | 
										int indent = visibleItem->indent * style->gapWrap;
 | 
				
			||||||
					int firstColumn = columns[0].width * theming.scale + secondaryCellStyle->gapMajor;
 | 
										int firstColumn = columns[0].width * theming.scale + secondaryCellStyle->gapMajor;
 | 
				
			||||||
					visibleItem->startAtSecondColumn = indent > firstColumn;
 | 
										visibleItem->startAtSecondColumn = indent > firstColumn;
 | 
				
			||||||
					if (indent > firstColumn) indent = firstColumn;
 | 
										if (indent > firstColumn) indent = firstColumn;
 | 
				
			||||||
					visibleItem->element->InternalMove(totalColumnWidth - indent, visibleItem->size, 
 | 
										visibleItem->element->InternalMove(totalColumnWidth - indent, visibleItem->size, 
 | 
				
			||||||
						indent - this->scroll.position[0] + contentBounds.l + currentStyle->insets.l, position + contentBounds.t);
 | 
											indent - this->scroll.position[0] + contentBounds.l + style->insets.l, position + contentBounds.t);
 | 
				
			||||||
					position += visibleItem->element->height;
 | 
										position += visibleItem->element->height;
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					int indent = visibleItem->indent * currentStyle->gapWrap + currentStyle->insets.l;
 | 
										int indent = visibleItem->indent * style->gapWrap + style->insets.l;
 | 
				
			||||||
					visibleItem->element->InternalMove(Width(contentBounds) - indent - currentStyle->insets.r, visibleItem->size, 
 | 
										visibleItem->element->InternalMove(Width(contentBounds) - indent - style->insets.r, visibleItem->size, 
 | 
				
			||||||
						indent + contentBounds.l - this->scroll.position[0], position + contentBounds.t);
 | 
											indent + contentBounds.l - this->scroll.position[0], position + contentBounds.t);
 | 
				
			||||||
					position += visibleItem->element->height;
 | 
										position += visibleItem->element->height;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if ((flags & ES_LIST_VIEW_TILED) && (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && currentItem.iterateIndex.index == 0) {
 | 
									if ((flags & ES_LIST_VIEW_TILED) && (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) && currentItem.iterateIndex.index == 0) {
 | 
				
			||||||
					position += currentStyle->gapWrap;
 | 
										position += style->gapWrap;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -684,7 +684,7 @@ struct EsListView : EsElement {
 | 
				
			||||||
			visibleIndex++;
 | 
								visibleIndex++;
 | 
				
			||||||
			EsListViewIndex previousGroup = currentItem.iterateIndex.group;
 | 
								EsListViewIndex previousGroup = currentItem.iterateIndex.group;
 | 
				
			||||||
			if (!IterateForwards(¤tItem)) break;
 | 
								if (!IterateForwards(¤tItem)) break;
 | 
				
			||||||
			position += previousGroup == currentItem.iterateIndex.group ? (flags & ES_LIST_VIEW_TILED ? 0 : currentStyle->gapMinor) : currentStyle->gapMajor;
 | 
								position += previousGroup == currentItem.iterateIndex.group ? (flags & ES_LIST_VIEW_TILED ? 0 : style->gapMinor) : style->gapMajor;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		while (visibleIndex < visibleItems.Length()) {
 | 
							while (visibleIndex < visibleItems.Length()) {
 | 
				
			||||||
| 
						 | 
					@ -711,21 +711,21 @@ struct EsListView : EsElement {
 | 
				
			||||||
			intptr_t itemCount = group->itemCount;
 | 
								intptr_t itemCount = group->itemCount;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) {
 | 
								if (group->flags & ES_LIST_VIEW_GROUP_HAS_HEADER) {
 | 
				
			||||||
				groupSize += fixedHeaderSize + currentStyle->gapWrap;
 | 
									groupSize += fixedHeaderSize + style->gapWrap;
 | 
				
			||||||
				itemCount--;
 | 
									itemCount--;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) {
 | 
								if (group->flags & ES_LIST_VIEW_GROUP_HAS_FOOTER) {
 | 
				
			||||||
				groupSize += fixedFooterSize + currentStyle->gapWrap;
 | 
									groupSize += fixedFooterSize + style->gapWrap;
 | 
				
			||||||
				itemCount--;
 | 
									itemCount--;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			intptr_t bandsInGroup = (itemCount + itemsPerBand - 1) / itemsPerBand;
 | 
								intptr_t bandsInGroup = (itemCount + itemsPerBand - 1) / itemsPerBand;
 | 
				
			||||||
			groupSize += (((flags & ES_LIST_VIEW_HORIZONTAL) ? fixedWidth : fixedHeight) + currentStyle->gapWrap) * bandsInGroup;
 | 
								groupSize += (((flags & ES_LIST_VIEW_HORIZONTAL) ? fixedWidth : fixedHeight) + style->gapWrap) * bandsInGroup;
 | 
				
			||||||
			groupSize -= currentStyle->gapWrap;
 | 
								groupSize -= style->gapWrap;
 | 
				
			||||||
			group->totalSize = groupSize;
 | 
								group->totalSize = groupSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			totalSize += groupSize + (group == &groups.Last() ? 0 : currentStyle->gapMajor);
 | 
								totalSize += groupSize + (group == &groups.Last() ? 0 : style->gapMajor);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		scroll.Refresh();
 | 
							scroll.Refresh();
 | 
				
			||||||
| 
						 | 
					@ -941,8 +941,8 @@ struct EsListView : EsElement {
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			int64_t wrapLimit = GetWrapLimit();
 | 
								int64_t wrapLimit = GetWrapLimit();
 | 
				
			||||||
			int64_t fixedMinorSize = (flags & ES_LIST_VIEW_HORIZONTAL) ? fixedHeight : fixedWidth;
 | 
								int64_t fixedMinorSize = (flags & ES_LIST_VIEW_HORIZONTAL) ? fixedHeight : fixedWidth;
 | 
				
			||||||
			intptr_t itemsPerBand = fixedMinorSize && ((fixedMinorSize + currentStyle->gapMinor) < wrapLimit) 
 | 
								intptr_t itemsPerBand = fixedMinorSize && ((fixedMinorSize + style->gapMinor) < wrapLimit) 
 | 
				
			||||||
				? (wrapLimit / (fixedMinorSize + currentStyle->gapMinor)) : 1;
 | 
									? (wrapLimit / (fixedMinorSize + style->gapMinor)) : 1;
 | 
				
			||||||
			return MinimumInteger(itemsPerBand, maximumItemsPerBand);
 | 
								return MinimumInteger(itemsPerBand, maximumItemsPerBand);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -958,15 +958,15 @@ struct EsListView : EsElement {
 | 
				
			||||||
		bool noItems = false;
 | 
							bool noItems = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (flags & ES_LIST_VIEW_HORIZONTAL) {
 | 
							if (flags & ES_LIST_VIEW_HORIZONTAL) {
 | 
				
			||||||
			if (y1 >= contentBounds.b - currentStyle->insets.b || y2 < contentBounds.t + currentStyle->insets.t) {
 | 
								if (y1 >= contentBounds.b - style->insets.b || y2 < contentBounds.t + style->insets.t) {
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else if (flags & ES_LIST_VIEW_COLUMNS) {
 | 
							} else if (flags & ES_LIST_VIEW_COLUMNS) {
 | 
				
			||||||
			if (x1 >= contentBounds.l + currentStyle->insets.l + totalColumnWidth || x2 < contentBounds.l + currentStyle->insets.l) {
 | 
								if (x1 >= contentBounds.l + style->insets.l + totalColumnWidth || x2 < contentBounds.l + style->insets.l) {
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			if (x1 >= contentBounds.r - currentStyle->insets.r || x2 < contentBounds.l + currentStyle->insets.l) {
 | 
								if (x1 >= contentBounds.r - style->insets.r || x2 < contentBounds.l + style->insets.l) {
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -974,8 +974,8 @@ struct EsListView : EsElement {
 | 
				
			||||||
		// TODO Use reference for FindFirstVisibleItem.
 | 
							// TODO Use reference for FindFirstVisibleItem.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		bool adjustStart = false, adjustEnd = false;
 | 
							bool adjustStart = false, adjustEnd = false;
 | 
				
			||||||
		int r1 = (flags & ES_LIST_VIEW_HORIZONTAL) ? currentStyle->insets.l - x1 : currentStyle->insets.t - y1 + scroll.fixedViewport[1];
 | 
							int r1 = (flags & ES_LIST_VIEW_HORIZONTAL) ? style->insets.l - x1 : style->insets.t - y1 + scroll.fixedViewport[1];
 | 
				
			||||||
		int r2 = (flags & ES_LIST_VIEW_HORIZONTAL) ? currentStyle->insets.l - x2 : currentStyle->insets.t - y2 + scroll.fixedViewport[1];
 | 
							int r2 = (flags & ES_LIST_VIEW_HORIZONTAL) ? style->insets.l - x2 : style->insets.t - y2 + scroll.fixedViewport[1];
 | 
				
			||||||
		start = FindFirstVisibleItem(&offset, r1, nullptr, &noItems);
 | 
							start = FindFirstVisibleItem(&offset, r1, nullptr, &noItems);
 | 
				
			||||||
		if (noItems) return;
 | 
							if (noItems) return;
 | 
				
			||||||
		adjustStart = -offset >= MeasureItems(start.iterateIndex.group, start.iterateIndex.index, 1);
 | 
							adjustStart = -offset >= MeasureItems(start.iterateIndex.group, start.iterateIndex.index, 1);
 | 
				
			||||||
| 
						 | 
					@ -988,7 +988,7 @@ struct EsListView : EsElement {
 | 
				
			||||||
			int64_t fixedMinorSize = (flags & ES_LIST_VIEW_HORIZONTAL) ? fixedHeight : fixedWidth;
 | 
								int64_t fixedMinorSize = (flags & ES_LIST_VIEW_HORIZONTAL) ? fixedHeight : fixedWidth;
 | 
				
			||||||
			intptr_t itemsPerBand = GetItemsPerBand();
 | 
								intptr_t itemsPerBand = GetItemsPerBand();
 | 
				
			||||||
			int64_t computedMinorGap = (wrapLimit - itemsPerBand * fixedMinorSize) / (itemsPerBand + 1);
 | 
								int64_t computedMinorGap = (wrapLimit - itemsPerBand * fixedMinorSize) / (itemsPerBand + 1);
 | 
				
			||||||
			int64_t minorStartOffset = computedMinorGap + ((flags & ES_LIST_VIEW_HORIZONTAL) ? currentStyle->insets.t : currentStyle->insets.l);
 | 
								int64_t minorStartOffset = computedMinorGap + ((flags & ES_LIST_VIEW_HORIZONTAL) ? style->insets.t : style->insets.l);
 | 
				
			||||||
			intptr_t startInBand = (((flags & ES_LIST_VIEW_HORIZONTAL) ? y1 : x1) - minorStartOffset) / (fixedMinorSize + computedMinorGap);
 | 
								intptr_t startInBand = (((flags & ES_LIST_VIEW_HORIZONTAL) ? y1 : x1) - minorStartOffset) / (fixedMinorSize + computedMinorGap);
 | 
				
			||||||
			intptr_t endInBand = (((flags & ES_LIST_VIEW_HORIZONTAL) ? y2 : x2) - minorStartOffset) / (fixedMinorSize + computedMinorGap);
 | 
								intptr_t endInBand = (((flags & ES_LIST_VIEW_HORIZONTAL) ? y2 : x2) - minorStartOffset) / (fixedMinorSize + computedMinorGap);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1130,7 +1130,7 @@ struct EsListView : EsElement {
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (flags & ES_LIST_VIEW_COLUMNS) {
 | 
								if (flags & ES_LIST_VIEW_COLUMNS) {
 | 
				
			||||||
				EsRectangle bounds = EsRectangleAddBorder(element->GetBounds(), element->currentStyle->insets);
 | 
									EsRectangle bounds = EsRectangleAddBorder(element->GetBounds(), element->style->insets);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				for (uintptr_t i = item->startAtSecondColumn ? 1 : 0; i < columnCount; i++) {
 | 
									for (uintptr_t i = item->startAtSecondColumn ? 1 : 0; i < columnCount; i++) {
 | 
				
			||||||
					m.getContent.column = i;
 | 
										m.getContent.column = i;
 | 
				
			||||||
| 
						 | 
					@ -1138,10 +1138,10 @@ struct EsListView : EsElement {
 | 
				
			||||||
					buffer.position = 0;
 | 
										buffer.position = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					bounds.r = bounds.l + columns[i].width * theming.scale
 | 
										bounds.r = bounds.l + columns[i].width * theming.scale
 | 
				
			||||||
						- element->currentStyle->insets.r - element->currentStyle->insets.l;
 | 
											- element->style->insets.r - element->style->insets.l;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (i == 0) {
 | 
										if (i == 0) {
 | 
				
			||||||
						bounds.r -= item->indent * currentStyle->gapWrap;
 | 
											bounds.r -= item->indent * style->gapWrap;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					EsRectangle drawBounds = { bounds.l + message->painter->offsetX, bounds.r + message->painter->offsetX,
 | 
										EsRectangle drawBounds = { bounds.l + message->painter->offsetX, bounds.r + message->painter->offsetX,
 | 
				
			||||||
| 
						 | 
					@ -1168,7 +1168,7 @@ struct EsListView : EsElement {
 | 
				
			||||||
					bounds.l += columns[i].width * theming.scale + secondaryCellStyle->gapMajor;
 | 
										bounds.l += columns[i].width * theming.scale + secondaryCellStyle->gapMajor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (i == 0) {
 | 
										if (i == 0) {
 | 
				
			||||||
						bounds.l -= item->indent * currentStyle->gapWrap;
 | 
											bounds.l -= item->indent * style->gapWrap;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
| 
						 | 
					@ -1260,8 +1260,8 @@ struct EsListView : EsElement {
 | 
				
			||||||
	inline int GetWrapLimit() {
 | 
						inline int GetWrapLimit() {
 | 
				
			||||||
		EsRectangle bounds = GetListBounds();
 | 
							EsRectangle bounds = GetListBounds();
 | 
				
			||||||
		return (flags & ES_LIST_VIEW_HORIZONTAL) 
 | 
							return (flags & ES_LIST_VIEW_HORIZONTAL) 
 | 
				
			||||||
			? bounds.b - bounds.t - currentStyle->insets.b - currentStyle->insets.t 
 | 
								? bounds.b - bounds.t - style->insets.b - style->insets.t 
 | 
				
			||||||
			: bounds.r - bounds.l - currentStyle->insets.r - currentStyle->insets.l;
 | 
								: bounds.r - bounds.l - style->insets.r - style->insets.l;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	ListViewItem *FindVisibleItem(EsListViewIndex group, EsListViewIndex index) {
 | 
						ListViewItem *FindVisibleItem(EsListViewIndex group, EsListViewIndex index) {
 | 
				
			||||||
| 
						 | 
					@ -1543,26 +1543,26 @@ struct EsListView : EsElement {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void MoveInlineTextbox(ListViewItem *item) {
 | 
						void MoveInlineTextbox(ListViewItem *item) {
 | 
				
			||||||
		UIStyle *style = item->element->currentStyle;
 | 
							UIStyle *style = item->element->style;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (flags & ES_LIST_VIEW_COLUMNS) {
 | 
							if (flags & ES_LIST_VIEW_COLUMNS) {
 | 
				
			||||||
			int offset = primaryCellStyle->metrics->iconSize + primaryCellStyle->gapMinor 
 | 
								int offset = primaryCellStyle->metrics->iconSize + primaryCellStyle->gapMinor 
 | 
				
			||||||
				+ style->insets.l - inlineTextbox->currentStyle->insets.l;
 | 
									+ style->insets.l - inlineTextbox->style->insets.l;
 | 
				
			||||||
			inlineTextbox->InternalMove(columns[0].width * theming.scale - offset, item->element->height, 
 | 
								inlineTextbox->InternalMove(columns[0].width * theming.scale - offset, item->element->height, 
 | 
				
			||||||
					item->element->offsetX + offset, item->element->offsetY);
 | 
										item->element->offsetX + offset, item->element->offsetY);
 | 
				
			||||||
		} else if (flags & ES_LIST_VIEW_TILED) {
 | 
							} else if (flags & ES_LIST_VIEW_TILED) {
 | 
				
			||||||
			if (style->metrics->layoutVertical) {
 | 
								if (style->metrics->layoutVertical) {
 | 
				
			||||||
				int height = inlineTextbox->currentStyle->preferredHeight;
 | 
									int height = inlineTextbox->style->preferredHeight;
 | 
				
			||||||
				int textStart = style->metrics->iconSize + style->gapMinor + style->insets.t;
 | 
									int textStart = style->metrics->iconSize + style->gapMinor + style->insets.t;
 | 
				
			||||||
				int textEnd = item->element->height - style->insets.b;
 | 
									int textEnd = item->element->height - style->insets.b;
 | 
				
			||||||
				int offset = (textStart + textEnd - height) / 2;
 | 
									int offset = (textStart + textEnd - height) / 2;
 | 
				
			||||||
				inlineTextbox->InternalMove(item->element->width - style->insets.r - style->insets.l, height, 
 | 
									inlineTextbox->InternalMove(item->element->width - style->insets.r - style->insets.l, height, 
 | 
				
			||||||
						item->element->offsetX + style->insets.l, item->element->offsetY + offset);
 | 
											item->element->offsetX + style->insets.l, item->element->offsetY + offset);
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				int textboxInset = inlineTextbox->currentStyle->insets.l;
 | 
									int textboxInset = inlineTextbox->style->insets.l;
 | 
				
			||||||
				int offset = style->metrics->iconSize + style->gapMinor 
 | 
									int offset = style->metrics->iconSize + style->gapMinor 
 | 
				
			||||||
					+ style->insets.l - textboxInset;
 | 
										+ style->insets.l - textboxInset;
 | 
				
			||||||
				int height = inlineTextbox->currentStyle->preferredHeight;
 | 
									int height = inlineTextbox->style->preferredHeight;
 | 
				
			||||||
				inlineTextbox->InternalMove(item->element->width - offset - style->insets.r + textboxInset, height, 
 | 
									inlineTextbox->InternalMove(item->element->width - offset - style->insets.r + textboxInset, height, 
 | 
				
			||||||
						item->element->offsetX + offset, 
 | 
											item->element->offsetX + offset, 
 | 
				
			||||||
						item->element->offsetY + (item->element->height - height) / 2);
 | 
											item->element->offsetY + (item->element->height - height) / 2);
 | 
				
			||||||
| 
						 | 
					@ -1578,13 +1578,13 @@ struct EsListView : EsElement {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (message->type == ES_MSG_GET_WIDTH || message->type == ES_MSG_GET_HEIGHT) {
 | 
							if (message->type == ES_MSG_GET_WIDTH || message->type == ES_MSG_GET_HEIGHT) {
 | 
				
			||||||
			if (flags & ES_LIST_VIEW_HORIZONTAL) {
 | 
								if (flags & ES_LIST_VIEW_HORIZONTAL) {
 | 
				
			||||||
				message->measure.width = totalSize + currentStyle->insets.l + currentStyle->insets.r;
 | 
									message->measure.width = totalSize + style->insets.l + style->insets.r;
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				message->measure.height = totalSize + currentStyle->insets.t + currentStyle->insets.b;
 | 
									message->measure.height = totalSize + style->insets.t + style->insets.b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (flags & ES_LIST_VIEW_COLUMNS) {
 | 
									if (flags & ES_LIST_VIEW_COLUMNS) {
 | 
				
			||||||
					message->measure.width = totalColumnWidth + currentStyle->insets.l + currentStyle->insets.r;
 | 
										message->measure.width = totalColumnWidth + style->insets.l + style->insets.r;
 | 
				
			||||||
					message->measure.height += columnHeader->currentStyle->preferredHeight;
 | 
										message->measure.height += columnHeader->style->preferredHeight;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else if (message->type == ES_MSG_LAYOUT) {
 | 
							} else if (message->type == ES_MSG_LAYOUT) {
 | 
				
			||||||
| 
						 | 
					@ -1594,7 +1594,7 @@ struct EsListView : EsElement {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (columnHeader) {
 | 
								if (columnHeader) {
 | 
				
			||||||
				EsRectangle bounds = GetBounds();
 | 
									EsRectangle bounds = GetBounds();
 | 
				
			||||||
				columnHeader->InternalMove(Width(bounds), columnHeader->currentStyle->preferredHeight, 0, 0);
 | 
									columnHeader->InternalMove(Width(bounds), columnHeader->style->preferredHeight, 0, 0);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (inlineTextbox) {
 | 
								if (inlineTextbox) {
 | 
				
			||||||
| 
						 | 
					@ -1903,14 +1903,14 @@ void EsListViewChangeStyles(EsListView *view, const EsStyle *style, const EsStyl
 | 
				
			||||||
			EsListView *view = (EsListView *) element->userData.p;
 | 
								EsListView *view = (EsListView *) element->userData.p;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (message->type == ES_MSG_LAYOUT) {
 | 
								if (message->type == ES_MSG_LAYOUT) {
 | 
				
			||||||
				int x = view->currentStyle->insets.l - view->scroll.position[0];
 | 
									int x = view->style->insets.l - view->scroll.position[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				for (uintptr_t i = 0; i < element->children.Length(); i += 2) {
 | 
									for (uintptr_t i = 0; i < element->children.Length(); i += 2) {
 | 
				
			||||||
					EsElement *item = element->children[i], *splitter = element->children[i + 1];
 | 
										EsElement *item = element->children[i], *splitter = element->children[i + 1];
 | 
				
			||||||
					EsListViewColumn *column = view->columns + item->userData.u;
 | 
										EsListViewColumn *column = view->columns + item->userData.u;
 | 
				
			||||||
					int splitterLeft = splitter->currentStyle->preferredWidth - view->secondaryCellStyle->gapMajor;
 | 
										int splitterLeft = splitter->style->preferredWidth - view->secondaryCellStyle->gapMajor;
 | 
				
			||||||
					item->InternalMove(column->width * theming.scale - splitterLeft, element->height, x, 0);
 | 
										item->InternalMove(column->width * theming.scale - splitterLeft, element->height, x, 0);
 | 
				
			||||||
					splitter->InternalMove(splitter->currentStyle->preferredWidth, element->height, x + column->width * theming.scale - splitterLeft, 0);
 | 
										splitter->InternalMove(splitter->style->preferredWidth, element->height, x + column->width * theming.scale - splitterLeft, 0);
 | 
				
			||||||
					x += column->width * theming.scale + view->secondaryCellStyle->gapMajor;
 | 
										x += column->width * theming.scale + view->secondaryCellStyle->gapMajor;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
| 
						 | 
					@ -1918,7 +1918,7 @@ void EsListViewChangeStyles(EsListView *view, const EsStyle *style, const EsStyl
 | 
				
			||||||
			return 0;
 | 
								return 0;
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		view->scroll.fixedViewport[1] = view->columnHeader->currentStyle->preferredHeight;
 | 
							view->scroll.fixedViewport[1] = view->columnHeader->style->preferredHeight;
 | 
				
			||||||
	} else if ((~view->flags & ES_LIST_VIEW_COLUMNS) && view->columnHeader) {
 | 
						} else if ((~view->flags & ES_LIST_VIEW_COLUMNS) && view->columnHeader) {
 | 
				
			||||||
		EsElementDestroy(view->columnHeader);
 | 
							EsElementDestroy(view->columnHeader);
 | 
				
			||||||
		view->columnHeader = nullptr;
 | 
							view->columnHeader = nullptr;
 | 
				
			||||||
| 
						 | 
					@ -2031,7 +2031,7 @@ void EsListViewInsertGroup(EsListView *view, EsListViewIndex group, uint32_t fla
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Insert gap between groups.
 | 
						// Insert gap between groups.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	view->InsertSpace(view->groups.Length() > 1 ? view->currentStyle->gapMajor : 0, firstVisibleItemToMove);
 | 
						view->InsertSpace(view->groups.Length() > 1 ? view->style->gapMajor : 0, firstVisibleItemToMove);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Create header and footer items.
 | 
						// Create header and footer items.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2065,7 +2065,7 @@ void EsListViewInsert(EsListView *view, EsListViewIndex groupIndex, EsListViewIn
 | 
				
			||||||
	bool addedFirstItemInGroup = !group->itemCount;
 | 
						bool addedFirstItemInGroup = !group->itemCount;
 | 
				
			||||||
	group->itemCount += count;
 | 
						group->itemCount += count;
 | 
				
			||||||
	int64_t totalSizeOfItems = view->MeasureItems(groupIndex, firstIndex, count);
 | 
						int64_t totalSizeOfItems = view->MeasureItems(groupIndex, firstIndex, count);
 | 
				
			||||||
	int64_t sizeToAdd = (count - (addedFirstItemInGroup ? 1 : 0)) * view->currentStyle->gapMinor + totalSizeOfItems;
 | 
						int64_t sizeToAdd = (count - (addedFirstItemInGroup ? 1 : 0)) * view->style->gapMinor + totalSizeOfItems;
 | 
				
			||||||
	group->totalSize += sizeToAdd;
 | 
						group->totalSize += sizeToAdd;
 | 
				
			||||||
	view->totalItemCount += count;
 | 
						view->totalItemCount += count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2136,7 +2136,7 @@ void EsListViewRemove(EsListView *view, EsListViewIndex groupIndex, EsListViewIn
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int64_t totalSizeOfItems = view->MeasureItems(groupIndex, firstIndex, count);
 | 
						int64_t totalSizeOfItems = view->MeasureItems(groupIndex, firstIndex, count);
 | 
				
			||||||
	int64_t sizeToRemove = (int64_t) group->itemCount == count ? group->totalSize 
 | 
						int64_t sizeToRemove = (int64_t) group->itemCount == count ? group->totalSize 
 | 
				
			||||||
		: (count * view->currentStyle->gapMinor + totalSizeOfItems);
 | 
							: (count * view->style->gapMinor + totalSizeOfItems);
 | 
				
			||||||
	group->itemCount -= count;
 | 
						group->itemCount -= count;
 | 
				
			||||||
	group->totalSize -= sizeToRemove;
 | 
						group->totalSize -= sizeToRemove;
 | 
				
			||||||
	view->totalItemCount -= count;
 | 
						view->totalItemCount -= count;
 | 
				
			||||||
| 
						 | 
					@ -2258,7 +2258,7 @@ void EsListViewSetColumns(EsListView *view, EsListViewColumn *columns, size_t co
 | 
				
			||||||
				view->columnResizingOriginalWidth = column->width * theming.scale;
 | 
									view->columnResizingOriginalWidth = column->width * theming.scale;
 | 
				
			||||||
			} else if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
 | 
								} else if (message->type == ES_MSG_MOUSE_LEFT_DRAG) {
 | 
				
			||||||
				int width = message->mouseDragged.newPositionX - message->mouseDragged.originalPositionX + view->columnResizingOriginalWidth;
 | 
									int width = message->mouseDragged.newPositionX - message->mouseDragged.originalPositionX + view->columnResizingOriginalWidth;
 | 
				
			||||||
				int minimumWidth = element->currentStyle->metrics->minimumWidth;
 | 
									int minimumWidth = element->style->metrics->minimumWidth;
 | 
				
			||||||
				if (width < minimumWidth) width = minimumWidth;
 | 
									if (width < minimumWidth) width = minimumWidth;
 | 
				
			||||||
				column->width = width / theming.scale;
 | 
									column->width = width / theming.scale;
 | 
				
			||||||
				ListViewCalculateTotalColumnWidth(view);
 | 
									ListViewCalculateTotalColumnWidth(view);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4263,14 +4263,14 @@ int ProcessTextboxMarginMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
			DocumentLine *line = &textbox->lines[i + textbox->firstVisibleLine];
 | 
								DocumentLine *line = &textbox->lines[i + textbox->firstVisibleLine];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			EsRectangle bounds;
 | 
								EsRectangle bounds;
 | 
				
			||||||
			bounds.l = painter->offsetX + element->currentStyle->insets.l;
 | 
								bounds.l = painter->offsetX + element->style->insets.l;
 | 
				
			||||||
			bounds.r = painter->offsetX + painter->width - element->currentStyle->insets.r;
 | 
								bounds.r = painter->offsetX + painter->width - element->style->insets.r;
 | 
				
			||||||
			bounds.t = painter->offsetY + textbox->insets.t + visibleLine->yPosition - textbox->scroll.position[1];
 | 
								bounds.t = painter->offsetY + textbox->insets.t + visibleLine->yPosition - textbox->scroll.position[1];
 | 
				
			||||||
			bounds.b = bounds.t + line->height;
 | 
								bounds.b = bounds.t + line->height;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			char label[64];
 | 
								char label[64];
 | 
				
			||||||
			EsTextRun textRun[2] = {};
 | 
								EsTextRun textRun[2] = {};
 | 
				
			||||||
			element->currentStyle->GetTextStyle(&textRun[0].style);
 | 
								element->style->GetTextStyle(&textRun[0].style);
 | 
				
			||||||
			textRun[0].style.figures = ES_TEXT_FIGURE_TABULAR;
 | 
								textRun[0].style.figures = ES_TEXT_FIGURE_TABULAR;
 | 
				
			||||||
			textRun[1].offset = EsStringFormat(label, sizeof(label), "%d", i + textbox->firstVisibleLine + 1);
 | 
								textRun[1].offset = EsStringFormat(label, sizeof(label), "%d", i + textbox->firstVisibleLine + 1);
 | 
				
			||||||
			EsTextPlanProperties properties = {};
 | 
								EsTextPlanProperties properties = {};
 | 
				
			||||||
| 
						 | 
					@ -4284,13 +4284,13 @@ int ProcessTextboxMarginMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TextboxStyleChanged(EsTextbox *textbox) {
 | 
					void TextboxStyleChanged(EsTextbox *textbox) {
 | 
				
			||||||
	textbox->borders = textbox->currentStyle->borders;
 | 
						textbox->borders = textbox->style->borders;
 | 
				
			||||||
	textbox->insets = textbox->currentStyle->insets;
 | 
						textbox->insets = textbox->style->insets;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (textbox->flags & ES_TEXTBOX_MARGIN) {
 | 
						if (textbox->flags & ES_TEXTBOX_MARGIN) {
 | 
				
			||||||
		int marginWidth = textbox->margin->currentStyle->preferredWidth;
 | 
							int marginWidth = textbox->margin->style->preferredWidth;
 | 
				
			||||||
		textbox->borders.l += marginWidth;
 | 
							textbox->borders.l += marginWidth;
 | 
				
			||||||
		textbox->insets.l += marginWidth + textbox->margin->currentStyle->gapMajor;
 | 
							textbox->insets.l += marginWidth + textbox->margin->style->gapMajor;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int lineHeight = TextGetLineHeight(textbox, &textbox->textStyle);
 | 
						int lineHeight = TextGetLineHeight(textbox, &textbox->textStyle);
 | 
				
			||||||
| 
						 | 
					@ -4328,8 +4328,8 @@ int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
		EsTextSelection selectionProperties = {};
 | 
							EsTextSelection selectionProperties = {};
 | 
				
			||||||
		selectionProperties.hideCaret = (~textbox->state & UI_STATE_FOCUSED) || (textbox->flags & ES_ELEMENT_DISABLED) || !textbox->editing;
 | 
							selectionProperties.hideCaret = (~textbox->state & UI_STATE_FOCUSED) || (textbox->flags & ES_ELEMENT_DISABLED) || !textbox->editing;
 | 
				
			||||||
		selectionProperties.snapCaretToInsets = true;
 | 
							selectionProperties.snapCaretToInsets = true;
 | 
				
			||||||
		selectionProperties.background = textbox->currentStyle->metrics->selectedBackground;
 | 
							selectionProperties.background = textbox->style->metrics->selectedBackground;
 | 
				
			||||||
		selectionProperties.foreground = textbox->currentStyle->metrics->selectedText;
 | 
							selectionProperties.foreground = textbox->style->metrics->selectedText;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EsRectangle clip;
 | 
							EsRectangle clip;
 | 
				
			||||||
		EsRectangleClip(painter->clip, ES_RECT_4(painter->offsetX + textbox->borders.l, 
 | 
							EsRectangleClip(painter->clip, ES_RECT_4(painter->offsetX + textbox->borders.l, 
 | 
				
			||||||
| 
						 | 
					@ -4402,7 +4402,7 @@ int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
		EsRectangle bounds = textbox->GetBounds();
 | 
							EsRectangle bounds = textbox->GetBounds();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (textbox->margin) {
 | 
							if (textbox->margin) {
 | 
				
			||||||
			int marginWidth = textbox->margin->currentStyle->preferredWidth;
 | 
								int marginWidth = textbox->margin->style->preferredWidth;
 | 
				
			||||||
			textbox->margin->InternalMove(marginWidth, Height(bounds), bounds.l, bounds.t);
 | 
								textbox->margin->InternalMove(marginWidth, Height(bounds), bounds.l, bounds.t);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4670,7 +4670,7 @@ int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
		TextboxSetHorizontalScroll(textbox, message->scrollbarMoved.scroll);
 | 
							TextboxSetHorizontalScroll(textbox, message->scrollbarMoved.scroll);
 | 
				
			||||||
	} else if (message->type == ES_MSG_SCROLL_Y) {
 | 
						} else if (message->type == ES_MSG_SCROLL_Y) {
 | 
				
			||||||
		TextboxRefreshVisibleLines(textbox, false);
 | 
							TextboxRefreshVisibleLines(textbox, false);
 | 
				
			||||||
		EsElementRepaintForScroll(textbox, message, EsRectangleAdd(element->GetInternalOffset(), element->currentStyle->borders));
 | 
							EsElementRepaintForScroll(textbox, message, EsRectangleAdd(element->GetInternalOffset(), element->style->borders));
 | 
				
			||||||
	} else if (message->type == ES_MSG_GET_INSPECTOR_INFORMATION) {
 | 
						} else if (message->type == ES_MSG_GET_INSPECTOR_INFORMATION) {
 | 
				
			||||||
		DocumentLine *firstLine = &textbox->lines.First();
 | 
							DocumentLine *firstLine = &textbox->lines.First();
 | 
				
			||||||
		EsBufferFormat(message->getContent.buffer, "'%s'", firstLine->lengthBytes, firstLine->GetBuffer(textbox));
 | 
							EsBufferFormat(message->getContent.buffer, "'%s'", firstLine->lengthBytes, firstLine->GetBuffer(textbox));
 | 
				
			||||||
| 
						 | 
					@ -4680,7 +4680,7 @@ int ProcessTextboxMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
			textbox->margin->RefreshStyle(nullptr, false, true);
 | 
								textbox->margin->RefreshStyle(nullptr, false, true);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		textbox->currentStyle->GetTextStyle(&textbox->textStyle);
 | 
							textbox->style->GetTextStyle(&textbox->textStyle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (textbox->overrideTextSize) {
 | 
							if (textbox->overrideTextSize) {
 | 
				
			||||||
			textbox->textStyle.size = textbox->overrideTextSize;
 | 
								textbox->textStyle.size = textbox->overrideTextSize;
 | 
				
			||||||
| 
						 | 
					@ -4721,10 +4721,10 @@ EsTextbox *EsTextboxCreate(EsElement *parent, uint64_t flags, const EsStyle *sty
 | 
				
			||||||
	textbox->undo = &textbox->localUndo;
 | 
						textbox->undo = &textbox->localUndo;
 | 
				
			||||||
	textbox->undo->instance = textbox->instance;
 | 
						textbox->undo->instance = textbox->instance;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	textbox->borders = textbox->currentStyle->borders;
 | 
						textbox->borders = textbox->style->borders;
 | 
				
			||||||
	textbox->insets = textbox->currentStyle->insets;
 | 
						textbox->insets = textbox->style->insets;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	textbox->currentStyle->GetTextStyle(&textbox->textStyle);
 | 
						textbox->style->GetTextStyle(&textbox->textStyle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	textbox->smartQuotes = true;
 | 
						textbox->smartQuotes = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4746,9 +4746,9 @@ EsTextbox *EsTextboxCreate(EsElement *parent, uint64_t flags, const EsStyle *sty
 | 
				
			||||||
		textbox->margin->cName = "margin";
 | 
							textbox->margin->cName = "margin";
 | 
				
			||||||
		textbox->margin->messageUser = ProcessTextboxMarginMessage;
 | 
							textbox->margin->messageUser = ProcessTextboxMarginMessage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int marginWidth = textbox->margin->currentStyle->preferredWidth;
 | 
							int marginWidth = textbox->margin->style->preferredWidth;
 | 
				
			||||||
		textbox->borders.l += marginWidth;
 | 
							textbox->borders.l += marginWidth;
 | 
				
			||||||
		textbox->insets.l += marginWidth + textbox->margin->currentStyle->gapMajor;
 | 
							textbox->insets.l += marginWidth + textbox->margin->style->gapMajor;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return textbox;
 | 
						return textbox;
 | 
				
			||||||
| 
						 | 
					@ -4994,7 +4994,7 @@ int ProcessTextDisplayMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (!display->plan || display->planWidth != textBounds.r - textBounds.l || display->planHeight != textBounds.b - textBounds.t) {
 | 
							if (!display->plan || display->planWidth != textBounds.r - textBounds.l || display->planHeight != textBounds.b - textBounds.t) {
 | 
				
			||||||
			if (display->plan) EsTextPlanDestroy(display->plan);
 | 
								if (display->plan) EsTextPlanDestroy(display->plan);
 | 
				
			||||||
			display->properties.flags = display->currentStyle->textAlign;
 | 
								display->properties.flags = display->style->textAlign;
 | 
				
			||||||
			if (~display->flags & ES_TEXT_DISPLAY_PREFORMATTED) display->properties.flags |= ES_TEXT_PLAN_TRIM_SPACES;
 | 
								if (~display->flags & ES_TEXT_DISPLAY_PREFORMATTED) display->properties.flags |= ES_TEXT_PLAN_TRIM_SPACES;
 | 
				
			||||||
			if (display->flags & ES_TEXT_DISPLAY_NO_FONT_SUBSTITUTION) display->properties.flags |= ES_TEXT_PLAN_NO_FONT_SUBSTITUTION;
 | 
								if (display->flags & ES_TEXT_DISPLAY_NO_FONT_SUBSTITUTION) display->properties.flags |= ES_TEXT_PLAN_NO_FONT_SUBSTITUTION;
 | 
				
			||||||
			display->plan = EsTextPlanCreate(element, &display->properties, textBounds, display->contents, display->textRuns, display->textRunCount);
 | 
								display->plan = EsTextPlanCreate(element, &display->properties, textBounds, display->contents, display->textRuns, display->textRunCount);
 | 
				
			||||||
| 
						 | 
					@ -5008,7 +5008,7 @@ int ProcessTextDisplayMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
	} else if (message->type == ES_MSG_GET_WIDTH || message->type == ES_MSG_GET_HEIGHT) {
 | 
						} else if (message->type == ES_MSG_GET_WIDTH || message->type == ES_MSG_GET_HEIGHT) {
 | 
				
			||||||
		if (!display->measurementCache.Get(message, &display->state)) {
 | 
							if (!display->measurementCache.Get(message, &display->state)) {
 | 
				
			||||||
			if (display->plan) EsTextPlanDestroy(display->plan);
 | 
								if (display->plan) EsTextPlanDestroy(display->plan);
 | 
				
			||||||
			display->properties.flags = display->currentStyle->textAlign | ((display->flags & ES_TEXT_DISPLAY_PREFORMATTED) ? 0 : ES_TEXT_PLAN_TRIM_SPACES);
 | 
								display->properties.flags = display->style->textAlign | ((display->flags & ES_TEXT_DISPLAY_PREFORMATTED) ? 0 : ES_TEXT_PLAN_TRIM_SPACES);
 | 
				
			||||||
			EsRectangle insets = EsElementGetInsets(element);
 | 
								EsRectangle insets = EsElementGetInsets(element);
 | 
				
			||||||
			display->planWidth = message->type == ES_MSG_GET_HEIGHT && message->measure.width 
 | 
								display->planWidth = message->type == ES_MSG_GET_HEIGHT && message->measure.width 
 | 
				
			||||||
				? (message->measure.width - insets.l - insets.r) : 0;
 | 
									? (message->measure.width - insets.l - insets.r) : 0;
 | 
				
			||||||
| 
						 | 
					@ -5078,12 +5078,12 @@ void EsTextDisplaySetContents(EsTextDisplay *display, const char *string, ptrdif
 | 
				
			||||||
	if (display->flags & ES_TEXT_DISPLAY_RICH_TEXT) {
 | 
						if (display->flags & ES_TEXT_DISPLAY_RICH_TEXT) {
 | 
				
			||||||
		EsHeapFree(display->contents);
 | 
							EsHeapFree(display->contents);
 | 
				
			||||||
		EsTextStyle baseStyle = {};
 | 
							EsTextStyle baseStyle = {};
 | 
				
			||||||
		display->currentStyle->GetTextStyle(&baseStyle);
 | 
							display->style->GetTextStyle(&baseStyle);
 | 
				
			||||||
		EsRichTextParse(string, stringBytes, &display->contents, &display->textRuns, &display->textRunCount, &baseStyle);
 | 
							EsRichTextParse(string, stringBytes, &display->contents, &display->textRuns, &display->textRunCount, &baseStyle);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		HeapDuplicate((void **) &display->contents, (size_t *) &stringBytes, string, stringBytes);
 | 
							HeapDuplicate((void **) &display->contents, (size_t *) &stringBytes, string, stringBytes);
 | 
				
			||||||
		display->textRuns = (EsTextRun *) EsHeapAllocate(sizeof(EsTextRun) * 2, true);
 | 
							display->textRuns = (EsTextRun *) EsHeapAllocate(sizeof(EsTextRun) * 2, true);
 | 
				
			||||||
		display->currentStyle->GetTextStyle(&display->textRuns[0].style);
 | 
							display->style->GetTextStyle(&display->textRuns[0].style);
 | 
				
			||||||
		display->textRuns[1].offset = stringBytes;
 | 
							display->textRuns[1].offset = stringBytes;
 | 
				
			||||||
		display->textRunCount = 1;
 | 
							display->textRunCount = 1;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -5119,7 +5119,7 @@ void EsTextDisplaySetupSyntaxHighlighting(EsTextDisplay *display, uint32_t langu
 | 
				
			||||||
	EsMemoryCopy(colors, customColors, customColorCount * sizeof(uint32_t));
 | 
						EsMemoryCopy(colors, customColors, customColorCount * sizeof(uint32_t));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EsTextStyle textStyle = {};
 | 
						EsTextStyle textStyle = {};
 | 
				
			||||||
	display->currentStyle->GetTextStyle(&textStyle);
 | 
						display->style->GetTextStyle(&textStyle);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	EsTextRun *newRuns = TextApplySyntaxHighlighting(&textStyle, language, colors, {}, 
 | 
						EsTextRun *newRuns = TextApplySyntaxHighlighting(&textStyle, language, colors, {}, 
 | 
				
			||||||
			display->contents, display->textRuns[display->textRunCount].offset).array;
 | 
								display->contents, display->textRuns[display->textRunCount].offset).array;
 | 
				
			||||||
| 
						 | 
					@ -5142,7 +5142,7 @@ int ProcessListDisplayMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (message->type == ES_MSG_GET_HEIGHT) {
 | 
						if (message->type == ES_MSG_GET_HEIGHT) {
 | 
				
			||||||
		int32_t height = 0;
 | 
							int32_t height = 0;
 | 
				
			||||||
		int32_t margin = element->currentStyle->insets.l + element->currentStyle->insets.r + element->currentStyle->gapMinor;
 | 
							int32_t margin = element->style->insets.l + element->style->insets.r + element->style->gapMinor;
 | 
				
			||||||
		uintptr_t itemCount = 0;
 | 
							uintptr_t itemCount = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (uintptr_t i = 0; i < element->GetChildCount(); i++) {
 | 
							for (uintptr_t i = 0; i < element->GetChildCount(); i++) {
 | 
				
			||||||
| 
						 | 
					@ -5153,21 +5153,21 @@ int ProcessListDisplayMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (itemCount) {
 | 
							if (itemCount) {
 | 
				
			||||||
			height += (itemCount - 1) * element->currentStyle->gapMajor;
 | 
								height += (itemCount - 1) * element->style->gapMajor;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		message->measure.height = height + element->currentStyle->insets.t + element->currentStyle->insets.b;
 | 
							message->measure.height = height + element->style->insets.t + element->style->insets.b;
 | 
				
			||||||
	} else if (message->type == ES_MSG_LAYOUT) {
 | 
						} else if (message->type == ES_MSG_LAYOUT) {
 | 
				
			||||||
		int32_t position = element->currentStyle->insets.t;
 | 
							int32_t position = element->style->insets.t;
 | 
				
			||||||
		int32_t margin = element->currentStyle->insets.l + element->currentStyle->gapMinor;
 | 
							int32_t margin = element->style->insets.l + element->style->gapMinor;
 | 
				
			||||||
		int32_t width = element->width - margin - element->currentStyle->insets.r;
 | 
							int32_t width = element->width - margin - element->style->insets.r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for (uintptr_t i = 0; i < element->GetChildCount(); i++) {
 | 
							for (uintptr_t i = 0; i < element->GetChildCount(); i++) {
 | 
				
			||||||
			EsElement *child = element->GetChild(i);
 | 
								EsElement *child = element->GetChild(i);
 | 
				
			||||||
			if (child->flags & ES_ELEMENT_NON_CLIENT) continue;
 | 
								if (child->flags & ES_ELEMENT_NON_CLIENT) continue;
 | 
				
			||||||
			int height = child->GetHeight(width);
 | 
								int height = child->GetHeight(width);
 | 
				
			||||||
			EsElementMove(child, margin, position, width, height);
 | 
								EsElementMove(child, margin, position, width, height);
 | 
				
			||||||
			position += height + element->currentStyle->gapMajor;
 | 
								position += height + element->style->gapMajor;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else if (message->type == ES_MSG_PAINT) {
 | 
						} else if (message->type == ES_MSG_PAINT) {
 | 
				
			||||||
		char buffer[64];
 | 
							char buffer[64];
 | 
				
			||||||
| 
						 | 
					@ -5176,7 +5176,7 @@ int ProcessListDisplayMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
		EsTextRun textRun[2] = {};
 | 
							EsTextRun textRun[2] = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		EsRectangle bounds = EsPainterBoundsClient(message->painter); 
 | 
							EsRectangle bounds = EsPainterBoundsClient(message->painter); 
 | 
				
			||||||
		bounds.r = bounds.l + element->currentStyle->insets.l;
 | 
							bounds.r = bounds.l + element->style->insets.l;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		uintptr_t counter = display->previous ? display->previous->itemCount : display->startIndex;
 | 
							uintptr_t counter = display->previous ? display->previous->itemCount : display->startIndex;
 | 
				
			||||||
		uint8_t markerType = element->flags & ES_LIST_DISPLAY_MARKER_TYPE_MASK;
 | 
							uint8_t markerType = element->flags & ES_LIST_DISPLAY_MARKER_TYPE_MASK;
 | 
				
			||||||
| 
						 | 
					@ -5204,7 +5204,7 @@ int ProcessListDisplayMessage(EsElement *element, EsMessage *message) {
 | 
				
			||||||
				EsAssert(false);
 | 
									EsAssert(false);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			child->currentStyle->GetTextStyle(&textRun[0].style);
 | 
								child->style->GetTextStyle(&textRun[0].style);
 | 
				
			||||||
			textRun[0].style.figures = ES_TEXT_FIGURE_TABULAR;
 | 
								textRun[0].style.figures = ES_TEXT_FIGURE_TABULAR;
 | 
				
			||||||
			bounds.t += child->offsetY;
 | 
								bounds.t += child->offsetY;
 | 
				
			||||||
			bounds.b = bounds.t + child->height;
 | 
								bounds.b = bounds.t + child->height;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -140,7 +140,7 @@ File FileOpen(const char *path, char mode) {
 | 
				
			||||||
// Toolchain flags:
 | 
					// Toolchain flags:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const char *commonCompileFlagsFreestanding = " -ffreestanding -fno-exceptions ";
 | 
					const char *commonCompileFlagsFreestanding = " -ffreestanding -fno-exceptions ";
 | 
				
			||||||
char commonCompileFlags[4096] = " -Wall -Wextra -Wno-missing-field-initializers -Wno-frame-address -Wno-unused-function -Wno-format-truncation -g -I. ";
 | 
					char commonCompileFlags[4096] = " -Wall -Wextra -Wno-missing-field-initializers -Wno-frame-address -Wno-unused-function -Wno-format-truncation -g -I. -fdiagnostics-column-unit=byte ";
 | 
				
			||||||
char commonCompileFlagsWithCStdLib[4096];
 | 
					char commonCompileFlagsWithCStdLib[4096];
 | 
				
			||||||
char cCompileFlags[4096] = "";
 | 
					char cCompileFlags[4096] = "";
 | 
				
			||||||
char cppCompileFlags[4096] = " -std=c++14 -Wno-pmf-conversions -Wno-invalid-offsetof -fno-rtti ";
 | 
					char cppCompileFlags[4096] = " -std=c++14 -Wno-pmf-conversions -Wno-invalid-offsetof -fno-rtti ";
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue