mirror of https://github.com/buggins/dlangui.git
reduce relayouts
This commit is contained in:
parent
c6b5028ff1
commit
4df4c0fc04
|
@ -527,7 +527,7 @@ class Win32FontManager : FontManager {
|
||||||
override ref FontRef getFont(int size, int weight, bool italic, FontFamily family, string face) {
|
override ref FontRef getFont(int size, int weight, bool italic, FontFamily family, string face) {
|
||||||
//Log.i("getFont()");
|
//Log.i("getFont()");
|
||||||
FontDef * def = findFace(family, face);
|
FontDef * def = findFace(family, face);
|
||||||
Log.i("getFont() found face ", def.face, " by requested face ", face);
|
//Log.i("getFont() found face ", def.face, " by requested face ", face);
|
||||||
if (def !is null) {
|
if (def !is null) {
|
||||||
int index = _activeFonts.find(size, weight, italic, def.family, def.face);
|
int index = _activeFonts.find(size, weight, italic, def.family, def.face);
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
|
|
|
@ -529,6 +529,10 @@ class ListWidget : WidgetGroup, OnScrollHandler {
|
||||||
pwidth -= m.left + m.right + p.left + p.right;
|
pwidth -= m.left + m.right + p.left + p.right;
|
||||||
if (parentHeight != SIZE_UNSPECIFIED)
|
if (parentHeight != SIZE_UNSPECIFIED)
|
||||||
pheight -= m.top + m.bottom + p.top + p.bottom;
|
pheight -= m.top + m.bottom + p.top + p.bottom;
|
||||||
|
|
||||||
|
bool oldNeedLayout = _needLayout;
|
||||||
|
Visibility oldScrollbarVisibility = _scrollbar.visibility;
|
||||||
|
|
||||||
_scrollbar.visibility = Visibility.Visible;
|
_scrollbar.visibility = Visibility.Visible;
|
||||||
_scrollbar.measure(pwidth, pheight);
|
_scrollbar.measure(pwidth, pheight);
|
||||||
|
|
||||||
|
@ -606,6 +610,10 @@ class ListWidget : WidgetGroup, OnScrollHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
measuredContent(parentWidth, parentHeight, sz.x + _sbsz.x, sz.y + _sbsz.y);
|
measuredContent(parentWidth, parentHeight, sz.x + _sbsz.x, sz.y + _sbsz.y);
|
||||||
|
if (_scrollbar.visibility == oldScrollbarVisibility) {
|
||||||
|
_needLayout = oldNeedLayout;
|
||||||
|
_scrollbar.cancelLayout();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -715,6 +723,8 @@ class ListWidget : WidgetGroup, OnScrollHandler {
|
||||||
makeSelectionVisible();
|
makeSelectionVisible();
|
||||||
_makeSelectionVisibleOnNextLayout = false;
|
_makeSelectionVisibleOnNextLayout = false;
|
||||||
}
|
}
|
||||||
|
_needLayout = false;
|
||||||
|
_scrollbar.cancelLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Draw widget at its position to buffer
|
/// Draw widget at its position to buffer
|
||||||
|
|
|
@ -779,6 +779,12 @@ class MainMenu : MenuWidgetBase {
|
||||||
deactivate();
|
deactivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// request relayout of widget and its children
|
||||||
|
//override void requestLayout() {
|
||||||
|
// Log.d("MainMenu.requestLayout is called");
|
||||||
|
// super.requestLayout();
|
||||||
|
//}
|
||||||
|
|
||||||
/// bring focus to main menu, if not yet activated
|
/// bring focus to main menu, if not yet activated
|
||||||
void activate() {
|
void activate() {
|
||||||
debug(DebugMenus) Log.d("activating main menu");
|
debug(DebugMenus) Log.d("activating main menu");
|
||||||
|
|
|
@ -927,6 +927,10 @@ class Widget {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cancelLayout() {
|
||||||
|
_needLayout = false;
|
||||||
|
}
|
||||||
|
|
||||||
/// set new timer to call onTimer() after specified interval (for recurred notifications, return true from onTimer)
|
/// set new timer to call onTimer() after specified interval (for recurred notifications, return true from onTimer)
|
||||||
ulong setTimer(long intervalMillis) {
|
ulong setTimer(long intervalMillis) {
|
||||||
return window.setTimer(this, intervalMillis);
|
return window.setTimer(this, intervalMillis);
|
||||||
|
|
Loading…
Reference in New Issue