console backend - support async event queue, timers, tooltips

This commit is contained in:
Vadim Lopatin 2016-09-13 16:00:29 +03:00
parent 5fc7825c82
commit 380bc94f19
3 changed files with 18 additions and 2 deletions

View File

@ -1222,6 +1222,14 @@ class Window : CustomEventTarget {
Log.d("override scheduleSystemTimer to support timers"); Log.d("override scheduleSystemTimer to support timers");
} }
/// poll expired timers; returns true if update is needed
bool pollTimers() {
bool res = _timerQueue.notify();
if (res)
update(false);
return res;
}
/// system timer interval expired - notify queue /// system timer interval expired - notify queue
protected void onTimer() { protected void onTimer() {
//Log.d("window.onTimer"); //Log.d("window.onTimer");

View File

@ -68,6 +68,7 @@ class ConsolePlatform : Platform {
_console.resizeEvent = &onConsoleResize; _console.resizeEvent = &onConsoleResize;
_console.inputIdleEvent = &onInputIdle; _console.inputIdleEvent = &onInputIdle;
_console.init(); _console.init();
_console.setCursorType(ConsoleCursorType.Invisible);
_drawBuf = new ConsoleDrawBuf(_console); _drawBuf = new ConsoleDrawBuf(_console);
} }
@ -154,7 +155,13 @@ class ConsolePlatform : Platform {
} }
_needRedraw = false; _needRedraw = false;
} }
protected bool onInputIdle() { protected bool onInputIdle() {
checkClosedWindows();
foreach(w; _windowList) {
w.pollTimers();
w.handlePostedEvents();
}
checkClosedWindows(); checkClosedWindows();
redraw(); redraw();
_console.flush(); _console.flush();

View File

@ -423,12 +423,12 @@
padding="0,0,0,0" padding="0,0,0,0"
/> />
<style id="TOOLTIP" <style id="TOOLTIP"
backgroundImageId="tooltip_background" backgroundColor="#808080"
layoutWidth="WRAP_CONTENT" layoutWidth="WRAP_CONTENT"
layoutHeight="WRAP_CONTENT" layoutHeight="WRAP_CONTENT"
margins="0,0,0,0" margins="0,0,0,0"
padding="1,0,1,0" padding="1,0,1,0"
textColor="#404040" textColor="#00FFFF"
/> />
<style id="TOOLBAR" <style id="TOOLBAR"
backgroundColor="#000000" backgroundColor="#000000"
@ -443,6 +443,7 @@
padding="0,0,0,0" padding="0,0,0,0"
backgroundImageId="{'┌─┐' '│ │' '└─┘' 0x808000 bc 0xFFFFFFFF ninepatch 1 1 1 1 padding 1 1 1 1}" backgroundImageId="{'┌─┐' '│ │' '└─┘' 0x808000 bc 0xFFFFFFFF ninepatch 1 1 1 1 padding 1 1 1 1}"
> >
<state state_enabled="false" backgroundImageId="{'┌─┐' '│ │' '└─┘' 0x808080 bc 0xFFFFFFFF ninepatch 1 1 1 1 padding 1 1 1 1}"/>
<state state_enabled="true" state_hover="true" backgroundImageId="{'┌─┐' '│ │' '└─┘' 0xFFFF00 bc 0xFFFFFFFF ninepatch 1 1 1 1 padding 1 1 1 1}"/> <state state_enabled="true" state_hover="true" backgroundImageId="{'┌─┐' '│ │' '└─┘' 0xFFFF00 bc 0xFFFFFFFF ninepatch 1 1 1 1 padding 1 1 1 1}"/>
</style> </style>
<style id="TOOLBAR_CONTROL" <style id="TOOLBAR_CONTROL"