FILE_CHOOSER_COMPARE_FUNC
Function to compare two entires in the list of files. Setting the FILE_CHOOSER_FILTER_FUNC to
NULL does not guarantee any ordering to row entries.
Argument: int (*compare_func)()
Default: Case-insensitive ascending sorting order. Also provided are case-insensitive descending
and case sensitive ascending and descending.
Procs: create, get, set
Objects: File_chooser
Callback:
int
compare_func( row1, row2 )
File_chooser_row *row1;
File_chooser_row *row2;
where File_chooser_row is defined as:
typedef struct {
char * file;
struct stat * stats;
File_chooser_op matched;
char * xfrm;
} File_chooser_row;
file is a string representing the name of the file being sorted.
stats is a pointer to a stat structure as returned by the stat() system call.
matched is one of the values
FILE_CHOOSER_MATCHED or FILE_CHOOSER_NOT_
MATCHED
, indicating if the file name has matched the regular expression installed using
FILE_CHOOSER_FILTER_STRING.
xfrm field represents the file name, as returned by the strxfmt(3) function.
FILE_CHOOSER_CUSTOMIZE_OPEN
Allows the client to re-use the Open dialog within other contexts. Active only on a dialog of type
FILE_CHOOSER_OPEN. The recommended uses are Insert, Include or Import.
The first argument is a string that will be used as the label for a special-purpose button at the bottom
of the dialog. The Open button becomes Open Folder, as with a Save or Save As dialog. The second
argument becomes the help message that is displayed immediately above the Scrolling List. The third
is of type File_chooser_op indicating if this new type should be able to select files, or both files
and directories (values are
FILE_CHOOSER_SELECT_FILES or FILE_CHOOSER_SELECT_ALL).
The button added by this call will activate the
FILE_CHOOSER_NOTIFY_FUNC, with the same argu-
ments as the open callback and is retrievable using
FILE_CHOOSER_CHILD with a value of
FILE_CHOOSER_CUSTOM_BUTTON
.
Argument 1: char *
Argument 2: char *
Argument 3: File_chooser_op
Procs: create
Objects: File_chooser
See Also: Appendix D, Version 3.2 and the File Chooser, of XView Programming Manual.
46 XView Reference Manual
FILE_CHOOSER_DIRECTORY
Specifies the current working directory being displayed in the FILE_CHOOSER. This can be NULL.
Argument: char *
Default: The current working directory.
Procs: create, get, set
Objects: File_chooser
See Also: Appendix D, Version 3.2 and the File Chooser, of XView Programming Manual.
FILE_CHOOSER_DOC_NAME
Specifies the name of the application’s current document for use by the Save As dialog (this is only
effective if the FILE_CHOOSER_TYPE attribute is FILE_CHOOSER_SAVEAS). It is suggested that this
value be set to current.doc.name.1 whenever a new document is created or opened.
Specifies the name of the default document name in a Save dialog (that is, this is only effective if the
FILE_CHOOSER_TYPE attribute is FILE_CHOOSER_SAVE).
Argument: char *
Default: Untitled1
Procs: create, get, set
Objects: File_chooser
See Also: Appendix D, Version 3.2 and the File Chooser, of XView Programming Manual.
FILE_CHOOSER_EXTEN_FUNC
Function that gets called during resize handling that allows the client to adjust its extension controls
for the new size of the dialog. The return value is the new height desired for the exten_rect, or -1
if there is no change. Note that new y values should be relative to the exten_rect and should ex-
pect to increase it upwards, because adding height to the extension area takes away from the number
of rows in the Scrolling List. Newly defined height values should never exceed the max_height
parameter. Clients may adjust the
FRAME_MIN_SIZE attribute to prevent this from being a problem.
Returning a new height from this function is not the same as xv_set for the
FILE_CHOOSER_EX-
TEN_HEIGHT
attribute.
Argument: int (*exten_func)()
Procs: create, get, set
Objects: File_chooser
See Also: Appendix D, Version 3.2 and the File Chooser, of XView Programming Manual.
Callback:
int
exten_func(fc, frame_rect, exten_rect, left_edge,
right_edge, max_height)
File_chooser fc;
Rect * frame_rect;
Rect * exten_rect;
int left_edge;
int right_edge;
int max_height;
fc is the File Chooser instance.
frame_rect is the new size of the Command Frame.
exten_rect is the current size of the area delegated for extension items.
left_edge is the position being used as the leftmost x position used by the regular
objects on the File Chooser.
XView Attributes
XView Attributes 47
right_edge is the position being used as the rightmost point for regular item
layout.
max_height is the maximum amount of space that the extension rect can
occupy given the current size of the Frame.
It is recommended that the client set the
PANEL_PAINT attribute to the value of
PANEL_NONE for each xv_set call made on a Panel Item within this callback.
FILE_CHOOSER_EXTEN_HEIGHT
Tells the File Chooser to reserve this much vertical space for the added controls. Positioning controls
outside this area is not supported by the XView File Chooser.
Argument: int
Procs: get, set
Objects: File_chooser
FILE_CHOOSER_FILTER_FUNC
Function called to validate the file names before they will be displayed to the user. The files for which
this callback is invoked are chosen using
FILE_CHOOSER_FILTER_MASK.
Argument: int (*filter_func)()
Procs: create, get, set
Objects: File_chooser
Callback:
File_chooser_op
filter_func( fc, path, stats, matched, glyph,
client_data, mask_glyph )
File_chooser fc;
char * path;
struct stat * stats;
File_chooser_op matched;
Server_image * glyph;
Xv_opaque * client_data;
Server_image * mask_glyph;
fc is the File Chooser instance for which the callback was invoked.
path is the path name of the file being decided on.
statbuf is the address of a stat structure (see the stat(2) man page for details).
matched is one of the values
FILE_CHOOSER_MATCHED or FILE_CHOOSER_
NOT_MATCHED, depending on if the file name was found to match the regular expres-
sion given using the
FILE_CHOOSER_FILTER_STRING attribute.
glyph and client_data are returnable values. If the filter function returns a
Server_image in the glyph field, the glyph returned will be displayed in the list
along with the file name. The Server_image returned is expected to be 16×16 pix-
els, regardless of the scale or font size of the File Chooser.
mask_glyph is the clip mask to be used with the glyph field. The Server_image
returned must be of depth 1. In most cases, if the glyph is of depth 1, the
mask_glyph is the same Server_image as the glyph.
If a value is returned in the client_data field, this same value will be returned, unin-
terpreted, to the callback installed from the
FILE_CHOOSER_NOTIFY_FUNC attribute.
The expected return value from the filter-func is one of the ops
FILE_CHOOSER_ACCEPT
or FILE_CHOOSER_IGNORE. If the return value is FILE_CHOOSER_IGNORE, this file will
48 XView Reference Manual
be displayed grayed out, and unselectable. This is the default behavior specified by the
Application File Choosing Specification. If the FILE_CHOOSER_ABBREV_VIEW attribute
is set to TRUE, these files will not be displayed at all.
Also, in a Save or Save As dialog, all documents will be set inactive automatically.
FILE_CHOOSER_FILTER_MASK
Mask bits for the FILE_CHOOSER_FILTER_FUNC.
Argument: int (File_chooser_filter_mask)
Valid Values: Defined by a set or an or of flags from the set of:
FC_NONE_MASK
FC_MATCHED_FILES_MASK
FC_NOT_MATCHED_FILES_MASK
FC_MATCHED_DIRS_MASK
FC_NOT_MATCHED_DIRS_MASK
FC_DOTDOT_MASK
FC_ALL_MASK
Default:
FC_MATCHED_FILES
Procs: create, get, set
Objects: File_chooser
See Also: Appendix D, Version 3.2 and the File Chooser, of XView Programming Manual.
FILE_CHOOSER_FILTER_STRING
Sets or gets an ex-like regular expression string which files are filtered through before being actively
displayed in the list. If no filter string is specified, all entries are assumed to match. “..” is always as-
sumed to match. A default glyph may be specified for entries that match the regular expression using
FILE_CHOOSER_MATCH_GLYPH
.
Note that the Save and Save As dialogs must have all of the documents grayed out, so setting a filter
string on them will not be useful unless you are using a filter function to assign glyphs as well, even
though they are grayed out, or issuing
FILE_CHOOSER_ABBREV_VIEW.
Argument: char *
Procs: create, get, set
Objects: File_chooser
See Also: Appendix D, Version 3.2 and the File Chooser, of XView Programming Manual.
FILE_CHOOSER_HISTORY_LIST
Specifies an opaque handle to the
HISTORY_LIST object associated with the dialog instance. By de-
fault, the FILE_CHOOSER package will look for a list identified by the string “XView GoTo History”
and create it if it cannot be found.
Argument: History_list
Procs: create, get, set
Objects: File_chooser
See Also: Appendix D, Version 3.2 and the File Chooser, of XView Programming Manual.
XView Attributes
XView Attributes 49
FILE_CHOOSER_MATCH_GLYPH
Sets or gets a Server_image to be used as the default glyph for all file names matching the filter
string (see FILE_CHOOSER_FILTER_STRING attribute).
Argument: Server_image
Procs: create, get, set
Objects: File_chooser
See Also: Appendix D, Version 3.2 and the File Chooser, of XView Programming Manual.
FILE_CHOOSER_MATCH_GLYPH_MASK
Sets or gets Server_image to be used as a clip mask for the corresponding
FILE_CHOOSER_MATCH_GLYPH. The Server_image must be of depth 1.
Argument: Server_image
Default:
XV_NULL
Procs: create, get, set
Objects: File_chooser
See Also: Appendix D, Version 3.2 and the File Chooser, of XView Programming Manual.
FILE_CHOOSER_NO_CONFIRM
Tells the FILE_CHOOSER not to do confirmation before issuing the call to open or save callbacks.
Argument: Bool
Default:
FALSE
Procs: create, get, set
Objects: File_chooser
See Also: Appendix D, Version 3.2 and the File Chooser, of XView Programming Manual.
FILE_CHOOSER_NOTIFY_FUNC
Callbacks invoked when the user selects a file from the dialog for opening or saving. The callback
takes different form depending on whether the
FILE_CHOOSER_TYPE is FILE_CHOOSER_OPEN or
FILE_CHOOSER_SAVE/AS. Expected return values are XV_OK or XV_ERROR.
Argument: int (*notify_callback)()
Procs: create, get, set
Objects: File_chooser
Callback 1:
int
open_callback( fc, path, file, client_data )
File_chooser fc;
char * path;
char * file;
Xv_opaque client_data;
client_data is the client_data field set for this row in the
list from the
FILE_CHOOSER_FILTER_FUNC.
path is the entire path to the file.
The file string is strictly the file-name portion of the path. The directory portion of
the path may be obtained with the
FILE_CHOOSER_DIRECTORY attribute.
50 XView Reference Manual

Get Volume 7B: XView Reference Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.