wxruby3 0.9.0.pre.beta.10 → 0.9.0.pre.beta.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +4 -4
  2. data/INSTALL.md +85 -0
  3. data/README.md +2 -0
  4. data/assets/logo.png +0 -0
  5. data/assets/logo.svg +170 -0
  6. data/assets/logo.xcf +0 -0
  7. data/ext/wxruby3/include/wxruby-ScaledDC.h +549 -0
  8. data/ext/wxruby3/swig/wx.i +1 -1
  9. data/lib/wx/core/array_ext.rb +26 -0
  10. data/lib/wx/core/art_locator.rb +92 -0
  11. data/lib/wx/core/artprovider.rb +1 -1
  12. data/lib/wx/core/bitmap.rb +90 -53
  13. data/lib/wx/core/cursor.rb +12 -0
  14. data/lib/wx/core/data_object.rb +74 -6
  15. data/lib/wx/core/dataformat.rb +3 -1
  16. data/lib/wx/core/dc.rb +76 -52
  17. data/lib/wx/core/enum.rb +4 -0
  18. data/lib/wx/core/event.rb +38 -5
  19. data/lib/wx/core/evthandler.rb +64 -23
  20. data/lib/wx/core/icon.rb +50 -35
  21. data/lib/wx/core/id_helper.rb +32 -0
  22. data/lib/wx/core/image.rb +63 -53
  23. data/lib/wx/core/point.rb +35 -10
  24. data/lib/wx/core/real_point.rb +35 -10
  25. data/lib/wx/core/rect.rb +44 -9
  26. data/lib/wx/core/region_iterator.rb +37 -0
  27. data/lib/wx/core/size.rb +32 -5
  28. data/lib/wx/core/window.rb +8 -31
  29. data/lib/wx/doc/array_ext.rb +27 -0
  30. data/lib/wx/doc/art_locator.rb +57 -0
  31. data/lib/wx/doc/bitmap.rb +27 -0
  32. data/lib/wx/doc/clipboard.rb +12 -0
  33. data/lib/wx/doc/const.rb +77 -0
  34. data/lib/wx/doc/cursor.rb +16 -0
  35. data/lib/wx/doc/data_object.rb +103 -0
  36. data/lib/wx/doc/dc.rb +63 -46
  37. data/lib/wx/doc/event.rb +24 -0
  38. data/lib/wx/doc/events.rb +14 -0
  39. data/lib/wx/doc/evthandler.rb +24 -3
  40. data/lib/wx/doc/extra/00_starting.md +1 -1
  41. data/lib/wx/doc/extra/06_geometry.md +10 -4
  42. data/lib/wx/doc/extra/10_art.md +105 -0
  43. data/lib/wx/doc/gc_dc.rb +21 -0
  44. data/lib/wx/doc/gdi_common.rb +155 -6
  45. data/lib/wx/doc/graphics_context.rb +42 -0
  46. data/lib/wx/doc/icon.rb +18 -0
  47. data/lib/wx/doc/id_helper.rb +25 -0
  48. data/lib/wx/doc/image.rb +33 -0
  49. data/lib/wx/doc/region_iterator.rb +31 -0
  50. data/lib/wx/doc/scaled_dc.rb +17 -0
  51. data/lib/wx/doc/window.rb +18 -0
  52. data/lib/wx/global_const.rb +4 -3
  53. data/lib/wx/version.rb +1 -1
  54. data/lib/wx/wxruby/cmd/sampler.rb +3 -21
  55. data/rakelib/lib/config.rb +4 -4
  56. data/rakelib/lib/core/package.rb +6 -6
  57. data/rakelib/lib/core/spec.rb +2 -0
  58. data/rakelib/lib/director/art_provider.rb +2 -2
  59. data/rakelib/lib/director/busy_info.rb +9 -7
  60. data/rakelib/lib/director/clipboard.rb +1 -1
  61. data/rakelib/lib/director/colour_picker_ctrl.rb +1 -0
  62. data/rakelib/lib/director/data_object.rb +162 -0
  63. data/rakelib/lib/director/data_object_simple_base.rb +123 -0
  64. data/rakelib/lib/director/derived_dc.rb +134 -2
  65. data/rakelib/lib/director/dir_picker_ctrl.rb +1 -0
  66. data/rakelib/lib/director/event.rb +73 -8
  67. data/rakelib/lib/director/events.rb +19 -1
  68. data/rakelib/lib/director/file_picker_ctrl.rb +1 -0
  69. data/rakelib/lib/director/font_picker_ctrl.rb +1 -0
  70. data/rakelib/lib/director/gdicommon.rb +1 -3
  71. data/rakelib/lib/director/graphics_context.rb +89 -0
  72. data/rakelib/lib/director/help_controller.rb +2 -2
  73. data/rakelib/lib/director/html_data_object.rb +37 -0
  74. data/rakelib/lib/director/image.rb +55 -0
  75. data/rakelib/lib/director/region_iterator.rb +48 -0
  76. data/rakelib/lib/director/richtext_buffer.rb +1 -1
  77. data/rakelib/lib/director/richtext_buffer_data_object.rb +45 -0
  78. data/rakelib/lib/director/scroll_bar.rb +39 -0
  79. data/rakelib/lib/director/slider.rb +39 -0
  80. data/rakelib/lib/director/window.rb +36 -5
  81. data/rakelib/lib/director/window_disabler.rb +0 -7
  82. data/rakelib/lib/extractor/class.rb +1 -1
  83. data/rakelib/lib/extractor/function.rb +1 -1
  84. data/rakelib/lib/generate/doc.rb +26 -6
  85. data/rakelib/lib/specs/interfaces.rb +8 -1
  86. data/rakelib/lib/typemap/common.rb +1 -1
  87. data/rakelib/lib/typemap/data_object_data.rb +13 -4
  88. data/rakelib/lib/util/string.rb +29 -8
  89. data/samples/art/wxruby-128x128.png +0 -0
  90. data/samples/art/wxruby-256x256.png +0 -0
  91. data/samples/art/wxruby-64x64.png +0 -0
  92. data/samples/art/wxruby.ico +0 -0
  93. data/samples/art/wxruby.png +0 -0
  94. data/samples/drawing/graphics_drawing.rb +1 -2
  95. data/samples/propgrid/propgrid.rb +65 -65
  96. data/samples/sample.xpm +246 -470
  97. data/samples/treectrl/treectrl.rb +1 -1
  98. data/tests/art/my_art/sample.xpm +251 -0
  99. data/tests/art/sample3.xpm +251 -0
  100. data/tests/art/test_art/bitmap/sample.xpm +251 -0
  101. data/tests/art/test_art/bitmap/wxruby.bmp +0 -0
  102. data/tests/art/test_art/bitmap/wxruby.png +0 -0
  103. data/tests/art/test_art/bitmap/wxruby.xpm +251 -0
  104. data/tests/art/test_art/cursor/wxruby.bmp +0 -0
  105. data/tests/art/test_art/icon/sample.xpm +251 -0
  106. data/tests/art/test_art/icon/wxruby.ico +0 -0
  107. data/tests/art/test_art/icon/wxruby.png +0 -0
  108. data/tests/art/test_art/image/sample.xpm +251 -0
  109. data/tests/art/test_art/image/wxruby.jpg +0 -0
  110. data/tests/art/test_art/image/wxruby.png +0 -0
  111. data/tests/art/test_art/sample2.xpm +251 -0
  112. data/tests/lib/wxapp_runner.rb +64 -0
  113. data/tests/test_art.rb +91 -0
  114. data/tests/test_basic.rb +0 -5
  115. data/tests/test_clipboard.rb +149 -17
  116. data/tests/test_dc.rb +70 -0
  117. data/tests/test_dialog.rb +2 -13
  118. data/tests/test_event_handling.rb +2 -13
  119. data/tests/test_events.rb +14 -6
  120. data/tests/test_geometry.rb +67 -17
  121. data/tests/test_intl.rb +2 -15
  122. data/tests/test_item_data.rb +2 -15
  123. data/tests/test_variant.rb +1 -15
  124. data/tests/testapp.rb +0 -5
  125. data/tests/testapp_noframe.rb +0 -5
  126. metadata +56 -5
@@ -52,24 +52,45 @@ module Wx
52
52
  # @return [Wx::Size]
53
53
  def +(arg) end
54
54
 
55
+ alias :get_x :get_width
56
+ alias :x :get_width
57
+ alias :get_y :get_height
58
+ alias :y :get_height
59
+
60
+ # Set this size to the given size's width,height values
61
+ # @param [Wx::Size] sz
62
+ # @return [self]
63
+ def assign(sz) end
64
+
65
+ # Returns self.
66
+ # @return [self]
67
+ def to_size; end
68
+
55
69
  end
56
70
 
57
71
  class Point
58
72
 
73
+ include Comparable
74
+
59
75
  # Returns point array (`[x, y]`)
60
76
  # @return [Array(Integer,Integer)] point as array
61
77
  def to_ary; end
62
78
 
63
- # Compare point values (Wx::Point or point array). Throws exception if incompatible.
79
+ # Compare point values (Wx::Point or point array). Returns -1,0 or 1 to indicate if this point
80
+ # is smaller, equal or greater than other (comparing <code>x*y</code> with <code>other.x*other.y</code>).
81
+ # Returns nil if incompatible.
64
82
  # @param [Wx::Point,Array(Integer,Integer)] other
65
- # @return [Boolean]
66
- def ==(other)end
83
+ # @return [Boolean,nil]
84
+ def <=>(other)end
67
85
 
68
86
  # Compare points.
69
87
  # @param [Wx::Point] other
70
88
  # @return [Boolean]
71
89
  def eql?(other)end
72
90
 
91
+ # Returns hash for point
92
+ def hash; end
93
+
73
94
  # Return a new Wx::Point with the x and y parameters both divided by
74
95
  # parameter +num+, which should be a Numeric
75
96
  # @param [Numeric] num
@@ -97,11 +118,27 @@ module Wx
97
118
  # @param [Wx::Point,Wx::Size,Array(Integer,Integer),Numeric] arg
98
119
  # @return [Wx::Point]
99
120
  def +(arg) end
100
-
121
+
122
+ # Converts point to Wx::RealPoint
123
+ # @return [Wx::RealPoint] Wx::RealPoint instance from point coordinates
124
+ def to_real_point; end
125
+ alias :to_real :to_real_point
126
+
127
+ # Returns self.
128
+ # @return [self]
129
+ def to_point; end
130
+
131
+ # Set this point to the given point's x,y values
132
+ # @param [Wx::Point] pt
133
+ # @return [self]
134
+ def assign(pt) end
135
+
101
136
  end
102
137
 
103
138
  class RealPoint
104
139
 
140
+ include Comparable
141
+
105
142
  # Returns point array (`[x, y]`)
106
143
  # @return [Array(Float,Float)] point as array
107
144
  def to_ary; end
@@ -111,11 +148,21 @@ module Wx
111
148
  # @return [Boolean]
112
149
  def ==(other)end
113
150
 
151
+ # Compare point values (Wx::RealPoint or point array). Returns -1,0 or 1 to indicate if this point
152
+ # is smaller, equal or greater than other (comparing <code>x*y</code> with <code>other.x*other.y</code>).
153
+ # Returns nil if incompatible.
154
+ # @param [Wx::RealPoint,Array(Float,Float)] other
155
+ # @return [Boolean,nil]
156
+ def <=>(other)end
157
+
114
158
  # Compare points.
115
159
  # @param [Wx::RealPoint] other
116
160
  # @return [Boolean]
117
161
  def eql?(other)end
118
162
 
163
+ # Returns hash for point
164
+ def hash; end
165
+
119
166
  # Return a new Wx::RealPoint with the x and y parameters both divided by
120
167
  # parameter +num+, which should be a Numeric
121
168
  # @param [Numeric] num
@@ -144,6 +191,19 @@ module Wx
144
191
  # @return [Wx::RealPoint]
145
192
  def +(arg) end
146
193
 
194
+ # Converts real point to Wx::Point
195
+ # @return [Wx::Point] Wx::Point instance from real point coordinates
196
+ def to_point; end
197
+
198
+ # Returns self.
199
+ # @return [self]
200
+ def to_real_point; end
201
+
202
+ # Set this point to the given point's x,y values
203
+ # @param [Wx::RealPoint] pt
204
+ # @return [self]
205
+ def assign(pt) end
206
+
147
207
  end
148
208
 
149
209
  class Rect
@@ -152,7 +212,7 @@ module Wx
152
212
  # @return [Array(Integer,Integer,Integer,Integer)] rect as array
153
213
  def to_ary; end
154
214
 
155
- # Compare area values (Wx::Rect or 4-element array). Throws exception if incompatible.
215
+ # Compare area values (Wx::Rect or 4-element array). Returns false if incompatible.
156
216
  # @param [Wx::Rect,Array(Integer,Integer,Integer,Integer)] other
157
217
  # @return [Boolean]
158
218
  def ==(other)end
@@ -162,6 +222,88 @@ module Wx
162
222
  # @return [Boolean]
163
223
  def eql?(other)end
164
224
 
225
+ # Update this rectangle to the union with 'rect'
226
+ # @param [Wx::Rect] rect
227
+ # @return [self]
228
+ def union!(rect) end
229
+
230
+ # Update this rectangle to the intersection with 'rect'
231
+ # @param [Wx::Rect] rect
232
+ # @return [self]
233
+ def intersect!(rect) end
234
+
235
+ # @overload deflate!(dx, dy)
236
+ # Decrease the rectangle size.
237
+ # This method is the opposite from {inflate!}: deflate!(a, b) is equivalent to inflate!(-a, -b). Please refer to {inflate!} for full description.
238
+ # @param dx [Integer]
239
+ # @param dy [Integer]
240
+ # @return [self]
241
+ # @overload deflate!(diff)
242
+ # Decrease the rectangle size.
243
+ # This method is the opposite from {inflate!}: deflate!(a, b) is equivalent to inflate!(-a, -b). Please refer to {inflate!} for full description.
244
+ # @param diff [Array(Integer, Integer), Wx::Size]
245
+ # @return [self]
246
+ # @overload deflate!(diff)
247
+ # Decrease the rectangle size.
248
+ # This method is the opposite from {inflate!}: deflate!(a, b) is equivalent to inflate!(-a, -b). Please refer to {inflate!} for full description.
249
+ # @param diff [Integer]
250
+ # @return [self]
251
+ def deflate!(*args) end
252
+
253
+ # @overload inflate!(dx, dy)
254
+ # Increases the size of the rectangle.
255
+ # The left border is moved farther left and the right border is moved farther right by dx. The upper border is moved farther up and the bottom border is moved farther down by dy. (Note that the width and height of the rectangle thus change by 2*dx and 2*dy, respectively.) If one or both of dx and dy are negative, the opposite happens: the rectangle size decreases in the respective direction.
256
+ # Inflating and deflating behaves "naturally". Defined more precisely, that means:
257
+ # - "Real" inflates (that is, dx and/or dy = 0) are not constrained. Thus inflating a rectangle can cause its upper left corner to move into the negative numbers. (2.5.4 and older forced the top left coordinate to not fall below (0, 0), which implied a forced move of the rectangle.)- Deflates are clamped to not reduce the width or height of the rectangle below zero. In such cases, the top-left corner is nonetheless handled properly. For example, a rectangle at (10, 10) with size (20, 40) that is inflated by (-15, -15) will become located at (20, 25) at size (0, 10). Finally, observe that the width and height are treated independently. In the above example, the width is reduced by 20, whereas the height is reduced by the full 30 (rather than also stopping at 20, when the width reached zero).
258
+ # @see #inflate
259
+ # @see #deflate!
260
+ # @param dx [Integer]
261
+ # @param dy [Integer]
262
+ # @return [self]
263
+ # @overload inflate!(diff)
264
+ # Increases the size of the rectangle.
265
+ # The left border is moved farther left and the right border is moved farther right by dx. The upper border is moved farther up and the bottom border is moved farther down by dy. (Note that the width and height of the rectangle thus change by 2*dx and 2*dy, respectively.) If one or both of dx and dy are negative, the opposite happens: the rectangle size decreases in the respective direction.
266
+ # Inflating and deflating behaves "naturally". Defined more precisely, that means:
267
+ # - "Real" inflates (that is, dx and/or dy = 0) are not constrained. Thus inflating a rectangle can cause its upper left corner to move into the negative numbers. (2.5.4 and older forced the top left coordinate to not fall below (0, 0), which implied a forced move of the rectangle.)- Deflates are clamped to not reduce the width or height of the rectangle below zero. In such cases, the top-left corner is nonetheless handled properly. For example, a rectangle at (10, 10) with size (20, 40) that is inflated by (-15, -15) will become located at (20, 25) at size (0, 10). Finally, observe that the width and height are treated independently. In the above example, the width is reduced by 20, whereas the height is reduced by the full 30 (rather than also stopping at 20, when the width reached zero).
268
+ # @see deflate
269
+ # @param diff [Array(Integer, Integer), Wx::Size]
270
+ # @return [self]
271
+ # @overload inflate!(diff)
272
+ # Increases the size of the rectangle.
273
+ # The left border is moved farther left and the right border is moved farther right by dx. The upper border is moved farther up and the bottom border is moved farther down by dy. (Note that the width and height of the rectangle thus change by 2*dx and 2*dy, respectively.) If one or both of dx and dy are negative, the opposite happens: the rectangle size decreases in the respective direction.
274
+ # Inflating and deflating behaves "naturally". Defined more precisely, that means:
275
+ # - "Real" inflates (that is, dx and/or dy = 0) are not constrained. Thus inflating a rectangle can cause its upper left corner to move into the negative numbers. (2.5.4 and older forced the top left coordinate to not fall below (0, 0), which implied a forced move of the rectangle.)- Deflates are clamped to not reduce the width or height of the rectangle below zero. In such cases, the top-left corner is nonetheless handled properly. For example, a rectangle at (10, 10) with size (20, 40) that is inflated by (-15, -15) will become located at (20, 25) at size (0, 10). Finally, observe that the width and height are treated independently. In the above example, the width is reduced by 20, whereas the height is reduced by the full 30 (rather than also stopping at 20, when the width reached zero).
276
+ # @see deflate
277
+ # @param diff [Integer]
278
+ # @return [self]
279
+ def inflate!(*args) end
280
+
281
+ # @overload offset(dx, dy)
282
+ # Moves the rectangle by the specified offset.
283
+ # If dx is positive, the rectangle is moved to the right, if dy is positive, it is moved to the bottom, otherwise it is moved to the left or top respectively.
284
+ # @param dx [Integer]
285
+ # @param dy [Integer]
286
+ # @return [Wx::Rect]
287
+ # @overload offset(pt)
288
+ # Moves the rectangle by the specified offset.
289
+ # If dx is positive, the rectangle is moved to the right, if dy is positive, it is moved to the bottom, otherwise it is moved to the left or top respectively.
290
+ # @param pt [Array(Integer, Integer), Wx::Point]
291
+ # @return [Wx::Rect]
292
+ def offset(*args) end
293
+
294
+ # @overload offset!(dx, dy)
295
+ # Moves the rectangle by the specified offset.
296
+ # If dx is positive, the rectangle is moved to the right, if dy is positive, it is moved to the bottom, otherwise it is moved to the left or top respectively.
297
+ # @param dx [Integer]
298
+ # @param dy [Integer]
299
+ # @return [self]
300
+ # @overload offset!(pt)
301
+ # Moves the rectangle by the specified offset.
302
+ # If dx is positive, the rectangle is moved to the right, if dy is positive, it is moved to the bottom, otherwise it is moved to the left or top respectively.
303
+ # @param pt [Array(Integer, Integer), Wx::Point]
304
+ # @return [self]
305
+ def offset!(*args) end
306
+
165
307
  alias :& :intersect
166
308
 
167
309
  alias :| :union
@@ -169,13 +311,20 @@ module Wx
169
311
  # Returns the overlap of the rectangle areas.
170
312
  # Does not check negative or zero overlap like #intersect.
171
313
  # @param [Wx::Rect] rect
314
+ # @return [Wx::Rect]
172
315
  def *(rect) end
173
316
 
174
- # Modifies the rectangle to contain the bounding box of this rectangle and the one passed in as parameter.
317
+ # Returns a rectangle containing the bounding box of this rectangle and the one passed in as parameter.
175
318
  # Does not ignore empty rectangles like #union
176
319
  # @param [Wx::Rect] rect
320
+ # @return [Wx::Rect]
177
321
  def +(rect) end
178
322
 
323
+ # Set this rectangle to the given rectangle's position & size values
324
+ # @param [Wx::Rect] rct
325
+ # @return [self]
326
+ def assign(rct) end
327
+
179
328
  end
180
329
 
181
330
  end
@@ -0,0 +1,42 @@
1
+
2
+ class Wx::GraphicsContext
3
+
4
+ # @overload self.draw_on(window)
5
+ # Creates a {Wx::GraphicsContext} from a {Wx::Window} and passes that object to the given block.
6
+ # Deletes the gc object after the block returns.
7
+ # @see Wx::GraphicsRenderer#create_context
8
+ # @param window [Wx::Window]
9
+ # @return [Wx::GraphicsContext]
10
+ # @overload self.draw_on(windowDC)
11
+ # Creates a {Wx::GraphicsContext} from a {Wx::WindowDC} and passes that object to the given block.
12
+ # Deletes the gc object after the block returns.
13
+ # @see Wx::GraphicsRenderer#create_context
14
+ # @param windowDC [Wx::WindowDC]
15
+ # @return [Wx::GraphicsContext]
16
+ # @overload self.draw_on(memoryDC)
17
+ # Creates a {Wx::GraphicsContext} from a {Wx::MemoryDC} and passes that object to the given block.
18
+ # Deletes the gc object after the block returns.
19
+ # @see Wx::GraphicsRenderer#create_context
20
+ # @param memoryDC [Wx::MemoryDC]
21
+ # @return [Wx::GraphicsContext]
22
+ # @overload self.draw_on(printerDC)
23
+ # Creates a {Wx::GraphicsContext} from a {Wx::PrinterDC} and passes that object to the given block.
24
+ # Deletes the gc object after the block returns.
25
+ # Under GTK+, this will only work when using the GtkPrint printing backend which is available since GTK+ 2.10.
26
+ # @see Wx::GraphicsRenderer#create_context
27
+ # @see Printing Under Unix (GTK+)
28
+ # @param printerDC [Wx::PrinterDC]
29
+ # @return [Wx::GraphicsContext]
30
+ # @overload self.draw_on(image)
31
+ # Creates a {Wx::GraphicsContext} associated with a {Wx::Image} and passes that object to the given block.
32
+ # Deletes the gc object after the block returns.
33
+ # The image specifies the size of the context as well as whether alpha is supported (if {Wx::Image#has_alpha}) or not and the initial contents of the context. The image object must have a life time greater than that of the new context as the context copies its contents back to the image when it is destroyed.
34
+ # @param image [Wx::Image]
35
+ # @return [Wx::GraphicsContext]
36
+ # @overload self.draw_on()
37
+ # Create a lightweight context that can be used only for measuring text and passes that object to the given block.
38
+ # Deletes the gc object after the block returns.
39
+ # @return [Wx::GraphicsContext]
40
+ def self.draw_on(*args) end
41
+
42
+ end
@@ -0,0 +1,18 @@
1
+
2
+ class Wx::Icon
3
+
4
+ # Searches for an art file with basename 'name' and creates an Icon if found.
5
+ # Raises an ArgumentError if not found.
6
+ # Wx::ArtLocator::find_art is used to look up the art file using ::Kernel#caller_locations to
7
+ # determine the values for the 'art_path' and 'art_owner' arguments ('art_path' is set to the
8
+ # absolute path to the folder holding the caller's code and 'art_owner' to the basename of the
9
+ # caller's source file). The 'art_type' argument is set to <code>:icon</code>.
10
+ # @param [String,Symbol] name base name of art file
11
+ # @param [Wx::BitmapType,nil] bmp_type bitmap type for art file (nil means any supported type)
12
+ # @param [Integer] desired_width
13
+ # @param [Integer] desired_height
14
+ # @return [Wx::Icon]
15
+ # @see Wx::ArtLocator::find_art
16
+ def self.Icon(name, bmp_type = nil, desired_width=-1, desired_height=-1); end
17
+
18
+ end
@@ -0,0 +1,25 @@
1
+
2
+ module Wx
3
+
4
+ # Mixin module to provide convenience method for defining Windows/Control ids.
5
+ # @example Define an ID module
6
+ # module MyIDS
7
+ # include Wx::IDHelper
8
+ # # by default the offset for the next id is Wx::ID_HIGHEST which makes 'Wx::ID_HIGHEST+1'
9
+ # # the first id value returned.
10
+ # MY_FIRST_ID = self.next_id
11
+ # MY_SECOND_ID = self.next_id # MY_SECOND_ID will have value Wx::ID_HIGHEST+2
12
+ #
13
+ # # optionally a user defined offset can be specified like this:
14
+ # MY_OTHER_ID = self.next_id(MY_FIRST_ID+1000) # MY_OTHER_ID will have value MY_FIRST_ID+1001
15
+ # MY_OTHER_ID2 = self.next_id # MY_OTHER_ID2 will have value MY_FIRST_ID+1002
16
+ # end
17
+ #
18
+ module IDHelper
19
+
20
+ # Provides the singleton method #next_id to the including module.
21
+ def self.included(base) end
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,33 @@
1
+
2
+ module Wx
3
+
4
+ class Image
5
+
6
+ # Returns an array of BitmapTypes identifying the available image handlers.
7
+ # @return [Array<Wx::BitmapType>]
8
+ def self.handlers; end
9
+
10
+ # Returns an array with the supported file extensions (as 'bmp') of the available image handlers.
11
+ # @return [Array<String>]
12
+ def self.extensions; end
13
+
14
+ # returns a Hash with all supported extensions per available BitmapType
15
+ # @return [Hash]
16
+ def self.handler_extensions; end
17
+
18
+ # Searches for an art file with basename 'name' and creates an Image if found.
19
+ # Raises an ArgumentError if not found.
20
+ # Wx::ArtLocator::find_art is used to look up the art file using ::Kernel#caller_locations to
21
+ # determine the values for the 'art_path' and 'art_owner' arguments ('art_path' is set to the
22
+ # absolute path to the folder holding the caller's code and 'art_owner' to the basename of the
23
+ # caller's source file). The 'art_type' argument is set to <code>:icon</code>.
24
+ # @param [String,Symbol] name base name of art file
25
+ # @param [Wx::BitmapType,nil] bmp_type bitmap type for art file (nil means any supported type)
26
+ # @param [Integer] index Index of the image to load in the case that the image file contains multiple images. This is only used by GIF, ICO and TIFF handlers. The default value (-1) means "choose the default image" and is interpreted as the first image (index=0) by the GIF and TIFF handler and as the largest and most colourful one by the ICO handler.
27
+ # @return [Wx::Image]
28
+ # @see Wx::ArtLocator::find_art
29
+ def self.Image(name, bmp_type = nil, index=-1); end
30
+
31
+ end
32
+
33
+ end
@@ -0,0 +1,31 @@
1
+
2
+ class Wx::RegionIterator
3
+
4
+ # Creates a Wx::RegionIterator and passes that to the given block.
5
+ # Removes the iterator after the block finishes.
6
+ # @param [Wx::Region] region
7
+ # @yieldparam [Wx::RegionIterator] region_it
8
+ def self.for_region(region) end
9
+
10
+ # Creates a Wx::RegionIterator and iterates each rectangle in the region executing the given block
11
+ # for each iteration passing the region iterator.
12
+ # @param [Wx::Region] region
13
+ # @yieldparam [Wx::RegionIterator] region_it
14
+ def self.iterate(region) end
15
+
16
+ alias :have_rects? :have_rects
17
+
18
+ # Moves to the next rectangle of the iterated region.
19
+ # @return [void]
20
+ def next_rect; end
21
+
22
+ # If a block is given the given block is called for each rectangle in the region passing the rectangle.
23
+ # If no block is given an Enumerator is returned.
24
+ # @overload each(&block)
25
+ # @yieldparam [Wx::Rect] rect
26
+ # @return [Object]
27
+ # @overload each()
28
+ # @return [Enumerator]
29
+ def each; end
30
+
31
+ end
@@ -0,0 +1,17 @@
1
+
2
+ class Wx
3
+
4
+ class ScaledDC < Wx::DC
5
+
6
+ private :initialize
7
+
8
+ # Creates a Wx::ScaledDC instance for target and scale and
9
+ # passes the instance to the given block to draw on.
10
+ # @param [Wx::DC] target DC to draw on (scaled)
11
+ # @param [Float] scale scale factor
12
+ # @yieldparam [Wx::ScaledDC] dc scaled dc to draw on
13
+ # @return [Object] result from block
14
+ def self.draw_on(target, scale) end
15
+ end
16
+
17
+ end
@@ -0,0 +1,18 @@
1
+
2
+ class Wx::Window
3
+
4
+ # Creates an appropriate (temporary) DC to paint on and
5
+ # passes that to the given block. Deletes the DC when the block returns.
6
+ # Creates a Wx::PaintDC when called from an evt_paint handler and a
7
+ # Wx::ClientDC otherwise.
8
+ # @yieldparam [Wx::PaintDC,Wx::ClientDC] dc dc to paint on
9
+ # @return [Object] result from block
10
+ def paint; end
11
+
12
+ # Similar to #paint but this time creates a Wx::AutoBufferedPaintDC when called
13
+ # from an evt_paint handler and a Wx::ClientDC otherwise.
14
+ # @yieldparam [Wx::AutoBufferedPaintDC,Wx::ClientDC] dc dc to paint on
15
+ # @return [Object] result from block
16
+ def paint_buffered; end
17
+
18
+ end
@@ -4,7 +4,7 @@
4
4
  module WxGlobalConstants
5
5
 
6
6
  class << self
7
- def search_nested(mod, sym)
7
+ def search_nested(mod, sym, path = [])
8
8
  # check any nested modules and/or (enum) classes
9
9
  const_val = nil
10
10
  mod.constants.each do |c|
@@ -16,11 +16,12 @@ module WxGlobalConstants
16
16
  elsif cv.name.start_with?('Wx::') # only search Wx namespace
17
17
  # prevent const_missing being triggered here since that may lead to unexpected results
18
18
  const_val = cv.const_get(sym) if cv.constants.include?(sym)
19
- const_val = search_nested(cv, sym) unless const_val
19
+ const_val = search_nested(cv, sym, path+[mod]) unless const_val || path.include?(cv)
20
20
  end
21
21
  when ::Module
22
22
  if cv.name.start_with?('Wx::') # only search Wx namespace
23
- const_val = cv.const_get(sym) rescue nil
23
+ const_val = cv.const_get(sym) if cv.constants.include?(sym)
24
+ const_val = search_nested(cv, sym, path+[mod]) unless const_val || path.include?(cv)
24
25
  end
25
26
  end unless mod == cv # watch out for infinite recursion
26
27
  break if const_val
data/lib/wx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Wx
2
- WXRUBY_VERSION = '0.9.0-beta.10'
2
+ WXRUBY_VERSION = '0.9.0-beta.13'
3
3
  end
@@ -15,24 +15,6 @@ module WxRuby
15
15
  " sampler [help]|[copy DEST]\tRun wxRuby3 Sampler application (or copy samples)."
16
16
  end
17
17
 
18
- def self.parse_args(args)
19
- opts = OptionParser.new
20
- opts.banner = "Usage: wxruby [global options] sampler [-h]|[-s PATH]\n"
21
- opts.separator ''
22
- opts.on('-s PATH', '--save=PATH',
23
- 'Save wxRuby samples under PATH.') do |v|
24
- OPTIONS[:save_path] = v.to_s
25
- end
26
- opts.on('-h', '--help',
27
- 'Show this message.') do |v|
28
- puts opts
29
- puts
30
- exit(0)
31
- end
32
- opts.raise_unknown = false
33
- opts.parse!(args)
34
- end
35
-
36
18
  def self.run(argv)
37
19
  if argv == :describe
38
20
  description
@@ -47,15 +29,15 @@ module WxRuby
47
29
  puts ' Starts the sampler application if called without arguments.'
48
30
  puts ' Otherwise shows this help for argument "help" or copies the included wxRuby'
49
31
  puts ' sample folders under the directory indicated by DEST for argument "copy DEST".'
50
- puts ' The directory indicated by DEST *must* already exist.'
32
+ puts ' The directory indicated by DEST *must* already exist.'
51
33
  puts
52
34
  elsif arg == 'copy'
53
35
  unless File.directory?(dest = argv.shift)
54
- STDERR.puts "ERROR: Invalid destination folder #{DEST}"
36
+ STDERR.puts "ERROR: Invalid destination folder #{dest}"
55
37
  exit(1)
56
38
  end
57
39
  Dir[File.join(WxRuby::ROOT, 'samples', '*')].each do |fp|
58
- FileUtils.cp_r(fp, dest, verbose: true, noop: true)
40
+ FileUtils.cp_r(fp, dest, verbose: true)
59
41
  end
60
42
  end
61
43
  end
@@ -145,11 +145,11 @@ module WXRuby3
145
145
  end
146
146
  private :do_run
147
147
 
148
- def make_ruby_cmd(*cmd)
148
+ def make_ruby_cmd(*cmd, verbose: true)
149
149
  [
150
150
  FileUtils::RUBY,
151
151
  '-I', rb_lib_path,
152
- (verbose? ? '-v' : nil),
152
+ (verbose && verbose? ? '-v' : nil),
153
153
  *cmd.flatten
154
154
  ].compact
155
155
  end
@@ -159,8 +159,8 @@ module WXRuby3
159
159
  do_run(*cmd.flatten)
160
160
  end
161
161
 
162
- def run(*cmd, capture: nil)
163
- do_run(*make_ruby_cmd(cmd), capture: capture)
162
+ def run(*cmd, capture: nil, verbose: true)
163
+ do_run(*make_ruby_cmd(cmd, verbose: verbose), capture: capture)
164
164
  end
165
165
 
166
166
  def debug_command(*args)
@@ -208,7 +208,7 @@ module WXRuby3
208
208
  # next initialize all modules without classes (keeping only those with classes)
209
209
  inc_dirs.select! do |dir|
210
210
  modreg = Spec.module_registry[dir.spec.module_name]
211
- if modreg.nil? || modreg.empty?
211
+ if !dir.spec.initialize_at_end && (modreg.nil? || modreg.empty?)
212
212
  init = "Init_#{dir.spec.module_name}()"
213
213
  decls << "extern \"C\" void #{init};"
214
214
  init_fn << " #{init};"
@@ -222,7 +222,7 @@ module WXRuby3
222
222
  cls_set = ::Set.new
223
223
  inc_dirs.select! do |dir|
224
224
  modreg = Spec.module_registry[dir.spec.module_name]
225
- if modreg && !modreg.empty? && modreg.values.all? {|base| base.nil? || modreg.has_key?(base) }
225
+ if !dir.spec.initialize_at_end && modreg && !modreg.empty? && modreg.values.all? {|base| base.nil? || modreg.has_key?(base) }
226
226
  cls_set.merge modreg.keys # remember classes
227
227
  init = "Init_#{dir.spec.module_name}()"
228
228
  decls << "extern \"C\" void #{init};"
@@ -235,7 +235,7 @@ module WXRuby3
235
235
 
236
236
  # next initialize all modules with classes depending (bases AND mixins) on classes in any modules already
237
237
  # selected until there are no more modules left or none that are left depend on any selected ones
238
- while dir_inx = inc_dirs.find_index { |dir| is_dir_with_fulfilled_deps?(dir, cls_set) }
238
+ while dir_inx = inc_dirs.find_index { |dir| !dir.spec.initialize_at_end && is_dir_with_fulfilled_deps?(dir, cls_set) }
239
239
  dir = inc_dirs[dir_inx]
240
240
  modreg = Spec.module_registry[dir.spec.module_name]
241
241
  cls_set.merge modreg.keys # remember classes
@@ -389,7 +389,7 @@ module WXRuby3
389
389
 
390
390
  def generate_event_types(fout, item, evts_handled)
391
391
  fout.puts " # from #{item.name}"
392
- item.event_types.each do |evt_hnd, evt_type, evt_arity, evt_klass|
392
+ item.event_types.each do |evt_hnd, evt_type, evt_arity, evt_klass, _|
393
393
  evh_name = evt_hnd.downcase
394
394
  unless evts_handled.include?(evh_name)
395
395
  evt_klass ||= item.name
@@ -463,11 +463,11 @@ module WXRuby3
463
463
  end
464
464
 
465
465
  def generate_event_doc(fdoc, item, evts_handled)
466
- item.event_types.each do |evt_hnd, evt_type, evt_arity, evt_klass|
466
+ item.event_types.each do |evt_hnd, evt_type, evt_arity, evt_klass, evt_nodoc|
467
467
  evh_name = evt_hnd.downcase
468
468
  unless evts_handled.include?(evh_name)
469
469
  evt_klass ||= item.name
470
- evh_args, evh_docstr = find_event_doc(evh_name)
470
+ evh_args, evh_docstr = evt_nodoc ? nil : find_event_doc(evh_name)
471
471
  fdoc.doc.puts evh_docstr if evh_docstr
472
472
  fdoc.doc.puts "Processes a {#{fullname}::#{evt_type}} event." unless /Process.*\s(event|command)/ =~ evh_docstr
473
473
  case evt_arity
@@ -77,6 +77,7 @@ module WXRuby3
77
77
  @post_processors = processors || [:rename, :fixmodule, :fix_protected_access]
78
78
  @requirements = [requirements].flatten
79
79
  @type_maps = Typemap::Collection.new
80
+ @initialize_at_end = false
80
81
  end
81
82
 
82
83
  attr_reader :director, :package, :module_name, :name, :items, :folded_bases, :ignores, :regards, :readonly, :contracts, :event_overrides,
@@ -85,6 +86,7 @@ module WXRuby3
85
86
  :runtime_code, :header_code, :wrapper_code, :extend_code, :init_code, :interface_code,
86
87
  :nogen_sections, :post_processors, :requirements, :type_maps
87
88
  attr_writer :interface_file
89
+ attr_accessor :initialize_at_end
88
90
 
89
91
  def interface_file
90
92
  @interface_file || File.join(Config.instance.classes_path, @name + '.i')
@@ -69,7 +69,7 @@ module WXRuby3
69
69
 
70
70
  v_id = WXSTR_TO_RSTR(id);
71
71
  v_client = WXSTR_TO_RSTR(client);
72
- v_size = SWIG_NewPointerObj(SWIG_as_voidptr(&size), SWIGTYPE_p_wxSize, 0);
72
+ v_size = SWIG_NewPointerObj(new wxSize(size), SWIGTYPE_p_wxSize, 1);
73
73
  v_ret = rb_funcall(self, create_bitmap_id(), 3, v_id, v_client, v_size);
74
74
 
75
75
  if (v_ret != Qnil)
@@ -87,7 +87,7 @@ module WXRuby3
87
87
 
88
88
  v_id = WXSTR_TO_RSTR(id);
89
89
  v_client = WXSTR_TO_RSTR(client);
90
- v_size = SWIG_NewPointerObj(SWIG_as_voidptr(&size), SWIGTYPE_p_wxSize, 0);
90
+ v_size = SWIG_NewPointerObj(new wxSize(size), SWIGTYPE_p_wxSize, 1);
91
91
  v_ret = rb_funcall(self, create_bitmap_bundle_id(), 3, v_id, v_client, v_size);
92
92
 
93
93
  if (v_ret != Qnil)
@@ -13,7 +13,7 @@ module WXRuby3
13
13
  super
14
14
  spec.items << 'wxBusyInfoFlags'
15
15
  spec.disable_proxies
16
- spec.gc_as_temporary 'wxBusyInfoFlags'
16
+ spec.gc_as_temporary 'wxBusyInfo', 'wxBusyInfoFlags'
17
17
  # again C++ type guards do not work with Ruby
18
18
  # need to Rubify this
19
19
  spec.make_abstract 'wxBusyInfo'
@@ -35,29 +35,31 @@ module WXRuby3
35
35
  spec.add_extend_code 'wxBusyInfo', <<~__HEREDOC
36
36
  static VALUE busy(const wxString& message, wxWindow *parent = NULL)
37
37
  {
38
+ VALUE rc = Qnil;
38
39
  VALUE rb_busyinfo = Qnil;
39
40
  wxBusyInfo *p_busyinfo = 0 ;
40
41
  if (rb_block_given_p())
41
42
  {
42
43
  wxBusyInfo disabler(message,parent);
43
44
  p_busyinfo = &disabler;
44
- rb_busyinfo = SWIG_NewPointerObj(SWIG_as_voidptr(p_busyinfo), SWIGTYPE_p_wxBusyInfo, 0 | 0 );
45
- return rb_yield(rb_busyinfo);
45
+ rb_busyinfo = SWIG_NewPointerObj(SWIG_as_voidptr(p_busyinfo), SWIGTYPE_p_wxBusyInfo, 0);
46
+ rc = rb_yield(rb_busyinfo);
46
47
  }
47
- return Qnil;
48
+ return rc;
48
49
  }
49
50
  static VALUE busy(const wxBusyInfoFlags &flags)
50
51
  {
52
+ VALUE rc = Qnil;
51
53
  VALUE rb_busyinfo = Qnil;
52
54
  wxBusyInfo *p_busyinfo = 0 ;
53
55
  if (rb_block_given_p())
54
56
  {
55
57
  wxBusyInfo disabler(flags);
56
58
  p_busyinfo = &disabler;
57
- rb_busyinfo = SWIG_NewPointerObj(SWIG_as_voidptr(p_busyinfo), SWIGTYPE_p_wxBusyInfo, 0 | 0 );
58
- return rb_yield(rb_busyinfo);
59
+ rb_busyinfo = SWIG_NewPointerObj(SWIG_as_voidptr(p_busyinfo), SWIGTYPE_p_wxBusyInfo, 0);
60
+ rc = rb_yield(rb_busyinfo);
59
61
  }
60
- return Qnil;
62
+ return rc;
61
63
  }
62
64
  __HEREDOC
63
65
  spec.map 'wxBusyInfoFlags &' => 'Wx::BusyInfoFlags' do