# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # FRAME_NO_TASKBAR = 2 # FRAME_TOOL_WINDOW = 4 # FRAME_FLOAT_ON_PARENT = 8 # A frame is a window whose size and position can (usually) be changed by the user. # It usually has thick borders and a title bar, and can optionally contain a menu bar, toolbar and status bar. A frame can contain any window that is not a frame or dialog. # A frame that has a status bar and toolbar, created via the {Wx::Frame#create_status_bar} and {Wx::Frame#create_tool_bar} functions, manages these windows and adjusts the value returned by {Wx::Frame#get_client_size} to reflect the remaining size available to application windows. # If a frame is to be used as an input form, the controls should not be created as its children. Instead, a {Wx::Panel} should be created as the sole child of the frame, serving as the parent of the actual controls (the frame will size the panel so it always fills its client area). Doing this will ensure that tabbing between the controls works and the frame background has the expected colour. Moreover, as a frame is by default resizable, it could be better to use {Wx::ScrolledWindow} instead of {Wx::Panel}, to make sure the controls are easily accessible regardless of the frame size. However, please consider whether it would not be better to use {Wx::Dialog} instead of {Wx::Frame}, where using a panel like this is not needed and {Wx::Dialog} also offers other benefits such as creating specialized sizers (e.g., for buttons, with their platform-correct order). # An application should normally define a {Wx::CloseEvent} handler for the frame to respond to system close events, for example so that related data and subwindows can be cleaned up. # # == Default event processing # # {Wx::Frame} processes the following events: # # - {Wx::EVT_SIZE}: if the frame has exactly one child window, not counting the status and toolbar, this child is resized to take the entire frame client area. If two or more windows are present, they should be laid out explicitly either by manually handling {Wx::EVT_SIZE} or using sizers; # # - {Wx::EVT_MENU_HIGHLIGHT}: the default implementation displays the help string associated with the selected item in the first pane of the status bar, if there is one. # # === Styles # # This class supports the following styles: # # - {Wx::DEFAULT_FRAME_STYLE}: Defined as {Wx::MINIMIZE_BOX} | {Wx::MAXIMIZE_BOX} | {Wx::RESIZE_BORDER} | {Wx::SYSTEM_MENU} | {Wx::CAPTION} | {Wx::CLOSE_BOX} | {Wx::CLIP_CHILDREN}. # # - {Wx::ICONIZE}: Display the frame iconized (minimized). Windows only. # # - {Wx::CAPTION}: Puts a caption on the frame. Notice that this flag is required by {Wx::MINIMIZE_BOX}, {Wx::MAXIMIZE_BOX} and {Wx::CLOSE_BOX} on most systems as the corresponding buttons cannot be shown if the window has no title bar at all. I.e. if {Wx::CAPTION} is not specified those styles would be simply ignored. # # - {Wx::MINIMIZE}: Identical to {Wx::ICONIZE}. Windows only. # # - {Wx::MINIMIZE_BOX}: Displays a minimize box on the frame. # # - {Wx::MAXIMIZE}: Displays the frame maximized. Windows and GTK+ only. # # - {Wx::MAXIMIZE_BOX}: Displays a maximize box on the frame. Notice that under wxGTK {Wx::RESIZE_BORDER} must be used as well or this style is ignored. # # - {Wx::CLOSE_BOX}: Displays a close box on the frame. # # - {Wx::STAY_ON_TOP}: Stay on top of all other windows, see also {Wx::FRAME_FLOAT_ON_PARENT}. # # - {Wx::SYSTEM_MENU}: Displays a system menu containing the list of various windows commands in the window title bar. Unlike {Wx::MINIMIZE_BOX}, {Wx::MAXIMIZE_BOX} and {Wx::CLOSE_BOX} styles this style can be used without {Wx::CAPTION}, at least under Windows, and makes the system menu available without showing it on screen in this case. However it is recommended to only use it together with {Wx::CAPTION} for consistent behaviour under all platforms. # # - {Wx::RESIZE_BORDER}: Displays a resizable border around the window. # # - {Wx::FRAME_TOOL_WINDOW}: Causes a frame with a small title bar to be created; the frame does not appear in the taskbar under Windows or GTK+. # # - {Wx::FRAME_NO_TASKBAR}: Creates an otherwise normal frame but it does not appear in the taskbar under Windows or GTK+ (note that it will minimize to the desktop window under Windows which may seem strange to the users and thus it might be better to use this style only without {Wx::MINIMIZE_BOX} style). In wxGTK, the flag is respected only if the window manager supports _NET_WM_STATE_SKIP_TASKBAR hint. # # - {Wx::FRAME_FLOAT_ON_PARENT}: The frame will always be on top of its parent (unlike {Wx::STAY_ON_TOP}). A frame created with this style must have a non-NULL parent. # # - {Wx::FRAME_SHAPED}: Windows with this style are allowed to have their shape changed with the {Wx::Frame#set_shape} method. # # The default frame style is for normal, resizable frames. To create a frame which cannot be resized by user, you may use the following combination of styles: # # ```ruby # Wx::DEFAULT_FRAME_STYLE & ~(Wx::RESIZE_BORDER | Wx::MAXIMIZE_BOX) # ``` # # See also the Window Styles. # # === Extra Styles # # This class supports the following extra styles: # # - {Wx::FRAME_EX_CONTEXTHELP}: Under Windows, puts a query button on the caption. When pressed, Windows will go into a context-sensitive help mode and wxWidgets will send a {Wx::EVT_HELP} event if the user clicked on an application window. Note that this is an extended style and must be set by calling SetExtraStyle before Create is called (two-step construction). You cannot use this style together with {Wx::MAXIMIZE_BOX} or {Wx::MINIMIZE_BOX}, so you should use {Wx::DEFAULT_FRAME_STYLE} ~ ({Wx::MINIMIZE_BOX} | {Wx::MAXIMIZE_BOX}) for the frames having this style (the dialogs don't have a minimize or a maximize box by default) # # - {Wx::FRAME_EX_METAL}: On macOS, frames with this style will be shown with a metallic look. This is an extra style. # # === Events emitted by this class # # Event handler methods for events emitted by this class: # # - {Wx::EvtHandler#evt_close}(meth = nil, &block): Process a {Wx::EVT_CLOSE_WINDOW} event when the frame is being closed by the user or programmatically (see {Wx::Window#close}). The user may generate this event clicking the close button (typically the 'X' on the top-right of the title bar) if it's present (see the {Wx::CLOSE_BOX} style). See {Wx::CloseEvent}. # # - {Wx::EvtHandler#evt_iconize}(meth = nil, &block): Process a {Wx::EVT_ICONIZE} event. See {Wx::IconizeEvent}. # # - {Wx::EvtHandler#evt_menu_open}(meth = nil, &block): A menu is about to be opened. See {Wx::MenuEvent}. # # - {Wx::EvtHandler#evt_menu_close}(meth = nil, &block): A menu has been just closed. See {Wx::MenuEvent}. # # - {Wx::EvtHandler#evt_menu_highlight}(id, meth = nil, &block): The menu item with the specified id has been highlighted: used to show help prompts in the status bar by {Wx::Frame}. See {Wx::MenuEvent}. # # - {Wx::EvtHandler#evt_menu_highlight_all}(meth = nil, &block): A menu item has been highlighted, i.e. the currently selected menu item has changed. See {Wx::MenuEvent}. # # === # # Category: Managed Windows # @see Wx::MDIParentFrame # @see Wx::MDIChildFrame # @see Wx::MiniFrame # @see Wx::Dialog # # class Frame < TopLevelWindow # @overload initialize() # Default constructor. # @return [Wx::Frame] # @overload initialize(parent, id, title, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::DEFAULT_FRAME_STYLE, name=Wx::FRAME_NAME_STR) # Constructor, creating the window. # For Motif, MWM (the Motif Window Manager) should be running for any window styles to work (otherwise all styles take effect). # @see Wx::Frame#create # @param parent [Wx::Window] The window parent. This may be, and often is, NULL. If it is non-NULL, the frame will be minimized when its parent is minimized and restored when it is restored (although it will still be possible to minimize and restore just this frame itself). # @param id [Integer] The window identifier. It may take a value of -1 to indicate a default value. # @param title [String] The caption to be displayed on the frame's title bar. # @param pos [Array(Integer, Integer), Wx::Point] The window position. The value {Wx::DEFAULT_POSITION} indicates a default position, chosen by either the windowing system or wxWidgets, depending on platform. # @param size [Array(Integer, Integer), Wx::Size] The window size. The value {Wx::DEFAULT_SIZE} indicates a default size, chosen by either the windowing system or wxWidgets, depending on platform. # @param style [Integer] The window style. See {Wx::Frame} class description. # @param name [String] The name of the window. This parameter is used to associate a name with the item, allowing the application user to set Motif resource values for individual windows. # @return [Wx::Frame] def initialize(*args) end # Centres the frame on the display. # @param direction [Integer] The parameter may be {Wx::Orientation::HORIZONTAL}, {Wx::Orientation::VERTICAL} or {Wx::Orientation::BOTH}. # @return [void] def centre(direction=Wx::Orientation::BOTH) end # Used in two-step frame construction. # See {Wx::Frame#initialize} for further details. # @param parent [Wx::Window] # @param id [Integer] # @param title [String] # @param pos [Array(Integer, Integer), Wx::Point] # @param size [Array(Integer, Integer), Wx::Size] # @param style [Integer] # @param name [String] # @return [Boolean] def create(parent, id, title, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::DEFAULT_FRAME_STYLE, name=Wx::FRAME_NAME_STR) end # Creates a status bar at the bottom of the frame. # A pointer to the status bar if it was created successfully, NULL otherwise. # # The width of the status bar is the whole width of the frame (adjusted automatically when resizing), and the height and text size are chosen by the host windowing system. # @see Wx::Frame#set_status_text # @see Wx::Frame#on_create_status_bar # @see Wx::Frame#get_status_bar # @param number [Integer] The number of fields to create. Specify a value greater than 1 to create a multi-field status bar. # @param style [Integer] The status bar style. See {Wx::StatusBar} for a list of valid styles. # @param id [Integer] The status bar window identifier. If -1, an identifier will be chosen by wxWidgets. # @param name [String] The status bar window name. # @return [Wx::StatusBar] def create_status_bar(number=1, style=Wx::STB_DEFAULT_STYLE, id=0, name=Wx::STATUS_BAR_NAME_STR) end # Creates a toolbar at the top or left of the frame. # A pointer to the toolbar if it was created successfully, NULL otherwise. # # By default, the toolbar is an instance of {Wx::ToolBar}. To use a different class, override {Wx::Frame#on_create_tool_bar}. When a toolbar has been created with this function, or made known to the frame with {Wx::Frame#set_tool_bar}, the frame will manage the toolbar position and adjust the return value from {Wx::Window#get_client_size} to reflect the available space for application windows. Under Pocket PC, you should always use this function for creating the toolbar to be managed by the frame, so that wxWidgets can use a combined menubar and toolbar. Where you manage your own toolbars, create a {Wx::ToolBar} as usual. # @see Wx::Frame#create_status_bar # @see Wx::Frame#on_create_tool_bar # @see Wx::Frame#set_tool_bar # @see Wx::Frame#get_tool_bar # @param style [Integer] The toolbar style. See {Wx::ToolBar} for a list of valid styles. # @param id [Integer] The toolbar window identifier. If -1, an identifier will be chosen by wxWidgets. # @param name [String] The toolbar window name. # @return [Wx::ToolBar] def create_tool_bar(style=Wx::TB_DEFAULT_STYLE, id=Wx::StandardID::ID_ANY, name=Wx::TOOL_BAR_NAME_STR) end # Method used to show help string of the selected menu toolbar item. # This method is called by the default {Wx::EVT_MENU_HIGHLIGHT} event handler and also by {Wx::ToolBar} to show the optional help string associated with the selected menu or toolbar item. It can be overridden if the default behaviour of showing this string in the frame status bar is not appropriate. # @see Wx::Frame#set_status_bar_pane # @param text [String] The help string to show, may be empty. The default implementation simply shows this string in the frame status bar (after remembering its previous text to restore it later). # @param show [Boolean] Whether the help should be shown or hidden. The default implementation restores the previously saved status bar text when it is false. # @return [void] def do_give_help(text, show) end # Returns the origin of the frame client area (in client coordinates). # It may be different from (0, 0) if the frame has a toolbar. # @return [Wx::Point] def get_client_area_origin; end alias_method :client_area_origin, :get_client_area_origin # Returns a pointer to the menubar currently associated with the frame (if any). # # @see Wx::Frame#set_menu_bar # @see Wx::MenuBar # @see Wx::Menu # @return [Wx::MenuBar] def get_menu_bar; end alias_method :menu_bar, :get_menu_bar # Returns a pointer to the status bar currently associated with the frame (if any). # # @see Wx::Frame#create_status_bar # @see Wx::StatusBar # @return [Wx::StatusBar] def get_status_bar; end alias_method :status_bar, :get_status_bar # Returns the status bar pane used to display menu and toolbar help. # # @see Wx::Frame#set_status_bar_pane # @return [Integer] def get_status_bar_pane; end alias_method :status_bar_pane, :get_status_bar_pane # Returns a pointer to the toolbar currently associated with the frame (if any). # # @see Wx::Frame#create_tool_bar # @see Wx::ToolBar # @see Wx::Frame#set_tool_bar # @return [Wx::ToolBar] def get_tool_bar; end alias_method :tool_bar, :get_tool_bar # Simulate a menu command. # @param id [Integer] The identifier for a menu item. # @return [Boolean] def process_command(id) end # Tells the frame to show the given menu bar. # If the frame is destroyed, the menu bar and its menus will be destroyed also, so do not delete the menu bar explicitly (except by resetting the frame's menu bar to another frame or NULL). Under Windows, a size event is generated, so be sure to initialize data members properly before calling {Wx::Frame#set_menu_bar}. Note that on some platforms, it is not possible to call this function twice for the same frame object. # @see Wx::Frame#get_menu_bar # @see Wx::MenuBar # @see Wx::Menu. # @param menuBar [Wx::MenuBar] The menu bar to associate with the frame. # @return [void] def set_menu_bar(menuBar) end alias_method :menu_bar=, :set_menu_bar # Associates a status bar with the frame. # If statusBar is NULL, then the status bar, if present, is detached from the frame, but not deleted. # @see Wx::Frame#create_status_bar # @see Wx::StatusBar # @see Wx::Frame#get_status_bar # @param statusBar [Wx::StatusBar] # @return [void] def set_status_bar(statusBar) end alias_method :status_bar=, :set_status_bar # Set the status bar pane used to display menu and toolbar help. # Using -1 disables help display. # @param n [Integer] # @return [void] def set_status_bar_pane(n) end alias_method :status_bar_pane=, :set_status_bar_pane # Sets the status bar text and updates the status bar display. # This is a simple wrapper for {Wx::StatusBar#set_status_text} which doesn't do anything if the frame has no status bar, i.e. {Wx::Frame#get_status_bar} returns NULL. # # Use an empty string to clear the status bar. # @see Wx::Frame#create_status_bar # @see Wx::StatusBar # @param text [String] The text for the status field. # @param number [Integer] The status field (starting from zero). # @return [void] def set_status_text(text, number=0) end alias_method :status_text=, :set_status_text # Sets the widths of the fields in the status bar. # The widths of the variable fields are calculated from the total width of all fields, minus the sum of widths of the non-variable fields, divided by the number of variable fields. # @param widths_field [Array] Must contain an array of n integers, each of which is a status field width in pixels. A value of -1 indicates that the field is variable width; at least one field must be -1. You should delete this array after calling {Wx::Frame#set_status_widths}. # @return [void] def set_status_widths(widths_field) end # Associates a toolbar with the frame. # @param toolBar [Wx::ToolBar] # @return [void] def set_tool_bar(toolBar) end alias_method :tool_bar=, :set_tool_bar # @param text [String] # @param number [Integer] # @return [void] def push_status_text(text, number=0) end # @param number [Integer] # @return [void] def pop_status_text(number=0) end end # Frame end