scorninpc / php-gtk3

GTK3 extension for PHP
https://andor.com.br/
GNU Lesser General Public License v3.0
112 stars 10 forks source link

Icon features? #111

Closed d47081 closed 23 hours ago

d47081 commented 2 weeks ago

Any features about gio / native icons not implemented yet?

scorninpc commented 2 weeks ago

what do you mean gio/native

ntfs1984 commented 1 week ago

Hello. Mb bro means class Gtk.IconTheme.

Gtk.Image have all necessary icon functions except of one - checking if some icon name does exist in icon theme\current icon theme. It's function called gtk_icon_theme_has_icon.

scorninpc commented 1 week ago

ah ok, i got

As i see, it can be coded, yes! I'll do this week

scorninpc commented 23 hours ago

Started the class with useful methods https://github.com/scorninpc/php-gtk3/commit/d91cf4e6c95d05bbc787ed7cd730a748bda2a24b

I done a simple example


<?php

Gtk::init();

$win = new GtkWindow();
$win->set_default_size(300, 200);
$win->connect("destroy", function() { Gtk::main_quit(); });

$button = \GtkButton::new_with_label("OK");
$win->add($button);
$button->connect("clicked", function($button) use ($win) {

    // $screen = GdkScreen::get_default();
    // $theme = GtkIconTheme::get_for_screen($screen);
    $theme = GtkIconTheme::get_default();

    var_dump($theme->list_icons());

    $exists = $theme->has_icon("notes");
    var_dump($exists);

    $no_exists = $theme->has_icon("new");
    var_dump($no_exists);
});

$win->show_all();

Gtk::main();
``