# The "Filewin" Widget

This widget provides a file selector (browser).

Library: karmawidgets
Link With: -lkarmawidgets

#### Tables

Filewin_ResourceNames | List of resource names for Filewin widget
Filewin_Resources | List of resources for Filewin widget

#### Functions

XkwFilewinRescan | Force a directory rescan in a Filewin widget.
XkwFilewinCurrentDirectory | Get the current directory in a Filewin widget.
XkwFilewinRegisterDirCbk | Register a callback to capture directory selection events.
XkwFilewinStandardFileTester_nD | Standard file tester.
XkwFilewinStandardFileTester_3D | Standard file tester for cube files.
XkwFilewinChangeDirectory | Change the current directory for a Filewin widget.

#### Prototype Functions

Filewin_PROTO_dir_cbk | Callback for directory selection.

## Tables

Filewin_ResourceNames List of resource names for Filewin widget

Name | Purpose
XkwNfileSelectCallback | Callbacks for file selection
XkwNfilenameTester | Callbacks to test filenames
XtNforeground | The foreground pixel
XkwNforwardSyntheticEvents | Forward synthetic events
XkwNtrapDirectoryDatasets | Trap directories which are known dataset types

Filewin_Resources List of resources for Filewin widget

Name | Class | Rep. Type | Default
XkwNfileSelectCallback | XtCCallback | XtRCallback | NULL
XkwNdirectoryChangeCallback | XtCCallback | XtRCallback | NULL
XkwNfilenameTester | XtCCallback | XtRPointer | NULL
XtNforeground | XtCForeground | XtRPixel | XtDefaultForeground
XkwNnumLines | XkwCNumLines | XtRInt | 0
XkwNforwardSyntheticEvents | XkwCForwardSyntheticEvents | XtRBool | False
XkwNtrapDirectoryDatasets | XkwCTrapDirectoryDatasets | XtRBool | False
XkwNshowDotsToggleWidget | XkwCShowDotsToggleWidget | XtRWidget | NULL

## Functions

#### EXPERIMENTAL FUNCTION: subject to change without notice

void XkwFilewinRescan (Widget W)

Force a directory rescan in a Filewin widget.

Parameters:

- W : The widget.

Returns: Nothing.
Multithreading Level: Unsafe

#### EXPERIMENTAL FUNCTION: subject to change without notice

char * XkwFilewinCurrentDirectory (Widget W)

Get the current directory in a Filewin widget.

Parameters:

- W : The widget.

Returns: A pointer to a dynamically allocated string containing the current directory for the widget. This must be freed with m_free.
Multithreading Level: Unsafe

#### EXPERIMENTAL FUNCTION: subject to change without notice

KCallbackFunc XkwFilewinRegisterDirCbk (Widget w, flag (*callback) (Widget w, void *info, CONST char *dirname), void *info)

This routine will register a callback to capture directory selection events prior to the Filewin widget changing directory.

Parameters:

- w : The Filewin widget.
- callback : The routine which will be called when directories are selected. The prototype function is Filewin_PROTO_dir_cbk.
- info : A pointer to arbitrary information.

Returns: A KCallbackFunc object.
Multithreading Level: Unsafe

#### EXPERIMENTAL FUNCTION: subject to change without notice

flag XkwFilewinStandardFileTester_nD (KFileInfo finfo)

This routine may be passed as the value for the XkwNfilenameTester resource on a FilewinWidget or FilepopupWidget. The routine will accept all known filetypes.

Parameters:

- finfo : The file information.

Returns: TRUE if the file is to be displayed, else FALSE.
Multithreading Level: Unsafe

#### EXPERIMENTAL FUNCTION: subject to change without notice

flag XkwFilewinStandardFileTester_3D (KFileInfo finfo)

This routine may be passed as the value for the XkwNfilenameTester resource on a FilewinWidget or FilepopupWidget. The routine will accept all known filetypes which are capable of containing a 3-dimensional array of data.

Parameters:

- finfo : The file information.

Returns: TRUE if the file is to be displayed, else FALSE.
Multithreading Level: Unsafe

#### EXPERIMENTAL FUNCTION: subject to change without notice

flag XkwFilewinChangeDirectory (Widget W, CONST char *dirname)

Change the current directory for a Filewin widget.

Parameters:

- W : The widget.
- dirname : The pathname to the directory.

Returns: TRUE on success, else FALSE. On error the directory is unchanged.
Multithreading Level: Unsafe

## Prototype Functions

flag Filewin_PROTO_dir_cbk (Widget w, void *info, CONST char *dirname)

This routine is called when the user selects a directory in the file selector. Normally the directory is descended and another group of files is visible. This callback makes it to possible to "capture" a directory if required. This can be useful when a conceptual "data file" is in fact implemented as a directory or files, such as with Miriad.

Parameters:

- w : The Filewin widget on which the selection occurred.
- info : A pointer to arbitrary information.
- dirname : The name of the directory.

Returns: TRUE if the selection event is to be consumed, else FALSE (meaning the event should be passed on to other callbacks, or, if none consume the event, the widget will change it's active directory).
Multithreading Level: Unsafe

Back to Karma Home Page