# :stopdoc:
# This file is automatically generated by the WXRuby3 documentation
# generator. Do not alter this file.
# :startdoc:
module Wx
# A menu bar is a series of menus accessible from the top of a frame.
# To respond to a menu selection, provide a handler for EVT_MENU, in the frame that contains the menu bar.
#
# If you have a toolbar which uses the same identifiers as your EVT_MENU entries, events from the toolbar will also be processed by your EVT_MENU event handlers.
# Tip: under Windows, if you discover that menu shortcuts (for example, Alt-F to show the file menu) are not working, check any EVT_CHAR events you are handling in child windows. If you are not calling event.Skip() for events that you don't process in these event handlers, menu shortcuts may cease to work.
# ===
#
# Category: {Wx::Menus}
# @see Wx::Menu
# @see Events and Event Handling
#
#
class MenuBar < Window
# Construct an empty menu bar.
# @param style [Integer] If {Wx::MB_DOCKABLE} the menu bar can be detached (wxGTK only).
# @return [Wx::MenuBar]
def initialize(style=0) end
# Adds the item to the end of the menu bar.
# true on success, false if an error occurred.
# @see Wx::MenuBar#insert
# @param menu [Wx::Menu] The menu to add. Do not deallocate this menu after calling {Wx::MenuBar#append}.
# @param title [String] The title of the menu, must be non-empty.
# @return [Boolean]
def append(menu, title) end
# Checks or unchecks a menu item.
# Only use this when the menu bar has been associated with a frame; otherwise, use the {Wx::Menu} equivalent call.
# @param id [Integer] The menu item identifier.
# @param check [Boolean] If true, checks the menu item, otherwise the item is unchecked.
# @return [void]
def check(id, check) end
# Enables or disables (greys out) a menu item.
# Only use this when the menu bar has been associated with a frame; otherwise, use the {Wx::Menu} equivalent call.
# @param id [Integer] The menu item identifier.
# @param enable [Boolean] true to enable the item, false to disable it.
# @return [void]
def enable(id, enable) end
# Returns true if the menu with the given index is enabled.
# @param pos [Integer] The menu position (0-based)
# @return [Boolean]
def is_enabled_top(pos) end
alias_method :enabled_top?, :is_enabled_top
# Enables or disables a whole menu.
# Only use this when the menu bar has been associated with a frame.
# @param pos [Integer] The position of the menu, starting from zero.
# @param enable [Boolean] true to enable the menu, false to disable it.
# @return [void]
def enable_top(pos, enable) end
# Finds the menu item object associated with the given menu item identifier.
# The found menu item object, or NULL if one was not found.
# @param id [Integer] Menu item identifier.
# @param menu [Wx::Menu] If not NULL, menu will get set to the associated menu.
# @return [Wx::MenuItem]
def find_item(id, menu=nil) end
# Returns the index of the menu with the given title or {Wx::NOT_FOUND} if no such menu exists in this menubar.
# The title parameter may specify either the menu title (with accelerator characters, i.e. "&File"
) or just the menu label ("File"
) indifferently.
# @param title [String]
# @return [Integer]
def find_menu(title) end
# Finds the menu item id for a menu name/menu item string pair.
# The menu item identifier, or {Wx::NOT_FOUND} if none was found.
#
# Any special menu codes are stripped out of source and target strings before matching.
# @param menuString [String] Menu title to find.
# @param itemString [String] Item to find.
# @return [Integer]
def find_menu_item(menuString, itemString) end
# Gets the help string associated with the menu item identifier.
# The help string, or the empty string if there was no help string or the menu item was not found.
# @see Wx::MenuBar#set_help_string
# @param id [Integer] The menu item identifier.
# @return [String]
def get_help_string(id) end
alias_method :help_string, :get_help_string
# Gets the label associated with a menu item.
# The menu item label, or the empty string if the item was not found.
#
# Use only after the menubar has been associated with a frame.
# @param id [Integer] The menu item identifier.
# @return [String]
def get_label(id) end
alias_method :label, :get_label
# Returns the menu at menuIndex (zero-based).
# @param menuIndex [Integer]
# @return [Wx::Menu]
def get_menu(menuIndex) end
alias_method :menu, :get_menu
# Returns the number of menus in this menubar.
# @return [Integer]
def get_menu_count; end
alias_method :menu_count, :get_menu_count
# Returns the label of a top-level menu.
# Note that the returned string includes the accelerator characters that have been specified in the menu title string during its construction.
#
# The menu label, or the empty string if the menu was not found.
#
# Use only after the menubar has been associated with a frame.
# @see Wx::MenuBar#get_menu_label_text
# @see Wx::MenuBar#set_menu_label
# @param pos [Integer] Position of the menu on the menu bar, starting from zero.
# @return [String]
def get_menu_label(pos) end
alias_method :menu_label, :get_menu_label
# Returns the label of a top-level menu.
# Note that the returned string does not include any accelerator characters that may have been specified in the menu title string during its construction.
#
# The menu label, or the empty string if the menu was not found.
#
# Use only after the menubar has been associated with a frame.
# @see Wx::MenuBar#get_menu_label
# @see Wx::MenuBar#set_menu_label
# @param pos [Integer] Position of the menu on the menu bar, starting from zero.
# @return [String]
def get_menu_label_text(pos) end
alias_method :menu_label_text, :get_menu_label_text
# Inserts the menu at the given position into the menu bar.
# Inserting menu at position 0 will insert it in the very beginning of it, inserting at position {Wx::MenuBar#get_menu_count} is the same as calling {Wx::MenuBar#append}.
#
# true on success, false if an error occurred.
# @see Wx::MenuBar#append
# @param pos [Integer] The position of the new menu in the menu bar
# @param menu [Wx::Menu] The menu to add. {Wx::MenuBar} owns the menu and will free it.
# @param title [String] The title of the menu.
# @return [Boolean]
def insert(pos, menu, title) end
# Determines whether an item is checked.
# true if the item was found and is checked, false otherwise.
# @param id [Integer] The menu item identifier.
# @return [Boolean]
def is_checked(id) end
alias_method :checked?, :is_checked
# Determines whether an item is enabled.
# true if the item was found and is enabled, false otherwise.
# @param id [Integer] The menu item identifier.
# @return [Boolean]
def is_enabled(id) end
alias_method :enabled?, :is_enabled
# Removes the menu from the menu bar and returns the menu object - the caller is responsible for deleting it.
# This function may be used together with {Wx::MenuBar#insert} to change the menubar dynamically.
# @see Wx::MenuBar#replace
# @param pos [Integer]
# @return [Wx::Menu]
def remove(pos) end
# Replaces the menu at the given position with another one.
# The menu which was previously at position pos. The caller is responsible for deleting it.
# @see Wx::MenuBar#insert
# @see Wx::MenuBar#remove
# @param pos [Integer] The position of the new menu in the menu bar
# @param menu [Wx::Menu] The menu to add.
# @param title [String] The title of the menu.
# @return [Wx::Menu]
def replace(pos, menu, title) end
# Sets the help string associated with a menu item.
#
# @see Wx::MenuBar#get_help_string
# @param id [Integer] Menu item identifier.
# @param helpString [String] Help string to associate with the menu item.
# @return [void]
def set_help_string(id, helpString) end
# Sets the label of a menu item.
# Use only after the menubar has been associated with a frame.
# @see Wx::MenuBar#get_label
# @param id [Integer] Menu item identifier.
# @param label [String] Menu item label.
# @return [void]
def set_label(id, label) end
# Sets the label of a top-level menu.
# Use only after the menubar has been associated with a frame.
# @param pos [Integer] The position of a menu on the menu bar, starting from zero.
# @param label [String] The menu label.
# @return [void]
def set_menu_label(pos, label) end
# @return [Wx::Frame]
def get_frame; end
alias_method :frame, :get_frame
# @return [Boolean]
def is_attached; end
alias_method :attached?, :is_attached
# @param frame [Wx::Frame]
# @return [void]
def attach(frame) end
# @return [void]
def detach; end
end # MenuBar
end