Module: Gtk2AppLib::Images

Defined in:
lib/gtk2applib/images.rb

Constant Summary

PNGS =
File.join(Constants::USERDIR, 'pngs')
IMAGE =

IMAGE primarily sets the :ICON and :LOGO Pixbuf

{}

Class Method Summary (collapse)

Class Method Details

+ (Object) [](key)



8
9
10
# File 'lib/gtk2applib/images.rb', line 8

def self.[](key)
  IMAGE[key]
end

+ (Object) image(key, dir = PNGS, ext = '.png')



12
13
14
15
16
17
# File 'lib/gtk2applib/images.rb', line 12

def self.image(key, dir=PNGS, ext='.png')
  fn = File.join(dir, key.to_s.downcase+ext)
  if File.exist?(fn) then
    IMAGE[key] = ($nogtk)? fn : Gdk::Pixbuf.new(fn)
  end
end

+ (Object) images(keys, dir = PNGS, ext = '.png')



19
20
21
22
# File 'lib/gtk2applib/images.rb', line 19

def self.images(keys, dir=PNGS, ext='.png')
  keys = [keys] if keys.class != Array
  keys.each { |key| Images.image(key, dir, ext) }
end