Class: Wx::App

Inherits:
EvtHandler show all
Defined in:
lib/wx/doc/gen/app.rb,
lib/wx/doc/app.rb

Overview

The App class represents the application itself when wxUSE_GUI=1.

In addition to the features provided by AppConsole it keeps track of the top window (see #set_top_window) and adds support for video modes (see set_display_mode). In general, application-wide settings for GUI-only apps are accessible from App (or from SystemSettings or SystemOptions classes).

Events emitted by this class

Event handler methods for events emitted by this class:

Category: Application and Process Management

See Also:

Defined Under Namespace

Classes: Appearance, AppearanceResult

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from EvtHandler

add_filter, #add_pending_event, #call_after, clear_filters, #connect, #disconnect, #evt_activate, #evt_activate_app, #evt_aui_pane_activated, #evt_aui_pane_button, #evt_aui_pane_close, #evt_aui_pane_maximize, #evt_aui_pane_restore, #evt_aui_render, #evt_auinotebook_allow_dnd, #evt_auinotebook_begin_drag, #evt_auinotebook_bg_dclick, #evt_auinotebook_button, #evt_auinotebook_drag_done, #evt_auinotebook_drag_motion, #evt_auinotebook_end_drag, #evt_auinotebook_page_changed, #evt_auinotebook_page_changing, #evt_auinotebook_page_close, #evt_auinotebook_page_closed, #evt_auinotebook_tab_middle_down, #evt_auinotebook_tab_middle_up, #evt_auinotebook_tab_right_down, #evt_auinotebook_tab_right_up, #evt_auitoolbar_begin_drag, #evt_auitoolbar_middle_click, #evt_auitoolbar_overflow_click, #evt_auitoolbar_right_click, #evt_auitoolbar_tool_dropdown, #evt_button, #evt_calculate_layout, #evt_calendar, #evt_calendar_page_changed, #evt_calendar_sel_changed, #evt_calendar_week_clicked, #evt_calendar_weekday_clicked, #evt_char, #evt_char_hook, #evt_checkbox, #evt_checklistbox, #evt_child_focus, #evt_choice, #evt_choicebook_page_changed, #evt_choicebook_page_changing, #evt_close, #evt_collapsiblepane_changed, #evt_colourpicker_changed, #evt_colourpicker_current_changed, #evt_colourpicker_dialog_cancelled, #evt_combobox, #evt_combobox_closeup, #evt_combobox_dropdown, #evt_command, #evt_command_enter, #evt_command_kill_focus, #evt_command_left_click, #evt_command_left_dclick, #evt_command_range, #evt_command_right_click, #evt_command_scroll, #evt_command_scroll_bottom, #evt_command_scroll_changed, #evt_command_scroll_linedown, #evt_command_scroll_lineup, #evt_command_scroll_pagedown, #evt_command_scroll_pageup, #evt_command_scroll_thumbrelease, #evt_command_scroll_thumbtrack, #evt_command_scroll_top, #evt_command_set_focus, #evt_context_menu, #evt_date_changed, #evt_dialup_connected, #evt_dialup_disconnected, #evt_dirctrl_fileactivated, #evt_dirctrl_selectionchanged, #evt_dirpicker_changed, #evt_dpi_changed, #evt_drop_files, #evt_end_session, #evt_enter_window, #evt_erase_background, #evt_filectrl_fileactivated, #evt_filectrl_filterchanged, #evt_filectrl_folderchanged, #evt_filectrl_selectionchanged, #evt_filepicker_changed, #evt_find, #evt_find_close, #evt_find_next, #evt_find_replace, #evt_find_replace_all, #evt_fontpicker_changed, #evt_fullscreen, #evt_gesture_pan, #evt_gesture_rotate, #evt_gesture_zoom, #evt_grid_cell_changed, #evt_grid_cell_changing, #evt_grid_cell_left_click, #evt_grid_cell_left_dclick, #evt_grid_cell_right_click, #evt_grid_cell_right_dclick, #evt_grid_cmd_col_size, #evt_grid_cmd_editor_created, #evt_grid_cmd_range_selected, #evt_grid_cmd_range_selecting, #evt_grid_cmd_row_size, #evt_grid_col_auto_size, #evt_grid_col_label_size, #evt_grid_col_move, #evt_grid_col_size, #evt_grid_col_sort, #evt_grid_editor_created, #evt_grid_editor_hidden, #evt_grid_editor_shown, #evt_grid_label_left_click, #evt_grid_label_left_dclick, #evt_grid_label_right_click, #evt_grid_label_right_dclick, #evt_grid_range_selected, #evt_grid_range_selecting, #evt_grid_row_auto_size, #evt_grid_row_label_size, #evt_grid_row_move, #evt_grid_row_size, #evt_grid_select_cell, #evt_grid_tabbing, #evt_header_begin_reorder, #evt_header_begin_resize, #evt_header_click, #evt_header_dclick, #evt_header_dragging_cancelled, #evt_header_end_reorder, #evt_header_end_resize, #evt_header_middle_click, #evt_header_middle_dclick, #evt_header_resizing, #evt_header_right_click, #evt_header_right_dclick, #evt_header_separator_dclick, #evt_help, #evt_help_range, #evt_hibernate, #evt_hotkey, #evt_html_cell_clicked, #evt_html_cell_hover, #evt_html_link_clicked, #evt_hyperlink, #evt_iconize, #evt_idle, #evt_init_dialog, #evt_joy_button_down, #evt_joy_button_up, #evt_joy_move, #evt_joy_zmove, #evt_joystick_events, #evt_key_down, #evt_key_up, #evt_kill_focus, #evt_leave_window, #evt_left_dclick, #evt_left_down, #evt_left_up, #evt_list_begin_drag, #evt_list_begin_label_edit, #evt_list_begin_rdrag, #evt_list_cache_hint, #evt_list_col_begin_drag, #evt_list_col_click, #evt_list_col_dragging, #evt_list_col_end_drag, #evt_list_col_right_click, #evt_list_delete_all_items, #evt_list_delete_item, #evt_list_end_label_edit, #evt_list_insert_item, #evt_list_item_activated, #evt_list_item_checked, #evt_list_item_deselected, #evt_list_item_focused, #evt_list_item_middle_click, #evt_list_item_right_click, #evt_list_item_selected, #evt_list_item_unchecked, #evt_list_key_down, #evt_listbook_page_changed, #evt_listbook_page_changing, #evt_listbox, #evt_listbox_dclick, #evt_long_press, #evt_magnify, #evt_maximize, #evt_media_finished, #evt_media_loaded, #evt_media_pause, #evt_media_play, #evt_media_statechanged, #evt_media_stop, #evt_menu, #evt_menu_close, #evt_menu_highlight, #evt_menu_highlight_all, #evt_menu_open, #evt_menu_range, #evt_middle_dclick, #evt_middle_down, #evt_middle_up, #evt_motion, #evt_mouse_aux1_dclick, #evt_mouse_aux1_down, #evt_mouse_aux1_up, #evt_mouse_aux2_dclick, #evt_mouse_aux2_down, #evt_mouse_aux2_up, #evt_mouse_events, #evt_mousewheel, #evt_move, #evt_move_end, #evt_move_start, #evt_moving, #evt_navigation_key, #evt_notebook_page_changed, #evt_notebook_page_changing, #evt_paint, #evt_pg_changed, #evt_pg_changing, #evt_pg_col_begin_drag, #evt_pg_col_dragging, #evt_pg_col_end_drag, #evt_pg_double_click, #evt_pg_highlighted, #evt_pg_item_collapsed, #evt_pg_item_expanded, #evt_pg_label_edit_begin, #evt_pg_label_edit_ending, #evt_pg_page_changed, #evt_pg_right_click, #evt_pg_selected, #evt_press_and_tap, #evt_query_end_session, #evt_query_layout_info, #evt_radiobox, #evt_radiobutton, #evt_ribbonbar_help_click, #evt_ribbonbar_page_changed, #evt_ribbonbar_page_changing, #evt_ribbonbar_tab_left_dclick, #evt_ribbonbar_tab_middle_down, #evt_ribbonbar_tab_middle_up, #evt_ribbonbar_tab_right_down, #evt_ribbonbar_tab_right_up, #evt_ribbonbar_toggled, #evt_ribbonbuttonbar_clicked, #evt_ribbonbuttonbar_dropdown_clicked, #evt_ribbongallery_clicked, #evt_ribbongallery_hover_changed, #evt_ribbongallery_selected, #evt_ribbonpanel_extbutton_activated, #evt_ribbontoolbar_clicked, #evt_ribbontoolbar_dropdown_clicked, #evt_richtext_buffer_reset, #evt_richtext_character, #evt_richtext_consuming_character, #evt_richtext_content_deleted, #evt_richtext_content_inserted, #evt_richtext_delete, #evt_richtext_focus_object_changed, #evt_richtext_left_click, #evt_richtext_left_dclick, #evt_richtext_middle_click, #evt_richtext_properties_changed, #evt_richtext_return, #evt_richtext_right_click, #evt_richtext_selection_changed, #evt_richtext_style_changed, #evt_richtext_stylesheet_changed, #evt_richtext_stylesheet_replaced, #evt_richtext_stylesheet_replacing, #evt_right_dclick, #evt_right_down, #evt_right_up, #evt_sash_dragged, #evt_sash_dragged_range, #evt_scroll, #evt_scroll_bottom, #evt_scroll_changed, #evt_scroll_linedown, #evt_scroll_lineup, #evt_scroll_pagedown, #evt_scroll_pageup, #evt_scroll_thumbrelease, #evt_scroll_thumbtrack, #evt_scroll_top, #evt_scrollbar, #evt_scrollwin, #evt_scrollwin_bottom, #evt_scrollwin_linedown, #evt_scrollwin_lineup, #evt_scrollwin_pagedown, #evt_scrollwin_pageup, #evt_scrollwin_thumbrelease, #evt_scrollwin_thumbtrack, #evt_scrollwin_top, #evt_search, #evt_search_cancel, #evt_set_cursor, #evt_set_focus, #evt_show, #evt_size, #evt_slider, #evt_spin, #evt_spin_down, #evt_spin_up, #evt_spinctrl, #evt_spinctrldouble, #evt_splitter_dclick, #evt_splitter_sash_pos_changed, #evt_splitter_sash_pos_changing, #evt_splitter_sash_pos_resize, #evt_splitter_unsplit, #evt_stc_autocomp_cancelled, #evt_stc_autocomp_char_deleted, #evt_stc_autocomp_completed, #evt_stc_autocomp_selection, #evt_stc_autocomp_selection_change, #evt_stc_calltip_click, #evt_stc_change, #evt_stc_charadded, #evt_stc_clipboard_copy, #evt_stc_clipboard_paste, #evt_stc_do_drop, #evt_stc_doubleclick, #evt_stc_drag_over, #evt_stc_dwellend, #evt_stc_dwellstart, #evt_stc_hotspot_click, #evt_stc_hotspot_dclick, #evt_stc_hotspot_release_click, #evt_stc_indicator_click, #evt_stc_indicator_release, #evt_stc_macrorecord, #evt_stc_margin_right_click, #evt_stc_marginclick, #evt_stc_modified, #evt_stc_needshown, #evt_stc_painted, #evt_stc_romodifyattempt, #evt_stc_savepointleft, #evt_stc_savepointreached, #evt_stc_start_drag, #evt_stc_styleneeded, #evt_stc_updateui, #evt_stc_userlistselection, #evt_stc_zoom, #evt_sys_colour_changed, #evt_taskbar_click, #evt_taskbar_left_dclick, #evt_taskbar_left_down, #evt_taskbar_left_up, #evt_taskbar_move, #evt_taskbar_right_dclick, #evt_taskbar_right_down, #evt_taskbar_right_up, #evt_text, #evt_text_copy, #evt_text_cut, #evt_text_enter, #evt_text_maxlen, #evt_text_paste, #evt_text_url, #evt_time_changed, #evt_timer, #evt_togglebutton, #evt_tool, #evt_tool_dropdown, #evt_tool_enter, #evt_tool_range, #evt_tool_rclicked, #evt_tool_rclicked_range, #evt_toolbook_page_changed, #evt_toolbook_page_changing, #evt_tree_begin_drag, #evt_tree_begin_label_edit, #evt_tree_begin_rdrag, #evt_tree_delete_item, #evt_tree_end_drag, #evt_tree_end_label_edit, #evt_tree_get_info, #evt_tree_item_activated, #evt_tree_item_collapsed, #evt_tree_item_collapsing, #evt_tree_item_expanded, #evt_tree_item_expanding, #evt_tree_item_gettooltip, #evt_tree_item_menu, #evt_tree_item_middle_click, #evt_tree_item_right_click, #evt_tree_key_down, #evt_tree_sel_changed, #evt_tree_sel_changing, #evt_tree_set_info, #evt_tree_state_image_click, #evt_treebook_node_collapsed, #evt_treebook_node_expanded, #evt_treebook_page_changed, #evt_treebook_page_changing, #evt_two_finger_tap, #evt_update_ui, #evt_update_ui_range, #evt_window_create, #evt_window_destroy, #evt_wizard_before_page_changed, #evt_wizard_cancel, #evt_wizard_finished, #evt_wizard_help, #evt_wizard_page_changed, #evt_wizard_page_changing, #evt_wizard_page_shown, #get_client_object, #get_evt_handler_enabled, #get_next_handler, #get_previous_handler, #is_unlinked, #process_event, #process_event_locally, #queue_event, register_class, remove_filter, #safely_process_event, #set_client_object, #set_evt_handler_enabled, #set_next_handler, #try_after, #try_before, #unlink

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::App

Constructor.

Called implicitly with a definition of a Wx::App object.



183
# File 'lib/wx/doc/gen/app.rb', line 183

def initialize; end

Class Method Details

.call_on_unhandled_exceptionvoid

This method returns an undefined value.

Call on_unhandled_exception on the current TheApp object if it exists.

This function is used by wxWidgets itself and is usually not meant to be called by the application code. If you do call it, it must be done from a catch clause of a try block, i.e. there must be a currently handled exception. The function checks if TheApp is not nil and if it is, calls on_unhandled_exception on it. Additionally, if this call results in an exception, it is caught and Wx::AppConsole#on_unhandled_exception is called.



369
# File 'lib/wx/doc/gen/app.rb', line 369

def self.call_on_unhandled_exception; end

.get_mac_about_menu_itemidInteger Also known as: mac_about_menu_itemid

Get the current menu item id for the About menu item. Default is ID_ABOUT

Returns:

  • (Integer)

See Also:

Requires:

  • WXOSX


41
# File 'lib/wx/doc/app.rb', line 41

def get_mac_about_menu_itemid; end

.get_mac_exit_menu_itemidInteger Also known as: mac_exit_menu_itemid

Get the current menu item id for the Exit menu item. Default is ID_EXIT

Returns:

  • (Integer)

See Also:

Requires:

  • WXOSX


73
# File 'lib/wx/doc/app.rb', line 73

def get_mac_exit_menu_itemid; end

.get_mac_help_menu_titleString Also known as: mac_help_menu_title

Get the current title for the Help menu. Default is ‘&Help’

Returns:

  • (String)

See Also:

Requires:

  • WXOSX


89
# File 'lib/wx/doc/app.rb', line 89

def get_mac_help_menu_title; end

.get_mac_preferences_menu_itemidInteger Also known as: mac_preferences_menu_itemid

Get the current menu item id for the Preferences menu item. Default is ID_PREFERENCES

Returns:

  • (Integer)

See Also:

Requires:

  • WXOSX


57
# File 'lib/wx/doc/app.rb', line 57

def get_mac_preferences_menu_itemid; end

.get_mac_window_menu_titleString Also known as: mac_window_menu_title

Get the current title for the Window menu. Default is ‘&Window’

Returns:

  • (String)

See Also:

Requires:

  • WXOSX


105
# File 'lib/wx/doc/app.rb', line 105

def get_mac_window_menu_title; end

.get_main_top_windowWx::Window

Returns a pointer to the top application window if any.

This function is safe to call even before creating, or after destroying, the application object, as it simply returns nil if it doesn’t exist. Otherwise it’s equivalent to calling wxTheApp->get_top_window.

Returns:



296
# File 'lib/wx/doc/gen/app.rb', line 296

def self.get_main_top_window; end

.gtk_suppress_diagnostics(flags = -1)) ⇒ void

This method returns an undefined value.

Disables the printing of various GTK messages.

This function can be called to suppress GTK diagnostic messages that are output on the standard error stream by default. If WXSUPPRESS_GTK_DIAGNOSTICS environment variable is set to a non-zero value, wxWidgets automatically calls this function on program startup with the value of this variable as flags if it’s a number or with the default flags value otherwise. The default value of the argument disables all messages, but you can pass in a mask flag to specifically disable only particular categories of messages. Note that this function only works when using glib 2.50 (released in September 2016) or later and does nothing with the older versions of the library.

Availability: only available for the WXGTK port.

Parameters:

  • flags (Integer) (defaults to: -1))

    The mask for the types of messages to suppress. Refer to the glib documentation for the GLogLevelFlags enum, which defines the various message types.

Requires:

  • WXGTK


177
# File 'lib/wx/doc/gen/app.rb', line 177

def self.gtk_suppress_diagnostics(flags=-1) end

.is_main_loop_runningBoolean

Returns true if the main event loop is currently running, i.e. if the application is inside on_run.

This can be useful to test whether events can be dispatched. For example, if this function returns false, non-blocking sockets cannot be used because the events from them would never be processed.

Returns:

  • (Boolean)


500
# File 'lib/wx/doc/gen/app.rb', line 500

def self.is_main_loop_running; end

.run(&block) ⇒ Integer

Convenience method to instantiate an application object of the class and call the #run method for that application object.

Yield Returns:

  • (Boolean)

    return true if init block succeeded, false otherwise

Returns:

  • (Integer)

    return code from #run



24
# File 'lib/wx/doc/app.rb', line 24

def self.run(&block) end

.set_fatal_error_exit_code(code) ⇒ void

This method returns an undefined value.

Allows to set a custom process exit code if a fatal error happens.

If the program can’t continue due to a fatal error, such as receiving an unhandled exception or failing to initialize the graphical environment for the GUI applications, it terminates with the default fatal error exit code which is 255. This function can be used to change this default value to something else, e.g. -1 which used to be returned in the previous versions of wxWidgets (and corresponds to either 255 or 127 depending on the platform and compiler used) if compatibility is important. Notice that it has to be called as early as possible to take effect even during the early application initialization, e.g.

struct FatalErrorCodeInitializer {
      FatalErrorCodeInitializer() {
          wxApp::SetFatalErrorExitCode(3); // same as abort()
      }
  };
  
  // Create a global variable to call SetFatalErrorExitCode() in its ctor.
  static FatalErrorCodeInitializer s_fatalErrorCodeInitializer;

Note that this function doesn’t change the exit code returned if on_init returns false, so if you change the default value of this exit code you may want to call #set_error_exit_code to change the other one too.

Parameters:

  • code (Integer)


522
# File 'lib/wx/doc/gen/app.rb', line 522

def self.set_fatal_error_exit_code(code) end

.set_mac_about_menu_itemid(id) ⇒ Object Also known as: mac_about_menu_itemid=

Set the menu item id for the About menu item. Default is ID_ABOUT. Setting to ID_NONE will disable moving the About item to the Application menu.

Parameters:

  • id (Integer)

See Also:

Requires:

  • WXOSX


33
# File 'lib/wx/doc/app.rb', line 33

def set_mac_about_menu_itemid(id) end

.set_mac_exit_menu_itemid(id) ⇒ Object Also known as: mac_exit_menu_itemid=

Set the menu item id for the Exit menu item. Default is ID_EXIT. Setting to ID_NONE will disable hiding the exit item. Standard item will still be added to Application menu.

Parameters:

  • id (Integer)

See Also:

Requires:

  • WXOSX


65
# File 'lib/wx/doc/app.rb', line 65

def set_mac_exit_menu_itemid(id) end

.set_mac_help_menu_title(title) ⇒ Object Also known as: mac_help_menu_title=

Set the menu title for the Help menu. Default is ‘&Help’

Parameters:

  • title (String)

See Also:

Requires:

  • WXOSX


81
# File 'lib/wx/doc/app.rb', line 81

def set_mac_help_menu_title(title) end

.set_mac_preferences_menu_itemid(id) ⇒ Object Also known as: mac_preferences_menu_itemid=

Set the menu item id for the Preferences menu item. Default is ID_PREFERENCES

Parameters:

  • id (Integer)

See Also:

Requires:

  • WXOSX


49
# File 'lib/wx/doc/app.rb', line 49

def set_mac_preferences_menu_itemid(id) end

.set_mac_window_menu_title(title) ⇒ Object Also known as: mac_window_menu_title=

Set the menu title for the Window menu. Default is ‘&Window’

Parameters:

  • title (String)

See Also:

Requires:

  • WXOSX


97
# File 'lib/wx/doc/app.rb', line 97

def set_mac_window_menu_title(title) end

Instance Method Details

#delete_pending_eventsvoid

This method returns an undefined value.

Deletes the pending events of all EvtHandlers of this application.

See EvtHandler#delete_pending_events for warnings about deleting the pending events.



332
# File 'lib/wx/doc/gen/app.rb', line 332

def delete_pending_events; end

#exit_main_loopvoid

This method returns an undefined value.

Call this to explicitly exit the main message (event) loop.

You should normally exit the main loop (and the application) by deleting the top window. This function simply calls Wx::EvtLoopBase#exit on the active loop.



303
# File 'lib/wx/doc/gen/app.rb', line 303

def exit_main_loop; end

#filter_event(event) ⇒ Integer

Overridden EventFilter method.

This function is called before processing any event and allows the application to preempt the processing of some events, see EventFilter documentation for more information. Wx::App implementation of this method always return -1 indicating that the event should be processed normally.

Parameters:

Returns:

  • (Integer)


311
# File 'lib/wx/doc/gen/app.rb', line 311

def filter_event(event) end

#get_app_display_nameString Also known as: app_display_name

Returns the user-readable application name.

The difference between this string and the one returned by #get_app_name is that this one is meant to be shown to the user and so should be used for the window titles, page headers and so on while the other one should be only used internally, e.g. for the file names or configuration file keys. If the application name for display had been previously set by #set_app_display_name, it will be returned by this function. Otherwise, if #set_app_name had been called its value will be returned; also as is. Finally if none was called, this function returns the program name capitalized using Wx::String#capitalize.

Returns:

  • (String)


376
# File 'lib/wx/doc/gen/app.rb', line 376

def get_app_display_name; end

#get_app_nameString Also known as: app_name

Returns the application name.

If #set_app_name had been called, returns the string passed to it. Otherwise returns the program name, i.e. the value of argv passed to the main() function.

Returns:

  • (String)

See Also:



384
# File 'lib/wx/doc/gen/app.rb', line 384

def get_app_name; end

#get_class_nameString Also known as: class_name

Gets the class name of the application.

The class name may be used in a platform specific manner to refer to the application.

Returns:

  • (String)

See Also:



392
# File 'lib/wx/doc/gen/app.rb', line 392

def get_class_name; end

#get_exit_on_frame_deleteBoolean Also known as: exit_on_frame_delete

Returns true if the application will exit when the top-level frame is deleted.

Returns:

  • (Boolean)

See Also:



190
# File 'lib/wx/doc/gen/app.rb', line 190

def get_exit_on_frame_delete; end

#get_layout_directionWx::LayoutDirection Also known as: layout_direction

Return the layout direction for the current locale or LayoutDirection::Layout_Default if it’s unknown.

Returns:



195
# File 'lib/wx/doc/gen/app.rb', line 195

def get_layout_direction; end

#get_top_windowWx::Window Also known as: top_window

Returns a pointer to the top window.

Remark:

If the top window hasn't been set using #set_top_window, this function will find the first top-level window (frame or dialog or instance of TopLevelWindow) from the internal top level window list and return that.

Returns:

See Also:



215
# File 'lib/wx/doc/gen/app.rb', line 215

def get_top_window; end

#get_traitsWx::AppTraits Also known as: traits

Returns a pointer to the Wx::AppTraits object for the application.

If you want to customize the Wx::AppTraits object, you must override the create_traits function.

Returns:



399
# File 'lib/wx/doc/gen/app.rb', line 399

def get_traits; end

#get_use_best_visualBoolean Also known as: use_best_visual

Returns true if the application will use the best visual on systems that support different visuals, false otherwise.

Returns:

  • (Boolean)

See Also:



203
# File 'lib/wx/doc/gen/app.rb', line 203

def get_use_best_visual; end

#get_vendor_display_nameWx::String Also known as: vendor_display_name

Returns the user-readable vendor name.

The difference between this string and the one returned by #get_vendor_name is that this one is meant to be shown to the user and so should be used for the window titles, page headers and so on while the other one should be only used internally, e.g. for the file names or configuration file keys. By default, returns the same string as #get_vendor_name.

Returns:

  • (Wx::String)


407
# File 'lib/wx/doc/gen/app.rb', line 407

def get_vendor_display_name; end

#get_vendor_nameWx::String Also known as: vendor_name

Returns the application’s vendor name.

Returns:

  • (Wx::String)


412
# File 'lib/wx/doc/gen/app.rb', line 412

def get_vendor_name; end

#has_pending_eventsBoolean Also known as: has_pending_events?

Returns true if there are pending events on the internal pending event list.

Whenever EvtHandler#queue_event or EvtHandler#add_pending_event are called (not only for Wx::App itself, but for any event handler of the application!), the internal Wx::App‘s list of handlers with pending events is updated and this function will return true.

Returns:

  • (Boolean)


338
# File 'lib/wx/doc/gen/app.rb', line 338

def has_pending_events; end

#is_activeBoolean Also known as: active?

Returns true if the application is active, i.e. if one of its windows is currently in the foreground.

If this function returns false and you need to attract users attention to the application, you may use TopLevelWindow#request_user_attention to do it.

Returns:

  • (Boolean)


222
# File 'lib/wx/doc/gen/app.rb', line 222

def is_active; end

#mac_new_filevoid

This method returns an undefined value.

Called in response of an “open-application” Apple event.

Override this to create a new document in your app. Availability: only available for the WXOSX/Cocoa port.

Requires:

  • WXOSX


86
# File 'lib/wx/doc/gen/app.rb', line 86

def mac_new_file; end

#mac_open_files(fileNames) ⇒ void

This method returns an undefined value.

Called in response of an openFiles message.

You need to override this method in order to open one or more document files after the user double clicked on it or if the files and/or folders were dropped on either the application in the dock or the application icon in Finder. By default this method calls MacOpenFile for each file/folder. Availability: only available for the WXOSX/Cocoa port.

Parameters:

  • fileNames (Array<String>)

Requires:

  • WXOSX


96
# File 'lib/wx/doc/gen/app.rb', line 96

def mac_open_files(fileNames) end

#mac_open_url(url) ⇒ void

This method returns an undefined value.

Called in response of a “get-url” Apple event.

Availability: only available for the WXOSX/Cocoa port.

Parameters:

  • url (String)

Requires:

  • WXOSX


104
# File 'lib/wx/doc/gen/app.rb', line 104

def mac_open_url(url) end

#mac_print_file(fileName) ⇒ void

This method returns an undefined value.

Called in response of a “print-document” Apple event.

Availability: only available for the WXOSX/Cocoa port.

Parameters:

  • fileName (String)

Requires:

  • WXOSX


112
# File 'lib/wx/doc/gen/app.rb', line 112

def mac_print_file(fileName) end

#mac_reopen_appvoid

This method returns an undefined value.

Called in response of a “reopen-application” Apple event.

Availability: only available for the WXOSX/Cocoa port.

Requires:

  • WXOSX


119
# File 'lib/wx/doc/gen/app.rb', line 119

def mac_reopen_app; end

#msw_enable_dark_mode(flags = 0, settings = nil) ⇒ Boolean

Enable experimental dark mode support for MSW applications.

This function uses undocumented, and unsupported by Microsoft, functions to enable dark mode support for the desktop applications under Windows 10 20H1 or later (including all Windows 11 versions). Note that dark mode can also be enabled by setting the “msw.dark-mode” system option via an environment variable from outside the application or by calling #set_appearance with either System or Dark parameter. Known limitations of dark mode support include:

true if dark mode support was enabled, false if it couldn’t be done, most likely because the system doesn’t support dark mode.

Availability: only available for the WXMSW port.

Parameters:

  • flags (Integer) (defaults to: 0)

    Can include DarkMode_Always to force enabling dark mode for the application, even if the system doesn’t use the dark mode by default. Otherwise dark mode is only used if it is the default mode for the applications on the current system.

  • settings (Wx::DarkModeSettings) (defaults to: nil)

    If specified, allows to customize dark mode appearance. Please see DarkModeSettings documentation for more information.

Returns:

  • (Boolean)

Requires:

  • WXMSW


164
# File 'lib/wx/doc/gen/app.rb', line 164

def msw_enable_dark_mode(flags=0, settings=nil) end

#on_assert_failure(file, line, func, cond, msg) ⇒ void

This method returns an undefined value.

This function is called when an assert failure occurs, i.e. the condition specified in assert macro evaluated to false.

It is only called in debug mode (when WXDEBUG is defined) as asserts are not left in the release code at all. The base class version shows the default assert failure dialog box proposing to the user to stop the program, continue or ignore all subsequent asserts.

Parameters:

  • file (String)

    the name of the source file where the assert occurred

  • line (Integer)

    the line number in this file where the assert occurred

  • func (String)

    the name of the function where the assert occurred

  • cond (String)

    the condition of the failed assert in text form

  • msg (String)

    the message specified as argument to Wx::ASSERT_MSG or FAIL_MSG, will be nil if just Wx::ASSERT or FAIL was used



361
# File 'lib/wx/doc/gen/app.rb', line 361

def on_assert_failure(file, line, func, cond, msg) end

#osx_enable_automatic_tabbing(enable) ⇒ void

This method returns an undefined value.

Enable the automatic tabbing features of macOS.

This feature is native to the operating system. When it is enabled, macOS will automatically place windows inside tabs and show a tab bar in the application. Entries are also added to the View menu to show/hide the tab bar. Availability: only available for the WXOSX/Cocoa port.

Remark:

Requires macOS 10.12+, does nothing under earlier OS versions.

Parameters:

  • enable (Boolean)

Requires:

  • WXOSX


143
# File 'lib/wx/doc/gen/app.rb', line 143

def osx_enable_automatic_tabbing(enable) end

#osx_is_gui_applicationBoolean

May be overridden to indicate that the application is not a foreground GUI application under macOS.

This method is called during the application startup and returns true by default. In this case, wxWidgets ensures that the application is ran as a foreground, GUI application so that the user can interact with it normally, even if it is not bundled. If this is undesired, i.e. if the application doesn’t need to be brought to the foreground, this method can be overridden to return false. Notice that overriding it doesn’t make any difference for the bundled applications which are always foreground unless LSBackgroundOnly key is specified in the Info.plist file. Availability: only available for the WXOSX/Cocoa port.

Returns:

  • (Boolean)

Requires:

  • WXOSX


128
# File 'lib/wx/doc/gen/app.rb', line 128

def osx_is_gui_application; end

#process_pending_eventsvoid

This method returns an undefined value.

Process all pending events; it is necessary to call this function to process events posted with EvtHandler#queue_event or EvtHandler#add_pending_event.

This happens during each event loop iteration (see EventLoopBase) in GUI mode but it may be also called directly. Note that this function does not only process the pending events for the Wx::App object itself (which derives from EvtHandler) but also the pending events for any event handler of this application. This function will immediately return and do nothing if #suspend_processing_of_pending_events was called.



326
# File 'lib/wx/doc/gen/app.rb', line 326

def process_pending_events; end

#resume_processing_of_pending_eventsvoid

This method returns an undefined value.

Resume processing of the pending events previously stopped because of a call to #suspend_processing_of_pending_events.



350
# File 'lib/wx/doc/gen/app.rb', line 350

def resume_processing_of_pending_events; end

#run(&block) ⇒ Integer

Run the (main loop for) the application instance. Optionally runs a given block as the applications #on_init callback if no actual #on_init method has been defined. A given block will be ignored if an actual #on_init method has been defined.

Yield Returns:

  • (Boolean)

    return true if init block succeeded, false otherwise

Returns:

  • (Integer)

    return code from the #on_exit callback (0 if no #on_exit defined or called)



18
# File 'lib/wx/doc/app.rb', line 18

def run(&block) end

#safe_yield(win, onlyIfNeeded) ⇒ Boolean

This function is similar to #yield, except that it disables the user input to all program windows before calling Wx::AppConsole::Yield and re-enables it again afterwards.

If win is not nil, this window will remain enabled, allowing the implementation of some limited user interaction. Returns the result of the call to Wx::AppConsole::Yield.

Parameters:

Returns:

  • (Boolean)

See Also:



232
# File 'lib/wx/doc/gen/app.rb', line 232

def safe_yield(win, onlyIfNeeded) end

#safe_yield_for(win, eventsToProcess) ⇒ Boolean

Works like #safe_yield with onlyIfNeeded == true except that it allows the caller to specify a mask of events to be processed.

See Wx::EventLoopBase#yield_for for more info.

Parameters:

Returns:

  • (Boolean)


240
# File 'lib/wx/doc/gen/app.rb', line 240

def safe_yield_for(win, eventsToProcess) end

#set_app_display_name(name) ⇒ void Also known as: app_display_name=

This method returns an undefined value.

Set the application name to be used in the user-visible places such as window titles.

See #get_app_display_name for more about the differences between the display name and name. Notice that if this function is called, the name is used as is, without any capitalization as done by default by #get_app_display_name.

Parameters:

  • name (String)


421
# File 'lib/wx/doc/gen/app.rb', line 421

def set_app_display_name(name) end

#set_app_name(name) ⇒ void Also known as: app_name=

This method returns an undefined value.

Sets the name of the application.

This name should be used for file names, configuration file entries and other internal strings. For the user-visible strings, such as the window titles, the application display name set by #set_app_display_name is used instead. By default the application name is set to the name of its executable file.

Parameters:

  • name (String)

See Also:



431
# File 'lib/wx/doc/gen/app.rb', line 431

def set_app_name(name) end

#set_appearance(appearance) ⇒ Wx::App::AppearanceResult Also known as: appearance=

Request using either system default or explicitly light or dark theme for the application.

Under GTK and macOS applications use the system default appearance by default, and so it is only useful to call this function with either Wx::App::Appearance::Light or Wx::App::Appearance::Dark parameters if you need to override the default system appearance. The effect of calling this function is immediate, i.e. this function returns Wx::App::AppearanceResult::Ok, and affects all the existing windows as well as any windows created after this call. Under MSW, the default appearance is always light and the applications that want to follow the system appearance need to explicitly call this function with Wx::App::Appearance::System parameter in order to do it. Please note using dark appearance under MSW requires using non-documented system functions and has several known limitations, please see #msw_enable_dark_mode for more details. Also, on this platform the appearance can be only set before any windows are created and calling this function too late will return Wx::App::AppearanceResult::CannotChange. Note that to query the current appearance, you can use SystemAppearance, see SystemSettings.get_appearance. Wx::App::AppearanceResult::Ok if the appearance was successfully changed or had been already set to the requested value, Wx::App::AppearanceResult::CannotChange if the appearance can’t be changed any more because it’s too late to do it but could be changed if done immediately on next program launch (only returned by WXMSW currently) or Wx::App::AppearanceResult::Failure if changing the appearance failed for some other reason, e.g. because GTK_THEME is defined when using WXGTK of this function is not implemented at all for the current platform.

Parameters:

Returns:



250
# File 'lib/wx/doc/gen/app.rb', line 250

def set_appearance(appearance) end

#set_c_localevoid

This method returns an undefined value.

Sets the C locale to the default locale for the current environment.

It is advised to call this to ensure that the underlying toolkit uses the locale in which the numbers and monetary amounts are shown in the format expected by user and so on. Calling this function is roughly equivalent to calling

setlocale(LC_ALL, "");

but performs additional toolkit-specific tasks under some platforms and so should be used instead of setlocale() itself. Alternatively, you can use Locale to change the locale with more control. Notice that this does not change the global C++ locale, you need to do it explicitly if you want, e.g.

std::locale::global(std::locale(""));

but be warned that locale support in C++ standard library can be poor or worse under some platforms.



482
# File 'lib/wx/doc/gen/app.rb', line 482

def set_c_locale; end

#set_class_name(name) ⇒ void Also known as: class_name=

This method returns an undefined value.

Sets the class name of the application.

This may be used in a platform specific manner to refer to the application.

Parameters:

  • name (String)

See Also:



440
# File 'lib/wx/doc/gen/app.rb', line 440

def set_class_name(name) end

#set_error_exit_code(code) ⇒ void Also known as: error_exit_code=

This method returns an undefined value.

Sets the error code to use in case of exit on error.

This function is mostly useful to customize the error code returned by the application when it exits due to on_init returning false and can be called from on_init itself or other virtual functions called from it, for example on_cmd_line_error. By default, the exit code is 255 which indicates a generic error, so it is may be useful to call this function to set a more precise exit code, e.g. 2 which is a de facto standard exit code if command line parsing fails. Please also note that in the previous versions of wxWidgets this exit code was -1, which corresponds to either 255 or 127 depending on the platform and compiler used, so you may want to call this function with -1 argument if you need to preserve compatibility with the old behaviour. #set_error_exit_code can be overridden by the application to perform additional actions, but the overridden version should call the base class version to update the value returned by GetErrorExitCode() and actually used when exiting the application.

Parameters:

  • code (Integer)

See Also:



493
# File 'lib/wx/doc/gen/app.rb', line 493

def set_error_exit_code(code) end

#set_exit_on_frame_delete(flag) ⇒ void Also known as: exit_on_frame_delete=

This method returns an undefined value.

Allows the programmer to specify whether the application will exit when the top-level frame is deleted.

Parameters:

  • flag (Boolean)

    If true (the default), the application will exit when the top-level frame is deleted. If false, the application will continue to run.

See Also:



260
# File 'lib/wx/doc/gen/app.rb', line 260

def set_exit_on_frame_delete(flag) end

#set_native_theme(theme) ⇒ Boolean Also known as: native_theme=

Allows runtime switching of the UI environment theme.

Currently implemented for WXGTK2-only. Return true if theme was successfully changed.

Parameters:

  • theme (String)

    The name of the new theme or an absolute path to a gtkrc-theme-file

Returns:

  • (Boolean)


268
# File 'lib/wx/doc/gen/app.rb', line 268

def set_native_theme(theme) end

#set_top_window(window) ⇒ void Also known as: top_window=

This method returns an undefined value.

Sets the ‘top’ window.

You can call this from within on_init to let wxWidgets know which is the main window. You don’t have to set the top window; it is only a convenience so that (for example) certain dialogs without parents can use a specific window as the top window. If no top window is specified by the application, wxWidgets just uses the first frame or dialog (or better, any TopLevelWindow) in its top-level window list, when it needs to use the top window. If you previously called #set_top_window and now you need to restore this automatic behaviour you can call wxApp::SetTopWindow(nil).

Parameters:

See Also:



279
# File 'lib/wx/doc/gen/app.rb', line 279

def set_top_window(window) end

#set_use_best_visual(flag, forceTrueColour = false) ⇒ void Also known as: use_best_visual=

This method returns an undefined value.

Allows the programmer to specify whether the application will use the best visual on systems that support several visual on the same display.

This is typically the case under Solaris and IRIX, where the default visual is only 8-bit whereas certain applications are supposed to run in TrueColour mode. Note that this function has to be called in the constructor of the Wx::App instance and won’t have any effect when called later on. This function currently only has effect under GTK.

Parameters:

  • flag (Boolean)

    If true, the app will use the best visual.

  • forceTrueColour (Boolean) (defaults to: false)

    If true then the application will try to force using a TrueColour visual and abort the app if none is found.



289
# File 'lib/wx/doc/gen/app.rb', line 289

def set_use_best_visual(flag, forceTrueColour=false) end

#set_vendor_display_name(name) ⇒ void Also known as: vendor_display_name=

This method returns an undefined value.

Set the vendor name to be used in the user-visible places.

See #get_vendor_display_name for more about the differences between the display name and name.

Parameters:

  • name (String)


448
# File 'lib/wx/doc/gen/app.rb', line 448

def set_vendor_display_name(name) end

#set_vendor_name(name) ⇒ void Also known as: vendor_name=

This method returns an undefined value.

Sets the name of application’s vendor.

The name will be used in registry access. A default name is set by wxWidgets.

Parameters:

  • name (String)

See Also:



457
# File 'lib/wx/doc/gen/app.rb', line 457

def set_vendor_name(name) end

#suspend_processing_of_pending_eventsvoid

This method returns an undefined value.

Temporary suspends processing of the pending events.



346
# File 'lib/wx/doc/gen/app.rb', line 346

def suspend_processing_of_pending_events; end

#uses_event_loopBoolean

Returns true if the application is using an event loop.

This function always returns true for the GUI applications which must use an event loop but by default only returns true for the console programs if an event loop is already running as it can’t know whether one will be created in the future. Thus, it only makes sense to override it in console applications which do use an event loop, to return true instead of checking if there is a currently active event loop.

Returns:

  • (Boolean)


318
# File 'lib/wx/doc/gen/app.rb', line 318

def uses_event_loop; end

#yield(onlyIfNeeded = false) ⇒ Boolean

Yields control to pending messages in the event loop.

This method is a convenient wrapper for Wx::EvtLoopBase#yield. If the main loop is currently running, it calls this method on it. Otherwise it creates a temporary event loop and uses it instead, which can be useful to process pending messages during the program startup, before the main loop is created. Use extreme caution when calling this function as, just as Wx::EvtLoopBase#yield, it can result in unexpected reentrances.

Parameters:

  • onlyIfNeeded (Boolean) (defaults to: false)

Returns:

  • (Boolean)


466
# File 'lib/wx/doc/gen/app.rb', line 466

def yield(onlyIfNeeded=false) end