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.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/CREDITS.md +18 -0
  4. data/INSTALL.md +39 -0
  5. data/LICENSE +21 -0
  6. data/README.md +118 -0
  7. data/assets/screenshot.png +0 -0
  8. data/bin/wx-shapes +9 -0
  9. data/lib/wx/shapes/arrow_base.rb +86 -0
  10. data/lib/wx/shapes/arrows/circle_arrow.rb +39 -0
  11. data/lib/wx/shapes/arrows/diamond_arrow.rb +33 -0
  12. data/lib/wx/shapes/arrows/open_arrow.rb +56 -0
  13. data/lib/wx/shapes/arrows/solid_arrow.rb +69 -0
  14. data/lib/wx/shapes/art/shape_canvas/page.xpm +73 -0
  15. data/lib/wx/shapes/auto_layout.rb +358 -0
  16. data/lib/wx/shapes/base.rb +33 -0
  17. data/lib/wx/shapes/canvas_history.rb +84 -0
  18. data/lib/wx/shapes/connection_point.rb +238 -0
  19. data/lib/wx/shapes/core.rb +19 -0
  20. data/lib/wx/shapes/diagram.rb +659 -0
  21. data/lib/wx/shapes/events.rb +389 -0
  22. data/lib/wx/shapes/printout.rb +136 -0
  23. data/lib/wx/shapes/serializable.rb +440 -0
  24. data/lib/wx/shapes/serialize/core.rb +40 -0
  25. data/lib/wx/shapes/serialize/id.rb +82 -0
  26. data/lib/wx/shapes/serialize/wx.rb +104 -0
  27. data/lib/wx/shapes/serializer/json.rb +258 -0
  28. data/lib/wx/shapes/serializer/yaml.rb +125 -0
  29. data/lib/wx/shapes/shape.rb +2129 -0
  30. data/lib/wx/shapes/shape_canvas.rb +3285 -0
  31. data/lib/wx/shapes/shape_data_object.rb +43 -0
  32. data/lib/wx/shapes/shape_handle.rb +287 -0
  33. data/lib/wx/shapes/shape_list.rb +161 -0
  34. data/lib/wx/shapes/shapes/bitmap_shape.rb +257 -0
  35. data/lib/wx/shapes/shapes/circle_shape.rb +136 -0
  36. data/lib/wx/shapes/shapes/control_shape.rb +483 -0
  37. data/lib/wx/shapes/shapes/curve_shape.rb +231 -0
  38. data/lib/wx/shapes/shapes/diamond_shape.rb +62 -0
  39. data/lib/wx/shapes/shapes/edit_text_shape.rb +317 -0
  40. data/lib/wx/shapes/shapes/ellipse_shape.rb +106 -0
  41. data/lib/wx/shapes/shapes/flex_grid_shape.rb +78 -0
  42. data/lib/wx/shapes/shapes/grid_shape.rb +404 -0
  43. data/lib/wx/shapes/shapes/line_shape.rb +907 -0
  44. data/lib/wx/shapes/shapes/multi_sel_rect.rb +214 -0
  45. data/lib/wx/shapes/shapes/ortho_shape.rb +357 -0
  46. data/lib/wx/shapes/shapes/polygon_shape.rb +294 -0
  47. data/lib/wx/shapes/shapes/rect_shape.rb +378 -0
  48. data/lib/wx/shapes/shapes/round_ortho_shape.rb +131 -0
  49. data/lib/wx/shapes/shapes/round_rect_shape.rb +142 -0
  50. data/lib/wx/shapes/shapes/square_shape.rb +119 -0
  51. data/lib/wx/shapes/shapes/text_shape.rb +324 -0
  52. data/lib/wx/shapes/thumbnail.rb +234 -0
  53. data/lib/wx/shapes/version.rb +12 -0
  54. data/lib/wx/shapes/wx.rb +29 -0
  55. data/lib/wx/shapes.rb +18 -0
  56. data/lib/wx/wx-shapes/base.rb +87 -0
  57. data/lib/wx/wx-shapes/cmd/sampler.rb +58 -0
  58. data/lib/wx/wx-shapes/cmd/test.rb +27 -0
  59. data/rakelib/yard/templates/default/fulldoc/html/css/wxruby3.css +7 -0
  60. data/rakelib/yard/templates/default/layout/html/setup.rb +5 -0
  61. data/rakelib/yard/yard/relative_markdown_links/version.rb +8 -0
  62. data/rakelib/yard/yard/relative_markdown_links.rb +39 -0
  63. data/rakelib/yard/yard-custom-templates.rb +2 -0
  64. data/rakelib/yard/yard-relative_markdown_links.rb +4 -0
  65. data/samples/demo/art/AlignBottom.xpm +35 -0
  66. data/samples/demo/art/AlignCenter.xpm +35 -0
  67. data/samples/demo/art/AlignLeft.xpm +35 -0
  68. data/samples/demo/art/AlignMiddle.xpm +35 -0
  69. data/samples/demo/art/AlignRight.xpm +35 -0
  70. data/samples/demo/art/AlignTop.xpm +35 -0
  71. data/samples/demo/art/Bitmap.xpm +25 -0
  72. data/samples/demo/art/Circle.xpm +22 -0
  73. data/samples/demo/art/Curve.xpm +21 -0
  74. data/samples/demo/art/Diamond.xpm +22 -0
  75. data/samples/demo/art/EditText.xpm +21 -0
  76. data/samples/demo/art/Ellipse.xpm +22 -0
  77. data/samples/demo/art/FixedRect.xpm +22 -0
  78. data/samples/demo/art/FlexGrid.xpm +22 -0
  79. data/samples/demo/art/GC.xpm +23 -0
  80. data/samples/demo/art/Grid.xpm +22 -0
  81. data/samples/demo/art/Line.xpm +21 -0
  82. data/samples/demo/art/NoSource.xpm +69 -0
  83. data/samples/demo/art/OrthoLine.xpm +21 -0
  84. data/samples/demo/art/Rect.xpm +22 -0
  85. data/samples/demo/art/RoundOrthoLine.xpm +21 -0
  86. data/samples/demo/art/RoundRect.xpm +22 -0
  87. data/samples/demo/art/Shadow.xpm +23 -0
  88. data/samples/demo/art/StandAloneLine.xpm +22 -0
  89. data/samples/demo/art/Text.xpm +21 -0
  90. data/samples/demo/art/Tool.xpm +23 -0
  91. data/samples/demo/art/sample.xpm +251 -0
  92. data/samples/demo/demo.rb +658 -0
  93. data/samples/demo/frame_canvas.rb +422 -0
  94. data/samples/demo/images/motyl.bmp +0 -0
  95. data/samples/demo/images/motyl2.bmp +0 -0
  96. data/samples/sample1/art/sample.xpm +251 -0
  97. data/samples/sample1/sample.rb +263 -0
  98. data/samples/sample2/art/sample.xpm +251 -0
  99. data/samples/sample2/sample.rb +133 -0
  100. data/samples/sample2/sample_canvas.rb +35 -0
  101. data/samples/sample2/sample_shape.rb +108 -0
  102. data/samples/sample3/art/sample.xpm +251 -0
  103. data/samples/sample3/sample.rb +281 -0
  104. data/samples/sample4/art/sample.xpm +251 -0
  105. data/samples/sample4/sample.rb +180 -0
  106. data/tests/art/motyl.bmp +0 -0
  107. data/tests/lib/wxapp_runner.rb +64 -0
  108. data/tests/serializer_tests.rb +521 -0
  109. data/tests/test_grid_shapes.rb +42 -0
  110. data/tests/test_serialize.rb +7 -0
  111. data/tests/test_serialize_yaml.rb +17 -0
  112. metadata +242 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e87fc628c22cdd597cdffbcd842d207cee3542b4b18c599abb2240b56a1b623f
4
+ data.tar.gz: aca8560f77c6f20e25a25a9905ea0e2f84b6b2d4293dd8341f772882acf52880
5
+ SHA512:
6
+ metadata.gz: 96cedb90feb6f2bf21044f17c45e55be647e34f20f14035742cf8fa0aa6e9671d732dd8d6f7878900a799d696d29aa1975434674468de15f0038a29c3b68c423
7
+ data.tar.gz: 95c952c4a3c94e492eac23f854b6465dd185c063266b975ec68ec8929877d4de3302bba71dce5b9e06238ded4828cffbdeb74e258ff23f02cd256e20fa3156a2
data/.yardopts ADDED
@@ -0,0 +1,12 @@
1
+ --load rakelib/yard/yard-relative_markdown_links.rb
2
+ --load rakelib/yard/yard-custom-templates.rb
3
+ --charset UTF-8
4
+ --readme README.md
5
+ --title "wxruby3/shapes API Documentation"
6
+ --output-dir rdoc
7
+ --protected
8
+ lib/wx/shapes/**/*.rb
9
+ -
10
+ CREDITS.md
11
+ INSTALL.md
12
+ LICENSE
data/CREDITS.md ADDED
@@ -0,0 +1,18 @@
1
+
2
+ # Credits
3
+
4
+ ## wxRuby3/Shapes
5
+
6
+ Martin Corino established the wxRuby3/Shapes project in 2023.
7
+
8
+ ### Lead Maintainer
9
+
10
+ Martin Corino: mcorino at m2c-software dot nl
11
+
12
+ ## wxShapeFramework
13
+
14
+ In 2002 Michal Bliznak established the [wxShapeFramework](https://sourceforge.net/projects/wxsf/) project. The last
15
+ contribution to this project dates back 7 years.
16
+
17
+ wxruby3/shapes has been ported from the code base of [this](https://github.com/danselmi/wxShapeFramework) Github fork
18
+ for which the last contribution dates back 4 years.
data/INSTALL.md ADDED
@@ -0,0 +1,39 @@
1
+ <!--
2
+ # @markup markdown
3
+ -->
4
+
5
+ # Installation of wxRuby3/Shapes
6
+
7
+ ## Installation of a wxRuby3/Shapes Gem
8
+
9
+ The wxRuby3/Shapes project provides gems on [RubyGems](https://rubygems.org) which can be installed with the
10
+ standard `gem install` command line this:
11
+
12
+ ```sh
13
+ gem install wxruby3-shapes
14
+ ```
15
+
16
+ This will install the wxruby3-shapes gem on any system supporting Ruby and wxRuby.
17
+ As wxRuby3/Shapes has a dependency on wxRuby3 the wxRuby3 gem will be attempted to be installed if (the required version is)
18
+ not yet installed. This will be attempted using a default installation of the wxRuby3 gem. As this is a gem building
19
+ a native extension (except for Windows where the default install will be a prebuilt binary extension gem) this can take quite a
20
+ while.
21
+
22
+ Due to the dependencies of the wxRuby3 gem itself it might be preferable to install that gem separately beforehand. See the
23
+ [INSTALL](https://github.com/mcorino/wxRuby3/blob/master/INSTALL.md) document of the wxRuby3 project for more details.
24
+
25
+ ## Building from source
26
+
27
+ When installing from source the following basic requirements apply:
28
+
29
+ - Git version control toolkit
30
+ - Ruby 2.5 or later
31
+
32
+ Checkout the wxRuby3/Shapes sources from [GitHub](https://github.com/mcorino/wxRuby3-shapes).
33
+
34
+ The wxRuby3/Shapes project provides a Rake based build system. Call `rake help` to get an overview of the available commands.
35
+
36
+ Execute the `rake gem` command to build the wxruby-shapes gem. This will create a gem file in the `./pkg` folder.
37
+
38
+ Install the created gem by executing the command `gem install pkg/wxruby3-shapes-<version>.gem`. Everything described
39
+ above for [Installation of a wxRuby3/Shapes Gem](#installation-of-a-wxruby3shapes-gem) applies.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 mcorino
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,118 @@
1
+ [![Linux wxGTK](https://github.com/mcorino/wxRuby3-shapes/actions/workflows/linux.yml/badge.svg)](https://github.com/mcorino/wxRuby3-shapes/actions/workflows/linux.yml)
2
+ [![Windows wxMSW](https://github.com/mcorino/wxRuby3-shapes/actions/workflows/msw.yml/badge.svg)](https://github.com/mcorino/wxRuby3-shapes/actions/workflows/msw.yml)
3
+ [![License](https://img.shields.io/badge/license-MIT-yellowgreen.svg)](LICENSE)
4
+ [![Gem Version](https://badge.fury.io/rb/wxruby3-shapes.svg)](https://badge.fury.io/rb/wxruby3-shapes)
5
+
6
+ [![Documentation](https://img.shields.io/badge/docs-pages-blue.svg)](https://mcorino.github.io/wxRuby3-shapes)
7
+
8
+ # wxRuby3/Shapes - A wxRuby3 2D shapes and diagramming framework
9
+
10
+ ![wxRuby3/Shapes demo](assets/screenshot.png)
11
+
12
+ ## Introduction
13
+
14
+ **wxRuby3/Shapes** (Wx::SF) is a pure Ruby software library/framework based on wxRuby3 which allows
15
+ easy development of software applications manipulating graphical objects (shapes) like various CASE
16
+ tools, technological processes modeling tools, etc. This library is a pure Ruby implementation based
17
+ on the excellent [wxShapeFramework](https://sourceforge.net/projects/wxsf/) C++ library based on
18
+ wxWidgets.
19
+
20
+ The library consists of several classes encapsulating a so called 'Shape canvas' (visual
21
+ GUI control used for management of diagrams) providing the following features:
22
+
23
+ - Create charts (diagrams) interactively in your wxRuby3 applications
24
+ - Serialize/deserialize charts to file or any io stream in multiple formats (currently supported formats are JSON and YAML)
25
+ - Support for Clipboard operations (Cut/Paste) and Drag&Drop of diagram components (shapes)
26
+ - Support for Undo/Redo operations
27
+ - Support for alignment of diagram components.
28
+ - Support for printing of diagrams (including preview)
29
+ - Support for diagram export to bitmap (any supported type)
30
+ - Support for Thumbnail view of diagram
31
+ - A standard collection of diagram components
32
+ - Shapes: basic rectangular, square, circle, ellipse, rounded rectangle, grid, flexible grid, text, editable text, polygonal, diamond, bitmap
33
+ - Lines: straight, curved, orthogonal, rounded orthogonal
34
+ - Line arrows: solid, open, diamond, circle
35
+ - Highly customizable and extendable
36
+
37
+ The shape framework (and shape canvas) allows to define the relationship between various
38
+ shape types (for example which shape can be a child of another one, which shape types
39
+ can be connected together by which connection type, how do various connections look
40
+ like, etc) and provides an extensive set of events for customizing the interactive creation
41
+ of diagrams.
42
+
43
+ More over, the library source code is pure Ruby based on wxRuby3 GUI toolkit, so it will
44
+ run on any platform that supports Ruby and wxRuby3.
45
+
46
+ ## wxRuby3/Shapes licence
47
+
48
+ wxruby3/shapes is free and open-source. It is distributed under the liberal
49
+ MIT licence which is compatible with both free and commercial development.
50
+ See [LICENSE](LICENSE) for more details.
51
+
52
+ See the [wxRuby3](https://github.com/mcorino/wxRuby3) project for more information
53
+ concerning licensing of wxRuby3.
54
+
55
+ ### Required Credits and Attribution
56
+
57
+ Generally, neither wxRuby3 nor wxRuby3/Shapes require attribution, beyond
58
+ retaining existing copyright notices.
59
+ See [here](CREDITS.md) for more details and acknowledgements.
60
+
61
+ ## FAQ
62
+
63
+ ### What platforms and operating systems are supported in wxRuby3/Shapes?
64
+
65
+ All platforms supporting Ruby and wxRuby3. See the [wxRuby3](https://github.com/mcorino/wxRuby3)
66
+ project for more information
67
+
68
+ ### Where can I ask a question, or report a bug?
69
+
70
+ Use GitHUb Issues.
71
+
72
+ When asking a question, if something is not working as you expect,
73
+ please provide a *minimal*, *runnable* sample of code that demonstrates
74
+ the problem, and say what you expected to happen, and what actually
75
+ happened. Please also provide basic details of your platform, Ruby,
76
+ wxRuby3/Shapes, wxRuby and wxWidgets version, and make a reasonable effort
77
+ to find answers in the archive and documentation before posting. People are mostly happy
78
+ to help, but it's too much to expect them to guess what you're trying to
79
+ do, or try and debug 1,000 lines of your application.
80
+ Very important also; do not use offensive language and be **polite**.
81
+
82
+ ### How can I learn to use wxRuby3/Shapes?
83
+
84
+ The wxRuby3/Shapes API has a lot of features and takes some time to learn.
85
+ The wxRuby3/Shapes distribution comes with several samples which illustrate how
86
+ to use many specific parts of the API. Good one's to start with are the
87
+ basic samples (samples/sample1|2|3|4) which provide insights in various basic
88
+ features. The samples also include a fairly advanced and complete diagramming
89
+ demo application showcasing most of the features of wxRuby3/Shapes.
90
+
91
+ Complete (more or less) wxRuby3/Shapes API documentation should be part of any
92
+ complete wxRuby3/Shapes build. This tends to focus on providing a reference
93
+ of all available modules, classes ad methods and how to use specific
94
+ classes and methods, rather than on how to construct an application
95
+ overall.
96
+ This documentation (for the latest release) is also available online
97
+ [here](https://mcorino.github.io/wxRuby3-shapes/index.html).
98
+
99
+ ### How does wxRuby3/Shapes compare to wxShapeFramework?
100
+
101
+ **wxRuby3/Shapes** is not a straight port of wxShapeFramework although much of the structure is maintained
102
+ with the following major implementation differences:
103
+
104
+ - wxRuby3/Shapes implements a totally different serialization scheme in which none of the XML serializer
105
+ code has been ported. In fact wxRuby3/Shapes does not offer any XML serialization out of the box but instead
106
+ provides a more adaptable implementation with (for now) two supported output formats; JSON and YAML.
107
+ - Related to this the internal management of shape references has been changed as well as this was tightly
108
+ linked to the serialization implementation.
109
+ - The API has been Ruby-fied with respect to constant names, method names and argument passing and return
110
+ values.
111
+ - The ScaledDC class has been integrated with wxRuby3 and is not part of wxRuby3/Shapes.
112
+
113
+ In addition many small tweaks, improvements and also bugfixes have been implemented as part of the port.
114
+
115
+ ### I am getting an error trying to install wxRuby3/Shapes
116
+
117
+ Please double-check the [INSTALL](INSTALL.md) documents, and search issue archives. If
118
+ this doesn't help, please post your question using GitHub Issues.
Binary file
data/bin/wx-shapes ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ #---------------------------------
3
+ # This file is generated
4
+ #---------------------------------
5
+ module WxShapes
6
+ ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
7
+ end
8
+ require 'wx/wx-shapes/base'
9
+ WxShapes.run
@@ -0,0 +1,86 @@
1
+ # Wx::SF::ArrowBase - arrow base class
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+
4
+ require 'wx/shapes/serializable'
5
+ require 'wx/shapes/shape'
6
+
7
+ module Wx::SF
8
+
9
+ class ArrowBase
10
+
11
+ include Wx::SF::Serializable
12
+
13
+ module DEFAULT
14
+ FILL = Wx::Brush.new(Wx::WHITE) if Wx::App.is_main_loop_running
15
+ Wx.add_delayed_constant(self, :FILL) { Wx::Brush.new(Wx::WHITE) }
16
+ BORDER = Wx::Pen.new(Wx::BLACK) if Wx::App.is_main_loop_running
17
+ Wx.add_delayed_constant(self, :BORDER) { Wx::Pen.new(Wx::BLACK) }
18
+ end
19
+
20
+ # Constructor
21
+ # @param [Wx::SF::Shape] parent parent shape
22
+ def initialize(parent=nil)
23
+ @parent_shape = parent
24
+ end
25
+
26
+ # Set a parent of the arrow shape.
27
+ # @param [Wx::SF::Shape] parent parent shape
28
+ def set_parent_shape(parent)
29
+ @parent_shape = parent
30
+ end
31
+ alias :parent_shape= :set_parent_shape
32
+
33
+ # Get pointer to a parent shape.
34
+ # @return [Wx::SF::Shape] parent shape if exists, otherwise nil
35
+ def get_parent_shape
36
+ @parent_shape
37
+ end
38
+ alias :parent_shape :get_parent_shape
39
+
40
+ # Draw arrow shape at the end of a virtual line.
41
+ # @param [Wx::RealPoint] from Start of the virtual line
42
+ # @param [Wx::RealPoint] to End of the virtual line
43
+ # @param [Wx::DC] dc Device context for drawing
44
+ def draw(from, to, dc)
45
+ # needs to be overridden
46
+ end
47
+
48
+ protected
49
+
50
+ # Rotate and move arrow's vertices in accordance of virtual line at which end the arrow will be placed.
51
+ # @param [Array<Wx::RealPoint>] src array of source vertices
52
+ # @param [Wx::RealPoint] from Start of the virtual line
53
+ # @param [Wx::RealPoint] to End of the virtual line
54
+ # @param [Array<Wx::Point>] trg array where translated vertices will be stored
55
+ # @return [Array<Wx::Point>] array with translated vertices
56
+ def translate_arrow(src, from, to, trg = [])
57
+ # calculate distance between line points
58
+ from = from.to_real_point; to = to.to_real_point
59
+ dist = from.distance_to(to)
60
+
61
+ if dist == 0.0
62
+ src.each do |pt|
63
+ trg << Wx::Point.new(((pt.x-pt.y)+to.x).to_i,
64
+ ((pt.x+pt.y)+to.y).to_i)
65
+ end
66
+ else
67
+ # calculate sin and cos of given line segment
68
+ sina = (from.y - to.y)/dist
69
+ cosa = (from.x - to.x)/dist
70
+
71
+ # rotate arrow
72
+ src.each do |pt|
73
+ trg << Wx::Point.new(((pt.x*cosa-pt.y*sina)+to.x).to_i,
74
+ ((pt.x*sina+pt.y*cosa)+to.y).to_i)
75
+ end
76
+ end
77
+ trg
78
+ end
79
+
80
+ end
81
+
82
+ end
83
+
84
+ Dir[File.join(__dir__, 'arrows', '*.rb')].each do |f|
85
+ require "wx/shapes/arrows/#{File.basename(f, '.rb')}"
86
+ end
@@ -0,0 +1,39 @@
1
+ # Wx::SF::CircleArrow - circle arrow class
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+
4
+ require 'wx/shapes/arrows/solid_arrow'
5
+
6
+ module Wx::SF
7
+
8
+ class CircleArrow < SolidArrow
9
+
10
+ # Default circle radius.
11
+ RADIUS = 4
12
+
13
+ property :radius
14
+
15
+ # Constructor
16
+ # @param [Wx::SF::Shape] parent parent shape
17
+ def initialize(parent=nil)
18
+ super
19
+ @radius = 4
20
+ end
21
+
22
+ # Get or set the circle radius
23
+ attr_accessor :radius
24
+
25
+ # Draw arrow shape at the end of a virtual line.
26
+ # @param [Wx::RealPoint] from Start of the virtual line
27
+ # @param [Wx::RealPoint] to End of the virtual line
28
+ # @param [Wx::DC] dc Device context for drawing
29
+ def draw(from, to, dc)
30
+ dc.with_pen(@pen) do |dc|
31
+ dc.with_brush(@fill) do |dc|
32
+ dc.draw_circle(to.to_point, @radius)
33
+ end
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -0,0 +1,33 @@
1
+ # Wx::SF::DiamondArrow - diamond arrow class
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+
4
+ require 'wx/shapes/arrows/solid_arrow'
5
+
6
+ module Wx::SF
7
+
8
+ class DiamondArrow < SolidArrow
9
+
10
+ class << self
11
+
12
+ def diamond_arrow
13
+ @diamond_arrow ||= [Wx::RealPoint.new(0,0), Wx::RealPoint.new(10,4), Wx::RealPoint.new(20,0), Wx::RealPoint.new(10,-4)]
14
+ end
15
+
16
+ end
17
+
18
+ # Draw arrow shape at the end of a virtual line.
19
+ # @param [Wx::RealPoint] from Start of the virtual line
20
+ # @param [Wx::RealPoint] to End of the virtual line
21
+ # @param [Wx::DC] dc Device context for drawing
22
+ def draw(from, to, dc)
23
+ rarrow = translate_arrow(DiamondArrow.diamond_arrow, from, to)
24
+ dc.with_pen(@pen) do |dc|
25
+ dc.with_brush(@fill) do |dc|
26
+ dc.draw_polygon(rarrow)
27
+ end
28
+ end
29
+ end
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,56 @@
1
+ # Wx::SF::OpenArrow - open arrow class
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+
4
+ require 'wx/shapes/arrow_base'
5
+
6
+ module Wx::SF
7
+
8
+ # Class extends the wxSFArrowBase class and encapsulates
9
+ # arrow shape consisting of single two lines leading from the end of the
10
+ # parent line shape.
11
+ class OpenArrow < ArrowBase
12
+
13
+ class << self
14
+ def open_arrow
15
+ @open_arrow ||= [Wx::RealPoint.new(0,0), Wx::RealPoint.new(10,4), Wx::RealPoint.new(10,-4)]
16
+ end
17
+ end
18
+
19
+ property :arrow_pen
20
+
21
+ # Constructor
22
+ # @param [Wx::SF::Shape] parent parent shape
23
+ def initialize(parent=nil)
24
+ super
25
+ @pen = DEFAULT::BORDER
26
+ end
27
+
28
+ # Get arrow border pen
29
+ # @return [Wx::Pen]
30
+ def get_arrow_pen
31
+ @pen
32
+ end
33
+ alias :arrow_pen :get_arrow_pen
34
+
35
+ # Set arrow border pen
36
+ # @param [Wx::Pen] pen
37
+ def set_arrow_pen(pen)
38
+ @pen = pen
39
+ end
40
+ alias :arrow_pen= :set_arrow_pen
41
+
42
+ # Draw arrow shape at the end of a virtual line.
43
+ # @param [Wx::RealPoint] from Start of the virtual line
44
+ # @param [Wx::RealPoint] to End of the virtual line
45
+ # @param [Wx::DC] dc Device context for drawing
46
+ def draw(from, to, dc)
47
+ rarrow = translate_arrow(OpenArrow.open_arrow, from, to)
48
+ dc.with_pen(@pen) do |dc|
49
+ dc.draw_line(rarrow[0], rarrow[1])
50
+ dc.draw_line(rarrow[0], rarrow[2])
51
+ end
52
+ end
53
+
54
+ end
55
+
56
+ end
@@ -0,0 +1,69 @@
1
+ # Wx::SF::SolidArrow - solid arrow class
2
+ # Copyright (c) M.J.N. Corino, The Netherlands
3
+
4
+ require 'wx/shapes/arrow_base'
5
+
6
+ module Wx::SF
7
+
8
+ class SolidArrow < ArrowBase
9
+
10
+ class << self
11
+ def solid_arrow
12
+ @solid_arrow ||= [Wx::RealPoint.new(0,0), Wx::RealPoint.new(10,4), Wx::RealPoint.new(10,-4)]
13
+ end
14
+ end
15
+
16
+ property :arrow_fill, :arrow_pen
17
+
18
+ # Constructor
19
+ # @param [Wx::SF::Shape] parent parent shape
20
+ def initialize(parent=nil)
21
+ super
22
+ @fill = DEFAULT::FILL
23
+ @pen = DEFAULT::BORDER
24
+ end
25
+
26
+ # Get arrow fill brush
27
+ # @return [Wx::Brush]
28
+ def get_arrow_fill
29
+ @fill
30
+ end
31
+ alias :arrow_fill :get_arrow_fill
32
+
33
+ # Set arrow fill brush
34
+ # @param [Wx::Brush] brush
35
+ def set_arrow_fill(brush)
36
+ @fill = brush
37
+ end
38
+ alias :arrow_fill= :set_arrow_fill
39
+
40
+ # Get arrow border pen
41
+ # @return [Wx::Pen]
42
+ def get_arrow_pen
43
+ @pen
44
+ end
45
+ alias :arrow_pen :get_arrow_pen
46
+
47
+ # Set arrow border pen
48
+ # @param [Wx::Pen] pen
49
+ def set_arrow_pen(pen)
50
+ @pen = pen
51
+ end
52
+ alias :arrow_pen= :set_arrow_pen
53
+
54
+ # Draw arrow shape at the end of a virtual line.
55
+ # @param [Wx::RealPoint] from Start of the virtual line
56
+ # @param [Wx::RealPoint] to End of the virtual line
57
+ # @param [Wx::DC] dc Device context for drawing
58
+ def draw(from, to, dc)
59
+ rarrow = translate_arrow(SolidArrow.solid_arrow, from, to)
60
+ dc.with_pen(@pen) do |dc|
61
+ dc.with_brush(@fill) do |dc|
62
+ dc.draw_polygon(rarrow)
63
+ end
64
+ end
65
+ end
66
+
67
+ end
68
+
69
+ end
@@ -0,0 +1,73 @@
1
+ /* XPM */
2
+ static char * page_xpm[] = {
3
+ "32 32 37 1",
4
+ "5 c #7198D9",
5
+ ", c #769CDA",
6
+ "2 c #DCE6F6",
7
+ "i c #FFFFFF",
8
+ "e c #779DDB",
9
+ ": c #9AB6E4",
10
+ "9 c #EAF0FA",
11
+ "- c #B1C7EB",
12
+ "$ c #6992D7",
13
+ "y c #F7F9FD",
14
+ "= c #BED0EE",
15
+ "q c #F0F5FC",
16
+ "; c #A8C0E8",
17
+ "@ c #366BC2",
18
+ " c None",
19
+ "u c #FDFEFF",
20
+ "8 c #5987D3",
21
+ "* c #C4D5F0",
22
+ "7 c #7CA0DC",
23
+ "O c #487BCE",
24
+ "< c #6B94D7",
25
+ "& c #CCDAF2",
26
+ "> c #89A9DF",
27
+ "3 c #5584D1",
28
+ "w c #82A5DE",
29
+ "1 c #3F74CB",
30
+ "+ c #3A70CA",
31
+ ". c #3569BF",
32
+ "% c #D2DFF4",
33
+ "# c #3366BB",
34
+ "r c #F5F8FD",
35
+ "0 c #FAFCFE",
36
+ "4 c #DFE8F7",
37
+ "X c #5E8AD4",
38
+ "o c #5282D0",
39
+ "t c #B8CCEC",
40
+ "6 c #E5EDF9",
41
+ " ",
42
+ " ",
43
+ " ",
44
+ " ",
45
+ " ",
46
+ " .XXXooOO++@# ",
47
+ " $%&*=-;::>,<1 ",
48
+ " $2%&*=-;::><:3 ",
49
+ " $42%&*=-;::<&:3 ",
50
+ " 56477<<<<8<<9&:X ",
51
+ " 59642%&*=-;<09&:5 ",
52
+ " 5q9642%&*=-<<<<<# ",
53
+ " 5qqw777<<<<<88:>+ ",
54
+ " erqq9642%&*=t;::+ ",
55
+ " eyrqq9642%&*=t;:O ",
56
+ " eyywwww777<<<<t;O ",
57
+ " e0yyrqq9642%&*=to ",
58
+ " e00yyrqq9642%&*=o ",
59
+ " eu0wwwwwww777<&*X ",
60
+ " euu00yyrqq9642%&X ",
61
+ " eiuu00yyrqq9642%X ",
62
+ " eiiwwwwwwwwww742$ ",
63
+ " eiiiuu00yyrqq964$ ",
64
+ " eiiiiuu00yyrqq96$ ",
65
+ " eiiiiiuu00yyrqq95 ",
66
+ " eiiiiiiuu00yyrqq5 ",
67
+ " eeeeeeeeeeeeee55e ",
68
+ " ",
69
+ " ",
70
+ " ",
71
+ " ",
72
+ " "
73
+ };