diff options
author | Andreas Kling <kling@serenityos.org> | 2021-05-16 00:37:11 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-16 01:11:56 +0200 |
commit | 5579ec767e989aca1d9f4fda5d8f55ae2ce9ebcc (patch) | |
tree | c1b27e6e0380358558840dc6a688e35862c5fdaa /Userland/Applications | |
parent | 864392254e533d5e5ff4ac310fb415f5c5a9ff9d (diff) | |
download | serenity-5579ec767e989aca1d9f4fda5d8f55ae2ce9ebcc.zip |
PixelPaint: Add a statusbar to the main window
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/PixelPaint/PixelPaintWindow.gml | 4 | ||||
-rw-r--r-- | Userland/Applications/PixelPaint/main.cpp | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/Userland/Applications/PixelPaint/PixelPaintWindow.gml b/Userland/Applications/PixelPaint/PixelPaintWindow.gml index df2e051ffa..dd1e3dab89 100644 --- a/Userland/Applications/PixelPaint/PixelPaintWindow.gml +++ b/Userland/Applications/PixelPaint/PixelPaintWindow.gml @@ -61,4 +61,8 @@ } } } + + @GUI::Statusbar { + name: "statusbar" + } } diff --git a/Userland/Applications/PixelPaint/main.cpp b/Userland/Applications/PixelPaint/main.cpp index ab9c76b6fc..a440d0207f 100644 --- a/Userland/Applications/PixelPaint/main.cpp +++ b/Userland/Applications/PixelPaint/main.cpp @@ -26,6 +26,7 @@ #include <LibGUI/Icon.h> #include <LibGUI/Menubar.h> #include <LibGUI/MessageBox.h> +#include <LibGUI/Statusbar.h> #include <LibGUI/Toolbar.h> #include <LibGUI/Window.h> #include <LibGfx/Bitmap.h> @@ -416,6 +417,19 @@ int main(int argc, char** argv) image_editor.set_active_layer(bg_layer); } + auto& statusbar = *main_widget.find_descendant_of_type_named<GUI::Statusbar>("statusbar"); + + app->on_action_enter = [&statusbar](GUI::Action& action) { + auto text = action.status_tip(); + if (text.is_empty()) + text = Gfx::parse_ampersand_string(action.text()); + statusbar.set_override_text(move(text)); + }; + + app->on_action_leave = [&statusbar](GUI::Action&) { + statusbar.set_override_text({}); + }; + window->show(); return app->exec(); } |