Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/widget_ref/ptfilesel.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/widget_ref/ptfilesel.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/widget_ref/ptfilesel.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/widget_ref/ptfilesel.html on line 8

PtFileSel

A tree widget for selecting files and directories

Class hierarchy:

PtWidgetPtBasicPtContainerPtCompoundPtGenListPtGenTreePtFileSel

For more information, see the diagram of the widget hierarchy.

PhAB icon:

PtFileSel button in PhAB

Public header:

<photon/PtFileSel.h>

Description:

The PtFileSel widget is a tree where items can be files, directories, links to files or directories, or custom entries.


PtFileSel


A PtFileSel widget.

This widget is useful when a program lets you open or save files or directories. It reads a directory and displays the contents. You can also use the widget to navigate a filesystem and choose your own file and directory.

The items in the PtFileSel widget are displayed with images to show what type of file they are. Directory items are expandable and can show the files, directories and links under them. To expand and collapse items, you can use the pointer or these keys:

To: Press one of:
Expand a directory Enter, →, or + on the keypad
Collapse a directory Backspace, ←, or - on the keypad

Each item is stored in a PtFileSelItem_t structure that contains at least:

PtGenTreeItem_t gen
Used internally.
short opened
A value that indicates whether the given directories' children have already been allocated or not:
short type
The type of file the item is:
short root
A value that indicates if this is the root item:
char *fullpath
The full pathname of the item
int tag
Used internally

The widget has two main modes of operation:

Tree mode (default)
Items are displayed in a tree structure; opening a directory causes a new branch to be created.
Single-level mode
Items are displayed in a single level or list; the list contains all the files in the current directory. When a directory is chosen, the existing items are freed and new ones are created for the new directory. You can traverse up the filesystem by using the .. item. To use this mode, set the Pt_FS_SINGLE_LEVEL bit in Pt_ARG_FS_FLAGS.

Single-level file selector


A single-level file selector.

In this mode, you can also turn on the “key seek” flag, Pt_FS_SEEK_KEY, which lets you use the keyboard to search for a file. In this mode, the widget selects the next file or directory whose name starts with a character that you type. The search is case-sensitive and wraps to the top of the list if the character isn't found. Whenever you press a key, the Pt_CB_FS_SELECTION callback is invoked with a reason_subtype of Pt_LIST_SELECTION_BROWSE.

The widget can also display file information including name, size, date, permissions, owner and group. You can use the Pt_ARG_FS_FORMAT resource to set the amount and order of information displayed. A PtDivider widget is automatically included in the file selector, along with a label for each column you request.

If you want to override the default headers, create a PtDivider of your own, add appropriate PtLabel widgets to it, and make the divider a child of the file selector. The information you requested is displayed in the proper columns.

For example, if you create a PtDivider with the headings “Filename”, “File size”, and “Modification time” as a child of a PtFileSel widget and set the Pt_ARG_FS_FORMAT to nsd, the PtFileSel items contain the name, size, and date information in the proper columns, but your divider is displayed.

By default, when you expand an item (directory) for the first time, the directory is read and items are allocated. After this, when you collapse and expand the item, the information is stored in memory to remove the delay of reading a directory. You can refresh an item at any time by using the Pt_ARG_FS_REFRESH resource. You can also set the Pt_FS_FREE_ON_COLLAPSE flag to cause a directory to be reread every time it's expanded. Every time a new root directory is set, all the previous items are freed.

If you plan to add items to the PtFileSel widget yourself by using the PtFSAllocItem(), PtFSAddFirst(), and PtFSAddAfter() convenience functions, you should have a state callback (Pt_CB_FS_STATE, subtype = Pt_FS_STATE_START) that returns Pt_END.


Note: If you're in tree mode and you get a state callback for one of your items (i.e. not from a filesystem), you should deal with the expansion/collapse and return Pt_END from the callback to prevent PtFileSel from trying to find the item in the filesystem.

If you're in single-level mode and you get a state callback for one of your items, you should deal with the expansion; it's your responsibility to free all the previous items. Return Pt_END from the callback as mentioned above.


Examples

In the examples below, Pt_FS_ALL_FLAGS is a value containing all the flag bits. It's used for a mask.

To display only directories, in tree mode:

...
PtSetArg(&args[0], Pt_ARG_FS_FLAGS, Pt_FS_SHOW_DIRS,
         Pt_FS_ALL_FLAGS);
PtSetArg(&args[1], Pt_ARG_FS_ROOT_DIR, "/", 0);
PtSetArg(&args[2], Pt_ARG_AREA, area, 0);
PtCreateWidget(PtFileSel, Pt_DEFAULT_PARENT, 3, args);
...

To display only files in single-level mode, with keyboard seek on:

...
PtSetArg(&args[0], Pt_ARG_FS_FLAGS,
         Pt_FS_SINGLE_LEVEL|Pt_FS_SHOW_FILES| \
         Pt_FS_KEY_SEEK, Pt_FS_ALL_FLAGS);
PtSetArg(&args[1], Pt_ARG_FS_ROOT_DIR, "/", 0);
PtSetArg(&args[2], Pt_ARG_AREA, area, 0);
PtCreateWidget(PtFileSel, Pt_DEFAULT_PARENT, 3, args);
...

To display a single level of directories with a “..” item to move up levels:

...
PtSetArg(&args[0], Pt_ARG_FS_FLAGS,
         Pt_FS_SHOW_DIRS|Pt_FS_SINGLE_LEVEL,
         Pt_FS_ALL_FLAGS);
PtSetArg(&args[1], Pt_ARG_FS_ROOT_DIR, "/", 0);
PtSetArg(&args[2], Pt_ARG_AREA, area, 0);
PtCreateWidget(PtFileSel, Pt_DEFAULT_PARENT, 3, args);
...

To display a combination of directories and files in tree mode:

...
PtSetArg(&args[0], Pt_ARG_FS_FLAGS,
         Pt_FS_SHOW_DIRS|Pt_FS_SHOW_FILES,
         Pt_FS_ALL_FLAGS);
PtSetArg(&args[1], Pt_ARG_FS_ROOT_DIR, "/", 0);
PtSetArg(&args[2], Pt_ARG_AREA, area, 0);
PtCreateWidget(PtFileSel, Pt_DEFAULT_PARENT, 3, args);
...

To show only hidden files (that is, those whose name begins with a “.” and aren't normally displayed):

...
PtSetArg(&args[0], Pt_ARG_FS_FLAGS,
         Pt_FS_SHOW_FILES|Pt_FS_SHOW_HIDDEN,
         Pt_FS_ALL_FLAGS);
PtSetArg(&args[1], Pt_ARG_FS_ROOT_DIR, "/", 0);
PtSetArg(&args[2], Pt_ARG_AREA, area, 0);
PtCreateWidget(PtFileSel, Pt_DEFAULT_PARENT, 3, args);
...

You can show hidden files or directories by combining the Pt_FS_SHOW_HIDDEN flag with Pt_FS_SHOW_DIRS or Pt_FS_SHOW_FILES.

The PtFileSel widget reads a filesystem, so there could be some delays on large directories. To help you cope with these delays, the widget does the following:

Here's a full PtFileSel example:



#include <stdio.h>
#include <stdlib.h>
#include <Pt.h>
#include <photon/PtFileSel.h>

PtWidget_t *window, *button, *fs;

/* Quit button callback */
int
quit( PtWidget_t *widget, void *data,
      PtCallbackInfo_t *info)
{
    PtExit(EXIT_SUCCESS);
    return (Pt_CONTINUE);
}

/* Open button callback */
int
file_open( PtWidget_t *widget, void *data,
           PtCallbackInfo_t *info)
{
    PtFileSelItem_t *item;
    char buffer[PATH_MAX+NAME_MAX + 40];
    char const *btns[] = { "&OK" };

    item = PtFSGetCurrent(fs);
    if (item == NULL)
        return(Pt_CONTINUE);

    strcpy(buffer, "The selected file is\n");
    strcat(buffer, item->fullpath);


    PtAlert( window, NULL, "Selected File", NULL,
                buffer, NULL, 1, btns, NULL, 1, 1, Pt_MODAL );

    return (Pt_CONTINUE);
}

/* State callback, will use the reason to block the
   widget for large directory opens. */
int
state_cb( PtWidget_t *widget,
          void * data,
          PtCallbackInfo_t *info)
{
    PtArg_t args[3];
    PtFileSelCallback_t *it;

    it = (PtFileSelCallback_t *)(info->cbdata);

    if (it->reason == Pt_FS_STATE_START)
    {
        PtSetArg(&args[0], Pt_ARG_FLAGS, Pt_BLOCKED,
                 Pt_BLOCKED);
        PtSetArg(&args[1], Pt_ARG_CURSOR_TYPE,
                 Ph_CURSOR_CLOCK, 0);
    }
    else
    {
        PtSetArg(&args[0], Pt_ARG_FLAGS, ~Pt_BLOCKED,
                 Pt_BLOCKED);
        PtSetArg(&args[1], Pt_ARG_CURSOR_TYPE,
                 Ph_CURSOR_INHERIT, 0);
    }
    PtSetResources(widget, 2, args);
    return (Pt_CONTINUE);
}

/* Function to handle photon draw events and fix
   screen damage */
int
handler_cb(PtWidget_t *widget,
           void * data,
           PtCallbackInfo_t *info)
{
    PtBkgdHandlerProcess();

    return (Pt_CONTINUE);
}

int main(void)
{
    PtArg_t     args[10];
    PtCallback_t cb, cb2;
    PhDim_t win_dim = { 300, 300 };
    PhArea_t area;

    if (PtInit(NULL) == -1)
       exit(EXIT_FAILURE);

    /* Make the main window. */
    PtSetArg( &args[0], Pt_ARG_WINDOW_TITLE,
              "PtFileSel Demo", 0 );
    PtSetArg( &args[1], Pt_ARG_DIM, &win_dim, 0 );

    if ((window = PtCreateWidget(PtWindow, Pt_NO_PARENT,
                                 2, args)) == NULL)
      PtExit(EXIT_FAILURE);

    /* Make a file selector. */
    area.size.w = 200;
    area.size.h = 200;
    area.pos.x = 10;
    area.pos.y = 10;
    cb.event_f = state_cb;
    cb2.event_f = handler_cb;
    PtSetArg(&args[0], Pt_ARG_AREA, &area, 0 );
    PtSetArg(&args[1], Pt_ARG_FS_FLAGS,
             Pt_FS_SHOW_DIRS|Pt_FS_SHOW_FILES,
             Pt_FS_ALL_FLAGS );
    PtSetArg(&args[2], Pt_ARG_FS_ROOT_DIR, "/", 0);
    PtSetArg(&args[3], Pt_CB_FS_STATE, &cb, 0);
    PtSetArg(&args[4], Pt_CB_FS_BKGD_HANDLER, &cb2, 0);
    fs = PtCreateWidget( PtFileSel, window, 5, args );

    /* Make a button for quitting. */
    area.size.w = 60;
    area.size.h = 20;
    area.pos.x = 230;
    area.pos.y = 250;
    cb.event_f = quit;
    PtSetArg( &args[0], Pt_ARG_AREA, &area, 0 );
    PtSetArg( &args[1], Pt_ARG_TEXT_STRING, "Quit", 0);
    PtSetArg( &args[2], Pt_CB_ACTIVATE, &cb, 0);
    button = PtCreateWidget( PtButton, window, 3, args );

    /* Make a open button. */
    area.size.w = 60;
    area.size.h = 20;
    area.pos.x = 160;
    area.pos.y = 250;
    cb.event_f = file_open;
    PtSetArg( &args[0], Pt_ARG_AREA, &area, 0 );
    PtSetArg( &args[1], Pt_ARG_TEXT_STRING, "Open", 0);
    PtSetArg( &args[2], Pt_CB_ACTIVATE, &cb, 0);
    PtCreateWidget( PtButton, window, 3, args );

    PtRealizeWidget( window );

    PtMainLoop();
    return (EXIT_SUCCESS);
}

New resources:

Resource C type Pt type Default
Pt_ARG_FS_FILE_SPEC char * String "*"
Pt_ARG_FS_FLAGS unsigned long Flags Pt_FS_SHOW_DIRS | Pt_FS_SHOW_FILES
Pt_ARG_FS_FORMAT char * String n
Pt_ARG_FS_IMAGES PhImage_t *, short Array PFM-style images (write-only)
Pt_ARG_FS_LBL_DATE char * String "Date"
Pt_ARG_FS_LBL_GROUP char * String "Group"
Pt_ARG_FS_LBL_NAME char * String "Name"
Pt_ARG_FS_LBL_OWNER char * String "Owner"
Pt_ARG_FS_LBL_PERMISSIONS char * String "Permissions"
Pt_ARG_FS_LBL_SIZE char * String "Size"
Pt_ARG_FS_REFRESH PtFileSelItem_t * Pointer NULL
Pt_ARG_FS_ROOT_DIR char * String NULL
Pt_CB_FS_BKGD_HANDLER PtCallback_t * Link NULL
Pt_CB_FS_SELECTION PtCallback_t * Link NULL
Pt_CB_FS_STATE PtCallback_t * Link NULL

Pt_ARG_FS_FILE_SPEC

C type Pt type Default
char * String "*"

A string that you can use to limit the files listed, by specifying a pattern that the filenames must match. The default is *, but you can use values such as *.c, *.[ch] and so on. You can specify multiple patterns by separating them with a space or a comma (for example, *.gif, *.jpg).

Pt_ARG_FS_FLAGS

C type Pt type Default
unsigned long Flags Pt_FS_SHOW_DIRS | Pt_FS_SHOW_FILES

Flags that control the appearance and behavior of the file selector:

Pt_FS_CASE_INSENSITIVE
The file name's filtering (according to the file_spec ) is case-insensitive.
Pt_FS_ERROR_POPUP
Display an error dialog when the desired root directory is invalid.
Pt_FS_FREE_ON_COLLAPSE
Free items on every collapse. This means that every time an item expands, all its child items are reread from the disk.
Pt_FS_NO_ROOT_DISPLAY
Don't show the root item.
Pt_FS_SEEK_KEY
Keyboard seek mode, valid only for single-level mode. Type characters to seek an item.
Pt_FS_SHOW_DIRS
Show directories.
Pt_FS_SHOW_ERRORS
Show files that had a read error.
Pt_FS_SHOW_FILES
Show files.
Pt_FS_SHOW_HIDDEN
Show hidden files or directories. This flag must be combined with Pt_FS_SHOW_FILES and/or Pt_FS_SHOW_DIRS. A hidden file or directory is one whose name begins with a period (.).
Pt_FS_SINGLE_LEVEL
Single-level mode, instead of tree mode. Directories and possibly files are shown in one level with a .. item for moving up directory levels.

Note: If the Pt_FS_NO_ROOT_DISPLAY and Pt_FS_SINGLE_LEVEL flags are both set, the Pt_FS_NO_ROOT_DISPLAY flag is ignored.

Pt_ARG_FS_FORMAT

C type Pt type Default
char * String n

A string that's used to set the order and amount of file information displayed and optionally the initial size (in pixels) of each column shown. The following information can be displayed for each item in the widget by including the corresponding letter in the Pt_ARG_FS_FORMAT string:

To display: Specify:
Name n
Size (in bytes) s
Size (in kbytes) k
Date d
Permissions p
Owner o
Group g

Note: These letters must be in lower case.

The s and k options are mutually exclusive. If you try to set both, the first one found in the string is used and the other is ignored. The maximum number of characters is 6; any extra ones are ignored.

If you wish to display only the filename and no divider at the top, set this resource to NULL. To set the size of the column, specify a number of pixels before the corresponding letter. For example, if you want to have the name (100 pixels wide) and the date (200 pixels wide) displayed, set the Pt_ARG_FS_FORMAT resource as follows:

PtSetArg(&args[0], Pt_ARG_FS_FORMAT, "100n200d", 0);
    

Pt_ARG_FS_IMAGES (write-only)

C type Pt type Default
PhImage_t * Array PFM-style images

A pointer to an array of image pointers (of type PhImage_t — see the Photon Library Reference) to be used for displaying items. The following constants are used to index into this array (the order shown is the order the images appear in the array):

If you don't want to change an image, specify NULL for that array element. For example, to change the file image, set the Pt_FS_FILE entry of the array to the image pointer and set all others to NULL.

For example, to change the Pt_FS_DIR_OP and Pt_FS_FILE images:

PhImage_t *images[7];
/* Fill the below image structures */
…
PhImage_t new_open_image, new_file_image;
...
images[Pt_FS_DIR_OP] = &new_open_image;
images[Pt_FS_DIR_CL] = NULL;
images[Pt_FS_DLINK_OP] = NULL;
images[Pt_FS_DLINK_CL] = NULL;
images[Pt_FS_FILE] = &new_file_image;
images[Pt_FS_FLINK] = NULL;
images[Pt_FS_ERROR] = NULL;

PtSetArg(&args[0], Pt_ARG_FS_IMAGES, images, 7);
...
    

If you want to save processing time, set the length parameter to PtSetArg() to the index of the last image you changed + 1.


Note: Set the flags member of the PhImage_t structures to:
Ph_RELEASE_IMAGE | Ph_RELEASE_PALETTE |
Ph_RELEASE_TRANSPARENCY_MASK | Ph_RELEASE_GHOST_BITMAP
    

before providing the images to the widget. If you do this, the memory used for the images is released when the widget is unrealized or destroyed.


Pt_ARG_FS_LBL_DATE

C type Pt type Default
char * String "Date"

The label used for the column that displays the files' modification dates.

Pt_ARG_FS_LBL_GROUP

C type Pt type Default
char * String "Group"

The label used for the column that displays the group for the owner of the files.

Pt_ARG_FS_LBL_NAME

C type Pt type Default
char * String "Name"

The label used for the column that displays the names of the files.

Pt_ARG_FS_LBL_OWNER

C type Pt type Default
char * String "Owner"

The label used for the column that displays the owners of the files.

Pt_ARG_FS_LBL_PERMISSIONS

C type Pt type Default
char * String "Permissions"

The label used for the column that displays the permissions for the files.

Pt_ARG_FS_LBL_SIZE

C type Pt type Default
char * String "Size"

The label used for the column that displays the sizes of the files.

Pt_ARG_FS_REFRESH

C type Pt type Default
PtFileSelItem_t * Pointer NULL

A pointer to the PtFileSelItem_t structure for an expandable item that's to be refreshed (i.e. reread from the disk). For example, if you have a large directory displayed and someone adds a file, you may wish to refresh the directory item. To do this, set the Pt_ARG_FS_REFRESH resource to point to the root item for that subtree.

Pt_ARG_FS_ROOT_DIR

C type Pt type Default
char * String NULL

The root directory for the file selector. The default value is NULL or none.

The widget stores the actual path obtained via the realpath() function (see the QNX Neutrino Library Reference). For example, if you set this resource to ///home//fred/.././fred/src, the widget actually sets it to /home/fred/src or /fs/hd0-qnx4/home/fred/src (if home is a link to /fs/hd0-qnx4/home).

Setting Pt_ARG_FS_ROOT_DIR to NULL clears the PtFileSel directory tree, and setting it to "." loads the current working directory.

Pt_CB_FS_BKGD_HANDLER

C type Pt type Default
PtCallback_t * Link NULL

A list of PtCallback_t structures that define the callbacks invoked each time a directory item is read. For example, if you have 5 files in a directory and expand that directory, this callback is invoked 5 times. This gives you a chance to translate any non-UTF-8 filenames into UTF-8 strings. It's also useful for handling pending Photon events.

Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:

reason
Pt_CB_FS_BKGD_HANDLER
reason_subtype
One of:
event
A pointer to a PhEvent_t structure that describes the event that caused the callback to be invoked.
cbdata
Used only for the Pt_FS_NEW_ITEM subtype of this callback

For the Pt_FS_NEW_ITEM reason subtype, cbdata points to a structure of type PtFileSelBkgdCallback_t, which contains at least:

char* name
A pointer to a buffer that contains the filename that the widget will add to the list. You can use this callback to ensure that the buffer contains a valid UTF-8 string.

If this callback returns Pt_END, the item isn't added. If you want to make sure that the widget correctly displays filenames that aren't encoded in UTF-8, you can use PxTranslate... functions to translate them, copy the new string into name, and return Pt_CONTINUE. You may also wish to process events.


Note: Set the Pt_CB_FS_BKGD_HANDLER callback resource before the Pt_ARG_FS_ROOT_DIR resource in order to translate all the filenames.

Here's an example of this callback:

int
handler_cb( PtWidget_t *widget, void *data,
             PtCallbackInfo_t *info)
{
     PtFileSelBkgdCallback_t *it = (void *) info->cbdata;
     if (info->reason_subtype == Pt_FS_NEW_ITEM)
     {
         int srctaken = 0, dstmade = 0;
         char dst[NAME_MAX * 3];

         /* ctrl is a PxTransCtrl structure that was set with a
            call to PxTranslateSet(). The following will convert
            the string and copy it back to the original: */

         if (PxTranslateToUTF( ctrl, it->name, strlen( it->name),
                       &srctaken, dst, sizeof(dst)-1, &dstmade) == 0)
         {
             dst[ dstmade ] = '\0';
             strcpy(it->name, dst);
         }
         else
             /* Can't translate to UTF-8 -- let's just ignore this file... */
             return Pt_END;
     }
     PtBkgdHandlerProcess();

     return(Pt_CONTINUE);
}

Pt_CB_FS_SELECTION

C type Pt type Default
PtCallback_t * Link NULL

A list of PtCallback_t structures that define the callbacks invoked when you select an item. Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:

reason
Pt_CB_FS_SELECTION
reason_subtype
Depending on the selection mode, this is one of:
event
A pointer to a PhEvent_t structure that describes the event that caused the callback to be invoked.
cbdata
A pointer to a PtFileSelCallback_t structure that contains:

These callbacks should return Pt_CONTINUE.

Pt_CB_FS_STATE

C type Pt type Default
PtCallback_t * Link NULL

A list of PtCallback_t structures that define the callbacks invoked when an item is expanded or collapsed. Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:

reason
Pt_CB_FS_STATE
reason_subtype
Pt_TREE_COLLAPSING or Pt_TREE_EXPANDING.
event
A pointer to a PhEvent_t structure that describes the event that caused the callback to be invoked.
cbdata
A pointer to a PtFileSelCallback_t structure that contains:

These callbacks should return Pt_CONTINUE.

Inherited resources:

If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.

Resource Inherited from Default override
Pt_ARG_ANCHOR_FLAGS PtWidget
Pt_ARG_ANCHOR_OFFSETS PtWidget
Pt_ARG_AREA PtWidget
Pt_ARG_BANDWIDTH_THRESHOLD PtBasic Not used by this class.
Pt_ARG_BASIC_FLAGS PtBasic
Pt_ARG_BEVEL_WIDTH PtWidget
Pt_ARG_BITMAP_CURSOR PtWidget
Pt_ARG_BEVEL_COLOR PtBasic
Pt_ARG_BEVEL_CONTRAST PtBasic
Pt_ARG_COLOR PtBasic
Pt_ARG_CONTAINER_FLAGS PtContainer
Pt_ARG_CONTRAST PtBasic
Pt_ARG_CURSOR_COLOR PtWidget
Pt_ARG_CURSOR_OVERRIDE PtContainer
Pt_ARG_CURSOR_TYPE PtWidget
Pt_ARG_DARK_BEVEL_COLOR PtBasic
Pt_ARG_DARK_FILL_COLOR PtBasic
Pt_ARG_DATA PtWidget
Pt_ARG_DIM PtWidget
Pt_ARG_EFLAGS PtWidget
Pt_ARG_EXTENT PtWidget
Pt_ARG_FILL_COLOR PtBasic
Pt_ARG_FILL_PATTERN PtBasic
Pt_ARG_FLAGS PtWidget
Pt_ARG_HEIGHT PtWidget
Pt_ARG_HELP_TOPIC PtWidget
Pt_ARG_HIGHLIGHT_ROUNDNESS PtBasic
Pt_ARG_INLINE_COLOR PtBasic
Pt_ARG_LIGHT_BEVEL_COLOR PtBasic
Pt_ARG_LIGHT_FILL_COLOR PtBasic
Pt_ARG_LIST_COLUMN_ATTR PtGenList
Pt_ARG_LIST_COLUMN_POS PtGenList
Pt_ARG_LIST_DNDSEL_COLOR PtGenList
Pt_ARG_LIST_FLAGS PtGenList
Pt_ARG_LIST_FONT PtGenList
Pt_ARG_LIST_ITEM_COUNT PtGenList
Pt_ARG_LIST_SB_RES PtGenList
Pt_ARG_LIST_SCROLL_RATE PtGenList
Pt_ARG_LIST_SEL_COUNT PtGenList
Pt_ARG_LIST_TOTAL_HEIGHT PtGenList
Pt_ARG_MARGIN_HEIGHT PtBasic
Pt_ARG_MARGIN_WIDTH PtBasic
Pt_ARG_MAXIMUM_DIM PtWidget
Pt_ARG_MINIMUM_DIM PtWidget
Pt_ARG_OUTLINE_COLOR PtBasic
Pt_ARG_POINTER PtWidget
Pt_ARG_POS PtWidget
Pt_ARG_RESIZE_FLAGS PtWidget
Pt_ARG_SCROLLBAR_WIDTH PtGenList
Pt_ARG_SELECTION_FILL_COLOR PtGenList
Pt_ARG_SELECTION_MODE PtGenList
Pt_ARG_SELECTION_TEXT_COLOR PtGenList
Pt_ARG_STYLE PtBasic
Pt_ARG_TITLE PtContainer
Pt_ARG_TITLE_FONT PtContainer
Pt_ARG_TOP_ITEM_POS PtGenList
Pt_ARG_TRANS_PATTERN PtBasic
Pt_ARG_TREE_FLAGS PtGenTree
Pt_ARG_TREE_LINE_COLOR PtGenTree
Pt_ARG_TREE_LINE_SPACING PtGenTree
Pt_ARG_TREE_MARGIN_COLOR PtGenTree
Pt_ARG_USER_DATA PtWidget
Pt_ARG_VISIBLE_COUNT PtGenList
Pt_ARG_WIDTH PtWidget
Pt_CB_ACTIVATE PtBasic
Pt_CB_ARM PtBasic
Pt_CB_BALLOONS PtContainer Not used by this class.
Pt_CB_BLOCKED PtWidget
Pt_CB_CHILD_ADDED_REMOVED PtContainer
Pt_CB_DESTROYED PtWidget
Pt_CB_DISARM PtBasic
Pt_CB_DND PtWidget See below.
Pt_CB_FILTER PtWidget
Pt_CB_GEN_TREE_INPUT PtGenTree
Pt_CB_GOT_FOCUS PtBasic
Pt_CB_HOTKEY PtWidget
Pt_CB_IS_DESTROYED PtWidget
Pt_CB_LOST_FOCUS PtBasic
Pt_CB_MENU PtBasic
Pt_CB_OUTBOUND PtWidget
Pt_CB_RAW PtWidget
Pt_CB_REALIZED PtWidget
Pt_CB_REPEAT PtBasic
Pt_CB_RESIZE PtContainer
Pt_CB_SCROLL_MOVE PtGenList
Pt_CB_UNREALIZED PtWidget

Pt_CB_DND

For Pt_CB_DND callbacks for a PtList, the cbinfo->cbdata is a pointer to a PtTreeDndCallback_t structure, containing at least the following members:

PtDndCallbackInfo_t dnd_info
See the description of Pt_CB_DND for PtWidget.
PtGenTreeItem_t *item
A pointer to the PtGenTreeItem_t structure for the target item involved in the drag-and-drop operation. You can cast this to be a pointer to a PtFileSelItem_t.
int item_pos
The index of that item.
unsigned long flags
Possible values:
int action
This member is initially set to Pt_LIST_ITEM_DNDSELECTED_UP | Pt_LIST_ITEM_DNDSELECTED_DOWN | Pt_LIST_ITEM_DNDSELECTED_IN. You can unset some of these values to indicate that the drag-and-drop isn't accepted in that case. For example, if you unset Pt_LIST_ITEM_DNDSELECTED_IN, the drag-and-drop can't occur inside the item, only above or below.

Convenience functions:

The PtFileSel widget defines the following convenience functions that make it easier to use the file selector once it's been created:

PtFileSelection()
Create a file-selector dialog — see the Photon Library Reference
PtFSAddAfter()
Insert an item after the specified item
PtFSAddFirst()
Add a root item to the widget
PtFSAllItems()
Fill a buffer with pointers to all items
PtFSAllocItem()
Create an item for a file-selector widget
PtFSClearSelection()
Clear the selection
PtFSDamageItem()
Redraw an item
PtFSExpandParents()
Expand an item's collapsed ancestors
PtFSFolderCollapse()
Collapse an expandable item (directory)
PtFSFolderExpand()
Expand an expandable item (directory)
PtFSFreeAllItems()
Unlink and frees all items
PtFSFreeItems()
Free an unlinked item
PtFSGetCurrent()
Get the current item (see Current item in the description of PtGenList)
PtFSGetSelIndexes()
Fill a buffer with indexes
PtFSGoto()
Set the current item
PtFSItemIndex()
Calculate the index of the specified item
PtFSRemoveChildren()
Unlink all the children of a given item
PtFSRemoveItem()
Unlink an item
PtFSRemoveList()
Unlink the root item
PtFSRootItem()
Return the first root item of the file selector
PtFSSelect()
Select the specified item
PtFSSelectedItems()
Fill a buffer with item pointers
PtFSSetSelIndexes()
Set the selection indexes
PtFSShow()
Set the position so that the specified item is visible
PtFSUnselect()
Unselect the specified item
PtFSUnselectNonBrothers()
Unselect all items that aren't siblings of the specified item

Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/photon/widget_ref/ptfilesel.html on line 2670

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/photon/widget_ref/ptfilesel.html on line 2670