lib/vedeu/bindings/visibility.rb in vedeu-0.4.53 vs lib/vedeu/bindings/visibility.rb in vedeu-0.4.54
- old
+ new
@@ -12,21 +12,38 @@
# Setup events relating to visibility. This method is called by Vedeu.
#
# @return [void]
def setup!
+ clear_group!
hide_cursor!
hide_group!
hide_interface!
show_cursor!
show_group!
show_interface!
+ toggle_cursor!
+ toggle_group!
toggle_interface!
end
private
+ # Clears the spaces occupied by the interfaces belonging to the named
+ # group.
+ #
+ # @example
+ # Vedeu.trigger(:_clear_group_, name)
+ # Vedeu.clear_by_group(name)
+ #
+ # @return [void]
+ def clear_group!
+ Vedeu.bind(:_clear_group_) do |name|
+ Vedeu::Clear::NamedGroup.render(name)
+ end
+ end
+
# Hide the cursor of the named interface or if a name is not given, the
# interface currently in focus.
#
# @example
# Vedeu.trigger(:_hide_cursor_, name)
@@ -34,11 +51,11 @@
# Vedeu.hide_cursor(name)
#
# @return [void]
def hide_cursor!
Vedeu.bind(:_hide_cursor_) do |name|
- Vedeu::Visibility.hide_cursor(name)
+ Vedeu::Cursor.hide_cursor(name)
end
Vedeu.bind(:_cursor_hide_) do |name|
Vedeu.trigger(:_hide_cursor_, name)
end
end
@@ -48,29 +65,30 @@
# This may be rarely used, since the action of showing a group will
# effectively clear the terminal and show the new group.
#
# @example
- # Vedeu.trigger(:_hide_group_, group_name)
+ # Vedeu.trigger(:_hide_group_, name)
+ # Vedeu.hide_group(name)
#
# @return [void]
def hide_group!
Vedeu.bind(:_hide_group_) do |name|
- Vedeu.trigger(:_clear_group_, name)
+ Vedeu::Group.hide_group(name)
end
end
# Hiding an interface.
#
# @example
# Vedeu.trigger(:_hide_interface_, name)
+ # Vedeu.hide_interface(name)
#
# @return [void]
- # @see Vedeu::Buffer#hide
def hide_interface!
Vedeu.bind(:_hide_interface_) do |name|
- Vedeu.buffers.by_name(name).hide
+ Vedeu::Interface.hide_interface(name)
end
end
# Show the cursor of the named interface or if a name is not given, the
# interface currently in focus.
@@ -81,53 +99,79 @@
# Vedeu.show_cursor(name)
#
# @return [void]
def show_cursor!
Vedeu.bind(:_show_cursor_) do |name|
- Vedeu::Visibility.show_cursor(name)
+ Vedeu::Cursor.show_cursor(name)
end
Vedeu.bind(:_cursor_show_) do |name|
Vedeu.trigger(:_show_cursor_, name)
end
end
# Will clear the terminal and then show all of the interfaces belonging to
# the named group.
#
# @example
- # Vedeu.trigger(:_show_group_, group_name)
+ # Vedeu.trigger(:_show_group_, name)
+ # Vedeu.show_group(name)
#
# @return [void]
def show_group!
Vedeu.bind(:_show_group_) do |name|
- Vedeu.trigger(:_clear_)
- Vedeu.trigger(:_refresh_group_, name)
+ Vedeu::Group.show_group(name)
end
end
# Showing an interface.
#
# @example
# Vedeu.trigger(:_show_interface_, name)
+ # Vedeu.show_interface(name)
#
# @return [void]
- # @see Vedeu::Buffer#show
def show_interface!
Vedeu.bind(:_show_interface_) do |name|
- Vedeu.buffers.by_name(name).show
+ Vedeu::Interface.show_interface(name)
end
end
+ # Toggling a cursor.
+ #
+ # @example
+ # Vedeu.trigger(:_toggle_cursor_, name)
+ # Vedeu.toggle_cursor(name)
+ #
+ # @return [void]
+ def toggle_cursor!
+ Vedeu.bind(:_toggle_cursor_) do |name|
+ Vedeu::Cursor.toggle_cursor(name)
+ end
+ end
+
+ # Toggling a group.
+ #
+ # @example
+ # Vedeu.trigger(:_toggle_group_, name)
+ # Vedeu.toggle_group(name)
+ #
+ # @return [void]
+ def toggle_group!
+ Vedeu.bind(:_toggle_group_) do |name|
+ Vedeu::Group.toggle_group(name)
+ end
+ end
+
# Toggling an interface.
#
# @example
# Vedeu.trigger(:_toggle_interface_, name)
+ # Vedeu.toggle_interface(name)
#
# @return [void]
- # @see Vedeu::Buffer#toggle
def toggle_interface!
Vedeu.bind(:_toggle_interface_) do |name|
- Vedeu.buffers.by_name(name).toggle
+ Vedeu::Interface.toggle_interface(name)
end
end
end # Visibility
# :nocov: