if (*type == FILE_CONTENTS)
XmTextSetString (w, value);
else if (*type == FILE_NAME) {
sprintf (label, "Filename: %s", value);
string = XmStringCreateLocalized (label);
XtVaSetValues (w, XmNlabelString, string, NULL);
XmStringFree (string);
}
}
The application basically has the same functionality as editor.c in Chapter 14. The only difference in the interface is
the Filename: status area that displays the name of the current file. This status area is also a drop site for file objects,
so the user can drag a file from the file_manager.c application and drop it in this area. When a file is dropped here, the
filename is displayed in the status area, and the contents of the file are copied into the ScrolledText object. The
ScrolledText object has also been modified to function as a drop site for file data, so the user can drop a file in the text
entry area. the figure shows the output of the application before and after a file has been dropped in the file status area.
19.5.1 Creating a Drop Site
The file status area is a Label widget, so it does not have any drop site capabilities by default. In order for the widget
to function as a drop site, we have to register it using XmDropSiteRegister(), as shown below:
n = 0;
importList[0] = FILE_CONTENTS;
importList[1] = FILE_NAME;
XtSetArg (args[n], XmNimportTargets, importList); n++;
XtSetArg (args[n], XmNnumImportTargets, XtNumber (importList)); n++;
XtSetArg (args[n], XmNdropSiteOperations, XmDROP_COPY); n++;
XtSetArg (args[n], XmNdropProc, ...