ios stuff + keyboard
This commit is contained in:
parent
33040259bd
commit
a968ce2ad0
@ -139,9 +139,8 @@ protected:
|
|||||||
std::map<int, vec2> TotalShift;
|
std::map<int, vec2> TotalShift;
|
||||||
|
|
||||||
boost::mutex WidgetListMutex;
|
boost::mutex WidgetListMutex;
|
||||||
|
|
||||||
bool KeyboardIsOnScreen;
|
|
||||||
public:
|
public:
|
||||||
|
bool KeyboardIsOnScreen;
|
||||||
|
|
||||||
boost::signal<void(int)> KeyPressedSignal;
|
boost::signal<void(int)> KeyPressedSignal;
|
||||||
boost::signal<void(std::string)> SetTextSignal;
|
boost::signal<void(std::string)> SetTextSignal;
|
||||||
|
@ -23,9 +23,9 @@ std::string IosGetFilePathUserData(const std::string& filename);
|
|||||||
void IosSwitchToScreen();
|
void IosSwitchToScreen();
|
||||||
|
|
||||||
void ShowKeyboard(std::string text);
|
void ShowKeyboard(std::string text);
|
||||||
|
|
||||||
void HideKeyboard();
|
void HideKeyboard();
|
||||||
|
void ClearKeyboardText();
|
||||||
|
|
||||||
bool IsIpad();
|
bool IsIpad();
|
||||||
|
|
||||||
} //namespace SE
|
} //namespace SE
|
||||||
|
@ -685,12 +685,7 @@ void TEdit::SetText(const std::string& newText)
|
|||||||
|
|
||||||
void TEdit::OnSetAllText(std::string newText)
|
void TEdit::OnSetAllText(std::string newText)
|
||||||
{
|
{
|
||||||
if (newText != TextParams.Text)
|
SetText(newText);
|
||||||
{
|
|
||||||
TextParams.Text = newText;
|
|
||||||
|
|
||||||
RefreshTextTriangleList();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,8 @@ const std::string CONST_DRAG_SIGNAL_NAME = "OnDrag";
|
|||||||
const std::string CONST_TAPDOWN_SIGNAL_NAME = "OnTapDown";
|
const std::string CONST_TAPDOWN_SIGNAL_NAME = "OnTapDown";
|
||||||
|
|
||||||
|
|
||||||
boost::mutex KeyMutex;
|
boost::mutex KeyMutex;
|
||||||
|
|
||||||
void GuiManagerSetKeyboardText(std::string newText)
|
void GuiManagerSetKeyboardText(std::string newText)
|
||||||
{
|
{
|
||||||
KeyMutex.lock();
|
KeyMutex.lock();
|
||||||
@ -18,8 +19,14 @@ void GuiManagerSetKeyboardText(std::string newText)
|
|||||||
KeyMutex.unlock();
|
KeyMutex.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GuiOnKeyboardHide()
|
||||||
|
{
|
||||||
|
ResourceManager->GUIManager.KeyboardIsOnScreen = false;
|
||||||
|
ResourceManager->GUIManager.OnKeyboardHideSignal();
|
||||||
|
ResourceManager->GUIManager.OnKeyboardHideSignal.disconnect_all_slots();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
TGUIManager::TGUIManager()
|
TGUIManager::TGUIManager()
|
||||||
: KeyboardIsOnScreen(false)
|
: KeyboardIsOnScreen(false)
|
||||||
{
|
{
|
||||||
|
@ -74,6 +74,11 @@ void HideKeyboard()
|
|||||||
[extKeyboardTextView resignFirstResponder];
|
[extKeyboardTextView resignFirstResponder];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClearKeyboardText()
|
||||||
|
{
|
||||||
|
extKeyboardTextView.text = @"";
|
||||||
|
}
|
||||||
|
|
||||||
void GuiManagerSetKeyboardText(std::string newText); //Find it in GUIManager.cpp
|
void GuiManagerSetKeyboardText(std::string newText); //Find it in GUIManager.cpp
|
||||||
|
|
||||||
void SetKeyboardText(const char* newText)
|
void SetKeyboardText(const char* newText)
|
||||||
@ -83,12 +88,21 @@ void SetKeyboardText(const char* newText)
|
|||||||
//NSLog(@"text: %s", 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 )
|
if ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad )
|
||||||
{
|
{
|
||||||
return YES; /* Device is iPad */
|
return YES; /* Device is iPad */
|
||||||
}
|
}
|
||||||
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
} //namespace SE
|
} //namespace SE
|
||||||
|
@ -18,7 +18,7 @@ namespace SE
|
|||||||
{
|
{
|
||||||
|
|
||||||
void SetKeyboardText(const char* newText);
|
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
|
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
|
||||||
{
|
{
|
||||||
if([string isEqualToString:@"\n"])
|
if([string isEqualToString:@"\n"])
|
||||||
|
{
|
||||||
[textField resignFirstResponder];
|
[textField resignFirstResponder];
|
||||||
|
SE::OnKeyboardHide();
|
||||||
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user