class UnderOs::UI::Sidebar
Constants
- LOCATIONS
Public Class Methods
new(options={})
click to toggle source
Calls superclass method
UnderOs::UI::View::new
# File lib/under_os/ui/sidebar.rb, line 6 def initialize(options={}) super self.location = options.delete(:location) if options.has_key?(:location) end
Public Instance Methods
hide()
click to toggle source
# File lib/under_os/ui/sidebar.rb, line 31 def hide @_class_names -= ['visible'] animate location => -slide_distance end
location()
click to toggle source
# File lib/under_os/ui/sidebar.rb, line 12 def location @location || :bottom end
location=(value)
click to toggle source
# File lib/under_os/ui/sidebar.rb, line 16 def location=(value) @location = value.to_sym @location = nil if ! LOCATIONS.include?(@location) end
show()
click to toggle source
# File lib/under_os/ui/sidebar.rb, line 21 def show class_names = self.classNames class_names.reject!{ |n| LOCATIONS.include?(n.to_sym) } self.classNames = class_names + [location, 'visible'] self.style = {location => -slide_distance, display: :block} animate location => 0 end
slide_distance()
click to toggle source
# File lib/under_os/ui/sidebar.rb, line 41 def slide_distance [:top, :bottom].include?(location) ? size.y : size.x end