Add True and False tests for bitwise enums

This commit is contained in:
Jack Andersen 2019-04-02 18:30:35 -10:00
parent 9bb21b0b32
commit 8ba5cf9a8b
4 changed files with 6 additions and 6 deletions

View File

@ -405,7 +405,7 @@ void FileBrowser::touchMove(const boo::STouchCoord& coord, uintptr_t tid) {}
void FileBrowser::charKeyDown(unsigned long charcode, boo::EModifierKey mod, bool isRepeat) {
if (skipBuildInAnimation() || closed())
return;
if ((mod & boo::EModifierKey::CtrlCommand) != boo::EModifierKey::None && !isRepeat) {
if (True(mod & boo::EModifierKey::CtrlCommand) && !isRepeat) {
if (charcode == 'h' || charcode == 'H')
setShowingHidden(!showingHidden());
else if (charcode == 'r' || charcode == 'R')

View File

@ -446,7 +446,7 @@ void RootView::touchMove(const boo::STouchCoord& coord, uintptr_t tid) {
void RootView::charKeyDown(unsigned long charCode, boo::EModifierKey mods, bool isRepeat) {
for (View* v : m_views)
v->charKeyDown(charCode, mods, isRepeat);
if (m_activeTextView && (mods & (boo::EModifierKey::Ctrl | boo::EModifierKey::Command)) != boo::EModifierKey::None) {
if (m_activeTextView && True(mods & (boo::EModifierKey::Ctrl | boo::EModifierKey::Command))) {
if (charCode == 'c' || charCode == 'C')
m_activeTextView->clipboardCopy();
else if (charCode == 'x' || charCode == 'X')
@ -462,7 +462,7 @@ void RootView::charKeyUp(unsigned long charCode, boo::EModifierKey mods) {
}
void RootView::specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, bool isRepeat) {
if (key == boo::ESpecialKey::Enter && (mods & boo::EModifierKey::Alt) != boo::EModifierKey::None) {
if (key == boo::ESpecialKey::Enter && True(mods & boo::EModifierKey::Alt)) {
m_window->setFullscreen(!m_window->isFullscreen());
return;
}

View File

@ -320,7 +320,7 @@ void TextField::specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, boo
return;
if (key == boo::ESpecialKey::Left) {
if ((mods & boo::EModifierKey::Shift) != boo::EModifierKey::None) {
if (True(mods & boo::EModifierKey::Shift)) {
if (m_cursorPos) {
size_t origPos = m_cursorPos;
if (m_selectionCount) {
@ -338,7 +338,7 @@ void TextField::specialKeyDown(boo::ESpecialKey key, boo::EModifierKey mods, boo
setCursorPos(m_cursorPos == 0 ? 0 : (m_cursorPos - 1));
}
} else if (key == boo::ESpecialKey::Right) {
if ((mods & boo::EModifierKey::Shift) != boo::EModifierKey::None) {
if (True(mods & boo::EModifierKey::Shift)) {
std::string_view textStr(m_textStr);
size_t len = UTF8Iterator(textStr.cbegin()).countTo(textStr.cend());
if (m_cursorPos < len) {

@ -1 +1 @@
Subproject commit 2edc75f7935573e6022be739b4058f56ae8665d2
Subproject commit 617875531acd375e77f142fdb04fd219162c1237