# All classes which are capable of handling events inherit from # EvtHandler. This includes all Wx::Window subclasses and Wx::App. class Wx::EvtHandler # EventType is an internal class that's used to set up event handlers # and mappings. # * 'name' is the name of the event handler method in ruby # * 'arity' is the number of id arguments that method should accept # * 'const' is the Wx EventType constant that identifies the event # * 'evt_class' is the WxRuby event class which is passed to the event # handler block # # NB: Some event types currently pass a Wx::Event into the event # handler block; when the appropriate classes are added to wxRuby, the # binding can be updated here. EventType = Struct.new(:name, :arity, :const, :evt_class) # Fast look-up hash to map event type ids to ruby event classes EVENT_TYPE_MAPPING = {} # Given a Wx EventType id (eg Wx::EVT_MENU), returns a WxRuby Event # class which should be passed to event handler blocks. The actual # EVT_XXX constants themselves are in the compiled library, defined in # swig/classes/Event.i def self.event_class_for_type(id) if evt_klass = EVENT_TYPE_MAPPING[id] return evt_klass else warn "No event class defined for event type #{id}" return Wx::Event end end # Public method to register the mapping of a custom event type # +konstant+ (which should be a unique integer; one will be created if # not supplied) to a custom event class +klass+. If +meth+ and +arity+ # are given, a convenience evt_handler method called +meth+ will be # created, which accepts +arity+ arguments. def self.register_class( klass, konstant = nil, meth = nil, arity = nil) konstant ||= Wx::Event.new_event_type unless klass < Wx::Event Kernel.raise TypeError, "Event class should be a subclass of Wx::Event" end ev_type = EventType.new(meth, arity, konstant, klass) register_event_type(ev_type) return konstant end # Registers the event type +ev_type+, which should be an instance of # the Struct class +Wx::EvtHandler::EventType+. def self.register_event_type(ev_type) EVENT_TYPE_MAPPING[ev_type.const] = ev_type.evt_class unless ev_type.arity and ev_type.name return end case ev_type.arity when 0 # events without an id class_eval %Q| def #{ev_type.name}(&block) connect(Wx::ID_ANY, Wx::ID_ANY, #{ev_type.const}, &block) end | when 1 # events with an id class_eval %Q| def #{ev_type.name}(id, &block) connect(id, Wx::ID_ANY, #{ev_type.const}, &block) end | when 2 # events with id range class_eval %Q| def #{ev_type.name}(first_id, last_id, &block) connect(first_id, last_id, #{ev_type.const}, &block) end | end end EVENT_DEFINITIONS = [ EventType['evt_activate', 0, Wx::EVT_ACTIVATE, Wx::ActivateEvent], EventType['evt_activate_app', 0, Wx::EVT_ACTIVATE_APP, Wx::ActivateEvent], EventType['evt_auinotebook_allow_dnd', 1, Wx::EVT_COMMAND_AUINOTEBOOK_ALLOW_DND, Wx::AuiNotebookEvent], EventType['evt_auinotebook_begin_drag', 1, Wx::EVT_COMMAND_AUINOTEBOOK_BEGIN_DRAG, Wx::AuiNotebookEvent], EventType['evt_auinotebook_button', 1, Wx::EVT_COMMAND_AUINOTEBOOK_BUTTON, Wx::AuiNotebookEvent], EventType['evt_auinotebook_drag_motion', 1, Wx::EVT_COMMAND_AUINOTEBOOK_DRAG_MOTION, Wx::AuiNotebookEvent], EventType['evt_auinotebook_end_drag', 1, Wx::EVT_COMMAND_AUINOTEBOOK_END_DRAG, Wx::AuiNotebookEvent], EventType['evt_auinotebook_page_changed', 1, Wx::EVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, Wx::AuiNotebookEvent], EventType['evt_auinotebook_page_changing', 1, Wx::EVT_COMMAND_AUINOTEBOOK_PAGE_CHANGING, Wx::AuiNotebookEvent], EventType['evt_auinotebook_page_close', 1, Wx::EVT_COMMAND_AUINOTEBOOK_PAGE_CLOSE, Wx::AuiNotebookEvent], EventType['evt_aui_find_manager', 0, Wx::EVT_AUI_FIND_MANAGER, Wx::AuiManagerEvent], EventType['evt_aui_pane_button', 0, Wx::EVT_AUI_PANE_BUTTON, Wx::AuiManagerEvent], EventType['evt_aui_pane_close', 0, Wx::EVT_AUI_PANE_CLOSE, Wx::AuiManagerEvent], EventType['evt_aui_pane_maximize', 0, Wx::EVT_AUI_PANE_MAXIMIZE, Wx::AuiManagerEvent], EventType['evt_aui_pane_restore', 0, Wx::EVT_AUI_PANE_RESTORE, Wx::AuiManagerEvent], EventType['evt_aui_render', 0, Wx::EVT_AUI_RENDER, Wx::AuiManagerEvent], EventType['evt_button', 1, Wx::EVT_COMMAND_BUTTON_CLICKED, Wx::CommandEvent], EventType['evt_calculate_layout', 0, Wx::EVT_CALCULATE_LAYOUT, Wx::Event], EventType['evt_calendar', 1, Wx::EVT_CALENDAR_DOUBLECLICKED, Wx::CalendarEvent], EventType['evt_calendar_day', 1, Wx::EVT_CALENDAR_DAY_CHANGED, Wx::CalendarEvent], EventType['evt_calendar_month', 1, Wx::EVT_CALENDAR_MONTH_CHANGED, Wx::CalendarEvent], EventType['evt_calendar_sel_changed', 1, Wx::EVT_CALENDAR_SEL_CHANGED, Wx::CalendarEvent], EventType['evt_calendar_weekday_clicked', 1, Wx::EVT_CALENDAR_WEEKDAY_CLICKED, Wx::CalendarEvent], EventType['evt_calendar_year', 1, Wx::EVT_CALENDAR_YEAR_CHANGED, Wx::CalendarEvent], EventType['evt_char', 0, Wx::EVT_CHAR, Wx::KeyEvent], EventType['evt_char_hook', 0, Wx::EVT_CHAR_HOOK, Wx::KeyEvent], EventType['evt_checkbox', 1, Wx::EVT_COMMAND_CHECKBOX_CLICKED, Wx::CommandEvent], EventType['evt_checklistbox', 1, Wx::EVT_COMMAND_CHECKLISTBOX_TOGGLED, Wx::CommandEvent], EventType['evt_child_focus', 0, Wx::EVT_CHILD_FOCUS, Wx::ChildFocusEvent], EventType['evt_choice', 1, Wx::EVT_COMMAND_CHOICE_SELECTED, Wx::CommandEvent], EventType['evt_choicebook_page_changed', 1, Wx::EVT_COMMAND_CHOICEBOOK_PAGE_CHANGED, Wx::ChoicebookEvent], EventType['evt_choicebook_page_changing', 1, Wx::EVT_COMMAND_CHOICEBOOK_PAGE_CHANGING, Wx::ChoicebookEvent], EventType['evt_close', 0, Wx::EVT_CLOSE_WINDOW, Wx::CloseEvent], EventType['evt_combobox', 1, Wx::EVT_COMMAND_COMBOBOX_SELECTED, Wx::CommandEvent], EventType['evt_command', 0, Wx::EVT_NULL, Wx::Event], EventType['evt_command_enter', 1, Wx::EVT_COMMAND_ENTER, Wx::Event], EventType['evt_command_kill_focus', 1, Wx::EVT_COMMAND_KILL_FOCUS, Wx::Event], EventType['evt_command_left_click', 1, Wx::EVT_COMMAND_LEFT_CLICK, Wx::Event], EventType['evt_command_left_dclick', 1, Wx::EVT_COMMAND_LEFT_DCLICK, Wx::Event], EventType['evt_command_range', 2, Wx::EVT_NULL, Wx::Event], EventType['evt_command_right_click', 1, Wx::EVT_COMMAND_RIGHT_CLICK, Wx::Event], EventType['evt_command_set_focus', 1, Wx::EVT_COMMAND_SET_FOCUS, Wx::Event], EventType['evt_context_menu', 0, Wx::EVT_CONTEXT_MENU, Wx::ContextMenuEvent], EventType['evt_drop_files', 0, Wx::EVT_DROP_FILES, Wx::Event], EventType['evt_end_process', 1, Wx::EVT_END_PROCESS, Wx::Event], EventType['evt_end_session', 0, Wx::EVT_END_SESSION, Wx::Event], EventType['evt_enter_window', 0, Wx::EVT_ENTER_WINDOW, Wx::MouseEvent], EventType['evt_erase_background', 0, Wx::EVT_ERASE_BACKGROUND, Wx::EraseEvent], EventType['evt_find', 1, Wx::EVT_COMMAND_FIND, Wx::FindDialogEvent], EventType['evt_find_close', 1, Wx::EVT_COMMAND_FIND_CLOSE, Wx::FindDialogEvent], EventType['evt_find_next', 1, Wx::EVT_COMMAND_FIND_NEXT, Wx::FindDialogEvent], EventType['evt_find_replace', 1, Wx::EVT_COMMAND_FIND_REPLACE, Wx::FindDialogEvent], EventType['evt_find_replace_all', 1, Wx::EVT_COMMAND_FIND_REPLACE_ALL, Wx::FindDialogEvent], EventType['evt_grid_cell_change', 0, Wx::EVT_GRID_CELL_CHANGE, Wx::GridEvent], EventType['evt_grid_cell_left_click', 0, Wx::EVT_GRID_CELL_LEFT_CLICK, Wx::GridEvent], EventType['evt_grid_cell_left_dclick', 0, Wx::EVT_GRID_CELL_LEFT_DCLICK, Wx::GridEvent], EventType['evt_grid_cell_right_click', 0, Wx::EVT_GRID_CELL_RIGHT_CLICK, Wx::GridEvent], EventType['evt_grid_cell_right_dclick', 0, Wx::EVT_GRID_CELL_RIGHT_DCLICK, Wx::GridEvent], EventType['evt_grid_cmd_cell_change', 1, Wx::EVT_GRID_CELL_CHANGE, Wx::GridEvent], EventType['evt_grid_cmd_cell_left_click', 1, Wx::EVT_GRID_CELL_LEFT_CLICK, Wx::GridEvent], EventType['evt_grid_cmd_cell_left_dclick', 1, Wx::EVT_GRID_CELL_LEFT_DCLICK, Wx::GridEvent], EventType['evt_grid_cmd_cell_right_click', 1, Wx::EVT_GRID_CELL_RIGHT_CLICK, Wx::GridEvent], EventType['evt_grid_cmd_cell_right_dclick', 1, Wx::EVT_GRID_CELL_RIGHT_DCLICK, Wx::GridEvent], EventType['evt_grid_cmd_col_size', 1, Wx::EVT_GRID_COL_SIZE, Wx::GridSizeEvent], EventType['evt_grid_cmd_editor_created', 1, Wx::EVT_GRID_EDITOR_CREATED, Wx::GridEditorCreatedEvent], EventType['evt_grid_cmd_editor_hidden', 1, Wx::EVT_GRID_EDITOR_HIDDEN, Wx::GridEvent], EventType['evt_grid_cmd_editor_shown', 1, Wx::EVT_GRID_EDITOR_SHOWN, Wx::GridEvent], EventType['evt_grid_cmd_label_left_click', 1, Wx::EVT_GRID_LABEL_LEFT_CLICK, Wx::GridEvent], EventType['evt_grid_cmd_label_left_dclick', 1, Wx::EVT_GRID_LABEL_LEFT_DCLICK, Wx::GridEvent], EventType['evt_grid_cmd_label_right_click', 1, Wx::EVT_GRID_LABEL_RIGHT_CLICK, Wx::GridEvent], EventType['evt_grid_cmd_label_right_dclick', 1, Wx::EVT_GRID_LABEL_RIGHT_DCLICK, Wx::GridEvent], EventType['evt_grid_cmd_range_select', 1, Wx::EVT_GRID_RANGE_SELECT, Wx::GridRangeSelectEvent], EventType['evt_grid_cmd_row_size', 1, Wx::EVT_GRID_ROW_SIZE, Wx::GridSizeEvent], EventType['evt_grid_cmd_select_cell', 1, Wx::EVT_GRID_SELECT_CELL, Wx::GridEvent], EventType['evt_grid_col_size', 0, Wx::EVT_GRID_COL_SIZE, Wx::GridSizeEvent], EventType['evt_grid_editor_created', 0, Wx::EVT_GRID_EDITOR_CREATED, Wx::GridEditorCreatedEvent], EventType['evt_grid_editor_hidden', 0, Wx::EVT_GRID_EDITOR_HIDDEN, Wx::GridEvent], EventType['evt_grid_editor_shown', 0, Wx::EVT_GRID_EDITOR_SHOWN, Wx::GridEvent], EventType['evt_grid_label_left_click', 0, Wx::EVT_GRID_LABEL_LEFT_CLICK, Wx::GridEvent], EventType['evt_grid_label_left_dclick', 0, Wx::EVT_GRID_LABEL_LEFT_DCLICK, Wx::GridEvent], EventType['evt_grid_label_right_click', 0, Wx::EVT_GRID_LABEL_RIGHT_CLICK, Wx::GridEvent], EventType['evt_grid_label_right_dclick', 0, Wx::EVT_GRID_LABEL_RIGHT_DCLICK, Wx::GridEvent], EventType['evt_grid_range_select', 0, Wx::EVT_GRID_RANGE_SELECT, Wx::GridRangeSelectEvent], EventType['evt_grid_row_size', 0, Wx::EVT_GRID_ROW_SIZE, Wx::GridSizeEvent], EventType['evt_grid_select_cell', 0, Wx::EVT_GRID_SELECT_CELL, Wx::GridEvent], EventType['evt_help', 1, Wx::EVT_HELP, Wx::Event], EventType['evt_help_range', 2, Wx::EVT_HELP, Wx::Event], EventType['evt_hyperlink', 1, Wx::EVT_COMMAND_HYPERLINK, Wx::HyperlinkEvent], EventType['evt_iconize', 0, Wx::EVT_ICONIZE, Wx::IconizeEvent], EventType['evt_idle', 0, Wx::EVT_IDLE, Wx::IdleEvent], EventType['evt_init_dialog', 0, Wx::EVT_INIT_DIALOG, Wx::Event], EventType['evt_joy_button_down', 0, Wx::EVT_JOY_BUTTON_DOWN, Wx::Event], EventType['evt_joy_button_up', 0, Wx::EVT_JOY_BUTTON_UP, Wx::Event], EventType['evt_joy_move', 0, Wx::EVT_JOY_MOVE, Wx::Event], EventType['evt_joy_zmove', 0, Wx::EVT_JOY_ZMOVE, Wx::Event], EventType['evt_key_down', 0, Wx::EVT_KEY_DOWN, Wx::KeyEvent], EventType['evt_key_up', 0, Wx::EVT_KEY_UP, Wx::KeyEvent], EventType['evt_kill_focus', 0, Wx::EVT_KILL_FOCUS, Wx::FocusEvent], EventType['evt_leave_window', 0, Wx::EVT_LEAVE_WINDOW, Wx::MouseEvent], EventType['evt_left_dclick', 0, Wx::EVT_LEFT_DCLICK, Wx::MouseEvent], EventType['evt_left_down', 0, Wx::EVT_LEFT_DOWN, Wx::MouseEvent], EventType['evt_left_up', 0, Wx::EVT_LEFT_UP, Wx::MouseEvent], EventType['evt_listbook_page_changed', 1, Wx::EVT_COMMAND_LISTBOOK_PAGE_CHANGED, Wx::ListbookEvent], EventType['evt_listbook_page_changing', 1, Wx::EVT_COMMAND_LISTBOOK_PAGE_CHANGING, Wx::ListbookEvent], EventType['evt_listbox', 1, Wx::EVT_COMMAND_LISTBOX_SELECTED, Wx::CommandEvent], EventType['evt_listbox_dclick', 1, Wx::EVT_COMMAND_LISTBOX_DOUBLECLICKED, Wx::CommandEvent], EventType['evt_list_begin_drag', 1, Wx::EVT_COMMAND_LIST_BEGIN_DRAG, Wx::ListEvent], EventType['evt_list_begin_label_edit', 1, Wx::EVT_COMMAND_LIST_BEGIN_LABEL_EDIT, Wx::ListEvent], EventType['evt_list_begin_rdrag', 1, Wx::EVT_COMMAND_LIST_BEGIN_RDRAG, Wx::ListEvent], EventType['evt_list_cache_hint', 1, Wx::EVT_COMMAND_LIST_CACHE_HINT, Wx::ListEvent], EventType['evt_list_col_begin_drag', 1, Wx::EVT_COMMAND_LIST_COL_BEGIN_DRAG, Wx::ListEvent], EventType['evt_list_col_click', 1, Wx::EVT_COMMAND_LIST_COL_CLICK, Wx::ListEvent], EventType['evt_list_col_dragging', 1, Wx::EVT_COMMAND_LIST_COL_DRAGGING, Wx::ListEvent], EventType['evt_list_col_end_drag', 1, Wx::EVT_COMMAND_LIST_COL_END_DRAG, Wx::ListEvent], EventType['evt_list_col_right_click', 1, Wx::EVT_COMMAND_LIST_COL_RIGHT_CLICK, Wx::ListEvent], EventType['evt_list_delete_all_items', 1, Wx::EVT_COMMAND_LIST_DELETE_ALL_ITEMS, Wx::ListEvent], EventType['evt_list_delete_item', 1, Wx::EVT_COMMAND_LIST_DELETE_ITEM, Wx::ListEvent], EventType['evt_list_end_label_edit', 1, Wx::EVT_COMMAND_LIST_END_LABEL_EDIT, Wx::ListEvent], EventType['evt_list_insert_item', 1, Wx::EVT_COMMAND_LIST_INSERT_ITEM, Wx::ListEvent], EventType['evt_list_item_activated', 1, Wx::EVT_COMMAND_LIST_ITEM_ACTIVATED, Wx::ListEvent], EventType['evt_list_item_deselected', 1, Wx::EVT_COMMAND_LIST_ITEM_DESELECTED, Wx::ListEvent], EventType['evt_list_item_focused', 1, Wx::EVT_COMMAND_LIST_ITEM_FOCUSED, Wx::ListEvent], EventType['evt_list_item_middle_click', 1, Wx::EVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, Wx::ListEvent], EventType['evt_list_item_right_click', 1, Wx::EVT_COMMAND_LIST_ITEM_RIGHT_CLICK, Wx::ListEvent], EventType['evt_list_item_selected', 1, Wx::EVT_COMMAND_LIST_ITEM_SELECTED, Wx::ListEvent], EventType['evt_list_key_down', 1, Wx::EVT_COMMAND_LIST_KEY_DOWN, Wx::ListEvent], EventType['evt_maximize', 0, Wx::EVT_MAXIMIZE, Wx::Event], EventType['evt_menu', 1, Wx::EVT_COMMAND_MENU_SELECTED, Wx::CommandEvent], EventType['evt_menu_close', 0, Wx::EVT_MENU_CLOSE, Wx::MenuEvent], EventType['evt_menu_highlight', 1, Wx::EVT_MENU_HIGHLIGHT, Wx::MenuEvent], EventType['evt_menu_highlight_all', 0, Wx::EVT_MENU_HIGHLIGHT, Wx::MenuEvent], EventType['evt_menu_open', 0, Wx::EVT_MENU_OPEN, Wx::MenuEvent], EventType['evt_menu_range', 2, Wx::EVT_COMMAND_MENU_SELECTED, Wx::CommandEvent], EventType['evt_middle_dclick', 0, Wx::EVT_MIDDLE_DCLICK, Wx::MouseEvent], EventType['evt_middle_down', 0, Wx::EVT_MIDDLE_DOWN, Wx::MouseEvent], EventType['evt_middle_up', 0, Wx::EVT_MIDDLE_UP, Wx::MouseEvent], EventType['evt_motion', 0, Wx::EVT_MOTION, Wx::MouseEvent], EventType['evt_mousewheel', 0, Wx::EVT_MOUSEWHEEL, Wx::MouseEvent], EventType['evt_mouse_capture_changed', 0, Wx::EVT_MOUSE_CAPTURE_CHANGED, Wx::Event], EventType['evt_move', 0, Wx::EVT_MOVE, Wx::MoveEvent], EventType['evt_nc_paint', 0, Wx::EVT_NC_PAINT, Wx::Event], EventType['evt_notebook_page_changed', 1, Wx::EVT_COMMAND_NOTEBOOK_PAGE_CHANGED, Wx::NotebookEvent], EventType['evt_notebook_page_changing', 1, Wx::EVT_COMMAND_NOTEBOOK_PAGE_CHANGING, Wx::NotebookEvent], EventType['evt_paint', 0, Wx::EVT_PAINT, Wx::PaintEvent], EventType['evt_query_end_session', 0, Wx::EVT_QUERY_END_SESSION, Wx::Event], EventType['evt_query_layout_info', 0, Wx::EVT_QUERY_LAYOUT_INFO, Wx::Event], EventType['evt_radiobox', 1, Wx::EVT_COMMAND_RADIOBOX_SELECTED, Wx::CommandEvent], EventType['evt_radiobutton', 1, Wx::EVT_COMMAND_RADIOBUTTON_SELECTED, Wx::CommandEvent], EventType['evt_right_dclick', 0, Wx::EVT_RIGHT_DCLICK, Wx::MouseEvent], EventType['evt_right_down', 0, Wx::EVT_RIGHT_DOWN, Wx::MouseEvent], EventType['evt_right_up', 0, Wx::EVT_RIGHT_UP, Wx::MouseEvent], EventType['evt_sash_dragged', 1, Wx::EVT_SASH_DRAGGED, Wx::SashEvent], EventType['evt_sash_dragged_range', 2, Wx::EVT_SASH_DRAGGED, Wx::SashEvent], EventType['evt_scrollbar', 1, Wx::EVT_COMMAND_SCROLLBAR_UPDATED, Wx::CommandEvent], EventType['evt_scrollwin_bottom', 0, Wx::EVT_SCROLLWIN_TOP, Wx::ScrollWinEvent], EventType['evt_scrollwin_linedown', 0, Wx::EVT_SCROLLWIN_LINEDOWN, Wx::ScrollWinEvent], EventType['evt_scrollwin_lineup', 0, Wx::EVT_SCROLLWIN_LINEUP, Wx::ScrollWinEvent], EventType['evt_scrollwin_pagedown', 0, Wx::EVT_SCROLLWIN_PAGEDOWN, Wx::ScrollWinEvent], EventType['evt_scrollwin_pageup', 0, Wx::EVT_SCROLLWIN_PAGEUP, Wx::ScrollWinEvent], EventType['evt_scrollwin_thumbrelease', 0, Wx::EVT_SCROLLWIN_THUMBRELEASE, Wx::ScrollWinEvent], EventType['evt_scrollwin_thumbtrack', 0, Wx::EVT_SCROLLWIN_THUMBTRACK, Wx::ScrollWinEvent], EventType['evt_scrollwin_top', 0, Wx::EVT_SCROLLWIN_TOP, Wx::ScrollWinEvent], EventType['evt_scroll_bottom', 0, Wx::EVT_SCROLL_BOTTOM, Wx::ScrollEvent], EventType['evt_scroll_linedown', 0, Wx::EVT_SCROLL_LINEDOWN, Wx::ScrollEvent], EventType['evt_scroll_lineup', 0, Wx::EVT_SCROLL_LINEUP, Wx::ScrollEvent], EventType['evt_scroll_pagedown', 0, Wx::EVT_SCROLL_PAGEDOWN, Wx::ScrollEvent], EventType['evt_scroll_pageup', 0, Wx::EVT_SCROLL_PAGEUP, Wx::ScrollEvent], EventType['evt_scroll_thumbrelease', 0, Wx::EVT_SCROLL_THUMBRELEASE, Wx::ScrollEvent], EventType['evt_scroll_thumbtrack', 0, Wx::EVT_SCROLL_THUMBTRACK, Wx::ScrollEvent], EventType['evt_scroll_top', 0, Wx::EVT_SCROLL_TOP, Wx::ScrollEvent], EventType['evt_set_cursor', 0, Wx::EVT_SET_CURSOR, Wx::SetCursorEvent], EventType['evt_set_focus', 0, Wx::EVT_SET_FOCUS, Wx::FocusEvent], EventType['evt_size', 0, Wx::EVT_SIZE, Wx::SizeEvent], EventType['evt_sizing', 0, Wx::EVT_SIZING, Wx::SizeEvent], EventType['evt_slider', 1, Wx::EVT_COMMAND_SLIDER_UPDATED, Wx::CommandEvent], EventType['evt_socket', 1, Wx::EVT_SOCKET, Wx::Event], EventType['evt_spin', 1, Wx::EVT_SCROLL_THUMBTRACK, Wx::ScrollEvent], EventType['evt_spinctrl', 1, Wx::EVT_COMMAND_SPINCTRL_UPDATED, Wx::SpinEvent], EventType['evt_spin_down', 1, Wx::EVT_SCROLL_LINEDOWN, Wx::ScrollEvent], EventType['evt_spin_up', 1, Wx::EVT_SCROLL_LINEUP, Wx::ScrollEvent], EventType['evt_splitter_dclick', 1, Wx::EVT_COMMAND_SPLITTER_DOUBLECLICKED, Wx::SplitterEvent], EventType['evt_splitter_sash_pos_changed', 1, Wx::EVT_COMMAND_SPLITTER_SASH_POS_CHANGED, Wx::SplitterEvent], EventType['evt_splitter_sash_pos_changing', 1, Wx::EVT_COMMAND_SPLITTER_SASH_POS_CHANGING, Wx::SplitterEvent], EventType['evt_splitter_unsplit', 1, Wx::EVT_COMMAND_SPLITTER_UNSPLIT, Wx::SplitterEvent], EventType['evt_sys_colour_changed', 0, Wx::EVT_SYS_COLOUR_CHANGED, Wx::Event], EventType['evt_taskbar_left_dclick', 0, Wx::EVT_TASKBAR_LEFT_DCLICK, Wx::Event], EventType['evt_taskbar_left_down', 0, Wx::EVT_TASKBAR_LEFT_DOWN, Wx::Event], EventType['evt_taskbar_left_up', 0, Wx::EVT_TASKBAR_LEFT_UP, Wx::Event], EventType['evt_taskbar_move', 0, Wx::EVT_TASKBAR_MOVE, Wx::Event], EventType['evt_taskbar_right_dclick', 0, Wx::EVT_TASKBAR_RIGHT_DCLICK, Wx::Event], EventType['evt_taskbar_right_down', 0, Wx::EVT_TASKBAR_RIGHT_DOWN, Wx::Event], EventType['evt_taskbar_right_up', 0, Wx::EVT_TASKBAR_RIGHT_UP, Wx::Event], EventType['evt_text', 1, Wx::EVT_COMMAND_TEXT_UPDATED, Wx::CommandEvent], EventType['evt_text_enter', 1, Wx::EVT_COMMAND_TEXT_ENTER, Wx::CommandEvent], EventType['evt_text_maxlen', 1, Wx::EVT_COMMAND_TEXT_MAXLEN, Wx::CommandEvent], EventType['evt_text_url', 1, Wx::EVT_COMMAND_TEXT_URL, Wx::TextUrlEvent], EventType['evt_timer', 1, Wx::EVT_TIMER, Wx::TimerEvent], EventType['evt_togglebutton', 1, Wx::EVT_COMMAND_TOGGLEBUTTON_CLICKED, Wx::Event], EventType['evt_tool', 1, Wx::EVT_COMMAND_TOOL_CLICKED, Wx::CommandEvent], EventType['evt_tool_enter', 1, Wx::EVT_COMMAND_TOOL_ENTER, Wx::CommandEvent], EventType['evt_tool_range', 2, Wx::EVT_COMMAND_TOOL_CLICKED, Wx::CommandEvent], EventType['evt_tool_rclicked', 1, Wx::EVT_COMMAND_TOOL_RCLICKED, Wx::CommandEvent], EventType['evt_tool_rclicked_range', 2, Wx::EVT_COMMAND_TOOL_RCLICKED, Wx::CommandEvent], EventType['evt_tree_begin_drag', 1, Wx::EVT_COMMAND_TREE_BEGIN_DRAG, Wx::TreeEvent], EventType['evt_tree_begin_label_edit', 1, Wx::EVT_COMMAND_TREE_BEGIN_LABEL_EDIT, Wx::TreeEvent], EventType['evt_tree_begin_rdrag', 1, Wx::EVT_COMMAND_TREE_BEGIN_RDRAG, Wx::TreeEvent], EventType['evt_tree_delete_item', 1, Wx::EVT_COMMAND_TREE_DELETE_ITEM, Wx::TreeEvent], EventType['evt_tree_end_drag', 1, Wx::EVT_COMMAND_TREE_END_DRAG, Wx::TreeEvent], EventType['evt_tree_end_label_edit', 1, Wx::EVT_COMMAND_TREE_END_LABEL_EDIT, Wx::TreeEvent], EventType['evt_tree_get_info', 1, Wx::EVT_COMMAND_TREE_GET_INFO, Wx::TreeEvent], EventType['evt_tree_item_activated', 1, Wx::EVT_COMMAND_TREE_ITEM_ACTIVATED, Wx::TreeEvent], EventType['evt_tree_item_collapsed', 1, Wx::EVT_COMMAND_TREE_ITEM_COLLAPSED, Wx::TreeEvent], EventType['evt_tree_item_collapsing', 1, Wx::EVT_COMMAND_TREE_ITEM_COLLAPSING, Wx::TreeEvent], EventType['evt_tree_item_expanded', 1, Wx::EVT_COMMAND_TREE_ITEM_EXPANDED, Wx::TreeEvent], EventType['evt_tree_item_expanding', 1, Wx::EVT_COMMAND_TREE_ITEM_EXPANDING, Wx::TreeEvent], EventType['evt_tree_item_middle_click', 1, Wx::EVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, Wx::TreeEvent], EventType['evt_tree_item_right_click', 1, Wx::EVT_COMMAND_TREE_ITEM_RIGHT_CLICK, Wx::TreeEvent], EventType['evt_tree_key_down', 1, Wx::EVT_COMMAND_TREE_KEY_DOWN, Wx::TreeEvent], EventType['evt_tree_sel_changed', 1, Wx::EVT_COMMAND_TREE_SEL_CHANGED, Wx::TreeEvent], EventType['evt_tree_sel_changing', 1, Wx::EVT_COMMAND_TREE_SEL_CHANGING, Wx::TreeEvent], EventType['evt_tree_set_info', 1, Wx::EVT_COMMAND_TREE_SET_INFO, Wx::TreeEvent], EventType['evt_update_ui', 1, Wx::EVT_UPDATE_UI, Wx::UpdateUIEvent], EventType['evt_update_ui_range', 2, Wx::EVT_UPDATE_UI, Wx::UpdateUIEvent], EventType['evt_window_create', 0, Wx::EVT_CREATE, Wx::WindowCreateEvent], EventType['evt_window_destroy', 0, Wx::EVT_DESTROY, Wx::WindowDestroyEvent], EventType['evt_wizard_cancel', 1, Wx::EVT_WIZARD_CANCEL, Wx::WizardEvent], EventType['evt_wizard_finished', 1, Wx::EVT_WIZARD_FINISHED, Wx::WizardEvent], EventType['evt_wizard_help', 1, Wx::EVT_WIZARD_HELP, Wx::WizardEvent], EventType['evt_wizard_page_changed', 1, Wx::EVT_WIZARD_PAGE_CHANGED, Wx::WizardEvent], EventType['evt_wizard_page_changing', 1, Wx::EVT_WIZARD_PAGE_CHANGING, Wx::WizardEvent] ] # Loop over the event definitions to set up two things: # 1) A hash mapping Event Type ids to event classes, used when events # are fired to quickly look up the right type to yield # 2) EvtHandler instance methods like evt_xxx to conveniently set # up event handlers EVENT_DEFINITIONS.each { | ev_type | register_event_type(ev_type) } # convenience evt_handler to listen to all mouse events def evt_mouse_events(&block) evt_left_down(&block) evt_left_up(&block) evt_middle_down(&block) evt_middle_up(&block) evt_right_down(&block) evt_right_up(&block) evt_motion(&block) evt_left_dclick(&block) evt_middle_dclick(&block) evt_right_dclick(&block) evt_leave_window(&block) evt_enter_window(&block) evt_mousewheel(&block) end # TODO # if defined?(Wx::Scintilla) # EVENT_TYPE_MAPPING.merge( # Wx::EVT_SCI_CHANGE => Wx::ScintillaEvent, # Wx::EVT_SCI_STYLENEEDED => Wx::ScintillaEvent, # Wx::EVT_SCI_CHARADDED => Wx::ScintillaEvent, # Wx::EVT_SCI_SAVEPOINTREACHED => Wx::ScintillaEvent, # Wx::EVT_SCI_SAVEPOINTLEFT => Wx::ScintillaEvent, # Wx::EVT_SCI_ROMODIFYATTEMPT => Wx::ScintillaEvent, # Wx::EVT_SCI_KEY => Wx::ScintillaEvent, # Wx::EVT_SCI_DOUBLECLICK => Wx::ScintillaEvent, # Wx::EVT_SCI_UPDATEUI => Wx::ScintillaEvent, # Wx::EVT_SCI_MODIFIED => Wx::ScintillaEvent, # Wx::EVT_SCI_MACRORECORD => Wx::ScintillaEvent, # Wx::EVT_SCI_MARGINCLICK => Wx::ScintillaEvent, # Wx::EVT_SCI_NEEDSHOWN => Wx::ScintillaEvent, # Wx::EVT_SCI_PAINTED => Wx::ScintillaEvent, # Wx::EVT_SCI_USERLISTSELECTION => Wx::ScintillaEvent, # Wx::EVT_SCI_URIDROPPED => Wx::ScintillaEvent, # Wx::EVT_SCI_DWELLSTART => Wx::ScintillaEvent, # Wx::EVT_SCI_DWELLEND => Wx::ScintillaEvent, # Wx::EVT_SCI_START_DRAG => Wx::ScintillaEvent, # Wx::EVT_SCI_DRAG_OVER => Wx::ScintillaEvent, # Wx::EVT_SCI_DO_DROP => Wx::ScintillaEvent, # Wx::EVT_SCI_ZOOM => Wx::ScintillaEvent, # Wx::EVT_SCI_HOTSPOT_CLICK => Wx::ScintillaEvent, # Wx::EVT_SCI_HOTSPOT_DCLICK => Wx::ScintillaEvent, # Wx::EVT_SCI_CALLTIP_CLICK => Wx::ScintillaEvent ) # end end