Browse Source

add icon images support

PHP-GTK3
yggverse 4 months ago
parent
commit
30a8f2617e
  1. 11
      src/Abstract/Entity/Button.php

11
src/Abstract/Entity/Button.php

@ -10,11 +10,22 @@ abstract class Button
public const SENSITIVE = false; public const SENSITIVE = false;
public const LABEL = 'Button'; public const LABEL = 'Button';
public const IMAGE = null;
public function __construct() public function __construct()
{ {
$this->gtk = new \GtkButton; $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->gtk->set_sensitive(
$this::SENSITIVE $this::SENSITIVE
); );

Loading…
Cancel
Save