Class: Reflex::View
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
Methods included from Hookable
#hook
Constructor Details
#initialize(options = nil, &block) ⇒ View
Returns a new instance of View.
57
58
59
60
61
|
# File 'lib/reflex/view.rb', line 57
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
160
161
162
|
# File 'lib/reflex/view.rb', line 160
def self.has_model ()
include ModelView
end
|
Instance Method Details
#capturing?(*args) ⇒ Boolean
123
124
125
126
|
# File 'lib/reflex/view.rb', line 123
def capturing? (*args)
cap = capture
args.all? {|type| cap.include? type}
end
|
#categories ⇒ Object
103
104
105
|
# File 'lib/reflex/view.rb', line 103
def categories ()
@categories ||= Xot::BitFlag.new(auto: true, all: 1)
end
|
#category ⇒ Object
111
112
113
|
# File 'lib/reflex/view.rb', line 111
def category ()
parent_categories.bits2symbols get_category_bits
end
|
#category=(*symbols) ⇒ Object
107
108
109
|
# File 'lib/reflex/view.rb', line 107
def category= (*symbols)
set_category_bits parent_categories.symbols2bits *symbols
end
|
#children ⇒ Object
85
86
87
|
# File 'lib/reflex/view.rb', line 85
def children ()
to_enum :each_child
end
|
#collision ⇒ Object
119
120
121
|
# File 'lib/reflex/view.rb', line 119
def collision ()
parent_categories.bits2symbols get_collision_mask
end
|
#collision=(*categories) ⇒ Object
115
116
117
|
# File 'lib/reflex/view.rb', line 115
def collision= (*categories)
set_collision_mask parent_categories.symbols2bits *categories
end
|
#delay(seconds = 0, &block) ⇒ Object
73
74
75
|
# File 'lib/reflex/view.rb', line 73
def delay (seconds = 0, &block)
timeout seconds, &block
end
|
#find_child(*args) ⇒ Object
Also known as:
find
81
82
83
|
# File 'lib/reflex/view.rb', line 81
def find_child (*args)
find_children(*args).first
end
|
#interval(seconds = 0, &block) ⇒ Object
69
70
71
|
# File 'lib/reflex/view.rb', line 69
def interval (seconds = 0, &block)
timeout seconds, count: -1, &block
end
|
128
129
|
# File 'lib/reflex/view.rb', line 128
def on_contact (e)
end
|
131
132
|
# File 'lib/reflex/view.rb', line 131
def on_contact_begin (e)
end
|
134
135
|
# File 'lib/reflex/view.rb', line 134
def on_contact_end (e)
end
|
#remove_self ⇒ Object
77
78
79
|
# File 'lib/reflex/view.rb', line 77
def remove_self ()
parent.remove self if parent
end
|
#shapes ⇒ Object
99
100
101
|
# File 'lib/reflex/view.rb', line 99
def shapes ()
to_enum :each_shape
end
|
#style(*args, &block) ⇒ Object
93
94
95
96
97
|
# File 'lib/reflex/view.rb', line 93
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
89
90
91
|
# File 'lib/reflex/view.rb', line 89
def styles ()
to_enum :each_style
end
|
#timeout(seconds = 0, count: 1, &block) ⇒ Object
63
64
65
66
67
|
# File 'lib/reflex/view.rb', line 63
def timeout (seconds = 0, count: 1, &block)
timer = start_timer seconds, count
timer.block = block if block
timer
end
|