mirror of https://github.com/adamdruppe/arsd.git
more tab stuff
This commit is contained in:
parent
5ad3faea13
commit
46a3cf2e1e
27
minigui.d
27
minigui.d
|
@ -792,6 +792,15 @@ class Window : Widget {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
bool skipNextChar = false;
|
||||||
|
|
||||||
|
addEventListener("char", (Widget, Event ev) {
|
||||||
|
if(skipNextChar) {
|
||||||
|
ev.preventDefault();
|
||||||
|
skipNextChar = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
defaultEventHandlers["keydown"] = delegate void(Widget ignored, Event event) {
|
defaultEventHandlers["keydown"] = delegate void(Widget ignored, Event event) {
|
||||||
Widget _this = event.target;
|
Widget _this = event.target;
|
||||||
|
@ -822,8 +831,18 @@ class Window : Widget {
|
||||||
|
|
||||||
if(tabOrdering.length) {
|
if(tabOrdering.length) {
|
||||||
bool seenThis = false;
|
bool seenThis = false;
|
||||||
|
Widget previous;
|
||||||
foreach(idx, child; tabOrdering) {
|
foreach(idx, child; tabOrdering) {
|
||||||
if(child is focusedWidget) {
|
if(child is focusedWidget) {
|
||||||
|
|
||||||
|
if(event.shiftKey) {
|
||||||
|
if(idx == 0)
|
||||||
|
recipient = tabOrdering[$-1];
|
||||||
|
else
|
||||||
|
recipient = tabOrdering[idx - 1];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
seenThis = true;
|
seenThis = true;
|
||||||
if(idx + 1 == tabOrdering.length) {
|
if(idx + 1 == tabOrdering.length) {
|
||||||
// we're at the end, either move to the next group
|
// we're at the end, either move to the next group
|
||||||
|
@ -836,17 +855,20 @@ class Window : Widget {
|
||||||
recipient = child;
|
recipient = child;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
previous = child;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(recipient !is null) {
|
if(recipient !is null) {
|
||||||
import std.stdio; writeln(typeid(recipient));
|
// import std.stdio; writeln(typeid(recipient));
|
||||||
version(Windows) {
|
version(Windows) {
|
||||||
if(recipient.hwnd !is null)
|
if(recipient.hwnd !is null)
|
||||||
SetFocus(recipient.hwnd);
|
SetFocus(recipient.hwnd);
|
||||||
} else {
|
} else {
|
||||||
focusedWidget = recipient;
|
focusedWidget = recipient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
skipNextChar = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -890,6 +912,7 @@ class Window : Widget {
|
||||||
auto event = new Event(ev.pressed ? "keydown" : "keyup", focusedWidget);
|
auto event = new Event(ev.pressed ? "keydown" : "keyup", focusedWidget);
|
||||||
event.character = ev.character;
|
event.character = ev.character;
|
||||||
event.key = ev.key;
|
event.key = ev.key;
|
||||||
|
event.shiftKey = (ev.modifierState & ModifierState.shift) ? true : false;
|
||||||
event.dispatch();
|
event.dispatch();
|
||||||
}
|
}
|
||||||
return super.dispatchKeyEvent(ev);
|
return super.dispatchKeyEvent(ev);
|
||||||
|
@ -2188,6 +2211,8 @@ class Event {
|
||||||
Key key;
|
Key key;
|
||||||
dchar character;
|
dchar character;
|
||||||
|
|
||||||
|
bool shiftKey;
|
||||||
|
|
||||||
private bool isBubbling;
|
private bool isBubbling;
|
||||||
|
|
||||||
/// this sends it only to the target. If you want propagation, use dispatch() instead.
|
/// this sends it only to the target. If you want propagation, use dispatch() instead.
|
||||||
|
|
Loading…
Reference in New Issue