lib/vedeu/models/view/interface.rb in vedeu-0.3.1 vs lib/vedeu/models/view/interface.rb in vedeu-0.3.2
- old
+ new
@@ -23,14 +23,12 @@
include Vedeu::DisplayBuffer
collection Vedeu::Lines
member Vedeu::Line
- attr_accessor :border,
- :colour,
+ attr_accessor :colour,
:delay,
- :geometry,
:group,
:name,
:parent,
:style
@@ -106,14 +104,12 @@
@lines = lines
@parent = parent
@colour = colour
@style = style
- @border = nil
- @delay = 0.0
- @geometry = nil
- @group = ''
+ @delay = 0.0
+ @group = ''
@repository = Vedeu.interfaces
end
# @param child []
@@ -123,14 +119,12 @@
end
# @return [Hash]
def attributes
{
- border: border,
colour: colour,
delay: delay,
- geometry: geometry,
group: group,
name: name,
parent: parent,
style: style,
}
@@ -138,18 +132,32 @@
# Returns a boolean indicating whether the interface has a border.
#
# @return [Boolean]
def border?
- !!(border)
+ Vedeu.borders.registered?(name)
end
+ # Returns the border object belonging to the interface.
+ #
+ # @return [Vedeu::Border|NilClass]
+ def border
+ if border?
+ Vedeu.borders.find(name)
+ end
+ end
+
# @return [Vedeu::Cursor]
def cursor
Vedeu.cursors.by_name(name)
end
+ # @return [Vedeu::Geometry]
+ def geometry
+ Vedeu.geometries.find(name)
+ end
+
# Returns log friendly output.
#
# @return [String]
def inspect
"<#{self.class.name} (lines:#{lines.size})>"
@@ -167,36 +175,18 @@
# @return [Boolean]
def lines?
lines.any?
end
- # Renders the interface with a border if one is defined.
- #
- # @return [Array]
- def render
- if border?
- border.render
-
- else
- viewport
-
- end
- end
-
# @return [Interface]
def store
super
store_new_buffer
store_refresh_events
store_focusable
store_cursor
store_group
- end
-
- # return [Array]
- def viewport
- Vedeu::Viewport.show(self)
end
end # Interface
end # Vedeu