1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-25 06:35:30 +00:00

Add new EditBox for searching to console layout

This commit is contained in:
Shihan42 2023-02-20 18:18:00 +01:00
parent 67f0d37c20
commit 63659224fd
3 changed files with 21 additions and 3 deletions

View File

@ -144,11 +144,15 @@ namespace MWGui
getWidget(mCommandLine, "edit_Command");
getWidget(mHistory, "list_History");
getWidget(mSearchTerm, "edit_SearchTerm");
// Set up the command line box
mCommandLine->eventEditSelectAccept += newDelegate(this, &Console::acceptCommand);
mCommandLine->eventKeyButtonPressed += newDelegate(this, &Console::keyPress);
mCommandLine->eventKeyButtonPressed += newDelegate(this, &Console::commandBoxKeyPress);
// Set up the search term box
mSearchTerm->eventKeyButtonReleased += newDelegate(this, &Console::searchTermBoxKeyRelease);
// Set up the log window
mHistory->setOverflowToTheLeft(true);
@ -254,7 +258,7 @@ namespace MWGui
return c == ' ' || c == '\t';
}
void Console::keyPress(MyGUI::Widget* _sender, MyGUI::KeyCode key, MyGUI::Char _char)
void Console::commandBoxKeyPress(MyGUI::Widget* _sender, MyGUI::KeyCode key, MyGUI::Char _char)
{
if (MyGUI::InputManager::getInstance().isControlPressed())
{
@ -343,6 +347,13 @@ namespace MWGui
}
}
void Console::searchTermBoxKeyRelease(MyGUI::Widget* _sender, MyGUI::KeyCode key)
{
const std::string& searchTerm = mSearchTerm->getOnlyText();
if (searchTerm.empty())
return;
}
void Console::acceptCommand(MyGUI::EditBox* _sender)
{
const std::string& cm = mCommandLine->getOnlyText();

View File

@ -28,6 +28,7 @@ namespace MWGui
MyGUI::EditBox* mCommandLine;
MyGUI::EditBox* mHistory;
MyGUI::EditBox* mSearchTerm;
typedef std::list<std::string> StringList;
@ -77,7 +78,8 @@ namespace MWGui
void updateConsoleTitle();
void keyPress(MyGUI::Widget* _sender, MyGUI::KeyCode key, MyGUI::Char _char);
void commandBoxKeyPress(MyGUI::Widget* _sender, MyGUI::KeyCode key, MyGUI::Char _char);
void searchTermBoxKeyRelease(MyGUI::Widget* _sender, MyGUI::KeyCode key);
void acceptCommand(MyGUI::EditBox* _sender);

View File

@ -23,5 +23,10 @@
<UserString key="AcceptTab" value="true"/>
</Widget>
<!-- Search box -->
<Widget type="EditBox" skin="MW_ConsoleCommand" position="264 0 120 28" align="Top Right" name="edit_SearchTerm">
<Property key="InvertSelected" value="false"/>
</Widget>
</Widget>
</MyGUI>