Class: Gtk::Image
- Inherits:
-
Object
- Object
- Gtk::Image
- Extended by:
- GLib::Deprecatable
- Defined in:
- lib/gtk4/image.rb,
lib/gtk4/deprecated.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Image
constructor
Creates a Gtk::Image.
- #initialize_raw ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Image
Creates a Gtk::Image. The source of the image depends on the options given.
icon = Gio::Icon.new_for_string 'path/to/the/image.png'
image = Gtk::Image.new(icon: icon)
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/gtk4/image.rb', line 52 def initialize(={}) icon_name = [:icon_name] || nil icon = [:icon] || [:gicon] || nil file = [:file] || nil pixbuf = [:pixbuf] || nil resource = [:resource] || nil if icon_name initialize_new_from_icon_name(icon_name) elsif icon initialize_new_from_gicon(icon) elsif file initialize_new_from_file(file) elsif pixbuf initialize_new_from_pixbuf(pixbuf) elsif resource initialize_new_from_resource(resource) else initialize_raw end end |
Instance Method Details
#initialize_raw ⇒ Object
19 |
# File 'lib/gtk4/image.rb', line 19 alias_method :initialize_raw, :initialize |