Class: UnderOs::UI::Sidebar
Constant Summary collapse
- LOCATIONS =
[:top, :left, :right, :bottom]
Constants included from Wrap
Wrap::INSTANCES_CACHE, Wrap::RAW_WRAPS_MAP, Wrap::WRAPS_TAGS_MAP
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
Methods inherited from View
Methods included from Manipulation
#append, #clear, #insert, #insertTo, #prepend, #remove
Methods included from Traversing
#children, #empty?, #find, #first, #matches, #parent, #siblings
Methods included from Dimensions
#position, #position=, #size, #size=
Methods included from Animation
#animate, #fade_in, #fade_out, #highlight
Methods included from Commons
#data, #data=, #id, #id=, #page, #tagName, #toggle, #visible
Methods included from Styles
#addClass, #className, #className=, #classNames, #classNames=, #hasClass, #radioClass, #removeClass, #repaint, #style, #style=, #toggleClass
Methods included from Events
Methods included from Wrap
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 |