From 30a8f2617ed252024ae9dc57bae9c704642849f5 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 22 Jul 2024 14:20:17 +0300 Subject: [PATCH] add icon images support --- src/Abstract/Entity/Button.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Abstract/Entity/Button.php b/src/Abstract/Entity/Button.php index 4abe0d5f..a51d5e0c 100644 --- a/src/Abstract/Entity/Button.php +++ b/src/Abstract/Entity/Button.php @@ -10,11 +10,22 @@ abstract class Button public const SENSITIVE = false; public const LABEL = 'Button'; + public const IMAGE = null; public function __construct() { $this->gtk = new \GtkButton; + if ($this::IMAGE && \GtkIconTheme::get_default()->has_icon($this::IMAGE)) + { + $this->gtk->set_image( + \GtkImage::new_from_icon_name( + $this::IMAGE, + \GtkIconSize::BUTTON + ) + ); + } + $this->gtk->set_sensitive( $this::SENSITIVE );