# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # A generic implementation of the GUI event loop. # # Category: Application and Process Management # class GUIEventLoop < ::Object # @return [Wx::GUIEventLoop] def initialize; end # Start the event loop, return the exit code when it is finished. # # Logically, this method calls {Wx::GUIEventLoop#dispatch} in a loop until it returns false and also takes care of generating idle events during each loop iteration. However not all implementations of this class really implement it like this (e.g. WXGTK does not) so you shouldn't rely on {Wx::GUIEventLoop#dispatch} being called from inside this function. # The argument passed to {Wx::GUIEventLoop#exit} which terminated this event loop. # @return [Integer] def run; end # Return true if this event loop is currently running. # # Notice that even if this event loop hasn't terminated yet but has just spawned a nested (e.g. modal) event loop, this method would return false. # @return [Boolean] def is_running; end alias_method :running?, :is_running # Use this to check whether the event loop was successfully created before using it. # @return [Boolean] def is_ok; end alias_method :ok?, :is_ok # Exit the currently running loop with the given exit code. # # The loop will exit, i.e. its {Wx::GUIEventLoop#run} method will return, during the next event loop iteration. # Notice that this method can only be used if this event loop is the currently running one, i.e. its {Wx::GUIEventLoop#is_running} returns true. If this is not the case, an assert failure is triggered and nothing is done as outer event loops can't be exited from immediately. Use {Wx::GUIEventLoop#schedule_exit} if you'd like to exit this loop even if it doesn't run currently. # @param rc [Integer] # @return [void] def exit(rc=0) end # Schedule an exit from the loop with the given exit code. # # This method is similar to {Wx::GUIEventLoop#exit} but can be called even if this event loop is not the currently running one and if it is the active loop, then it works in exactly the same way as {Wx::GUIEventLoop#exit}. # The loop will exit as soon as the control flow returns to it, i.e. after any nested loops terminate. # @param rc [Integer] # @return [void] def schedule_exit(rc=0) end # Return true if any events are available. # # If this method returns true, calling {Wx::GUIEventLoop#dispatch} will not block. # @return [Boolean] def pending; end # Dispatches the next event in the windowing system event queue. # # Blocks until an event appears if there are none currently (use {Wx::GUIEventLoop#pending} if this is not wanted). # This can be used for programming event loops, e.g. # # ```ruby # while evt_loop.pending # evt_loop.dispatch # ``` # # false if the event loop should stop and true otherwise. # @see Wx::GUIEventLoop#pending # @see Wx::EventLoopBase # @return [Boolean] def dispatch; end # Dispatch an event but not wait longer than the specified timeout for it. # # If an event is received before the specified timeout expires, it is processed and the function returns 1 normally or 0 if the event loop should quite. Otherwise, i.e. if the timeout expires, the functions returns -1 without processing any events. # # 1 if an event was processed, 0 if the event loop should quit or -1 if the timeout expired. # @param timeout [Integer] The maximal time to wait for the events in milliseconds. # @return [Integer] def dispatch_timeout(timeout) end # Called by wxWidgets to wake up the event loop even if it is currently blocked inside {Wx::GUIEventLoop#dispatch}. # @return [void] def wake_up; end # Makes sure that idle events are sent again. # @return [void] def wake_up_idle; end # This virtual function is called when the application becomes idle and normally just sends {Wx::IdleEvent} to all interested parties. # # It should return true if more idle events are needed, false if not. # @return [Boolean] def process_idle; end # Returns true if called from inside {Wx::GUIEventLoop#yield} or from inside {Wx::GUIEventLoop#yield_for}. # @return [Boolean] def is_yielding; end alias_method :yielding?, :is_yielding # Yields control to pending messages in the windowing system. # # This can be useful, for example, when a time-consuming process writes to a text window. Without an occasional yield, the text window will not be updated properly, and on systems with cooperative multitasking, other processes will not respond. # Caution should be exercised, however, since yielding may allow the user to perform actions which are not compatible with the current task. Disabling menu items or whole menus during processing can avoid unwanted reentrance of code: see {Wx::SafeYield} for a better function. # Note that {Wx::GUIEventLoop#yield} will not flush the message logs. This is intentional as calling {Wx::GUIEventLoop#yield} is usually done to quickly update the screen and popping up a message box dialog may be undesirable. If you do wish to flush the log messages immediately (otherwise it will be done during the next idle loop iteration), call {Wx::Log.flush_active}. # If onlyIfNeeded parameter is true and the flow control is already inside {Wx::GUIEventLoop#yield}, i.e. {Wx::GUIEventLoop#is_yielding} returns true, the method just silently returns false and doesn't do anything. # @param onlyIfNeeded [Boolean] # @return [Boolean] def yield(onlyIfNeeded=false) end # Works like {Wx::GUIEventLoop#yield} with onlyIfNeeded == true, except that it allows the caller to specify a mask of the {Wx::EventCategory} values which indicates which events should be processed and which should instead be "delayed" (i.e. # # processed by the main loop later). # Note that this is a safer alternative to {Wx::GUIEventLoop#yield} since it ensures that only the events you're interested to will be processed; i.e. this method helps to avoid unwanted reentrancies. # Note that currently only WXMSW and WXGTK do support selective yield of native events coming from the underlying GUI toolkit. wxWidgets events posted using {Wx::EvtHandler#add_pending_event} or {Wx::EvtHandler#queue_event} are instead selectively processed by all ports. # @see Wx::Event#get_event_category # @param eventsToProcess [Integer] # @return [Boolean] def yield_for(eventsToProcess) end # Returns true if the given event category is allowed inside a {Wx::GUIEventLoop#yield_for} call (i.e. # # compares the given category against the last mask passed to {Wx::GUIEventLoop#yield_for}). # @see Wx::Event#get_event_category # @param cat [Wx::EventCategory] # @return [Boolean] def is_event_allowed_inside_yield(cat) end alias_method :event_allowed_inside_yield?, :is_event_allowed_inside_yield # Returns true if this is the main loop executed by {Wx::App#on_run}. # @return [Boolean] def is_main; end alias_method :main?, :is_main end # GUIEventLoop end