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,9 +23,9 @@ std::string IosGetFilePathUserData(const std::string& filename);
|
||||
void IosSwitchToScreen();
|
||||
|
||||
void ShowKeyboard(std::string text);
|
||||
|
||||
void HideKeyboard();
|
||||
void ClearKeyboardText();
|
||||
|
||||
bool IsIpad();
|
||||
bool IsIpad();
|
||||
|
||||
} //namespace SE
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -10,7 +10,8 @@ const std::string CONST_DRAG_SIGNAL_NAME = "OnDrag";
|
||||
const std::string CONST_TAPDOWN_SIGNAL_NAME = "OnTapDown";
|
||||
|
||||
|
||||
boost::mutex KeyMutex;
|
||||
boost::mutex KeyMutex;
|
||||
|
||||
void GuiManagerSetKeyboardText(std::string newText)
|
||||
{
|
||||
KeyMutex.lock();
|
||||
@ -18,8 +19,14 @@ void GuiManagerSetKeyboardText(std::string newText)
|
||||
KeyMutex.unlock();
|
||||
}
|
||||
|
||||
void GuiOnKeyboardHide()
|
||||
{
|
||||
ResourceManager->GUIManager.KeyboardIsOnScreen = false;
|
||||
ResourceManager->GUIManager.OnKeyboardHideSignal();
|
||||
ResourceManager->GUIManager.OnKeyboardHideSignal.disconnect_all_slots();
|
||||
}
|
||||
|
||||
|
||||
|
||||
TGUIManager::TGUIManager()
|
||||
: KeyboardIsOnScreen(false)
|
||||
{
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
bool IsIpad()
|
||||
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