Class: Wx::Menu

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

Overview

A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes away (clicking elsewhere dismisses the menu).

Menus may be used to construct either menu bars or popup menus. A menu item has an integer ID associated with it which can be used to identify the selection, or to change the menu item in some way. A menu item with a special identifier StandardID::ID_SEPARATOR is a separator item and doesn’t have an associated command but just makes a separator line appear in the menu.

Note:

Please note that StandardID::ID_ABOUT and StandardID::ID_EXIT are predefined by wxWidgets and have a special meaning since entries using these IDs will be taken out of the normal menus under macOS and will be inserted into the system menu (following the appropriate macOS interface guideline).

Menu items may be either normal items, check items or radio items. Normal items don’t have any special properties while the check items have a boolean flag associated to them and they show a checkmark in the menu when the flag is set. wxWidgets automatically toggles the flag value when the item is clicked and its value may be retrieved using either #is_checked method of Menu or MenuBar itself or by using Event::IsChecked when you get the menu notification for the item in question. The radio items are similar to the check items except that all the other items in the same radio group are unchecked when a radio item is checked. The radio group is formed by a contiguous range of radio items, i.e. it starts at the first item of this kind and ends with the first item of a different kind (or the end of the menu). Notice that because the radio groups are defined in terms of the item positions inserting or removing the items in the menu containing the radio items risks to not work correctly.

Allocation strategy

All menus must be created on the heap because all menus attached to a menubar or to another menu will be deleted by their parent when it is deleted. The only exception to this rule are the popup menus (i.e. menus used with Window#popup_menu) as wxWidgets does not destroy them to allow reusing the same menu more than once. But the exception applies only to the menus themselves and not to any submenus of popup menus which are still destroyed by wxWidgets as usual and so must be heap-allocated. As the frame menubar is deleted by the frame itself, it means that normally all menus used are deleted automatically.

Event handling

Event handlers for the commands generated by the menu items can be connected directly to the menu object itself using EvtHandler#bind. If this menu is a submenu of another one, the events from its items can also be processed in the parent menu and so on, recursively. If the menu is part of a menu bar, then events can also be handled in MenuBar object. Finally, menu events can also be handled in the associated window, which is either the Frame associated with the menu bar this menu belongs to or the window for which Window#popup_menu was called for the popup menus. See Dynamic Event Handling for how to bind event handlers to the various objects.

Category: Menus

See Also:

Requires:

  • USE_MENUS

Instance Method Summary collapse

Methods inherited from EvtHandler

add_filter, #add_pending_event, #call_after, clear_filters, #connect, #delete_pending_events, #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_display_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_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_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_capture_changed, #evt_mouse_capture_lost, #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_command, #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, #process_pending_events, #queue_event, register_class, remove_filter, #safely_process_event, #set_client_object, #set_evt_handler_enabled, #set_next_handler, #set_previous_handler, #try_after, #try_before, #unlink

Methods inherited from Object

#clone, #dup, #is_same_as, #un_share

Constructor Details

#initializeWx::Menu #initialize(title, style = 0) ⇒ Wx::Menu

Returns a new instance of Menu.

Overloads:

  • #initializeWx::Menu

    Constructs a Wx::Menu object.

  • #initialize(title, style = 0) ⇒ Wx::Menu

    Constructs a Wx::Menu object with a title.

    Parameters:

    • title (String)

      Title at the top of the menu (not always supported).

    • style (Integer) (defaults to: 0)

      If set to Wx::MENU_TEAROFF, the menu will be detachable (WXGTK and QT only).



60
# File 'lib/wx/doc/gen/menu.rb', line 60

def initialize(*args) end

Instance Method Details

#append(id, item = (''), helpString = (''), kind = Wx::ItemKind::ITEM_NORMAL) ⇒ Wx::MenuItem #append(menuItem) ⇒ Wx::MenuItem

Overloads:



114
# File 'lib/wx/doc/gen/menu.rb', line 114

def append(*args) end

#append_check_item(id, item, help = ('')) ⇒ Wx::MenuItem

Adds a checkable item to the end of the menu.

Parameters:

  • id (Integer)
  • item (String)
  • help (String) (defaults to: (''))

Returns:

See Also:



125
# File 'lib/wx/doc/gen/menu.rb', line 125

def append_check_item(id, item, help=('')) end

#append_radio_item(id, item, help = ('')) ⇒ Wx::MenuItem

Adds a radio item to the end of the menu.

All consequent radio items form a group and when an item in the group is checked, all the others are automatically unchecked.

Note:

Radio items are not supported under Wx::Motif.

Parameters:

  • id (Integer)
  • item (String)
  • help (String) (defaults to: (''))

Returns:

See Also:



142
# File 'lib/wx/doc/gen/menu.rb', line 142

def append_radio_item(id, item, help=('')) end

#append_separatorWx::MenuItem

Adds a separator to the end of the menu.

Returns:

See Also:



150
# File 'lib/wx/doc/gen/menu.rb', line 150

def append_separator; end

#append_sub_menu(submenu, text, help = ('')) ⇒ Wx::MenuItem

Adds the given submenu to this menu.

text is the text shown in the menu for it and help is the help string shown in the status bar when the submenu item is selected.

Parameters:

  • submenu (Wx::Menu)
  • text (String)
  • help (String) (defaults to: (''))

Returns:

See Also:



161
# File 'lib/wx/doc/gen/menu.rb', line 161

def append_sub_menu(submenu, text, help=('')) end

#attach(menubar) ⇒ void

This method returns an undefined value.

Parameters:



537
# File 'lib/wx/doc/gen/menu.rb', line 537

def attach(menubar) end

#break_void

This method returns an undefined value.

Inserts a break in a menu, causing the next appended item to appear in a new column.

This function only actually inserts a break in WXMSW and does nothing under the other platforms.



167
# File 'lib/wx/doc/gen/menu.rb', line 167

def break_; end

#check(id, check) ⇒ void

This method returns an undefined value.

Checks or unchecks the menu item.

Parameters:

  • id (Integer)

    The menu item identifier.

  • check (Boolean)

    If true, the item will be checked, otherwise it will be unchecked.

See Also:



176
# File 'lib/wx/doc/gen/menu.rb', line 176

def check(id, check) end

#delete(id) ⇒ Boolean #delete(item) ⇒ Boolean

Overloads:

  • #delete(id) ⇒ Boolean

    Deletes the menu item from the menu.

    If the item is a submenu, it will not be deleted. Use #destroy if you want to delete a submenu.

    Parameters:

    • id (Integer)

      Id of the menu item to be deleted.

    Returns:

    • (Boolean)

    See Also:

  • #delete(item) ⇒ Boolean

    Deletes the menu item from the menu.

    If the item is a submenu, it will not be deleted. Use #destroy if you want to delete a submenu.

    Parameters:

    Returns:

    • (Boolean)

    See Also:



196
# File 'lib/wx/doc/gen/menu.rb', line 196

def delete(*args) end

#destroy(id) ⇒ Boolean #destroy(item) ⇒ Boolean

Overloads:

  • #destroy(id) ⇒ Boolean

    Deletes the menu item from the menu.

    If the item is a submenu, it will be deleted. Use #remove if you want to keep the submenu (for example, to reuse it later).

    Parameters:

    • id (Integer)

      Id of the menu item to be deleted.

    Returns:

    • (Boolean)

    See Also:

  • #destroy(item) ⇒ Boolean

    Deletes the menu item from the menu.

    If the item is a submenu, it will be deleted. Use #remove if you want to keep the submenu (for example, to reuse it later).

    Parameters:

    Returns:

    • (Boolean)

    See Also:



216
# File 'lib/wx/doc/gen/menu.rb', line 216

def destroy(*args) end

#detachvoid

This method returns an undefined value.



540
# File 'lib/wx/doc/gen/menu.rb', line 540

def detach; end

#each_item {|item| ... } ⇒ Object, Enumerator

Yield each menu item to the given block. Returns an Enumerator if no block given.

Yield Parameters:

Returns:

  • (Object, Enumerator)

    last result of block or Enumerator if no block given.



16
# File 'lib/wx/doc/menu.rb', line 16

def each_item; end

#enable(id, enable) ⇒ void

This method returns an undefined value.

Enables or disables (greys out) a menu item.

Parameters:

  • id (Integer)

    The menu item identifier.

  • enable (Boolean)

    true to enable the menu item, false to disable it.

See Also:



225
# File 'lib/wx/doc/gen/menu.rb', line 225

def enable(id, enable) end

#find_child_item(id) ⇒ Array(Wx::MenuItem,Integer)

Finds the menu item object associated with the given menu item identifier and, optionally, the position of the item in the menu.

Unlike #find_item, this function doesn’t recurse but only looks at the direct children of this menu.

Menu item object or NULL if not found.

Parameters:

  • id (Integer)

    The identifier of the menu item to find.

Returns:



234
# File 'lib/wx/doc/gen/menu.rb', line 234

def find_child_item(id) end

#find_item(itemString) ⇒ Integer #find_item(id) ⇒ Array(Wx::MenuItem,Wx::Menu)

Overloads:

  • #find_item(itemString) ⇒ Integer

    Finds the menu id for a menu item string.

    Menu item identifier, or NOT_FOUND if none is found.

    Remark:

    Any special menu codes are stripped out of source and target strings before matching.

    Parameters:

    • itemString (String)

      Menu item string to find.

    Returns:

    • (Integer)
  • #find_item(id) ⇒ Array(Wx::MenuItem,Wx::Menu)

    Finds the menu item object associated with the given menu item identifier and, optionally, the (sub)menu it belongs to.

    Menu item object or NULL if none is found.

    Parameters:

    • id (Integer)

      Menu item identifier.

    Returns:



254
# File 'lib/wx/doc/gen/menu.rb', line 254

def find_item(*args) end

#find_item_by_position(position) ⇒ Wx::MenuItem

Returns the Wx::MenuItem given a position in the menu.

Parameters:

  • position (Integer)

Returns:



259
# File 'lib/wx/doc/gen/menu.rb', line 259

def find_item_by_position(position) end

#get_help_string(id) ⇒ String Also known as: help_string

Returns the help string associated with a menu item.

The help string, or the empty string if there is no help string or the item was not found.

Parameters:

  • id (Integer)

    The menu item identifier.

Returns:

  • (String)

See Also:



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

def get_help_string(id) end

#get_invoking_windowWx::Window Also known as: invoking_window

Returns:



515
# File 'lib/wx/doc/gen/menu.rb', line 515

def get_invoking_window; end

#get_label(id) ⇒ String Also known as: label

Returns a menu item label.

The item label, or the empty string if the item was not found.

Parameters:

  • id (Integer)

    The menu item identifier.

Returns:

  • (String)

See Also:



278
# File 'lib/wx/doc/gen/menu.rb', line 278

def get_label(id) end

#get_label_text(id) ⇒ String Also known as: label_text

Returns a menu item label, without any of the original mnemonics and accelerators.

The item label, or the empty string if the item was not found.

Parameters:

  • id (Integer)

    The menu item identifier.

Returns:

  • (String)

See Also:



288
# File 'lib/wx/doc/gen/menu.rb', line 288

def get_label_text(id) end

#get_menu_item_countInteger Also known as: menu_item_count

Returns the number of items in the menu.

Returns:

  • (Integer)


293
# File 'lib/wx/doc/gen/menu.rb', line 293

def get_menu_item_count; end

#get_menu_itemsWx::MenuItemList Also known as: menu_items

Returns the list of items in the menu.

Wx::MenuItemList is a pseudo-template list class containing Wx::MenuItem pointers, see List.

Returns:

  • (Wx::MenuItemList)


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

def get_menu_items; end

#get_parentWx::Menu Also known as: parent

Returns:



532
# File 'lib/wx/doc/gen/menu.rb', line 532

def get_parent; end

#get_styleInteger Also known as: style

Returns:

  • (Integer)


523
# File 'lib/wx/doc/gen/menu.rb', line 523

def get_style; end

#get_titleWx::String Also known as: title

Returns the title of the menu.

Returns:

  • (Wx::String)

See Also:



301
# File 'lib/wx/doc/gen/menu.rb', line 301

def get_title; end

#get_windowWx::Window Also known as: window

Returns:



519
# File 'lib/wx/doc/gen/menu.rb', line 519

def get_window; end

#insert(pos, menuItem) ⇒ Wx::MenuItem #insert(pos, id, item = (''), helpString = (''), kind = Wx::ItemKind::ITEM_NORMAL) ⇒ Wx::MenuItem #insert(pos, id, text, submenu, help = ('')) ⇒ Wx::MenuItem

Overloads:

  • #insert(pos, menuItem) ⇒ Wx::MenuItem

    Inserts the given item before the position pos.

    Inserting the item at position #get_menu_item_count is the same as appending it.

    Parameters:

    Returns:

    See Also:

  • #insert(pos, id, item = (''), helpString = (''), kind = Wx::ItemKind::ITEM_NORMAL) ⇒ Wx::MenuItem

    Inserts the given item before the position pos.

    Inserting the item at position #get_menu_item_count is the same as appending it.

    Parameters:

    • pos (Integer)
    • id (Integer)
    • item (String) (defaults to: (''))
    • helpString (String) (defaults to: (''))
    • kind (Wx::ItemKind) (defaults to: Wx::ItemKind::ITEM_NORMAL)

    Returns:

    See Also:

  • #insert(pos, id, text, submenu, help = ('')) ⇒ Wx::MenuItem

    Inserts the given submenu before the position pos.

    text is the text shown in the menu for it and help is the help string shown in the status bar when the submenu item is selected.

    Parameters:

    • pos (Integer)
    • id (Integer)
    • text (String)
    • submenu (Wx::Menu)
    • help (String) (defaults to: (''))

    Returns:

    See Also:



337
# File 'lib/wx/doc/gen/menu.rb', line 337

def insert(*args) end

#insert_check_item(pos, id, item, helpString = ('')) ⇒ Wx::MenuItem

Inserts a checkable item at the given position.

Parameters:

  • pos (Integer)
  • id (Integer)
  • item (String)
  • helpString (String) (defaults to: (''))

Returns:

See Also:



349
# File 'lib/wx/doc/gen/menu.rb', line 349

def insert_check_item(pos, id, item, helpString=('')) end

#insert_radio_item(pos, id, item, helpString = ('')) ⇒ Wx::MenuItem

Inserts a radio item at the given position.

Parameters:

  • pos (Integer)
  • id (Integer)
  • item (String)
  • helpString (String) (defaults to: (''))

Returns:

See Also:



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

def insert_radio_item(pos, id, item, helpString=('')) end

#insert_separator(pos) ⇒ Wx::MenuItem

Inserts a separator at the given position.

Parameters:

  • pos (Integer)

Returns:

See Also:



370
# File 'lib/wx/doc/gen/menu.rb', line 370

def insert_separator(pos) end

#is_attachedBoolean Also known as: attached?

Returns:

  • (Boolean)


543
# File 'lib/wx/doc/gen/menu.rb', line 543

def is_attached; end

#is_checked(id) ⇒ Boolean Also known as: checked?

Determines whether a menu item is checked.

true if the menu item is checked, false otherwise.

Parameters:

  • id (Integer)

    The menu item identifier.

Returns:

  • (Boolean)

See Also:



378
# File 'lib/wx/doc/gen/menu.rb', line 378

def is_checked(id) end

#is_enabled(id) ⇒ Boolean Also known as: enabled?

Determines whether a menu item is enabled.

true if the menu item is enabled, false otherwise.

Parameters:

  • id (Integer)

    The menu item identifier.

Returns:

  • (Boolean)

See Also:



387
# File 'lib/wx/doc/gen/menu.rb', line 387

def is_enabled(id) end

#prepend(item) ⇒ Wx::MenuItem #prepend(id, item = (''), helpString = (''), kind = Wx::ItemKind::ITEM_NORMAL) ⇒ Wx::MenuItem #prepend(id, text, submenu, help = ('')) ⇒ Wx::MenuItem

Overloads:

  • #prepend(item) ⇒ Wx::MenuItem

    Inserts the given item at position 0, i.e. before all the other existing items.

    Parameters:

    Returns:

    See Also:

  • #prepend(id, item = (''), helpString = (''), kind = Wx::ItemKind::ITEM_NORMAL) ⇒ Wx::MenuItem

    Inserts the given item at position 0, i.e. before all the other existing items.

    Parameters:

    • id (Integer)
    • item (String) (defaults to: (''))
    • helpString (String) (defaults to: (''))
    • kind (Wx::ItemKind) (defaults to: Wx::ItemKind::ITEM_NORMAL)

    Returns:

    See Also:

  • #prepend(id, text, submenu, help = ('')) ⇒ Wx::MenuItem

    Inserts the given submenu at position 0.

    Parameters:

    • id (Integer)
    • text (String)
    • submenu (Wx::Menu)
    • help (String) (defaults to: (''))

    Returns:

    See Also:



420
# File 'lib/wx/doc/gen/menu.rb', line 420

def prepend(*args) end

#prepend_check_item(id, item, helpString = ('')) ⇒ Wx::MenuItem

Inserts a checkable item at position 0.

Parameters:

  • id (Integer)
  • item (String)
  • helpString (String) (defaults to: (''))

Returns:

See Also:



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

def prepend_check_item(id, item, helpString=('')) end

#prepend_radio_item(id, item, helpString = ('')) ⇒ Wx::MenuItem

Inserts a radio item at position 0.

Parameters:

  • id (Integer)
  • item (String)
  • helpString (String) (defaults to: (''))

Returns:

See Also:



442
# File 'lib/wx/doc/gen/menu.rb', line 442

def prepend_radio_item(id, item, helpString=('')) end

#prepend_separatorWx::MenuItem

Inserts a separator at position 0.

Returns:

See Also:



450
# File 'lib/wx/doc/gen/menu.rb', line 450

def prepend_separator; end

#remove(id) ⇒ Wx::MenuItem #remove(item) ⇒ Wx::MenuItem

Overloads:

  • #remove(id) ⇒ Wx::MenuItem

    Removes the menu item from the menu but doesn’t delete the associated C++ object.

    This allows you to reuse the same item later by adding it back to the menu (especially useful with submenus).

    A pointer to the item which was detached from the menu.

    Parameters:

    • id (Integer)

      The identifier of the menu item to remove.

    Returns:

  • #remove(item) ⇒ Wx::MenuItem

    Removes the menu item from the menu but doesn’t delete the associated C++ object.

    This allows you to reuse the same item later by adding it back to the menu (especially useful with submenus).

    A pointer to the item which was detached from the menu.

    Parameters:

    Returns:



468
# File 'lib/wx/doc/gen/menu.rb', line 468

def remove(*args) end

#set_help_string(id, helpString) ⇒ void

This method returns an undefined value.

Sets an item’s help string.

Parameters:

  • id (Integer)

    The menu item identifier.

  • helpString (String)

    The help string to set.

See Also:



477
# File 'lib/wx/doc/gen/menu.rb', line 477

def set_help_string(id, helpString) end

#set_invoking_window(win) ⇒ void Also known as: invoking_window=

This method returns an undefined value.

Parameters:



511
# File 'lib/wx/doc/gen/menu.rb', line 511

def set_invoking_window(win) end

#set_label(id, label) ⇒ void

This method returns an undefined value.

Sets the label of a menu item.

Parameters:

  • id (Integer)

    The menu item identifier.

  • label (String)

    The menu item label to set.

See Also:



487
# File 'lib/wx/doc/gen/menu.rb', line 487

def set_label(id, label) end

#set_parent(parent) ⇒ void Also known as: parent=

This method returns an undefined value.

Parameters:



528
# File 'lib/wx/doc/gen/menu.rb', line 528

def set_parent(parent) end

#set_title(title) ⇒ void Also known as: title=

This method returns an undefined value.

Sets the title of the menu.

Remark:

Notice that you can only call this method directly for the popup menus, to change the title of a menu that is part of a menu bar you need to use Wx::MenuBar#set_label_top.

Parameters:

  • title (String)

    The title to set.

See Also:



499
# File 'lib/wx/doc/gen/menu.rb', line 499

def set_title(title) end

#update_ui(source = nil) ⇒ void

This method returns an undefined value.

Update the state of all menu items, recursively, by generating EVT_UPDATE_UI events for them.

This is an internal wxWidgets function and shouldn’t normally be called from outside of the library. If it is called, source argument should not be used, it is deprecated and exists only for backwards compatibility.

Parameters:



507
# File 'lib/wx/doc/gen/menu.rb', line 507

def update_ui(source=nil) end