Class: Reflex::View
- Inherits:
-
Object
show all
- Extended by:
- Forwardable
- Includes:
- HasFrame, HasTags, Xot::Hookable, Xot::Setter
- Defined in:
- lib/reflex/view.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from HasTags
#clear_tags, #tag, #tag=, #tags, #untag
Methods included from HasFrame
#inset_by, #move_by, #move_to, #resize_by, #resize_to
Constructor Details
#initialize(options = nil, &block) ⇒ View
Returns a new instance of View.
56
57
58
59
60
|
# File 'lib/reflex/view.rb', line 56
def initialize(options = nil, &block)
super()
set options if options
Xot::BlockUtil.instance_eval_or_block_call self, &block if block
end
|
Class Method Details
.has_model ⇒ Object
147
148
149
|
# File 'lib/reflex/view.rb', line 147
def self.has_model()
include ModelView
end
|
Instance Method Details
#capturing?(*args) ⇒ Boolean
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/reflex/view.rb', line 102
def capturing?(*args)
args, cap = args.flatten, capture
if args.empty?
not cap.empty?
elsif args.include?(:all)
cap == [:key, :pointer, :midi]
else
args.all? {|type| cap.include? type}
end
end
|
#children ⇒ Object
84
85
86
|
# File 'lib/reflex/view.rb', line 84
def children()
to_enum :each_child
end
|
#delay(seconds = 0, &block) ⇒ Object
72
73
74
|
# File 'lib/reflex/view.rb', line 72
def delay(seconds = 0, &block)
timeout seconds, &block
end
|
#find_child(*args) ⇒ Object
Also known as:
find
80
81
82
|
# File 'lib/reflex/view.rb', line 80
def find_child(*args)
find_children(*args).first
end
|
#interval(seconds = 0, &block) ⇒ Object
68
69
70
|
# File 'lib/reflex/view.rb', line 68
def interval(seconds = 0, &block)
timeout seconds, count: -1, &block
end
|
113
114
|
# File 'lib/reflex/view.rb', line 113
def on_contact(e)
end
|
116
117
|
# File 'lib/reflex/view.rb', line 116
def on_contact_begin(e)
end
|
119
120
|
# File 'lib/reflex/view.rb', line 119
def on_contact_end(e)
end
|
#remove_self ⇒ Object
76
77
78
|
# File 'lib/reflex/view.rb', line 76
def remove_self()
parent.remove self if parent
end
|
#shapes ⇒ Object
98
99
100
|
# File 'lib/reflex/view.rb', line 98
def shapes()
to_enum :each_shape
end
|
#style(*args, &block) ⇒ Object
92
93
94
95
96
|
# File 'lib/reflex/view.rb', line 92
def style(*args, &block)
s = get_style args.empty? ? nil : Selector.selector(*args)
Xot::BlockUtil.instance_eval_or_block_call s, &block if block
s
end
|
#styles ⇒ Object
88
89
90
|
# File 'lib/reflex/view.rb', line 88
def styles()
to_enum :each_style
end
|
#timeout(seconds = 0, count: 1, &block) ⇒ Object
62
63
64
65
66
|
# File 'lib/reflex/view.rb', line 62
def timeout(seconds = 0, count: 1, &block)
timer = start_timer seconds, count
timer.block = block if block
timer
end
|