wxruby3-shapes 0.9.0.pre.beta.3
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.
- checksums.yaml +7 -0
- data/.yardopts +12 -0
- data/CREDITS.md +18 -0
- data/INSTALL.md +39 -0
- data/LICENSE +21 -0
- data/README.md +118 -0
- data/assets/screenshot.png +0 -0
- data/bin/wx-shapes +9 -0
- data/lib/wx/shapes/arrow_base.rb +86 -0
- data/lib/wx/shapes/arrows/circle_arrow.rb +39 -0
- data/lib/wx/shapes/arrows/diamond_arrow.rb +33 -0
- data/lib/wx/shapes/arrows/open_arrow.rb +56 -0
- data/lib/wx/shapes/arrows/solid_arrow.rb +69 -0
- data/lib/wx/shapes/art/shape_canvas/page.xpm +73 -0
- data/lib/wx/shapes/auto_layout.rb +358 -0
- data/lib/wx/shapes/base.rb +33 -0
- data/lib/wx/shapes/canvas_history.rb +84 -0
- data/lib/wx/shapes/connection_point.rb +238 -0
- data/lib/wx/shapes/core.rb +19 -0
- data/lib/wx/shapes/diagram.rb +659 -0
- data/lib/wx/shapes/events.rb +389 -0
- data/lib/wx/shapes/printout.rb +136 -0
- data/lib/wx/shapes/serializable.rb +440 -0
- data/lib/wx/shapes/serialize/core.rb +40 -0
- data/lib/wx/shapes/serialize/id.rb +82 -0
- data/lib/wx/shapes/serialize/wx.rb +104 -0
- data/lib/wx/shapes/serializer/json.rb +258 -0
- data/lib/wx/shapes/serializer/yaml.rb +125 -0
- data/lib/wx/shapes/shape.rb +2129 -0
- data/lib/wx/shapes/shape_canvas.rb +3285 -0
- data/lib/wx/shapes/shape_data_object.rb +43 -0
- data/lib/wx/shapes/shape_handle.rb +287 -0
- data/lib/wx/shapes/shape_list.rb +161 -0
- data/lib/wx/shapes/shapes/bitmap_shape.rb +257 -0
- data/lib/wx/shapes/shapes/circle_shape.rb +136 -0
- data/lib/wx/shapes/shapes/control_shape.rb +483 -0
- data/lib/wx/shapes/shapes/curve_shape.rb +231 -0
- data/lib/wx/shapes/shapes/diamond_shape.rb +62 -0
- data/lib/wx/shapes/shapes/edit_text_shape.rb +317 -0
- data/lib/wx/shapes/shapes/ellipse_shape.rb +106 -0
- data/lib/wx/shapes/shapes/flex_grid_shape.rb +78 -0
- data/lib/wx/shapes/shapes/grid_shape.rb +404 -0
- data/lib/wx/shapes/shapes/line_shape.rb +907 -0
- data/lib/wx/shapes/shapes/multi_sel_rect.rb +214 -0
- data/lib/wx/shapes/shapes/ortho_shape.rb +357 -0
- data/lib/wx/shapes/shapes/polygon_shape.rb +294 -0
- data/lib/wx/shapes/shapes/rect_shape.rb +378 -0
- data/lib/wx/shapes/shapes/round_ortho_shape.rb +131 -0
- data/lib/wx/shapes/shapes/round_rect_shape.rb +142 -0
- data/lib/wx/shapes/shapes/square_shape.rb +119 -0
- data/lib/wx/shapes/shapes/text_shape.rb +324 -0
- data/lib/wx/shapes/thumbnail.rb +234 -0
- data/lib/wx/shapes/version.rb +12 -0
- data/lib/wx/shapes/wx.rb +29 -0
- data/lib/wx/shapes.rb +18 -0
- data/lib/wx/wx-shapes/base.rb +87 -0
- data/lib/wx/wx-shapes/cmd/sampler.rb +58 -0
- data/lib/wx/wx-shapes/cmd/test.rb +27 -0
- data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +7 -0
- data/rakelib/yard/templates/default/layout/html/setup.rb +5 -0
- data/rakelib/yard/yard/relative_markdown_links/version.rb +8 -0
- data/rakelib/yard/yard/relative_markdown_links.rb +39 -0
- data/rakelib/yard/yard-custom-templates.rb +2 -0
- data/rakelib/yard/yard-relative_markdown_links.rb +4 -0
- data/samples/demo/art/AlignBottom.xpm +35 -0
- data/samples/demo/art/AlignCenter.xpm +35 -0
- data/samples/demo/art/AlignLeft.xpm +35 -0
- data/samples/demo/art/AlignMiddle.xpm +35 -0
- data/samples/demo/art/AlignRight.xpm +35 -0
- data/samples/demo/art/AlignTop.xpm +35 -0
- data/samples/demo/art/Bitmap.xpm +25 -0
- data/samples/demo/art/Circle.xpm +22 -0
- data/samples/demo/art/Curve.xpm +21 -0
- data/samples/demo/art/Diamond.xpm +22 -0
- data/samples/demo/art/EditText.xpm +21 -0
- data/samples/demo/art/Ellipse.xpm +22 -0
- data/samples/demo/art/FixedRect.xpm +22 -0
- data/samples/demo/art/FlexGrid.xpm +22 -0
- data/samples/demo/art/GC.xpm +23 -0
- data/samples/demo/art/Grid.xpm +22 -0
- data/samples/demo/art/Line.xpm +21 -0
- data/samples/demo/art/NoSource.xpm +69 -0
- data/samples/demo/art/OrthoLine.xpm +21 -0
- data/samples/demo/art/Rect.xpm +22 -0
- data/samples/demo/art/RoundOrthoLine.xpm +21 -0
- data/samples/demo/art/RoundRect.xpm +22 -0
- data/samples/demo/art/Shadow.xpm +23 -0
- data/samples/demo/art/StandAloneLine.xpm +22 -0
- data/samples/demo/art/Text.xpm +21 -0
- data/samples/demo/art/Tool.xpm +23 -0
- data/samples/demo/art/sample.xpm +251 -0
- data/samples/demo/demo.rb +658 -0
- data/samples/demo/frame_canvas.rb +422 -0
- data/samples/demo/images/motyl.bmp +0 -0
- data/samples/demo/images/motyl2.bmp +0 -0
- data/samples/sample1/art/sample.xpm +251 -0
- data/samples/sample1/sample.rb +263 -0
- data/samples/sample2/art/sample.xpm +251 -0
- data/samples/sample2/sample.rb +133 -0
- data/samples/sample2/sample_canvas.rb +35 -0
- data/samples/sample2/sample_shape.rb +108 -0
- data/samples/sample3/art/sample.xpm +251 -0
- data/samples/sample3/sample.rb +281 -0
- data/samples/sample4/art/sample.xpm +251 -0
- data/samples/sample4/sample.rb +180 -0
- data/tests/art/motyl.bmp +0 -0
- data/tests/lib/wxapp_runner.rb +64 -0
- data/tests/serializer_tests.rb +521 -0
- data/tests/test_grid_shapes.rb +42 -0
- data/tests/test_serialize.rb +7 -0
- data/tests/test_serialize_yaml.rb +17 -0
- metadata +242 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# Wx::SF - Sample1
|
|
2
|
+
# Copyright (c) M.J.N. Corino, The Netherlands
|
|
3
|
+
|
|
4
|
+
require 'wx/shapes'
|
|
5
|
+
|
|
6
|
+
class SFSample1Frame < Wx::Frame
|
|
7
|
+
|
|
8
|
+
module ID
|
|
9
|
+
MenuQuit = 1000
|
|
10
|
+
MenuAbout = 1001
|
|
11
|
+
MenuLogMouseEvent = 1002
|
|
12
|
+
MenuLogHandleEvent = 1003
|
|
13
|
+
MenuLogKeyEvent = 1004
|
|
14
|
+
MenuLogChildDropEvent = 1005
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def initialize(title)
|
|
18
|
+
super(nil, Wx::StandardID::ID_ANY, title, size: [800,600])
|
|
19
|
+
|
|
20
|
+
self.icon = Wx::Icon(:sample)
|
|
21
|
+
|
|
22
|
+
# initialize event types
|
|
23
|
+
@event_type_info = {
|
|
24
|
+
Wx::SF::EVT_SF_SHAPE_LEFT_DOWN => "Shape was clicked by LMB (wxEVT_SF_SHAPE_LEFT_DOWN )",
|
|
25
|
+
Wx::SF::EVT_SF_SHAPE_LEFT_DCLICK => "Shape was double-clicked by LMB (wxEVT_SF_SHAPE_LEFT_DOWN )",
|
|
26
|
+
Wx::SF::EVT_SF_SHAPE_RIGHT_DOWN => "Shape was clicked by RMB (wxEVT_SF_SHAPE_RIGHT_DOWN )",
|
|
27
|
+
Wx::SF::EVT_SF_SHAPE_RIGHT_DCLICK => "Shape was double-clicked by RMB (wxEVT_SF_SHAPE_RIGHT_DOWN )",
|
|
28
|
+
Wx::SF::EVT_SF_SHAPE_DRAG_BEGIN => "Shape has started to be dragged (wxEVT_SF_SHAPE_DRAG_BEGIN )",
|
|
29
|
+
Wx::SF::EVT_SF_SHAPE_DRAG => "Shape is dragging (wxEVT_SF_SHAPE_DRAG )",
|
|
30
|
+
Wx::SF::EVT_SF_SHAPE_DRAG_END => "Shape's dragging was finished (wxEVT_SF_SHAPE_DRAG_END )",
|
|
31
|
+
Wx::SF::EVT_SF_SHAPE_HANDLE_BEGIN => "Shape handle has started to be dragged (wxEVT_SF_SHAPE_HANDLE_BEGIN )",
|
|
32
|
+
Wx::SF::EVT_SF_SHAPE_HANDLE => "Shape handle is dragging (wxEVT_SF_SHAPE_HANDLE )",
|
|
33
|
+
Wx::SF::EVT_SF_SHAPE_HANDLE_END => "Shape handle's dragging was finished (wxEVT_SF_SHAPE_HANDLE_END )",
|
|
34
|
+
Wx::SF::EVT_SF_SHAPE_KEYDOWN => "Key was pressed (wxEVT_SF_SHAPE_KEYDOWN )",
|
|
35
|
+
Wx::SF::EVT_SF_SHAPE_MOUSE_ENTER => "Mouse has entered shape's area (wxEVT_SF_SHAPE_MOUSE_ENTER)",
|
|
36
|
+
Wx::SF::EVT_SF_SHAPE_MOUSE_OVER => "Mouse is moving over shape's area (wxEVT_SF_SHAPE_MOUSE_OVER)",
|
|
37
|
+
Wx::SF::EVT_SF_SHAPE_MOUSE_LEAVE => "Mouse has leaved shape's area (wxEVT_SF_SHAPE_MOUSE_LEAVE)",
|
|
38
|
+
Wx::SF::EVT_SF_SHAPE_CHILD_DROP => "Child shape has been assigned to shape (wxEVT_SF_SHAPE_CHILD_DROP)",
|
|
39
|
+
Wx::SF::EVT_SF_LINE_HANDLE_ADD => "Line handle has been created (wxEVT_SF_LINE_HANDLE_ADD)",
|
|
40
|
+
Wx::SF::EVT_SF_LINE_HANDLE_REMOVE => "Line handle has been removed (wxEVT_SF_LINE_HANDLE_REMOVE)"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
evt_close :on_close
|
|
44
|
+
|
|
45
|
+
if Wx.has_feature?(:USE_MENUS)
|
|
46
|
+
# create a menu bar
|
|
47
|
+
mbar = Wx::MenuBar.new
|
|
48
|
+
file_menu = Wx::Menu.new
|
|
49
|
+
file_menu.append(ID::MenuQuit, "&Quit\tAlt-F4", "Quit the application")
|
|
50
|
+
mbar.append(file_menu, "&File")
|
|
51
|
+
|
|
52
|
+
@log_menu = Wx::Menu.new
|
|
53
|
+
@log_menu.append_check_item(ID::MenuLogMouseEvent, "Log &mouse events")
|
|
54
|
+
@log_menu.append_check_item(ID::MenuLogHandleEvent, "Log &handle events")
|
|
55
|
+
@log_menu.append_check_item(ID::MenuLogKeyEvent, "Log &keyboard events")
|
|
56
|
+
@log_menu.append_check_item(ID::MenuLogChildDropEvent, "Log &child drop event")
|
|
57
|
+
mbar.append(@log_menu, "&Log")
|
|
58
|
+
|
|
59
|
+
help_menu = Wx::Menu.new
|
|
60
|
+
help_menu.append(ID::MenuAbout, "&About\tF1", "Show info about this application")
|
|
61
|
+
mbar.append(help_menu, "&Help")
|
|
62
|
+
|
|
63
|
+
self.menu_bar = mbar
|
|
64
|
+
|
|
65
|
+
evt_menu(ID::MenuQuit, :on_quit)
|
|
66
|
+
evt_menu(ID::MenuAbout, :on_about)
|
|
67
|
+
end # wxUSE_MENUS
|
|
68
|
+
|
|
69
|
+
main_sizer = Wx::FlexGridSizer.new(2, 0, 0, 0)
|
|
70
|
+
main_sizer.add_growable_col(0)
|
|
71
|
+
main_sizer.add_growable_row(0)
|
|
72
|
+
main_sizer.set_flexible_direction(Wx::Orientation::BOTH)
|
|
73
|
+
main_sizer.set_non_flexible_grow_mode(Wx::FlexSizerGrowMode::FLEX_GROWMODE_SPECIFIED)
|
|
74
|
+
|
|
75
|
+
@diagram = Wx::SF::Diagram.new
|
|
76
|
+
# set some diagram manager properties if necessary...
|
|
77
|
+
# set accepted shapes (accept only Wx::SF::RectShape)
|
|
78
|
+
@diagram.clear_accepted_shapes
|
|
79
|
+
@diagram.accept_shape(Wx::SF::RectShape)
|
|
80
|
+
@diagram.accept_shape(Wx::SF::CurveShape)
|
|
81
|
+
|
|
82
|
+
# create shape canvas and associate it with shape manager
|
|
83
|
+
@canvas = Wx::SF::ShapeCanvas.new(@diagram, self)
|
|
84
|
+
# set some shape canvas properties if necessary...
|
|
85
|
+
@canvas.add_style(Wx::SF::ShapeCanvas::STYLE::GRID_SHOW)
|
|
86
|
+
@canvas.add_style(Wx::SF::ShapeCanvas::STYLE::GRID_USE)
|
|
87
|
+
|
|
88
|
+
# connect (some) shape canvas events
|
|
89
|
+
@canvas.evt_left_down { |evt| self.on_left_click_canvas(evt) }
|
|
90
|
+
@canvas.evt_right_down { |evt| self.on_right_click_canvas(evt) }
|
|
91
|
+
|
|
92
|
+
# connect (some) shape events (for full list of available shape/shape canvas events see Wx::SF reference documentation).
|
|
93
|
+
@canvas.evt_sf_shape_left_down { |evt| self.on_shape_mouse_event(evt) }
|
|
94
|
+
@canvas.evt_sf_shape_left_dclick { |evt| self.on_shape_mouse_event(evt) }
|
|
95
|
+
@canvas.evt_sf_shape_right_down { |evt| self.on_shape_mouse_event(evt) }
|
|
96
|
+
@canvas.evt_sf_shape_right_dclick { |evt| self.on_shape_mouse_event(evt) }
|
|
97
|
+
@canvas.evt_sf_shape_drag_begin { |evt| self.on_shape_mouse_event(evt) }
|
|
98
|
+
@canvas.evt_sf_shape_drag { |evt| self.on_shape_mouse_event(evt) }
|
|
99
|
+
@canvas.evt_sf_shape_drag_end { |evt| self.on_shape_mouse_event(evt) }
|
|
100
|
+
|
|
101
|
+
@canvas.evt_sf_shape_mouse_enter { |evt| self.on_shape_mouse_event(evt) }
|
|
102
|
+
@canvas.evt_sf_shape_mouse_over { |evt| self.on_shape_mouse_event(evt) }
|
|
103
|
+
@canvas.evt_sf_shape_mouse_leave { |evt| self.on_shape_mouse_event(evt) }
|
|
104
|
+
|
|
105
|
+
@canvas.evt_sf_shape_handle_begin { |evt| self.on_shape_handle_event(evt) }
|
|
106
|
+
@canvas.evt_sf_shape_handle { |evt| self.on_shape_handle_event(evt) }
|
|
107
|
+
@canvas.evt_sf_shape_handle_end { |evt| self.on_shape_handle_event(evt) }
|
|
108
|
+
@canvas.evt_sf_line_handle_add { |evt| self.on_shape_handle_event(evt) }
|
|
109
|
+
@canvas.evt_sf_line_handle_remove { |evt| self.on_shape_handle_event(evt) }
|
|
110
|
+
|
|
111
|
+
@canvas.evt_sf_shape_keydown { |evt| self.on_shape_key_event(evt) }
|
|
112
|
+
|
|
113
|
+
@canvas.evt_sf_shape_child_drop { |evt| self.on_shape_child_drop_event(evt) }
|
|
114
|
+
|
|
115
|
+
@canvas.evt_sf_line_done { |evt| self.on_line_finished(evt) }
|
|
116
|
+
|
|
117
|
+
main_sizer.add(@canvas, 1, Wx::EXPAND, 0)
|
|
118
|
+
|
|
119
|
+
@text_log = Wx::TextCtrl.new(self, size: [-1, 150], style: Wx::TE_MULTILINE)
|
|
120
|
+
@text_log.set_font(Wx::Font.new(8, Wx::FONTFAMILY_SWISS, Wx::FONTSTYLE_NORMAL, Wx::FONTWEIGHT_NORMAL, false, 'Sans'))
|
|
121
|
+
@text_log.set_min_size(Wx::Size.new(-1, 150))
|
|
122
|
+
|
|
123
|
+
main_sizer.add(@text_log, 0, Wx::EXPAND, 0)
|
|
124
|
+
|
|
125
|
+
if Wx.has_feature?(:USE_STATUSBAR)
|
|
126
|
+
# create a status bar with some information about the used wxWidgets version
|
|
127
|
+
create_status_bar(2)
|
|
128
|
+
set_status_text('Hello wxRuby ShapeFramework user!',0)
|
|
129
|
+
set_status_text("wxRuby #{Wx::WXRUBY_VERSION} #{Wx::PLATFORM} (wxWidgets #{Wx::WXWIDGETS_VERSION})", 1)
|
|
130
|
+
end # wxUSE_STATUSBAR
|
|
131
|
+
|
|
132
|
+
set_sizer(main_sizer)
|
|
133
|
+
layout
|
|
134
|
+
center
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# Window event handlers
|
|
138
|
+
|
|
139
|
+
def on_close(_event)
|
|
140
|
+
destroy
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def on_quit(_event)
|
|
144
|
+
destroy
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def on_about(_event)
|
|
148
|
+
msg = "wxRuby ShapeFramework #{Wx::SF::VERSION}\n(wxRuby #{Wx::WXRUBY_VERSION} #{Wx::PLATFORM}; #{Wx::WXWIDGETS_VERSION})\n\n"
|
|
149
|
+
|
|
150
|
+
msg += "Welcome to wxRuby ShapeFramework Sample1 (c) Martin Corino, 2023\n"
|
|
151
|
+
msg += "(ported from wxSFShapeFramework original (c) Michal Bliznak, 2007 - 2013)\n\n"
|
|
152
|
+
msg += "Sample demonstrates basic Wx::SF functionality.\n"
|
|
153
|
+
msg += "Usage:\n"
|
|
154
|
+
msg += " - Left mouse click operates with inserted shapes\n"
|
|
155
|
+
msg += " - Right mouse click inserts a rectangular shape to the canvas\n"
|
|
156
|
+
msg += " - Right mouse click onto the shape + CTRL key starts interactive line connection \n"
|
|
157
|
+
msg += " - DEL key removes selected shape\n"
|
|
158
|
+
|
|
159
|
+
Wx.message_box(msg, "wxRuby ShapeFramework Sample 1")
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
# event handlers for shape canvas
|
|
163
|
+
|
|
164
|
+
def on_left_click_canvas(event)
|
|
165
|
+
# HINT: perform your user actions here...
|
|
166
|
+
|
|
167
|
+
# ... and then process standard canvas operations
|
|
168
|
+
event.skip
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
def on_right_click_canvas(event)
|
|
172
|
+
if event.control_down
|
|
173
|
+
# create connection line
|
|
174
|
+
@canvas.start_interactive_connection(Wx::SF::CurveShape, event.get_position)
|
|
175
|
+
else
|
|
176
|
+
# add new rectangular shape to the diagram ...
|
|
177
|
+
_err, shape = @diagram.create_shape(Wx::SF::RectShape, event.get_position)
|
|
178
|
+
# set some shape's properties...
|
|
179
|
+
if shape
|
|
180
|
+
# set accepted child shapes for the new shape
|
|
181
|
+
shape.accept_child(Wx::SF::RectShape)
|
|
182
|
+
# set accepted connections for the new shape
|
|
183
|
+
shape.accept_connection(Wx::SF::ACCEPT_ALL)
|
|
184
|
+
shape.accept_src_neighbour(Wx::SF::RectShape)
|
|
185
|
+
shape.accept_trg_neighbour(Wx::SF::RectShape)
|
|
186
|
+
# enable emitting of shape events
|
|
187
|
+
shape.add_style(Wx::SF::Shape::STYLE::EMIT_EVENTS)
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
# ... and process standard canvas operations
|
|
191
|
+
event.skip
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# event handlers for shapes
|
|
195
|
+
|
|
196
|
+
def on_shape_mouse_event(event)
|
|
197
|
+
if @log_menu.is_checked(ID::MenuLogMouseEvent)
|
|
198
|
+
@text_log.append_text("#{@event_type_info[event.get_event_type]}, ID: #{event.get_id}, Mouse position: #{event.get_mouse_position.x},#{event.get_mouse_position.y}\n")
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
def on_shape_handle_event(event)
|
|
203
|
+
if @log_menu.is_checked(ID::MenuLogHandleEvent)
|
|
204
|
+
hnd_type =case event.handle.type
|
|
205
|
+
when Wx::SF::Shape::Handle::LEFTTOP
|
|
206
|
+
"left-top"
|
|
207
|
+
when Wx::SF::Shape::Handle::TOP
|
|
208
|
+
"top"
|
|
209
|
+
when Wx::SF::Shape::Handle::RIGHTTOP
|
|
210
|
+
"right-top"
|
|
211
|
+
when Wx::SF::Shape::Handle::LEFT
|
|
212
|
+
"left"
|
|
213
|
+
when Wx::SF::Shape::Handle::RIGHT
|
|
214
|
+
"right"
|
|
215
|
+
when Wx::SF::Shape::Handle::LEFTBOTTOM
|
|
216
|
+
"left-bottom"
|
|
217
|
+
when Wx::SF::Shape::Handle::BOTTOM
|
|
218
|
+
"bottom"
|
|
219
|
+
when Wx::SF::Shape::Handle::RIGHTBOTTOM
|
|
220
|
+
"right-bottom"
|
|
221
|
+
when Wx::SF::Shape::Handle::LINECTRL
|
|
222
|
+
"line-control"
|
|
223
|
+
else
|
|
224
|
+
''
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
@text_log.append_text("%s, Shape ID: %d, Handle type: %d (%s), Delta: %d,%d\n" % [
|
|
228
|
+
@event_type_info[event.get_event_type],
|
|
229
|
+
event.get_id,
|
|
230
|
+
event.get_handle.get_type,
|
|
231
|
+
hnd_type,
|
|
232
|
+
event.get_handle.get_delta.x,
|
|
233
|
+
event.get_handle.get_delta.y])
|
|
234
|
+
end
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
def on_shape_key_event(event)
|
|
238
|
+
if @log_menu.is_checked(ID::MenuLogKeyEvent)
|
|
239
|
+
@text_log.append_text("%s, Shape ID: %d, Key code: %d\n" % [
|
|
240
|
+
@event_type_info[event.get_event_type],
|
|
241
|
+
event.get_id,
|
|
242
|
+
event.get_key_code])
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def on_shape_child_drop_event(event)
|
|
247
|
+
if @log_menu.is_checked(ID::MenuLogChildDropEvent)
|
|
248
|
+
@text_log.append_text("%s, Shape ID: %d, Child ID: %d\n" % [
|
|
249
|
+
@event_type_info[event.get_event_type],
|
|
250
|
+
event.get_id,
|
|
251
|
+
event.get_child_shape.get_id])
|
|
252
|
+
end
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
def on_line_finished(event)
|
|
256
|
+
event.get_shape.add_style(Wx::SF::Shape::STYLE::EMIT_EVENTS) if event.get_shape
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
Wx::App.run do
|
|
262
|
+
SFSample1Frame.new('wxShapeFramework Sample 1').show
|
|
263
|
+
end
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
/* XPM */
|
|
2
|
+
static char * sample_xpm[] = {
|
|
3
|
+
"32 32 216 2",
|
|
4
|
+
" c None",
|
|
5
|
+
". c #872C2C",
|
|
6
|
+
"+ c #A52827",
|
|
7
|
+
"@ c #A42828",
|
|
8
|
+
"# c #553131",
|
|
9
|
+
"$ c #7D2D2D",
|
|
10
|
+
"% c #3D3232",
|
|
11
|
+
"& c #535331",
|
|
12
|
+
"* c #AEAE26",
|
|
13
|
+
"= c #85852C",
|
|
14
|
+
"- c #ACAC26",
|
|
15
|
+
"; c #88882C",
|
|
16
|
+
"> c #9B2929",
|
|
17
|
+
", c #A92626",
|
|
18
|
+
"' c #F10D0C",
|
|
19
|
+
") c #B32424",
|
|
20
|
+
"! c #D91919",
|
|
21
|
+
"~ c #A52727",
|
|
22
|
+
"{ c #E51414",
|
|
23
|
+
"] c #DC1817",
|
|
24
|
+
"^ c #9F2828",
|
|
25
|
+
"/ c #A5A527",
|
|
26
|
+
"( c #F2F20B",
|
|
27
|
+
"_ c #FFFF00",
|
|
28
|
+
": c #F1F10C",
|
|
29
|
+
"< c #AEAE25",
|
|
30
|
+
"[ c #E7E712",
|
|
31
|
+
"} c #BEBE22",
|
|
32
|
+
"| c #999929",
|
|
33
|
+
"1 c #DE1716",
|
|
34
|
+
"2 c #A82626",
|
|
35
|
+
"3 c #EF0E0D",
|
|
36
|
+
"4 c #CA1E1E",
|
|
37
|
+
"5 c #C42020",
|
|
38
|
+
"6 c #EC1010",
|
|
39
|
+
"7 c #9E2828",
|
|
40
|
+
"8 c #B12525",
|
|
41
|
+
"9 c #E91211",
|
|
42
|
+
"0 c #922A2A",
|
|
43
|
+
"a c #A8A827",
|
|
44
|
+
"b c #EFEF0D",
|
|
45
|
+
"c c #C5C520",
|
|
46
|
+
"d c #FBFB03",
|
|
47
|
+
"e c #A6A627",
|
|
48
|
+
"f c #FAFA04",
|
|
49
|
+
"g c #CACA1E",
|
|
50
|
+
"h c #DDDD18",
|
|
51
|
+
"i c #F8F806",
|
|
52
|
+
"j c #B8B823",
|
|
53
|
+
"k c #E3E315",
|
|
54
|
+
"l c #9E2929",
|
|
55
|
+
"m c #D01D1D",
|
|
56
|
+
"n c #B72423",
|
|
57
|
+
"o c #AD2625",
|
|
58
|
+
"p c #DD1817",
|
|
59
|
+
"q c #B22525",
|
|
60
|
+
"r c #D71A1A",
|
|
61
|
+
"s c #EBEB10",
|
|
62
|
+
"t c #B0B025",
|
|
63
|
+
"u c #C0C021",
|
|
64
|
+
"v c #E6E613",
|
|
65
|
+
"w c #97972A",
|
|
66
|
+
"x c #A22828",
|
|
67
|
+
"y c #BB2323",
|
|
68
|
+
"z c #B82424",
|
|
69
|
+
"A c #4A3232",
|
|
70
|
+
"B c #842D2D",
|
|
71
|
+
"C c #912B2B",
|
|
72
|
+
"D c #5B3131",
|
|
73
|
+
"E c #70702F",
|
|
74
|
+
"F c #C6C620",
|
|
75
|
+
"G c #8E8E2B",
|
|
76
|
+
"H c #9A9A29",
|
|
77
|
+
"I c #484832",
|
|
78
|
+
"J c #A4A428",
|
|
79
|
+
"K c #9D2828",
|
|
80
|
+
"L c #E61211",
|
|
81
|
+
"M c #E51212",
|
|
82
|
+
"N c #DF1615",
|
|
83
|
+
"O c #D21B1A",
|
|
84
|
+
"P c #423232",
|
|
85
|
+
"Q c #515131",
|
|
86
|
+
"R c #E4E412",
|
|
87
|
+
"S c #F3F307",
|
|
88
|
+
"T c #E2E213",
|
|
89
|
+
"U c #BEBE20",
|
|
90
|
+
"V c #ECEC0C",
|
|
91
|
+
"W c #B1B124",
|
|
92
|
+
"X c #999928",
|
|
93
|
+
"Y c #CF1D1D",
|
|
94
|
+
"Z c #CD1E1D",
|
|
95
|
+
"` c #D21C1C",
|
|
96
|
+
" . c #A42727",
|
|
97
|
+
".. c #ED0F0F",
|
|
98
|
+
"+. c #7E2D2D",
|
|
99
|
+
"@. c #92922B",
|
|
100
|
+
"#. c #FDFD01",
|
|
101
|
+
"$. c #D1D11C",
|
|
102
|
+
"%. c #E5E513",
|
|
103
|
+
"&. c #643030",
|
|
104
|
+
"*. c #E61313",
|
|
105
|
+
"=. c #EE0F0E",
|
|
106
|
+
"-. c #A92726",
|
|
107
|
+
";. c #C1C121",
|
|
108
|
+
">. c #ADAD25",
|
|
109
|
+
",. c #EEEE0E",
|
|
110
|
+
"'. c #5C5C31",
|
|
111
|
+
"). c #F00D0C",
|
|
112
|
+
"!. c #AA2726",
|
|
113
|
+
"~. c #AF2525",
|
|
114
|
+
"{. c #EA1110",
|
|
115
|
+
"]. c #32365A",
|
|
116
|
+
"^. c #333440",
|
|
117
|
+
"/. c #E2E215",
|
|
118
|
+
"(. c #F0F00D",
|
|
119
|
+
"_. c #C4C420",
|
|
120
|
+
":. c #F5F508",
|
|
121
|
+
"<. c #BCBC22",
|
|
122
|
+
"[. c #FCFC02",
|
|
123
|
+
"}. c #8C8C2B",
|
|
124
|
+
"|. c #B92323",
|
|
125
|
+
"1. c #E51413",
|
|
126
|
+
"2. c #633030",
|
|
127
|
+
"3. c #313A74",
|
|
128
|
+
"4. c #2D43AE",
|
|
129
|
+
"5. c #2E40A2",
|
|
130
|
+
"6. c #313975",
|
|
131
|
+
"7. c #77772E",
|
|
132
|
+
"8. c #F7F706",
|
|
133
|
+
"9. c #CBCB1E",
|
|
134
|
+
"0. c #BABA23",
|
|
135
|
+
"a. c #D81919",
|
|
136
|
+
"b. c #A62727",
|
|
137
|
+
"c. c #D41B1B",
|
|
138
|
+
"d. c #C91F1E",
|
|
139
|
+
"e. c #8F2B2B",
|
|
140
|
+
"f. c #323553",
|
|
141
|
+
"g. c #2C45BA",
|
|
142
|
+
"h. c #284CE0",
|
|
143
|
+
"i. c #2A4AD5",
|
|
144
|
+
"j. c #2C46C0",
|
|
145
|
+
"k. c #A3A328",
|
|
146
|
+
"l. c #DEDE17",
|
|
147
|
+
"m. c #772E2E",
|
|
148
|
+
"n. c #EC100F",
|
|
149
|
+
"o. c #AB2626",
|
|
150
|
+
"p. c #B12524",
|
|
151
|
+
"q. c #2B47C8",
|
|
152
|
+
"r. c #2D43AF",
|
|
153
|
+
"s. c #2453FF",
|
|
154
|
+
"t. c #2552FA",
|
|
155
|
+
"u. c #2D44B6",
|
|
156
|
+
"v. c #2C45BE",
|
|
157
|
+
"w. c #BEBE21",
|
|
158
|
+
"x. c #BFBF22",
|
|
159
|
+
"y. c #B2B224",
|
|
160
|
+
"z. c #6B2F2F",
|
|
161
|
+
"A. c #C6201F",
|
|
162
|
+
"B. c #2F409F",
|
|
163
|
+
"C. c #2551F8",
|
|
164
|
+
"D. c #2C44B9",
|
|
165
|
+
"E. c #2452FC",
|
|
166
|
+
"F. c #2F3E92",
|
|
167
|
+
"G. c #585831",
|
|
168
|
+
"H. c #8E8E2A",
|
|
169
|
+
"I. c #79792D",
|
|
170
|
+
"J. c #5C3030",
|
|
171
|
+
"K. c #333333",
|
|
172
|
+
"L. c #313971",
|
|
173
|
+
"M. c #2551F5",
|
|
174
|
+
"N. c #2A49D0",
|
|
175
|
+
"O. c #284EE6",
|
|
176
|
+
"P. c #294BD9",
|
|
177
|
+
"Q. c #294CDD",
|
|
178
|
+
"R. c #2650F1",
|
|
179
|
+
"S. c #323761",
|
|
180
|
+
"T. c #606030",
|
|
181
|
+
"U. c #294CDE",
|
|
182
|
+
"V. c #2D42AD",
|
|
183
|
+
"W. c #2D43B3",
|
|
184
|
+
"X. c #2A4AD6",
|
|
185
|
+
"Y. c #2C45BD",
|
|
186
|
+
"Z. c #303B7C",
|
|
187
|
+
"`. c #2650F0",
|
|
188
|
+
" + c #2650F3",
|
|
189
|
+
".+ c #2B46C3",
|
|
190
|
+
"++ c #284CDE",
|
|
191
|
+
"@+ c #2A49D1",
|
|
192
|
+
"#+ c #264FED",
|
|
193
|
+
"$+ c #31396F",
|
|
194
|
+
"%+ c #303D90",
|
|
195
|
+
"&+ c #2B47C6",
|
|
196
|
+
"*+ c #31386B",
|
|
197
|
+
"=+ c #2E41A7",
|
|
198
|
+
"-+ c #313A77",
|
|
199
|
+
";+ c #303C86",
|
|
200
|
+
">+ c #2551F7",
|
|
201
|
+
",+ c #2D43B1",
|
|
202
|
+
"'+ c #2E41A6",
|
|
203
|
+
")+ c #2552FB",
|
|
204
|
+
"!+ c #2552F9",
|
|
205
|
+
"~+ c #2552F8",
|
|
206
|
+
"{+ c #323765",
|
|
207
|
+
"]+ c #2B48CB",
|
|
208
|
+
"^+ c #2A49CF",
|
|
209
|
+
"/+ c #274EE7",
|
|
210
|
+
"(+ c #264FEE",
|
|
211
|
+
"_+ c #2D42AE",
|
|
212
|
+
":+ c #2650F2",
|
|
213
|
+
"<+ c #294BDA",
|
|
214
|
+
"[+ c #2C46C1",
|
|
215
|
+
"}+ c #313A78",
|
|
216
|
+
"|+ c #2D42AA",
|
|
217
|
+
"1+ c #294BDC",
|
|
218
|
+
"2+ c #2B48CA",
|
|
219
|
+
"3+ c #2453FD",
|
|
220
|
+
" ",
|
|
221
|
+
" ",
|
|
222
|
+
" ",
|
|
223
|
+
" ",
|
|
224
|
+
" ",
|
|
225
|
+
" . + + @ # $ + + + % & * * * = & - * * ; ",
|
|
226
|
+
" > , ' ' ) ! ~ { ' ] ^ / ( _ : < [ } _ _ < | ",
|
|
227
|
+
" 1 2 3 4 5 ' 6 7 3 8 9 0 a b c d e f _ g h i j k ",
|
|
228
|
+
" l ' m n o ' ' ' p q ~ ' r s _ < t b _ _ _ < u v _ w ",
|
|
229
|
+
" x y z A z y y y y B C y y D E F F G H F F F F } I c F J ",
|
|
230
|
+
" K L L ^ M L L L L , N L O P Q R S T U S S S S V W S S X ",
|
|
231
|
+
" Y ' Z ` ' ' ' ' .' ..+. @.#._ < _ _ _ _ $.%._ $. ",
|
|
232
|
+
" &.*.=., ' ' ' ! 5 ' -. } _ ;.( _ _ _ >._ ,.'. ",
|
|
233
|
+
" C ).!.=.' ' ~.{.Z ].^. /.(._._ _ :.<.[.}. ",
|
|
234
|
+
" |.` Z ' ' ~ 1.2. 3.4.5.6. 7.8.>._ _ 9.s 0. ",
|
|
235
|
+
" a.b.' c.d.e. f.g.h.i.j. k.F ,._ < l. ",
|
|
236
|
+
" m. .n.o.p. q.r.s.t.u.v. w.x.( y.E ",
|
|
237
|
+
" z.A.$ B.C.D.s.s.r.E.F. G.H._.I. ",
|
|
238
|
+
" J.K. L.M.N.O.s.s.P.Q.R.S. K.T. ",
|
|
239
|
+
" K. U.s.V.s.s.s.E.W.s.X. ",
|
|
240
|
+
" g.s.M.Y.s.s.s.s.W.E.s.V. ",
|
|
241
|
+
" Z.`. +.+++ + + + +@+N. +#+$+ ",
|
|
242
|
+
" %+&+&+*+W.&+&+&+&+=+-+&+&+;+ ",
|
|
243
|
+
" 6.E.>+,+'+)+s.s.!+=+r.E.~+{+ ",
|
|
244
|
+
" ]+^+/+(+,+s.s._+:+Q.<+[+ ",
|
|
245
|
+
" }+|+s.s.1+q.2+Q.s.3+=+{+ ",
|
|
246
|
+
" 6._+_+_+$+$+_+_+_+*+ ",
|
|
247
|
+
" ",
|
|
248
|
+
" ",
|
|
249
|
+
" ",
|
|
250
|
+
" ",
|
|
251
|
+
" "};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Wx::SF - Sample2
|
|
2
|
+
# Copyright (c) M.J.N. Corino, The Netherlands
|
|
3
|
+
|
|
4
|
+
require 'wx/shapes'
|
|
5
|
+
require_relative 'sample_shape'
|
|
6
|
+
require_relative 'sample_canvas'
|
|
7
|
+
|
|
8
|
+
class SFSample2Frame < Wx::Frame
|
|
9
|
+
|
|
10
|
+
class LOGTYPE < Wx::Enum
|
|
11
|
+
MouseEvent = self.new(1002)
|
|
12
|
+
HandleEvent = self.new(1003)
|
|
13
|
+
KeyEvent = self.new(1004)
|
|
14
|
+
ChildDropEvent = self.new(1005)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class << self
|
|
18
|
+
def log(logtype, msg)
|
|
19
|
+
main_frame = Wx.get_app.get_top_window
|
|
20
|
+
|
|
21
|
+
if main_frame.log_menu.is_checked(logtype.to_i)
|
|
22
|
+
main_frame.text_log.append_text(msg)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
module ID
|
|
28
|
+
MenuQuit = 1000
|
|
29
|
+
MenuAbout = 1001
|
|
30
|
+
MenuLogMouseEvent = 1002
|
|
31
|
+
MenuLogHandleEvent = 1003
|
|
32
|
+
MenuLogKeyEvent = 1004
|
|
33
|
+
MenuLogChildDropEvent = 1005
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def initialize(title)
|
|
37
|
+
super(nil, Wx::StandardID::ID_ANY, title, size: [800,600])
|
|
38
|
+
|
|
39
|
+
self.icon = Wx::Icon(:sample)
|
|
40
|
+
|
|
41
|
+
evt_close :on_close
|
|
42
|
+
|
|
43
|
+
if Wx.has_feature?(:USE_MENUS)
|
|
44
|
+
# create a menu bar
|
|
45
|
+
mbar = Wx::MenuBar.new
|
|
46
|
+
file_menu = Wx::Menu.new
|
|
47
|
+
file_menu.append(ID::MenuQuit, "&Quit\tAlt-F4", "Quit the application")
|
|
48
|
+
mbar.append(file_menu, "&File")
|
|
49
|
+
|
|
50
|
+
@log_menu = Wx::Menu.new
|
|
51
|
+
@log_menu.append_check_item(ID::MenuLogMouseEvent, "Log &mouse events")
|
|
52
|
+
@log_menu.append_check_item(ID::MenuLogHandleEvent, "Log &handle events")
|
|
53
|
+
@log_menu.append_check_item(ID::MenuLogKeyEvent, "Log &keyboard events")
|
|
54
|
+
@log_menu.append_check_item(ID::MenuLogChildDropEvent, "Log &child drop event")
|
|
55
|
+
mbar.append(@log_menu, "&Log")
|
|
56
|
+
|
|
57
|
+
help_menu = Wx::Menu.new
|
|
58
|
+
help_menu.append(ID::MenuAbout, "&About\tF1", "Show info about this application")
|
|
59
|
+
mbar.append(help_menu, "&Help")
|
|
60
|
+
|
|
61
|
+
self.menu_bar = mbar
|
|
62
|
+
|
|
63
|
+
evt_menu(ID::MenuQuit, :on_quit)
|
|
64
|
+
evt_menu(ID::MenuAbout, :on_about)
|
|
65
|
+
end # wxUSE_MENUS
|
|
66
|
+
|
|
67
|
+
main_sizer = Wx::FlexGridSizer.new(2, 0, 0, 0)
|
|
68
|
+
main_sizer.add_growable_col(0)
|
|
69
|
+
main_sizer.add_growable_row(0)
|
|
70
|
+
main_sizer.set_flexible_direction(Wx::Orientation::BOTH)
|
|
71
|
+
main_sizer.set_non_flexible_grow_mode(Wx::FlexSizerGrowMode::FLEX_GROWMODE_SPECIFIED)
|
|
72
|
+
|
|
73
|
+
@diagram = Wx::SF::Diagram.new
|
|
74
|
+
# set some diagram manager properties if necessary...
|
|
75
|
+
# set accepted shapes (accept only Wx::SF::RectShape)
|
|
76
|
+
@diagram.clear_accepted_shapes
|
|
77
|
+
@diagram.accept_shape(SampleShape)
|
|
78
|
+
|
|
79
|
+
# create shape canvas and associate it with shape manager
|
|
80
|
+
@canvas = SampleCanvas.new(@diagram, self)
|
|
81
|
+
|
|
82
|
+
main_sizer.add(@canvas, 1, Wx::EXPAND, 0)
|
|
83
|
+
|
|
84
|
+
@text_log = Wx::TextCtrl.new(self, size: [-1, 150], style: Wx::TE_MULTILINE)
|
|
85
|
+
@text_log.set_font(Wx::Font.new(8, Wx::FONTFAMILY_SWISS, Wx::FONTSTYLE_NORMAL, Wx::FONTWEIGHT_NORMAL, false, 'Sans'))
|
|
86
|
+
@text_log.set_min_size(Wx::Size.new(-1, 150))
|
|
87
|
+
|
|
88
|
+
main_sizer.add(@text_log, 0, Wx::EXPAND, 0)
|
|
89
|
+
|
|
90
|
+
if Wx.has_feature?(:USE_STATUSBAR)
|
|
91
|
+
# create a status bar with some information about the used wxWidgets version
|
|
92
|
+
create_status_bar(2)
|
|
93
|
+
set_status_text('Hello wxRuby ShapeFramework user!',0)
|
|
94
|
+
set_status_text("wxRuby #{Wx::WXRUBY_VERSION} #{Wx::PLATFORM} (wxWidgets #{Wx::WXWIDGETS_VERSION})", 1)
|
|
95
|
+
end # wxUSE_STATUSBAR
|
|
96
|
+
|
|
97
|
+
set_sizer(main_sizer)
|
|
98
|
+
layout
|
|
99
|
+
center
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
attr_reader :log_menu, :text_log
|
|
103
|
+
|
|
104
|
+
# Window event handlers
|
|
105
|
+
|
|
106
|
+
def on_close(_event)
|
|
107
|
+
destroy
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def on_quit(_event)
|
|
111
|
+
destroy
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def on_about(_event)
|
|
115
|
+
msg = "wxRuby ShapeFramework #{Wx::SF::VERSION}\n(wxRuby #{Wx::WXRUBY_VERSION} #{Wx::PLATFORM}; #{Wx::WXWIDGETS_VERSION})\n\n"
|
|
116
|
+
|
|
117
|
+
msg += "Welcome to wxRuby ShapeFramework Sample1 (c) Martin Corino, 2023\n"
|
|
118
|
+
msg += "(ported from wxSFShapeFramework original (c) Michal Bliznak, 2007 - 2013)\n\n"
|
|
119
|
+
msg += "Sample demonstrates basic Wx::SF functionality.\n"
|
|
120
|
+
msg += "wxRuby SF event handlers are overridden in user-defined canvas and shape class.\n\n"
|
|
121
|
+
msg += "Usage:\n"
|
|
122
|
+
msg += " - Left mouse click operates with inserted shapes\n"
|
|
123
|
+
msg += " - Right mouse click inserts a rectangular shape to the canvas\n"
|
|
124
|
+
msg += " - DEL key removes selected shape\n"
|
|
125
|
+
|
|
126
|
+
Wx.message_box(msg, "wxRuby ShapeFramework Sample 2")
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
Wx::App.run do
|
|
132
|
+
SFSample2Frame.new('wxShapeFramework Sample 1').show
|
|
133
|
+
end
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Wx::SF - Sample2 SampleCanvas class
|
|
2
|
+
# Copyright (c) M.J.N. Corino, The Netherlands
|
|
3
|
+
|
|
4
|
+
require 'wx/shapes'
|
|
5
|
+
|
|
6
|
+
class SampleCanvas < Wx::SF::ShapeCanvas
|
|
7
|
+
def initialize(diagram, parent)
|
|
8
|
+
super
|
|
9
|
+
add_style(STYLE::GRID_SHOW)
|
|
10
|
+
add_style(STYLE::GRID_USE)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# override required wxSF virtual functions
|
|
14
|
+
def on_left_down(event)
|
|
15
|
+
# HINT: perform your user actions here...
|
|
16
|
+
|
|
17
|
+
# perform standard operations
|
|
18
|
+
super
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def on_right_down(event)
|
|
22
|
+
# HINT: perform your user actions here...
|
|
23
|
+
|
|
24
|
+
# add new custom shape to the diagram ...
|
|
25
|
+
_, shape = get_diagram.create_shape(SampleShape, event.get_position)
|
|
26
|
+
# set some shape's properties...
|
|
27
|
+
if shape
|
|
28
|
+
# set accepted child shapes for the new shape
|
|
29
|
+
shape.accept_child(SampleShape)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# perform standard operations
|
|
33
|
+
super
|
|
34
|
+
end
|
|
35
|
+
end
|