mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
add filename image support
This commit is contained in:
parent
80766fb62c
commit
4f6445d167
1 changed files with 32 additions and 8 deletions
|
|
@ -65,15 +65,39 @@ abstract class Button
|
|||
int $size = \GtkIconSize::BUTTON
|
||||
): void
|
||||
{
|
||||
if (\GtkIconTheme::get_default()->has_icon($image))
|
||||
switch (true)
|
||||
{
|
||||
$this->gtk->set_image(
|
||||
\GtkImage::new_from_icon_name(
|
||||
$image,
|
||||
$size
|
||||
)
|
||||
);
|
||||
case file_exists(
|
||||
$image
|
||||
) && is_readable(
|
||||
$image
|
||||
):
|
||||
|
||||
} else throw new \Exception;
|
||||
$this->gtk->set_image(
|
||||
\GtkImage::new_from_file(
|
||||
$image,
|
||||
$size
|
||||
)
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
case \GtkIconTheme::get_default()->has_icon(
|
||||
$image
|
||||
):
|
||||
|
||||
$this->gtk->set_image(
|
||||
\GtkImage::new_from_icon_name(
|
||||
$image,
|
||||
$size
|
||||
)
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
throw new \Exception;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue