# :stopdoc: # This file is automatically generated by the WXRuby3 documentation # generator. Do not alter this file. # :startdoc: module Wx # This control allows the user to select a file. # The generic implementation is a button which brings up a {Wx::FileDialog} when clicked. Native implementation may differ but this is usually a (small) widget which give access to the file-chooser dialog. It is only available if {Wx::Setup::USE_FILEPICKERCTRL} is set to 1 (the default). # === Styles # # This class supports the following styles: # # - {Wx::FLP_DEFAULT_STYLE}: The default style: includes {Wx::FLP_OPEN} | {Wx::FLP_FILE_MUST_EXIST} and, under {Wx::MSW} and {Wx::OSX}, {Wx::FLP_USE_TEXTCTRL}. # - {Wx::FLP_USE_TEXTCTRL}: Creates a text control to the left of the picker button which is completely managed by the {Wx::FilePickerCtrl} and which can be used by the user to specify a path (see SetPath). The text control is automatically synchronized with button's value. Use functions defined in {Wx::PickerBase} to modify the text control. # - {Wx::FLP_OPEN}: Creates a picker which allows the user to select a file to open. # - {Wx::FLP_SAVE}: Creates a picker which allows the user to select a file to save. # - {Wx::FLP_OVERWRITE_PROMPT}: Can be combined with {Wx::FLP_SAVE} only: ask confirmation to the user before selecting a file. # - {Wx::FLP_FILE_MUST_EXIST}: Can be combined with {Wx::FLP_OPEN} only: the file selected in the popup {Wx::FileDialog} must be an existing file. Notice that it still remains possible for the user to enter a non-existent file name in the text control if {Wx::FLP_USE_TEXTCTRL} is also used, this flag is a hint for the user rather than a guarantee that the selected file does exist for the program. # - {Wx::FLP_CHANGE_DIR}: Change current working directory on each user file selection change. # - {Wx::FLP_SMALL}: Use smaller version of the control with a small "..." button instead of the normal "Browse" one. This flag is new since wxWidgets 2.9.3. # # === Events emitted by this class # # The following event-handler methods redirect the events to member method or handler blocks for {Wx::FileDirPickerEvent} events. # Event handler methods for events emitted by this class: # - {Wx::EvtHandler#evt_filepicker_changed}(id, meth = nil, &block): The user changed the file selected in the control either using the button or using text control (see {Wx::FLP_USE_TEXTCTRL}; note that in this case the event is fired only if the user's input is valid, e.g. an existing file path if {Wx::FLP_FILE_MUST_EXIST} was given). # # === # # Category: Picker Controls
Appearance:
{Wx::MSW} Appearance # {Wx::GTK} Appearance # {Wx::OSX} Appearance #
# @see Wx::FileDialog # @see Wx::FileDirPickerEvent # # class FilePickerCtrl < PickerBase # @overload initialize() # @return [FilePickerCtrl] # @overload initialize(parent, id, path=Wx::EMPTY_STRING, message=Wx::FILE_SELECTOR_PROMPT_STR, wildcard=Wx::FILE_SELECTOR_DEFAULT_WILDCARD_STR, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::FLP_DEFAULT_STYLE, validator=Wx::DEFAULT_VALIDATOR, name=Wx::FILE_PICKER_CTRL_NAME_STR) # Initializes the object and calls {Wx::FilePickerCtrl#create} with all the parameters. # @param parent [Wx::Window] # @param id [Integer] # @param path [String] # @param message [String] # @param wildcard [String] # @param pos [Array(Integer, Integer), Wx::Point] # @param size [Array(Integer, Integer), Wx::Size] # @param style [Integer] # @param validator [Wx::Validator] # @param name [String] # @return [FilePickerCtrl] def initialize(*args) end # Creates this widget with the given parameters. # true if the control was successfully created or false if creation failed. # @param parent [Wx::Window] Parent window, must not be non-NULL. # @param id [Integer] The identifier for the control. # @param path [String] The initial file shown in the control. Must be a valid path to a file or the empty string. # @param message [String] The message shown to the user in the {Wx::FileDialog} shown by the control. # @param wildcard [String] A wildcard which defines user-selectable files (use the same syntax as for {Wx::FileDialog}'s wildcards). # @param pos [Array(Integer, Integer), Wx::Point] Initial position. # @param size [Array(Integer, Integer), Wx::Size] Initial size. # @param style [Integer] The window style, see {Wx::FLP_}* flags. # @param validator [Wx::Validator] Validator which can be used for additional data checks. # @param name [String] Control name. # @return [true,false] def create(parent, id, path=Wx::EMPTY_STRING, message=Wx::FILE_SELECTOR_PROMPT_STR, wildcard=Wx::FILE_SELECTOR_DEFAULT_WILDCARD_STR, pos=Wx::DEFAULT_POSITION, size=Wx::DEFAULT_SIZE, style=Wx::FLP_DEFAULT_STYLE, validator=Wx::DEFAULT_VALIDATOR, name=Wx::FILE_PICKER_CTRL_NAME_STR) end # Similar to {Wx::FilePickerCtrl#get_path} but returns the path of the currently selected file as a {Wx::FileName} object. # @return [Wx::FileName] def get_file_name; end alias_method :file_name, :get_file_name # Returns the absolute path of the currently selected file. # @return [String] def get_path; end alias_method :path, :get_path # This method does the same thing as {Wx::FilePickerCtrl#set_path} but takes a {Wx::FileName} object instead of a string. # @param filename [Wx::FileName] # @return [void] def set_file_name(filename) end alias_method :file_name=, :set_file_name # Set the directory to show when starting to browse for files. # This function is mostly useful for the file picker controls which have no selection initially to configure the directory that should be shown if the user starts browsing for files as otherwise the directory of initially selected file is used, which is usually the desired behaviour and so the directory specified by this function is ignored in this case. # @param dir [String] # @return [void] def set_initial_directory(dir) end alias_method :initial_directory=, :set_initial_directory # Sets the absolute path of the currently selected file. # If the control uses {Wx::FLP_FILE_MUST_EXIST} and does not use {Wx::FLP_USE_TEXTCTRL} style, the filename must be a name of an existing file and will be simply ignored by the native {Wx::GTK} implementation if this is not the case (the generic implementation used under the other platforms accepts even invalid file names currently, but this is subject to change in the future, don't rely on being able to use non-existent paths with it). # @param filename [String] # @return [void] def set_path(filename) end alias_method :path=, :set_path end # FilePickerCtrl end