diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-13 15:06:11 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-13 15:06:11 +0200 |
commit | 2c45076e6861786f7000cbac812d6b3c63a9e3ca (patch) | |
tree | 2ec3a041f8c2fa5294b72191d376971b7341d72e /Applications | |
parent | 1631077b74c6acd7786501e15ccf32aef05bd040 (diff) | |
download | serenity-2c45076e6861786f7000cbac812d6b3c63a9e3ca.zip |
PaintBrush: Let's have a tool (pen) checked on startup
Diffstat (limited to 'Applications')
-rw-r--r-- | Applications/PaintBrush/ToolboxWidget.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/Applications/PaintBrush/ToolboxWidget.cpp b/Applications/PaintBrush/ToolboxWidget.cpp index c548755a76..124a51aa14 100644 --- a/Applications/PaintBrush/ToolboxWidget.cpp +++ b/Applications/PaintBrush/ToolboxWidget.cpp @@ -100,24 +100,17 @@ ToolboxWidget::ToolboxWidget() m_action_group.set_exclusive(true); m_action_group.set_unchecking_allowed(false); - auto add_tool = [&](const StringView& name, const StringView& icon_name, const GUI::Shortcut& shortcut, NonnullOwnPtr<Tool> tool) { + auto add_tool = [&](const StringView& name, const StringView& icon_name, const GUI::Shortcut& shortcut, NonnullOwnPtr<Tool> tool) -> ToolButton& { auto& button = add<ToolButton>(*this, name, shortcut, move(tool)); button.set_size_policy(GUI::SizePolicy::Fill, GUI::SizePolicy::Fixed); button.set_preferred_size(0, 32); button.set_checkable(true); - button.set_exclusive(true); button.set_icon(Gfx::Bitmap::load_from_file(String::format("/res/icons/paintbrush/%s.png", icon_name.to_string().characters()))); - - button.on_checked = [this, button = &button](auto checked) { - if (checked) - on_tool_selection(&button->tool()); - else - on_tool_selection(nullptr); - }; + return button; }; add_tool("Move", "move", { 0, Key_M }, make<MoveTool>()); - add_tool("Pen", "pen", { 0, Key_N }, make<PenTool>()); + add_tool("Pen", "pen", { 0, Key_N }, make<PenTool>()).set_checked(true); add_tool("Bucket Fill", "bucket", { Mod_Shift, Key_B }, make<BucketTool>()); add_tool("Spray", "spray", { Mod_Shift, Key_S }, make<SprayTool>()); add_tool("Color Picker", "picker", { 0, Key_O }, make<PickerTool>()); |