Class: Fox::FXFileDialog
- Inherits:
-
FXDialogBox
- Object
- FXObject
- FXId
- FXDrawable
- FXWindow
- FXComposite
- FXShell
- FXTopWindow
- FXDialogBox
- Fox::FXFileDialog
- Defined in:
- rdoc-sources/FXFileDialog.rb,
lib/fox16/core.rb
Overview
File selection dialog
Each pattern in the patternList comprises an optional name, followed by a pattern in parentheses. The patterns are separated by newlines. For example,
fileDialog.patternList = ["*",
"*.cpp,*.cc",
"*.hpp,*.hh,*.h"
]
and
fileDialog.patternList = ["All Files (*)",
"C++ Sources (*.cpp,*.cc)",
"C++ Headers (*.hpp,*.hh,*.h)"
]
will set the same three patterns, but the former shows no pattern names.
Wildcard matching modes
FILEMATCH_FILE_NAME
-
No wildcard can ever match “/” (or “",”/“ under Windows).
FILEMATCH_NOESCAPE
-
Backslashes don’t quote special chars (“" is treated as ”").
FILEMATCH_PERIOD
-
Leading “.” is matched only explicitly (Useful to match hidden files on Unix).
FILEMATCH_LEADING_DIR
-
Ignore “/…” after a match.
FILEMATCH_CASEFOLD
-
Compare without regard to case.
Note that under Windows, FILEMATCH_NOESCAPE
must be passed.
Instance Attribute Summary collapse
-
#currentPattern ⇒ Object
Current pattern number [Integer].
-
#directory ⇒ Object
Directory [String].
-
#fileBoxStyle ⇒ Object
File list style [Integer].
-
#filename ⇒ Object
File name [String].
-
#filenames ⇒ Object
readonly
List of selected filenames [Array].
-
#imageSize ⇒ Object
Image size for preview images [Integer].
-
#itemSpace ⇒ Object
Inter-item spacing (in pixels) [Integer].
-
#matchMode ⇒ Object
Wildcard matching mode [Integer].
-
#pattern ⇒ Object
File pattern [String].
-
#selectMode ⇒ Object
File selection mode [Integer].
Attributes inherited from FXTopWindow
#decorations, #hSpacing, #icon, #miniIcon, #packingHints, #padBottom, #padLeft, #padRight, #padTop, #title, #vSpacing
Attributes inherited from FXWindow
#accelTable, #backColor, #defaultCursor, #dragCursor, #first, #focus, #key, #last, #layoutHints, #next, #numChildren, #owner, #parent, #prev, #root, #selector, #shell, #target, #x, #y
Attributes inherited from FXDrawable
Attributes inherited from FXId
Class Method Summary collapse
-
.getOpenDirectory(owner, caption, path) ⇒ Object
Display a dialog box that allows the user to select a directory.
-
.getOpenFilename(owner, caption, path, patterns = "*", initial = 0) ⇒ Object
Display a dialog box that allows the user to select a single existing file name for opening.
-
.getOpenFilenames(owner, caption, path, patterns = "*", initial = 0) ⇒ Object
Display a dialog box that allows the user to select multiple existing file names for opening.
-
.getSaveFilename(owner, caption, path, patterns = "*", initial = 0) ⇒ Object
Display a dialog box that allows the user to select an existing file name, or enter a new file name, for saving.
Instance Method Summary collapse
-
#allowNavigation ⇒ Object
Allow navigation for this file dialog.
-
#allowsPatternEntry=(allowed) ⇒ Object
Change whether this file dialog allows pattern entry or not.
-
#allowsPatternEntry? ⇒ Boolean
Return
true
if this file dialog allows pattern entry. -
#disallowNavigation ⇒ Object
Disallow navigation for this file dialog.
-
#getPatternList ⇒ Object
Returns the list of patterns (an Array of Strings).
-
#getPatternText(patno) ⇒ Object
Get pattern text for given pattern number.
-
#hiddenFilesShown=(state) ⇒ Object
If state is
true
, the file dialog will show hidden files and directories; otherwise, it won’t. -
#hiddenFilesShown? ⇒ Boolean
Return
true
if showing hidden files and directories. -
#imagesShown=(shown) ⇒ Object
If shown is
true
, the file dialog will show preview images; otherwise it won’t. -
#imagesShown? ⇒ Boolean
Return
true
if the file dialog is showing preview images. -
#initialize(owner, name, opts = 0, x = 0, y = 0, width = 500, height = 300) ⇒ FXFileDialog
constructor
Construct a file dialog box.
-
#navigationAllowed=(allowed) ⇒ Object
Set navigation to allowed (
true
) or disallowed (false
). -
#navigationAllowed? ⇒ Boolean
Return
true
if navigation allowed. -
#numPatterns ⇒ Object
Return number of patterns.
-
#readOnly=(state) ⇒ Object
Set initial state of read-only button, where state is either
true
orfalse
. -
#readOnly? ⇒ Boolean
Return
true
if read-only. -
#readOnlyShown? ⇒ Boolean
Return
true
if read-only button is shown. -
#setPatternList(patterns) ⇒ Object
Change the list of file patterns shown in the file dialog.
-
#setPatternText(patno, text) ⇒ Object
Change pattern text for pattern number.
-
#showReadOnly=(shown) ⇒ Object
Set visibility of the read-only button, where shown is either
true
orfalse
.
Methods inherited from FXDialogBox
Methods inherited from FXTopWindow
#close, #getWMBorders, #maximize, #maximized?, #minimize, #minimized?, #place, #restore, #show
Methods inherited from FXComposite
#maxChildHeight, #maxChildWidth
Methods inherited from FXWindow
#acceptDrop, #acquireClipboard, #acquireSelection, #active?, #addHotKey, after?, #after?, before?, #before?, #beginDrag, #canFocus?, #changeFocus, #childAtIndex, #childOf?, #children, #clearDragRectangle, #clearShape, colorType, colorTypeName, commonAncestor, #composeContext, #composite?, #contains?, #containsChild?, #create, #createComposeContext, #cursorPosition, #default?, #defaultHeight, #defaultWidth, deleteType, deleteTypeName, #destroy, #destroyComposeContext, #detach, #didAccept, #disable, #doesSaveUnder?, #dragging?, #dropDisable, #dropEnable, #dropEnabled?, #dropFinished, #dropTarget?, #each_child, #each_child_recursive, #enable, #enabled?, #endDrag, #forceRefresh, #getChildAt, #getDNDData, #getHeightForWidth, #getWidthForHeight, #grab, #grabKeyboard, #grabbed?, #grabbedKeyboard?, #handleDrag, #hasClipboard?, #hasFocus?, #hasSelection?, #height, #height=, #hide, imageType, #inFocusChain?, #indexOfChild, #initial?, #inquireDNDAction, #inquireDNDTypes, #killFocus, #layout, #linkAfter, #linkBefore, #lower, #move, octetType, octetTypeName, #offeredDNDType?, #position, #raiseWindow, #recalc, #releaseClipboard, #releaseSelection, #remHotKey, #removeChild, #repaint, #reparent, #resize, #scroll, #setCursorPosition, #setDNDData, #setDefault, #setDragRectangle, #setFocus, #setInitial, #setShape, #shell?, #show, #shown?, stringType, textType, textTypeName, #tr, #translateCoordinatesFrom, #translateCoordinatesTo, #underCursor?, #ungrab, #ungrabKeyboard, #update, urilistType, urilistTypeName, utf16Type, utf16TypeName, utf8Type, utf8TypeName, #visible=, #width, #width=
Methods included from Responder2
Methods inherited from FXDrawable
Methods inherited from FXId
#create, #created?, #destroy, #detach, #runOnUiThread
Methods inherited from FXObject
#bind, #handle, #load, #save, subclasses
Constructor Details
#initialize(owner, name, opts = 0, x = 0, y = 0, width = 500, height = 300) ⇒ FXFileDialog
Construct a file dialog box
66 67 |
# File 'rdoc-sources/FXFileDialog.rb', line 66 def initialize(owner, name, opts=0, x=0, y=0, width=500, height=300) # :yields: theFileDialog end |
Instance Attribute Details
#currentPattern ⇒ Object
Current pattern number [Integer]
45 46 47 |
# File 'rdoc-sources/FXFileDialog.rb', line 45 def currentPattern @currentPattern end |
#directory ⇒ Object
Directory [String]
48 49 50 |
# File 'rdoc-sources/FXFileDialog.rb', line 48 def directory @directory end |
#fileBoxStyle ⇒ Object
File list style [Integer]
54 55 56 |
# File 'rdoc-sources/FXFileDialog.rb', line 54 def fileBoxStyle @fileBoxStyle end |
#filename ⇒ Object
File name [String]
36 37 38 |
# File 'rdoc-sources/FXFileDialog.rb', line 36 def filename @filename end |
#filenames ⇒ Object (readonly)
List of selected filenames [Array]
39 40 41 |
# File 'rdoc-sources/FXFileDialog.rb', line 39 def filenames @filenames end |
#imageSize ⇒ Object
Image size for preview images [Integer]
63 64 65 |
# File 'rdoc-sources/FXFileDialog.rb', line 63 def imageSize @imageSize end |
#itemSpace ⇒ Object
Inter-item spacing (in pixels) [Integer]
51 52 53 |
# File 'rdoc-sources/FXFileDialog.rb', line 51 def itemSpace @itemSpace end |
#matchMode ⇒ Object
Wildcard matching mode [Integer]
60 61 62 |
# File 'rdoc-sources/FXFileDialog.rb', line 60 def matchMode @matchMode end |
#pattern ⇒ Object
File pattern [String]
42 43 44 |
# File 'rdoc-sources/FXFileDialog.rb', line 42 def pattern @pattern end |
#selectMode ⇒ Object
File selection mode [Integer]
57 58 59 |
# File 'rdoc-sources/FXFileDialog.rb', line 57 def selectMode @selectMode end |
Class Method Details
.getOpenDirectory(owner, caption, path) ⇒ Object
Display a dialog box that allows the user to select a directory. Returns the directory name (a String).
Parameters:
owner
-
the owner window for the dialog box Fox::FXWindow
caption
-
the caption for the dialog box [String]
path
-
the initial directory path [String]
214 |
# File 'rdoc-sources/FXFileDialog.rb', line 214 def FXFileDialog.getOpenDirectory(owner, , path); end |
.getOpenFilename(owner, caption, path, patterns = "*", initial = 0) ⇒ Object
Display a dialog box that allows the user to select a single existing file name for opening. Returns the selected file name (a String).
Parameters:
owner
-
the owner window for the dialog box Fox::FXWindow
caption
-
the caption for the dialog box [String]
path
-
the initial filename [String]
patterns
-
the pattern list [String]
initial
-
the initial pattern to be used (an index into the pattern list) [Integer]
172 |
# File 'rdoc-sources/FXFileDialog.rb', line 172 def FXFileDialog.getOpenFilename(owner, , path, patterns="*", initial=0); end |
.getOpenFilenames(owner, caption, path, patterns = "*", initial = 0) ⇒ Object
Display a dialog box that allows the user to select multiple existing file names for opening. Returns an array of the selected file names (an array of strings).
Parameters:
owner
-
the owner window for the dialog box Fox::FXWindow
caption
-
the caption for the dialog box [String]
path
-
the initial filename [String]
patterns
-
the pattern list [String]
initial
-
the initial pattern to be used (an index into the pattern list) [Integer]
187 |
# File 'rdoc-sources/FXFileDialog.rb', line 187 def FXFileDialog.getOpenFilenames(owner, , path, patterns="*", initial=0); end |
.getSaveFilename(owner, caption, path, patterns = "*", initial = 0) ⇒ Object
Display a dialog box that allows the user to select an existing file name, or enter a new file name, for saving. Returns the save file name (a String).
Parameters:
owner
-
the owner window for the dialog box Fox::FXWindow
caption
-
the caption for the dialog box [String]
path
-
the initial filename [String]
patterns
-
the pattern list [String]
initial
-
the initial pattern to be used (an index into the pattern list) [Integer]
202 |
# File 'rdoc-sources/FXFileDialog.rb', line 202 def FXFileDialog.getSaveFilename(owner, , path, patterns="*", initial=0); end |
Instance Method Details
#allowNavigation ⇒ Object
Allow navigation for this file dialog
110 111 112 |
# File 'lib/fox16/core.rb', line 110 def self. = true end |
#allowsPatternEntry=(allowed) ⇒ Object
Change whether this file dialog allows pattern entry or not.
114 |
# File 'rdoc-sources/FXFileDialog.rb', line 114 def allowsPatternEntry=(allowed); end |
#allowsPatternEntry? ⇒ Boolean
Return true
if this file dialog allows pattern entry
119 |
# File 'rdoc-sources/FXFileDialog.rb', line 119 def allowsPatternEntry? ; end |
#disallowNavigation ⇒ Object
Disallow navigation for this file dialog
115 116 117 |
# File 'lib/fox16/core.rb', line 115 def self. = false end |
#getPatternList ⇒ Object
Returns the list of patterns (an Array of Strings).
98 |
# File 'rdoc-sources/FXFileDialog.rb', line 98 def getPatternList(); end |
#getPatternText(patno) ⇒ Object
Get pattern text for given pattern number
101 |
# File 'rdoc-sources/FXFileDialog.rb', line 101 def getPatternText(patno); end |
#hiddenFilesShown=(state) ⇒ Object
If state is true
, the file dialog will show hidden files and directories; otherwise, it won’t.
134 |
# File 'rdoc-sources/FXFileDialog.rb', line 134 def hiddenFilesShown=(state); end |
#hiddenFilesShown? ⇒ Boolean
Return true
if showing hidden files and directories
128 |
# File 'rdoc-sources/FXFileDialog.rb', line 128 def hiddenFilesShown?; end |
#imagesShown=(shown) ⇒ Object
If shown is true
, the file dialog will show preview images; otherwise it won’t.
140 |
# File 'rdoc-sources/FXFileDialog.rb', line 140 def imagesShown=(shown); end |
#imagesShown? ⇒ Boolean
Return true
if the file dialog is showing preview images.
145 |
# File 'rdoc-sources/FXFileDialog.rb', line 145 def imagesShown? ; end |
#navigationAllowed=(allowed) ⇒ Object
Set navigation to allowed (true
) or disallowed (false
)
157 |
# File 'rdoc-sources/FXFileDialog.rb', line 157 def (allowed); end |
#navigationAllowed? ⇒ Boolean
Return true
if navigation allowed.
154 |
# File 'rdoc-sources/FXFileDialog.rb', line 154 def ; end |
#numPatterns ⇒ Object
Return number of patterns
109 |
# File 'rdoc-sources/FXFileDialog.rb', line 109 def numPatterns; end |
#readOnly=(state) ⇒ Object
Set initial state of read-only button, where state is either true
or false
148 |
# File 'rdoc-sources/FXFileDialog.rb', line 148 def readOnly=(state); end |
#readOnly? ⇒ Boolean
Return true
if read-only
151 |
# File 'rdoc-sources/FXFileDialog.rb', line 151 def readOnly?; end |
#readOnlyShown? ⇒ Boolean
Return true
if read-only button is shown
125 |
# File 'rdoc-sources/FXFileDialog.rb', line 125 def readOnlyShown?; end |
#setPatternList(patterns) ⇒ Object
Change the list of file patterns shown in the file dialog. The patterns argument is an array of strings, and each string represents a different file pattern. A pattern consists of an optional name, followed by a pattern in parentheses. For example, this code:
patterns = [ "*", "*.cpp,*.cc", "*.hpp,*.hh,*.h" ]
aFileSelector.setPatternList(patterns)
and this code:
patterns = [ "All Files (*)", "C++ Sources (*.cpp,*.cc)", "C++ Headers (*.hpp,*.hh,*.h)" ]
aFileSelector.setPatternList(patterns)
will both set the same three patterns, but the former shows no pattern names.
For compatibility with the FOX C++ library API of the same name, #setPatternList also accepts a patterns value that is a single string, with each pattern separated by newline characters, e.g.
patterns = "All Files (*)\nC++ Sources (*.cpp,*.cc)\nC++ Headers (*.hpp,*.hh,*.h)"
aFileSelector.setPatternList(patterns)
93 |
# File 'rdoc-sources/FXFileDialog.rb', line 93 def setPatternList(patterns); end |
#setPatternText(patno, text) ⇒ Object
Change pattern text for pattern number
104 |
# File 'rdoc-sources/FXFileDialog.rb', line 104 def setPatternText(patno, text); end |
#showReadOnly=(shown) ⇒ Object
Set visibility of the read-only button, where shown is either true
or false
122 |
# File 'rdoc-sources/FXFileDialog.rb', line 122 def showReadOnly=(shown); end |