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.
139 140 141 142 143 144 145 |
# File 'lib/gswax/shared.rb', line 139 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.
137 138 139 |
# File 'lib/gswax/shared.rb', line 137 def cold_pix @cold_pix end |
#hot_pix ⇒ Object
Returns the value of attribute hot_pix.
137 138 139 |
# File 'lib/gswax/shared.rb', line 137 def hot_pix @hot_pix end |
#image ⇒ Object
Returns the value of attribute image.
137 138 139 |
# File 'lib/gswax/shared.rb', line 137 def image @image end |
Instance Method Details
#enter_event ⇒ Object
156 157 158 |
# File 'lib/gswax/shared.rb', line 156 def enter_event @image.pixbuf = @hot_pix if @image end |
#leave_event ⇒ Object
160 161 162 |
# File 'lib/gswax/shared.rb', line 160 def leave_event @image.pixbuf = @cold_pix if @image end |
#set_images(img_file, hov_file, width, height = width) ⇒ Object
147 148 149 150 151 152 153 154 |
# File 'lib/gswax/shared.rb', line 147 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 |