Class: Fox::FXFileSelector

Inherits:
FXPacker show all
Defined in:
rdoc-sources/FXFileSelector.rb,
lib/fox16/core.rb

Overview

File selection widget

File selection modes

SELECTFILE_ANY

A single file, existing or not (to save to)

SELECTFILE_EXISTING

An existing file (to load)

SELECTFILE_MULTIPLE

Multiple existing files

SELECTFILE_MULTIPLE_ALL

Multiple existing files or directories, but not ‘.’ and ‘..’

SELECTFILE_DIRECTORY

Existing directory, including ‘.’ or ‘..’

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.

Message identifiers

ID_FILEFILTER

x

ID_ACCEPT

x

ID_FILELIST

x

ID_DIRECTORY_UP

x

ID_DIRTREE

x

ID_NORMAL_SIZE

x

ID_MEDIUM_SIZE

x

ID_GIANT_SIZE

x

ID_HOME

x

ID_WORK

x

ID_BOOKMARK

x

ID_BOOKMENU

x

ID_VISIT

x

ID_NEW

x

ID_DELETE

x

ID_MOVE

x

ID_COPY

x

ID_LINK

x

Instance Attribute Summary collapse

Attributes inherited from FXPacker

#baseColor, #borderColor, #borderWidth, #frameStyle, #hSpacing, #hiliteColor, #packingHints, #padBottom, #padLeft, #padRight, #padTop, #shadowColor, #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

#height, #visual, #width

Attributes inherited from FXId

#app, #userData, #xid

Class Method Summary collapse

Instance Method Summary collapse

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

#connect

Methods inherited from FXDrawable

#resize

Methods inherited from FXId

#create, #created?, #destroy, #detach, #runOnUiThread

Methods inherited from FXObject

#bind, #handle, #load, #save, subclasses

Constructor Details

#initialize(p, target = nil, selector = 0, opts = 0, x = 0, y = 0, width = 0, height = 0) ⇒ FXFileSelector

Return an initialized FXFileSelector instance.



82
83
# File 'rdoc-sources/FXFileSelector.rb', line 82

def initialize(p, target=nil, selector=0, opts=0, x=0, y=0, width=0, height=0) # :yields: theFileSelector
end

Instance Attribute Details

#acceptButtonObject (readonly)

The “Accept” button Fox::FXButton



47
48
49
# File 'rdoc-sources/FXFileSelector.rb', line 47

def acceptButton
  @acceptButton
end

#cancelButtonObject (readonly)

The “Cancel” button Fox::FXButton



50
51
52
# File 'rdoc-sources/FXFileSelector.rb', line 50

def cancelButton
  @cancelButton
end

#currentPatternObject

Current pattern number [Integer]



62
63
64
# File 'rdoc-sources/FXFileSelector.rb', line 62

def currentPattern
  @currentPattern
end

#directoryObject

Directory [String]



59
60
61
# File 'rdoc-sources/FXFileSelector.rb', line 59

def directory
  @directory
end

#fileBoxStyleObject

Change file list style [Integer]



68
69
70
# File 'rdoc-sources/FXFileSelector.rb', line 68

def fileBoxStyle
  @fileBoxStyle
end

#filenameObject

File name [String]



53
54
55
# File 'rdoc-sources/FXFileSelector.rb', line 53

def filename
  @filename
end

#imageSizeObject

Image size for preview images [Integer]



77
78
79
# File 'rdoc-sources/FXFileSelector.rb', line 77

def imageSize
  @imageSize
end

#itemSpaceObject

Inter-item spacing (in pixels) [Integer]



65
66
67
# File 'rdoc-sources/FXFileSelector.rb', line 65

def itemSpace
  @itemSpace
end

#matchModeObject

Wildcard matching mode [Integer]



74
75
76
# File 'rdoc-sources/FXFileSelector.rb', line 74

def matchMode
  @matchMode
end

#patternObject

File pattern [String]



56
57
58
# File 'rdoc-sources/FXFileSelector.rb', line 56

def pattern
  @pattern
end

#selectModeObject

Change file selection mode [Integer]



71
72
73
# File 'rdoc-sources/FXFileSelector.rb', line 71

def selectMode
  @selectMode
end

Class Method Details

.extensionFromPattern(pattern) ⇒ Object

Given a pattern of the form “.gif,.GIF”, return the first extension of the pattern, i.e. “gif” in this example. Returns empty string if it doesn’t work out.



181
# File 'rdoc-sources/FXFileSelector.rb', line 181

def FXFileSelector.extensionFromPattern(pattern) ; end

.patternFromText(pattern) ⇒ Object

Given filename pattern of the form “GIF Format (*.gif)”, returns the pattern only, i.e. “*.gif” in this case. If the parentheses are not found then returns the entire input pattern.



174
# File 'rdoc-sources/FXFileSelector.rb', line 174

def FXFileSelector.patternFromText(pattern) ; end

Instance Method Details

#allowNavigationObject

Allow navigation for this file selector



138
139
140
# File 'lib/fox16/core.rb', line 138

def allowNavigation
  self.navigationAllowed = true
end

#disallowNavigationObject

Disallow navigation for this file selector



143
144
145
# File 'lib/fox16/core.rb', line 143

def disallowNavigation
  self.navigationAllowed = false
end

#filenamesObject

Returns an array of the selected file names.



88
# File 'rdoc-sources/FXFileSelector.rb', line 88

def filenames; end

#getPatternListObject

Returns the list of patterns (an Array of Strings).



119
# File 'rdoc-sources/FXFileSelector.rb', line 119

def getPatternList(); end

#getPatternText(patno) ⇒ Object

Get pattern text for given pattern number



122
# File 'rdoc-sources/FXFileSelector.rb', line 122

def getPatternText(patno); end

#hiddenFilesShown=(state) ⇒ Object

If state is true, the file selector will show hidden files and directories; otherwise, it won’t.



149
# File 'rdoc-sources/FXFileSelector.rb', line 149

def hiddenFilesShown=(state); end

#hiddenFilesShown?Boolean

Return true if showing hidden files and directories

Returns:

  • (Boolean)


143
# File 'rdoc-sources/FXFileSelector.rb', line 143

def hiddenFilesShown?; end

#imagesShown=(shown) ⇒ Object

If shown is true, the file selector will show preview images; otherwise it won’t.



155
# File 'rdoc-sources/FXFileSelector.rb', line 155

def imagesShown=(shown); end

#imagesShown?Boolean

Return true if the file selector is showing preview images.

Returns:

  • (Boolean)


160
# File 'rdoc-sources/FXFileSelector.rb', line 160

def imagesShown? ; end

Set navigation to allowed (true) or disallowed (false)



166
# File 'rdoc-sources/FXFileSelector.rb', line 166

def navigationAllowed=(allowed); end

Return true if navigation allowed.

Returns:

  • (Boolean)


163
# File 'rdoc-sources/FXFileSelector.rb', line 163

def navigationAllowed?; end

#numPatternsObject

Return number of patterns.



128
# File 'rdoc-sources/FXFileSelector.rb', line 128

def numPatterns; end

#readOnly=(state) ⇒ Object

Set state of read-only button.



137
# File 'rdoc-sources/FXFileSelector.rb', line 137

def readOnly=(state); end

#readOnly?Boolean

Return true if in read-only mode.

Returns:

  • (Boolean)


140
# File 'rdoc-sources/FXFileSelector.rb', line 140

def readOnly?; end

#readOnlyShown=(shown) ⇒ Object

Show read-only button.



131
# File 'rdoc-sources/FXFileSelector.rb', line 131

def readOnlyShown=(shown); end

#readOnlyShown?Boolean

Return true if the read-only button is shown.

Returns:

  • (Boolean)


134
# File 'rdoc-sources/FXFileSelector.rb', line 134

def readOnlyShown?; end

#setPatternList(patterns) ⇒ Object

Change the list of file patterns shown in the file selector. 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)


114
# File 'rdoc-sources/FXFileSelector.rb', line 114

def setPatternList(patterns); end

#setPatternText(patno, text) ⇒ Object

Change pattern text for pattern number



125
# File 'rdoc-sources/FXFileSelector.rb', line 125

def setPatternText(patno, text); end