1 /* 2 * Motif Tools Library, Version 3.1 3 * $Id: LayoutGP.h,v 1.1.1.1 2001/02/10 13:46:12 motiftools Exp $ 4 * 5 * Written by David Flanagan. 6 * Copyright (c) 1992-2001 by David Flanagan. 7 * All Rights Reserved. See the file COPYRIGHT for details. 8 * This is open source software. See the file LICENSE for details. 9 * There is no warranty for this software. See NO_WARRANTY for details. 10 * 11 * $Log: LayoutGP.h,v $ 12 * Revision 1.1.1.1 2001/02/10 13:46:12 motiftools 13 * Initial import of Xmt310 to CVS 14 * 15 * 16 */ 17 18 #ifndef _XmtLayoutGP_h 19 #define _XmtLayoutGP_h 20 21 #include <Xm/XmP.h> 22 #include <X11/RectObjP.h> 23 #include <Xmt/LayoutG.h> 24 #include <Xmt/LayoutP.h> 25 26 /* 27 * Define an XmtLayoutGadget class as a subclass of Object. 28 * Give it class and instance fields identical to RectObj, and 29 * also (in a separate structure) a change_font method. 30 * We'll be able to cast this to a RectObj or Widget for most uses, 31 * but XtIsRectObj will return False, so Motif won't mess with it. 32 * We'll still have to fake _XmConfigureObject() out to make it 33 * think that it is a rectobj for that one case... 34 * Or if _XmConfigureObject() is causing too many redraws, then 35 * we can write our own version that doesn't need to be faked out. 36 */ 37 38 /* 39 * The following definitions for LayoutGadget are modified from the 40 * X11R5 source code mit/lib/Xt/RectObjP.h See XCOPYRIGHT for copyright info. 41 */ 42 43 /* these fields match CorePart and can not be changed */ 44 typedef struct _XmtLayoutGadgetRectPart { 45 Position x, y; /* rectangle position */ 46 Dimension width, height; /* rectangle dimensions */ 47 Dimension border_width; /* rectangle border width */ 48 Boolean managed; /* is widget geometry managed? */ 49 Boolean sensitive; /* is widget sensitive to user events*/ 50 Boolean ancestor_sensitive; /* are all ancestors sensitive? */ 51 }XmtLayoutGadgetRectPart; 52 53 typedef struct _XmtLayoutGadgetRec { 54 ObjectPart object; 55 XmtLayoutGadgetRectPart rectangle; 56 } XmtLayoutGadgetRec; 57 58 59 /* these fields match CoreClassPart and can not be changed */ 60 typedef struct _XmtLayoutGadgetRectClassPart { 61 WidgetClass superclass; /* pointer to superclass ClassRec */ 62 String class_name; /* widget resource class name */ 63 Cardinal widget_size; /* size in bytes of widget record */ 64 XtProc class_initialize; /* class initialization proc */ 65 XtWidgetClassProc class_part_initialize; /* dynamic initialization */ 66 XtEnum class_inited; /* has class been initialized? */ 67 XtInitProc initialize; /* initialize subclass fields */ 68 XtArgsProc initialize_hook; /* notify that initialize called */ 69 XtProc rect1; /* NULL */ 70 XtPointer rect2; /* NULL */ 71 Cardinal rect3; /* NULL */ 72 XtResourceList resources; /* resources for subclass fields */ 73 Cardinal num_resources; /* number of entries in resources */ 74 XrmClass xrm_class; /* resource class quarkified */ 75 Boolean rect4; /* NULL */ 76 Boolean rect5; /* NULL */ 77 Boolean rect6; /* NULL */ 78 Boolean rect7; /* NULL */ 79 XtWidgetProc destroy; /* free data for subclass pointers */ 80 XtWidgetProc resize; /* geom manager changed widget size */ 81 XtExposeProc expose; /* rediplay rectangle */ 82 XtSetValuesFunc set_values; /* set subclass resource values */ 83 XtArgsFunc set_values_hook; /* notify that set_values called */ 84 XtAlmostProc set_values_almost; /* set values almost for geometry */ 85 XtArgsProc get_values_hook; /* notify that get_values called */ 86 XtProc rect9; /* NULL */ 87 XtVersionType version; /* version of intrinsics used */ 88 XtPointer callback_private; /* list of callback offsets */ 89 String rect10; /* NULL */ 90 XtGeometryHandler query_geometry; /* return preferred geometry */ 91 XtProc rect11; /* NULL */ 92 XtPointer extension; /* pointer to extension record */ 93 } XmtLayoutGadgetRectClassPart; 94 95 typedef struct _XmtLayoutGadgetClassPart { 96 XtWidgetProc change_font; /* method called when parent font changes */ 97 } XmtLayoutGadgetClassPart; 98 99 typedef struct _XmtLayoutGadgetClassRec { 100 XmtLayoutGadgetRectClassPart rect_class; 101 XmtLayoutGadgetClassPart layout_gadget_class; 102 } XmtLayoutGadgetClassRec; 103 104 externalref XmtLayoutGadgetClassRec xmtLayoutGadgetClassRec; 105 106 typedef struct { 107 XtPointer extension; 108 } XmtLayoutEmptyClassPart; 109 110 typedef struct _XmtLayoutBoxClassRec { 111 XmtLayoutGadgetRectClassPart rect_class; 112 XmtLayoutGadgetClassPart layout_gadget_class; 113 XmtLayoutEmptyClassPart layout_box_class; 114 } XmtLayoutBoxClassRec; 115 116 externalref XmtLayoutBoxClassRec xmtLayoutBoxClassRec; 117 118 typedef struct { 119 /* resources */ 120 unsigned char orientation; 121 Pixel background; 122 Boolean equal; 123 unsigned char space_type; 124 Dimension space; 125 Dimension space_stretch; 126 Dimension item_stretch; 127 /* private */ 128 GC gc; /* to draw our background color with */ 129 int total_stretch, total_shrink; /* sum over all kids */ 130 Dimension equal_size; /* size of elements of an "equal" box */ 131 Dimension num_items; /* # of items in the box */ 132 } XmtLayoutBoxPart; 133 134 typedef struct _XmtLayoutBoxRec { 135 ObjectPart object; 136 XmtLayoutGadgetRectPart rectangle; 137 XmtLayoutBoxPart layout_box; 138 } XmtLayoutBoxRec; 139 140 typedef struct _XmtLayoutStringClassRec { 141 XmtLayoutGadgetRectClassPart rect_class; 142 XmtLayoutGadgetClassPart layout_gadget_class; 143 XmtLayoutEmptyClassPart layout_string_class; 144 } XmtLayoutStringClassRec; 145 146 externalref XmtLayoutStringClassRec xmtLayoutStringClassRec; 147 148 typedef struct { 149 /* resources */ 150 String label; 151 XmString label_string; 152 Pixel foreground, background; 153 /* private */ 154 Dimension width, height; 155 GC gc; 156 GC background_gc; 157 } XmtLayoutStringPart; 158 159 typedef struct _XmtLayoutStringRec { 160 ObjectPart object; 161 XmtLayoutGadgetRectPart rectangle; 162 XmtLayoutStringPart layout_string; 163 } XmtLayoutStringRec; 164 165 typedef struct _XmtLayoutPixmapClassRec { 166 XmtLayoutGadgetRectClassPart rect_class; 167 XmtLayoutGadgetClassPart layout_gadget_class; 168 XmtLayoutEmptyClassPart layout_pixmap_class; 169 } XmtLayoutPixmapClassRec; 170 171 externalref XmtLayoutPixmapClassRec xmtLayoutPixmapClassRec; 172 173 typedef struct { 174 /* resources */ 175 Pixmap pixmap; 176 Pixmap bitmap; 177 Pixmap bitmask; 178 Pixel foreground, background; 179 /* private */ 180 Dimension width, height, depth; 181 GC gc; 182 } XmtLayoutPixmapPart; 183 184 typedef struct _XmtLayoutPixmapRec { 185 ObjectPart object; 186 XmtLayoutGadgetRectPart rectangle; 187 XmtLayoutPixmapPart layout_pixmap; 188 } XmtLayoutPixmapRec; 189 190 typedef struct _XmtLayoutSeparatorClassRec { 191 XmtLayoutGadgetRectClassPart rect_class; 192 XmtLayoutGadgetClassPart layout_gadget_class; 193 XmtLayoutEmptyClassPart layout_separator_class; 194 } XmtLayoutSeparatorClassRec; 195 196 externalref XmtLayoutSeparatorClassRec xmtLayoutSeparatorClassRec; 197 198 typedef struct { 199 /* resources */ 200 unsigned char orientation; 201 /* private */ 202 } XmtLayoutSeparatorPart; 203 204 typedef struct _XmtLayoutSeparatorRec { 205 ObjectPart object; 206 XmtLayoutGadgetRectPart rectangle; 207 XmtLayoutSeparatorPart layout_separator; 208 } XmtLayoutSeparatorRec; 209 210 typedef struct _XmtLayoutSpaceClassRec { 211 XmtLayoutGadgetRectClassPart rect_class; 212 XmtLayoutGadgetClassPart layout_gadget_class; 213 XmtLayoutEmptyClassPart layout_space_class; 214 } XmtLayoutSpaceClassRec; 215 216 externalref XmtLayoutSpaceClassRec xmtLayoutSpaceClassRec; 217 218 typedef struct { 219 /* resources */ 220 /* private */ 221 Boolean unused; 222 } XmtLayoutSpacePart; 223 224 typedef struct _XmtLayoutSpaceRec { 225 ObjectPart object; 226 XmtLayoutGadgetRectPart rectangle; 227 XmtLayoutSpacePart layout_space; 228 } XmtLayoutSpaceRec; 229 230 #define _XmtRedisplayGadget(w, e, r)\ 231 if (((XmtLayoutGadgetClass)XtClass(w))->rect_class.expose)\ 232 ((*((XmtLayoutGadgetClass)XtClass(w))->rect_class.expose)((Widget)w, e, r)) 233 234 #define _XmtCallChangeFontMethod(w)\ 235 if (((XmtLayoutGadgetClass)XtClass(w))->layout_gadget_class.change_font)\ 236 ((*((XmtLayoutGadgetClass)XtClass(w))->layout_gadget_class.change_font)(w)) 237 238 #endif 239