Hide default chatbar when user presses ESC while chatting and autohide is configured

ZiRee 2012-02-08 17:51:11 +01:00
parent f8c5c37ae5
commit 814fe741ea
2 changed files with 35 additions and 12 deletions

View File

@ -120,18 +120,7 @@ void LLNearbyChatControl::onCommit()
LLNearbyChat::instance().sendChat(getConvertedText(),CHAT_TYPE_NORMAL);
setText(LLStringExplicit(""));
if(getName()=="default_chat_bar")
{
if(gSavedSettings.getBOOL("CloseChatOnReturn"))
{
setFocus(FALSE);
}
if(gSavedSettings.getBOOL("AutohideChatBar"))
{
LLNearbyChat::instance().showDefaultChatBar(FALSE);
}
}
autohide();
LLUICtrl::onCommit();
}
@ -246,3 +235,32 @@ void LLNearbyChatControl::setFocus(BOOL focus)
LLNearbyChat::instance().setFocusedInputEditor(this,focus);
LLLineEditor::setFocus(focus);
}
void LLNearbyChatControl::autohide()
{
if(getName()=="default_chat_bar")
{
if(gSavedSettings.getBOOL("CloseChatOnReturn"))
{
setFocus(FALSE);
}
if(gSavedSettings.getBOOL("AutohideChatBar"))
{
LLNearbyChat::instance().showDefaultChatBar(FALSE);
}
}
}
// handle ESC key here
BOOL LLNearbyChatControl::handleKeyHere(KEY key, MASK mask )
{
// autohide the chat bar if escape key was pressed and we're the default chat bar
if(key==KEY_ESCAPE && mask==MASK_NONE)
{
autohide();
gAgent.stopTyping();
}
return LLLineEditor::handleKeyHere(key,mask);
}

View File

@ -42,6 +42,8 @@ public:
virtual void onFocusLost();
virtual void setFocus(BOOL focus);
virtual BOOL handleKeyHere(KEY key,MASK mask);
static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str);
private:
@ -50,6 +52,9 @@ private:
// Chat data entered to be sent to nearby chat
void onCommit();
// Unfocus and autohide chat bar accordingly if we are the default chat bar
void autohide();
};
#endif