Class: Gtk::Widget
- Inherits:
-
Object
- Object
- Gtk::Widget
- Includes:
- Freightrain::BindingBase
- Defined in:
- lib/extensions/gtk/widgets/gtk_widget.rb
Instance Method Summary collapse
- #background=(color) ⇒ Object
- #base_background=(color) ⇒ Object
- #color_from_rgb(rgb_array) ⇒ Object
- #defaults ⇒ Object
- #foreground=(color) ⇒ Object
- #get_color(symbol_or_array) ⇒ Object
- #hide ⇒ Object
- #name ⇒ Object
- #plug_in(region_widget) ⇒ Object
-
#show ⇒ Object
made for easier compatibility (other toolkits use show/hide).
Methods included from Freightrain::BindingBase
Instance Method Details
#background=(color) ⇒ Object
42 43 44 |
# File 'lib/extensions/gtk/widgets/gtk_widget.rb', line 42 def background=(color) self.modify_bg(Gtk::STATE_NORMAL, get_color(color)) end |
#base_background=(color) ⇒ Object
50 51 52 |
# File 'lib/extensions/gtk/widgets/gtk_widget.rb', line 50 def base_background=(color) self.modify_base(Gtk::STATE_NORMAL, get_color(color)) end |
#color_from_rgb(rgb_array) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/extensions/gtk/widgets/gtk_widget.rb', line 25 def color_from_rgb(rgb_array) return nil unless rgb_array.kind_of? Enumerable red = rgb_array[0] * 255 green = rgb_array[1] * 255 blue = rgb_array[2] * 255 return Gdk::Color.new(red, green, blue) end |
#defaults ⇒ Object
7 8 9 10 |
# File 'lib/extensions/gtk/widgets/gtk_widget.rb', line 7 def defaults @defaults = {} unless @defaults return @defaults end |
#foreground=(color) ⇒ Object
46 47 48 |
# File 'lib/extensions/gtk/widgets/gtk_widget.rb', line 46 def foreground=(color) self.modify_fg(Gtk::STATE_NORMAL, get_color(color)) end |
#get_color(symbol_or_array) ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/extensions/gtk/widgets/gtk_widget.rb', line 33 def get_color(symbol_or_array) if symbol_or_array.kind_of? Symbol rgb_array = FreightColor[symbol_or_array] else rgb_array = symbol_or_array end return color_from_rgb(rgb_array) end |
#hide ⇒ Object
17 18 19 |
# File 'lib/extensions/gtk/widgets/gtk_widget.rb', line 17 def hide self.visible = false end |
#name ⇒ Object
21 22 23 |
# File 'lib/extensions/gtk/widgets/gtk_widget.rb', line 21 def name return self.builder_name end |
#plug_in(region_widget) ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/extensions/gtk/widgets/gtk_widget.rb', line 54 def plug_in() self.remove(self.children.first) unless self.children.empty? target = nil if .class == Gtk::Window target = .children.first else target = end self << target end |
#show ⇒ Object
made for easier compatibility (other toolkits use show/hide)
13 14 15 |
# File 'lib/extensions/gtk/widgets/gtk_widget.rb', line 13 def show self.visible = true end |