Loading

Paste #pss2abftc

  1. diff --git a/CorsixTH/Lua/window.lua b/CorsixTH/Lua/window.lua
  2. index 0c52544..dc4fa61 100644
  3. --- a/CorsixTH/Lua/window.lua
  4. +++ b/CorsixTH/Lua/window.lua
  5. @@ -317,16 +317,28 @@ function Panel:drawLabel(canvas, x, y, limit)
  6.    return next_y, last_x
  7.  end
  8.  
  9. +--! Set the position of a panel.
  10. +--!param x (int) New horizontal position of the panel.
  11. +--!param y (int) New vertical position of the panel.
  12.  function Panel:setPosition(x, y)
  13.    self.x = x
  14.    self.y = y
  15.  end
  16.  
  17. +--! Set the size of a panel.
  18. +--!param width (int) New width of the panel.
  19. +--!param height (int) New height of the panel.
  20.  function Panel:setSize(width, height)
  21.    self.w = width
  22.    self.h = height
  23.  end
  24.  
  25. +--! Set the visibility of the panel.
  26. +--!param visibility (bool) New visibility of the panel.
  27. +function Panel:setVisible(visibility)
  28. +  self.visible = visibility
  29. +end
  30. +
  31.  --[[ Add a `Panel` to the window.
  32.  ! Panels form the basic building blocks of most windows. A panel is a small
  33.  bitmap coupled with a position, and by combining several panels, a window can
  34. @@ -670,6 +682,9 @@ function Button:handleClick(mouse_button)
  35.    end
  36.  end
  37.  
  38. +--! Set the position of a button.
  39. +--!param x (int) New horizontal position of the button.
  40. +--!param y (int) New vertical position of the button.
  41.  function Button:setPosition(x, y)
  42.    self.panel_for_sprite:setPosition(x, y)
  43.    self.r = self.r - self.x + x
  44. @@ -682,6 +697,9 @@ function Button:setPosition(x, y)
  45.    end
  46.  end
  47.  
  48. +--! Set the size of a button.
  49. +--!param width (int) New width of the button.
  50. +--!param height (int) New height of the button.
  51.  function Button:setSize(width, height)
  52.    self.panel_for_sprite:setSize(width, height)
  53.    self.r = self.x + width
  54. @@ -692,6 +710,12 @@ function Button:setSize(width, height)
  55.    end
  56.  end
  57.  
  58. +--! Set the visibility of the button.
  59. +--!param visibility (bool) New visibility of the button.
  60. +function Button:setVisible(visibility)
  61. +  self.panel_for_sprite:setVisible(visibility)
  62. +end
  63. +
  64.  --! Convenience function to allow setLabel to be called on a button, not only its panel.
  65.  --! see Panel:setLabel
  66.  function Button:setLabel(label, font, align)

Comments