/traderous

To get this branch, use:
bzr branch /bzr/traderous

« back to all changes in this revision

Viewing changes to trade_view.lua

  • Committer: Josh C
  • Date: 2013-06-15 19:58:24 UTC
  • Revision ID: josh@9ix.org-20130615195824-62r7gwrujgyijmh9
prices, buttons

Show diffs side-by-side

added added

removed removed

6
6
 
7
7
              local boxL = the.app.width / 2 - 200
8
8
              local boxT = the.app.height / 2 - 200
 
9
              local boxR = boxL + 400
 
10
 
 
11
              local lh = 17 -- line height
9
12
 
10
13
              self:add(Fill:new{
11
14
                          fill = {255,255,255},
27
30
                 local t = Text:new{
28
31
                    text = good[1],
29
32
                    x = boxL + 10,
 
33
                    y = boxT + 10 + (i-1) * lh,
30
34
                    width = 380
31
35
                 }
32
36
 
33
 
                 local tw, th = t:getSize()
34
 
                 t.y = boxT + 10 + (i-1) * th -- (th + 2) -- for padding?
35
 
 
36
 
                 self:add(t)
 
37
                 self:add(t)
 
38
 
 
39
                 t = Text:new{
 
40
                    text = good[2],
 
41
                    x = boxL + 10,
 
42
                    y = boxT + 10 + (i-1) * lh,
 
43
                    width = 300,
 
44
                    align = 'right'
 
45
                 }
 
46
                 self:add(t)
 
47
 
 
48
                 local b = Button:new{
 
49
                    x = boxR - 80,
 
50
                    y = boxT + 10 + (i-1) * lh - 1,
 
51
                    label = Text:new{ text = 'BUY', x = 1 },
 
52
                 }
 
53
                 local tw, th = b.label:getSize()
 
54
                 b.background = Fill:new{
 
55
                    fill = {100,100,100},
 
56
                    width = tw + 3,
 
57
                    height = th
 
58
                 }
 
59
                 self:add(b)
 
60
 
 
61
                 b = Button:new{
 
62
                    x = boxR - 40,
 
63
                    y = boxT + 10 + (i-1) * lh - 1,
 
64
                    label = Text:new{ text = 'SELL', x = 1 },
 
65
                 }
 
66
                 local tw, th = b.label:getSize()
 
67
                 b.background = Fill:new{
 
68
                    fill = {100,100,100},
 
69
                    width = tw + 3,
 
70
                    height = th
 
71
                 }
 
72
                 self:add(b)
 
73
 
37
74
              end
38
75
           end,
39
76
   activate = function (self)