1 /********************************************************************\ 2 ** _________________________________ ** 3 ** A n t h o n y |________ __ __ _________| ** 4 ** | |o_| |o_| | ** 5 ** T h y s s e n __| __ __ |__ ** 6 ** __| __| | | |__ |__ ** 7 ** `` Dragon Computing! '' __| __| | | |__ |__ ** 8 ** |_____| |__| |_____| ** 9 ** ** 10 \********************************************************************/ 11 /* 12 ** IconLabel.h - IconLabel Widget Display a Pixmap with or without a label 13 ** 14 ** Author: Anthony Thyssen 15 ** Griffith University 16 ** anthony@cit.gu.edu.au 17 ** 18 ** Date: March 30, 1996 19 ** 20 ** This Widget was created due to problems with using the original X 21 ** Consortium Label Widget for displaying Bitmap and Pixmap in my 22 ** XbmBrowser program. I designed this widget to basically display a 23 ** pixmap and optionally a title or filename centered underneath this 24 ** image. 25 ** 26 ** FEATURES 27 ** 1/ Pixmap displayed correctly (a flag indicates to treat it as a bitmap) 28 ** 2/ Shaped Windows using the bitmap mask given 29 ** 3/ Optional Label centered either above or below the image 30 ** 4/ Numerous inter-dimension controls for good user control 31 ** 32 */ 33 34 #ifndef _IconLabel_h 35 #define _IconLabel_h 36 37 #include <X11/Xaw/Simple.h> 38 39 /* Resources * -- new to this widget (subclass of Core,Simple) 40 41 Name Class RepType Default Value 42 ---- ----- ------- ------------- 43 background Background Pixel XtDefaultBackground 44 border BorderColor Pixel XtDefaultForeground 45 borderWidth BorderWidth Dimension 1 46 cursor Cursor Cursor None 47 cursorName Cursor String NULL 48 destroyCallback Callback Pointer NULL 49 * infoPtr InfoPtr XtPointer NULL 50 * font Font XFontStruct* XtDefaultFont 51 * foreground Foreground Pixel XtDefaultForeground 52 height Height Dimension 0 53 insensitiveBorder Insensitive Pixmap Gray 54 * internalHeight Height Dimension 1 55 * internalWidth Width Dimension 2 56 * isBitmap IsBitmap Boolean False 57 * label Label String NULL 58 * labelGap Height Dimension 1 59 * labelTop LabelTop Boolean False 60 mappedWhenManaged MappedWhenManaged Boolean True 61 * mask Mask Bitmap None 62 * pixmap Pixmap Pixmap None 63 pointerColor Foreground Pixel XtDefaultForeground 64 pointerColorBackground Background Pixel XtDefaultBackground 65 * resize Resize Boolean True 66 sensitive Sensitive Boolean True 67 * shape Shape Boolean True 68 width Width Dimension 0 69 x Position Position 0 70 y Position Position 0 71 72 73 Resource Explaination 74 75 font the font to draw the text label in. 76 77 foreground the colors to use for the window background and to 78 background use to display bitmaps and the text label with. 79 80 pixmap The pixmap/bitmap to be displayed in the widget. 81 mask The mask should be the same size (not checked) and is 82 currently only used to shape the widget. 83 84 isBitmap The Pixmap given is really a bitmap and is to be 85 drawn as such. Setting this on basically makes this 86 widget act just like the Xaw Label widget and like 87 that widget could draw pixmaps incorrectly on some` 88 monocrome displays. 89 90 label String to display as a label to the pixmap if NULL 91 no label will be displayed 92 93 labelTop Put the label above the pixmap? 94 It is placed under the pixmap (centered) by default. 95 96 internalWidth Sets the amount of space around the text label 97 internalHeight and the pixmap and between the two items. This space 98 is allways provided around the label while the 99 pixmap is normally centered in whatever area is left. 100 101 labelGap Extra space between the pixmap and the label on top of 102 the usual internalHeight space provided. 103 104 shape Use the Shape extension and mask on the pixmap. If the 105 label is turned on a extra box (padded by internalWidth 106 and Height) is added for it. 107 108 resize if true only the user modifing the widget can resize 109 the window. 110 111 infoPtr A pointer to a user structure containing information. 112 This allows a program to lookup the information a 113 particular widget represents, when selected, due to 114 some action by the user. 115 See the GetInfoPtr() and SetInfoPtr() functions below. 116 117 */ 118 119 /* specific to this widget */ 120 #define XtNmask "mask" 121 #define XtCMask "Mask" 122 #define XtNisBitmap "isBitmap" 123 #define XtCIsBitmap "IsBitmap" 124 #define XtNlabelTop "labelTop" 125 #define XtCLabelTop "LabelTop" 126 #define XtNshape "shape" 127 #define XtCShape "Shape" 128 #define XtNlabelGap "labelGap" 129 #define XtNinfoPtr "infoPtr" 130 #define XtCInfoPtr "InfoPtr" 131 132 133 /* in case XtStringsDef.h is not included */ 134 #ifndef _XtStringDefs_h_ 135 #define XtNforeground "foreground" 136 #define XtNlabel "label" 137 #define XtNfont "font" 138 #define XtNinternalWidth "internalWidth" 139 #define XtNinternalHeight "internalHeight" 140 #define XtNresize "resize" 141 #define XtCResize "Resize" 142 #define XtNpixmap "pixmap" 143 #define XtCPixmap "Pixmap" 144 #endif 145 146 /* Class record constants */ 147 extern WidgetClass iconLabelWidgetClass; 148 149 typedef struct _IconLabelClassRec *IconLabelWidgetClass; 150 typedef struct _IconLabelRec *IconLabelWidget; 151 152 153 /* Public Functions */ 154 155 /* Function Name: SetInfoPtr 156 * Description: Set the pointer to extra information (for fast lookup) 157 * Arguments: IconLabelWidget, and the pointer to store 158 * Returns: none. 159 */ 160 extern void SetInfoPtr( 161 #if NeedFunctionPrototypes 162 Widget /* ilw */, 163 XtPointer /* info_ptr */ 164 #endif 165 ); 166 167 /* Function Name: GetInfoPtr 168 * Description: Set the pointer to extra information (for fast lookup) 169 * Arguments: IconLabelWidget with the information to be retrieved 170 * Returns: the current pointer to information 171 */ 172 extern XPointer GetInfoPtr( 173 #if NeedFunctionPrototypes 174 Widget /* ilw */ 175 #endif 176 ); 177 178 #endif /* _IconLabel_h */ 179 180