add icon images support

This commit is contained in:
yggverse 2024-07-22 14:20:17 +03:00
parent 27332b2828
commit 30a8f2617e

View file

@ -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
);