mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 19:27:36 +00:00
LibGUI: Turn GTextBox into a wrapper around a single-line GTextEditor.
This commit is contained in:
parent
981623f4ee
commit
313ac51832
11 changed files with 25 additions and 260 deletions
|
@ -69,8 +69,8 @@ int main(int argc, char** argv)
|
|||
progressbar->set_frame_shadow(GFrame::Shadow::Sunken);
|
||||
progressbar->set_frame_thickness(1);
|
||||
|
||||
location_textbox->on_return_pressed = [directory_view] (auto& editor) {
|
||||
directory_view->open(editor.text());
|
||||
location_textbox->on_return_pressed = [directory_view, location_textbox] {
|
||||
directory_view->open(location_textbox->text());
|
||||
};
|
||||
|
||||
file_system_model->on_selection_changed = [&] (auto& index) {
|
||||
|
|
|
@ -33,14 +33,14 @@ FontEditorWidget::FontEditorWidget(const String& path, RetainPtr<Font>&& edited_
|
|||
m_name_textbox = new GTextBox(this);
|
||||
m_name_textbox->set_relative_rect({ 5, 220, 300, 20 });
|
||||
m_name_textbox->set_text(m_edited_font->name());
|
||||
m_name_textbox->on_change = [this] (GTextBox&) {
|
||||
m_name_textbox->on_change = [this] {
|
||||
m_edited_font->set_name(m_name_textbox->text());
|
||||
};
|
||||
|
||||
m_path_textbox = new GTextBox(this);
|
||||
m_path_textbox->set_relative_rect({ 5, 245, 300, 20 });
|
||||
m_path_textbox->set_text(m_path);
|
||||
m_path_textbox->on_change = [this] (GTextBox&) {
|
||||
m_path_textbox->on_change = [this] {
|
||||
m_path = m_path_textbox->text();
|
||||
};
|
||||
|
||||
|
|
|
@ -42,13 +42,13 @@ IRCWindow::IRCWindow(IRCClient& client, void* owner, Type type, const String& na
|
|||
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, 19 });
|
||||
m_text_editor->on_return_pressed = [this] (GTextEditor& editor) {
|
||||
m_text_editor->on_return_pressed = [this] {
|
||||
if (m_type == Channel)
|
||||
m_client.handle_user_input_in_channel(m_name, editor.text());
|
||||
m_client.handle_user_input_in_channel(m_name, m_text_editor->text());
|
||||
else if (m_type == Query)
|
||||
m_client.handle_user_input_in_query(m_name, editor.text());
|
||||
m_client.handle_user_input_in_query(m_name, m_text_editor->text());
|
||||
else if (m_type == Server)
|
||||
m_client.handle_user_input_in_server(editor.text());
|
||||
m_client.handle_user_input_in_server(m_text_editor->text());
|
||||
m_text_editor->clear();
|
||||
};
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ OBJS = \
|
|||
|
||||
APP = TextEditor
|
||||
|
||||
STANDARD_FLAGS = -std=c++17
|
||||
STANDARD_FLAGS = -std=c++17 -Wno-sized-deallocation
|
||||
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
|
||||
FLAVOR_FLAGS = -fno-exceptions -fno-rtti
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
|
|
|
@ -26,9 +26,9 @@ int main(int argc, char** argv)
|
|||
auto* text_editor = new GTextEditor(GTextEditor::MultiLine, widget);
|
||||
auto* statusbar = new GStatusBar(widget);
|
||||
|
||||
text_editor->on_cursor_change = [statusbar] (GTextEditor& editor) {
|
||||
text_editor->on_cursor_change = [statusbar, text_editor] {
|
||||
StringBuilder builder;
|
||||
builder.appendf("Line: %d, Column: %d", editor.cursor().line(), editor.cursor().column());
|
||||
builder.appendf("Line: %d, Column: %d", text_editor->cursor().line(), text_editor->cursor().column());
|
||||
statusbar->set_text(builder.to_string());
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue