wxruby3-shapes 0.9.0.pre.beta.3 → 0.9.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +5 -7
  3. data/README.md +38 -6
  4. data/assets/logo.svg +339 -0
  5. data/assets/logo.xpm +60 -0
  6. data/assets/screenshot.png +0 -0
  7. data/assets/social.png +0 -0
  8. data/bin/wx-shapes +1 -1
  9. data/lib/wx/shapes/arrow_base.rb +4 -11
  10. data/lib/wx/shapes/arrows/circle_arrow.rb +22 -11
  11. data/lib/wx/shapes/arrows/circle_prong_arrow.rb +48 -0
  12. data/lib/wx/shapes/arrows/cross_bar_arrow.rb +57 -0
  13. data/lib/wx/shapes/arrows/cross_bar_circle_arrow.rb +56 -0
  14. data/lib/wx/shapes/arrows/cross_bar_prong_arrow.rb +49 -0
  15. data/lib/wx/shapes/arrows/crossed_circle.rb +46 -0
  16. data/lib/wx/shapes/arrows/cup_arrow.rb +65 -0
  17. data/lib/wx/shapes/arrows/diamond_arrow.rb +8 -13
  18. data/lib/wx/shapes/arrows/double_cross_bar_arrow.rb +27 -0
  19. data/lib/wx/shapes/arrows/filled_arrow.rb +60 -0
  20. data/lib/wx/shapes/arrows/line_arrow.rb +67 -0
  21. data/lib/wx/shapes/arrows/open_arrow.rb +22 -23
  22. data/lib/wx/shapes/arrows/prong_arrow.rb +42 -0
  23. data/lib/wx/shapes/arrows/solid_arrow.rb +21 -35
  24. data/lib/wx/shapes/arrows/square_arrow.rb +37 -0
  25. data/lib/wx/shapes/auto_layout.rb +2 -2
  26. data/lib/wx/shapes/base.rb +1 -1
  27. data/lib/wx/shapes/canvas_history.rb +20 -0
  28. data/lib/wx/shapes/connection_point.rb +10 -6
  29. data/lib/wx/shapes/diagram.rb +98 -78
  30. data/lib/wx/shapes/events.rb +8 -8
  31. data/lib/wx/shapes/printout.rb +3 -16
  32. data/lib/wx/shapes/serializable.rb +2 -436
  33. data/lib/wx/shapes/serialize/wx.rb +30 -18
  34. data/lib/wx/shapes/shape.rb +211 -168
  35. data/lib/wx/shapes/shape_canvas.rb +728 -267
  36. data/lib/wx/shapes/shape_data_object.rb +99 -18
  37. data/lib/wx/shapes/shape_handle.rb +18 -11
  38. data/lib/wx/shapes/shape_list.rb +34 -67
  39. data/lib/wx/shapes/shapes/bitmap_shape.rb +23 -24
  40. data/lib/wx/shapes/shapes/box_shape.rb +389 -0
  41. data/lib/wx/shapes/shapes/circle_shape.rb +19 -22
  42. data/lib/wx/shapes/shapes/control_shape.rb +77 -41
  43. data/lib/wx/shapes/shapes/curve_shape.rb +38 -31
  44. data/lib/wx/shapes/shapes/diamond_shape.rb +7 -17
  45. data/lib/wx/shapes/shapes/edit_text_shape.rb +6 -9
  46. data/lib/wx/shapes/shapes/ellipse_shape.rb +12 -15
  47. data/lib/wx/shapes/shapes/flex_grid_shape.rb +58 -33
  48. data/lib/wx/shapes/shapes/grid_shape.rb +259 -161
  49. data/lib/wx/shapes/shapes/line_shape.rb +155 -161
  50. data/lib/wx/shapes/shapes/manager_shape.rb +77 -0
  51. data/lib/wx/shapes/shapes/multi_sel_rect.rb +8 -8
  52. data/lib/wx/shapes/shapes/ortho_shape.rb +31 -36
  53. data/lib/wx/shapes/shapes/polygon_shape.rb +23 -29
  54. data/lib/wx/shapes/shapes/rect_shape.rb +95 -53
  55. data/lib/wx/shapes/shapes/round_ortho_shape.rb +6 -8
  56. data/lib/wx/shapes/shapes/round_rect_shape.rb +20 -24
  57. data/lib/wx/shapes/shapes/square_shape.rb +14 -17
  58. data/lib/wx/shapes/shapes/text_shape.rb +95 -53
  59. data/lib/wx/shapes/version.rb +1 -1
  60. data/lib/wx/shapes/wx.rb +16 -7
  61. data/lib/wx/wx-shapes/cmd/test.rb +1 -1
  62. data/samples/demo/arrows.json +1 -0
  63. data/samples/demo/arrows.yaml +793 -0
  64. data/samples/demo/art/HBox.xpm +22 -0
  65. data/samples/demo/art/VBox.xpm +22 -0
  66. data/samples/demo/art/logo.xpm +60 -0
  67. data/samples/demo/class.json +1 -0
  68. data/samples/demo/class.yaml +5631 -0
  69. data/samples/demo/demo.rb +301 -91
  70. data/samples/demo/dialogs.rb +1405 -0
  71. data/samples/demo/erd.json +1 -0
  72. data/samples/demo/erd.yaml +4072 -0
  73. data/samples/demo/frame_canvas.rb +409 -33
  74. data/samples/sample1/art/logo.xpm +60 -0
  75. data/samples/sample1/sample.rb +11 -11
  76. data/samples/sample2/art/logo.xpm +60 -0
  77. data/samples/sample2/sample.rb +2 -2
  78. data/samples/sample2/sample_shape.rb +15 -15
  79. data/samples/sample3/art/logo.xpm +60 -0
  80. data/samples/sample3/sample.rb +3 -3
  81. data/samples/sample4/art/logo.xpm +60 -0
  82. data/samples/sample4/sample.rb +2 -2
  83. data/tests/lib/wxapp_runner.rb +4 -0
  84. data/tests/serializer_tests.rb +8 -441
  85. data/tests/test_grid_shapes.rb +2 -2
  86. data/tests/test_serialize_xml.rb +17 -0
  87. data/tests/test_serialize_yaml.rb +2 -2
  88. metadata +78 -28
  89. data/lib/wx/shapes/serialize/core.rb +0 -40
  90. data/lib/wx/shapes/serialize/id.rb +0 -82
  91. data/lib/wx/shapes/serializer/json.rb +0 -258
  92. data/lib/wx/shapes/serializer/yaml.rb +0 -125
  93. data/samples/demo/art/sample.xpm +0 -251
  94. data/samples/sample1/art/sample.xpm +0 -251
  95. data/samples/sample2/art/sample.xpm +0 -251
  96. data/samples/sample3/art/sample.xpm +0 -251
  97. data/samples/sample4/art/sample.xpm +0 -251
@@ -9,26 +9,26 @@ module Wx::SF
9
9
  # user to create curved connection line.
10
10
  class CurveShape < LineShape
11
11
 
12
- # @overload initialize()
13
- # default constructor
14
- # @overload initialize(src, trg, path, manager)
15
- # @param [Wx::SF::Serializable::ID] src ID of the source shape
16
- # @param [Wx::SF::Serializable::ID] trg ID of the target shape
17
- # @param [Array<Wx::RealPoint>] path List of the line control points (can be empty)
12
+ # @overload initialize(src = DEFAULT::POINT, trg = DEFAULT::POINT, path: nil, manager: nil)
13
+ # Constructor.
14
+ # @param [Wx::RealPoint,Wx::Point] src starting line point
15
+ # @param [Wx::RealPoint,Wx::Point] trg end line point
16
+ # @param [Array<Wx::RealPoint>,nil] path List of the line control points (can be empty or nil)
18
17
  # @param [Diagram] diagram containing diagram
19
- # @overload initialize(src, trg, path, manager)
20
- # @param [Wx::RealPoint] src starting line point
21
- # @param [Wx::RealPoint] trg end line point
18
+ # @overload initialize(src, trg, path: nil, manager: nil)
19
+ # Constructor for connecting two shapes.
20
+ # @param [Shape] src source shape
21
+ # @param [Shape] trg target shape
22
22
  # @param [Array<Wx::RealPoint>,nil] path List of the line control points (can be empty or nil)
23
23
  # @param [Diagram] diagram containing diagram
24
- def initialize(*args)
24
+ def initialize(*args, **kwargs)
25
25
  super
26
26
  end
27
27
 
28
28
  # Get line's bounding box. The function can be overridden if necessary.
29
29
  # @return [Wx::Rect] Bounding rectangle
30
30
  def get_bounding_box
31
- super.inflate(20, 20)
31
+ super.inflate(35, 35)
32
32
  end
33
33
 
34
34
  # Get a line point laying on the given line segment and shifted
@@ -58,17 +58,24 @@ module Wx::SF
58
58
  if !@lst_points.empty?
59
59
  (0..@lst_points.size).each do |i|
60
60
  a,b,c,d = get_segment_quaternion(i)
61
- catmul_rom_kubika(a, b, c, d, dc)
61
+ if i == 0 && @src_arrow
62
+ src, trg = get_line_segment(i)
63
+ src = @src_arrow.draw(trg, src, dc)
64
+ a = b = src.to_real
65
+ end
66
+ if i == @lst_points.size && @trg_arrow
67
+ src, trg = get_line_segment(i)
68
+ trg = @trg_arrow.draw(src, trg, dc)
69
+ c = d = trg.to_real
70
+ end
71
+ catmul_rom_kubika(a, b, c, d, dc, at_end: i == @lst_points.size)
62
72
  end
63
73
  else
64
- b,c = get_direct_line
65
- dc.draw_line(b.to_point, c.to_point)
74
+ src, trg = get_direct_line.collect(&:to_point)
75
+ src = @src_arrow.draw(trg, src, dc) if @src_arrow
76
+ trg = @trg_arrow.draw(src, trg, dc) if @trg_arrow
77
+ dc.draw_line(src, trg)
66
78
  end
67
- # draw target arrow
68
- @trg_arrow.draw(b, c, dc) if @trg_arrow
69
- b, c = get_line_segment(0)
70
- # draw source arrow
71
- @src_arrow.draw(c, b, dc) if @src_arrow
72
79
 
73
80
  when LINEMODE::UNDERCONSTRUCTION
74
81
  # draw basic line parts
@@ -83,17 +90,14 @@ module Wx::SF
83
90
  dc.with_pen(Wx::Pen.new(Wx::BLACK, 1, Wx::PenStyle::PENSTYLE_DOT)) do
84
91
  if @lst_points.size > 1
85
92
  dc.draw_line(c.to_point, @unfinished_point)
86
- elsif @src_shape_id
93
+ elsif @src_shape
87
94
  # draw unfinished line segment if any (for interactive line creation)
88
95
  dc.with_pen(Wx::Pen.new(Wx::BLACK, 1, Wx::PenStyle::PENSTYLE_DOT)) do
89
- src_shape = @diagram.find_shape(@src_shape_id)
90
- if src_shape
91
- if src_shape.get_connection_points.empty?
92
- dc.draw_line((src_shape.get_border_point(src_shape.get_center, @unfinished_point.to_real)).to_point,
93
- @unfinished_point)
94
- else
95
- dc.draw_line(get_mod_src_point.to_point, @unfinished_point)
96
- end
96
+ if @src_shape.get_connection_points.empty?
97
+ dc.draw_line((@src_shape.get_border_point(@src_shape.get_center, @unfinished_point.to_real)).to_point,
98
+ @unfinished_point)
99
+ else
100
+ dc.draw_line(get_mod_src_point.to_point, @unfinished_point)
97
101
  end
98
102
  end
99
103
  end
@@ -141,7 +145,6 @@ module Wx::SF
141
145
  # @return [Array(Wx::RealPoint,Wx::RealPoint,Wx::RealPoint,Wx::RealPoint)]
142
146
  def get_segment_quaternion(segment)
143
147
  quart = [nil,nil,nil,nil]
144
- # wxXS::RealPointList::compatibility_iterator node
145
148
  index = 2 - segment
146
149
 
147
150
  quart[index - 1] = get_src_point if (index - 1) >= 0
@@ -165,7 +168,7 @@ module Wx::SF
165
168
  elsif index == 3
166
169
  if @mode == LINEMODE::UNDERCONSTRUCTION
167
170
  quart[3] = @unfinished_point.to_real
168
- elsif @trg_shape_id
171
+ elsif @trg_shape
169
172
  quart[3] = get_mod_trg_point
170
173
  end
171
174
  end
@@ -182,7 +185,7 @@ module Wx::SF
182
185
  # @param [Wx::RealPoint] c
183
186
  # @param [Wx::RealPoint] d
184
187
  # @param [Wx::DC] dc
185
- def catmul_rom_kubika(a, b, c, d, dc)
188
+ def catmul_rom_kubika(a, b, c, d, dc, at_end: false)
186
189
  # the beginning of the curve is in the B point
187
190
  point0 = b
188
191
 
@@ -193,11 +196,15 @@ module Wx::SF
193
196
  t = 0.0
194
197
  while t <= (1 + (1.0 / optim_steps))
195
198
  point1 = coord_catmul_rom_kubika(a,b,c,d,t)
199
+ # make sure not to overshoot at the target/arrow connection point
200
+ point1 = c if at_end && point0.distance_to(point1) > point0.distance_to(c)
196
201
  dc.draw_line(point0.x.to_i, point0.y.to_i, point1.x.to_i, point1.y.to_i)
197
202
  point0 = point1
198
203
  t += 1.0 / (optim_steps-1)
199
204
  end
200
205
  point1 = coord_catmul_rom_kubika(a,b,c,d,1)
206
+ # make sure not to overshoot at the target/arrow connection point
207
+ point1 = c if at_end && point0.distance_to(point1) > point0.distance_to(c)
201
208
  dc.draw_line(point0.x.to_i, point0.y.to_i, point1.x.to_i, point1.y.to_i)
202
209
  end
203
210
 
@@ -7,28 +7,18 @@ module Wx::SF
7
7
 
8
8
  class DiamondShape < PolygonShape
9
9
 
10
- class << self
11
- def diamond
12
- @diamond ||= [Wx::RealPoint.new(0,25), Wx::RealPoint.new(50,0), Wx::RealPoint.new(100, 25), Wx::RealPoint.new(50, 50)]
13
- end
10
+ module DEFAULT
11
+ DIAMOND = [Wx::RealPoint.new(0,25), Wx::RealPoint.new(50,0), Wx::RealPoint.new(100, 25), Wx::RealPoint.new(50, 50)]
14
12
  end
15
13
 
16
14
  # do not serialize because the vertices are assigned fixed in ctor
17
15
  excludes :vertices
18
16
 
19
- # @overload initialize()
20
- # Default constructor.
21
- # @overload initialize(pos, size, diagram)
22
- # User constructor.
23
- # @param [Wx::RealPoint] pos Initial position
24
- # @param [Wx::SF::Diagram] diagram parent diagram
25
- def initialize(*args)
26
- if args.empty?
27
- super
28
- set_vertices(DiamondShape.diamond)
29
- else
30
- super(DiamondShape.diamond, *args)
31
- end
17
+ # Constructor.
18
+ # @param [Wx::RealPoint,Wx::Point] pos Initial position
19
+ # @param [Wx::SF::Diagram] diagram parent diagram
20
+ def initialize(pos = Shape::DEFAULT::POSITION, diagram: nil)
21
+ super(pos, vertices: DEFAULT::DIAMOND, diagram: diagram)
32
22
  end
33
23
 
34
24
  # Test whether the given point is inside the shape. The function
@@ -30,7 +30,7 @@ module Wx::SF
30
30
  set_insertion_point_end
31
31
  if @parent_shape
32
32
  # update the font size in accordance to the canvas scale
33
- font = @parent_shape.get_font
33
+ font = @parent_shape.get_font.dup
34
34
  font.set_point_size((font.get_point_size * @parent_shape.get_parent_canvas.get_scale).to_i)
35
35
 
36
36
  set_font(font)
@@ -168,14 +168,11 @@ module Wx::SF
168
168
 
169
169
  property :force_multiline, :edit_type
170
170
 
171
- # @overload initialize()
172
- # Default constructor.
173
- # @overload initialize(pos, txt, diagram)
174
- # User constructor.
175
- # @param [Wx::RealPoint] pos Initial position
176
- # @param [String] txt Initial content
177
- # @param [Wx::SF::Diagram] diagram parent diagram
178
- def initialize(*args)
171
+ # Constructor.
172
+ # @param [Wx::RealPoint,Wx::Point] pos Initial position
173
+ # @param [String] txt Text content
174
+ # @param [Wx::SF::Diagram] diagram parent diagram
175
+ def initialize(pos = Shape::DEFAULT::POSITION, txt = TextShape::DEFAULT::TEXT, diagram: nil)
179
176
  super
180
177
  @text_ctrl = nil
181
178
  @force_multiline = DEFAULT::FORCE_MULTILINE
@@ -6,14 +6,11 @@ module Wx::SF
6
6
  # Class encapsulating the ellipse shape. It extends the basic rectangular shape.
7
7
  class EllipseShape < RectShape
8
8
 
9
- # @overload initialize()
10
- # Default constructor.
11
- # @overload initialize(pos, size, diagram)
12
- # User constructor.
13
- # @param [Wx::RealPoint] pos Initial position
14
- # @param [Wx::RealPoint] size Initial size
15
- # @param [Wx::SF::Diagram] diagram parent diagram
16
- def initialize(*args)
9
+ # Constructor.
10
+ # @param [Wx::RealPoint,Wx::Point] pos Initial position
11
+ # @param [Wx::RealPoint,Wx::Size,Wx::Point] size Initial size
12
+ # @param [Wx::SF::Diagram] diagram parent diagram
13
+ def initialize(pos = Shape::DEFAULT::POSITION, size = RectShape::DEFAULT::SIZE, diagram: nil)
17
14
  super
18
15
  end
19
16
 
@@ -58,8 +55,8 @@ module Wx::SF
58
55
  # Draw the shape in the normal way. The function can be overridden if necessary.
59
56
  # @param [Wx::DC] dc Reference to device context where the shape will be drawn to
60
57
  def draw_normal(dc)
61
- dc.with_pen(@border) do
62
- dc.with_brush(@fill) do
58
+ dc.with_pen(border) do
59
+ dc.with_brush(fill) do
63
60
  dc.draw_ellipse(get_absolute_position.to_point, @rect_size.to_size)
64
61
  end
65
62
  end
@@ -69,8 +66,8 @@ module Wx::SF
69
66
  # The function can be overridden if necessary.
70
67
  # @param [Wx::DC] dc Reference to device context where the shape will be drawn to
71
68
  def draw_hover(dc)
72
- dc.with_pen(Wx::Pen.new(@hover_color, 1)) do
73
- dc.with_brush(@fill) do
69
+ dc.with_pen(Wx::Pen.new(hover_colour, 1)) do
70
+ dc.with_brush(fill) do
74
71
  dc.draw_ellipse(get_absolute_position.to_point, @rect_size.to_size)
75
72
  end
76
73
  end
@@ -81,8 +78,8 @@ module Wx::SF
81
78
  # The function can be overridden if necessary.
82
79
  # @param [Wx::DC] dc Reference to device context where the shape will be drawn to
83
80
  def draw_highlighted(dc)
84
- dc.with_pen(Wx::Pen.new(@hover_color, 2)) do
85
- dc.with_brush(@fill) do
81
+ dc.with_pen(Wx::Pen.new(hover_colour, 2)) do
82
+ dc.with_brush(fill) do
86
83
  dc.draw_ellipse(get_absolute_position.to_point, @rect_size.to_size)
87
84
  end
88
85
  end
@@ -91,7 +88,7 @@ module Wx::SF
91
88
  # Draw shadow under the shape. The function can be overridden if necessary.
92
89
  # @param [Wx::DC] dc Reference to device context where the shadow will be drawn to
93
90
  def draw_shadow(dc)
94
- if @fill.style != Wx::BrushStyle::BRUSHSTYLE_TRANSPARENT
91
+ if fill.style != Wx::BrushStyle::BRUSHSTYLE_TRANSPARENT
95
92
  dc.with_pen(Wx::TRANSPARENT_PEN) do
96
93
  dc.with_brush(get_parent_canvas.get_shadow_fill) do
97
94
  dc.draw_ellipse((get_absolute_position + get_parent_canvas.get_shadow_offset).to_point,
@@ -11,38 +11,59 @@ module Wx::SF
11
11
  class FlexGridShape < GridShape
12
12
 
13
13
 
14
- # @overload initialize()
15
- # Default constructor.
16
- # @overload initialize(pos, size, rows, cols, cell_space, diagram)
17
- # User constructor.
18
- # @param [Wx::RealPoint] pos Initial position
19
- # @param [Wx::RealPoint] size Initial size
20
- # @param [Integer] cols Number of grid rows
21
- # @param [Integer] rows Number of grid columns
22
- # @param [Integer] cell_space Additional space between managed shapes
23
- # @param [Wx::SF::Diagram] diagram parent diagram
24
- def initialize(*args)
14
+ # Constructor.
15
+ # @param [Wx::RealPoint,Wx::Point] pos Initial position
16
+ # @param [Wx::RealPoint,Wx::Size,Wx::Point] size Initial size
17
+ # @param [Integer] cols Number of grid columns
18
+ # @param [Integer] max_rows Maximum number of grid rows
19
+ # @param [Integer] cell_space Additional space between managed shapes
20
+ # @param [Wx::SF::Diagram] diagram parent diagram
21
+ def initialize(pos = Shape::DEFAULT::POSITION, size = RectShape::DEFAULT::SIZE,
22
+ cols: DEFAULT::COLUMNS, max_rows: 0, cell_space: DEFAULT::CELLSPACE, diagram: nil)
25
23
  super
26
24
  end
27
25
 
26
+ protected
27
+
28
28
  # Do layout of assigned child shapes
29
29
  def do_children_layout
30
30
  return if @cols == 0 || @rows == 0
31
31
 
32
+ # get maximum size of all managed (child) shapes per row and column
33
+ row_sizes, col_sizes = get_max_child_sizes
34
+ total_x = total_y = 0
35
+
36
+ # put managed shapes to appropriate positions
37
+ @cells.each_with_index do |shape, i|
38
+ col = (i % @cols)
39
+ row = (i / @cols)
40
+ if col == 0
41
+ total_x = 0
42
+ total_y += row_sizes[row-1] if row > 0
43
+ else
44
+ total_x += col_sizes[col-1]
45
+ end
46
+
47
+ if shape
48
+ fit_shape_to_rect(shape,
49
+ Wx::Rect.new(total_x + (col+1)*@cell_space,
50
+ total_y + (row+1)*@cell_space,
51
+ col_sizes[col], row_sizes[row]))
52
+ end
53
+ end
54
+ end
55
+
56
+ def get_max_child_sizes
32
57
  # initialize size arrays
33
58
  row_sizes = ::Array.new(@rows, 0)
34
59
  col_sizes = ::Array.new(@cols, 0)
35
60
 
36
- # prepare a storage for processed shapes pointers
37
- grid_shapes = ::Array.new(@cells.size)
38
-
39
61
  # get maximum size of all managed (child) shapes per row and column
40
- @cells.each_with_index do |id, i|
41
- if id
62
+ @cells.each_with_index do |shape, i|
63
+ if shape
42
64
  col = (i % @cols)
43
65
  row = (i / @cols)
44
66
 
45
- grid_shapes[i] = shape = @child_shapes[id]
46
67
  curr_rect = shape.get_bounding_box
47
68
 
48
69
  # update maximum rows and columns sizes
@@ -50,26 +71,30 @@ module Wx::SF
50
71
  row_sizes[row] = curr_rect.height if (shape.get_v_align != VALIGN::EXPAND) && (curr_rect.height > row_sizes[row])
51
72
  end
52
73
  end
74
+ [row_sizes, col_sizes]
75
+ end
53
76
 
54
- total_x = total_y = 0
77
+ def find_cell(child_rect)
78
+ # get maximum size of all managed (child) shapes per row and column
79
+ row_sizes, col_sizes = get_max_child_sizes
55
80
 
56
- # put managed shapes to appropriate positions
57
- grid_shapes.each_with_index do |shape, i|
58
- if shape
59
- col = (i % @cols)
60
- row = (i / @cols)
61
- if col == 0
62
- total_x = 0
63
- total_y += row_sizes[row-1] if row > 0
64
- else
65
- total_x += col_sizes[col-1]
66
- end
81
+ total_x = total_y = 0
67
82
 
68
- fit_shape_to_rect(shape,
69
- Wx::Rect.new(total_x + (col+1)*@cell_space,
70
- total_y + (row+1)*@cell_space,
71
- col_sizes[col], row_sizes[row]))
83
+ # find the cell index where the new or dragged child is positioned above and in front of
84
+ offset = get_bounding_box.top_left
85
+ cell_count.times.find do |cell|
86
+ col = (cell % @cols)
87
+ row = (cell / @cols)
88
+ if col == 0
89
+ total_x = 0
90
+ total_y += row_sizes[row-1] if row > 0
91
+ else
92
+ total_x += col_sizes[col-1]
72
93
  end
94
+ cell_rct = Wx::Rect.new(total_x + (col+1)*@cell_space,
95
+ total_y + (row+1)*@cell_space,
96
+ col_sizes[col], row_sizes[row]).offset!(offset)
97
+ child_rect.right <= cell_rct.right && child_rect.bottom <= cell_rct.bottom
73
98
  end
74
99
  end
75
100