ios stuff + keyboard
This commit is contained in:
parent
33040259bd
commit
a968ce2ad0
@ -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;
|
||||
|
@ -23,8 +23,8 @@ std::string IosGetFilePathUserData(const std::string& filename);
|
||||
void IosSwitchToScreen();
|
||||
|
||||
void ShowKeyboard(std::string text);
|
||||
|
||||
void HideKeyboard();
|
||||
void ClearKeyboardText();
|
||||
|
||||
bool IsIpad();
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user