Unformatted text preview:

Graphic File Browser for the Xt Toolkit David Harrison University of California Berkeley 1990 This is a library implementing a simple graphical file browser It shows a list of files each with an icon Clicking on a file causes it to become highlighted Double clicking on it will cause it to be opened using a user defined callback function There are several limitations to this browser There is no provision for moving or copying The order of the icons cannot be changed by It does not detect changes to the directory must explicitly call a refresh function to changes to appear files the user so the caller cause directory The necessary definitions for using fb are in the file fb h generally in octtools include New file browsers are created by calling fb create typedef struct fb item defn String class Defines the image String name Name displayed under image caddr t data User specific data fb item Widget fb create Widget parent int num items fb item items void callback caddr t data This routine will create a new browser under the widget parent The browser consists of a viewport for possible scrolling named browser a box to contain the files named box and the files themselves created with the class name specified in items One image name pair will be created for each item in items They will be shown in the order given The image shown is not directly specified by the browser The user should specify the image as a resource using the class name for the item When the user double clicks on an image callback will be called with the arguments described below void callback class label item data global data char class label caddr t item data global data The item data is that associated with the item The global data is the data parameter to this function void fb update Widget fb int num items fb item items This routine updates the file browser fb with new information If the information is the same as the previous information there will be no change to the displayed state If there are any changes the displayed browser will be rebuilt and the programmer should expect some flashing File browsers may be destroyed by calling XtDestroyWidget on the widget returned by fb create Resource Management Resources are important when using the file browser By default the browser uses a question mark as the image for all the displayed files However you can control this behavior using resources All entries in the browser are displayed using the LImage widget These widgets have a resource called image When specified in a resource file the value of this resource is a path to a file of the form produced by the bitmap 1 program You can supply a different image for each class you specify in an item list For example let s assume you have three different kinds of files you want to display in the browser normal text files non text data files and directories First you invent names for each of these classes In this case let s choose text for text files data for data files and directory for directories When you build up the item list passed to fb create you should specify either text data or directory in the class field Using the bitmap 1 program you should create bitmaps for each of these classes Let s assume you name these text bm data bm and directory bm Now let s assume the overall class for your application is Useful In the applications default file for your application you should include the following lines Useful text image text bm Useful data image data bm Useful directory image directory bm Actually you may have to put more complete path names to these files The file browser will then use your images for each class of item Example The program br test c is provided as a simple example of how to use the file browser Note this program uses resources that should be loaded onto your server These resources are in br test resources This file also provides examples of sommonly specified browser resources


View Full Document

UW-Madison CS 755 - Graphic File Browser for the Xt Toolkit

Loading Unlocking...
Login

Join to view Graphic File Browser for the Xt Toolkit and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Graphic File Browser for the Xt Toolkit and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?