Class: UnderOs::UI::Sidebar
- Inherits:
-
View
- Object
- View
- UnderOs::UI::Sidebar
- Defined in:
- lib/under_os/ui/sidebar.rb
Constant Summary collapse
- LOCATIONS =
[:top, :left, :right, :bottom]
Instance Method Summary collapse
- #hidden ⇒ Object
- #hide ⇒ Object
-
#initialize(options = {}) ⇒ Sidebar
constructor
A new instance of Sidebar.
- #location ⇒ Object
- #location=(value) ⇒ Object
- #show ⇒ Object
- #slide_distance ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Sidebar
Returns a new instance of Sidebar.
6 7 8 9 10 |
# File 'lib/under_os/ui/sidebar.rb', line 6 def initialize(={}) super self.location = .delete(:location) if .has_key?(:location) end |
Instance Method Details
#hidden ⇒ Object
37 38 39 |
# File 'lib/under_os/ui/sidebar.rb', line 37 def hidden !classNames.include?('visible') end |
#hide ⇒ Object
31 32 33 34 35 |
# File 'lib/under_os/ui/sidebar.rb', line 31 def hide @_class_names -= ['visible'] animate location => - end |
#location ⇒ Object
12 13 14 |
# File 'lib/under_os/ui/sidebar.rb', line 12 def location @location || :bottom end |
#location=(value) ⇒ Object
16 17 18 19 |
# File 'lib/under_os/ui/sidebar.rb', line 16 def location=(value) @location = value.to_sym @location = nil if ! LOCATIONS.include?(@location) end |
#show ⇒ Object
21 22 23 24 25 26 27 28 29 |
# 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 => -, display: :block} animate location => 0 end |
#slide_distance ⇒ Object
41 42 43 |
# File 'lib/under_os/ui/sidebar.rb', line 41 def [:top, :bottom].include?(location) ? size.y : size.x end |