ios stuff + keyboard

This commit is contained in:
Vladislav Khorev 2014-01-06 07:44:33 +00:00
parent 33040259bd
commit a968ce2ad0
6 changed files with 32 additions and 14 deletions

View File

@ -139,9 +139,8 @@ protected:
std::map<int, vec2> TotalShift;
boost::mutex WidgetListMutex;
bool KeyboardIsOnScreen;
public:
bool KeyboardIsOnScreen;
boost::signal<void(int)> KeyPressedSignal;
boost::signal<void(std::string)> SetTextSignal;

View File

@ -23,8 +23,8 @@ std::string IosGetFilePathUserData(const std::string& filename);
void IosSwitchToScreen();
void ShowKeyboard(std::string text);
void HideKeyboard();
void ClearKeyboardText();
bool IsIpad();

View File

@ -685,12 +685,7 @@ void TEdit::SetText(const std::string& newText)
void TEdit::OnSetAllText(std::string newText)
{
if (newText != TextParams.Text)
{
TextParams.Text = newText;
RefreshTextTriangleList();
}
SetText(newText);
}

View File

@ -11,6 +11,7 @@ const std::string CONST_TAPDOWN_SIGNAL_NAME = "OnTapDown";
boost::mutex KeyMutex;
void GuiManagerSetKeyboardText(std::string newText)
{
KeyMutex.lock();
@ -18,6 +19,12 @@ void GuiManagerSetKeyboardText(std::string newText)
KeyMutex.unlock();
}
void GuiOnKeyboardHide()
{
ResourceManager->GUIManager.KeyboardIsOnScreen = false;
ResourceManager->GUIManager.OnKeyboardHideSignal();
ResourceManager->GUIManager.OnKeyboardHideSignal.disconnect_all_slots();
}
TGUIManager::TGUIManager()

View File

@ -74,6 +74,11 @@ void HideKeyboard()
[extKeyboardTextView resignFirstResponder];
}
void ClearKeyboardText()
{
extKeyboardTextView.text = @"";
}
void GuiManagerSetKeyboardText(std::string newText); //Find it in GUIManager.cpp
void SetKeyboardText(const char* newText)
@ -83,12 +88,21 @@ void SetKeyboardText(const char* newText)
//NSLog(@"text: %s", newText);
}
void GuiOnKeyboardHide(); //Find it in GUIManager.cpp
void OnKeyboardHide()
{
SE::PerformInMainThreadAsync(&GuiOnKeyboardHide);
}
bool IsIpad()
{
if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
{
return YES; /* Device is iPad */
}
return NO;
}
} //namespace SE

View File

@ -18,7 +18,7 @@ namespace SE
{
void SetKeyboardText(const char* newText);
void OnKeyboardHide();
}
@ -157,7 +157,10 @@ void SetKeyboardText(const char* newText);
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
if([string isEqualToString:@"\n"])
{
[textField resignFirstResponder];
SE::OnKeyboardHide();
}
return YES;
}