Class: StuffPage

Inherits:
UnderOs::Page show all
Defined in:
app/pages/stuff_page.rb

Instance Attribute Summary

Attributes inherited from UnderOs::Page

#_, #stylesheet

Instance Method Summary collapse

Methods inherited from UnderOs::Page

#alert, #build_layout, #compile_styles, #history, layout, #name, #navbar, new, #repaint, #setup_wrap, #title, #title=, #view, #view=

Methods included from UnderOs::Events

#emit, #off, #on

Constructor Details

#initializeStuffPage

Returns a new instance of StuffPage.



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'app/pages/stuff_page.rb', line 2

def initialize
  self.title = "Various Stuff"

  @box = View.new(style: {
    top:          50,
    left:         50,
    width:        100,
    height:       100,
    background:   :red,
    borderRadius: 10,
    borderWidth:  2,
    borderColor:  :green
  })

  @box.on(:tap){ @box.fade_out.fade_in }

  @b2 = View.new(style: {background: :blue})
  @b2.size = {x: 50, y: 50}
  @b2.position = {x: 25, y: 25}

  @b2.on(:tap, :highlight)

  insert @box.insert(@b2)

  insert Button.new(text: 'Boo Hoo!').position(x: 100, y: 200)

  insert Label.new(text: "Hey Label", style: {background: :red}).position({x: 100, y: 250})

  insert Icon.new(:cog).position(x: 50, y: 300)
  insert Icon.new(:trash).position(x: 100, y: 300)
  insert Icon.new(:home).position(x: 150, y: 300)
  insert Icon.new(:magic).position(x: 200, y: 300)
end