wxruby3 0.9.0.pre.beta.14-x64-mingw-ucrt → 0.9.0.pre.rc.2-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/.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
@@ -0,0 +1,88 @@
|
|
1
|
+
# :stopdoc:
|
2
|
+
# This file is automatically generated by the WXRuby3 documentation
|
3
|
+
# generator. Do not alter this file.
|
4
|
+
# :startdoc:
|
5
|
+
|
6
|
+
|
7
|
+
module Wx
|
8
|
+
|
9
|
+
# A global event filter for pre-processing all the events generated in the program.
|
10
|
+
# This is a very simple class which just provides {Wx::EventFilter#filter_event} virtual method to be called by {Wx::EvtHandler} before starting process of any event. Thus, inheriting from this class and overriding {Wx::EventFilter#filter_event} allows capturing and possibly handling or ignoring all the events happening in the program. Of course, having event filters adds additional overhead to every event processing and so should not be used lightly and your {Wx::EventFilter#filter_event} code should try to return as quickly as possible, especially for the events it is not interested in.
|
11
|
+
# An example of using this class:
|
12
|
+
# ```ruby
|
13
|
+
# # This class allows determining the last time the user has worked with
|
14
|
+
# # this application:
|
15
|
+
# class LastActivityTimeDetector < Wx::EventFilter
|
16
|
+
# def initialize
|
17
|
+
# Wx::EvtHandler.add_filter(self)
|
18
|
+
#
|
19
|
+
# @last = Time.now
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# def clear
|
23
|
+
# Wx::EvtHandler.remove_filter(self)
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# def filter_event(event)
|
27
|
+
# # Update the last user activity
|
28
|
+
# t = event.get_event_type
|
29
|
+
# case t
|
30
|
+
# when Wx::EVT_KEY_DOWN,
|
31
|
+
# Wx::EVT_MOTION,
|
32
|
+
# Wx::EVT_LEFT_DOWN,
|
33
|
+
# Wx::EVT_RIGHT_DOWN,
|
34
|
+
# Wx::EVT_MIDDLE_DOWN
|
35
|
+
# @last = Time.now
|
36
|
+
# end
|
37
|
+
#
|
38
|
+
# # Continue processing the event normally as well.
|
39
|
+
# Event_Skip
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# # This function could be called periodically from some timer to
|
43
|
+
# # do something (e.g. hide sensitive data or log out from remote
|
44
|
+
# # server) if the user has been inactive for some time period.
|
45
|
+
# def is_inactive_for?(diff)
|
46
|
+
# (Time.now - diff) > @last
|
47
|
+
# end
|
48
|
+
#
|
49
|
+
# end
|
50
|
+
# ```
|
51
|
+
#
|
52
|
+
# Notice that {Wx::App} derives from {Wx::EventFilter} and is registered as an event filter during its creation so you may also override {Wx::EventFilter#filter_event} method in your {Wx::App}-derived class and, in fact, this is often the most convenient way to do it. However creating a new class deriving directly from {Wx::EventFilter} allows isolating the event filtering code in its own separate class and also having several independent filters, if necessary.
|
53
|
+
# Category: {Wx::Events}
|
54
|
+
#
|
55
|
+
#
|
56
|
+
# @note This class is <b>untracked</b> and should not be derived from nor instances extended!
|
57
|
+
class EventFilter < ::Object
|
58
|
+
|
59
|
+
# Process event as usual.
|
60
|
+
#
|
61
|
+
Event_Skip = -1
|
62
|
+
|
63
|
+
# Don't process the event normally at all.
|
64
|
+
#
|
65
|
+
Event_Ignore = 0
|
66
|
+
|
67
|
+
# Event was already handled, don't process it normally.
|
68
|
+
#
|
69
|
+
Event_Processed = 1
|
70
|
+
|
71
|
+
# Default constructor.
|
72
|
+
# Constructor does not register this filter using {Wx::EvtHandler.add_filter}, it's your responsibility to do it when necessary.
|
73
|
+
# Notice that the objects of this class can't be copied.
|
74
|
+
# @return [EventFilter]
|
75
|
+
def initialize; end
|
76
|
+
|
77
|
+
# Override this method to implement event pre-processing.
|
78
|
+
# This method allows filtering all the events processed by the program, so you should try to return quickly from it to avoid slowing down the program to a crawl.
|
79
|
+
# Although the return type of this method is int, this is only due to backwards compatibility concerns and the actual return value must be one of the Event_XXX constants defined above:
|
80
|
+
# - Event_Skip to continue processing the event normally (this should be used in most cases).- Event_Ignore to not process this event at all (this can be used to suppress some events).- Event_Processed to not process this event normally but indicate that it was already processed by the event filter and so no default processing should take place either (this should only be used if the filter really did process the event).
|
81
|
+
# @param event [Wx::Event]
|
82
|
+
# @return [Integer]
|
83
|
+
def filter_event(event) end
|
84
|
+
|
85
|
+
end # EventFilter
|
86
|
+
|
87
|
+
|
88
|
+
end
|
@@ -1112,6 +1112,13 @@ class Wx::EvtHandler
|
|
1112
1112
|
# @yieldparam [Wx::MediaEvent] event the event to handle
|
1113
1113
|
def evt_media_pause(id, meth = nil, &block) end
|
1114
1114
|
|
1115
|
+
# User clicked on a hyperlink.
|
1116
|
+
# Processes a {Wx::EVT_HYPERLINK} event.
|
1117
|
+
# @param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] id window/control id
|
1118
|
+
# @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
|
1119
|
+
# @yieldparam [Wx::HyperlinkEvent] event the event to handle
|
1120
|
+
def evt_hyperlink(id, meth = nil, &block) end
|
1121
|
+
|
1115
1122
|
# Process a {Wx::EVT_BUTTON} event, when the button is clicked.
|
1116
1123
|
# @param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] id window/control id
|
1117
1124
|
# @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
|
@@ -1130,7 +1137,7 @@ class Wx::EvtHandler
|
|
1130
1137
|
# @yieldparam [Wx::CommandEvent] event the event to handle
|
1131
1138
|
def evt_choice(id, meth = nil, &block) end
|
1132
1139
|
|
1133
|
-
# Process a {Wx::EVT_COMBOBOX} event, when an item on the list is selected.
|
1140
|
+
# Process a {Wx::EVT_COMBOBOX} event, when an item on the list is selected.
|
1134
1141
|
# @param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] id window/control id
|
1135
1142
|
# @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
|
1136
1143
|
# @yieldparam [Wx::CommandEvent] event the event to handle
|
@@ -1199,7 +1206,7 @@ class Wx::EvtHandler
|
|
1199
1206
|
# @yieldparam [Wx::CommandEvent] event the event to handle
|
1200
1207
|
def evt_text(id, meth = nil, &block) end
|
1201
1208
|
|
1202
|
-
# Process a {Wx::EVT_TEXT_ENTER} event, when RETURN is pressed in the combobox
|
1209
|
+
# Process a {Wx::EVT_TEXT_ENTER} event, when RETURN is pressed in the combobox.
|
1203
1210
|
# @param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] id window/control id
|
1204
1211
|
# @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
|
1205
1212
|
# @yieldparam [Wx::CommandEvent] event the event to handle
|
@@ -1330,6 +1337,20 @@ class Wx::EvtHandler
|
|
1330
1337
|
# @yieldparam [Wx::BookCtrlEvent] event the event to handle
|
1331
1338
|
def evt_notebook_page_changing(id, meth = nil, &block) end
|
1332
1339
|
|
1340
|
+
# Respond to a {Wx::EVT_SEARCH} event, generated when the search button is clicked. Note that this does not initiate a search on its own, you need to perform the appropriate action in your event handler. You may use
|
1341
|
+
# Processes a {Wx::EVT_SEARCH} event.
|
1342
|
+
# @param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] id window/control id
|
1343
|
+
# @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
|
1344
|
+
# @yieldparam [Wx::CommandEvent] event the event to handle
|
1345
|
+
def evt_search(id, meth = nil, &block) end
|
1346
|
+
|
1347
|
+
# Respond to a {Wx::EVT_SEARCH_CANCEL} event, generated when the cancel button is clicked.
|
1348
|
+
# Processes a {Wx::EVT_SEARCH_CANCEL} event.
|
1349
|
+
# @param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] id window/control id
|
1350
|
+
# @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
|
1351
|
+
# @yieldparam [Wx::CommandEvent] event the event to handle
|
1352
|
+
def evt_search_cancel(id, meth = nil, &block) end
|
1353
|
+
|
1333
1354
|
# Process a {Wx::EVT_SPINCTRL} event, which is generated whenever the numeric value of the spin control is updated.
|
1334
1355
|
# @param [Integer,Wx::Enum,Wx::Window,Wx::MenuItem,Wx::ToolBarTool,Wx::Timer] id window/control id
|
1335
1356
|
# @param [String,Symbol,Method,Proc] meth (name of) method or handler proc
|
data/lib/wx/doc/gen/events.rb
CHANGED
@@ -574,13 +574,17 @@ module Wx
|
|
574
574
|
# The return value is a combination of {Wx::KeyModifier::MOD_ALT}, {Wx::KeyModifier::MOD_CONTROL}, {Wx::KeyModifier::MOD_SHIFT} and {Wx::KeyModifier::MOD_META} bit masks. Additionally, {Wx::KeyModifier::MOD_NONE} is defined as 0, i.e. corresponds to no modifiers (see {Wx::MouseEvent#has_any_modifiers}) and {Wx::KeyModifier::MOD_CMD} is either {Wx::KeyModifier::MOD_CONTROL} (MSW and Unix) or {Wx::KeyModifier::MOD_META} (Mac), see {Wx::MouseEvent#cmd_down}. See {Wx::KeyModifier} for the full list of modifiers.
|
575
575
|
# Notice that this function is easier to use correctly than, for example, {Wx::MouseEvent#control_down} because when using the latter you also have to remember to test that none of the other modifiers is pressed:
|
576
576
|
#
|
577
|
-
#
|
578
|
-
#
|
577
|
+
# ```ruby
|
578
|
+
# if event.control_down && !event.alt_down && !event.shift_down && !event.meta_down
|
579
|
+
# # ... handle Ctrl-XXX ...
|
580
|
+
# ```
|
579
581
|
#
|
580
582
|
# and forgetting to do it can result in serious program bugs (e.g. program not working with European keyboard layout where AltGr key which is seen by the program as combination of CTRL and ALT is used). On the other hand, you can simply write:
|
581
583
|
#
|
582
|
-
#
|
583
|
-
#
|
584
|
+
# ```ruby
|
585
|
+
# if event.get_modifiers == Wx::KeyModifier::MOD_CONTROL
|
586
|
+
# # ... handle Ctrl-XXX ...
|
587
|
+
# ```
|
584
588
|
#
|
585
589
|
# with this function.
|
586
590
|
# @return [Integer]
|
@@ -681,7 +685,7 @@ module Wx
|
|
681
685
|
def initialize(x=0, y=0) end
|
682
686
|
|
683
687
|
# Returns a reference to the cursor specified by this event.
|
684
|
-
# @return [
|
688
|
+
# @return [Wx::Cursor]
|
685
689
|
def get_cursor; end
|
686
690
|
alias_method :cursor, :get_cursor
|
687
691
|
|
@@ -925,18 +929,18 @@ module Wx
|
|
925
929
|
end # PressAndTapEvent
|
926
930
|
|
927
931
|
# This event class contains information about key press and release events.
|
928
|
-
# The main information carried by this event is the key being pressed or released. It can be accessed using one of {Wx::KeyEvent#get_unicode_key}, {Wx::KeyEvent#get_key_code} or {Wx::KeyEvent#get_raw_key_code} functions. For the printable characters, {Wx::KeyEvent#get_unicode_key} should be used as it works for any keys, including non-Latin-1 characters that can be entered when using national keyboard layouts. {Wx::KeyEvent#get_key_code} should be used to handle special characters (such as cursor arrows keys or HOME or INS and so on) which correspond to {Wx::KeyCode} enum elements above the
|
932
|
+
# The main information carried by this event is the key being pressed or released. It can be accessed using one of {Wx::KeyEvent#get_unicode_key}, {Wx::KeyEvent#get_key_code} or {Wx::KeyEvent#get_raw_key_code} functions. For the printable characters, {Wx::KeyEvent#get_unicode_key} should be used as it works for any keys, including non-Latin-1 characters that can be entered when using national keyboard layouts. {Wx::KeyEvent#get_key_code} should be used to handle special characters (such as cursor arrows keys or HOME or INS and so on) which correspond to {Wx::KeyCode} enum elements above the {Wx::K_START} constant. While {Wx::KeyEvent#get_key_code} also returns the character code for Latin-1 keys for compatibility, it doesn't work for Unicode characters in general and will return {Wx::K_NONE} for any non-Latin-1 ones. If both {Wx::KeyEvent#get_unicode_key} and {Wx::KeyEvent#get_key_code} return {Wx::K_NONE} then the key has no WXK_xxx mapping and {Wx::KeyEvent#get_raw_key_code} can be used to distinguish between keys, but raw key codes are platform specific. For these reasons, it is recommended to always use {Wx::KeyEvent#get_unicode_key} and only fall back to {Wx::KeyEvent#get_key_code} if {Wx::KeyEvent#get_unicode_key} returned {Wx::K_NONE}, meaning that the event corresponds to a non-printable special keys, then optionally check {Wx::KeyEvent#get_raw_key_code} if {Wx::KeyEvent#get_key_code} also returned {Wx::K_NONE} or simply ignore that key.
|
929
933
|
# While these three functions can be used with the events of {Wx::EVT_KEY_DOWN}, {Wx::EVT_KEY_UP} and {Wx::EVT_CHAR} types, the values returned by them are different for the first two events and the last one. For the latter, the key returned corresponds to the character that would appear in e.g. a text zone if the user pressed the key in it. As such, its value depends on the current state of the Shift key and, for the letters, on the state of Caps Lock modifier. For example, if A key is pressed without Shift being held down, {Wx::KeyEvent} of type {Wx::EVT_CHAR} generated for this key press will return (from either {Wx::KeyEvent#get_key_code} or {Wx::KeyEvent#get_unicode_key} as their meanings coincide for ASCII characters) key code of 97 corresponding the ASCII value of a. And if the same key is pressed but with Shift being held (or Caps Lock being active), then the key could would be 65, i.e. ASCII value of capital A.
|
930
934
|
# However for the key down and up events the returned key code will instead be A independently of the state of the modifier keys i.e. it depends only on physical key being pressed and is not translated to its logical representation using the current keyboard state. Such untranslated key codes are defined as follows:
|
931
935
|
# - For the letters they correspond to the upper case value of the letter.- For the other alphanumeric keys (e.g. 7 or <code>+</code>), the untranslated key code corresponds to the character produced by the key when it is pressed without Shift. E.g. in standard US keyboard layout the untranslated key code for the key <code>=/+</code> in the upper right corner of the keyboard is 61 which is the ASCII value of <code>=</code>.- For the rest of the keys (i.e. special non-printable keys) it is the same as the normal key code as no translation is used anyhow.
|
932
936
|
#
|
933
|
-
# Notice that the first rule applies to all Unicode letters, not just the usual Latin-1 ones. However for non-Latin-1 letters only {Wx::KeyEvent#get_unicode_key} can be used to retrieve the key code as {Wx::KeyEvent#get_key_code} just returns
|
937
|
+
# Notice that the first rule applies to all Unicode letters, not just the usual Latin-1 ones. However for non-Latin-1 letters only {Wx::KeyEvent#get_unicode_key} can be used to retrieve the key code as {Wx::KeyEvent#get_key_code} just returns {Wx::K_NONE} in this case.
|
934
938
|
# Also, note that {Wx::EVT_CHAR} events are not generated for keys which do not have a wxWidgets mapping, so {Wx::KeyEvent#get_raw_key_code} should never be required for this event.
|
935
939
|
# To summarize: you should handle {Wx::EVT_CHAR} if you need the translated key and {Wx::EVT_KEY_DOWN} if you only need the value of the key itself, independent of the current keyboard state.
|
936
940
|
# Not all key down events may be generated by the user. As an example, {Wx::EVT_KEY_DOWN} with <code>=</code> key code can be generated using the standard US keyboard layout but not using the German one because the <code>=</code> key corresponds to Shift-0 key combination in this layout and the key code for it is 0, not <code>=</code>. Because of this you should avoid requiring your users to type key events that might be impossible to enter on their keyboard.
|
937
941
|
#
|
938
|
-
# Another difference between key and char events is that another kind of translation is done for the latter ones when the Control key is pressed: char events for ASCII letters in this case carry codes corresponding to the ASCII value of Ctrl-Latter, i.e. 1 for Ctrl-A, 2 for Ctrl-B and so on until 26 for Ctrl-Z. This is convenient for terminal-like applications and can be completely ignored by all the other ones (if you need to handle Ctrl-A it is probably a better idea to use the key event rather than the char one). Notice that currently no translation is done for the presses of <code></code>[, <code>\</code>, <code></code>], <code>^</code> and _ keys which might be mapped to ASCII values from 27 to 31. Since version 2.9.2, the enum values
|
939
|
-
# Finally, modifier keys only generate key events but no char events at all. The modifiers keys are
|
942
|
+
# Another difference between key and char events is that another kind of translation is done for the latter ones when the Control key is pressed: char events for ASCII letters in this case carry codes corresponding to the ASCII value of Ctrl-Latter, i.e. 1 for Ctrl-A, 2 for Ctrl-B and so on until 26 for Ctrl-Z. This is convenient for terminal-like applications and can be completely ignored by all the other ones (if you need to handle Ctrl-A it is probably a better idea to use the key event rather than the char one). Notice that currently no translation is done for the presses of <code></code>[, <code>\</code>, <code></code>], <code>^</code> and _ keys which might be mapped to ASCII values from 27 to 31. Since version 2.9.2, the enum values {Wx::K_CONTROL}_A - {Wx::K_CONTROL}_Z can be used instead of the non-descriptive constant values 1-26.
|
943
|
+
# Finally, modifier keys only generate key events but no char events at all. The modifiers keys are {Wx::K_SHIFT}, {Wx::K_CONTROL}, {Wx::K_ALT} and various {Wx::K_WINDOWS}_XXX from {Wx::KeyCode} enum.
|
940
944
|
# Modifier keys events are special in one additional aspect: usually the keyboard state associated with a key press is well defined, e.g. {Wx::KeyboardState#shift_down} returns true only if the Shift key was held pressed when the key that generated this event itself was pressed. There is an ambiguity for the key press events for Shift key itself however. By convention, it is considered to be already pressed when it is pressed and already released when it is released. In other words, {Wx::EVT_KEY_DOWN} event for the Shift key itself will have {Wx::KeyModifier::MOD_SHIFT} in {Wx::KeyEvent#get_modifiers} and {Wx::KeyEvent#shift_down} will return true while the {Wx::EVT_KEY_UP} event for Shift itself will not have {Wx::KeyModifier::MOD_SHIFT} in its modifiers and {Wx::KeyEvent#shift_down} will return false.
|
941
945
|
# <b>Tip:</b> You may discover the key codes and modifiers generated by all the keys on your system interactively by running the Key Event Sample wxWidgets sample and pressing some keys in it.
|
942
946
|
# If a key down (EVT_KEY_DOWN) event is caught and the event handler does not call <code>event.Skip()</code> then the corresponding char event (EVT_CHAR) will not happen. This is by design and enables the programs that handle both types of events to avoid processing the same key twice. As a consequence, if you do not want to suppress the {Wx::EVT_CHAR} events for the keys you handle, always call <code>event.Skip()</code> in your {Wx::EVT_KEY_DOWN} handler. Not doing may also prevent accelerators defined using this key from working.
|
@@ -976,44 +980,34 @@ module Wx
|
|
976
980
|
def initialize(keyEventType=Wx::EVT_NULL) end
|
977
981
|
|
978
982
|
# Returns the key code of the key that generated this event.
|
979
|
-
# ASCII symbols return normal ASCII values, while events from special keys such as "left cursor arrow" (
|
980
|
-
# Note that this method returns a meaningful value only for special non-alphanumeric keys or if the user entered a Latin-1 character (this includes ASCII and the accented letters found in Western European languages but not letters of other alphabets such as e.g. Cyrillic). Otherwise it simply method returns
|
981
|
-
# Using {Wx::KeyEvent#get_unicode_key} is in general the right thing to do if you are interested in the characters typed by the user, {Wx::KeyEvent#get_key_code} should be only used for special keys (for which {Wx::KeyEvent#get_unicode_key} returns
|
983
|
+
# ASCII symbols return normal ASCII values, while events from special keys such as "left cursor arrow" ({Wx::K_LEFT}) return values outside of the ASCII range. See {Wx::KeyCode} for a full list of the virtual key codes.
|
984
|
+
# Note that this method returns a meaningful value only for special non-alphanumeric keys or if the user entered a Latin-1 character (this includes ASCII and the accented letters found in Western European languages but not letters of other alphabets such as e.g. Cyrillic). Otherwise it simply method returns {Wx::K_NONE} and {Wx::KeyEvent#get_unicode_key} should be used to obtain the corresponding Unicode character.
|
985
|
+
# Using {Wx::KeyEvent#get_unicode_key} is in general the right thing to do if you are interested in the characters typed by the user, {Wx::KeyEvent#get_key_code} should be only used for special keys (for which {Wx::KeyEvent#get_unicode_key} returns nil). To handle both kinds of keys you might write:
|
986
|
+
# ```ruby
|
987
|
+
# def on_char(event)
|
988
|
+
# uc = event.get_unicode_key
|
989
|
+
# if uc
|
990
|
+
# # It's a "normal" character. Notice that this includes
|
991
|
+
# # control characters in 1..31 range, e.g. Wx::K_RETURN or
|
992
|
+
# # Wx::K_BACK, so check for them explicitly.
|
993
|
+
# if uc.ord >= 32
|
994
|
+
# Wx.log_message("You pressed '#{uc}'")
|
995
|
+
# else
|
996
|
+
# # It's a control character
|
997
|
+
# ...
|
998
|
+
# end
|
999
|
+
# else # No Unicode equivalent.
|
1000
|
+
# # It's a special key, deal with all the known ones:
|
1001
|
+
# case event.get_key_code
|
1002
|
+
# when Wx::K_LEFT, Wx::K_RIGHT
|
1003
|
+
# ... move cursor ...
|
982
1004
|
#
|
983
|
-
#
|
984
|
-
#
|
985
|
-
#
|
986
|
-
#
|
987
|
-
#
|
988
|
-
#
|
989
|
-
# // control characters in 1..31 range, e.g. WXK_RETURN or
|
990
|
-
# // WXK_BACK, so check for them explicitly.
|
991
|
-
# if ( uc >= 32 )
|
992
|
-
# {
|
993
|
-
# wxLogMessage("You pressed '%c'", uc);
|
994
|
-
# }
|
995
|
-
# else
|
996
|
-
# {
|
997
|
-
# // It's a control character
|
998
|
-
# ...
|
999
|
-
# }
|
1000
|
-
# }
|
1001
|
-
# else // No Unicode equivalent.
|
1002
|
-
# {
|
1003
|
-
# // It's a special key, deal with all the known ones:
|
1004
|
-
# switch ( event.GetKeyCode() )
|
1005
|
-
# {
|
1006
|
-
# case WXK_LEFT:
|
1007
|
-
# case WXK_RIGHT:
|
1008
|
-
# ... move cursor ...
|
1009
|
-
# break;
|
1010
|
-
#
|
1011
|
-
# case WXK_F1:
|
1012
|
-
# ... give help ...
|
1013
|
-
# break;
|
1014
|
-
# }
|
1015
|
-
# }
|
1016
|
-
# }
|
1005
|
+
# when Wx::K_F1:
|
1006
|
+
# ... give help ...
|
1007
|
+
# end
|
1008
|
+
# end
|
1009
|
+
# end
|
1010
|
+
# ```
|
1017
1011
|
# @return [Integer]
|
1018
1012
|
def get_key_code; end
|
1019
1013
|
alias_method :key_code, :get_key_code
|
@@ -1050,7 +1044,7 @@ module Wx
|
|
1050
1044
|
alias_method :raw_key_flags, :get_raw_key_flags
|
1051
1045
|
|
1052
1046
|
# Returns the Unicode character corresponding to this key event.
|
1053
|
-
# If the key pressed doesn't have any character value (e.g. a cursor key) this method will return
|
1047
|
+
# If the key pressed doesn't have any character value (e.g. a cursor key) this method will return nil. In this case you should use {Wx::KeyEvent#get_key_code} to retrieve the value of the key.
|
1054
1048
|
# This function is only available in Unicode build, i.e. when {Wx::Setup::USE_UNICODE} is 1.
|
1055
1049
|
# @return [String]
|
1056
1050
|
def get_unicode_key; end
|
@@ -1086,13 +1080,17 @@ module Wx
|
|
1086
1080
|
# The return value is a combination of {Wx::KeyModifier::MOD_ALT}, {Wx::KeyModifier::MOD_CONTROL}, {Wx::KeyModifier::MOD_SHIFT} and {Wx::KeyModifier::MOD_META} bit masks. Additionally, {Wx::KeyModifier::MOD_NONE} is defined as 0, i.e. corresponds to no modifiers (see {Wx::KeyEvent#has_any_modifiers}) and {Wx::KeyModifier::MOD_CMD} is either {Wx::KeyModifier::MOD_CONTROL} (MSW and Unix) or {Wx::KeyModifier::MOD_META} (Mac), see {Wx::KeyEvent#cmd_down}. See {Wx::KeyModifier} for the full list of modifiers.
|
1087
1081
|
# Notice that this function is easier to use correctly than, for example, {Wx::KeyEvent#control_down} because when using the latter you also have to remember to test that none of the other modifiers is pressed:
|
1088
1082
|
#
|
1089
|
-
#
|
1090
|
-
#
|
1083
|
+
# ```ruby
|
1084
|
+
# if event.control_down && !event.alt_down && !event.shift_down && !event.meta_down
|
1085
|
+
# # ... handle Ctrl-XXX ...
|
1086
|
+
# ```
|
1091
1087
|
#
|
1092
1088
|
# and forgetting to do it can result in serious program bugs (e.g. program not working with European keyboard layout where AltGr key which is seen by the program as combination of CTRL and ALT is used). On the other hand, you can simply write:
|
1093
1089
|
#
|
1094
|
-
#
|
1095
|
-
#
|
1090
|
+
# ```ruby
|
1091
|
+
# if event.get_modifiers == Wx::KeyModifier::MOD_CONTROL
|
1092
|
+
# # ... handle Ctrl-XXX ...
|
1093
|
+
# ```
|
1096
1094
|
#
|
1097
1095
|
# with this function.
|
1098
1096
|
# @return [Integer]
|
@@ -1273,45 +1271,38 @@ module Wx
|
|
1273
1271
|
|
1274
1272
|
# A paint event is sent when a window's contents needs to be repainted.
|
1275
1273
|
# The handler of this event must create a {Wx::PaintDC} object and use it for painting the window contents. For example:
|
1276
|
-
#
|
1277
|
-
#
|
1278
|
-
#
|
1279
|
-
#
|
1280
|
-
#
|
1281
|
-
#
|
1282
|
-
#
|
1274
|
+
# ```ruby
|
1275
|
+
# def on_paint(event)
|
1276
|
+
# self.pain do |dc|
|
1277
|
+
# draw_my_document(dc)
|
1278
|
+
# end
|
1279
|
+
# end
|
1280
|
+
# ```
|
1283
1281
|
#
|
1284
1282
|
# Notice that you must not create other kinds of {Wx::DC} (e.g. {Wx::ClientDC} or {Wx::WindowDC}) in EVT_PAINT handlers and also don't create {Wx::PaintDC} outside of this event handlers.
|
1285
1283
|
# You can optimize painting by retrieving the rectangles that have been damaged and only repainting these. The rectangles are in terms of the client area, and are unscrolled, so you will need to do some calculations using the current view position to obtain logical, scrolled units. Here is an example of using the {Wx::RegionIterator} class:
|
1286
|
-
#
|
1287
|
-
#
|
1288
|
-
#
|
1289
|
-
#
|
1290
|
-
#
|
1291
|
-
#
|
1292
|
-
#
|
1293
|
-
#
|
1294
|
-
#
|
1295
|
-
#
|
1296
|
-
#
|
1297
|
-
#
|
1298
|
-
#
|
1299
|
-
#
|
1300
|
-
#
|
1301
|
-
#
|
1302
|
-
#
|
1303
|
-
#
|
1304
|
-
#
|
1305
|
-
#
|
1306
|
-
#
|
1307
|
-
#
|
1308
|
-
#
|
1309
|
-
# // Repaint this rectangle
|
1310
|
-
# ...some code...
|
1311
|
-
#
|
1312
|
-
# upd ++ ;
|
1313
|
-
# }
|
1314
|
-
# }
|
1284
|
+
# ```ruby
|
1285
|
+
# # Called when window needs to be repainted.
|
1286
|
+
# def on_paint(event)
|
1287
|
+
# self.paint do |dc|
|
1288
|
+
# # Find Out where the window has scrolled to
|
1289
|
+
# vb_pt = get_view_start # Top left corner of client
|
1290
|
+
#
|
1291
|
+
# Wx::RegionIterator.for_region(get_update_region) do |region_it|
|
1292
|
+
#
|
1293
|
+
# int vX,vY,vW,vH
|
1294
|
+
# wxRegionIterator upd(GetUpdateRegion()) # get the update rect list
|
1295
|
+
#
|
1296
|
+
# region_it.each do |rct|
|
1297
|
+
# # rct == Dimensions of client area to repaint in pixels
|
1298
|
+
#
|
1299
|
+
# # Repaint this rectangle
|
1300
|
+
# ...some code...
|
1301
|
+
# end
|
1302
|
+
# end
|
1303
|
+
# end
|
1304
|
+
# end
|
1305
|
+
# ```
|
1315
1306
|
#
|
1316
1307
|
# Please notice that in general it is impossible to change the drawing of a standard control (such as {Wx::Button}) and so you shouldn't attempt to handle paint events for them as even if it might work on some platforms, this is inherently not portable and won't work everywhere.
|
1317
1308
|
#
|
@@ -1447,9 +1438,9 @@ module Wx
|
|
1447
1438
|
# @param eventType [Integer]
|
1448
1439
|
# @param active [true,false]
|
1449
1440
|
# @param id [Integer]
|
1450
|
-
# @param
|
1441
|
+
# @param activationReason [Reason]
|
1451
1442
|
# @return [ActivateEvent]
|
1452
|
-
def initialize(eventType=Wx::EVT_NULL, active=true, id=0,
|
1443
|
+
def initialize(eventType=Wx::EVT_NULL, active=true, id=0, activationReason=Wx::ActivateEvent::Reason::Reason_Unknown) end
|
1453
1444
|
|
1454
1445
|
# Returns true if the application or window is being activated, false otherwise.
|
1455
1446
|
# @return [true,false]
|
@@ -1549,22 +1540,21 @@ module Wx
|
|
1549
1540
|
# If you don't destroy the window, you should call {Wx::CloseEvent#veto} to let the calling code know that you did not destroy the window. This allows the {Wx::Window#close} function to return true or false depending on whether the close instruction was honoured or not.
|
1550
1541
|
# Example of a {Wx::CloseEvent} handler:
|
1551
1542
|
#
|
1552
|
-
#
|
1553
|
-
#
|
1554
|
-
#
|
1555
|
-
#
|
1556
|
-
#
|
1557
|
-
#
|
1558
|
-
#
|
1559
|
-
#
|
1560
|
-
#
|
1561
|
-
#
|
1562
|
-
# }
|
1563
|
-
# }
|
1543
|
+
# ```ruby
|
1544
|
+
# def on_close(event)
|
1545
|
+
# if event.can_veto? && @file_not_saved
|
1546
|
+
# if Wx.message_box("The file has not been saved... continue closing?",
|
1547
|
+
# "Please confirm",
|
1548
|
+
# Wx::ICON_QUESTION | Wx::YES_NO) != Wx::YES)
|
1549
|
+
# event.veto
|
1550
|
+
# return
|
1551
|
+
# end
|
1552
|
+
# end
|
1564
1553
|
#
|
1565
|
-
#
|
1566
|
-
#
|
1567
|
-
#
|
1554
|
+
# destroy # you may also do: event.skip
|
1555
|
+
# # since the default event handler does call #destroy too
|
1556
|
+
# end
|
1557
|
+
# ```
|
1568
1558
|
#
|
1569
1559
|
# See also <code>samples/dialogs</code> for a full example of interrupting closing an application when there are e.g. unsaved files.
|
1570
1560
|
# The EVT_END_SESSION event is slightly different as it is sent by the system when the user session is ending (e.g. because of log out or shutdown) and so all windows are being forcefully closed. At least under MSW, after the handler for this event is executed the program is simply killed by the system. Because of this, the default handler for this event provided by wxWidgets calls all the usual cleanup code (including {Wx::App#on_exit}) so that it could still be executed and exit()s the process itself, without waiting for being killed. If this behaviour is for some reason undesirable, make sure that you define a handler for this event in your {Wx::App}-derived class and do not call <code>event.Skip()</code> in it (but be aware that the system will still kill your application).
|
@@ -1796,8 +1786,9 @@ module Wx
|
|
1796
1786
|
|
1797
1787
|
# Returns the identifier of the button changing state.
|
1798
1788
|
# The return value is
|
1799
|
-
#
|
1789
|
+
# ```
|
1800
1790
|
# 1 << n
|
1791
|
+
# ```
|
1801
1792
|
# where n is the index of the button changing state, which can also be retrieved using {Wx::JoystickEvent#get_button_ordinal}.
|
1802
1793
|
# Note that for n equal to 1, 2, 3 or 4 there are predefined {Wx::JOY_BUTTONn} constants which can be used for more clarity, however these constants are not defined for the buttons beyond the first four.
|
1803
1794
|
# @return [Integer]
|
@@ -1949,13 +1940,13 @@ module Wx
|
|
1949
1940
|
|
1950
1941
|
# Returns true if the UI element can be checked.
|
1951
1942
|
# For the event handlers that can be used for multiple items, not all of which can be checked, this method can be useful to determine whether to call {Wx::UpdateUIEvent#check} on the event object or not, i.e. the main use case for this method is:
|
1952
|
-
#
|
1953
|
-
#
|
1954
|
-
#
|
1955
|
-
#
|
1956
|
-
#
|
1957
|
-
#
|
1958
|
-
#
|
1943
|
+
# ```ruby
|
1944
|
+
# def on_update_ui(event)
|
1945
|
+
# ....
|
1946
|
+
# if event.is_checkable
|
1947
|
+
# event.check(...some condition...)
|
1948
|
+
# end
|
1949
|
+
# ```
|
1959
1950
|
# @return [true,false]
|
1960
1951
|
def is_checkable; end
|
1961
1952
|
alias_method :checkable?, :is_checkable
|
@@ -21,30 +21,7 @@ module Wx
|
|
21
21
|
|
22
22
|
# Queue event for a later processing.
|
23
23
|
# This method is similar to {Wx::EvtHandler#process_event} but while the latter is synchronous, i.e. the event is processed immediately, before the function returns, this one is asynchronous and returns immediately while the event will be processed at some later time (usually during the next event loop iteration).
|
24
|
-
# Another important difference is that this method takes ownership of the event parameter, i.e. it will delete it itself. This implies that the
|
25
|
-
# {Wx::EvtHandler#queue_event} can be used for inter-thread communication from the worker threads to the main thread, it is safe in the sense that it uses locking internally and avoids the problem mentioned in {Wx::EvtHandler#add_pending_event} documentation by ensuring that the event object is not used by the calling thread any more. Care should still be taken to avoid that some fields of this object are used by it, notably any {Wx::String} members of the event object must not be shallow copies of another {Wx::String} object as this would result in them still using the same string buffer behind the scenes. For example:
|
26
|
-
#
|
27
|
-
# void FunctionInAWorkerThread(const wxString& str)
|
28
|
-
# {
|
29
|
-
# wxCommandEvent* evt = new wxCommandEvent;
|
30
|
-
#
|
31
|
-
# // NOT evt->SetString(str) as this would be a shallow copy
|
32
|
-
# evt->SetString(str.c_str()); // make a deep copy
|
33
|
-
#
|
34
|
-
# wxTheApp->QueueEvent( evt );
|
35
|
-
# }
|
36
|
-
#
|
37
|
-
# Note that you can use {Wx::ThreadEvent} instead of {Wx::CommandEvent} to avoid this problem:
|
38
|
-
#
|
39
|
-
# void FunctionInAWorkerThread(const wxString& str)
|
40
|
-
# {
|
41
|
-
# wxThreadEvent evt;
|
42
|
-
# evt.SetString(str);
|
43
|
-
#
|
44
|
-
# // wxThreadEvent::Clone() makes sure that the internal wxString
|
45
|
-
# // member is not shared by other wxString instances:
|
46
|
-
# wxTheApp->QueueEvent( evt.Clone() );
|
47
|
-
# }
|
24
|
+
# Another important difference is that this method takes ownership of the event parameter, i.e. it will delete it itself. This implies that the pointer can't be used any more after the function returns (as it can be deleted at any moment).
|
48
25
|
#
|
49
26
|
# Finally notice that this method automatically wakes up the event loop if it is currently idle by calling {wake_up_idle} so there is no need to do it manually when using it.
|
50
27
|
# @param event [Wx::Event] A heap-allocated event to be queued, {Wx::EvtHandler#queue_event} takes ownership of it. This parameter shouldn't be NULL.
|
@@ -126,9 +103,10 @@ module Wx
|
|
126
103
|
|
127
104
|
# Sets the pointer to the next handler.
|
128
105
|
# See {Wx::EvtHandler#process_event} for more info about how the chains of event handlers are internally used. Also remember that {Wx::EvtHandler} uses double-linked lists and thus if you use this function, you should also call {Wx::EvtHandler#set_previous_handler} on the argument passed to this function:
|
129
|
-
#
|
130
|
-
# handlerA
|
131
|
-
# handlerB
|
106
|
+
# ```ruby
|
107
|
+
# handlerA.set_next_handler(handlerB)
|
108
|
+
# handlerB.set_previous_handler(handlerA)
|
109
|
+
# ```
|
132
110
|
# @see How Events are Processed
|
133
111
|
# @param handler [Wx::EvtHandler] The event handler to be set as the next handler. Cannot be NULL.
|
134
112
|
# @return [void]
|
@@ -159,13 +137,13 @@ module Wx
|
|
159
137
|
|
160
138
|
# Add an event filter whose FilterEvent() method will be called for each and every event processed by wxWidgets.
|
161
139
|
# The filters are called in LIFO order and {Wx::App} is registered as an event filter by default. The pointer must remain valid until it's removed with {Wx::EvtHandler.remove_filter} and is not deleted by {Wx::EvtHandler}.
|
162
|
-
# @param filter [Wx::EventFilter]
|
140
|
+
# @param filter [Wx::EventFilter,Wx::App]
|
163
141
|
# @return [void]
|
164
142
|
def self.add_filter(filter) end
|
165
143
|
|
166
144
|
# Remove a filter previously installed with {Wx::EvtHandler.add_filter}.
|
167
145
|
# It's an error to remove a filter that hadn't been previously added or was already removed.
|
168
|
-
# @param filter [Wx::EventFilter]
|
146
|
+
# @param filter [Wx::EventFilter,Wx::App]
|
169
147
|
# @return [void]
|
170
148
|
def self.remove_filter(filter) end
|
171
149
|
|
@@ -179,19 +157,18 @@ module Wx
|
|
179
157
|
# Method called by {Wx::EvtHandler#process_event} before examining this object event tables.
|
180
158
|
# This method can be overridden to hook into the event processing logic as early as possible. You should usually call the base class version when overriding this method, even if {Wx::EvtHandler} itself does nothing here, some derived classes do use this method, e.g. {Wx::Window} implements support for {Wx::Validator} in it.
|
181
159
|
# Example:
|
182
|
-
#
|
183
|
-
# class MyClass
|
184
|
-
# {
|
160
|
+
# ```ruby
|
161
|
+
# class MyClass < BaseClass # inheriting from Wx::EvtHandler
|
185
162
|
# ...
|
186
|
-
# protected
|
187
|
-
#
|
188
|
-
#
|
189
|
-
#
|
190
|
-
# return true;
|
163
|
+
# protected
|
164
|
+
# def try_before(event)
|
165
|
+
# if my_pre_process(event)
|
166
|
+
# return true
|
191
167
|
#
|
192
|
-
#
|
193
|
-
#
|
194
|
-
#
|
168
|
+
# super
|
169
|
+
# end
|
170
|
+
# end
|
171
|
+
# ```
|
195
172
|
# @see Wx::EvtHandler#process_event
|
196
173
|
# @param event [Wx::Event]
|
197
174
|
# @return [true,false]
|
@@ -200,19 +177,18 @@ module Wx
|
|
200
177
|
# Method called by {Wx::EvtHandler#process_event} as last resort.
|
201
178
|
# This method can be overridden to implement post-processing for the events which were not processed anywhere else.
|
202
179
|
# The base class version handles forwarding the unprocessed events to {Wx::App} at {Wx::EvtHandler} level and propagating them upwards the window child-parent chain at {Wx::Window} level and so should usually be called when overriding this method:
|
203
|
-
#
|
204
|
-
# class MyClass
|
205
|
-
# {
|
180
|
+
# ```ruby
|
181
|
+
# class MyClass < BaseClass # inheriting from Wx::EvtHandler
|
206
182
|
# ...
|
207
|
-
# protected
|
208
|
-
#
|
209
|
-
#
|
210
|
-
#
|
211
|
-
#
|
212
|
-
#
|
213
|
-
#
|
214
|
-
#
|
215
|
-
#
|
183
|
+
# protected
|
184
|
+
# def try_after(event)
|
185
|
+
# if super
|
186
|
+
# return true
|
187
|
+
#
|
188
|
+
# my_post_process(event)
|
189
|
+
# end
|
190
|
+
# end
|
191
|
+
# ```
|
216
192
|
# @see Wx::EvtHandler#process_event
|
217
193
|
# @param event [Wx::Event]
|
218
194
|
# @return [true,false]
|