Class: Gtk::Widget
- Inherits:
-
Object
- Object
- Gtk::Widget
- Extended by:
- GLib::Deprecatable
- Defined in:
- lib/gtk3/widget.rb,
lib/gtk3/deprecated.rb
Class Method Summary collapse
- .have_template? ⇒ Boolean
- .init ⇒ Object
- .set_connect_func(&block) ⇒ Object
- .set_connect_func_raw ⇒ Object
- .template_children ⇒ Object
Instance Method Summary collapse
- #add_events(new_events) ⇒ Object
- #add_events_raw ⇒ Object
- #bind_template_child(name, options = {}) ⇒ Object
- #drag_dest_set(flags, targets, actions) ⇒ Object
- #drag_dest_set_raw ⇒ Object
- #drag_source_set(flags, targets, actions) ⇒ Object
- #drag_source_set_raw ⇒ Object
- #events ⇒ Object
- #events_raw ⇒ Object
- #render_icon_pixbuf(stock_id, size) ⇒ Object
- #render_icon_pixbuf_raw ⇒ Object
- #set_allocation(*args) ⇒ Object
- #set_events(new_events) ⇒ Object (also: #events=)
- #set_events_raw ⇒ Object
- #set_template(template) ⇒ Object
- #set_template_raw ⇒ Object
- #style_context ⇒ Object
- #style_context_raw ⇒ Object
- #style_get_property(name) ⇒ Object
- #style_get_property_raw ⇒ Object
- #translate_coordinates(widget, x, y) ⇒ Object
- #translate_coordinates_raw ⇒ Object
Class Method Details
.have_template? ⇒ Boolean
23 24 25 |
# File 'lib/gtk3/widget.rb', line 23 def have_template? @have_template ||= false end |
.init ⇒ Object
20 21 |
# File 'lib/gtk3/widget.rb', line 20 def init end |
.set_connect_func(&block) ⇒ Object
54 55 56 57 58 |
# File 'lib/gtk3/widget.rb', line 54 def set_connect_func(&block) set_connect_func_raw do |*args| Builder.connect_signal(*args, &block) end end |
.set_connect_func_raw ⇒ Object
53 |
# File 'lib/gtk3/widget.rb', line 53 alias_method :set_connect_func_raw, :set_connect_func |
.template_children ⇒ Object
27 28 29 |
# File 'lib/gtk3/widget.rb', line 27 def template_children @template_children ||= [] end |
Instance Method Details
#add_events(new_events) ⇒ Object
67 68 69 70 71 72 |
# File 'lib/gtk3/widget.rb', line 67 def add_events(new_events) unless new_events.is_a?(Gdk::EventMask) new_events = Gdk::EventMask.new(new_events) end add_events_raw(new_events.to_i) end |
#add_events_raw ⇒ Object
66 |
# File 'lib/gtk3/widget.rb', line 66 alias_method :add_events_raw, :add_events |
#bind_template_child(name, options = {}) ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/gtk3/widget.rb', line 44 def bind_template_child(name, ={}) internal_child = [:internal_child] internal_child = false if internal_child.nil? bind_template_child_full(name, internal_child, 0) template_children << name attr_reader(name) end |
#drag_dest_set(flags, targets, actions) ⇒ Object
92 93 94 95 |
# File 'lib/gtk3/widget.rb', line 92 def drag_dest_set(flags, targets, actions) targets = ensure_drag_targets(targets) drag_dest_set_raw(flags, targets, actions) end |
#drag_dest_set_raw ⇒ Object
91 |
# File 'lib/gtk3/widget.rb', line 91 alias_method :drag_dest_set_raw, :drag_dest_set |
#drag_source_set(flags, targets, actions) ⇒ Object
86 87 88 89 |
# File 'lib/gtk3/widget.rb', line 86 def drag_source_set(flags, targets, actions) targets = ensure_drag_targets(targets) drag_source_set_raw(flags, targets, actions) end |
#drag_source_set_raw ⇒ Object
85 |
# File 'lib/gtk3/widget.rb', line 85 alias_method :drag_source_set_raw, :drag_source_set |
#events ⇒ Object
62 63 64 |
# File 'lib/gtk3/widget.rb', line 62 def events Gdk::EventMask.new(events_raw) end |
#events_raw ⇒ Object
61 |
# File 'lib/gtk3/widget.rb', line 61 alias_method :events_raw, :events |
#render_icon_pixbuf(stock_id, size) ⇒ Object
106 107 108 109 |
# File 'lib/gtk3/widget.rb', line 106 def render_icon_pixbuf(stock_id, size) size = IconSize.new(size) unless size.is_a?(IconSize) render_icon_pixbuf_raw(stock_id, size) end |
#render_icon_pixbuf_raw ⇒ Object
105 |
# File 'lib/gtk3/widget.rb', line 105 alias_method :render_icon_pixbuf_raw, :render_icon_pixbuf |
#set_allocation(*args) ⇒ Object
1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 |
# File 'lib/gtk3/deprecated.rb', line 1084 def set_allocation(*args) case args.size when 1 __set_allocation__(args.first) when 4 warn "#{caller[0]}: '#{self.class}#set_allocation(x, y, width, height)' style has been deprecated. Use '#{self.class}#set_allocation(alloc)' style." __set_allocation__(Gtk::Allocation.new(*args)) else raise ArgumentError.new("need 1 or 4 arguments.") end end |
#set_events(new_events) ⇒ Object Also known as: events=
75 76 77 78 79 80 |
# File 'lib/gtk3/widget.rb', line 75 def set_events(new_events) unless new_events.is_a?(Gdk::EventMask) new_events = Gdk::EventMask.new(new_events) end set_events_raw(new_events.to_i) end |
#set_events_raw ⇒ Object
74 |
# File 'lib/gtk3/widget.rb', line 74 alias_method :set_events_raw, :set_events |
#set_template(template) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/gtk3/widget.rb', line 33 def set_template(template) resource = template[:resource] data = template[:data] if resource set_template_from_resource(resource) else set_template_raw(data) end @have_template = true end |
#set_template_raw ⇒ Object
32 |
# File 'lib/gtk3/widget.rb', line 32 alias_method :set_template_raw, :set_template |
#style_context ⇒ Object
122 123 124 |
# File 'lib/gtk3/widget.rb', line 122 def style_context @style_context ||= style_context_raw end |
#style_context_raw ⇒ Object
121 |
# File 'lib/gtk3/widget.rb', line 121 alias_method :style_context_raw, :style_context |
#style_get_property(name) ⇒ Object
98 99 100 101 102 103 |
# File 'lib/gtk3/widget.rb', line 98 def style_get_property(name) property = self.class.find_style_property(name) value = GLib::Value.new(property.value_type) style_get_property_raw(name, value) value.value end |
#style_get_property_raw ⇒ Object
97 |
# File 'lib/gtk3/widget.rb', line 97 alias_method :style_get_property_raw, :style_get_property |
#translate_coordinates(widget, x, y) ⇒ Object
112 113 114 115 116 117 118 119 |
# File 'lib/gtk3/widget.rb', line 112 def translate_coordinates(, x, y) translated, x, y = translate_coordinates_raw(, x, y) if translated [x, y] else nil end end |
#translate_coordinates_raw ⇒ Object
111 |
# File 'lib/gtk3/widget.rb', line 111 alias_method :translate_coordinates_raw, :translate_coordinates |