lib/cyberarm_engine/ui/elements/label.rb in cyberarm_engine-0.15.0 vs lib/cyberarm_engine/ui/elements/label.rb in cyberarm_engine-0.16.0
- old
+ new
@@ -1,8 +1,8 @@
module CyberarmEngine
class Element
- class Label < Element
+ class TextBlock < Element
def initialize(text, options = {}, block = nil)
super(options, block)
@text = Text.new(
text, font: @options[:font], z: @z, color: @options[:color],
@@ -17,11 +17,11 @@
def render
@text.draw
end
def clicked_left_mouse_button(_sender, _x, _y)
- @block&.call(self)
+ @block&.call(self) if @enabled
# return :handled
end
def recalculate
@@ -124,8 +124,33 @@
root.gui_state.request_recalculate if old_width != width || old_height != height
publish(:changed, self.value)
end
+ end
+
+ class Banner < TextBlock
+ end
+
+ class Title < TextBlock
+ end
+
+ class Subtitle < TextBlock
+ end
+
+ class Tagline < TextBlock
+ end
+
+ class Caption < TextBlock
+ end
+
+ class Para < TextBlock
+ end
+
+ class Inscription < TextBlock
+ end
+
+ # TODO: Remove in version 0.16.0+
+ class Label < TextBlock
end
end
end