mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 23:58:12 +00:00
IRCClient+LibGUI: Add an input box so we can send messages to channels.
Implement this using a GTextEditor with a special single-line mode. This new mode needs some polishing, but it's already very useful.
This commit is contained in:
parent
ad08165a25
commit
1fc283ed7d
12 changed files with 126 additions and 23 deletions
|
@ -3,6 +3,7 @@
|
|||
#include "IRCLogBufferModel.h"
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GTableView.h>
|
||||
#include <LibGUI/GTextEditor.h>
|
||||
#include <LibGUI/GTextBox.h>
|
||||
|
||||
IRCClientWindow::IRCClientWindow(IRCClient& client, Type type, const String& name, GWidget* parent)
|
||||
|
@ -16,6 +17,19 @@ IRCClientWindow::IRCClientWindow(IRCClient& client, Type type, const String& nam
|
|||
m_table_view->set_headers_visible(false);
|
||||
m_table_view->set_font(Font::default_fixed_width_font());
|
||||
|
||||
m_text_editor = new GTextEditor(GTextEditor::SingleLine, this);
|
||||
m_text_editor->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed);
|
||||
m_text_editor->set_preferred_size({ 0, 18 });
|
||||
m_text_editor->on_return_pressed = [this] (GTextEditor& editor) {
|
||||
if (m_type == Channel)
|
||||
m_client.handle_user_input_in_channel(m_name, editor.text());
|
||||
else if (m_type == Query)
|
||||
m_client.handle_user_input_in_query(m_name, editor.text());
|
||||
else if (m_type == Server)
|
||||
m_client.handle_user_input_in_server(editor.text());
|
||||
m_text_editor->clear();
|
||||
};
|
||||
|
||||
m_client.register_subwindow(*this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue