wxruby3 0.9.0.pre.beta.10-x64-mingw-ucrt → 0.9.0.pre.beta.13-x64-mingw-ucrt

Sign up to get free protection for your applications and to get access to all the features.
Files changed (283) 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/wxbase32u_gcc_custom.dll +0 -0
  8. data/ext/wxbase32u_net_gcc_custom.dll +0 -0
  9. data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
  10. data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
  11. data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
  12. data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
  13. data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
  14. data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
  15. data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
  16. data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
  17. data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
  18. data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
  19. data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
  20. data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
  21. data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
  22. data/lib/wx/core/array_ext.rb +26 -0
  23. data/lib/wx/core/art_locator.rb +92 -0
  24. data/lib/wx/core/artprovider.rb +1 -1
  25. data/lib/wx/core/bitmap.rb +90 -53
  26. data/lib/wx/core/cursor.rb +12 -0
  27. data/lib/wx/core/data_object.rb +74 -6
  28. data/lib/wx/core/dataformat.rb +3 -1
  29. data/lib/wx/core/dc.rb +76 -52
  30. data/lib/wx/core/enum.rb +4 -0
  31. data/lib/wx/core/event.rb +38 -5
  32. data/lib/wx/core/events/evt_list.rb +3 -2
  33. data/lib/wx/core/evthandler.rb +64 -23
  34. data/lib/wx/core/icon.rb +50 -35
  35. data/lib/wx/core/id_helper.rb +32 -0
  36. data/lib/wx/core/image.rb +63 -53
  37. data/lib/wx/core/point.rb +35 -10
  38. data/lib/wx/core/real_point.rb +35 -10
  39. data/lib/wx/core/rect.rb +44 -9
  40. data/lib/wx/core/region_iterator.rb +37 -0
  41. data/lib/wx/core/size.rb +32 -5
  42. data/lib/wx/core/window.rb +8 -31
  43. data/lib/wx/doc/array_ext.rb +27 -0
  44. data/lib/wx/doc/art_locator.rb +57 -0
  45. data/lib/wx/doc/bitmap.rb +27 -0
  46. data/lib/wx/doc/clipboard.rb +12 -0
  47. data/lib/wx/doc/const.rb +77 -0
  48. data/lib/wx/doc/cursor.rb +16 -0
  49. data/lib/wx/doc/data_object.rb +103 -0
  50. data/lib/wx/doc/dc.rb +63 -46
  51. data/lib/wx/doc/event.rb +24 -0
  52. data/lib/wx/doc/events.rb +14 -0
  53. data/lib/wx/doc/evthandler.rb +24 -3
  54. data/lib/wx/doc/extra/00_starting.md +1 -1
  55. data/lib/wx/doc/extra/06_geometry.md +10 -4
  56. data/lib/wx/doc/extra/10_art.md +105 -0
  57. data/lib/wx/doc/gc_dc.rb +21 -0
  58. data/lib/wx/doc/gdi_common.rb +155 -6
  59. data/lib/wx/doc/gen/about_dialog_info.rb +1 -4
  60. data/lib/wx/doc/gen/animation.rb +3 -3
  61. data/lib/wx/doc/gen/animation_ctrl.rb +4 -4
  62. data/lib/wx/doc/gen/any_button.rb +1 -1
  63. data/lib/wx/doc/gen/aui/aui_floating_frame.rb +1 -1
  64. data/lib/wx/doc/gen/aui/aui_manager.rb +2 -2
  65. data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +3 -3
  66. data/lib/wx/doc/gen/aui/aui_mdi_parent_frame.rb +3 -3
  67. data/lib/wx/doc/gen/aui/aui_notebook.rb +2 -2
  68. data/lib/wx/doc/gen/aui/aui_tool_bar.rb +6 -6
  69. data/lib/wx/doc/gen/bitmap.rb +1 -1
  70. data/lib/wx/doc/gen/bitmap_button.rb +2 -2
  71. data/lib/wx/doc/gen/book_ctrl_base.rb +4 -4
  72. data/lib/wx/doc/gen/brush.rb +1 -1
  73. data/lib/wx/doc/gen/button.rb +2 -2
  74. data/lib/wx/doc/gen/calendar_ctrl.rb +3 -3
  75. data/lib/wx/doc/gen/calendar_date_attr.rb +1 -1
  76. data/lib/wx/doc/gen/check_box.rb +2 -2
  77. data/lib/wx/doc/gen/check_list_box.rb +3 -3
  78. data/lib/wx/doc/gen/choice.rb +2 -2
  79. data/lib/wx/doc/gen/choicebook.rb +2 -2
  80. data/lib/wx/doc/gen/collapsible_pane.rb +2 -2
  81. data/lib/wx/doc/gen/colour.rb +1 -3
  82. data/lib/wx/doc/gen/colour_dialog.rb +1 -2
  83. data/lib/wx/doc/gen/colour_picker_ctrl.rb +2 -2
  84. data/lib/wx/doc/gen/combo_box.rb +4 -4
  85. data/lib/wx/doc/gen/context_help_button.rb +1 -1
  86. data/lib/wx/doc/gen/control.rb +3 -3
  87. data/lib/wx/doc/gen/core.rb +2 -2
  88. data/lib/wx/doc/gen/data_format.rb +1 -1
  89. data/lib/wx/doc/gen/data_object.rb +6 -26
  90. data/lib/wx/doc/gen/data_object_simple_base.rb +10 -0
  91. data/lib/wx/doc/gen/date_picker_ctrl.rb +2 -2
  92. data/lib/wx/doc/gen/dc.rb +9 -9
  93. data/lib/wx/doc/gen/defs.rb +0 -4
  94. data/lib/wx/doc/gen/dialog.rb +3 -3
  95. data/lib/wx/doc/gen/dir_dialog.rb +2 -4
  96. data/lib/wx/doc/gen/dir_filter_list_ctrl.rb +2 -2
  97. data/lib/wx/doc/gen/dir_picker_ctrl.rb +2 -2
  98. data/lib/wx/doc/gen/drag_drop.rb +13 -1
  99. data/lib/wx/doc/gen/editable_list_box.rb +2 -2
  100. data/lib/wx/doc/gen/event.rb +0 -1
  101. data/lib/wx/doc/gen/event_list.rb +18 -16
  102. data/lib/wx/doc/gen/events.rb +87 -2
  103. data/lib/wx/doc/gen/ext_help_controller.rb +2 -2
  104. data/lib/wx/doc/gen/file_dialog.rb +1 -1
  105. data/lib/wx/doc/gen/file_picker_ctrl.rb +2 -2
  106. data/lib/wx/doc/gen/font.rb +6 -6
  107. data/lib/wx/doc/gen/font_dialog.rb +1 -2
  108. data/lib/wx/doc/gen/font_picker_ctrl.rb +2 -2
  109. data/lib/wx/doc/gen/frame.rb +5 -5
  110. data/lib/wx/doc/gen/fs_file.rb +2 -2
  111. data/lib/wx/doc/gen/gauge.rb +2 -2
  112. data/lib/wx/doc/gen/gdi_common.rb +18 -21
  113. data/lib/wx/doc/gen/generic_dir_ctrl.rb +2 -2
  114. data/lib/wx/doc/gen/graphics_context.rb +4 -4
  115. data/lib/wx/doc/gen/graphics_object.rb +2 -2
  116. data/lib/wx/doc/gen/grid/grid_cell_bool_editor.rb +1 -1
  117. data/lib/wx/doc/gen/grid/grid_cell_date_time_renderer.rb +1 -1
  118. data/lib/wx/doc/gen/grid/grid_cell_enum_editor.rb +1 -1
  119. data/lib/wx/doc/gen/grid/grid_cell_enum_renderer.rb +1 -1
  120. data/lib/wx/doc/gen/grid/grid_cell_float_editor.rb +1 -1
  121. data/lib/wx/doc/gen/grid/grid_cell_float_renderer.rb +1 -1
  122. data/lib/wx/doc/gen/grid/grid_ctrl.rb +7 -7
  123. data/lib/wx/doc/gen/help_controller.rb +1 -1
  124. data/lib/wx/doc/gen/html/html_cell.rb +4 -4
  125. data/lib/wx/doc/gen/html/html_easy_printing.rb +6 -6
  126. data/lib/wx/doc/gen/html/html_help_controller.rb +6 -6
  127. data/lib/wx/doc/gen/html/html_help_frame.rb +2 -2
  128. data/lib/wx/doc/gen/html/html_help_window.rb +6 -6
  129. data/lib/wx/doc/gen/html/html_list_box.rb +6 -6
  130. data/lib/wx/doc/gen/html/html_printout.rb +4 -4
  131. data/lib/wx/doc/gen/html/html_window.rb +4 -4
  132. data/lib/wx/doc/gen/icon.rb +6 -6
  133. data/lib/wx/doc/gen/image.rb +7 -7
  134. data/lib/wx/doc/gen/list_box.rb +4 -4
  135. data/lib/wx/doc/gen/list_ctrl.rb +5 -5
  136. data/lib/wx/doc/gen/listbook.rb +2 -2
  137. data/lib/wx/doc/gen/locale.rb +8 -8
  138. data/lib/wx/doc/gen/log.rb +2 -2
  139. data/lib/wx/doc/gen/mdi_frame.rb +5 -5
  140. data/lib/wx/doc/gen/media_ctrl.rb +4 -4
  141. data/lib/wx/doc/gen/menu.rb +12 -12
  142. data/lib/wx/doc/gen/menu_item.rb +1 -1
  143. data/lib/wx/doc/gen/message_dialog.rb +2 -4
  144. data/lib/wx/doc/gen/mini_frame.rb +2 -2
  145. data/lib/wx/doc/gen/notebook.rb +3 -3
  146. data/lib/wx/doc/gen/number_entry_dialog.rb +0 -1
  147. data/lib/wx/doc/gen/object.rb +0 -1
  148. data/lib/wx/doc/gen/panel.rb +2 -2
  149. data/lib/wx/doc/gen/pen.rb +2 -2
  150. data/lib/wx/doc/gen/pg/pg_array_editor_dialog.rb +1 -1
  151. data/lib/wx/doc/gen/pg/pg_cell.rb +1 -1
  152. data/lib/wx/doc/gen/pg/pg_properties.rb +20 -20
  153. data/lib/wx/doc/gen/pg/pg_property.rb +12 -12
  154. data/lib/wx/doc/gen/pg/property_grid.rb +3 -3
  155. data/lib/wx/doc/gen/pg/property_grid_interface.rb +14 -14
  156. data/lib/wx/doc/gen/pg/property_grid_manager.rb +3 -3
  157. data/lib/wx/doc/gen/pg/property_grid_page.rb +2 -2
  158. data/lib/wx/doc/gen/pg/property_grid_page_state.rb +2 -2
  159. data/lib/wx/doc/gen/popup_window.rb +3 -3
  160. data/lib/wx/doc/gen/property_sheet_dialog.rb +3 -3
  161. data/lib/wx/doc/gen/prt/print_abort_dialog.rb +1 -1
  162. data/lib/wx/doc/gen/prt/printer.rb +1 -1
  163. data/lib/wx/doc/gen/radio_box.rb +4 -4
  164. data/lib/wx/doc/gen/radio_button.rb +2 -2
  165. data/lib/wx/doc/gen/rbn/ribbon_bar.rb +2 -2
  166. data/lib/wx/doc/gen/rbn/ribbon_button_bar.rb +12 -12
  167. data/lib/wx/doc/gen/rbn/ribbon_control.rb +1 -1
  168. data/lib/wx/doc/gen/rbn/ribbon_gallery.rb +2 -2
  169. data/lib/wx/doc/gen/rbn/ribbon_page.rb +2 -2
  170. data/lib/wx/doc/gen/rbn/ribbon_panel.rb +2 -2
  171. data/lib/wx/doc/gen/rbn/ribbon_tool_bar.rb +11 -11
  172. data/lib/wx/doc/gen/region.rb +1 -1
  173. data/lib/wx/doc/gen/region_iterator.rb +76 -0
  174. data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +10 -10
  175. data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +19 -19
  176. data/lib/wx/doc/gen/rtc/rich_text_file_handler.rb +2 -2
  177. data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +4 -4
  178. data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +1 -1
  179. data/lib/wx/doc/gen/rtc/rich_text_printing.rb +6 -6
  180. data/lib/wx/doc/gen/rtc/rich_text_xml_handler.rb +1 -1
  181. data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +2 -2
  182. data/lib/wx/doc/gen/sash_event.rb +1 -1
  183. data/lib/wx/doc/gen/sash_layout_window.rb +2 -2
  184. data/lib/wx/doc/gen/sash_window.rb +1 -1
  185. data/lib/wx/doc/gen/scaled_dc.rb +10 -0
  186. data/lib/wx/doc/gen/scroll_bar.rb +150 -0
  187. data/lib/wx/doc/gen/scrolled_canvas.rb +2 -2
  188. data/lib/wx/doc/gen/scrolled_control.rb +2 -2
  189. data/lib/wx/doc/gen/scrolled_window.rb +2 -2
  190. data/lib/wx/doc/gen/simplebook.rb +2 -2
  191. data/lib/wx/doc/gen/sizer.rb +3 -3
  192. data/lib/wx/doc/gen/slider.rb +2 -2
  193. data/lib/wx/doc/gen/spin_button.rb +2 -2
  194. data/lib/wx/doc/gen/spin_ctrl.rb +2 -2
  195. data/lib/wx/doc/gen/splash_screen.rb +1 -1
  196. data/lib/wx/doc/gen/splitter_window.rb +2 -2
  197. data/lib/wx/doc/gen/static_bitmap.rb +2 -2
  198. data/lib/wx/doc/gen/static_box.rb +4 -4
  199. data/lib/wx/doc/gen/static_box_sizer.rb +1 -1
  200. data/lib/wx/doc/gen/static_line.rb +2 -2
  201. data/lib/wx/doc/gen/static_text.rb +2 -2
  202. data/lib/wx/doc/gen/status_bar.rb +2 -2
  203. data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +3 -3
  204. data/lib/wx/doc/gen/task_bar_icon.rb +2 -2
  205. data/lib/wx/doc/gen/text_attr.rb +3 -3
  206. data/lib/wx/doc/gen/text_ctrl.rb +3 -3
  207. data/lib/wx/doc/gen/text_entry_dialog.rb +6 -8
  208. data/lib/wx/doc/gen/text_validator.rb +1 -1
  209. data/lib/wx/doc/gen/time_picker_ctrl.rb +2 -2
  210. data/lib/wx/doc/gen/tip_provider.rb +1 -3
  211. data/lib/wx/doc/gen/toggle_button.rb +2 -2
  212. data/lib/wx/doc/gen/tool_bar.rb +10 -10
  213. data/lib/wx/doc/gen/toolbook.rb +2 -2
  214. data/lib/wx/doc/gen/top_level_window.rb +4 -4
  215. data/lib/wx/doc/gen/tree_ctrl.rb +4 -4
  216. data/lib/wx/doc/gen/treebook.rb +2 -2
  217. data/lib/wx/doc/gen/utils.rb +5 -42
  218. data/lib/wx/doc/gen/v_list_box.rb +2 -2
  219. data/lib/wx/doc/gen/v_scrolled_window.rb +2 -2
  220. data/lib/wx/doc/gen/variant.rb +10 -10
  221. data/lib/wx/doc/gen/window.rb +9 -14
  222. data/lib/wx/doc/gen/wizard.rb +2 -2
  223. data/lib/wx/doc/gen/wizard_event.rb +1 -1
  224. data/lib/wx/doc/gen/xml_node.rb +2 -2
  225. data/lib/wx/doc/gen/xml_resource.rb +3 -3
  226. data/lib/wx/doc/graphics_context.rb +42 -0
  227. data/lib/wx/doc/icon.rb +18 -0
  228. data/lib/wx/doc/id_helper.rb +25 -0
  229. data/lib/wx/doc/image.rb +33 -0
  230. data/lib/wx/doc/region_iterator.rb +31 -0
  231. data/lib/wx/doc/scaled_dc.rb +17 -0
  232. data/lib/wx/doc/window.rb +18 -0
  233. data/lib/wx/global_const.rb +4 -3
  234. data/lib/wx/version.rb +1 -1
  235. data/lib/wx/wxruby/cmd/sampler.rb +3 -21
  236. data/lib/wxruby_aui.so +0 -0
  237. data/lib/wxruby_core.so +0 -0
  238. data/lib/wxruby_grid.so +0 -0
  239. data/lib/wxruby_html.so +0 -0
  240. data/lib/wxruby_pg.so +0 -0
  241. data/lib/wxruby_prt.so +0 -0
  242. data/lib/wxruby_rbn.so +0 -0
  243. data/lib/wxruby_rtc.so +0 -0
  244. data/lib/wxruby_stc.so +0 -0
  245. data/rakelib/lib/config.rb +4 -4
  246. data/samples/art/wxruby-128x128.png +0 -0
  247. data/samples/art/wxruby-256x256.png +0 -0
  248. data/samples/art/wxruby-64x64.png +0 -0
  249. data/samples/art/wxruby.ico +0 -0
  250. data/samples/art/wxruby.png +0 -0
  251. data/samples/drawing/graphics_drawing.rb +1 -2
  252. data/samples/propgrid/propgrid.rb +65 -65
  253. data/samples/sample.xpm +246 -470
  254. data/samples/treectrl/treectrl.rb +1 -1
  255. data/tests/art/my_art/sample.xpm +251 -0
  256. data/tests/art/sample3.xpm +251 -0
  257. data/tests/art/test_art/bitmap/sample.xpm +251 -0
  258. data/tests/art/test_art/bitmap/wxruby.bmp +0 -0
  259. data/tests/art/test_art/bitmap/wxruby.png +0 -0
  260. data/tests/art/test_art/bitmap/wxruby.xpm +251 -0
  261. data/tests/art/test_art/cursor/wxruby.bmp +0 -0
  262. data/tests/art/test_art/icon/sample.xpm +251 -0
  263. data/tests/art/test_art/icon/wxruby.ico +0 -0
  264. data/tests/art/test_art/icon/wxruby.png +0 -0
  265. data/tests/art/test_art/image/sample.xpm +251 -0
  266. data/tests/art/test_art/image/wxruby.jpg +0 -0
  267. data/tests/art/test_art/image/wxruby.png +0 -0
  268. data/tests/art/test_art/sample2.xpm +251 -0
  269. data/tests/lib/wxapp_runner.rb +64 -0
  270. data/tests/test_art.rb +91 -0
  271. data/tests/test_basic.rb +0 -5
  272. data/tests/test_clipboard.rb +149 -17
  273. data/tests/test_dc.rb +70 -0
  274. data/tests/test_dialog.rb +2 -13
  275. data/tests/test_event_handling.rb +2 -13
  276. data/tests/test_events.rb +14 -6
  277. data/tests/test_geometry.rb +67 -17
  278. data/tests/test_intl.rb +2 -15
  279. data/tests/test_item_data.rb +2 -15
  280. data/tests/test_variant.rb +1 -15
  281. data/tests/testapp.rb +0 -5
  282. data/tests/testapp_noframe.rb +0 -5
  283. metadata +55 -3
data/lib/wx/core/image.rb CHANGED
@@ -1,68 +1,78 @@
1
1
  # A platform-independent image; can be manipulated more extensively than
2
2
  # Bitmap, but must be converted to a Bitmap for drawing.
3
- class Wx::Image
3
+ module Wx
4
+ class Image
4
5
 
5
- # restore the overloaded method
6
- def set_rgb_data(data, *size)
7
- if size.empty?
8
- height = self.get_size.height
9
- width = self.get_size.width
10
- else
11
- width, height = size
12
- if Wx::Size === width
13
- height = width.height
14
- width = width.width
6
+ # restore the overloaded method
7
+ def set_rgb_data(data, *size)
8
+ if size.empty?
9
+ height = self.get_size.height
10
+ width = self.get_size.width
11
+ else
12
+ width, height = size
13
+ if Wx::Size === width
14
+ height = width.height
15
+ width = width.width
16
+ end
15
17
  end
18
+ set_rgb_data_with_size(data, width, height)
16
19
  end
17
- set_rgb_data_with_size(data, width, height)
18
- end
19
20
 
20
- # alias for backward compatibility
21
- alias :get_data :get_rgb_data
22
- alias :set_data :set_rgb_data
23
-
24
- # Load the type-guessing hash from Wx::Bitmap
25
- require_relative './bitmap'
26
- BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
21
+ # alias for backward compatibility
22
+ alias :get_data :get_rgb_data
23
+ alias :set_data :set_rgb_data
27
24
 
28
- # Load a new image from an IO-like object that supports "read"
29
- def self.read(an_io, type_or_mime, index = -1)
30
- img = new
31
- img.load_stream(an_io, type_or_mime, index)
32
- img
33
- end
25
+ # Load the type-guessing hash from Wx::Bitmap
26
+ require_relative './bitmap'
27
+ BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
34
28
 
35
- # Create a new image from Wx::Bitmap, preserving mask information
36
- def self.from_bitmap(bmp)
37
- bmp.convert_to_image
38
- end
29
+ # Load a new image from an IO-like object that supports "read"
30
+ def self.read(an_io, type_or_mime, index = -1)
31
+ img = new
32
+ img.load_stream(an_io, type_or_mime, index)
33
+ img
34
+ end
39
35
 
40
- # Ruby methods that switch class are conventionally named to_foo
41
- def to_bitmap
42
- Wx::Bitmap.from_image(self)
43
- end
36
+ # Create a new image from Wx::Bitmap, preserving mask information
37
+ def self.from_bitmap(bmp)
38
+ bmp.convert_to_image
39
+ end
44
40
 
45
- # Redefine the initialize method so it raises an exception if a
46
- # non-existent file is given to the constructor; otherwise, wx Widgets
47
- # just carries on with an invalid image, which may cause faults
48
- # later. Also, if loading from a file, and the type is not specified,
49
- # try to guess it from the filename extension
50
- wx_init = self.instance_method(:initialize)
51
- define_method(:initialize) do | *args |
52
- if args[0].kind_of? String
53
- if not File.exist?( File.expand_path(args[0]) )
54
- Kernel.raise(ArgumentError, "Image file does not exist: #{args[0]}")
55
- end
56
- # If type not specified, try to guess it from the file extension
57
- if not args[1] and file_ext = args[0][/\w+$/]
58
- args[1] = BITMAP_TYPE_GUESS[file_ext.downcase]
41
+ # Ruby methods that switch class are conventionally named to_foo
42
+ def to_bitmap
43
+ Wx::Bitmap.from_image(self)
44
+ end
45
+
46
+ # Redefine the initialize method so it raises an exception if a
47
+ # non-existent file is given to the constructor; otherwise, wx Widgets
48
+ # just carries on with an invalid image, which may cause faults
49
+ # later. Also, if loading from a file, and the type is not specified,
50
+ # try to guess it from the filename extension
51
+ wx_init = self.instance_method(:initialize)
52
+ define_method(:initialize) do | *args |
53
+ if args[0].kind_of? String
54
+ if not File.exist?( File.expand_path(args[0]) )
55
+ Kernel.raise(ArgumentError, "Image file does not exist: #{args[0]}")
56
+ end
57
+ # If type not specified, try to guess it from the file extension
58
+ if not args[1] and file_ext = args[0][/\w+$/]
59
+ args[1] = BITMAP_TYPE_GUESS[file_ext.downcase]
60
+ end
59
61
  end
62
+ wx_init.bind(self).call(*args)
63
+ end
64
+
65
+ # Convert to bitmap
66
+ def convert_to_bitmap
67
+ Wx::Bitmap.from_image(self)
60
68
  end
61
- wx_init.bind(self).call(*args)
62
69
  end
63
-
64
- # Convert to bitmap
65
- def convert_to_bitmap
66
- Wx::Bitmap.from_image(self)
70
+
71
+ def self.Image(name, bmp_type = nil, *rest)
72
+ art_path = File.dirname(caller_path = caller_locations(1).first.absolute_path)
73
+ art_owner = File.basename(caller_path, '.*')
74
+ art_file = ArtLocator.find_art(name, art_type: :image, art_path: art_path, art_section: art_owner, bmp_type: bmp_type)
75
+ ::Kernel.raise ArgumentError, "Cannot locate art file for #{name}:Image" unless art_file
76
+ Image.new(art_file, bmp_type, *rest)
67
77
  end
68
78
  end
data/lib/wx/core/point.rb CHANGED
@@ -1,4 +1,7 @@
1
1
  class Wx::Point
2
+
3
+ include Comparable
4
+
2
5
  # More informative output when converted to string
3
6
  def to_s
4
7
  "#<Wx::Point: (#{x}, #{y})>"
@@ -16,23 +19,26 @@ class Wx::Point
16
19
  alias :get_x :x
17
20
  alias :get_y :y
18
21
 
19
- # Compare point values
20
- def ==(other)
21
- if Wx::Point === other
22
+ # Correct comparison for Points - same if same x and y
23
+ def eql?(other)
24
+ if other.instance_of?(self.class)
22
25
  x == other.x and y == other.y
23
- elsif Array === other && other.size == 2
24
- to_ary == other
25
26
  else
26
- Kernel.raise TypeError, "Cannot compare Point to #{other}"
27
+ false
27
28
  end
28
29
  end
29
30
 
30
- # Correct comparison for Points - same if same x and y
31
- def eql?(other)
31
+ def hash
32
+ to_ary.hash
33
+ end
34
+
35
+ def <=>(other)
32
36
  if Wx::Point === other
33
- x == other.x and y == other.y
37
+ (x*y) <=> (other.x*other.y)
38
+ elsif Array === other && other.size == 2
39
+ (x*y) <=> (other.first.to_i*other.last.to_i)
34
40
  else
35
- false
41
+ nil
36
42
  end
37
43
  end
38
44
 
@@ -89,4 +95,23 @@ class Wx::Point
89
95
  end
90
96
  end
91
97
  end
98
+
99
+ def to_real_point
100
+ Wx::RealPoint.new(self.x.to_f, self.y.to_f)
101
+ end
102
+ alias :to_real :to_real_point
103
+
104
+ def to_point
105
+ self
106
+ end
107
+
108
+ def dup
109
+ Wx::Point.new(self.x, self.y)
110
+ end
111
+
112
+ def assign(pt)
113
+ self.x = pt.x
114
+ self.y = pt.y
115
+ self
116
+ end
92
117
  end
@@ -1,4 +1,7 @@
1
1
  class Wx::RealPoint
2
+
3
+ include Comparable
4
+
2
5
  # More informative output when converted to string
3
6
  def to_s
4
7
  "#<Wx::RealPoint: (#{x}, #{y})>"
@@ -16,23 +19,26 @@ class Wx::RealPoint
16
19
  alias :get_x :x
17
20
  alias :get_y :y
18
21
 
19
- # Compare point values
20
- def ==(other)
21
- if Wx::RealPoint === other
22
+ # Correct comparison for RealPoints - same if same x and y
23
+ def eql?(other)
24
+ if other.instance_of?(self.class)
22
25
  x == other.x and y == other.y
23
- elsif Array === other && other.size == 2
24
- to_ary == other
25
26
  else
26
- Kernel.raise TypeError, "Cannot compare RealPoint to #{other}"
27
+ false
27
28
  end
28
29
  end
29
30
 
30
- # Correct comparison for RealPoints - same if same x and y
31
- def eql?(other)
31
+ def hash
32
+ to_ary.hash
33
+ end
34
+
35
+ def <=>(other)
32
36
  if Wx::RealPoint === other
33
- x == other.x and y == other.y
37
+ (x*y) <=> (other.x*other.y)
38
+ elsif Array === other && other.size == 2
39
+ (x*y) <=> (other.first.to_f*other.last.to_f)
34
40
  else
35
- false
41
+ nil
36
42
  end
37
43
  end
38
44
 
@@ -89,4 +95,23 @@ class Wx::RealPoint
89
95
  end
90
96
  end
91
97
  end
98
+
99
+ def to_point
100
+ Wx::Point.new(self.x.to_i, self.y.to_i)
101
+ end
102
+
103
+ def to_real_point
104
+ self
105
+ end
106
+
107
+ def dup
108
+ Wx::RealPoint.new(self.x, self.y)
109
+ end
110
+
111
+ def assign(pt)
112
+ self.x = pt.x
113
+ self.y = pt.y
114
+ self
115
+ end
116
+
92
117
  end
data/lib/wx/core/rect.rb CHANGED
@@ -23,12 +23,12 @@ class Wx::Rect
23
23
  elsif Array === other && other.size == 4
24
24
  to_ary == other
25
25
  else
26
- Kernel.raise TypeError, "Cannot compare Rect to #{other}"
26
+ false
27
27
  end
28
28
  end
29
29
 
30
30
  def eql?(other)
31
- if Wx::Rect === other
31
+ if other.instance_of?(self.class)
32
32
  left == other.left and top == other.top and
33
33
  width == other.width and height == other.height
34
34
  else
@@ -36,15 +36,40 @@ class Wx::Rect
36
36
  end
37
37
  end
38
38
 
39
- # make sure union and intersect are constant operations, i.e. not changing self
40
- wx_union = instance_method :union
41
- define_method :union do |rect|
42
- wx_union.bind(Wx::Rect.new(*self.to_ary)).call(rect)
39
+ # provide both constant and non-constant versions of union/intersect/inflate/deflate/offset
40
+
41
+ # first alias the wrapped (non-constant) versions with correct names
42
+ alias :union! :union
43
+ alias :intersect! :intersect
44
+ alias :inflate! :inflate
45
+ alias :deflate! :deflate
46
+
47
+ # redefine offset as offset! returning self
48
+ wx_offset = instance_method :offset
49
+ define_method :offset! do |*args|
50
+ wx_offset.bind(self).call(*args)
51
+ self
52
+ end
53
+
54
+ # next provide new constant versions
55
+ def offset(*args)
56
+ self.dup.offset!(*args)
57
+ end
58
+
59
+ def union(rect)
60
+ self.dup.union!(rect)
43
61
  end
44
62
 
45
- wx_intersect = instance_method :intersect
46
- define_method :intersect do |rect|
47
- wx_intersect.bind(Wx::Rect.new(*self.to_ary)).call(rect)
63
+ def intersect(rect)
64
+ self.dup.intersect!(rect)
65
+ end
66
+
67
+ def inflate(*args)
68
+ self.dup.inflate!(*args)
69
+ end
70
+
71
+ def deflate(*args)
72
+ self.dup.deflate!(*args)
48
73
  end
49
74
 
50
75
  alias :+ :add
@@ -54,4 +79,14 @@ class Wx::Rect
54
79
 
55
80
  # More ruby-ish names
56
81
  alias :contains? :contains
82
+
83
+ def dup
84
+ Wx::Rect.new(self.x, self.y, self.width, self.height)
85
+ end
86
+
87
+ def assign(rct)
88
+ self.position = rct.position
89
+ self.size = rct.size
90
+ self
91
+ end
57
92
  end
@@ -0,0 +1,37 @@
1
+
2
+ class Wx::RegionIterator
3
+
4
+ alias :have_rects? :have_rects
5
+
6
+ # Ruby like enumeration
7
+ def each
8
+ if block_given?
9
+ while have_rects
10
+ yield get_rect
11
+ next_rect
12
+ end
13
+ else
14
+ # The region iterator instance cannot be allowed to exist beyond the outer
15
+ # Wx::RegionIterator.for_region block as it is a temporary instance that
16
+ # will stop to exist when the outer block finishes, so we collect the rectangles
17
+ # here and return an enumerator on that
18
+ arr = []
19
+ while has_rects
20
+ arr << get_rect
21
+ next_rect
22
+ end
23
+ arr.each
24
+ end
25
+ end
26
+
27
+ def self.iterate(region, &block)
28
+ return unless block
29
+ for_region(region) do |ri|
30
+ while ri.have_rects
31
+ block.call(ri)
32
+ ri.next_rect
33
+ end
34
+ end
35
+ end
36
+
37
+ end
data/lib/wx/core/size.rb CHANGED
@@ -1,4 +1,13 @@
1
1
  class Wx::Size
2
+
3
+ include Comparable
4
+
5
+ # provide compatibility methods
6
+ alias :get_x :get_width
7
+ alias :x :get_width
8
+ alias :get_y :get_height
9
+ alias :y :get_height
10
+
2
11
  # More informative output for inspect etc
3
12
  def to_s
4
13
  "#<Wx::Size: #{width}x#{height}>"
@@ -14,24 +23,28 @@ class Wx::Size
14
23
  end
15
24
 
16
25
  # Compare with another size value
17
- def ==(other)
26
+ def <=>(other)
18
27
  if Wx::Size === other
19
- width == other.width and height == other.height
28
+ (width*height) <=> (other.width*other.height)
20
29
  elsif Array === other and other.size == 2
21
- to_ary == other
30
+ (width*height) <=> (other.first*other.last)
22
31
  else
23
- Kernel.raise TypeError, "Cannot compare Size to #{other}"
32
+ nil
24
33
  end
25
34
  end
26
35
 
27
36
  def eql?(other)
28
- if Wx::Size === other
37
+ if other.instance_of?(self.class)
29
38
  width == other.width and height == other.height
30
39
  else
31
40
  false
32
41
  end
33
42
  end
34
43
 
44
+ def hash
45
+ to_ary.hash
46
+ end
47
+
35
48
  # Return a new Wx::Size with the width and height values both divided
36
49
  # by parameter +num+, which should be a Numeric
37
50
  def /(num)
@@ -83,4 +96,18 @@ class Wx::Size
83
96
  end
84
97
  end
85
98
  end
99
+
100
+ def dup
101
+ Wx::Size.new(self.width, self.height)
102
+ end
103
+
104
+ def to_size
105
+ self
106
+ end
107
+
108
+ def assign(sz)
109
+ self.width = sz.width
110
+ self.height = sz.height
111
+ self
112
+ end
86
113
  end
@@ -53,43 +53,20 @@ class Wx::Window
53
53
  def evt_paint(meth = nil, &block)
54
54
  paint_proc = acquire_handler(meth, block)
55
55
  wrapped_block = proc do | event |
56
- instance_variable_set("@__painting__", true)
56
+ instance_variable_set('@__painting__', true)
57
57
  paint_proc.call(event)
58
- remove_instance_variable("@__painting__")
58
+ remove_instance_variable('@__painting__')
59
59
  end
60
60
  __old_evt_paint(&wrapped_block)
61
61
  end
62
62
 
63
- # Provides bufferd drawing facility to reduce flicker for complex
64
- # drawing commands. Works similar to BufferedDC and BufferedPaintDC in
65
- # the wxWidgets API, by doing drawing on an in-memory Bitmap, then
66
- # copying the result in bulk to the screen.
67
- #
68
- # The method may be passed an existing Wx::Bitmap as the +buffer+,
69
- # otherwise one will be created.
70
- #
71
- # Works like wxAutoBufferedDC in that additional buffering will only
72
- # be done on platforms that do not already natively support buffering
73
- # for the standard PaintDC / ClientDC - Windows, in particular.
74
- def paint_buffered(buffer = nil)
75
- # OS X and GTK do double-buffering natively
76
- if self.double_buffered?
77
- paint { | dc | yield dc }
63
+ # Overload the wrapper method to check for @__painting__
64
+ wx_paint_buffered = instance_method :paint_buffered
65
+ define_method :paint_buffered do |&block|
66
+ if instance_variable_defined?('@__painting__')
67
+ wx_paint_buffered.bind(self).call(&block)
78
68
  else
79
- # client_size is the window area available for drawing upon
80
- c_size = client_size
81
- # Create an in-memory buffer if none supplied
82
- buffer ||= Wx::Bitmap.new(c_size.width, c_size.height)
83
- buffer.draw do | mem_dc |
84
- mem_dc.background = Wx::TRANSPARENT_BRUSH
85
- mem_dc.clear
86
- # Yield the bitmap for the user code to draw upon
87
- yield mem_dc
88
- paint do | dc |
89
- # Copy the buffer to the window
90
- dc.blit(0, 0, c_size.width, c_size.height, mem_dc, 0, 0)
91
- end
92
- end
69
+ self.paint(&block)
93
70
  end
94
71
  end
95
72
  end
@@ -0,0 +1,27 @@
1
+
2
+ module Wx
3
+
4
+ # Mixin module providing Array extensions.
5
+ module ArrayExt
6
+
7
+ # Returns a new Wx::Size instance created from the first two elements of the array.
8
+ # Any missing element will be supplemented by a Wx::DEFAULT_COORD value.
9
+ # The array is not altered.
10
+ # @return [Wx::Size]
11
+ def to_size; end
12
+
13
+ # Returns a new Wx::Point instance created from the first two elements of the array.
14
+ # Any missing element will be supplemented by a Wx::DEFAULT_COORD value.
15
+ # The array is not altered.
16
+ # @return [Wx::Point]
17
+ def to_point; end
18
+
19
+ # Returns a new Wx::RealPoint instance created from the first two elements of the array.
20
+ # Any missing element will be supplemented by a Wx::DEFAULT_COORD value.
21
+ # The array is not altered.
22
+ # @return [Wx::RealPoint]
23
+ def to_real_point; end
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,57 @@
1
+
2
+
3
+ # This module provides and standardizes support for locating application art files.
4
+ #
5
+ module Wx::ArtLocator
6
+
7
+ # Default name of art folder.
8
+ ART_FOLDER = 'art'
9
+
10
+ class << self
11
+
12
+ # Returns the base name for the folder holding application art files.
13
+ # By default this returns ART_FOLDER
14
+ # @return [String]
15
+ def art_folder; end
16
+
17
+ # Sets the base name for the folder holding application art files.
18
+ # @param [String] name art folder base name
19
+ def art_folder=(name) end
20
+
21
+ # Adds one or more search paths to look for art files.
22
+ # By default ArtLocator#find_art will look only at locations of the caller's
23
+ # file path. If search paths have been added though these will be searched
24
+ # after the lookup in the caller's path has failed.
25
+ def add_search_path(*names) end
26
+ alias :add_search_paths :add_search_path
27
+
28
+ # Searches for the an art file for the given 'art_name'.
29
+ # By default the search will be performed at the following locations (in order):
30
+ # 1. <art_path>/<#art_folder>/<art_section>/<art_type>/
31
+ # 2. <art_path>/<#art_folder>/<art_section>/
32
+ # 3. <art_path>/<#art_folder>/
33
+ # 4. <art_path>/
34
+ # Where 'art_type' is any of <code>:icon</code>, <code>:bitmap</code>, <code>:cursor</code>,
35
+ # <code>:image</code> or <code>nil</code>. If 'art_type' is nil the first location will be skipped.
36
+ # In case 'art_path' == <code>nil</code> the absolute path to the folder holding the caller's
37
+ # code will be used which is determined through ::Kernel#caller_locations.
38
+ # If 'art_section' is also <code>nil</code> the basename of the caller's source file will be used.
39
+ # At each location the existence of a file with base name 'art_name' and each of the supported
40
+ # extensions for the given 'art_type' (see wxWidgets documentation) will be tested. If 'art_type' is nil
41
+ # all extensions for all supported bitmap types will be tested (similar to when 'art_type' is :image).
42
+ # If an optional Wx::BitmapType is specified through 'bmp_type' the tested extensions will
43
+ # be restricted to the extensions supported for specified the bitmap type.
44
+ #
45
+ # In case additional search paths have been specified through #add_search_path these will be
46
+ # searched after the lookup at 'art_path' fails. For each search path the same lookups
47
+ # will be performed (replacing 'art_path' by the search path).
48
+ # @param [String,Symbol] art_name base name for art file
49
+ # @param [Symbol,nil] art_type type of art to look for (:icon, :bitmap, :cursor, :image)
50
+ # @param [String,nil] art_path base path to look up the art file
51
+ # @param [String,nil] art_section optional owner folder name for art files
52
+ # @param [Wx::BitmapType,nil] bmp_type bitmap type of art file
53
+ def find_art(art_name, art_type: nil, art_path: nil, art_section: nil, bmp_type: nil) end
54
+
55
+ end
56
+
57
+ end
@@ -0,0 +1,27 @@
1
+
2
+ module Wx
3
+
4
+ # Default BitmapType for current platform. Actual value is platform dependent.
5
+ ICON_DEFAULT_TYPE = Wx::BitmapType::BITMAP_TYPE_ANY
6
+ # Default BitmapType for current platform. Actual value is platform dependent.
7
+ BITMAP_DEFAULT_TYPE = Wx::BitmapType::BITMAP_TYPE_ANY
8
+ # Default BitmapType for current platform. Actual value is platform dependent.
9
+ CURSOR_DEFAULT_TYPE = Wx::BitmapType::BITMAP_TYPE_ANY
10
+
11
+ class Bitmap
12
+
13
+ # Searches for an art file with basename 'name' and creates a Bitmap if found.
14
+ # Raises an ArgumentError if not found.
15
+ # Wx::ArtLocator::find_art is used to look up the art file using ::Kernel#caller_locations to
16
+ # determine the values for the 'art_path' and 'art_owner' arguments ('art_path' is set to the
17
+ # absolute path to the folder holding the caller's code and 'art_owner' to the basename of the
18
+ # caller's source file). The 'art_type' argument is set to <code>:icon</code>.
19
+ # @param [String,Symbol] name base name of art file
20
+ # @param [Wx::BitmapType,nil] bmp_type bitmap type for art file (nil means any supported type)
21
+ # @return [Wx::Bitmap]
22
+ # @see Wx::ArtLocator::find_art
23
+ def self.Bitmap(name, bmp_type = nil); end
24
+
25
+ end
26
+
27
+ end
@@ -0,0 +1,12 @@
1
+
2
+ class Wx::Clipboard
3
+
4
+ alias :place :set_data
5
+ alias :fetch :get_data
6
+
7
+ # Opens the global clipboard and passes the clipboard object to the block.
8
+ # @yieldparam [Wx::Clipboard] clip the global clipboard object
9
+ # @return [Object] block result
10
+ def self.open; end
11
+
12
+ end