mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
PixelPaint: Add a statusbar to the main window
This commit is contained in:
parent
864392254e
commit
5579ec767e
2 changed files with 18 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue