diff --git a/include/GUIManager/GUIManager.h b/include/GUIManager/GUIManager.h index 4ee981e..a77562e 100644 --- a/include/GUIManager/GUIManager.h +++ b/include/GUIManager/GUIManager.h @@ -145,7 +145,8 @@ public: boost::signal KeyPressedSignal; boost::signal SetTextSignal; - //boost::signal PostUpdateSignal; + boost::signal OnKeyboardShowSignal; + boost::signal OnKeyboardHideSignal; TGUIManager(); @@ -178,6 +179,8 @@ public: void ShowKeyboard(const std::string text = ""); void HideKeyboard(); + bool IsKeyboardOnScreen(); + void PrintWidgetList(); diff --git a/src/GUIManager/GUIManager.cpp b/src/GUIManager/GUIManager.cpp index f716797..7ea68aa 100644 --- a/src/GUIManager/GUIManager.cpp +++ b/src/GUIManager/GUIManager.cpp @@ -108,12 +108,15 @@ void TGUIManager::Update(cardinal dt) for (TWidgetArr::iterator i = WidgetArr.begin(); i != WidgetArr.end(); ++i) { - i->Widget->Update(dt); + //i->Widget->Update(dt); if (i->IsMouseDown) { signalMap.push_back((i->SignalMap[CONST_HOLD_SIGNAL_NAME])); } + + i->Widget->Update(dt); + } //Keep this outside since signal may affect WidgetArr @@ -456,24 +459,37 @@ void TGUIManager::OnMove(vec2 shift, int touchNumber) void TGUIManager::ShowKeyboard(const std::string text) { -#ifdef TARGET_IOS - SE::ShowKeyboard(text); -#endif - /* if (!KeyboardIsOnScreen) { - MoveWidget("Keyboard", vec2(0, 216)); +#ifdef TARGET_IOS + SE::ShowKeyboard(text); +#endif + /* + if (!KeyboardIsOnScreen) + { + MoveWidget("Keyboard", vec2(0, 216)); + KeyboardIsOnScreen = true; + }*/ + + OnKeyboardShowSignal(); KeyboardIsOnScreen = true; - }*/ + } } void TGUIManager::HideKeyboard() { - ResourceManager->GUIManager.SetTextSignal.disconnect_all_slots(); + if (KeyboardIsOnScreen) + { + ResourceManager->GUIManager.SetTextSignal.disconnect_all_slots(); #ifdef TARGET_IOS - SE::HideKeyboard(); + SE::HideKeyboard(); #endif + OnKeyboardHideSignal(); + OnKeyboardShowSignal.disconnect_all_slots(); + OnKeyboardHideSignal.disconnect_all_slots(); + KeyboardIsOnScreen = false; + } /* if (KeyboardIsOnScreen) { @@ -482,6 +498,11 @@ void TGUIManager::HideKeyboard() }*/ } +bool TGUIManager::IsKeyboardOnScreen() +{ + return KeyboardIsOnScreen; +} + void TGUIManager::PrintWidgetList() { TWidgetArr::iterator i;