Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Dialog class. More...
#include <ilviews/gadgets/fbrowser.h>
Public Member Functions | |
IlvFileBrowser (IlvDisplay *display, IlvSystemView transientFor, const char *dir=0, IlInt nb=0, const char *const *filters=0, const char *const *messages=0, IlvFileBrowserOption useSystemDlg=IlvUseDefault) | |
Constructor. More... | |
void | ensureInScreen (IlvPos xMargin=0, IlvPos yMargin=0) |
Ensures that the file browser remains visible. More... | |
const char * | get () |
Displays the file browser as a modal dialog and returns a string. More... | |
const char * | getDirectory () const |
Returns the directory part of the selected path. More... | |
const char * | getFileName () const |
Returns the file name part of the selected path. More... | |
IlInt | getIndex () const |
Returns the index of the default filter and the corresponding message. More... | |
IlInt | getIndexFromFilter (const char *filter) const |
Returns the index of a given filter. More... | |
IlInt | getIndexFromMessage (const char *message) const |
Returns the index of a given message. More... | |
IlvFileBrowserOption | getOption () const |
Returns the current option. More... | |
const char * | getPathName () const |
Returns the full name of the selected path. More... | |
const char * | getTitle () const |
Returns the title of the dialog. More... | |
IlvFileSelectorType | getType () const |
Returns the current type of the dialog. More... | |
void | moveToMouse (IlvDirection justification=IlvCenter, IlvPos dx=0, IlvPos dy=0, IlBoolean ensureInScreen=IlTrue) |
Moves the file browser relative to the location of the mouse. More... | |
void | moveToScreen (IlvDirection justification=IlvCenter, IlvPos dx=0, IlvPos dy=0, IlBoolean ensureInScreen=IlTrue) |
Moves the file browser relative to the root window. More... | |
void | moveToView (IlvView *view, IlvDirection justification=IlvCenter, IlvPos dx=0, IlvPos dy=0, IlBoolean ensureInScreen=IlTrue) |
Moves the file browser relative to another view. More... | |
void | setDirectory (const char *dir) |
Sets the directory to be browsed. More... | |
void | setFileName (const char *filename) |
Sets the default file name. More... | |
void | setIndex (IlInt index) |
Sets the index of the default filter and the corresponding message. More... | |
void | setOption (IlvFileBrowserOption option) |
Sets the current option. More... | |
void | setPathName (const char *path) |
Sets the directory to be browsed and the default file name. More... | |
IlInt | setPatterns (IlInt count, const char *const *filters, const char *const *messages) |
Initializes the filters and the related messages. More... | |
void | setSortMode (IlPathName::SortMode mode) |
Returns the display used to create the file browser. More... | |
void | setTitle (const char *title) |
Sets the title of the dialog. More... | |
void | setType (IlvFileSelectorType t) |
Specifies whether this file browser must find a file that already exists. More... | |
virtual void | show () |
Displays the file browser as a modal dialog. More... | |
Static Public Member Functions | |
static IlvFileBrowserOption | GetInitOption () |
Returns the value read from the resources or environment variables, or the value overridden by SetInitOption . More... | |
static void | SetInitOption (IlvFileBrowserOption option) |
Overrides the resources or environment variables set for the current program. More... | |
Dialog class.
Library: ilvadvgdt
The IlvFileBrowser
class allows you to dynamically specify which file selector to use from IlvFileSelector
(when available) or IlvFileChooser
, through a unique programming interface.
You can select a file browser in code in two ways: either in the IlvFileBrowser
constructor, or with the setOption
member function. You can also select a file browser at run time using the ILVFILEBROWSEROPTIONS
environment variable or resource. The possible values for this environment variable are UseDefault
, UseAlwaysSystemDialog
or UseAlwaysViewsDialog
. For details, see the IlvFileBrowserOption
enumeration.
IlvFileSelector
, IlvFileChooser
, IlvFileBrowserOption
. IlvFileBrowser::IlvFileBrowser | ( | IlvDisplay * | display, |
IlvSystemView | transientFor, | ||
const char * | dir = 0 , |
||
IlInt | nb = 0 , |
||
const char *const * | filters = 0 , |
||
const char *const * | messages = 0 , |
||
IlvFileBrowserOption | useSystemDlg = IlvUseDefault |
||
) |
Constructor.
Initializes a new instance of the IlvFileBrowser
class that will display either the system dialog or the Rogue Wave Views built-in dialog, according to the parameter useSystemDlg.
display | The connection to the display. |
transientFor | The system view for which the dialog is transient (see IlvView ). |
dir | The directory to be browsed. |
count | The numbers of filters and related messages specified by the filters and messages parameters, respectively. |
filters | An array of strings representing the possible filters. |
messages | An array of strings representing the messages that describe the filters. |
useSystemDlg | A value specifying which dialog will be used. For details, see IlvFileBrowserOption . |
Ensures that the file browser remains visible.
This function moves the file browser so that it remains visible on the screen. If the file browser is higher than the screen, it will not move in the y direction. If the file browser is wider than the screen, it will not move in the x direction. xMargin and yMargin define margin distances that the file browser location must respect, as if the screen were 2*
xMargin pixels less wide, and 2*
yMargin pixels less high.
If the file browser is already entirely visible on the screen with the margins respected, this function does nothing.
xMargin | The horizontal margin. |
yMargin | The vertical margin. |
const char* IlvFileBrowser::get | ( | ) |
Displays the file browser as a modal dialog and returns a string.
0
if the dialog was canceled. This string must never be deleted or modified. const char* IlvFileBrowser::getDirectory | ( | ) | const |
Returns the directory part of the selected path.
const char* IlvFileBrowser::getFileName | ( | ) | const |
Returns the file name part of the selected path.
IlInt IlvFileBrowser::getIndex | ( | ) | const |
Returns the index of the default filter and the corresponding message.
IlInt IlvFileBrowser::getIndexFromFilter | ( | const char * | filter | ) | const |
Returns the index of a given filter.
filter | The filter to be retrieved. |
IlvFileBrowser
. It returns -1
if filter was not found. getIndexFromMessage
. IlInt IlvFileBrowser::getIndexFromMessage | ( | const char * | message | ) | const |
Returns the index of a given message.
message | The message to be retrieved. |
IlvFileBrowser
. It returns -1
if message was not found.
|
static |
Returns the value read from the resources or environment variables, or the value overridden by SetInitOption
.
SetInitOption
. IlvFileBrowserOption IlvFileBrowser::getOption | ( | ) | const |
const char* IlvFileBrowser::getPathName | ( | ) | const |
Returns the full name of the selected path.
setPathName
. const char* IlvFileBrowser::getTitle | ( | ) | const |
Returns the title of the dialog.
IlvFileSelectorType IlvFileBrowser::getType | ( | ) | const |
void IlvFileBrowser::moveToMouse | ( | IlvDirection | justification = IlvCenter , |
IlvPos | dx = 0 , |
||
IlvPos | dy = 0 , |
||
IlBoolean | ensureInScreen = IlTrue |
||
) |
Moves the file browser relative to the location of the mouse.
This function moves the file browser so that the point indicated by justification is moved to the pointing device, with an offset of dx and dy.
justification | Specifies how the new location of this file browser is calculated:
|
dx | The horizontal offset that is applied. |
dy | The vertical offset that is applied. |
ensureInScreen | If this Boolean value is not specified or set to IlTrue , the file browser will remain entirely within the screen, by calling ensureInScreen . |
void IlvFileBrowser::moveToScreen | ( | IlvDirection | justification = IlvCenter , |
IlvPos | dx = 0 , |
||
IlvPos | dy = 0 , |
||
IlBoolean | ensureInScreen = IlTrue |
||
) |
Moves the file browser relative to the root window.
This function moves the file browser to the position indicated by justification, relative to the entire screen, with an offset of dx and dy.
justification | Specifies how the new location of the file browser is calculated:
|
dx | The horizontal offset that is applied. |
dy | The vertical offset that is applied. |
ensureInScreen | If this Boolean value is not specified or set to IlTrue , the file browser will remain entirely within the screen, by calling ensureInScreen . |
void IlvFileBrowser::moveToView | ( | IlvView * | view, |
IlvDirection | justification = IlvCenter , |
||
IlvPos | dx = 0 , |
||
IlvPos | dy = 0 , |
||
IlBoolean | ensureInScreen = IlTrue |
||
) |
Moves the file browser relative to another view.
This function moves the file browser to the position indicated by justification, relative to the position and size of view, which must be another top view, with an offset of dx and dy.
view | The reference view. |
justification | Specifies how the new location of this file browser is calculated. Valid values for this parameter are:
|
dx | The horizontal offset that is applied. |
dy | The vertical offset that is applied. |
ensureInScreen | If this Boolean value is not specified or set to IlTrue , the file browser will remain entirely within the screen, by calling ensureInScreen . |
void IlvFileBrowser::setDirectory | ( | const char * | dir | ) |
Sets the directory to be browsed.
dir | The directory to be browsed. |
void IlvFileBrowser::setFileName | ( | const char * | filename | ) |
Sets the default file name.
filename | The default file name. |
void IlvFileBrowser::setIndex | ( | IlInt | index | ) |
Sets the index of the default filter and the corresponding message.
index | The index of the new default filter. |
|
static |
Overrides the resources or environment variables set for the current program.
option | The new option. |
void IlvFileBrowser::setOption | ( | IlvFileBrowserOption | option | ) |
Sets the current option.
option | The new option of the file browser. |
IlvFileBrowserOption
. void IlvFileBrowser::setPathName | ( | const char * | path | ) |
Sets the directory to be browsed and the default file name.
path | The path name. |
IlInt IlvFileBrowser::setPatterns | ( | IlInt | count, |
const char *const * | filters, | ||
const char *const * | messages | ||
) |
Initializes the filters and the related messages.
count | The number of elements in the filters and messages arrays. |
filters | An array of count strings representing the filters. The syntax of a filter is shown in the following code: (filter1|filter2|....|filetern) . For example, you can provide the string (*.ilv|*.iva) . |
messages | An array of count strings representing the messages that describe the filters. |
void IlvFileBrowser::setSortMode | ( | IlPathName::SortMode | mode | ) |
Returns the display used to create the file browser.
Note that this method is only effective if this file browser is not using the system file selector.
Specifies how file and directory names are sorted in the file chooser. The sort mode can be any combinaison of the values of the IlPathName::SortMode enumeration.
If IlPathName::GroupDirectories is specified, files are listed afted the directories.
mode | The sort method that must be used. |
void IlvFileBrowser::setTitle | ( | const char * | title | ) |
void IlvFileBrowser::setType | ( | IlvFileSelectorType | t | ) |
Specifies whether this file browser must find a file that already exists.
For more information, see IlvFileSelector::setType
.
|
virtual |
Displays the file browser as a modal dialog.
As a result of this the member functions getFileName
, getPathName
, and getDirectory
are able to return the correct value.
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.