This file is likely to grow in size as I think of other things to tell you about :)
struct { String string; int list_index; }; |
To get information from it in a callback, use something like:
void alist_callback(Widget aw, XtPointer client, XtPointer call) { XawListReturnStruct *listptr=(XawListReturnStruct *) call; int number=listptr->list_index; strcpy(buffer, listptr->string); ... } |
Basically, thats it. Remember that the widget will automatically hightlight the list element for you. Note also that the callback is NOT called if you un-highlight a previously selected list member by clicking on it again.
// This is a xvDirList callback ... void dirlist_select(Widget aw, XtPointer client, XtPointer call) { char *temp=dirlist.GetSelectedItem(call, XVRELATIVEPATH); strcpy(pathbuffer, dirlist.Directory(temp)); int dirstatus=dirlist.SetNewPath(pathbuffer, XVDIRLIST, FALSE); int filestatus=filelist.SetNewPath(pathbuffer, XVFILELIST,FALSE); } |
The third parameter indicates whether hidden files should be listed and is a matter of personal choice.
How can you set the translation table? Use the scrollbar's X_map event...
void scroller_X_Map (...) { XtTranslations t; t=XtParseTranslationTable( " |
If you want to use button 3, simply substitute the '1' for a '3'.
Now you need to be able to read the position of the scrollbar, so use the jump callback:
void scroller_jump(...) { float t= * (float *) calldata; // now t has a value between 0.0 and 1.0 - // a percentage of the distance.. } |
You can then use this value to determine how much you have scrolled the thumb.
GC colour methods such as GCSetForeground require a Pixel value to be passed to them, so you can use the stringToPixel method to convert colour name strings to Pixel values (it will allocate the colour in the ColourMap if it isn't already there)...
window.GCSetForeground(window.stringToPixel("SkyBlue"));This example sets the GC foreground value to the pixel value of SkyBlue in the colourmap.
Firstly, the name of the bitmap determines how it will be interpreted. If the filename is of the format bitmapname.xbm then it will be interpreted as an ordinary X11 bitmap. If the filename is of the format bitmapname.xpm then it is assumed that this is a colour pixmap and is treated as such.
Secondly, the format of the file: for .xbm files, the standard X11 format is used... i.e.
Where the filename is bitmapname.xbm... the internal structure of the file will be..
Note that with this version of the XIB, the files used must have the file format name .xbm or .xpm to be interpreted correctly.
1. For each code module .cc file, declare a corresponding .h file which contains extern declarations for functions or variables that you want to export to the rest of the application. Any .h files that you declare are imported by the XIB into the main application header file.
2. If you want functions in your code modules to access data or objects in the application, include the following lines at the start of each .cc module...
#include X11/xv/xv.h #include "appname.h"Note that the first include line must also include the angle braces which are not shown here.
The first line includeds the xv header file and the second includes the application's own main header file. Strictly speaking, the appname.h file includes the xv.h file but you may want to include this line anyway...