Enter key closes Cel or Layer properties if children have the focus

This commit is contained in:
David Capello 2015-08-21 14:53:31 -03:00
parent 4b064333cc
commit 5dfe7b64ae
2 changed files with 22 additions and 0 deletions

View File

@ -117,6 +117,16 @@ private:
bool onProcessMessage(ui::Message* msg) override {
switch (msg->type()) {
case kKeyDownMessage:
if (opacity()->hasFocus()) {
if (static_cast<KeyMessage*>(msg)->scancode() == kKeyEnter) {
onCommitChange();
closeWindow(this);
return true;
}
}
break;
case kCloseMessage:
// Save changes before we close the window
setCel(nullptr, nullptr);

View File

@ -132,6 +132,18 @@ private:
bool onProcessMessage(ui::Message* msg) override {
switch (msg->type()) {
case kKeyDownMessage:
if (name()->hasFocus() ||
opacity()->hasFocus() ||
mode()->hasFocus()) {
if (static_cast<KeyMessage*>(msg)->scancode() == kKeyEnter) {
onCommitChange();
closeWindow(this);
return true;
}
}
break;
case kCloseMessage:
// Save changes before we close the window
setLayer(nullptr);