# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # A class that can handle events from the windowing system. # # {Wx::Window} is (and therefore all window classes are) derived from this class. # When events are received, {Wx::EvtHandler} invokes the method listed in the event table using itself as the object. When using multiple inheritance it is imperative that the {Wx::EvtHandler}(-derived) class is the first class inherited such that the this pointer for the overall object will be identical to the this pointer of the {Wx::EvtHandler} portion. # # Category: {Wx::Events} # @see How Events are Processed # @see Wx::EventBlocker # @see Wx::EventLoopBase # # class EvtHandler < Object # Queue event for a later processing. # # 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). # 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). # # 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. # @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. # @return [void] def queue_event(event) end # Post an event to be processed later. # # This function is similar to {Wx::EvtHandler#queue_event} but can't be used to post events from worker threads for the event objects with {Wx::String} fields (i.e. in practice most of them) because of an unsafe use of the same {Wx::String} object which happens because the {Wx::String} field in the original event object and its copy made internally by this function share the same string buffer internally. Use {Wx::EvtHandler#queue_event} to avoid this. # A copy of event is made by the function, so the original can be deleted as soon as function returns (it is common that the original is created on the stack). This requires that the {Wx::Event#clone} method be implemented by event so that it can be duplicated and stored until it gets processed. # @param event [Wx::Event] Event to add to the pending events queue. # @return [void] def add_pending_event(event) end # Try to process the event in this handler and all those chained to it. # # As explained in {Wx::EvtHandler#process_event} documentation, the event handlers may be chained in a doubly-linked list. This function tries to process the event in this handler (including performing any pre-processing done in {Wx::EvtHandler#try_before}, e.g. applying validators) and all those following it in the chain until the event is processed or the chain is exhausted. # This function is called from {Wx::EvtHandler#process_event} and, in turn, calls {Wx::EvtHandler#try_before} and {Wx::EvtHandler#try_after}. It is not virtual and so cannot be overridden but can, and should, be called to forward an event to another handler instead of {Wx::EvtHandler#process_event} which would result in a duplicate call to {Wx::EvtHandler#try_after}, e.g. resulting in all unprocessed events being sent to the application object multiple times. # # true if this handler of one of those chained to it processed the event. # @param event [Wx::Event] Event to process. # @return [Boolean] def process_event_locally(event) end # Processes an event by calling {Wx::EvtHandler#process_event} and handles any exceptions that occur in the process. # # If an exception is thrown in event handler, {Wx::App::OnExceptionInMainLoop} is called. # # true if the event was processed, false if no handler was found or an exception was thrown. # @see Wx::Window#handle_window_event # @param event [Wx::Event] Event to process. # @return [Boolean] def safely_process_event(event) end # Processes the pending events previously queued using {Wx::EvtHandler#queue_event} or {Wx::EvtHandler#add_pending_event}; you must call this function only if you are sure there are pending events for this handler, otherwise a {Wx::CHECK} will fail. # # The real processing still happens in {Wx::EvtHandler#process_event} which is called by this function. # Note that this function needs a valid application object (see Wx::AppConsole#get_instance) because {Wx::App} holds the list of the event handlers with pending events and this function manipulates that list. # @return [void] def process_pending_events; end # Deletes all events queued on this event handler using {Wx::EvtHandler#queue_event} or {Wx::EvtHandler#add_pending_event}. # # Use with care because the events which are deleted are (obviously) not processed and this may have unwanted consequences (e.g. user actions events will be lost). # @return [void] def delete_pending_events; end # Returns a pointer to the user-supplied client data object. # # # @see Wx::EvtHandler#set_client_object # @see Wx::ClientData # @return [Object] def get_client_object; end alias_method :client_object, :get_client_object # Set the client data object. # # Any previous object will be deleted. # @see Wx::EvtHandler#get_client_object # @see Wx::ClientData # @param data [Object] # @return [void] def set_client_object(data) end alias_method :client_object=, :set_client_object # Returns true if the event handler is enabled, false otherwise. # # # @see Wx::EvtHandler#set_evt_handler_enabled # @return [Boolean] def get_evt_handler_enabled; end alias_method :evt_handler_enabled, :get_evt_handler_enabled # Returns the pointer to the next handler in the chain. # # # @see Wx::EvtHandler#set_next_handler # @see Wx::EvtHandler#get_previous_handler # @see Wx::EvtHandler#set_previous_handler # @see Wx::Window#push_event_handler # @see Wx::Window#pop_event_handler # @return [Wx::EvtHandler] def get_next_handler; end alias_method :next_handler, :get_next_handler # Returns the pointer to the previous handler in the chain. # # # @see Wx::EvtHandler#set_previous_handler # @see Wx::EvtHandler#get_next_handler # @see Wx::EvtHandler#set_next_handler # @see Wx::Window#push_event_handler # @see Wx::Window#pop_event_handler # @return [Wx::EvtHandler] def get_previous_handler; end alias_method :previous_handler, :get_previous_handler # Enables or disables the event handler. # #
You can use this function to avoid having to remove the event handler from the chain, for example when implementing a dialog editor and changing from edit to test mode. #
#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: # ```ruby # handlerA.set_next_handler(handlerB) # handlerB.set_previous_handler(handlerA) # ``` # #
#B->Wx::EvtHandler#unlink
you'll have:
# @return [void]
def unlink; end
# Returns true if the next and the previous handler pointers of this event handler instance are NULL.
#
#
# @see Wx::EvtHandler#set_previous_handler
# @see Wx::EvtHandler#set_next_handler
# @return [Boolean]
def is_unlinked; end
alias_method :unlinked?, :is_unlinked
# Add an event filter whose FilterEvent() method will be called for each and every event processed by wxWidgets.
#
# 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}.
# @param filter [Wx::EventFilter,Wx::App]
# @return [void]
def self.add_filter(filter) end
# Remove a filter previously installed with {Wx::EvtHandler.add_filter}.
#
# It's an error to remove a filter that hadn't been previously added or was already removed.
# @param filter [Wx::EventFilter,Wx::App]
# @return [void]
def self.remove_filter(filter) end
# Constructor.
# @return [Wx::EvtHandler]
def initialize; end
protected
# Method called by {Wx::EvtHandler#process_event} before examining this object event tables.
#
# 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.
# Example:
# ```ruby
# class MyClass < BaseClass # inheriting from Wx::EvtHandler
# ...
# protected
# def try_before(event)
# if my_pre_process(event)
# return true
#
# super
# end
# end
# ```
# @see Wx::EvtHandler#process_event
# @param event [Wx::Event]
# @return [Boolean]
def try_before(event) end
# Method called by {Wx::EvtHandler#process_event} as last resort.
#
# This method can be overridden to implement post-processing for the events which were not processed anywhere else.
# 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:
# ```ruby
# class MyClass < BaseClass # inheriting from Wx::EvtHandler
# ...
# protected
# def try_after(event)
# if super
# return true
#
# my_post_process(event)
# end
# end
# ```
# @see Wx::EvtHandler#process_event
# @param event [Wx::Event]
# @return [Boolean]
def try_after(event) end
end # EvtHandler
end