Class: ImageButton
- Inherits:
-
Gtk::EventBox
- Object
- Gtk::EventBox
- ImageButton
- Defined in:
- lib/gswax/shared.rb
Instance Attribute Summary collapse
-
#cold_pix ⇒ Object
Returns the value of attribute cold_pix.
-
#hot_pix ⇒ Object
Returns the value of attribute hot_pix.
-
#image ⇒ Object
Returns the value of attribute image.
Instance Method Summary collapse
- #enter_event ⇒ Object
-
#initialize ⇒ ImageButton
constructor
A new instance of ImageButton.
- #leave_event ⇒ Object
- #set_images(img_file, hov_file, width, height = width) ⇒ Object
Constructor Details
#initialize ⇒ ImageButton
Returns a new instance of ImageButton.
142 143 144 145 146 147 148 |
# File 'lib/gswax/shared.rb', line 142 def initialize super self.set_visible_window(false) self.signal_connect("enter_notify_event"){enter_event} self.signal_connect("leave_notify_event"){leave_event} self.signal_connect("button_press_event"){yield if block_given?} end |
Instance Attribute Details
#cold_pix ⇒ Object
Returns the value of attribute cold_pix.
140 141 142 |
# File 'lib/gswax/shared.rb', line 140 def cold_pix @cold_pix end |
#hot_pix ⇒ Object
Returns the value of attribute hot_pix.
140 141 142 |
# File 'lib/gswax/shared.rb', line 140 def hot_pix @hot_pix end |
#image ⇒ Object
Returns the value of attribute image.
140 141 142 |
# File 'lib/gswax/shared.rb', line 140 def image @image end |
Instance Method Details
#enter_event ⇒ Object
159 160 161 |
# File 'lib/gswax/shared.rb', line 159 def enter_event @image.pixbuf = @hot_pix if @image end |
#leave_event ⇒ Object
163 164 165 |
# File 'lib/gswax/shared.rb', line 163 def leave_event @image.pixbuf = @cold_pix if @image end |
#set_images(img_file, hov_file, width, height = width) ⇒ Object
150 151 152 153 154 155 156 157 |
# File 'lib/gswax/shared.rb', line 150 def set_images(img_file, hov_file, width, height= width) self.remove(@image) if @image @cold_pix = Gdk::Pixbuf.new(img_file, width, height) @hot_pix = Gdk::Pixbuf.new(hov_file, width, height) @image = Gtk::Image.new(@cold_pix) self.add(@image) end |