Advertisement
Guest User

gui

a guest
May 20th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.22 KB | None | 0 0
  1. local scheme = {
  2.   ack = {
  3.     bg = colours.green,
  4.     fg = colours.white,
  5.     bgp = colours.blue,
  6.     fgp = colours.white
  7.   },
  8.   stop = {
  9.     bg = colours.red,
  10.     fg = colours.black,
  11.     bgp = colours.orange,
  12.     fgp = colours.black
  13.   },
  14.   act = {
  15.     bg = colours.grey,
  16.     fg = colours.white,
  17.     bgp = colours.lightGrey,
  18.     fgp = colours.black
  19.   }
  20. }
  21.  
  22. local Button = {width = 1, height = 1, label = ""}
  23.  
  24. function Button:new(o)
  25.   local o = o or {}
  26.   setmetatable(o, self)
  27.   self.__index = self
  28.   return o
  29.  
  30.   --[[
  31.   if height < 0 then
  32.     button["height"] = 1
  33.   else
  34.     button["height"] = height
  35.   end
  36.   if width < label:len() then
  37.     button["width"] = label:len()
  38.   else
  39.     button["width"] = width
  40.   end
  41.   button["label"] = label
  42.   button["colours"] = scheme[colours]
  43.   button["parent"] = nil
  44.   return button
  45.   --]]
  46. end
  47.  
  48. function Button:dump()
  49.   print("-={  A button  }=-")
  50.   print("Width: "..self.width)
  51.   print("Height: "..self.height)
  52.   print("Label: "..self.label)
  53.   print("Colours: "..tostring(self.colours))
  54.   print("Parent: "..tostring(self.parent))
  55.   print()
  56. end
  57.  
  58. local Layout = {screen = nil}
  59.  
  60. local b = Button:new{width=12, height=1, label="OK", colours=scheme.ack}
  61. b:dump()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement