Class: Reflex::View

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
HasFrame, HasTags, Hookable, Xot::Setter
Defined in:
lib/reflex/view.rb

Direct Known Subclasses

Button, ListView, TextView

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.



54
55
56
57
58
# File 'lib/reflex/view.rb', line 54

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_modelObject



139
140
141
# File 'lib/reflex/view.rb', line 139

def self.has_model()
  include ModelView
end

Instance Method Details

#capturing?(*args) ⇒ Boolean

Returns:

  • (Boolean)


100
101
102
103
# File 'lib/reflex/view.rb', line 100

def capturing?(*args)
  cap = capture
  args.all? {|type| cap.include? type}
end

#childrenObject



82
83
84
# File 'lib/reflex/view.rb', line 82

def children()
  to_enum :each_child
end

#delay(seconds = 0, &block) ⇒ Object



70
71
72
# File 'lib/reflex/view.rb', line 70

def delay(seconds = 0, &block)
  timeout seconds, &block
end

#find_child(*args) ⇒ Object Also known as: find



78
79
80
# File 'lib/reflex/view.rb', line 78

def find_child(*args)
  find_children(*args).first
end

#interval(seconds = 0, &block) ⇒ Object



66
67
68
# File 'lib/reflex/view.rb', line 66

def interval(seconds = 0, &block)
  timeout seconds, count: -1, &block
end

#on_contact(e) ⇒ Object



105
106
# File 'lib/reflex/view.rb', line 105

def on_contact(e)
end

#on_contact_begin(e) ⇒ Object



108
109
# File 'lib/reflex/view.rb', line 108

def on_contact_begin(e)
end

#on_contact_end(e) ⇒ Object



111
112
# File 'lib/reflex/view.rb', line 111

def on_contact_end(e)
end

#remove_selfObject



74
75
76
# File 'lib/reflex/view.rb', line 74

def remove_self()
  parent.remove self if parent
end

#shapesObject



96
97
98
# File 'lib/reflex/view.rb', line 96

def shapes()
  to_enum :each_shape
end

#style(*args, &block) ⇒ Object



90
91
92
93
94
# File 'lib/reflex/view.rb', line 90

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

#stylesObject



86
87
88
# File 'lib/reflex/view.rb', line 86

def styles()
  to_enum :each_style
end

#timeout(seconds = 0, count: 1, &block) ⇒ Object



60
61
62
63
64
# File 'lib/reflex/view.rb', line 60

def timeout(seconds = 0, count: 1, &block)
  timer = start_timer seconds, count
  timer.block = block if block
  timer
end