wxruby3 0.9.0.pre.beta.14-x64-mingw-ucrt → 0.9.0.pre.rc.2-x64-mingw-ucrt
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +1 -0
- data/INSTALL.md +51 -22
- data/README.md +81 -6
- data/assets/hello_button-macos.png +0 -0
- data/assets/hello_button-msw.png +0 -0
- data/assets/hello_button.png +0 -0
- data/assets/hello_button_clicked-macos.png +0 -0
- data/assets/hello_button_clicked-msw.png +0 -0
- data/assets/hello_button_clicked.png +0 -0
- data/assets/hello_button_clicked_combi.png +0 -0
- data/assets/hello_world-macos.png +0 -0
- data/assets/hello_world-msw.png +0 -0
- data/assets/hello_world.png +0 -0
- data/assets/hello_world_combi.png +0 -0
- data/assets/repo-social-preview.png +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/art_locator.rb +2 -2
- data/lib/wx/core/artprovider.rb +2 -2
- data/lib/wx/core/bitmap.rb +6 -5
- data/lib/wx/core/bitmap_combobox.rb +34 -0
- data/lib/wx/core/brush.rb +6 -0
- data/lib/wx/core/controlwithitems.rb +52 -14
- data/lib/wx/core/cursor.rb +1 -1
- data/lib/wx/core/dc.rb +0 -20
- data/lib/wx/core/event_blocker.rb +14 -0
- data/lib/wx/core/events/evt_list.rb +19 -0
- data/lib/wx/core/evthandler.rb +48 -2
- data/lib/wx/core/find_replace_dialog.rb +24 -0
- data/lib/wx/core/font.rb +22 -14
- data/lib/wx/core/helpprovider.rb +2 -2
- data/lib/wx/core/icon.rb +1 -1
- data/lib/wx/core/image.rb +1 -1
- data/lib/wx/core/menu.rb +5 -0
- data/lib/wx/core/paintdc.rb +8 -0
- data/lib/wx/core/pen.rb +6 -0
- data/lib/wx/core/text_entry.rb +15 -0
- data/lib/wx/core/v_list_box.rb +13 -0
- data/lib/wx/core/window.rb +29 -2
- data/lib/wx/doc/app.rb +40 -0
- data/lib/wx/doc/brush.rb +17 -0
- data/lib/wx/doc/busy_info.rb +21 -0
- data/lib/wx/doc/client_dc.rb +28 -0
- data/lib/wx/doc/controlwithitems.rb +11 -0
- data/lib/wx/doc/dc.rb +0 -14
- data/lib/wx/doc/event_blocker.rb +27 -0
- data/lib/wx/doc/evthandler.rb +4 -0
- data/lib/wx/doc/extra/02_lifecycles.md +49 -0
- data/lib/wx/doc/extra/10_art.md +1 -1
- data/lib/wx/doc/extra/11_drawing_and_dc.md +62 -0
- data/lib/wx/doc/font.rb +27 -0
- data/lib/wx/doc/gen/about_dialog_info.rb +27 -24
- data/lib/wx/doc/gen/accelerator.rb +11 -12
- data/lib/wx/doc/gen/activity_indicator.rb +65 -0
- data/lib/wx/doc/gen/app.rb +6 -3
- data/lib/wx/doc/gen/art_provider.rb +53 -29
- data/lib/wx/doc/gen/aui/aui_manager.rb +4 -0
- data/lib/wx/doc/gen/aui/aui_mdi_child_frame.rb +1 -1
- data/lib/wx/doc/gen/aui/aui_pane_info.rb +2 -0
- data/lib/wx/doc/gen/aui/aui_tab_ctrl.rb +2 -0
- data/lib/wx/doc/gen/aui/aui_tool_bar.rb +2 -2
- data/lib/wx/doc/gen/bitmap.rb +25 -25
- data/lib/wx/doc/gen/bitmap_combo_box.rb +157 -0
- data/lib/wx/doc/gen/box_sizer.rb +6 -8
- data/lib/wx/doc/gen/brush.rb +2 -0
- data/lib/wx/doc/gen/busy_info.rb +52 -46
- data/lib/wx/doc/gen/caret.rb +0 -4
- data/lib/wx/doc/gen/check_list_box.rb +0 -2
- data/lib/wx/doc/gen/choice.rb +1 -5
- data/lib/wx/doc/gen/client_dc.rb +13 -18
- data/lib/wx/doc/gen/clipboard.rb +30 -27
- data/lib/wx/doc/gen/collapsible_pane.rb +11 -9
- data/lib/wx/doc/gen/colour.rb +6 -3
- data/lib/wx/doc/gen/colour_dialog.rb +111 -23
- data/lib/wx/doc/gen/combo_box.rb +2 -4
- data/lib/wx/doc/gen/context_help_button.rb +48 -0
- data/lib/wx/doc/gen/control.rb +20 -18
- data/lib/wx/doc/gen/core.rb +2 -2
- data/lib/wx/doc/gen/cursor.rb +18 -50
- data/lib/wx/doc/gen/data_format.rb +0 -2
- data/lib/wx/doc/gen/data_object.rb +37 -44
- data/lib/wx/doc/gen/dc.rb +16 -24
- data/lib/wx/doc/gen/defs.rb +3 -40
- data/lib/wx/doc/gen/dialog.rb +21 -17
- data/lib/wx/doc/gen/dir_dialog.rb +10 -8
- data/lib/wx/doc/gen/event.rb +2 -2
- data/lib/wx/doc/gen/event_blocker.rb +51 -0
- data/lib/wx/doc/gen/event_filter.rb +88 -0
- data/lib/wx/doc/gen/event_list.rb +23 -2
- data/lib/wx/doc/gen/events.rb +103 -112
- data/lib/wx/doc/gen/evt_handler.rb +28 -52
- data/lib/wx/doc/gen/file_dialog.rb +53 -50
- data/lib/wx/doc/gen/find_replace_dialog.rb +1 -1
- data/lib/wx/doc/gen/font.rb +19 -2
- data/lib/wx/doc/gen/font_data.rb +2 -0
- data/lib/wx/doc/gen/font_dialog.rb +1 -1
- data/lib/wx/doc/gen/frame.rb +4 -3
- data/lib/wx/doc/gen/fs_file.rb +8 -0
- data/lib/wx/doc/gen/gcdc.rb +2 -22
- data/lib/wx/doc/gen/gdi_common.rb +18 -2
- data/lib/wx/doc/gen/gdi_object.rb +2 -0
- data/lib/wx/doc/gen/graphics_context.rb +4 -43
- data/lib/wx/doc/gen/graphics_object.rb +2 -0
- data/lib/wx/doc/gen/grid/grid_cell_attr.rb +2 -1
- data/lib/wx/doc/gen/grid/grid_ctrl.rb +4 -2
- data/lib/wx/doc/gen/grid/grid_table_message.rb +2 -0
- data/lib/wx/doc/gen/grid_bag_sizer.rb +4 -0
- data/lib/wx/doc/gen/help_controller.rb +4 -1
- data/lib/wx/doc/gen/html/html_cell.rb +4 -1
- data/lib/wx/doc/gen/html/html_help_controller.rb +4 -1
- data/lib/wx/doc/gen/html/html_help_data.rb +4 -0
- data/lib/wx/doc/gen/html/html_help_window.rb +2 -1
- data/lib/wx/doc/gen/html/html_list_box.rb +138 -11
- data/lib/wx/doc/gen/html/html_window.rb +9 -3
- data/lib/wx/doc/gen/hyperlink_ctrl.rb +147 -0
- data/lib/wx/doc/gen/hyperlink_event.rb +43 -0
- data/lib/wx/doc/gen/icon.rb +7 -1
- data/lib/wx/doc/gen/icon_location.rb +2 -0
- data/lib/wx/doc/gen/image.rb +15 -8
- data/lib/wx/doc/gen/keyboard_state.rb +6 -0
- data/lib/wx/doc/gen/list_box.rb +0 -11
- data/lib/wx/doc/gen/list_ctrl.rb +10 -13
- data/lib/wx/doc/gen/locale.rb +7 -3
- data/lib/wx/doc/gen/log.rb +6 -2
- data/lib/wx/doc/gen/mdi_frame.rb +2 -0
- data/lib/wx/doc/gen/media_ctrl.rb +2 -0
- data/lib/wx/doc/gen/memory_dc.rb +105 -18
- data/lib/wx/doc/gen/menu.rb +4 -2
- data/lib/wx/doc/gen/menu_bar.rb +0 -8
- data/lib/wx/doc/gen/menu_item.rb +9 -3
- data/lib/wx/doc/gen/message_dialog.rb +6 -3
- data/lib/wx/doc/gen/mirror_dc.rb +2 -8
- data/lib/wx/doc/gen/mouse_state.rb +2 -0
- data/lib/wx/doc/gen/multi_choice_dialog.rb +0 -2
- data/lib/wx/doc/gen/non_owned_window.rb +2 -1
- data/lib/wx/doc/gen/notebook.rb +4 -2
- data/lib/wx/doc/gen/paint_dc.rb +2 -6
- data/lib/wx/doc/gen/palette.rb +3 -3
- data/lib/wx/doc/gen/pen.rb +6 -1
- data/lib/wx/doc/gen/pg/pg_editor.rb +2 -1
- data/lib/wx/doc/gen/pg/pg_multi_button.rb +4 -0
- data/lib/wx/doc/gen/pg/pg_properties.rb +30 -3
- data/lib/wx/doc/gen/pg/pg_property.rb +30 -4
- data/lib/wx/doc/gen/pg/pg_validation_info.rb +2 -0
- data/lib/wx/doc/gen/pg/property_grid.rb +5 -2
- data/lib/wx/doc/gen/pg/property_grid_interface.rb +6 -2
- data/lib/wx/doc/gen/pg/property_grid_manager.rb +2 -0
- data/lib/wx/doc/gen/pg/property_grid_page_state.rb +2 -0
- data/lib/wx/doc/gen/picker_base.rb +2 -1
- data/lib/wx/doc/gen/platform_info.rb +4 -1
- data/lib/wx/doc/gen/property_sheet_dialog.rb +2 -0
- data/lib/wx/doc/gen/prt/post_script_dc.rb +2 -8
- data/lib/wx/doc/gen/prt/print_data.rb +6 -0
- data/lib/wx/doc/gen/prt/printer.rb +0 -3
- data/lib/wx/doc/gen/prt/printer_dc.rb +2 -6
- data/lib/wx/doc/gen/radio_box.rb +2 -10
- data/lib/wx/doc/gen/rbn/ribbon_art_provider.rb +6 -0
- data/lib/wx/doc/gen/rbn/ribbon_panel.rb +1 -1
- data/lib/wx/doc/gen/region.rb +2 -0
- data/lib/wx/doc/gen/rtc/rich_text_buffer.rb +6 -0
- data/lib/wx/doc/gen/rtc/rich_text_ctrl.rb +0 -4
- data/lib/wx/doc/gen/rtc/rich_text_header_footer_data.rb +2 -0
- data/lib/wx/doc/gen/rtc/rich_text_html_handler.rb +2 -1
- data/lib/wx/doc/gen/rtc/symbol_picker_dialog.rb +2 -0
- data/lib/wx/doc/gen/screen_dc.rb +2 -0
- data/lib/wx/doc/gen/scroll_bar.rb +2 -1
- data/lib/wx/doc/gen/scrolled_canvas.rb +4 -8
- data/lib/wx/doc/gen/scrolled_control.rb +4 -8
- data/lib/wx/doc/gen/scrolled_window.rb +4 -8
- data/lib/wx/doc/gen/search_ctrl.rb +131 -0
- data/lib/wx/doc/gen/single_choice_dialog.rb +0 -2
- data/lib/wx/doc/gen/sizer.rb +14 -3
- data/lib/wx/doc/gen/splash_screen.rb +2 -0
- data/lib/wx/doc/gen/static_box.rb +6 -3
- data/lib/wx/doc/gen/static_box_sizer.rb +2 -1
- data/lib/wx/doc/gen/status_bar.rb +0 -5
- data/lib/wx/doc/gen/stc/styled_text_ctrl.rb +4 -5
- data/lib/wx/doc/gen/svg_file_dc.rb +10 -11
- data/lib/wx/doc/gen/text_ctrl.rb +10 -3
- data/lib/wx/doc/gen/text_entry.rb +8 -3
- data/lib/wx/doc/gen/text_entry_dialog.rb +4 -2
- data/lib/wx/doc/gen/timer_event.rb +2 -0
- data/lib/wx/doc/gen/tool_bar.rb +8 -4
- data/lib/wx/doc/gen/top_level_window.rb +5 -2
- data/lib/wx/doc/gen/tree_ctrl.rb +0 -6
- data/lib/wx/doc/gen/ui_action_simulator.rb +100 -0
- data/lib/wx/doc/gen/utils.rb +1 -1
- data/lib/wx/doc/gen/v_list_box.rb +36 -26
- data/lib/wx/doc/gen/validator.rb +2 -1
- data/lib/wx/doc/gen/variant.rb +10 -0
- data/lib/wx/doc/gen/window.rb +38 -17
- data/lib/wx/doc/gen/window_dc.rb +2 -0
- data/lib/wx/doc/gen/window_disabler.rb +2 -0
- data/lib/wx/doc/gen/wizard_page_simple.rb +2 -0
- data/lib/wx/doc/gen/xml_node.rb +6 -0
- data/lib/wx/doc/gen/xml_resource.rb +4 -1
- data/lib/wx/doc/memory_dc.rb +75 -0
- data/lib/wx/doc/mirror_dc.rb +16 -0
- data/lib/wx/doc/pen.rb +17 -0
- data/lib/wx/doc/prt/printer_dc.rb +26 -0
- data/lib/wx/doc/radio_box.rb +20 -0
- data/lib/wx/doc/screen_dc.rb +10 -6
- data/lib/wx/doc/svg_file_dc.rb +20 -0
- data/lib/wx/doc/v_list_box.rb +9 -0
- data/lib/wx/doc/window.rb +27 -0
- data/lib/wx/doc/window_disabler.rb +10 -0
- data/lib/wx/html/keyword_defs.rb +6 -7
- data/lib/wx/html/require.rb +1 -0
- data/lib/wx/html/simple_html_listbox.rb +105 -0
- data/lib/wx/keyword_defs.rb +83 -75
- data/lib/wx/prt/keyword_defs.rb +5 -1
- data/lib/wx/version.rb +1 -1
- data/lib/wx/wxruby/cmd/test.rb +1 -1
- 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/install.rb +20 -7
- data/rakelib/lib/config/linux.rb +4 -2
- data/rakelib/lib/config/macosx.rb +120 -1
- data/rakelib/lib/config/mingw.rb +6 -1
- data/rakelib/lib/config/unixish.rb +26 -11
- data/rakelib/lib/config.rb +15 -6
- data/rakelib/yard/yard/relative_markdown_links.rb +5 -1
- data/samples/aui/aui.rb +432 -363
- data/samples/bigdemo/wxArtProvider.rbw +5 -4
- data/samples/controls/controls.rb +2 -2
- data/samples/controls/htlbox.rb +411 -0
- data/samples/controls/tn_htlbox.png +0 -0
- data/samples/drawing/graphics_drawing.rb +1 -2
- data/samples/drawing/{svgtest.rb → image_prt.rb} +49 -18
- data/samples/drawing/tn_image_prt.png +0 -0
- data/samples/propgrid/propgrid.rb +26 -21
- data/samples/ribbon/ribbon.rb +47 -46
- data/samples/sampler/editor.rb +33 -25
- data/samples/sampler/sample.rb +2 -2
- data/samples/sampler/stc_editor.rb +4 -2
- data/tests/lib/item_container_tests.rb +82 -0
- data/tests/lib/text_entry_tests.rb +80 -0
- data/tests/lib/wxapp_runner.rb +15 -3
- data/tests/lib/wxframe_runner.rb +144 -0
- data/tests/test_app_event_filter.rb +74 -0
- data/tests/test_art_provider.rb +52 -0
- data/tests/test_clipboard.rb +2 -1
- data/tests/test_event_handling.rb +199 -16
- data/tests/test_events.rb +4 -11
- data/tests/test_ext_controls.rb +28 -0
- data/tests/test_font.rb +239 -0
- data/tests/test_gdi_object.rb +161 -0
- data/tests/test_intl.rb +16 -15
- data/tests/test_item_data.rb +33 -1
- data/tests/test_std_controls.rb +373 -0
- data/tests/test_window.rb +340 -0
- metadata +61 -8
- data/lib/wx/doc/gen/auto_buffered_paint_dc.rb +0 -47
- data/lib/wx/doc/gen/buffered_dc.rb +0 -95
- data/lib/wx/doc/gen/buffered_paint_dc.rb +0 -55
- data/lib/wx/doc/gen/colour_data.rb +0 -96
- data/samples/drawing/tn_svgtest.png +0 -0
@@ -1002,6 +1002,12 @@ class Wx::EvtHandler
|
|
1002
1002
|
Wx::EVT_MEDIA_PAUSE,
|
1003
1003
|
Wx::MediaEvent
|
1004
1004
|
] if Wx.const_defined?(:EVT_MEDIA_PAUSE)
|
1005
|
+
# from wxHyperlinkEvent
|
1006
|
+
self.register_event_type EventType[
|
1007
|
+
'evt_hyperlink', 1,
|
1008
|
+
Wx::EVT_HYPERLINK,
|
1009
|
+
Wx::HyperlinkEvent
|
1010
|
+
] if Wx.const_defined?(:EVT_HYPERLINK)
|
1005
1011
|
# from wxCommandEvent
|
1006
1012
|
self.register_event_type EventType[
|
1007
1013
|
'evt_button', 1,
|
@@ -1180,6 +1186,7 @@ class Wx::EvtHandler
|
|
1180
1186
|
Wx::EVT_COMBOBOX_CLOSEUP,
|
1181
1187
|
Wx::CommandEvent
|
1182
1188
|
] if Wx.const_defined?(:EVT_COMBOBOX_CLOSEUP)
|
1189
|
+
# from wxBitmapComboBox
|
1183
1190
|
# from wxRadioBox
|
1184
1191
|
# from wxPanel
|
1185
1192
|
# from wxNotebook
|
@@ -1195,6 +1202,17 @@ class Wx::EvtHandler
|
|
1195
1202
|
] if Wx.const_defined?(:EVT_NOTEBOOK_PAGE_CHANGING)
|
1196
1203
|
# from wxListBox
|
1197
1204
|
# from wxChoice
|
1205
|
+
# from wxSearchCtrl
|
1206
|
+
self.register_event_type EventType[
|
1207
|
+
'evt_search', 1,
|
1208
|
+
Wx::EVT_SEARCH,
|
1209
|
+
Wx::CommandEvent
|
1210
|
+
] if Wx.const_defined?(:EVT_SEARCH)
|
1211
|
+
self.register_event_type EventType[
|
1212
|
+
'evt_search_cancel', 1,
|
1213
|
+
Wx::EVT_SEARCH_CANCEL,
|
1214
|
+
Wx::CommandEvent
|
1215
|
+
] if Wx.const_defined?(:EVT_SEARCH_CANCEL)
|
1198
1216
|
# from wxCollapsiblePane
|
1199
1217
|
# from wxSlider
|
1200
1218
|
# from wxScrollBar
|
@@ -1376,4 +1394,5 @@ class Wx::EvtHandler
|
|
1376
1394
|
Wx::EVT_DIRCTRL_FILEACTIVATED,
|
1377
1395
|
Wx::GenericDirCtrl
|
1378
1396
|
] if Wx.const_defined?(:EVT_DIRCTRL_FILEACTIVATED)
|
1397
|
+
# from wxHyperlinkCtrl
|
1379
1398
|
end
|
data/lib/wx/core/evthandler.rb
CHANGED
@@ -17,9 +17,53 @@ class Wx::EvtHandler
|
|
17
17
|
|
18
18
|
# Fast look-up hash to map event type ids to ruby event classes
|
19
19
|
EVENT_TYPE_CLASS_MAP = {}
|
20
|
+
private_constant :EVENT_TYPE_CLASS_MAP
|
20
21
|
# Hash to look up EVT constants from symbol names of evt handler
|
21
22
|
# methods; used internally by disconnect (see EvtHandler.i)
|
22
23
|
EVENT_NAME_TYPE_MAP = {}
|
24
|
+
private_constant :EVENT_NAME_TYPE_MAP
|
25
|
+
# Hash to look up event handler arity from symbol names of evt handler
|
26
|
+
# methods; internal use
|
27
|
+
EVENT_NAME_EVENT_ARITY_MAP = {}
|
28
|
+
private_constant :EVENT_NAME_EVENT_ARITY_MAP
|
29
|
+
|
30
|
+
class << self
|
31
|
+
|
32
|
+
def event_type_arity(name)
|
33
|
+
EVENT_NAME_EVENT_ARITY_MAP[name.to_sym] || 0
|
34
|
+
end
|
35
|
+
|
36
|
+
def get_event_type_class_map
|
37
|
+
EVENT_TYPE_CLASS_MAP
|
38
|
+
end
|
39
|
+
private :get_event_type_class_map
|
40
|
+
|
41
|
+
# Add caching for added event filters as we need to keep these alive
|
42
|
+
# for as long as they are registered
|
43
|
+
|
44
|
+
def event_filters
|
45
|
+
@event_filters ||= []
|
46
|
+
end
|
47
|
+
private :event_filters
|
48
|
+
|
49
|
+
wx_add_filter = instance_method :add_filter
|
50
|
+
define_method :add_filter do |filter|
|
51
|
+
wx_add_filter.bind(self).call(filter)
|
52
|
+
event_filters << filter
|
53
|
+
end
|
54
|
+
|
55
|
+
wx_remove_filter = instance_method :remove_filter
|
56
|
+
define_method :remove_filter do |filter|
|
57
|
+
wx_remove_filter.bind(self).call(filter)
|
58
|
+
event_filters.delete(filter)
|
59
|
+
end
|
60
|
+
|
61
|
+
def clear_filters
|
62
|
+
event_filters.each { |f| remove_filter(f) }
|
63
|
+
event_filters.clear
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
23
67
|
|
24
68
|
# Given a Wx EventType id (eg Wx::EVT_MENU), returns a WxRuby Event
|
25
69
|
# class which should be passed to event handler blocks. The actual
|
@@ -43,8 +87,8 @@ class Wx::EvtHandler
|
|
43
87
|
|
44
88
|
# Given the Integer constant Wx::EVT_XXX, returns the convenience
|
45
89
|
# handler method name associated with that type of event.
|
46
|
-
def self.event_name_for_type(
|
47
|
-
EVENT_NAME_TYPE_MAP.key(
|
90
|
+
def self.event_name_for_type(evt_id)
|
91
|
+
EVENT_NAME_TYPE_MAP.key(evt_id)
|
48
92
|
end
|
49
93
|
|
50
94
|
# Given an integer value +int_val+, returns the name of the EVT_xxx
|
@@ -85,6 +129,8 @@ class Wx::EvtHandler
|
|
85
129
|
return
|
86
130
|
end
|
87
131
|
|
132
|
+
EVENT_NAME_EVENT_ARITY_MAP[ev_type.name.to_sym] = ev_type.arity
|
133
|
+
|
88
134
|
# set up the evt_xxx method
|
89
135
|
case ev_type.arity
|
90
136
|
when 0 # events without an id
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
module Wx
|
3
|
+
|
4
|
+
class FindReplaceDialog < Wx::Dialog
|
5
|
+
|
6
|
+
# add caching for FindReplaceData object
|
7
|
+
# dialog does not take over ownership but does allow referencing
|
8
|
+
# the data object so we need to keep it alive here
|
9
|
+
|
10
|
+
wx_initialize = instance_method :initialize
|
11
|
+
define_method :initialize do |parent, data, *args|
|
12
|
+
wx_initialize.bind(self).call(parent, data, *args)
|
13
|
+
@fr_data = data
|
14
|
+
end
|
15
|
+
|
16
|
+
wx_set_data = instance_method :set_data
|
17
|
+
define_method :set_data do |data|
|
18
|
+
wx_set_data.bind(self).call(data)
|
19
|
+
@fr_data = data
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
data/lib/wx/core/font.rb
CHANGED
@@ -1,22 +1,30 @@
|
|
1
1
|
|
2
2
|
require_relative './font/encoding'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
module Wx
|
5
|
+
|
6
|
+
class Font
|
7
|
+
class << self
|
8
|
+
# Returns the name of the platform's default font encoding
|
9
|
+
def get_default_encoding_name
|
10
|
+
ENCODING_NAMES[ get_default_encoding ]
|
11
|
+
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
# Sets the default encoding to be +enc+, which may be the string
|
14
|
+
# name of an encoding (eg 'UTF8') or an internal WxWidgets flag
|
15
|
+
# (eg Wx::FONTENCODING_UTF8).
|
16
|
+
def set_default_encoding_name(enc)
|
17
|
+
if flag_int = ENCODING_NAMES.index(enc.upcase)
|
18
|
+
set_default_encoding(Wx::FontEncoding.new(flag_int))
|
19
|
+
else
|
20
|
+
raise ArgumentError, "Unknown font encoding name '#{enc}'"
|
21
|
+
end
|
19
22
|
end
|
20
23
|
end
|
21
24
|
end
|
25
|
+
|
26
|
+
# make this simply an alias for the Font class so the #find_or_create_font methods
|
27
|
+
# can be accessed through that name too.
|
28
|
+
TheFontList = Font
|
29
|
+
|
22
30
|
end
|
data/lib/wx/core/helpprovider.rb
CHANGED
@@ -6,9 +6,9 @@ class Wx::HelpProvider
|
|
6
6
|
# SWIG Director; it can't be reaped and re-wrapped later. The
|
7
7
|
# easiest way is to make the currently set one an instance variable
|
8
8
|
# of this class
|
9
|
-
|
9
|
+
wx_set = instance_method :set
|
10
10
|
define_method(:set) do | help_provider |
|
11
|
-
|
11
|
+
wx_set.bind(self).call(help_provider)
|
12
12
|
@__hp__ = help_provider
|
13
13
|
end
|
14
14
|
end
|
data/lib/wx/core/icon.rb
CHANGED
@@ -51,7 +51,7 @@ module Wx
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def self.Icon(name, bmp_type = nil, *rest)
|
54
|
-
art_path = File.dirname(caller_path = caller_locations(1).first.absolute_path)
|
54
|
+
art_path = File.dirname(caller_path = caller_locations(1).first.absolute_path || caller_locations(1).first.path)
|
55
55
|
art_owner = File.basename(caller_path, '.*')
|
56
56
|
art_file = ArtLocator.find_art(name, art_type: :icon, art_path: art_path, art_section: art_owner, bmp_type: bmp_type)
|
57
57
|
::Kernel.raise ArgumentError, "Cannot locate art file for #{name}:Icon" unless art_file
|
data/lib/wx/core/image.rb
CHANGED
@@ -69,7 +69,7 @@ module Wx
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def self.Image(name, bmp_type = nil, *rest)
|
72
|
-
art_path = File.dirname(caller_path = caller_locations(1).first.absolute_path)
|
72
|
+
art_path = File.dirname(caller_path = caller_locations(1).first.absolute_path || caller_locations(1).first.path)
|
73
73
|
art_owner = File.basename(caller_path, '.*')
|
74
74
|
art_file = ArtLocator.find_art(name, art_type: :image, art_path: art_path, art_section: art_owner, bmp_type: bmp_type)
|
75
75
|
::Kernel.raise ArgumentError, "Cannot locate art file for #{name}:Image" unless art_file
|
data/lib/wx/core/menu.rb
CHANGED
data/lib/wx/core/pen.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
|
2
|
+
module Wx
|
3
|
+
|
4
|
+
module TextEntry
|
5
|
+
|
6
|
+
wx_auto_complete = instance_method :auto_complete
|
7
|
+
define_method :auto_complete do |completer|
|
8
|
+
if wx_auto_complete.bind(self).call(completer)
|
9
|
+
@completer = completer # keep the Ruby object alive
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
class Wx::VListBox
|
3
|
+
|
4
|
+
wx_each_selected = instance_method :each_selected
|
5
|
+
define_method :each_selected do |&block|
|
6
|
+
if block
|
7
|
+
wx_each_selected.bind(self).call(&block)
|
8
|
+
else
|
9
|
+
::Enumerator.new { |y| wx_each_selected.bind(self).call { |sel| y << sel } }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
data/lib/wx/core/window.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Copyright 2004-2007 by Kevin Smith
|
2
|
-
#
|
2
|
+
# Copyright 2022 by Martin Corino
|
3
|
+
# released under the MIT(-style) wxruby2/3 license
|
3
4
|
|
4
5
|
# The base class for all things displayed on screen
|
5
6
|
class Wx::Window
|
@@ -49,7 +50,7 @@ class Wx::Window
|
|
49
50
|
# This modified version of evt_paint sets a variable indicating that a
|
50
51
|
# paint event is being handled just before running the event
|
51
52
|
# handler. This ensures that any call to Window#paint within the
|
52
|
-
# handler will supply a Wx::PaintDC (see
|
53
|
+
# handler will supply a Wx::PaintDC (see Window SWIG director).
|
53
54
|
def evt_paint(meth = nil, &block)
|
54
55
|
paint_proc = acquire_handler(meth, block)
|
55
56
|
wrapped_block = proc do | event |
|
@@ -69,4 +70,30 @@ class Wx::Window
|
|
69
70
|
self.paint(&block)
|
70
71
|
end
|
71
72
|
end
|
73
|
+
|
74
|
+
# implement non-static variants of these
|
75
|
+
|
76
|
+
def from_dip(*args)
|
77
|
+
Wx::Window.from_dip(*args, self)
|
78
|
+
end
|
79
|
+
def to_dip(*args)
|
80
|
+
Wx::Window.to_dip(*args, self)
|
81
|
+
end
|
82
|
+
|
83
|
+
def from_phys(*args)
|
84
|
+
Wx::Window.from_phys(*args, self)
|
85
|
+
end
|
86
|
+
def to_phys(*args)
|
87
|
+
Wx::Window.to_phys(*args, self)
|
88
|
+
end
|
89
|
+
|
90
|
+
# implement Window update locker
|
91
|
+
def locked(&block)
|
92
|
+
self.freeze
|
93
|
+
begin
|
94
|
+
block.call if block_given?
|
95
|
+
ensure
|
96
|
+
self.thaw
|
97
|
+
end
|
98
|
+
end
|
72
99
|
end
|
data/lib/wx/doc/app.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
class Wx::App
|
3
|
+
|
4
|
+
# Set the menu item id for the About menu item.
|
5
|
+
# Default is {Wx::ID_ABOUT}
|
6
|
+
# @param [Integer] id
|
7
|
+
def set_mac_about_menu_itemid(id) end
|
8
|
+
alias :mac_about_menu_itemid= :set_mac_about_menu_itemid
|
9
|
+
|
10
|
+
# Get the current menu item id for the About menu item.
|
11
|
+
# Default is {Wx::ID_ABOUT}
|
12
|
+
# @return [Integer]
|
13
|
+
def get_mac_about_menu_itemid(id) end
|
14
|
+
alias :mac_about_menu_itemid :get_mac_about_menu_itemid
|
15
|
+
|
16
|
+
# Set the menu item id for the Preferences menu item.
|
17
|
+
# Default is {Wx::ID_PREFERENCES}
|
18
|
+
# @param [Integer] id
|
19
|
+
def set_mac_preferences_menu_itemid(id) end
|
20
|
+
alias :mac_preferences_menu_itemid= :set_mac_preferences_menu_itemid
|
21
|
+
|
22
|
+
# Get the current menu item id for the Preferences menu item.
|
23
|
+
# Default is {Wx::ID_PREFERENCES}
|
24
|
+
# @return [Integer]
|
25
|
+
def get_mac_preferences_menu_itemid(id) end
|
26
|
+
alias :mac_preferences_menu_itemid :get_mac_preferences_menu_itemid
|
27
|
+
|
28
|
+
# Set the menu item id for the Exit menu item.
|
29
|
+
# Default is {Wx::ID_EXIT}
|
30
|
+
# @param [Integer] id
|
31
|
+
def set_mac_exit_menu_itemid(id) end
|
32
|
+
alias :mac_exit_menu_itemid= :set_mac_exit_menu_itemid
|
33
|
+
|
34
|
+
# Get the current menu item id for the Exit menu item.
|
35
|
+
# Default is {Wx::ID_EXIT}
|
36
|
+
# @return [Integer]
|
37
|
+
def get_mac_exit_menu_itemid(id) end
|
38
|
+
alias :mac_exit_menu_itemid :get_mac_exit_menu_itemid
|
39
|
+
|
40
|
+
end
|
data/lib/wx/doc/brush.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
|
2
|
+
module Wx
|
3
|
+
|
4
|
+
class Brush
|
5
|
+
|
6
|
+
# Finds a brush with the specified attributes in the global list and returns it, else creates a new brush, adds it to the global brush list, and returns it.
|
7
|
+
# @param [Wx::Colour,String,Symbol] colour The Brush colour.
|
8
|
+
# @param [Wx::BrushStyle] style The brush style. See {Wx::BrushStyle} for a list of the styles.
|
9
|
+
# @return [Wx::Brush]
|
10
|
+
def self.find_or_create_brush(colour, style=Wx::BrushStyle::BRUSHSTYLE_SOLID) end
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
# In wxRuby this is simply an alias for the Brush class.
|
15
|
+
TheBrushList = Wx::Brush
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
module Wx
|
3
|
+
|
4
|
+
class BusyInfo
|
5
|
+
|
6
|
+
# @overload busy(message, parent=nil)
|
7
|
+
# Shows busy info window with message, blocks event handling and calls the given block
|
8
|
+
# passing the BusyInfo instance as argument.
|
9
|
+
# @param [String] message
|
10
|
+
# @param [Wx::Window,nil] parent
|
11
|
+
# @yieldparam [Wx::BusyInfo] bi BusyInfo instance
|
12
|
+
# @overload busy(busy_info)
|
13
|
+
# Shows busy info window according to busy_info settings, blocks event handling and calls the given block
|
14
|
+
# passing the BusyInfo instance as argument.
|
15
|
+
# @param [Wx::BusyInfoFlags] busy_info
|
16
|
+
# @yieldparam [Wx::BusyInfo] bi BusyInfo instance
|
17
|
+
def self.busy(*args) end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
module Wx
|
3
|
+
|
4
|
+
class ClientDC < Wx::DC
|
5
|
+
|
6
|
+
# Executes the given block providing a temporary (client) dc as
|
7
|
+
# it's single argument.
|
8
|
+
# @param [Wx::Window] win window to draw on
|
9
|
+
# @yieldparam [Wx::ClientDC] dc the ClientDC instance to paint on
|
10
|
+
# @return [Object] result of the block
|
11
|
+
def self.draw_on(win) end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
class PaintDC < Wx::ClientDC
|
16
|
+
|
17
|
+
# Executes the given block providing a temporary dc as
|
18
|
+
# it's single argument.
|
19
|
+
# Pass a pointer to the window on which you wish to paint.
|
20
|
+
# @note In wxRuby this method mostly exists to be consistent with the other DC classes. It is however recommended to use Wx::Window#paint instead.
|
21
|
+
# @param [Wx::Window] win window to draw on
|
22
|
+
# @yieldparam [Wx::PaintDC] dc the PaintDC instance to paint on
|
23
|
+
# @return [Object] result of the block
|
24
|
+
def self.draw_on(win) end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
class Wx::ControlWithItems
|
3
|
+
|
4
|
+
# Returns true if the items in the control are sorted
|
5
|
+
# (style Wx::LB_SORT for list boxes or Wx::CB_SORT for combo boxes).
|
6
|
+
# This method is mostly meant for internal use only.
|
7
|
+
# @return [Boolean] true is sorted, false otherwise
|
8
|
+
def is_sorted; end
|
9
|
+
alias :sorted? :is_sorted
|
10
|
+
|
11
|
+
end
|
data/lib/wx/doc/dc.rb
CHANGED
@@ -49,18 +49,4 @@ module Wx
|
|
49
49
|
|
50
50
|
end
|
51
51
|
|
52
|
-
class MemoryDC
|
53
|
-
|
54
|
-
# Creates a Memory DC and passes that to the given block to draw on.
|
55
|
-
# Automatically unselects any source object of the MemoryDC after the block finishes.
|
56
|
-
# @overload self.draw_on(bitmap)
|
57
|
-
# @param [Wx::Bitmap]
|
58
|
-
# @yieldparam [WxMemoryDC] dc
|
59
|
-
# @overload self.draw_on(dc)
|
60
|
-
# @param [Wx::DC]
|
61
|
-
# @yieldparam [WxMemoryDC] dc
|
62
|
-
def self.draw_on(arg, &block) end
|
63
|
-
|
64
|
-
end
|
65
|
-
|
66
52
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
module Wx
|
3
|
+
|
4
|
+
class EventBlocker
|
5
|
+
|
6
|
+
class << self
|
7
|
+
|
8
|
+
# Constructs the blocker for the given window and for the given event type and passes the blocker to the
|
9
|
+
# given block. The blocker is destroyed after the block returns.
|
10
|
+
#
|
11
|
+
# If type is Wx::EVT_ANY, then all events for that window are blocked. You can call #block after creation to
|
12
|
+
# add other event types to the list of events to block.
|
13
|
+
#
|
14
|
+
# @note Note that the win window must remain alive until the given block returns (i.e. until Wx::EventBlocker's
|
15
|
+
# object destruction).
|
16
|
+
# @param [Wx::Window] win the window to block events for
|
17
|
+
# @param [Integer] evt_type the event type to block
|
18
|
+
# @yieldparam [Wx::EventBlocker] blkr the blocker object
|
19
|
+
# @return [Object] the value returned by the block
|
20
|
+
def blocked_for(win, evt_type=Wx::EVT_ANY) end
|
21
|
+
alias :block_for :blocked_for
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
data/lib/wx/doc/evthandler.rb
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
|
4
4
|
class Wx::EvtHandler
|
5
5
|
|
6
|
+
# Removes all (Ruby) installed EventFilter-s.
|
7
|
+
# @return [void]
|
8
|
+
def self.clear_filters; end
|
9
|
+
|
6
10
|
# Public method to register the mapping of a custom event type
|
7
11
|
# +konstant+ (which should be a unique integer; one will be created if
|
8
12
|
# not supplied) to a custom event class +klass+. If +meth+ and +arity+
|
@@ -114,3 +114,52 @@ destroy these on a regular basis when not used (closed) possibly re-creating the
|
|
114
114
|
|
115
115
|
Dialogs are special cases of toplevel windows which are not automatically destroyed when closed. The wxRuby library
|
116
116
|
therefor provides special support to ease handling the destruction of these. See [here](03_dialogs.md) for more details.
|
117
|
+
|
118
|
+
## Object identities
|
119
|
+
|
120
|
+
One of the trickier things to handle correctly in the kind of native extensions like wxRuby is maintaining object
|
121
|
+
identities i.e. keeping native instances synced with their Ruby wrapper counter parts.
|
122
|
+
|
123
|
+
Whenever a native extension is allowed to call back into Ruby space we encounter the problem the we need to map any
|
124
|
+
native object data provided for the call to the right Ruby types and when necessary to the right Ruby instance (object
|
125
|
+
identity).
|
126
|
+
|
127
|
+
Objects that are considered POD types (*plain old data* types) like numerics, booleans, strings, arrays and hashes do
|
128
|
+
not require maintaining *object identity*. For these objects it is enough to map them to the right Ruby type before
|
129
|
+
passing them on to Ruby space.
|
130
|
+
|
131
|
+
For a lot of other objects though it is essential to not only map to the right **most derived** class type but also to
|
132
|
+
the exact Ruby instance which was originally instantiated as wrapper for the native object if any exists (in case no
|
133
|
+
Ruby instance existed yet a new instance of the correct **most derived** class should be instantiated at that point).
|
134
|
+
The reason this is important is 1. because the Ruby instance may have been used to identify, link to or otherwise
|
135
|
+
reference other data and/or functionality related to that specific Ruby/native pair and 2. the Ruby instance could
|
136
|
+
contain data elements (instance variables) related to that specific Ruby/native pair.<br>
|
137
|
+
In the case of wxRuby Window instance for example it is common to derive custom Window classes with custom behaviour and
|
138
|
+
corresponding instance variables that drive that behaviour. When an event handler or an overloaded native method is passed
|
139
|
+
a native window object we absolutely need to be able to map that native object to the correct Ruby wrapper instance so
|
140
|
+
all information stays in sync.
|
141
|
+
|
142
|
+
For this purpose wxRuby uses *object tracking* i.e. maintaining hash tables mapping native object pointers to Ruby object
|
143
|
+
values. Whenever a tracked object is instantiated it is registered and can from than on be resolved whenever needed to map
|
144
|
+
from native object to Ruby object.<br>
|
145
|
+
Of course this also means wxRuby has to track object destruction so mappings can be removed when a native object is
|
146
|
+
destructed.<br>
|
147
|
+
Additionally the tracking tables are also used to mark Ruby objects during the GC marking phase so they do not get garbage
|
148
|
+
collected whenever they are not referenced in Ruby space anymore but still functioning in native space (this is for example
|
149
|
+
a common situation for many child windows created but not permanently referenced in Ruby space).
|
150
|
+
|
151
|
+
Tracking and resolving mappings from tracking tables produces a certain computing overhead but testing has shown this to be
|
152
|
+
absolutely acceptable for normal applications.
|
153
|
+
|
154
|
+
There are however quite a lot of wrapped native objects in wxRuby for which *object identity* is not essential. For these
|
155
|
+
object tracking has been disabled for their classes. This means these kind of classes/object should **not** be derived from
|
156
|
+
(if even possible and/or useful) to add functionality/information or their identity used as key to link other information.<br>
|
157
|
+
These classes include:
|
158
|
+
- classes considered POD types like Wx::Size, Wx::Point, Wx::RealPoint, Wx::Rect, Wx::GBSpan, Wx::GBPosition, Wx::BusyInfoFlags,
|
159
|
+
Wx::AboutDialogInfo
|
160
|
+
- final non-instantiatable classes like the Wx::DC (Device Context) class family, Wx::GraphicsContext, Wx::WindowsDisabler,
|
161
|
+
Wx::EventBlocker, Wx::BusyInfo
|
162
|
+
- classes with native singleton objects like Wx::Clipboard
|
163
|
+
- the reference counted GDI objects like Wx::Pen, Wx::Brush, Wx::Colour, Wx::Cursor, Wx::Bitmap, Wx::Icon
|
164
|
+
|
165
|
+
The reference documentation will note untracked object classes.
|
data/lib/wx/doc/extra/10_art.md
CHANGED
@@ -0,0 +1,62 @@
|
|
1
|
+
<!--
|
2
|
+
# @markup markdown
|
3
|
+
# @title 11. wxRuby Drawing and Device Contexts
|
4
|
+
-->
|
5
|
+
|
6
|
+
# 11. wxRuby Drawing and Device Contexts (DC)
|
7
|
+
|
8
|
+
In wxRuby the Wx::DC class family provides functionality for drawing to windows, bitmaps, printers etc.
|
9
|
+
|
10
|
+
What most of these classes have in common is that actual drawing output is buffered until the time the
|
11
|
+
device context object is destroyed.
|
12
|
+
For this reason the common practice in wxWidgets C++ code would be to create temporary DC objects on the
|
13
|
+
stack and draw on them while they are in scope (for several classes it is even strongly advised to never create
|
14
|
+
them any other way and to never keep objects alive out of scope). When leaving the scope these object would than be
|
15
|
+
automatically destroyed and the any buffered output flushed to the final target.
|
16
|
+
|
17
|
+
In Ruby this approach is impossible as Ruby is a purely dynamic language and does not **this kind** of scope bound
|
18
|
+
life cycles. Any DC object created would have to be dynamically created and due to the properties of the GC driven
|
19
|
+
life cycles could well be kept alive beyond the scope of it's creation. This will not always cause problems but could
|
20
|
+
and does not really have an upside.
|
21
|
+
|
22
|
+
To prevent confusion and potential problems wxRuby defines all `Wx::DC` derived classes to be abstract classes that
|
23
|
+
cannot be instantiated using `new`. Rather all `Wx::DC` derived classes provide `::draw_on` factory methods to create
|
24
|
+
temporary dc objects that will be passed on to blocks given and will only exist for the duration of the execution of
|
25
|
+
the block. This will guarantee proper DC cleanup when leaving it's usage scope.
|
26
|
+
|
27
|
+
> Note that it is a **BAD** idea to think about storing the dc reference provide to the block for later access!
|
28
|
+
|
29
|
+
A typical usage of a `::draw_on` method would be:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
myTestBitmap1x = Wx::Bitmap.new(60, 15, 32)
|
33
|
+
Wx::MemoryDC.draw_on(myTestBitmap1x) do |mdc|
|
34
|
+
mdc.set_background(Wx::WHITE_BRUSH)
|
35
|
+
mdc.clear
|
36
|
+
mdc.set_pen(Wx::BLACK_PEN)
|
37
|
+
mdc.set_brush(Wx::WHITE_BRUSH)
|
38
|
+
mdc.draw_rectangle(0, 0, 60, 15)
|
39
|
+
mdc.draw_line(0, 0, 59, 14)
|
40
|
+
mdc.set_text_foreground(Wx::BLACK)
|
41
|
+
mdc.draw_text("x1", 0, 0)
|
42
|
+
end
|
43
|
+
```
|
44
|
+
|
45
|
+
## Windows, Wx::PaintDC and Wx::AutoBufferedPaintDC
|
46
|
+
|
47
|
+
The `Wx::PaintDC` and `Wx::AutoBufferedPaintDC` classes provide `::draw_on` methods just like all other DC classes but
|
48
|
+
this is mostly to be consistent.
|
49
|
+
|
50
|
+
In this case it is recommended to instead use the `Wx::Window#paint` or `Wx::Window#paint_buffered` methods as these
|
51
|
+
provide some optimizations with regard to automatically detecting is the methods are called inside `Wx::EVT_PAINT`
|
52
|
+
handlers (which should normally be the case) or not.
|
53
|
+
|
54
|
+
So the typical way to do buffered painting inside a windows `Wx::EVT_PAINT` handler would be something like:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
def on_paint(_event)
|
58
|
+
self.paint_buffered do |dc|
|
59
|
+
# ... do some drawing ...
|
60
|
+
end
|
61
|
+
end
|
62
|
+
```
|
data/lib/wx/doc/font.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
class Wx
|
3
|
+
class Font
|
4
|
+
|
5
|
+
# @overload find_or_create_font(point_size, family, style, weight, underline=false, facename='', encoding=Wx::FontEncoding::FONTENCODING_DEFAULT)
|
6
|
+
# Finds a font of the given specification in the global font list, or creates one and adds it to the list.
|
7
|
+
# @param [Integer] point_size Size in points. See {Wx::Font#set_point_size} for more info.
|
8
|
+
# @param [Wx::FontFamily] family The font family: a generic portable way of referring to fonts without specifying a facename.
|
9
|
+
# @param [Wx::FontStyle] style One of {Wx::FontStyle::FONTSTYLE_NORMAL}, {Wx::FontStyle::FONTSTYLE_SLANT} and {Wx::FontStyle::FONTSTYLE_ITALIC}.
|
10
|
+
# @param [Wx::FontWeight] weight Font weight, sometimes also referred to as font boldness. One of the {Wx::FontWeight} enumeration values.
|
11
|
+
# @param [Boolean] underline The value can be true or false.
|
12
|
+
# @param [String] facename An optional string specifying the face name to be used. If it is an empty string, a default face name will be chosen based on the family.
|
13
|
+
# @param [Wx::FontEncoding] encoding An encoding which may be one of the enumeration values of {Wx::FontEncoding}. If the specified encoding isn't available, no font is created (see also Font Encodings).
|
14
|
+
# @return [Wx::Font]
|
15
|
+
# @see Wx::Font#initialize
|
16
|
+
# @overload find_or_create_font(font_info)
|
17
|
+
# Finds a font of the given specification in the global font list, or creates one and adds it to the list.
|
18
|
+
# @param [Wx::FontInfo] font_info
|
19
|
+
# @return [Wx::Font]
|
20
|
+
def self.find_or_create_font(*args) end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
# In wxRuby this is simply an alias for the Font class.
|
25
|
+
TheFontList = Font
|
26
|
+
|
27
|
+
end
|