Class: UnderOs::UI::Scroll

Inherits:
View show all
Defined in:
lib/under_os/ui/scroll.rb

Constant Summary

Constants included from Wrap

Wrap::INSTANCES_CACHE, Wrap::RAW_WRAPS_MAP, Wrap::WRAPS_TAGS_MAP

Instance Method Summary collapse

Methods inherited from View

#inspect

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=, #hidden, #hide, #id, #id=, #page, #show, #tagName, #toggle, #visible

Methods included from Styles

#addClass, #className, #className=, #classNames, #classNames=, #hasClass, #radioClass, #removeClass, #style, #style=, #toggleClass

Methods included from Events

#emit, #off, #on, #on=

Methods included from Wrap

included

Constructor Details

#initialize(options = {}) ⇒ Scroll

Returns a new instance of Scroll.



4
5
6
7
8
# File 'lib/under_os/ui/scroll.rb', line 4

def initialize(options={})
  super

  self.paging = options.delete(:paging)
end

Instance Method Details

#contentSizeObject



19
20
21
# File 'lib/under_os/ui/scroll.rb', line 19

def contentSize
  UnderOs::Point.new(x: @_.contentSize.width, y: @_.contentSize.height)
end

#contentSize=(*args) ⇒ Object



23
24
25
26
# File 'lib/under_os/ui/scroll.rb', line 23

def contentSize=(*args)
  size = UnderOs::Point.new(*args)
  @_.contentSize = CGSizeMake(size.x, size.y)
end

#pagingObject



10
11
12
# File 'lib/under_os/ui/scroll.rb', line 10

def paging
  @paging == nil ? false : @paging
end

#paging=(value) ⇒ Object



14
15
16
17
# File 'lib/under_os/ui/scroll.rb', line 14

def paging=(value)
  @paging = value == true ? true : nil
  @_.pagingEnabled = paging
end

#repaint(*args) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/under_os/ui/scroll.rb', line 28

def repaint(*args)
  content_size = {}

  super *args do |styles|
    styles.reject do |key, value|
      if [:contentWidth, :contentHeight].include?(key)
        content_size[key] = value
      end
    end
  end

  self.style = content_size unless content_size.empty?
end