| 1 | /* |
| 2 | |
| 3 | Copyright 1987, 1998 The Open Group |
| 4 | |
| 5 | Permission to use, copy, modify, distribute, and sell this software and its |
| 6 | documentation for any purpose is hereby granted without fee, provided that |
| 7 | the above copyright notice appear in all copies and that both that |
| 8 | copyright notice and this permission notice appear in supporting |
| 9 | documentation. |
| 10 | |
| 11 | The above copyright notice and this permission notice shall be included in |
| 12 | all copies or substantial portions of the Software. |
| 13 | |
| 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 17 | OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 18 | AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 19 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 20 | |
| 21 | Except as contained in this notice, the name of The Open Group shall not be |
| 22 | used in advertising or otherwise to promote the sale, use or other dealings |
| 23 | in this Software without prior written authorization from The Open Group. |
| 24 | |
| 25 | */ |
| 26 | |
| 27 | #ifdef HAVE_CONFIG_H |
| 28 | #include <config.h> |
| 29 | #endif |
| 30 | #include <X11/IntrinsicP.h> |
| 31 | #include <X11/StringDefs.h> |
| 32 | #include <X11/Xaw/TemplateP.h> |
| 33 | |
| 34 | /* |
| 35 | * Class Methods |
| 36 | */ |
| 37 | static void TemplateInitialize(Widget, Widget, ArgList, Cardinal*); |
| 38 | |
| 39 | /* |
| 40 | * Prototypes |
| 41 | */ |
| 42 | static Bool TemplateFunction(TemplateWidget, int, int, Bool); |
| 43 | |
| 44 | /* |
| 45 | * Actions |
| 46 | */ |
| 47 | static void TemplateAction(Widget, XEvent*, String*, Cardinal*); |
| 48 | |
| 49 | /* |
| 50 | * Initialization |
| 51 | */ |
| 52 | #define offset(field) XtOffsetOf(TemplateRec, template.field) |
| 53 | static XtResource resources[] = { |
| 54 | /*{ |
| 55 | name, |
| 56 | class, |
| 57 | type, |
| 58 | size, |
| 59 | offset, |
| 60 | default_type, |
| 61 | default_addr |
| 62 | },*/ |
| 63 | { |
| 64 | XtNtemplateResource, |
| 65 | XtCTemplateResource, |
| 66 | XtRTemplateResource, |
| 67 | sizeof(char*), |
| 68 | offset(resource), |
| 69 | XtRString, |
| 70 | (XtPointer)"default" |
| 71 | }, |
| 72 | }; |
| 73 | #undef offset |
| 74 | |
| 75 | static XtActionsRec actions[] = |
| 76 | { |
| 77 | /*{name, procedure},*/ |
| 78 | {"template", TemplateAction}, |
| 79 | }; |
| 80 | |
| 81 | static char translations[] = |
| 82 | "<Key>:" "template()\n" |
| 83 | ; |
| 84 | |
| 85 | #define Superclass (&widgetClassRec) |
| 86 | TemplateClassRec templateClassRec = { |
| 87 | /* core */ |
| 88 | { |
| 89 | (WidgetClass)Superclass, /* superclass */ |
| 90 | "Template", /* class_name */ |
| 91 | sizeof(TemplateRec), /* widget_size */ |
| 92 | NULL, /* class_initialize */ |
| 93 | NULL, /* class_part_initialize */ |
| 94 | False, /* class_inited */ |
| 95 | TemplateInitialize, /* initialize */ |
| 96 | NULL, /* initialize_hook */ |
| 97 | XtInheritRealize, /* realize */ |
| 98 | actions, /* actions */ |
| 99 | XtNumber(actions), /* num_actions */ |
| 100 | resources, /* resources */ |
| 101 | XtNumber(resources), /* num_resources */ |
| 102 | NULLQUARK, /* xrm_class */ |
| 103 | True, /* compress_motion */ |
| 104 | True, /* compress_exposure */ |
| 105 | True, /* compress_enterleave */ |
| 106 | False, /* visible_interest */ |
| 107 | NULL, /* destroy */ |
| 108 | NULL, /* resize */ |
| 109 | NULL, /* expose */ |
| 110 | NULL, /* set_values */ |
| 111 | NULL, /* set_values_hook */ |
| 112 | XtInheritSetValuesAlmost, /* set_values_almost */ |
| 113 | NULL, /* get_values_hook */ |
| 114 | NULL, /* accept_focus */ |
| 115 | XtVersion, /* version */ |
| 116 | NULL, /* callback_private */ |
| 117 | translations, /* tm_table */ |
| 118 | XtInheritQueryGeometry, /* query_geometry */ |
| 119 | XtInheritDisplayAccelerator, /* display_accelerator */ |
| 120 | NULL, /* extension */ |
| 121 | }, |
| 122 | /* template */ |
| 123 | { |
| 124 | NULL, /* extension */ |
| 125 | } |
| 126 | }; |
| 127 | |
| 128 | WidgetClass templateWidgetClass = (WidgetClass)&templateClassRec; |
| 129 | |
| 130 | /* |
| 131 | * Implementation |
| 132 | */ |
| 133 | /* |
| 134 | * Function: |
| 135 | * TemplateInitialize |
| 136 | * |
| 137 | * Parameters: |
| 138 | * request - requested widget |
| 139 | * w - the widget |
| 140 | * args - arguments |
| 141 | * num_args - number of arguments |
| 142 | * |
| 143 | * Description: |
| 144 | * Initializes widget instance. |
| 145 | */ |
| 146 | /*ARGSUSED*/ |
| 147 | static void |
| 148 | TemplateInitialize(Widget request, Widget w, ArgList args, Cardinal *num_args) |
| 149 | { |
| 150 | TemplateWidget tw = (TemplateWidget)w; |
| 151 | |
| 152 | tw->template.private = NULL; |
| 153 | } |
| 154 | |
| 155 | /* |
| 156 | * Function: |
| 157 | * TemplateFunction |
| 158 | * |
| 159 | * Parameters: |
| 160 | * tw - template widget |
| 161 | * x - x coordinate |
| 162 | * y - y coordinate |
| 163 | * force - force action |
| 164 | * |
| 165 | * Description: |
| 166 | * This function does nothing. |
| 167 | * |
| 168 | * Return: |
| 169 | * Parameter force |
| 170 | */ |
| 171 | /*ARGSUSED*/ |
| 172 | static Bool |
| 173 | TemplateFunction(TemplateWidget tw, int x, int y, Bool force) |
| 174 | { |
| 175 | return (force); |
| 176 | } |
| 177 | |
| 178 | /* |
| 179 | * Function: |
| 180 | * TemplateAction |
| 181 | * |
| 182 | * Parameters: |
| 183 | * w - template widget |
| 184 | * event - event that caused this action |
| 185 | * params - parameters |
| 186 | * num_params - number of parameters |
| 187 | * |
| 188 | * Description: |
| 189 | * This function does nothing. |
| 190 | */ |
| 191 | /*ARGSUSED*/ |
| 192 | static void |
| 193 | TemplateAction(Widget w, XEvent *event, String *params, Cardinal *num_params) |
| 194 | { |
| 195 | } |