lacci 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +8 -1
  4. data/lib/lacci/scarpe_cli.rb +2 -1
  5. data/lib/lacci/scarpe_core.rb +2 -1
  6. data/lib/lacci/version.rb +1 -1
  7. data/lib/scarpe/niente/app.rb +23 -0
  8. data/lib/scarpe/niente/display_service.rb +62 -0
  9. data/lib/scarpe/niente/drawable.rb +57 -0
  10. data/lib/scarpe/niente/logger.rb +29 -0
  11. data/lib/scarpe/niente/shoes_spec.rb +87 -0
  12. data/lib/scarpe/niente.rb +20 -0
  13. data/lib/shoes/app.rb +88 -43
  14. data/lib/shoes/background.rb +2 -2
  15. data/lib/shoes/border.rb +2 -2
  16. data/lib/shoes/builtins.rb +63 -0
  17. data/lib/shoes/changelog.rb +52 -0
  18. data/lib/shoes/colors.rb +3 -1
  19. data/lib/shoes/constants.rb +19 -1
  20. data/lib/shoes/display_service.rb +39 -16
  21. data/lib/shoes/download.rb +2 -2
  22. data/lib/shoes/drawable.rb +380 -0
  23. data/lib/shoes/drawables/arc.rb +49 -0
  24. data/lib/shoes/drawables/arrow.rb +41 -0
  25. data/lib/shoes/drawables/button.rb +73 -0
  26. data/lib/shoes/{widgets → drawables}/check.rb +5 -4
  27. data/lib/shoes/{widgets → drawables}/document_root.rb +3 -3
  28. data/lib/shoes/{widgets → drawables}/edit_box.rb +6 -6
  29. data/lib/shoes/{widgets → drawables}/edit_line.rb +6 -6
  30. data/lib/shoes/{widgets → drawables}/flow.rb +6 -6
  31. data/lib/shoes/{widgets → drawables}/image.rb +6 -6
  32. data/lib/shoes/{widgets → drawables}/line.rb +7 -5
  33. data/lib/shoes/drawables/link.rb +34 -0
  34. data/lib/shoes/drawables/list_box.rb +56 -0
  35. data/lib/shoes/drawables/para.rb +118 -0
  36. data/lib/shoes/drawables/progress.rb +14 -0
  37. data/lib/shoes/drawables/radio.rb +33 -0
  38. data/lib/shoes/drawables/rect.rb +17 -0
  39. data/lib/shoes/{widgets → drawables}/shape.rb +6 -7
  40. data/lib/shoes/{widgets → drawables}/slot.rb +32 -20
  41. data/lib/shoes/{widgets → drawables}/span.rb +8 -7
  42. data/lib/shoes/{widgets → drawables}/stack.rb +6 -4
  43. data/lib/shoes/drawables/star.rb +50 -0
  44. data/lib/shoes/drawables/subscription_item.rb +93 -0
  45. data/lib/shoes/drawables/text_drawable.rb +63 -0
  46. data/lib/shoes/drawables/video.rb +16 -0
  47. data/lib/shoes/drawables/widget.rb +69 -0
  48. data/lib/shoes/drawables.rb +31 -0
  49. data/lib/shoes/errors.rb +28 -0
  50. data/lib/shoes/log.rb +2 -2
  51. data/lib/shoes/ruby_extensions.rb +15 -0
  52. data/lib/shoes/spacing.rb +2 -2
  53. data/lib/shoes-spec.rb +93 -0
  54. data/lib/shoes.rb +27 -7
  55. metadata +55 -28
  56. data/lib/shoes/widget.rb +0 -218
  57. data/lib/shoes/widgets/alert.rb +0 -19
  58. data/lib/shoes/widgets/arc.rb +0 -51
  59. data/lib/shoes/widgets/button.rb +0 -35
  60. data/lib/shoes/widgets/font.rb +0 -14
  61. data/lib/shoes/widgets/link.rb +0 -25
  62. data/lib/shoes/widgets/list_box.rb +0 -25
  63. data/lib/shoes/widgets/para.rb +0 -68
  64. data/lib/shoes/widgets/radio.rb +0 -35
  65. data/lib/shoes/widgets/star.rb +0 -44
  66. data/lib/shoes/widgets/subscription_item.rb +0 -60
  67. data/lib/shoes/widgets/text_widget.rb +0 -51
  68. data/lib/shoes/widgets/video.rb +0 -15
  69. data/lib/shoes/widgets.rb +0 -29
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Shoes
4
+ class Arc < Shoes::Drawable
5
+ shoes_style :draw_context
6
+ shoes_events # No Arc-specific events yet
7
+
8
+ [:left, :top, :width, :height].each do |prop|
9
+ shoes_style(prop) { |val| convert_to_integer(val, prop) }
10
+ end
11
+
12
+ [:angle1, :angle2].each do |prop|
13
+ shoes_style(prop) { |val| convert_to_float(val, prop) }
14
+ end
15
+
16
+ def initialize(*args)
17
+ @draw_context = Shoes::App.instance.current_draw_context
18
+
19
+ super
20
+ self.left, self.top, self.width, self.height, self.angle1, self.angle2 = args
21
+
22
+ create_display_drawable
23
+ end
24
+
25
+ def self.convert_to_integer(value, attribute_name)
26
+ begin
27
+ value = Integer(value)
28
+ raise Shoes::Errors::InvalidAttributeValueError, "Negative number '#{value}' not allowed for attribute '#{attribute_name}'" if value < 0
29
+
30
+ value
31
+ rescue ArgumentError
32
+ error_message = "Invalid value '#{value}' provided for attribute '#{attribute_name}'. The value should be a number."
33
+ raise Shoes::Errors::InvalidAttributeValueError, error_message
34
+ end
35
+ end
36
+
37
+ def self.convert_to_float(value, attribute_name)
38
+ begin
39
+ value = Float(value)
40
+ raise Shoes::Errors::InvalidAttributeValueError, "Negative number '#{value}' not allowed for attribute '#{attribute_name}'" if value < 0
41
+
42
+ value
43
+ rescue ArgumentError
44
+ error_message = "Invalid value '#{value}' provided for attribute '#{attribute_name}'. The value should be a number."
45
+ raise Shoes::Errors::InvalidAttributeValueError, error_message
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Shoes
4
+ class Arrow < Shoes::Drawable
5
+ shoes_style :draw_context
6
+ shoes_events # No Arrow-specific events yet
7
+
8
+ [:left, :top, :width].each do |prop|
9
+ shoes_style(prop) { |val| val.is_a?(Hash) ? val : convert_to_integer(val, prop) }
10
+ end
11
+
12
+ def initialize(*args)
13
+ @draw_context = Shoes::App.instance.current_draw_context
14
+
15
+ super
16
+
17
+ if args.length == 1 && args[0].is_a?(Hash)
18
+ options = args[0]
19
+ self.left = options[:left]
20
+ self.top = options[:top]
21
+ self.width = options[:width]
22
+ else
23
+ self.left, self.top, self.width = args
24
+ end
25
+
26
+ create_display_drawable
27
+ end
28
+
29
+ def self.convert_to_integer(value, attribute_name)
30
+ begin
31
+ value = Integer(value)
32
+ raise Shoes::Errors::InvalidAttributeValueError, "Negative number '#{value}' not allowed for attribute '#{attribute_name}'" if value < 0
33
+
34
+ value
35
+ rescue ArgumentError
36
+ error_message = "Invalid value '#{value}' provided for attribute '#{attribute_name}'. The value should be a number."
37
+ raise Shoes::Errors::InvalidAttributeValueError, error_message
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Shoes
4
+ class Button < Shoes::Drawable
5
+ include Shoes::Log
6
+ shoes_styles :text, :width, :height, :top, :left, :color, :padding_top, :padding_bottom, :text_color, :size, :font_size, :tooltip
7
+ shoes_events :click, :hover
8
+
9
+ # Creates a new Button object.
10
+ #
11
+ # @param text [String] The text displayed on the button.
12
+ # @param width [Integer] The requested width of the button in pixels.
13
+ # @param height [Integer] The requested height of the button in pixels.
14
+ # @param top [Integer] The position of the top edge of the button relative to its parent widget.
15
+ # @param left [Integer] The position of the left edge of the button relative to its parent widget.
16
+ # @param size [Integer] The font size of the button text.
17
+ # @param color [String] The background color of the button.
18
+ # @param padding_top [Integer] The padding above the button text.
19
+ # @param padding_bottom [Integer] The padding below the button text.
20
+ # @param text_color [String] The color of the button text.
21
+ # @yield A block of code to be executed when the button is clicked.
22
+ # @return [Shoes::Button] the button object
23
+ #
24
+ # @example
25
+ # Shoes.app do
26
+ # @push = button "Push me"
27
+ # @note = para "Nothing pushed so far"
28
+ # @push.click {
29
+ # @note.replace(
30
+ # "Aha! Click! ",
31
+ # link("Go back") { @note.replace("Nothing pushed so far") }
32
+ # )
33
+ # }
34
+ # end
35
+ def initialize(text, width: nil, height: nil, top: nil, left: nil, color: nil, padding_top: nil, padding_bottom: nil, size: 12, text_color: nil,
36
+ font_size: nil, tooltip: nil, &block)
37
+
38
+ log_init("Button")
39
+
40
+ # Properties passed as positional args, not keywords, don't get auto-set
41
+ @text = text
42
+ @block = block
43
+
44
+ super
45
+
46
+ # Bind to a handler named "click"
47
+ bind_self_event("click") do
48
+ @log.debug("Button clicked, calling handler") if @block
49
+ @block&.call
50
+ end
51
+
52
+ bind_self_event("hover") do
53
+ @hover&.call
54
+ end
55
+
56
+ create_display_drawable
57
+ end
58
+
59
+ # Set the click handler
60
+ #
61
+ # @yield A block to be called when the button is clicked.
62
+ def click(&block)
63
+ @block = block
64
+ end
65
+
66
+ # Set the hover handler
67
+ #
68
+ # @yield A block to be called when the cursor moves to be over the button.
69
+ def hover(&block)
70
+ @hover = block
71
+ end
72
+ end
73
+ end
@@ -1,15 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Shoes
4
- class Check < Shoes::Widget
5
- display_properties :checked
3
+ class Shoes
4
+ class Check < Shoes::Drawable
5
+ shoes_styles :checked
6
+ shoes_events :click
6
7
 
7
8
  def initialize(checked = nil, &block)
8
9
  @block = block
9
10
  super
10
11
 
11
12
  bind_self_event("click") { click }
12
- create_display_widget
13
+ create_display_drawable
13
14
  end
14
15
 
15
16
  def click(&block)
@@ -1,15 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Shoes
3
+ class Shoes
4
4
  class DocumentRoot < Shoes::Flow
5
+ shoes_events # No DocumentRoot-specific events yet
6
+
5
7
  def initialize
6
8
  @height = "100%"
7
9
  @width = @margin = @padding = nil
8
10
  @options = {}
9
11
 
10
12
  super
11
-
12
- create_display_widget
13
13
  end
14
14
 
15
15
  # The default inspect string can be absolutely huge in console output, and it's frequently printed.
@@ -1,21 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Shoes
4
- class EditBox < Shoes::Widget
5
- display_properties :text, :height, :width
3
+ class Shoes
4
+ class EditBox < Shoes::Drawable
5
+ shoes_styles :text, :height, :width
6
+ shoes_events :change
6
7
 
7
8
  def initialize(text = "", height: nil, width: nil, &block)
9
+ super
8
10
  @text = text
9
11
  @callback = block
10
12
 
11
- super
12
-
13
13
  bind_self_event("change") do |new_text|
14
14
  self.text = new_text
15
15
  @callback&.call(self)
16
16
  end
17
17
 
18
- create_display_widget
18
+ create_display_drawable
19
19
  end
20
20
 
21
21
  def change(&block)
@@ -1,21 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Shoes
4
- class EditLine < Shoes::Widget
5
- display_properties :text, :width
3
+ class Shoes
4
+ class EditLine < Shoes::Drawable
5
+ shoes_styles :text, :width
6
+ shoes_events :change
6
7
 
7
8
  def initialize(text = "", width: nil, &block)
9
+ super
8
10
  @block = block
9
11
  @text = text
10
12
 
11
- super
12
-
13
13
  bind_self_event("change") do |new_text|
14
14
  self.text = new_text
15
15
  @block&.call(new_text)
16
16
  end
17
17
 
18
- create_display_widget
18
+ create_display_drawable
19
19
  end
20
20
 
21
21
  def change(&block)
@@ -1,20 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Shoes
3
+ class Shoes
4
4
  class Flow < Shoes::Slot
5
5
  include Shoes::Background
6
6
  include Shoes::Border
7
7
  include Shoes::Spacing
8
8
 
9
- display_properties :width, :height, :margin, :padding
9
+ shoes_styles :width, :height, :margin, :padding
10
+ shoes_events
10
11
 
11
12
  def initialize(width: "100%", height: nil, margin: nil, padding: nil, **options, &block)
12
- @options = options
13
-
14
13
  super
14
+ @options = options
15
15
 
16
- # Create the display-side widget *before* instance_eval, which will add child widgets with their display widgets
17
- create_display_widget
16
+ # Create the display-side drawable *before* instance_eval, which will add child drawables with their display drawables
17
+ create_display_drawable
18
18
 
19
19
  Shoes::App.instance.with_slot(self, &block) if block_given?
20
20
  end
@@ -1,18 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Shoes
4
- class Image < Shoes::Widget
5
- display_properties :url, :width, :height, :top, :left, :click
3
+ class Shoes
4
+ class Image < Shoes::Drawable
5
+ shoes_styles :url, :width, :height, :top, :left, :click
6
+ shoes_events # No Image-specific events yet
6
7
 
7
8
  def initialize(url, width: nil, height: nil, top: nil, left: nil, click: nil)
8
- @url = url
9
-
10
9
  super
10
+ @url = url
11
11
 
12
12
  # Get the image dimensions
13
13
  # @width, @height = size
14
14
 
15
- create_display_widget
15
+ create_display_drawable
16
16
  end
17
17
 
18
18
  def replace(url)
@@ -1,18 +1,20 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Shoes
4
- class Line < Shoes::Widget
5
- display_properties :left, :top, :x2, :y2, :draw_context
3
+ class Shoes
4
+ class Line < Shoes::Drawable
5
+ shoes_styles :left, :top, :x2, :y2, :draw_context
6
+ shoes_events # No Line-specific events yet
6
7
 
7
8
  def initialize(left, top, x2, y2)
9
+ super
10
+
8
11
  @left = left
9
12
  @top = top
10
13
  @x2 = x2
11
14
  @y2 = y2
12
15
  @draw_context = Shoes::App.instance.current_draw_context
13
16
 
14
- super
15
- create_display_widget
17
+ create_display_drawable
16
18
  end
17
19
  end
18
20
  end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Shoes
4
+ class Link < Shoes::TextDrawable
5
+ shoes_styles :text, :click, :has_block
6
+ shoes_events :click
7
+
8
+ def initialize(text, click: nil, &block)
9
+ super
10
+
11
+ @text = text
12
+ @block = block
13
+ # We can't send a block to the display drawable, but we can send a boolean
14
+ @has_block = !block.nil?
15
+
16
+ # The click property should be changed before it gets sent to the display drawable
17
+ @click ||= "#"
18
+
19
+ bind_self_event("click") do
20
+ @block&.call
21
+ end
22
+
23
+ create_display_drawable
24
+ end
25
+ end
26
+
27
+ # In Shoes, the LinkHover pseudo-class is used to set default styles for links when
28
+ # hovered over. The functionality isn't present in Lacci yet.
29
+ class LinkHover < Link
30
+ def initialize
31
+ raise "This class should never be instantiated! Use link, not link_hover!"
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Shoes
4
+ class ListBox < Shoes::Drawable
5
+ shoes_styles :items, :height, :width
6
+
7
+ # Shoes3 uses choose as the initialize arg, and .choose(item) as the setter here,
8
+ # but queries it with .text. So this is an unusual style, and we've chosen this
9
+ # name not to conflict with Shoes3.
10
+ shoes_style :chosen
11
+
12
+ shoes_events :change
13
+
14
+ def initialize(**args, &block)
15
+ super
16
+
17
+ @items = args[:items] || []
18
+ @chosen = args[:choose] || args[:items]&.first
19
+
20
+ bind_self_event("change") do |new_item|
21
+ self.chosen = new_item
22
+ @callback&.call(self)
23
+ end
24
+
25
+ create_display_drawable
26
+ end
27
+
28
+ # Select an item. `item` should be a text entry from `items`.
29
+ #
30
+ # @param item [String] the item to choose
31
+ # @return [void]
32
+ def choose(item)
33
+ unless self.items.include?(item)
34
+ raise Shoes::Errors::NoSuchListItemError, "List items (#{self.items.inspect}) do not contain item #{item.inspect}!"
35
+ end
36
+
37
+ @chosen = item
38
+ end
39
+
40
+ # The currently chosen text item or nil.
41
+ #
42
+ # @return [String|NilClass] the current text item or nil.
43
+ def text
44
+ @chosen
45
+ end
46
+
47
+ # Register a block to be called when the selection changes.
48
+ #
49
+ # @yield the block to be called when selection changes
50
+ # @return [Shoes::ListBox] self
51
+ def change(&block)
52
+ @callback = block
53
+ self # Allow chaining calls
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,118 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Shoes
4
+ class Para < Shoes::Drawable
5
+ shoes_styles :text_items, :size, :font, :html_attributes, :hidden
6
+ shoes_style(:stroke) { |val| Shoes::Colors.to_rgb(val) }
7
+
8
+ shoes_events # No Para-specific events yet
9
+
10
+ # Initializes a new instance of the `Para` widget.
11
+ #
12
+ # @param args The text content of the paragraph.
13
+ # @param stroke [String, nil] The color of the text stroke.
14
+ # @param size [Symbol] The size of the paragraph text.
15
+ # @param font [String, nil] The font of the paragraph text.
16
+ # @param hidden [Boolean] Determines if the paragraph is initially hidden.
17
+ # @param html_attributes [Hash] Additional HTML attributes for the paragraph.
18
+ #
19
+ # @example
20
+ # Shoes.app do
21
+ # p = para "Hello, This is at the top!", stroke: "red", size: :title, font: "Arial"
22
+ #
23
+ # banner("Welcome to Shoes!")
24
+ # title("Shoes Examples")
25
+ # subtitle("Explore the Features")
26
+ # tagline("Step into a World of Shoes")
27
+ # caption("A GUI Framework for Ruby")
28
+ # inscription("Designed for Easy Development")
29
+ #
30
+ # p.replace "On top we'll switch to ", strong("bold"), "!"
31
+ # end
32
+ def initialize(*args, stroke: nil, size: :para, font: nil, **html_attributes)
33
+ super
34
+
35
+ # Text_children alternates strings and TextDrawables, so we can't just pass
36
+ # it as a Shoes style. It won't serialize.
37
+ update_text_children(args)
38
+
39
+ @html_attributes = html_attributes || {}
40
+
41
+ create_display_drawable
42
+ end
43
+
44
+ private
45
+
46
+ def text_children_to_items(text_children)
47
+ text_children.map { |arg| arg.is_a?(String) ? arg : arg.linkable_id }
48
+ end
49
+
50
+ public
51
+
52
+ # Sets the paragraph text to a new value, which can
53
+ # include {TextDrawable}s like em(), strong(), etc.
54
+ #
55
+ # @param children [Array] the arguments can be Strings and/or TextDrawables
56
+ # @return [void]
57
+ def replace(*children)
58
+ update_text_children(children)
59
+ end
60
+
61
+ # Set the paragraph text to a single String.
62
+ # To use bold, italics, etc. use {Para#replace} instead.
63
+ #
64
+ # @param child [String] the new text to use for this Para
65
+ # @return [void]
66
+ def text=(*children)
67
+ update_text_children(children)
68
+ end
69
+
70
+ def text
71
+ @text_children.map(&:to_s).join
72
+ end
73
+
74
+ def to_s
75
+ self.text
76
+ end
77
+
78
+ private
79
+
80
+ # Text_children alternates strings and TextDrawables, so we can't just pass
81
+ # it as a Shoes style. It won't serialize.
82
+ def update_text_children(children)
83
+ @text_children = children.flatten
84
+ # This should signal the display drawable to change
85
+ self.text_items = text_children_to_items(@text_children)
86
+ end
87
+ end
88
+ end
89
+
90
+ class Shoes
91
+ class Drawable
92
+ def banner(*args, **kwargs)
93
+ para(*args, **{ size: :banner }.merge(kwargs))
94
+ end
95
+
96
+ def title(*args, **kwargs)
97
+ para(*args, **{ size: :title }.merge(kwargs))
98
+ end
99
+
100
+ def subtitle(*args, **kwargs)
101
+ para(*args, **{ size: :subtitle }.merge(kwargs))
102
+ end
103
+
104
+ def tagline(*args, **kwargs)
105
+ para(*args, **{ size: :tagline }.merge(kwargs))
106
+ end
107
+
108
+ def caption(*args, **kwargs)
109
+ para(*args, **{ size: :caption }.merge(kwargs))
110
+ end
111
+
112
+ def inscription(*args, **kwargs)
113
+ para(*args, **{ size: :inscription }.merge(kwargs))
114
+ end
115
+
116
+ alias_method :ins, :inscription
117
+ end
118
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Shoes
4
+ class Progress < Shoes::Drawable
5
+ shoes_styles :fraction
6
+ shoes_events # No Progress-specific events yet
7
+
8
+ def initialize(fraction: nil)
9
+ super
10
+
11
+ create_display_drawable
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Shoes
4
+ # A Radio button drawable. Only a single radio button may be checked in each
5
+ # group. If no group is specified, or the group is nil, default to all
6
+ # radio buttons in the same slot being treated as being in the same group.
7
+ class Radio < Shoes::Drawable
8
+ shoes_styles :group, :checked
9
+ shoes_events :click
10
+
11
+ def initialize(group = nil, checked: nil, &block)
12
+ super
13
+ @group = group
14
+ @block = block
15
+
16
+ bind_self_event("click") { click }
17
+ create_display_drawable
18
+ end
19
+
20
+ def click(&block)
21
+ @block = block
22
+ self.checked = !checked?
23
+ end
24
+
25
+ def checked?
26
+ @checked ? true : false
27
+ end
28
+
29
+ def checked(value)
30
+ self.checked = value
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ class Shoes
4
+ class Rect < Shoes::Drawable
5
+ shoes_styles :left, :top, :width, :height, :draw_context, :curve
6
+ shoes_events # No Rect-specific events yet
7
+
8
+ def initialize(*args)
9
+ @draw_context = Shoes::App.instance.current_draw_context
10
+
11
+ super
12
+ self.left, self.top, self.width, self.height, self.curve = args
13
+
14
+ create_display_drawable
15
+ end
16
+ end
17
+ end
@@ -1,25 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Shoes
3
+ class Shoes
4
4
  # A Shape acts as a sort of union type for drawn shapes. In Shoes you can use it to merge multiple
5
5
  # ovals, arcs, stars, etc. into a single drawn shape.
6
6
  #
7
7
  # In Shoes3, a Shape isn't really a Slot. It's a kind of DSL with drawing commands that happen
8
- # to have the same name as the Art widgets like star, arc, etc. Here we're treating it as
9
- # a slot containing those widgets, which is wrong but not *too* wrong.
8
+ # to have the same name as the Art drawables like star, arc, etc. Here we're treating it as
9
+ # a slot containing those drawables, which is wrong but not *too* wrong.
10
10
  #
11
11
  # @incompatibility A Shoes3 Shape is *not* a slot; Scarpe does *not* do union shapes
12
12
  class Shape < Shoes::Slot
13
- display_properties :left, :top, :shape_commands, :draw_context
13
+ shoes_styles :left, :top, :shape_commands, :draw_context
14
+ shoes_events # No Shape-specific events yet
14
15
 
15
16
  def initialize(left: nil, top: nil, &block)
16
- @left = left
17
- @top = top
18
17
  @shape_commands = []
19
18
  @draw_context = Shoes::App.instance.current_draw_context
20
19
 
21
20
  super
22
- create_display_widget
21
+ create_display_drawable
23
22
 
24
23
  Shoes::App.instance.with_slot(self, &block) if block_given?
25
24
  end