comparison lwlib/lwlib-Xaw.c @ 163:0132846995bd r20-3b8

Import from CVS: tag r20-3b8
author cvs
date Mon, 13 Aug 2007 09:43:35 +0200
parents 6b37e6ddd302
children 5a88923fcbfe
comparison
equal deleted inserted replaced
162:4de2936b4e77 163:0132846995bd
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */ 19 Boston, MA 02111-1307, USA. */
20 20
21 #include <config.h> 21 #include <config.h>
22 #include <stdio.h> 22 #include <stdio.h>
23
24 #ifdef STDC_HEADERS
25 #include <stdlib.h>
26 #endif
23 27
24 #include "lwlib-Xaw.h" 28 #include "lwlib-Xaw.h"
25 29
26 #include <X11/StringDefs.h> 30 #include <X11/StringDefs.h>
27 #include <X11/IntrinsicP.h> 31 #include <X11/IntrinsicP.h>
73 XtVaSetValues (widget, 77 XtVaSetValues (widget,
74 XtNx, data->scrollbar_x, 78 XtNx, data->scrollbar_x,
75 XtNy, data->scrollbar_y, 79 XtNy, data->scrollbar_y,
76 XtNwidth, data->scrollbar_width, 80 XtNwidth, data->scrollbar_width,
77 XtNheight, data->scrollbar_height, 81 XtNheight, data->scrollbar_height,
78 0); 82 NULL);
79 83
80 /* 84 /*
81 * Now the size the scrollbar's slider. 85 * Now the size the scrollbar's slider.
82 */ 86 */
83 87
84 XtVaGetValues (widget, 88 XtVaGetValues (widget,
85 XtNtopOfThumb, &widget_topOfThumb, 89 XtNtopOfThumb, &widget_topOfThumb,
86 XtNshown, &widget_shown, 90 XtNshown, &widget_shown,
87 0); 91 NULL);
88 92
89 new_shown = (double) data->slider_size / 93 new_shown = (double) data->slider_size /
90 (double) (data->maximum - data->minimum); 94 (double) (data->maximum - data->minimum);
91 95
92 new_topOfThumb = (double) (data->slider_position - data->minimum) / 96 new_topOfThumb = (double) (data->slider_position - data->minimum) /
121 } 125 }
122 #endif 126 #endif
123 #ifdef DIALOGS_ATHENA 127 #ifdef DIALOGS_ATHENA
124 else if (XtIsSubclass (widget, dialogWidgetClass)) 128 else if (XtIsSubclass (widget, dialogWidgetClass))
125 { 129 {
126 XtVaSetValues (widget, XtNlabel, val->contents->value, 0); 130 XtVaSetValues (widget, XtNlabel, val->contents->value, NULL);
127 } 131 }
128 else if (XtIsSubclass (widget, commandWidgetClass)) 132 else if (XtIsSubclass (widget, commandWidgetClass))
129 { 133 {
130 Dimension bw = 0; 134 Dimension bw = 0;
131 XtVaGetValues (widget, XtNborderWidth, &bw, 0); 135 XtVaGetValues (widget, XtNborderWidth, &bw, NULL);
132 136
133 #ifndef LWLIB_DIALOGS_ATHENA3D 137 #ifndef LWLIB_DIALOGS_ATHENA3D
134 if (bw == 0) 138 if (bw == 0)
135 /* Don't let buttons end up with 0 borderwidth, that's ugly... 139 /* Don't let buttons end up with 0 borderwidth, that's ugly...
136 Yeah, all this should really be done through app-defaults files 140 Yeah, all this should really be done through app-defaults files
137 or fallback resources, but that's a whole different can of worms 141 or fallback resources, but that's a whole different can of worms
138 that I don't feel like opening right now. Making Athena widgets 142 that I don't feel like opening right now. Making Athena widgets
139 not look like shit is just entirely too much work. 143 not look like shit is just entirely too much work.
140 */ 144 */
141 XtVaSetValues (widget, XtNborderWidth, 1, 0); 145 XtVaSetValues (widget, XtNborderWidth, 1, NULL);
142 #endif 146 #endif
143 147
144 XtVaSetValues (widget, 148 XtVaSetValues (widget,
145 XtNlabel, val->value, 149 XtNlabel, val->value,
146 XtNsensitive, val->enabled, 150 XtNsensitive, val->enabled,
147 /* Force centered button text. Se above. */ 151 /* Force centered button text. Se above. */
148 XtNjustify, XtJustifyCenter, 152 XtNjustify, XtJustifyCenter,
149 0); 153 NULL);
150 154
151 XtRemoveAllCallbacks (widget, XtNcallback); 155 XtRemoveAllCallbacks (widget, XtNcallback);
152 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance); 156 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance);
153 } 157 }
154 #endif 158 #endif
446 450
447 id = instance->info->id; 451 id = instance->info->id;
448 452
449 #if 0 453 #if 0
450 user_data = NULL; 454 user_data = NULL;
451 XtVaGetValues (widget, XtNuserData, &user_data, 0); 455 XtVaGetValues (widget, XtNuserData, &user_data, NULL);
452 #else 456 #else
453 /* Damn! Athena doesn't give us a way to hang our own data on the 457 /* Damn! Athena doesn't give us a way to hang our own data on the
454 buttons, so we have to go find it... I guess this assumes that 458 buttons, so we have to go find it... I guess this assumes that
455 all instances of a button have the same call data. */ 459 all instances of a button have the same call data. */
456 { 460 {
479 LWLIB_ID id; 483 LWLIB_ID id;
480 Widget *kids = 0; 484 Widget *kids = 0;
481 Widget widget; 485 Widget widget;
482 if (! XtIsSubclass (shell, shellWidgetClass)) 486 if (! XtIsSubclass (shell, shellWidgetClass))
483 abort (); 487 abort ();
484 XtVaGetValues (shell, XtNchildren, &kids, 0); 488 XtVaGetValues (shell, XtNchildren, &kids, NULL);
485 if (!kids || !*kids) 489 if (!kids || !*kids)
486 abort (); 490 abort ();
487 widget = kids [0]; 491 widget = kids [0];
488 if (! XtIsSubclass (widget, dialogWidgetClass)) 492 if (! XtIsSubclass (widget, dialogWidgetClass))
489 abort (); 493 abort ();