From 694b4a64bd559927671b29998514943920b586cc Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 15 Jun 2019 17:52:53 +0200 Subject: [PATCH] PaintBrush: Make little icons for the pen and bucket tools. --- Applications/PaintBrush/ToolboxWidget.cpp | 12 ++++++++---- Base/res/icons/paintbrush/bucket.png | Bin 0 -> 334 bytes Base/res/icons/paintbrush/pen.png | Bin 0 -> 333 bytes 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 Base/res/icons/paintbrush/bucket.png create mode 100644 Base/res/icons/paintbrush/pen.png diff --git a/Applications/PaintBrush/ToolboxWidget.cpp b/Applications/PaintBrush/ToolboxWidget.cpp index aabc1e64cb..1d13b51e9a 100644 --- a/Applications/PaintBrush/ToolboxWidget.cpp +++ b/Applications/PaintBrush/ToolboxWidget.cpp @@ -4,13 +4,15 @@ #include "PenTool.h" #include #include +#include class ToolButton final : public GButton { public: ToolButton(const String& name, GWidget* parent, OwnPtr&& tool) - : GButton(name, parent) + : GButton(parent) , m_tool(move(tool)) { + set_tooltip(name); } const Tool& tool() const { return *m_tool; } @@ -36,13 +38,15 @@ ToolboxWidget::ToolboxWidget(GWidget* parent) set_layout(make(Orientation::Vertical)); layout()->set_margins({ 4, 4, 4, 4 }); - auto add_tool = [&](const StringView& name, OwnPtr&& tool) { + auto add_tool = [&](const StringView& name, const StringView& icon_name, OwnPtr&& tool) { auto* button = new ToolButton(name, this, move(tool)); button->set_size_policy(SizePolicy::Fill, SizePolicy::Fixed); button->set_preferred_size({ 0, 32 }); button->set_checkable(true); button->set_exclusive(true); + button->set_icon(load_png(String::format("/res/icons/paintbrush/%s.png", icon_name.characters()))); + button->on_checked = [button](auto checked) { if (checked) PaintableWidget::the().set_tool(&button->tool()); @@ -51,8 +55,8 @@ ToolboxWidget::ToolboxWidget(GWidget* parent) }; }; - add_tool("Pen", make()); - add_tool("Buck", make()); + add_tool("Pen", "pen", make()); + add_tool("Bucket Fill", "bucket", make()); } ToolboxWidget::~ToolboxWidget() diff --git a/Base/res/icons/paintbrush/bucket.png b/Base/res/icons/paintbrush/bucket.png new file mode 100644 index 0000000000000000000000000000000000000000..7c4082e2ac846a78a4f43540490f06b3c1cb53cc GIT binary patch literal 334 zcmeAS@N?(olHy`uVBq!ia0y~yV2}b~4mJh`hLv7E=NK3mMLk^{Lp+W@y=s_s*g&M= zVf>;AS0$|^sv7jnEF1L`mOtUz>2*AAQ8>rJT@C&MPqbOAM7pl~yn57f)sV2xv23}Rc7Zkfks&SHwW7v%HX z<@Ij$TACvK-tgERS?Sw6ufo>scl%`})$sKGEZ;rl z+Y=O7wU4dY+MH3-uaKX^Gf`&M<{KhRABx`nk-Jx8z&;`M=F)TLz8bfdu-)QiIPmVd p^UpX*U4zaud{uExUCVR+yLe2_z7n2rjDdlH!PC{xWt~$(69C_ukbeLG literal 0 HcmV?d00001 diff --git a/Base/res/icons/paintbrush/pen.png b/Base/res/icons/paintbrush/pen.png new file mode 100644 index 0000000000000000000000000000000000000000..5bfbd1a715a9b515a16c66eb96b217e2d5a1efe6 GIT binary patch literal 333 zcmeAS@N?(olHy`uVBq!ia0y~yV2}b~4mJh`hLv7E=NK3mMLb;`Lp+WrCrBK6Q14%J zzP`lKO)7%v`4klrd+O>vkWtpC|D!R#+*;mK$x{I;5goK1dM8dS1JvP0Kou=InUn;+fZVEd5@Au!S z4{u#lV#~CA72Om#b$=cE#xrM|cTF<@0q2)(?D8!VK36Ry_SODB`{4PKqYs2@J6H9J k&v5*&sZ+qt&%n_9^`_Hmz4`AL7#J8lUHx3vIVCg!02!Z#ZvX%Q literal 0 HcmV?d00001