This commit is contained in:
Vladislav Khorev 2013-06-13 08:59:07 +00:00
parent ec449cc337
commit 9195096bcb
4 changed files with 35 additions and 13 deletions

View File

@ -138,6 +138,7 @@ protected:
boost::mutex WidgetListMutex; boost::mutex WidgetListMutex;
bool KeyboardIsOnScreen;
public: public:
boost::signal<void(int)> KeyPressedSignal; boost::signal<void(int)> KeyPressedSignal;
@ -169,6 +170,10 @@ public:
void OnMove(vec2 shift); void OnMove(vec2 shift);
void ShowKeyboard();
void HideKeyboard();
void PrintWidgetList(); void PrintWidgetList();
std::shared_ptr<boost::signal<void (TSignalParam)>> GetOnClickSignal(const std::string& widgetName); std::shared_ptr<boost::signal<void (TSignalParam)>> GetOnClickSignal(const std::string& widgetName);

View File

@ -640,7 +640,10 @@ void TEdit::OnTapDown(vec2 pos)
{ {
ResourceManager->GUIManager.KeyPressedSignal.disconnect_all_slots(); ResourceManager->GUIManager.KeyPressedSignal.disconnect_all_slots();
InputConnection = ResourceManager->GUIManager.KeyPressedSignal.connect(boost::bind(&TEdit::OnKeyPress, this, _1)); InputConnection = ResourceManager->GUIManager.KeyPressedSignal.connect(boost::bind(&TEdit::OnKeyPress, this, _1));
} }
ResourceManager->GUIManager.ShowKeyboard();
} }
void TEdit::OnKeyPress(int key) void TEdit::OnKeyPress(int key)

View File

@ -10,6 +10,7 @@ const std::string CONST_DRAG_SIGNAL_NAME = "OnDrag";
TGUIManager::TGUIManager() TGUIManager::TGUIManager()
: KeyboardIsOnScreen(false)
{ {
} }
@ -369,6 +370,26 @@ void TGUIManager::OnMove(vec2 shift)
} }
} }
void TGUIManager::ShowKeyboard()
{
if (!KeyboardIsOnScreen)
{
MoveWidget("Keyboard", vec2(0, 216));
KeyboardIsOnScreen = true;
}
}
void TGUIManager::HideKeyboard()
{
if (KeyboardIsOnScreen)
{
MoveWidget("Keyboard", vec2(0, -216));
KeyboardIsOnScreen = false;
}
}
void TGUIManager::PrintWidgetList() void TGUIManager::PrintWidgetList()
{ {
TWidgetArr::iterator i; TWidgetArr::iterator i;

View File

@ -4,19 +4,6 @@ namespace SE
{ {
/*
struct TKeyboardWidget : public TInstancingWidgetAncestor
{
TKeyboardWidget();
virtual bool CheckClick(vec2 mousePos);
virtual void OnTapDown(vec2 pos);
virtual void OnTapUp(vec2 pos);
};*/
TKeyboardWidget::TKeyboardWidget() TKeyboardWidget::TKeyboardWidget()
: Shifted(false) : Shifted(false)
{ {
@ -160,6 +147,12 @@ struct TKeyboardWidget : public TInstancingWidgetAncestor
ResourceManager->GUIManager.KeyPressedSignal(std::get<1>(visualKeyElement)); ResourceManager->GUIManager.KeyPressedSignal(std::get<1>(visualKeyElement));
} }
} }
if (pos.v[0] >= 280 - 74/2 && pos.v[0] <= 280 + 74/2 &&
pos.v[1] >= 23 - 38/2 && pos.v[1] <= 23 + 38/2)
{
ResourceManager->GUIManager.HideKeyboard();
}
} }