wxruby3 0.9.0.pre.beta.11-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.
- checksums.yaml +4 -4
- data/INSTALL.md +85 -0
- data/README.md +2 -0
- data/assets/logo.png +0 -0
- data/assets/logo.svg +170 -0
- data/assets/logo.xcf +0 -0
- data/ext/wxbase32u_gcc_custom.dll +0 -0
- data/ext/wxbase32u_net_gcc_custom.dll +0 -0
- data/ext/wxbase32u_xml_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_aui_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_core_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_gl_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_html_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_media_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_propgrid_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_qa_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_ribbon_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_richtext_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_stc_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_webview_gcc_custom.dll +0 -0
- data/ext/wxmsw32u_xrc_gcc_custom.dll +0 -0
- data/lib/wx/core/array_ext.rb +26 -0
- data/lib/wx/core/art_locator.rb +92 -0
- data/lib/wx/core/artprovider.rb +1 -1
- data/lib/wx/core/bitmap.rb +90 -53
- data/lib/wx/core/cursor.rb +12 -0
- data/lib/wx/core/dataformat.rb +3 -1
- data/lib/wx/core/dc.rb +76 -52
- data/lib/wx/core/enum.rb +4 -0
- data/lib/wx/core/event.rb +38 -5
- data/lib/wx/core/events/evt_list.rb +3 -2
- data/lib/wx/core/evthandler.rb +64 -23
- data/lib/wx/core/icon.rb +50 -35
- data/lib/wx/core/id_helper.rb +32 -0
- data/lib/wx/core/image.rb +63 -53
- data/lib/wx/core/point.rb +14 -0
- data/lib/wx/core/real_point.rb +15 -1
- data/lib/wx/core/rect.rb +42 -7
- data/lib/wx/core/region_iterator.rb +37 -0
- data/lib/wx/core/size.rb +20 -0
- data/lib/wx/core/window.rb +8 -31
- data/lib/wx/doc/array_ext.rb +27 -0
- data/lib/wx/doc/art_locator.rb +57 -0
- data/lib/wx/doc/bitmap.rb +27 -0
- data/lib/wx/doc/clipboard.rb +12 -0
- data/lib/wx/doc/const.rb +77 -0
- data/lib/wx/doc/cursor.rb +16 -0
- data/lib/wx/doc/data_object.rb +1 -2
- data/lib/wx/doc/dc.rb +63 -46
- data/lib/wx/doc/event.rb +24 -0
- data/lib/wx/doc/events.rb +14 -0
- data/lib/wx/doc/evthandler.rb +24 -3
- data/lib/wx/doc/extra/00_starting.md +1 -1
- data/lib/wx/doc/extra/06_geometry.md +10 -4
- data/lib/wx/doc/extra/10_art.md +105 -0
- data/lib/wx/doc/gc_dc.rb +21 -0
- data/lib/wx/doc/gdi_common.rb +122 -1
- data/lib/wx/doc/gen/about_dialog_info.rb +1 -4
- data/lib/wx/doc/gen/animation.rb +3 -3
- data/lib/wx/doc/gen/animation_ctrl.rb +4 -4
- data/lib/wx/doc/gen/any_button.rb +1 -1
- data/lib/wx/doc/gen/aui/aui_floating_frame.rb +1 -1
- data/lib/wx/doc/gen/aui/aui_manager.rb +2 -2
- data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +3 -3
- data/lib/wx/doc/gen/aui/aui_mdi_parent_frame.rb +3 -3
- data/lib/wx/doc/gen/aui/aui_notebook.rb +2 -2
- data/lib/wx/doc/gen/aui/aui_tool_bar.rb +6 -6
- data/lib/wx/doc/gen/bitmap.rb +1 -1
- data/lib/wx/doc/gen/bitmap_button.rb +2 -2
- data/lib/wx/doc/gen/book_ctrl_base.rb +4 -4
- data/lib/wx/doc/gen/brush.rb +1 -1
- data/lib/wx/doc/gen/button.rb +2 -2
- data/lib/wx/doc/gen/calendar_ctrl.rb +3 -3
- data/lib/wx/doc/gen/calendar_date_attr.rb +1 -1
- data/lib/wx/doc/gen/check_box.rb +2 -2
- data/lib/wx/doc/gen/check_list_box.rb +3 -3
- data/lib/wx/doc/gen/choice.rb +2 -2
- data/lib/wx/doc/gen/choicebook.rb +2 -2
- data/lib/wx/doc/gen/collapsible_pane.rb +2 -2
- data/lib/wx/doc/gen/colour.rb +1 -3
- data/lib/wx/doc/gen/colour_dialog.rb +1 -2
- data/lib/wx/doc/gen/colour_picker_ctrl.rb +2 -2
- data/lib/wx/doc/gen/combo_box.rb +4 -4
- data/lib/wx/doc/gen/context_help_button.rb +1 -1
- data/lib/wx/doc/gen/control.rb +3 -3
- data/lib/wx/doc/gen/core.rb +2 -2
- data/lib/wx/doc/gen/data_format.rb +1 -1
- data/lib/wx/doc/gen/data_object.rb +6 -6
- data/lib/wx/doc/gen/date_picker_ctrl.rb +2 -2
- data/lib/wx/doc/gen/dc.rb +9 -9
- data/lib/wx/doc/gen/defs.rb +0 -4
- data/lib/wx/doc/gen/dialog.rb +3 -3
- data/lib/wx/doc/gen/dir_dialog.rb +2 -4
- data/lib/wx/doc/gen/dir_filter_list_ctrl.rb +2 -2
- data/lib/wx/doc/gen/dir_picker_ctrl.rb +2 -2
- data/lib/wx/doc/gen/drag_drop.rb +13 -1
- data/lib/wx/doc/gen/editable_list_box.rb +2 -2
- data/lib/wx/doc/gen/event.rb +0 -1
- data/lib/wx/doc/gen/event_list.rb +18 -16
- data/lib/wx/doc/gen/events.rb +87 -2
- data/lib/wx/doc/gen/ext_help_controller.rb +2 -2
- data/lib/wx/doc/gen/file_dialog.rb +1 -1
- data/lib/wx/doc/gen/file_picker_ctrl.rb +2 -2
- data/lib/wx/doc/gen/font.rb +6 -6
- data/lib/wx/doc/gen/font_dialog.rb +1 -2
- data/lib/wx/doc/gen/font_picker_ctrl.rb +2 -2
- data/lib/wx/doc/gen/frame.rb +5 -5
- data/lib/wx/doc/gen/fs_file.rb +2 -2
- data/lib/wx/doc/gen/gauge.rb +2 -2
- data/lib/wx/doc/gen/gdi_common.rb +18 -21
- data/lib/wx/doc/gen/generic_dir_ctrl.rb +2 -2
- data/lib/wx/doc/gen/graphics_context.rb +4 -4
- data/lib/wx/doc/gen/graphics_object.rb +2 -2
- data/lib/wx/doc/gen/grid/grid_cell_bool_editor.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_cell_date_time_renderer.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_cell_enum_editor.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_cell_enum_renderer.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_cell_float_editor.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_cell_float_renderer.rb +1 -1
- data/lib/wx/doc/gen/grid/grid_ctrl.rb +7 -7
- data/lib/wx/doc/gen/help_controller.rb +1 -1
- data/lib/wx/doc/gen/html/html_cell.rb +4 -4
- data/lib/wx/doc/gen/html/html_easy_printing.rb +6 -6
- data/lib/wx/doc/gen/html/html_help_controller.rb +6 -6
- data/lib/wx/doc/gen/html/html_help_frame.rb +2 -2
- data/lib/wx/doc/gen/html/html_help_window.rb +6 -6
- data/lib/wx/doc/gen/html/html_list_box.rb +6 -6
- data/lib/wx/doc/gen/html/html_printout.rb +4 -4
- data/lib/wx/doc/gen/html/html_window.rb +4 -4
- data/lib/wx/doc/gen/icon.rb +6 -6
- data/lib/wx/doc/gen/image.rb +7 -7
- data/lib/wx/doc/gen/list_box.rb +4 -4
- data/lib/wx/doc/gen/list_ctrl.rb +5 -5
- data/lib/wx/doc/gen/listbook.rb +2 -2
- data/lib/wx/doc/gen/locale.rb +8 -8
- data/lib/wx/doc/gen/log.rb +2 -2
- data/lib/wx/doc/gen/mdi_frame.rb +5 -5
- data/lib/wx/doc/gen/media_ctrl.rb +4 -4
- data/lib/wx/doc/gen/menu.rb +12 -12
- data/lib/wx/doc/gen/menu_item.rb +1 -1
- data/lib/wx/doc/gen/message_dialog.rb +2 -4
- data/lib/wx/doc/gen/mini_frame.rb +2 -2
- data/lib/wx/doc/gen/notebook.rb +3 -3
- data/lib/wx/doc/gen/number_entry_dialog.rb +0 -1
- data/lib/wx/doc/gen/object.rb +0 -1
- data/lib/wx/doc/gen/panel.rb +2 -2
- data/lib/wx/doc/gen/pen.rb +2 -2
- data/lib/wx/doc/gen/pg/pg_array_editor_dialog.rb +1 -1
- data/lib/wx/doc/gen/pg/pg_cell.rb +1 -1
- data/lib/wx/doc/gen/pg/pg_properties.rb +20 -20
- data/lib/wx/doc/gen/pg/pg_property.rb +12 -12
- data/lib/wx/doc/gen/pg/property_grid.rb +3 -3
- data/lib/wx/doc/gen/pg/property_grid_interface.rb +14 -14
- data/lib/wx/doc/gen/pg/property_grid_manager.rb +3 -3
- data/lib/wx/doc/gen/pg/property_grid_page.rb +2 -2
- data/lib/wx/doc/gen/pg/property_grid_page_state.rb +2 -2
- data/lib/wx/doc/gen/popup_window.rb +3 -3
- data/lib/wx/doc/gen/property_sheet_dialog.rb +3 -3
- data/lib/wx/doc/gen/prt/print_abort_dialog.rb +1 -1
- data/lib/wx/doc/gen/prt/printer.rb +1 -1
- data/lib/wx/doc/gen/radio_box.rb +4 -4
- data/lib/wx/doc/gen/radio_button.rb +2 -2
- data/lib/wx/doc/gen/rbn/ribbon_bar.rb +2 -2
- data/lib/wx/doc/gen/rbn/ribbon_button_bar.rb +12 -12
- data/lib/wx/doc/gen/rbn/ribbon_control.rb +1 -1
- data/lib/wx/doc/gen/rbn/ribbon_gallery.rb +2 -2
- data/lib/wx/doc/gen/rbn/ribbon_page.rb +2 -2
- data/lib/wx/doc/gen/rbn/ribbon_panel.rb +2 -2
- data/lib/wx/doc/gen/rbn/ribbon_tool_bar.rb +11 -11
- data/lib/wx/doc/gen/region.rb +1 -1
- data/lib/wx/doc/gen/region_iterator.rb +76 -0
- data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +10 -10
- data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +19 -19
- data/lib/wx/doc/gen/rtc/rich_text_file_handler.rb +2 -2
- data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +4 -4
- data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +1 -1
- data/lib/wx/doc/gen/rtc/rich_text_printing.rb +6 -6
- data/lib/wx/doc/gen/rtc/rich_text_xml_handler.rb +1 -1
- data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +2 -2
- data/lib/wx/doc/gen/sash_event.rb +1 -1
- data/lib/wx/doc/gen/sash_layout_window.rb +2 -2
- data/lib/wx/doc/gen/sash_window.rb +1 -1
- data/lib/wx/doc/gen/scroll_bar.rb +150 -0
- data/lib/wx/doc/gen/scrolled_canvas.rb +2 -2
- data/lib/wx/doc/gen/scrolled_control.rb +2 -2
- data/lib/wx/doc/gen/scrolled_window.rb +2 -2
- data/lib/wx/doc/gen/simplebook.rb +2 -2
- data/lib/wx/doc/gen/sizer.rb +3 -3
- data/lib/wx/doc/gen/slider.rb +2 -2
- data/lib/wx/doc/gen/spin_button.rb +2 -2
- data/lib/wx/doc/gen/spin_ctrl.rb +2 -2
- data/lib/wx/doc/gen/splash_screen.rb +1 -1
- data/lib/wx/doc/gen/splitter_window.rb +2 -2
- data/lib/wx/doc/gen/static_bitmap.rb +2 -2
- data/lib/wx/doc/gen/static_box.rb +4 -4
- data/lib/wx/doc/gen/static_box_sizer.rb +1 -1
- data/lib/wx/doc/gen/static_line.rb +2 -2
- data/lib/wx/doc/gen/static_text.rb +2 -2
- data/lib/wx/doc/gen/status_bar.rb +2 -2
- data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +3 -3
- data/lib/wx/doc/gen/task_bar_icon.rb +2 -2
- data/lib/wx/doc/gen/text_attr.rb +3 -3
- data/lib/wx/doc/gen/text_ctrl.rb +3 -3
- data/lib/wx/doc/gen/text_entry_dialog.rb +6 -8
- data/lib/wx/doc/gen/text_validator.rb +1 -1
- data/lib/wx/doc/gen/time_picker_ctrl.rb +2 -2
- data/lib/wx/doc/gen/tip_provider.rb +1 -3
- data/lib/wx/doc/gen/toggle_button.rb +2 -2
- data/lib/wx/doc/gen/tool_bar.rb +10 -10
- data/lib/wx/doc/gen/toolbook.rb +2 -2
- data/lib/wx/doc/gen/top_level_window.rb +4 -4
- data/lib/wx/doc/gen/tree_ctrl.rb +4 -4
- data/lib/wx/doc/gen/treebook.rb +2 -2
- data/lib/wx/doc/gen/utils.rb +5 -42
- data/lib/wx/doc/gen/v_list_box.rb +2 -2
- data/lib/wx/doc/gen/v_scrolled_window.rb +2 -2
- data/lib/wx/doc/gen/variant.rb +10 -10
- data/lib/wx/doc/gen/window.rb +9 -14
- data/lib/wx/doc/gen/wizard.rb +2 -2
- data/lib/wx/doc/gen/wizard_event.rb +1 -1
- data/lib/wx/doc/gen/xml_node.rb +2 -2
- data/lib/wx/doc/gen/xml_resource.rb +3 -3
- data/lib/wx/doc/graphics_context.rb +42 -0
- data/lib/wx/doc/icon.rb +18 -0
- data/lib/wx/doc/id_helper.rb +25 -0
- data/lib/wx/doc/image.rb +33 -0
- data/lib/wx/doc/region_iterator.rb +31 -0
- data/lib/wx/doc/scaled_dc.rb +1 -0
- data/lib/wx/doc/window.rb +18 -0
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/cmd/sampler.rb +3 -21
- data/lib/wxruby_aui.so +0 -0
- data/lib/wxruby_core.so +0 -0
- data/lib/wxruby_grid.so +0 -0
- data/lib/wxruby_html.so +0 -0
- data/lib/wxruby_pg.so +0 -0
- data/lib/wxruby_prt.so +0 -0
- data/lib/wxruby_rbn.so +0 -0
- data/lib/wxruby_rtc.so +0 -0
- data/lib/wxruby_stc.so +0 -0
- data/rakelib/lib/config.rb +4 -4
- data/samples/art/wxruby-128x128.png +0 -0
- data/samples/art/wxruby-256x256.png +0 -0
- data/samples/art/wxruby-64x64.png +0 -0
- data/samples/art/wxruby.ico +0 -0
- data/samples/art/wxruby.png +0 -0
- data/samples/drawing/graphics_drawing.rb +1 -2
- data/samples/propgrid/propgrid.rb +65 -65
- data/samples/sample.xpm +246 -470
- data/samples/treectrl/treectrl.rb +1 -1
- data/tests/art/my_art/sample.xpm +251 -0
- data/tests/art/sample3.xpm +251 -0
- data/tests/art/test_art/bitmap/sample.xpm +251 -0
- data/tests/art/test_art/bitmap/wxruby.bmp +0 -0
- data/tests/art/test_art/bitmap/wxruby.png +0 -0
- data/tests/art/test_art/bitmap/wxruby.xpm +251 -0
- data/tests/art/test_art/cursor/wxruby.bmp +0 -0
- data/tests/art/test_art/icon/sample.xpm +251 -0
- data/tests/art/test_art/icon/wxruby.ico +0 -0
- data/tests/art/test_art/icon/wxruby.png +0 -0
- data/tests/art/test_art/image/sample.xpm +251 -0
- data/tests/art/test_art/image/wxruby.jpg +0 -0
- data/tests/art/test_art/image/wxruby.png +0 -0
- data/tests/art/test_art/sample2.xpm +251 -0
- data/tests/test_art.rb +91 -0
- data/tests/test_clipboard.rb +35 -0
- data/tests/test_dc.rb +70 -0
- data/tests/test_events.rb +12 -0
- data/tests/test_geometry.rb +13 -0
- metadata +48 -5
data/lib/wx/core/dc.rb
CHANGED
@@ -1,68 +1,92 @@
|
|
1
|
-
# Class for drawing primitives and bitmaps on various outputs (screen, paper)
|
2
|
-
class Wx::DC
|
3
|
-
# provide Ruby-style convenience methods supporting wxDCxxxChanger-like functionality
|
4
1
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
2
|
+
module Wx
|
3
|
+
# Class for drawing primitives and bitmaps on various outputs (screen, paper)
|
4
|
+
class DC
|
5
|
+
# provide Ruby-style convenience methods supporting wxDCxxxChanger-like functionality
|
6
|
+
|
7
|
+
def with_brush(brush)
|
8
|
+
begin
|
9
|
+
old_brush = self.brush
|
10
|
+
self.brush = brush
|
11
|
+
yield(self) if block_given?
|
12
|
+
ensure
|
13
|
+
self.brush = old_brush
|
14
|
+
end
|
12
15
|
end
|
13
|
-
end
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
17
|
+
def with_pen(pen)
|
18
|
+
begin
|
19
|
+
old_pen = self.pen
|
20
|
+
self.pen = pen
|
21
|
+
yield(self) if block_given?
|
22
|
+
ensure
|
23
|
+
self.pen = old_pen
|
24
|
+
end
|
22
25
|
end
|
23
|
-
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
27
|
+
def with_font(font)
|
28
|
+
begin
|
29
|
+
old_font = self.font
|
30
|
+
self.font = font
|
31
|
+
yield(self) if block_given?
|
32
|
+
ensure
|
33
|
+
self.font = old_font
|
34
|
+
end
|
32
35
|
end
|
33
|
-
end
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
37
|
+
def with_text_foreground(clr)
|
38
|
+
begin
|
39
|
+
old = self.get_text_foreground
|
40
|
+
self.text_foreground = clr
|
41
|
+
yield(self) if block_given?
|
42
|
+
ensure
|
43
|
+
self.text_foreground = old
|
44
|
+
end
|
42
45
|
end
|
43
|
-
|
44
|
-
alias :with_text_fg :with_text_foreground
|
46
|
+
alias :with_text_fg :with_text_foreground
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
def with_text_background(clr)
|
49
|
+
begin
|
50
|
+
old = self.get_text_background
|
51
|
+
self.text_background = clr
|
52
|
+
yield(self) if block_given?
|
53
|
+
ensure
|
54
|
+
self.text_background = old
|
55
|
+
end
|
53
56
|
end
|
57
|
+
alias :with_text_bg :with_text_background
|
58
|
+
|
59
|
+
def with_background_mode(mode)
|
60
|
+
begin
|
61
|
+
old = self.get_background_mode
|
62
|
+
self.background_mode = mode
|
63
|
+
yield(self) if block_given?
|
64
|
+
ensure
|
65
|
+
self.background_mode = old
|
66
|
+
end
|
67
|
+
end
|
68
|
+
alias :with_bg_mode :with_background_mode
|
69
|
+
|
54
70
|
end
|
55
|
-
alias :with_text_bg :with_text_background
|
56
71
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
72
|
+
class MemoryDC
|
73
|
+
|
74
|
+
# convenience method for drawing on a temporary memory DC
|
75
|
+
def self.draw_on(arg)
|
76
|
+
dc = case arg
|
77
|
+
when Wx::Bitmap, Wx::DC
|
78
|
+
self.new(arg)
|
79
|
+
else
|
80
|
+
::Kernel.raise ArgumentError, 'Expected Wx::Bitmap or Wx::DC'
|
81
|
+
end
|
82
|
+
begin
|
83
|
+
yield(dc) if block_given?
|
84
|
+
ensure
|
85
|
+
dc.select_object(Wx::NULL_BITMAP)
|
86
|
+
end
|
87
|
+
nil
|
64
88
|
end
|
89
|
+
|
65
90
|
end
|
66
|
-
alias :with_bg_mode :with_background_mode
|
67
91
|
|
68
92
|
end
|
data/lib/wx/core/enum.rb
CHANGED
data/lib/wx/core/event.rb
CHANGED
@@ -1,10 +1,43 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# Get the Wx id, not Ruby's deprecated Object#id
|
4
|
-
alias :id :get_id
|
5
|
-
end
|
1
|
+
|
2
|
+
require_relative './evthandler'
|
6
3
|
|
7
4
|
module Wx
|
5
|
+
|
6
|
+
# Base class for all events
|
7
|
+
class Event
|
8
|
+
|
9
|
+
# overload the #initialize method to add a check on a
|
10
|
+
# correct match between EventType and event class
|
11
|
+
wx_init = self.instance_method(:initialize)
|
12
|
+
define_method :initialize do |evt_type = Wx::EVT_NULL, *rest|
|
13
|
+
evt_klass = Wx::EvtHandler.event_class_for_type(evt_type)
|
14
|
+
if evt_klass >= self.class
|
15
|
+
wx_init.bind(self).call(evt_type, *rest)
|
16
|
+
else
|
17
|
+
::Kernel.raise ArgumentError, "Invalid event type #{Wx::EvtHandler.event_name_for_type(evt_type)}:#{evt_type} for class #{self.class}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# Get the Wx id, not Ruby's deprecated Object#id
|
22
|
+
alias :id :get_id
|
23
|
+
end
|
24
|
+
|
25
|
+
class Wx::CommandEvent
|
26
|
+
|
27
|
+
# overload the #initialize method to add a check on a
|
28
|
+
# correct match between EventType and event class
|
29
|
+
wx_init = self.instance_method(:initialize)
|
30
|
+
define_method :initialize do |evt_type = Wx::EVT_NULL, *rest|
|
31
|
+
evt_klass = Wx::EvtHandler.event_class_for_type(evt_type)
|
32
|
+
if evt_klass >= self.class
|
33
|
+
wx_init.bind(self).call(evt_type, *rest)
|
34
|
+
else
|
35
|
+
::Kernel.raise ArgumentError, "Invalid event type #{Wx::EvtHandler.event_name_for_type(evt_type)}:#{evt_type} for class #{self.class}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
8
41
|
# reduce mapping warnings for this unpublished event class
|
9
42
|
NcPaintEvent = Wx::Event
|
10
43
|
|
@@ -103,12 +103,12 @@ class Wx::EvtHandler
|
|
103
103
|
Wx::ScrollEvent
|
104
104
|
] if Wx.const_defined?(:EVT_COMMAND_SCROLL_THUMBTRACK)
|
105
105
|
self.register_event_type EventType[
|
106
|
-
'evt_command_scroll_thumbrelease',
|
106
|
+
'evt_command_scroll_thumbrelease', 1,
|
107
107
|
Wx::EVT_COMMAND_SCROLL_THUMBRELEASE,
|
108
108
|
Wx::ScrollEvent
|
109
109
|
] if Wx.const_defined?(:EVT_COMMAND_SCROLL_THUMBRELEASE)
|
110
110
|
self.register_event_type EventType[
|
111
|
-
'evt_command_scroll_changed',
|
111
|
+
'evt_command_scroll_changed', 1,
|
112
112
|
Wx::EVT_COMMAND_SCROLL_CHANGED,
|
113
113
|
Wx::ScrollEvent
|
114
114
|
] if Wx.const_defined?(:EVT_COMMAND_SCROLL_CHANGED)
|
@@ -1197,6 +1197,7 @@ class Wx::EvtHandler
|
|
1197
1197
|
# from wxChoice
|
1198
1198
|
# from wxCollapsiblePane
|
1199
1199
|
# from wxSlider
|
1200
|
+
# from wxScrollBar
|
1200
1201
|
# from wxSpinButton
|
1201
1202
|
# from wxSpinCtrl
|
1202
1203
|
self.register_event_type EventType[
|
data/lib/wx/core/evthandler.rb
CHANGED
@@ -195,32 +195,73 @@ class Wx::EvtHandler
|
|
195
195
|
end
|
196
196
|
|
197
197
|
# Convenience evt_handler to listen to all mouse events.
|
198
|
-
def evt_mouse_events(&block)
|
199
|
-
evt_left_down(&block)
|
200
|
-
evt_left_up(&block)
|
201
|
-
evt_middle_down(&block)
|
202
|
-
evt_middle_up(&block)
|
203
|
-
evt_right_down(&block)
|
204
|
-
evt_right_up(&block)
|
205
|
-
evt_motion(&block)
|
206
|
-
evt_left_dclick(&block)
|
207
|
-
evt_middle_dclick(&block)
|
208
|
-
evt_right_dclick(&block)
|
209
|
-
evt_leave_window(&block)
|
210
|
-
evt_enter_window(&block)
|
211
|
-
evt_mousewheel(&block)
|
198
|
+
def evt_mouse_events(*args, &block)
|
199
|
+
evt_left_down(*args, &block)
|
200
|
+
evt_left_up(*args, &block)
|
201
|
+
evt_middle_down(*args, &block)
|
202
|
+
evt_middle_up(*args, &block)
|
203
|
+
evt_right_down(*args, &block)
|
204
|
+
evt_right_up(*args, &block)
|
205
|
+
evt_motion(*args, &block)
|
206
|
+
evt_left_dclick(*args, &block)
|
207
|
+
evt_middle_dclick(*args, &block)
|
208
|
+
evt_right_dclick(*args, &block)
|
209
|
+
evt_leave_window(*args, &block)
|
210
|
+
evt_enter_window(*args, &block)
|
211
|
+
evt_mousewheel(*args, &block)
|
212
212
|
end
|
213
213
|
|
214
214
|
# Convenience evt handler to listen to all scrollwin events.
|
215
|
-
def evt_scrollwin(&block)
|
216
|
-
evt_scrollwin_top(&block)
|
217
|
-
evt_scrollwin_bottom(&block)
|
218
|
-
evt_scrollwin_lineup(&block)
|
219
|
-
evt_scrollwin_linedown(&block)
|
220
|
-
evt_scrollwin_pageup(&block)
|
221
|
-
evt_scrollwin_pagedown(&block)
|
222
|
-
evt_scrollwin_thumbtrack(&block)
|
223
|
-
evt_scrollwin_thumbrelease(&block)
|
215
|
+
def evt_scrollwin(meth = nil, &block)
|
216
|
+
evt_scrollwin_top(meth, &block)
|
217
|
+
evt_scrollwin_bottom(meth, &block)
|
218
|
+
evt_scrollwin_lineup(meth, &block)
|
219
|
+
evt_scrollwin_linedown(meth, &block)
|
220
|
+
evt_scrollwin_pageup(meth, &block)
|
221
|
+
evt_scrollwin_pagedown(meth, &block)
|
222
|
+
evt_scrollwin_thumbtrack(meth, &block)
|
223
|
+
evt_scrollwin_thumbrelease(meth, &block)
|
224
|
+
end
|
225
|
+
|
226
|
+
# Convenience evt handler to listen to all scroll events (Wx::Slider and Wx::ScrollBar)
|
227
|
+
def evt_scroll(meth = nil, &block)
|
228
|
+
evt_scroll_top(meth, &block)
|
229
|
+
evt_scroll_bottom(meth, &block)
|
230
|
+
evt_scroll_lineup(meth, &block)
|
231
|
+
evt_scroll_linedown(meth, &block)
|
232
|
+
evt_scroll_pageup(meth, &block)
|
233
|
+
evt_scroll_pagedown(meth, &block)
|
234
|
+
evt_scroll_thumbtrack(meth, &block)
|
235
|
+
evt_scroll_thumbrelease(meth, &block)
|
236
|
+
evt_scroll_changed(meth, &block)
|
237
|
+
end
|
238
|
+
|
239
|
+
# Convenience evt handler to listen to all scroll command events.
|
240
|
+
def evt_command_scroll(id, meth = nil, &block)
|
241
|
+
evt_command_scroll_top(id, meth, &block)
|
242
|
+
evt_command_scroll_bottom(id, meth, &block)
|
243
|
+
evt_command_scroll_lineup(id, meth, &block)
|
244
|
+
evt_command_scroll_linedown(id, meth, &block)
|
245
|
+
evt_command_scroll_pageup(id, meth, &block)
|
246
|
+
evt_command_scroll_pagedown(id, meth, &block)
|
247
|
+
evt_command_scroll_thumbtrack(id, meth, &block)
|
248
|
+
evt_command_scroll_thumbrelease(id, meth, &block)
|
249
|
+
evt_command_scroll_changed(id, meth, &block)
|
250
|
+
end
|
251
|
+
|
252
|
+
# add missing constants (these are redefinitions of other constants which are not documented themselves)
|
253
|
+
%i[EVT_COMMAND_SCROLL_TOP
|
254
|
+
EVT_COMMAND_SCROLL_BOTTOM
|
255
|
+
EVT_COMMAND_SCROLL_LINEUP
|
256
|
+
EVT_COMMAND_SCROLL_LINEDOWN
|
257
|
+
EVT_COMMAND_SCROLL_PAGEUP
|
258
|
+
EVT_COMMAND_SCROLL_PAGEDOWN
|
259
|
+
EVT_COMMAND_SCROLL_THUMBTRACK
|
260
|
+
EVT_COMMAND_SCROLL_THUMBRELEASE
|
261
|
+
EVT_COMMAND_SCROLL_CHANGED].each do |const|
|
262
|
+
unless Wx.const_defined?(const)
|
263
|
+
Wx.const_set(const, Wx.const_get(const.to_s.sub('EVT_COMMAND_', 'EVT_').to_sym))
|
264
|
+
end
|
224
265
|
end
|
225
266
|
|
226
267
|
if Wx.const_defined?(:EVT_DESTROY)
|
data/lib/wx/core/icon.rb
CHANGED
@@ -1,46 +1,61 @@
|
|
1
1
|
# Specific type of platform-dependent image used for frames on Windows and
|
2
2
|
# Linux. Normally Bitmap is used
|
3
|
-
class Wx::Icon
|
4
|
-
# Load the type-guessing hash from Wx::Bitmap
|
5
|
-
require 'wx/core/bitmap'
|
6
|
-
BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
|
7
|
-
|
8
|
-
# Analogous to Image.from_bitmap
|
9
|
-
def self.from_bitmap(bmp)
|
10
|
-
ico = new
|
11
|
-
ico.copy_from_bitmap(bmp)
|
12
|
-
ico
|
13
|
-
end
|
14
3
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
bm = Wx::Bitmap.new
|
19
|
-
bm.copy_from_icon(self)
|
20
|
-
bm
|
21
|
-
end
|
4
|
+
require_relative './art_locator'
|
5
|
+
|
6
|
+
module Wx
|
22
7
|
|
23
|
-
|
24
|
-
|
25
|
-
|
8
|
+
class Icon
|
9
|
+
# Load the type-guessing hash from Wx::Bitmap
|
10
|
+
require 'wx/core/bitmap'
|
11
|
+
BITMAP_TYPE_GUESS = Wx::Bitmap::BITMAP_TYPE_GUESS
|
12
|
+
|
13
|
+
# Analogous to Image.from_bitmap
|
14
|
+
def self.from_bitmap(bmp)
|
15
|
+
ico = new
|
16
|
+
ico.copy_from_bitmap(bmp)
|
17
|
+
ico
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_bitmap
|
21
|
+
# for WXMSW platform Icon is not derived from Bitmap
|
22
|
+
return self unless Wx::PLATFORM == 'WXMSW' || Wx::PLATFORM == 'WXOSX'
|
23
|
+
bm = Wx::Bitmap.new
|
24
|
+
bm.copy_from_icon(self)
|
25
|
+
bm
|
26
26
|
end
|
27
|
-
end
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
# later. Also guess icon type from filename, if not specified.
|
33
|
-
wx_init = self.instance_method(:initialize)
|
34
|
-
define_method(:initialize) do | *args |
|
35
|
-
if args[0].kind_of? String
|
36
|
-
if not File.exist?( File.expand_path(args[0]) )
|
37
|
-
Kernel.raise(ArgumentError, "Icon file does not exist: #{args[0]}")
|
28
|
+
if Wx::PLATFORM == 'WXMSW' || Wx::PLATFORM == 'WXOSX'
|
29
|
+
def convert_to_image
|
30
|
+
to_bitmap.convert_to_image
|
38
31
|
end
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
end
|
33
|
+
|
34
|
+
# Redefine the initialize method so it raises an exception if a
|
35
|
+
# non-existent file is given to the constructor; otherwise, wx Widgets
|
36
|
+
# just carries on with an empty icon, which may cause faults
|
37
|
+
# later. Also guess icon type from filename, if not specified.
|
38
|
+
wx_init = self.instance_method(:initialize)
|
39
|
+
define_method(:initialize) do | *args |
|
40
|
+
if args[0].kind_of? String
|
41
|
+
if not File.exist?( File.expand_path(args[0]) )
|
42
|
+
Kernel.raise(ArgumentError, "Icon file does not exist: #{args[0]}")
|
43
|
+
end
|
44
|
+
# If type not specified, try to guess it from the file extension
|
45
|
+
if not args[1] and ( file_ext = args[0][/\w+$/] )
|
46
|
+
args[1] = BITMAP_TYPE_GUESS[file_ext.downcase]
|
47
|
+
end
|
42
48
|
end
|
49
|
+
wx_init.bind(self).call(*args)
|
43
50
|
end
|
44
|
-
wx_init.bind(self).call(*args)
|
45
51
|
end
|
52
|
+
|
53
|
+
def self.Icon(name, bmp_type = nil, *rest)
|
54
|
+
art_path = File.dirname(caller_path = caller_locations(1).first.absolute_path)
|
55
|
+
art_owner = File.basename(caller_path, '.*')
|
56
|
+
art_file = ArtLocator.find_art(name, art_type: :icon, art_path: art_path, art_section: art_owner, bmp_type: bmp_type)
|
57
|
+
::Kernel.raise ArgumentError, "Cannot locate art file for #{name}:Icon" unless art_file
|
58
|
+
Icon.new(art_file, bmp_type, *rest)
|
59
|
+
end
|
60
|
+
|
46
61
|
end
|
@@ -0,0 +1,32 @@
|
|
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
|
+
def self.included(base)
|
21
|
+
base.singleton_class.class_eval do
|
22
|
+
def next_id(offset = nil)
|
23
|
+
# set the offset if @next_id still unset or a user defined offset has been specified
|
24
|
+
@next_id = (offset || Wx::ID_HIGHEST) if @next_id.nil? || offset
|
25
|
+
@next_id += 1 # increment and return next id
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
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
|
-
|
3
|
+
module Wx
|
4
|
+
class Image
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
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
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
if
|
58
|
-
args[
|
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
|
-
|
65
|
-
|
66
|
-
|
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
@@ -100,4 +100,18 @@ class Wx::Point
|
|
100
100
|
Wx::RealPoint.new(self.x.to_f, self.y.to_f)
|
101
101
|
end
|
102
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
|
103
117
|
end
|
data/lib/wx/core/real_point.rb
CHANGED
@@ -96,8 +96,22 @@ class Wx::RealPoint
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
-
|
100
99
|
def to_point
|
101
100
|
Wx::Point.new(self.x.to_i, self.y.to_i)
|
102
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
|
+
|
103
117
|
end
|