# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # DIALOG_NO_PARENT = 32 # DEFAULT_DIALOG_STYLE = 536877056 # DIALOG_ADAPTATION_NONE = 0 # DIALOG_ADAPTATION_STANDARD_SIZER = 1 # DIALOG_ADAPTATION_ANY_SIZER = 2 # DIALOG_ADAPTATION_LOOSE_BUTTONS = 3 # Modes used for {Wx::Dialog#set_layout_adaptation_mode}. # # # class DialogLayoutAdaptationMode < Wx::Enum # Use global adaptation enabled status. # DIALOG_ADAPTATION_MODE_DEFAULT = Wx::DialogLayoutAdaptationMode.new(0) # Enable this dialog overriding global status. # DIALOG_ADAPTATION_MODE_ENABLED = Wx::DialogLayoutAdaptationMode.new(1) # Disable this dialog overriding global status. # DIALOG_ADAPTATION_MODE_DISABLED = Wx::DialogLayoutAdaptationMode.new(2) end # DialogLayoutAdaptationMode # A dialog box is a window with a title bar and sometimes a system menu, which can be moved around the screen. # It can contain controls and other windows and is often used to allow the user to make some choice or to answer a question. # Dialogs can be made scrollable, automatically, for computers with low resolution screens: please see Automatic Scrolled Dialogs for further details. # Dialogs usually contain either a single button allowing to close the dialog or two buttons, one accepting the changes and the other one discarding them (such button, if present, is automatically activated if the user presses the "Esc" key). By default, buttons with the standard {Wx::StandardID::ID_OK} and {Wx::StandardID::ID_CANCEL} identifiers behave as expected. Starting with wxWidgets 2.7 it is also possible to use a button with a different identifier instead, see {Wx::Dialog#set_affirmative_id} and {Wx::Dialog#set_escape_id}. # Also notice that the {Wx::Dialog#create_button_sizer} should be used to create the buttons appropriate for the current platform and positioned correctly (including their order which is platform-dependent). # # == Modal and Modeless # # There are two kinds of dialog, modal and modeless. A modal dialog blocks program flow and user input on other windows until it is dismissed, whereas a modeless dialog behaves more like a frame in that program flow continues, and input in other windows is still possible. To show a modal dialog you should use the {Wx::Dialog#show_modal} method while to show a dialog modelessly you simply use {Wx::Dialog#show}, just as with frames. # Note that the modal dialog is one of the very few examples of {Wx::Window}-derived objects which may be created on the stack and not on the heap. In other words, while most windows would be created like this: # # void AskUser() # { # MyAskDialog *dlg = new MyAskDialog(...); # if ( dlg->ShowModal() == wxID_OK ) # // ... # //else: dialog was cancelled or some another button pressed # # dlg->Destroy(); # } # # You can achieve the same result with dialogs by using simpler code: # # void AskUser() # { # MyAskDialog dlg(...); # if ( dlg.ShowModal() == wxID_OK ) # // ... # # // no need to call Destroy() here # } # # An application can define a {Wx::CloseEvent} handler for the dialog to respond to system close events. # === Styles # # This class supports the following styles: # # - {Wx::CAPTION}: Puts a caption on the dialog box. # - {Wx::DEFAULT_DIALOG_STYLE}: Equivalent to a combination of {Wx::CAPTION}, {Wx::CLOSE_BOX} and {Wx::SYSTEM_MENU} (the last one is not used under Unix). # - {Wx::RESIZE_BORDER}: Display a resizable frame around the window. # - {Wx::SYSTEM_MENU}: Display a system menu. # - {Wx::CLOSE_BOX}: Displays a close box on the frame. # - {Wx::MAXIMIZE_BOX}: Displays a maximize box on the dialog. # - {Wx::MINIMIZE_BOX}: Displays a minimize box on the dialog. # - {Wx::THICK_FRAME}: Display a thick frame around the window. # - {Wx::STAY_ON_TOP}: The dialog stays on top of all other windows. # - {Wx::NO_3D}: This style is obsolete and doesn't do anything any more, don't use it in any new code. # - {Wx::DIALOG_NO_PARENT}: By default, a dialog created with a NULL parent window will be given the application's top level window as parent. Use this style to prevent this from happening and create an orphan dialog. This is not recommended for modal dialogs. # - {Wx::DIALOG_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 {Wx::Dialog#set_extra_style} before Create is called (two-step construction). # - {Wx::DIALOG_EX_METAL}: On macOS, frames with this style will be shown with a metallic look. This is an extra style. # # Under Unix or Linux, MWM (the Motif Window Manager) or other window managers recognizing the MHM hints should be running for any of these styles to have an effect. # === Events emitted by this class # # The following event-handler methods redirect the events to member method or handler blocks for {Wx::CloseEvent} events. # Event handler methods for events emitted by this class: # - {Wx::EvtHandler#evt_close}(meth = nil, &block): The dialog 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). # - {Wx::EvtHandler#evt_init_dialog}(meth = nil, &block): Process a {Wx::EVT_INIT_DIALOG} event. See {Wx::InitDialogEvent}. # # === # # Category: Common Dialogs # @see wxDialog Overview # @see Wx::Frame # @see wxValidator Overview # # class Dialog < TopLevelWindow # @overload initialize() # Default constructor. # @return [Dialog] # @overload initialize(parent, id, title, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::DEFAULT_DIALOG_STYLE, name=Wx::DIALOG_NAME_STR) # Constructor. # # @see Wx::Dialog#create # @param parent [Wx::Window] Can be NULL, a frame or another dialog box. # @param id [Integer] An identifier for the dialog. A value of -1 is taken to mean a default. # @param title [String] The title of the dialog. # @param pos [Array(Integer, Integer), Wx::Point] The dialog 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 dialog 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. # @param name [String] Used to associate a name with the window, allowing the application user to set Motif resource values for individual dialog boxes. # @return [Dialog] def initialize(*args) end # Adds an identifier to be regarded as a main button for the non-scrolling area of a dialog. # # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @param id [Integer] # @return [void] def add_main_button_id(id) end # Returns true if this dialog can and should perform layout adaptation using {Wx::Dialog#do_layout_adaptation}, usually if the dialog is too large to fit on the display. # # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @return [true,false] def can_do_layout_adaptation; end alias_method :can_do_layout_adaptation?, :can_do_layout_adaptation # Centres the dialog box on the display. # @param direction [Integer] May be {Wx::Orientation::HORIZONTAL}, {Wx::Orientation::VERTICAL} or {Wx::Orientation::BOTH}. # @return [void] def centre(direction=Wx::BOTH) end # Used for two-step dialog box construction. # # @see Wx::Dialog#dialog # @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 [true,false] def create(parent, id, title, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::DEFAULT_DIALOG_STYLE, name=Wx::DIALOG_NAME_STR) end # Creates a sizer with standard buttons. # flags is a bit list of the following flags: {Wx::OK}, {Wx::CANCEL}, {Wx::YES}, {Wx::NO}, {Wx::APPLY}, {Wx::CLOSE}, {Wx::HELP}, {Wx::NO_DEFAULT}. # The sizer lays out the buttons in a manner appropriate to the platform. # This function uses {Wx::Dialog#create_std_dialog_button_sizer} internally for most platforms but doesn't create the sizer at all for the platforms with hardware buttons (such as smartphones) for which it sets up the hardware buttons appropriately and returns NULL, so don't forget to test that the return value is valid before using it. # @param flags [Integer] # @return [Wx::Sizer] def create_button_sizer(flags) end # Creates a sizer with standard buttons using {Wx::Dialog#create_button_sizer} separated from the rest of the dialog contents by a horizontal {Wx::StaticLine}. # Just like {Wx::Dialog#create_button_sizer}, this function may return NULL if no buttons were created. # # This is a combination of {Wx::Dialog#create_button_sizer} and {Wx::Dialog#create_separated_sizer}. # @param flags [Integer] # @return [Wx::Sizer] def create_separated_button_sizer(flags) end # Returns the sizer containing the given one with a separating {Wx::StaticLine} if necessarily. # This function is useful for creating the sizer containing footer-like contents in dialog boxes. It will add a separating static line only if it conforms to the current platform convention (currently it is not added under Mac where the use of static lines for grouping is discouraged and is added elsewhere). # # The sizer wrapping the input one or possibly the input sizer itself if no wrapping is necessary. # @param sizer [Wx::Sizer] The sizer to wrap, must be non-NULL. # @return [Wx::Sizer] def create_separated_sizer(sizer) end # Creates a {Wx::StdDialogButtonSizer} with standard buttons. # flags is a bit list of the following flags: {Wx::OK}, {Wx::CANCEL}, {Wx::YES}, {Wx::NO}, {Wx::APPLY}, {Wx::CLOSE}, {Wx::HELP}, {Wx::NO_DEFAULT}. # The sizer lays out the buttons in a manner appropriate to the platform. # @param flags [Integer] # @return [Wx::StdDialogButtonSizer] def create_std_dialog_button_sizer(flags) end # Splits text up at newlines and places the lines into {Wx::StaticText} objects with the specified maximum width in a vertical {Wx::BoxSizer}. # If widthMax has its default value of -1, only explicit new line characters in message are taken into account. Otherwise, lines are broken either after a new line or wrapped, at word boundary, if their width would become bigger than the specified maximal width. # @see wxStaticText::Wrap(int width) # @param message [String] The text to be displayed. # @param widthMax [Integer] Specifies the text's maximum width (this argument is available since version 3.1.1, previous versions always behaved as if the maximal width of -1 was specified). # @return [Wx::Sizer] def create_text_sizer(message, widthMax=-1) end # Performs layout adaptation, usually if the dialog is too large to fit on the display. # # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @return [true,false] def do_layout_adaptation; end # Ends a modal dialog, passing a value to be returned from the {Wx::Dialog#show_modal} invocation. # # @see Wx::Dialog#show_modal # @see Wx::Dialog#get_return_code # @see Wx::Dialog#set_return_code # @param retCode [Integer] The value that should be returned by ShowModal. # @return [void] def end_modal(retCode) end # Gets the identifier of the button which works like standard OK button in this dialog. # # @see Wx::Dialog#set_affirmative_id # @return [Integer] def get_affirmative_id; end alias_method :affirmative_id, :get_affirmative_id # Gets the identifier of the button to map presses of ESC button to. # # @see Wx::Dialog#set_escape_id # @return [Integer] def get_escape_id; end alias_method :escape_id, :get_escape_id # Returns true if the dialog has been adapted, usually by making it scrollable to work with a small display. # # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @return [true,false] def get_layout_adaptation_done; end alias_method :layout_adaptation_done, :get_layout_adaptation_done # Gets a value representing the aggressiveness of search for buttons and sizers to be in the non-scrolling part of a layout-adapted dialog. # Zero switches off adaptation, and 3 allows search for standard buttons anywhere in the dialog. # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @return [Integer] def get_layout_adaptation_level; end alias_method :layout_adaptation_level, :get_layout_adaptation_level # Gets the adaptation mode, overriding the global adaptation flag. # # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @return [DialogLayoutAdaptationMode] def get_layout_adaptation_mode; end alias_method :layout_adaptation_mode, :get_layout_adaptation_mode # Returns an array of identifiers to be regarded as the main buttons for the non-scrolling area of a dialog. # # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @return [Wx::ArrayInt] def get_main_button_ids; end alias_method :main_button_ids, :get_main_button_ids # Gets the return code for this window. # A return code is normally associated with a modal dialog, where {Wx::Dialog#show_modal} returns a code to the application. # @see Wx::Dialog#set_return_code # @see Wx::Dialog#show_modal # @see Wx::Dialog#end_modal # @return [Integer] def get_return_code; end alias_method :return_code, :get_return_code # Iconizes or restores the dialog. # Windows only. # # Note that in Windows, iconization has no effect since dialog boxes cannot be iconized. However, applications may need to explicitly restore dialog boxes under Motif which have user-iconizable frames, and under Windows calling Iconize(false) will bring the window to the front, as does Show(true). # @param iconize [true,false] If true, iconizes the dialog box; if false, shows and restores it. # @return [void] def iconize(iconize=true) end # Returns true if the dialog box is iconized. # Windows only. # Always returns false under Windows since dialogs cannot be iconized. # @return [true,false] def is_iconized; end alias_method :iconized?, :is_iconized # Returns true if id is in the array of identifiers to be regarded as the main buttons for the non-scrolling area of a dialog. # Availability: only available for the {Wx::MSW} port. {Wx::msw} # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @param id [Integer] # @return [true,false] def is_main_button_id(id) end alias_method :main_button_id?, :is_main_button_id # Returns true if the dialog box is modal, false otherwise. # @return [true,false] def is_modal; end alias_method :modal?, :is_modal # Sets the identifier to be used as OK button. # When the button with this identifier is pressed, the dialog calls {Wx::Window#validate} and {Wx::Window#transfer_data_from_window} and, if they both return true, closes the dialog with the affirmative id return code. # Also, when the user presses a hardware OK button on the devices having one or the special OK button in the PocketPC title bar, an event with this id is generated. # By default, the affirmative id is {Wx::StandardID::ID_OK}. # @see Wx::Dialog#get_affirmative_id # @see Wx::Dialog#set_escape_id # @param id [Integer] # @return [void] def set_affirmative_id(id) end alias_method :affirmative_id=, :set_affirmative_id # Sets the identifier of the button which should work like the standard "Cancel" button in this dialog. # When the button with this id is clicked, the dialog is closed. Also, when the user presses ESC key in the dialog or closes the dialog using the close button in the title bar, this is mapped to the click of the button with the specified id. # By default, the escape id is the special value {Wx::StandardID::ID_ANY} meaning that {Wx::StandardID::ID_CANCEL} button is used if it's present in the dialog and otherwise the button with {Wx::Dialog#get_affirmative_id} is used. Another special value for id is {Wx::StandardID::ID_NONE} meaning that ESC presses should be ignored. If any other value is given, it is interpreted as the id of the button to map the escape key to. # This method should be used for custom modal dialog implemented in wxWidgets itself, native dialogs such as {Wx::MessageDialog} or {Wx::FileDialog}, handle ESC presses in their own way which cannot be customized. # @param id [Integer] # @return [void] def set_escape_id(id) end alias_method :escape_id=, :set_escape_id # Sets the icon for this dialog. # # @see Wx::Icon # @param icon [Wx::Icon] The icon to associate with this dialog. # @return [void] def set_icon(icon) end alias_method :icon=, :set_icon # Sets the icons for this dialog. # # @see Wx::IconBundle # @param icons [Wx::IconBundle] The icons to associate with this dialog. # @return [void] def set_icons(icons) end alias_method :icons=, :set_icons # Marks the dialog as having been adapted, usually by making it scrollable to work with a small display. # # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @param done [true,false] # @return [void] def set_layout_adaptation_done(done) end alias_method :layout_adaptation_done=, :set_layout_adaptation_done # Sets the aggressiveness of search for buttons and sizers to be in the non-scrolling part of a layout-adapted dialog. # Zero switches off adaptation, and 3 allows search for standard buttons anywhere in the dialog. # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @param level [Integer] # @return [void] def set_layout_adaptation_level(level) end alias_method :layout_adaptation_level=, :set_layout_adaptation_level # Sets the adaptation mode, overriding the global adaptation flag. # # @see Wx::DialogLayoutAdaptationMode # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @param mode [DialogLayoutAdaptationMode] # @return [void] def set_layout_adaptation_mode(mode) end alias_method :layout_adaptation_mode=, :set_layout_adaptation_mode # Sets the return code for this window. # A return code is normally associated with a modal dialog, where {Wx::Dialog#show_modal} returns a code to the application. The function {Wx::Dialog#end_modal} calls {Wx::Dialog#set_return_code}. # @see Wx::Dialog#get_return_code # @see Wx::Dialog#show_modal # @see Wx::Dialog#end_modal # @param retCode [Integer] The integer return code, usually a control identifier. # @return [void] def set_return_code(retCode) end alias_method :return_code=, :set_return_code # Hides or shows the dialog. # The preferred way of dismissing a modal dialog is to use {Wx::Dialog#end_modal}. # @param show [true,false] If true, the dialog box is shown and brought to the front, otherwise the box is hidden. If false and the dialog is modal, control is returned to the calling program. # @return [true,false] def show(show=true) end # Shows an application-modal dialog. # Program flow does not return until the dialog has been dismissed with {Wx::Dialog#end_modal}. # Notice that it is possible to call {Wx::Dialog#show_modal} for a dialog which had been previously shown with {Wx::Dialog#show}, this allows making an existing modeless dialog modal. However {Wx::Dialog#show_modal} can't be called twice without intervening {Wx::Dialog#end_modal} calls. # Note that this function creates a temporary event loop which takes precedence over the application's main event loop (see {Wx::EventLoopBase}) and which is destroyed when the dialog is dismissed. This also results in a call to {Wx::App#process_pending_events}. # The value set with {Wx::Dialog#set_return_code}. # @see Wx::Dialog#show_window_modal # @see Wx::Dialog#show_window_modal_then_do # @see Wx::Dialog#end_modal # @see Wx::Dialog#get_return_code # @see Wx::Dialog#set_return_code # @return [Integer] def show_modal; end # Shows a dialog modal to the parent top level window only. # Unlike {Wx::Dialog#show_modal}, dialogs shown with this function only prevent the user from interacting with their parent frame only but not with the rest of the application. They also don't block the program execution but instead return immediately, as {Wx::Dialog#show}, and generate a {Wx::EVT_WINDOW_MODAL_DIALOG_CLOSED} event ({Wx::WindowModalDialogEvent}) later when the dialog is closed. # Currently this function is only fully implemented in {Wx::OSX} ports, under the other platforms it behaves like {Wx::Dialog#show_modal} (but also sends the above mentioned event). # @see Wx::WindowModalDialogEvent # @see Wx::Dialog#show_window_modal_then_do # @return [void] def show_window_modal; end # A static function enabling or disabling layout adaptation for all dialogs. # # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @param enable [true,false] # @return [void] def self.enable_layout_adaptation(enable) end # A static function getting the current layout adapter object. # # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @return [Wx::DialogLayoutAdapter] def self.get_layout_adapter; end # A static function returning true if layout adaptation is enabled for all dialogs. # # @see Automatic Scrolled Dialogs (for more on layout adaptation) # @return [true,false] def self.is_layout_adaptation_enabled; end # A static function for setting the current layout adapter object, returning the old adapter. # If you call this, you should delete the old adapter object. # @see Wx::DialogLayoutAdapter # @see Automatic Scrolled Dialogs # @param adapter [Wx::DialogLayoutAdapter] # @return [Wx::DialogLayoutAdapter] def self.set_layout_adapter(adapter) end end # Dialog end