diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index d7b4ab5c9db..2fa31f2dc21 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include #include @@ -36,20 +36,21 @@ int main(int argc, char** argv) auto* main_toolbar = new GToolBar(widget); auto* location_toolbar = new GToolBar(widget); - auto* location_textbox = new GTextBox(location_toolbar); + location_toolbar->set_preferred_size({ 0, 21 }); + auto* location_textbox = new GTextEditor(GTextEditor::SingleLine, location_toolbar); auto* directory_table_view = new DirectoryTableView(widget); auto* statusbar = new GStatusBar(widget); - location_textbox->on_return_pressed = [directory_table_view] (GTextBox& textbox) { - directory_table_view->open(textbox.text()); + location_textbox->on_return_pressed = [directory_table_view] (auto& editor) { + directory_table_view->open(editor.text()); }; auto open_parent_directory_action = GAction::create("Open parent directory", { Mod_Alt, Key_Up }, GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/parentdirectory16.rgb", { 16, 16 }), [directory_table_view] (const GAction&) { directory_table_view->open_parent_directory(); }); - auto mkdir_action = GAction::create("New directory...", GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/mkdir16.rgb", { 16, 16 }), [] (const GAction&) { + auto mkdir_action = GAction::create("New directory...", GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/16x16/mkdir.rgb", { 16, 16 }), [] (const GAction&) { dbgprintf("'New directory' action activated!\n"); }); @@ -57,7 +58,7 @@ int main(int argc, char** argv) dbgprintf("'Copy' action activated!\n"); }); - auto delete_action = GAction::create("Delete", GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/trash16.rgb", { 16, 16 }), [] (const GAction&) { + auto delete_action = GAction::create("Delete", GraphicsBitmap::load_from_file(GraphicsBitmap::Format::RGBA32, "/res/icons/16x16/delete.rgb", { 16, 16 }), [] (const GAction&) { dbgprintf("'Delete' action activated!\n"); }); diff --git a/Base/res/icons/16x16/delete.png b/Base/res/icons/16x16/delete.png new file mode 100644 index 00000000000..f271da46e77 Binary files /dev/null and b/Base/res/icons/16x16/delete.png differ diff --git a/Base/res/icons/16x16/delete.rgb b/Base/res/icons/16x16/delete.rgb new file mode 100644 index 00000000000..460cd225d1b Binary files /dev/null and b/Base/res/icons/16x16/delete.rgb differ diff --git a/Base/res/icons/16x16/mkdir.png b/Base/res/icons/16x16/mkdir.png new file mode 100644 index 00000000000..012fff339dd Binary files /dev/null and b/Base/res/icons/16x16/mkdir.png differ diff --git a/Base/res/icons/16x16/mkdir.rgb b/Base/res/icons/16x16/mkdir.rgb new file mode 100644 index 00000000000..a32de690b74 Binary files /dev/null and b/Base/res/icons/16x16/mkdir.rgb differ diff --git a/LibGUI/GTextEditor.cpp b/LibGUI/GTextEditor.cpp index 5a4d61584e8..06ab76f1a23 100644 --- a/LibGUI/GTextEditor.cpp +++ b/LibGUI/GTextEditor.cpp @@ -26,6 +26,9 @@ GTextEditor::~GTextEditor() void GTextEditor::set_text(const String& text) { + if (is_single_line() && text.length() == m_lines[0]->length() && !memcmp(text.characters(), m_lines[0]->characters(), text.length())) + return; + m_lines.clear(); int start_of_current_line = 0; @@ -44,7 +47,10 @@ void GTextEditor::set_text(const String& text) } add_line(i); update_content_size(); - set_cursor(0, 0); + if (is_single_line()) + set_cursor(0, m_lines[0]->length()); + else + set_cursor(0, 0); update(); }