mirror of https://github.com/buggins/dlangui.git
console window caption on windows
This commit is contained in:
parent
380bc94f19
commit
62a1a156b9
|
@ -143,13 +143,14 @@ class ConsolePlatform : Platform {
|
||||||
_drawBuf.fillRect(Rect(0, 0, w.width, w.height), w.backgroundColor);
|
_drawBuf.fillRect(Rect(0, 0, w.width, w.height), w.backgroundColor);
|
||||||
w.onDraw(_drawBuf);
|
w.onDraw(_drawBuf);
|
||||||
auto caretRect = w.caretRect;
|
auto caretRect = w.caretRect;
|
||||||
if ((w is activeWindow) && !caretRect.empty) {
|
if ((w is activeWindow)) {
|
||||||
if (!caretRect.empty) {
|
if (!caretRect.empty) {
|
||||||
_drawBuf.console.setCursor(caretRect.left, caretRect.top);
|
_drawBuf.console.setCursor(caretRect.left, caretRect.top);
|
||||||
_drawBuf.console.setCursorType(w.caretReplace ? ConsoleCursorType.Replace : ConsoleCursorType.Insert);
|
_drawBuf.console.setCursorType(w.caretReplace ? ConsoleCursorType.Replace : ConsoleCursorType.Insert);
|
||||||
} else {
|
} else {
|
||||||
_drawBuf.console.setCursorType(ConsoleCursorType.Invisible);
|
_drawBuf.console.setCursorType(ConsoleCursorType.Invisible);
|
||||||
}
|
}
|
||||||
|
_drawBuf.console.setWindowCaption(w.windowCaption);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -485,6 +485,20 @@ class Console {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private dstring _windowCaption;
|
||||||
|
void setWindowCaption(dstring str) {
|
||||||
|
if (_windowCaption == str)
|
||||||
|
return;
|
||||||
|
_windowCaption = str;
|
||||||
|
version(Windows) {
|
||||||
|
import std.utf;
|
||||||
|
SetConsoleTitle(toUTF16z(str));
|
||||||
|
} else {
|
||||||
|
// TODO: ANSI terminal caption
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ConsoleCursorType _rawCursorType = ConsoleCursorType.Insert;
|
private ConsoleCursorType _rawCursorType = ConsoleCursorType.Insert;
|
||||||
protected void rawSetCursorType(ConsoleCursorType type) {
|
protected void rawSetCursorType(ConsoleCursorType type) {
|
||||||
if (_rawCursorType == type)
|
if (_rawCursorType == type)
|
||||||
|
|
Loading…
Reference in New Issue