diff options
author | Vojtech Bocek <vbocek@gmail.com> | 2014-03-13 17:36:52 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit> | 2014-04-16 17:51:17 +0200 |
commit | 0b7fe504dc93246957aee38c0d93ea1fa1580fab (patch) | |
tree | 77a4471931591355c383074c480b91d8b71840e5 /gui/pages.cpp | |
parent | Add additional search path for brightness (diff) | |
download | android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.gz android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.bz2 android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.lz android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.xz android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.tar.zst android_bootable_recovery-0b7fe504dc93246957aee38c0d93ea1fa1580fab.zip |
Diffstat (limited to 'gui/pages.cpp')
-rw-r--r-- | gui/pages.cpp | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/gui/pages.cpp b/gui/pages.cpp index 2953eddb8..398224e17 100644 --- a/gui/pages.cpp +++ b/gui/pages.cpp @@ -55,6 +55,7 @@ std::map<std::string, PageSet*> PageManager::mPageSets; PageSet* PageManager::mCurrentSet; PageSet* PageManager::mBaseSet = NULL; MouseCursor *PageManager::mMouseCursor = NULL; +HardwareKeyboard *PageManager::mHardwareKeyboard = NULL; // Helper routine to convert a string to a color declaration int ConvertStrToColor(std::string str, COLOR* color) @@ -447,7 +448,7 @@ int Page::NotifyTouch(TOUCH_STATE state, int x, int y) return ret; } -int Page::NotifyKey(int key) +int Page::NotifyKey(int key, bool down) { std::vector<ActionObject*>::reverse_iterator iter; @@ -455,16 +456,17 @@ int Page::NotifyKey(int key) if (mActions.size() == 0) return 1; + int ret = 1; // We work backwards, from top-most element to bottom-most element for (iter = mActions.rbegin(); iter != mActions.rend(); iter++) { - int ret = (*iter)->NotifyKey(key); - if (ret == 0) - return 0; - else if (ret < 0) - LOGERR("An action handler has returned an error"); + ret = (*iter)->NotifyKey(key, down); + if (ret < 0) { + LOGERR("An action handler has returned an error\n"); + ret = 1; + } } - return 1; + return ret; } int Page::NotifyKeyboard(int key) @@ -719,12 +721,12 @@ int PageSet::NotifyTouch(TOUCH_STATE state, int x, int y) return (mCurrentPage ? mCurrentPage->NotifyTouch(state, x, y) : -1); } -int PageSet::NotifyKey(int key) +int PageSet::NotifyKey(int key, bool down) { if (mOverlayPage) - return (mOverlayPage->NotifyKey(key)); + return (mOverlayPage->NotifyKey(key, down)); - return (mCurrentPage ? mCurrentPage->NotifyKey(key) : -1); + return (mCurrentPage ? mCurrentPage->NotifyKey(key, down) : -1); } int PageSet::NotifyKeyboard(int key) @@ -964,6 +966,13 @@ int PageManager::Render(void) return res; } +HardwareKeyboard *PageManager::GetHardwareKeyboard() +{ + if(!mHardwareKeyboard) + mHardwareKeyboard = new HardwareKeyboard(); + return mHardwareKeyboard; +} + MouseCursor *PageManager::GetMouseCursor() { if(!mMouseCursor) @@ -1002,9 +1011,9 @@ int PageManager::NotifyTouch(TOUCH_STATE state, int x, int y) return (mCurrentSet ? mCurrentSet->NotifyTouch(state, x, y) : -1); } -int PageManager::NotifyKey(int key) +int PageManager::NotifyKey(int key, bool down) { - return (mCurrentSet ? mCurrentSet->NotifyKey(key) : -1); + return (mCurrentSet ? mCurrentSet->NotifyKey(key, down) : -1); } int PageManager::NotifyKeyboard(int key) |