J. Duke | 319a3b9 | 2007-12-01 00:00:00 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2002 Sun Microsystems, Inc. All Rights Reserved. |
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
| 4 | * |
| 5 | * This code is free software; you can redistribute it and/or modify it |
| 6 | * under the terms of the GNU General Public License version 2 only, as |
| 7 | * published by the Free Software Foundation. Sun designates this |
| 8 | * particular file as subject to the "Classpath" exception as provided |
| 9 | * by Sun in the LICENSE file that accompanied this code. |
| 10 | * |
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 14 | * version 2 for more details (a copy is included in the LICENSE file that |
| 15 | * accompanied this code). |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License version |
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 | * |
| 21 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
| 22 | * CA 95054 USA or visit www.sun.com if you need additional information or |
| 23 | * have any questions. |
| 24 | */ |
| 25 | |
| 26 | /* |
| 27 | */ |
| 28 | |
| 29 | #include <X11/IntrinsicP.h> |
| 30 | #include "XDrawingAreaP.h" |
| 31 | #include <Xm/XmP.h> |
| 32 | |
| 33 | #include <stdio.h> |
| 34 | #include <malloc.h> |
| 35 | |
| 36 | #ifdef DEBUG |
| 37 | #include <jvm.h> /* To get jio_fprintf() */ |
| 38 | #endif |
| 39 | |
| 40 | /****************************************************************** |
| 41 | * |
| 42 | * Provides Canvas widget which allows the X11 visual to be |
| 43 | * changed (the Motif DrawingArea restricts the visual to that |
| 44 | * of the parent widget). |
| 45 | * |
| 46 | ******************************************************************/ |
| 47 | |
| 48 | |
| 49 | static XmNavigability WidgetNavigable(); |
| 50 | static void ClassInitialize(); |
| 51 | |
| 52 | static XmBaseClassExtRec baseClassExtRec = { |
| 53 | NULL, |
| 54 | NULLQUARK, |
| 55 | XmBaseClassExtVersion, |
| 56 | sizeof(XmBaseClassExtRec), |
| 57 | NULL, /* InitializePrehook */ |
| 58 | NULL, /* SetValuesPrehook */ |
| 59 | NULL, /* InitializePosthook */ |
| 60 | NULL, /* SetValuesPosthook */ |
| 61 | NULL, /* secondaryObjectClass */ |
| 62 | NULL, /* secondaryCreate */ |
| 63 | NULL, /* getSecRes data */ |
| 64 | { 0 }, /* fastSubclass flags */ |
| 65 | NULL, /* getValuesPrehook */ |
| 66 | NULL, /* getValuesPosthook */ |
| 67 | NULL, /* classPartInitPrehook */ |
| 68 | NULL, /* classPartInitPosthook*/ |
| 69 | NULL, /* ext_resources */ |
| 70 | NULL, /* compiled_ext_resources*/ |
| 71 | 0, /* num_ext_resources */ |
| 72 | FALSE, /* use_sub_resources */ |
| 73 | WidgetNavigable, /* widgetNavigable */ |
| 74 | NULL /* focusChange */ |
| 75 | }; |
| 76 | |
| 77 | XDrawingAreaClassRec xDrawingAreaClassRec = { |
| 78 | { |
| 79 | /* Core class part */ |
| 80 | |
| 81 | /* superclass */ (WidgetClass)&xmDrawingAreaClassRec, |
| 82 | /* class_name */ "XDrawingArea", |
| 83 | /* widget_size */ sizeof(XDrawingAreaRec), |
| 84 | /* class_initialize */ ClassInitialize, |
| 85 | /* class_part_initialize*/ NULL, |
| 86 | /* class_inited */ FALSE, |
| 87 | /* initialize */ NULL, |
| 88 | /* initialize_hook */ NULL, |
| 89 | /* realize */ XtInheritRealize, |
| 90 | /* actions */ NULL, |
| 91 | /* num_actions */ 0, |
| 92 | /* resources */ NULL, |
| 93 | /* num_resources */ 0, |
| 94 | /* xrm_class */ NULLQUARK, |
| 95 | /* compress_motion */ FALSE, |
| 96 | /* compress_exposure */ FALSE, |
| 97 | /* compress_enterleave*/ FALSE, |
| 98 | /* visible_interest */ FALSE, |
| 99 | /* destroy */ NULL, |
| 100 | /* resize */ XtInheritResize, |
| 101 | /* expose */ XtInheritExpose, |
| 102 | /* set_values */ NULL, |
| 103 | /* set_values_hook */ NULL, |
| 104 | /* set_values_almost */ XtInheritSetValuesAlmost, |
| 105 | /* get_values_hook */ NULL, |
| 106 | /* accept_focus */ NULL, |
| 107 | /* version */ XtVersion, |
| 108 | /* callback_offsets */ NULL, |
| 109 | /* tm_table */ NULL, |
| 110 | /* query_geometry */ NULL, |
| 111 | /* display_accelerator */ NULL, |
| 112 | /* extension */ (XtPointer)&baseClassExtRec |
| 113 | }, |
| 114 | |
| 115 | { /* composite_class fields */ |
| 116 | XtInheritGeometryManager, /* geometry_manager */ |
| 117 | XtInheritChangeManaged, /* change_managed */ |
| 118 | XtInheritInsertChild, /* insert_child */ |
| 119 | XtInheritDeleteChild, /* delete_child */ |
| 120 | NULL, /* extension */ |
| 121 | }, |
| 122 | |
| 123 | { /* constraint_class fields */ |
| 124 | NULL, /* resource list */ |
| 125 | 0, /* num resources */ |
| 126 | 0, /* constraint size */ |
| 127 | NULL, /* init proc */ |
| 128 | NULL, /* destroy proc */ |
| 129 | NULL, /* set values proc */ |
| 130 | NULL, /* extension */ |
| 131 | }, |
| 132 | |
| 133 | { /* manager_class fields */ |
| 134 | XtInheritTranslations, /* translations */ |
| 135 | NULL, /* syn_resources */ |
| 136 | 0, /* num_get_resources */ |
| 137 | NULL, /* syn_cont_resources */ |
| 138 | 0, /* num_get_cont_resources */ |
| 139 | XmInheritParentProcess, /* parent_process */ |
| 140 | NULL, /* extension */ |
| 141 | }, |
| 142 | |
| 143 | { /* drawingArea class */ |
| 144 | /* extension */ NULL |
| 145 | }, |
| 146 | |
| 147 | /* XDrawingArea class part */ |
| 148 | { |
| 149 | /* extension */ NULL |
| 150 | } |
| 151 | }; |
| 152 | |
| 153 | WidgetClass xDrawingAreaClass = (WidgetClass)&xDrawingAreaClassRec; |
| 154 | |
| 155 | static void ClassInitialize( void ) |
| 156 | { |
| 157 | baseClassExtRec.record_type = XmQmotif ; |
| 158 | } |
| 159 | |
| 160 | static XmNavigability WidgetNavigable(Widget wid) |
| 161 | { |
| 162 | return XmCONTROL_NAVIGABLE; |
| 163 | } |