Mercurial > hg > xemacs-beta
comparison lwlib/lwlib-Xaw.c @ 165:5a88923fcbfe r20-3b9
Import from CVS: tag r20-3b9
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:44:42 +0200 |
parents | 0132846995bd |
children | 41ff10fd062f |
comparison
equal
deleted
inserted
replaced
164:4e0740e5aab2 | 165:5a88923fcbfe |
---|---|
68 if (val->scrollbar_data) | 68 if (val->scrollbar_data) |
69 { | 69 { |
70 scrollbar_values *data = val->scrollbar_data; | 70 scrollbar_values *data = val->scrollbar_data; |
71 float widget_shown, widget_topOfThumb; | 71 float widget_shown, widget_topOfThumb; |
72 float new_shown, new_topOfThumb; | 72 float new_shown, new_topOfThumb; |
73 | 73 Arg al [10]; |
74 /* | 74 |
75 * First size and position the scrollbar widget. | 75 /* First size and position the scrollbar widget. */ |
76 */ | 76 XtSetArg (al [0], XtNx, data->scrollbar_x); |
77 XtVaSetValues (widget, | 77 XtSetArg (al [1], XtNy, data->scrollbar_y); |
78 XtNx, data->scrollbar_x, | 78 XtSetArg (al [2], XtNwidth, data->scrollbar_width); |
79 XtNy, data->scrollbar_y, | 79 XtSetArg (al [3], XtNheight, data->scrollbar_height); |
80 XtNwidth, data->scrollbar_width, | 80 XtSetValues (widget, al, 4); |
81 XtNheight, data->scrollbar_height, | 81 |
82 NULL); | 82 /* Now size the scrollbar's slider. */ |
83 | 83 XtSetArg (al [0], XtNtopOfThumb, &widget_topOfThumb); |
84 /* | 84 XtSetArg (al [1], XtNshown, &widget_shown); |
85 * Now the size the scrollbar's slider. | 85 XtGetValues (widget, al, 2); |
86 */ | |
87 | |
88 XtVaGetValues (widget, | |
89 XtNtopOfThumb, &widget_topOfThumb, | |
90 XtNshown, &widget_shown, | |
91 NULL); | |
92 | 86 |
93 new_shown = (double) data->slider_size / | 87 new_shown = (double) data->slider_size / |
94 (double) (data->maximum - data->minimum); | 88 (double) (data->maximum - data->minimum); |
95 | 89 |
96 new_topOfThumb = (double) (data->slider_position - data->minimum) / | 90 new_topOfThumb = (double) (data->slider_position - data->minimum) / |
97 (double) (data->maximum - data->minimum); | 91 (double) (data->maximum - data->minimum); |
98 | 92 |
99 if (new_shown > 1.0) | 93 if (new_shown > 1.0) |
100 new_shown = 1.0; | 94 new_shown = 1.0; |
101 if (new_shown < 0) | 95 else if (new_shown < 0) |
102 new_shown = 0; | 96 new_shown = 0; |
103 | 97 |
104 if (new_topOfThumb > 1.0) | 98 if (new_topOfThumb > 1.0) |
105 new_topOfThumb = 1.0; | 99 new_topOfThumb = 1.0; |
106 if (new_topOfThumb < 0) | 100 else if (new_topOfThumb < 0) |
107 new_topOfThumb = 0; | 101 new_topOfThumb = 0; |
108 | 102 |
109 if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb) | 103 if (new_shown != widget_shown || new_topOfThumb != widget_topOfThumb) |
110 XawScrollbarSetThumb (widget, new_topOfThumb, new_shown); | 104 XawScrollbarSetThumb (widget, new_topOfThumb, new_shown); |
111 } | 105 } |
125 } | 119 } |
126 #endif | 120 #endif |
127 #ifdef DIALOGS_ATHENA | 121 #ifdef DIALOGS_ATHENA |
128 else if (XtIsSubclass (widget, dialogWidgetClass)) | 122 else if (XtIsSubclass (widget, dialogWidgetClass)) |
129 { | 123 { |
130 XtVaSetValues (widget, XtNlabel, val->contents->value, NULL); | 124 Arg al [1]; |
125 XtSetArg (al [0], XtNlabel, val->contents->value); | |
126 XtSetValues (widget, al, 1); | |
131 } | 127 } |
132 else if (XtIsSubclass (widget, commandWidgetClass)) | 128 else if (XtIsSubclass (widget, commandWidgetClass)) |
133 { | 129 { |
134 Dimension bw = 0; | 130 Dimension bw = 0; |
135 XtVaGetValues (widget, XtNborderWidth, &bw, NULL); | 131 Arg al [3]; |
132 XtSetArg (al [0], XtNborderWidth, &bw); | |
133 XtGetValues (widget, al, 1); | |
136 | 134 |
137 #ifndef LWLIB_DIALOGS_ATHENA3D | 135 #ifndef LWLIB_DIALOGS_ATHENA3D |
138 if (bw == 0) | 136 if (bw == 0) |
139 /* Don't let buttons end up with 0 borderwidth, that's ugly... | 137 /* Don't let buttons end up with 0 borderwidth, that's ugly... |
140 Yeah, all this should really be done through app-defaults files | 138 Yeah, all this should really be done through app-defaults files |
141 or fallback resources, but that's a whole different can of worms | 139 or fallback resources, but that's a whole different can of worms |
142 that I don't feel like opening right now. Making Athena widgets | 140 that I don't feel like opening right now. Making Athena widgets |
143 not look like shit is just entirely too much work. | 141 not look like shit is just entirely too much work. |
144 */ | 142 */ |
145 XtVaSetValues (widget, XtNborderWidth, 1, NULL); | 143 { |
146 #endif | 144 XtSetArg (al [0], XtNborderWidth, 1); |
147 | 145 XtSetValues (widget, al, 1); |
148 XtVaSetValues (widget, | 146 } |
149 XtNlabel, val->value, | 147 #endif |
150 XtNsensitive, val->enabled, | 148 |
151 /* Force centered button text. Se above. */ | 149 XtSetArg (al [0], XtNlabel, val->value); |
152 XtNjustify, XtJustifyCenter, | 150 XtSetArg (al [1], XtNsensitive, val->enabled); |
153 NULL); | 151 /* Force centered button text. See above. */ |
152 XtSetArg (al [2], XtNjustify, XtJustifyCenter); | |
153 XtSetValues (widget, al, 3); | |
154 | 154 |
155 XtRemoveAllCallbacks (widget, XtNcallback); | 155 XtRemoveAllCallbacks (widget, XtNcallback); |
156 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance); | 156 XtAddCallback (widget, XtNcallback, xaw_generic_callback, instance); |
157 } | 157 } |
158 #endif | 158 #endif |
450 | 450 |
451 id = instance->info->id; | 451 id = instance->info->id; |
452 | 452 |
453 #if 0 | 453 #if 0 |
454 user_data = NULL; | 454 user_data = NULL; |
455 XtVaGetValues (widget, XtNuserData, &user_data, NULL); | 455 { |
456 Arg al [1]; | |
457 XtSetArg (al [0], XtNuserData, &user_data); | |
458 XtGetValues (widget, al, 1); | |
459 } | |
456 #else | 460 #else |
457 /* Damn! Athena doesn't give us a way to hang our own data on the | 461 /* Damn! Athena doesn't give us a way to hang our own data on the |
458 buttons, so we have to go find it... I guess this assumes that | 462 buttons, so we have to go find it... I guess this assumes that |
459 all instances of a button have the same call data. */ | 463 all instances of a button have the same call data. */ |
460 { | 464 { |
481 wm_delete_window (Widget shell, XtPointer closure, XtPointer call_data) | 485 wm_delete_window (Widget shell, XtPointer closure, XtPointer call_data) |
482 { | 486 { |
483 LWLIB_ID id; | 487 LWLIB_ID id; |
484 Widget *kids = 0; | 488 Widget *kids = 0; |
485 Widget widget; | 489 Widget widget; |
490 Arg al [1]; | |
486 if (! XtIsSubclass (shell, shellWidgetClass)) | 491 if (! XtIsSubclass (shell, shellWidgetClass)) |
487 abort (); | 492 abort (); |
488 XtVaGetValues (shell, XtNchildren, &kids, NULL); | 493 XtSetArg (al [0], XtNchildren, &kids); |
494 XtGetValues (shell, al, 1); | |
489 if (!kids || !*kids) | 495 if (!kids || !*kids) |
490 abort (); | 496 abort (); |
491 widget = kids [0]; | 497 widget = kids [0]; |
492 if (! XtIsSubclass (widget, dialogWidgetClass)) | 498 if (! XtIsSubclass (widget, dialogWidgetClass)) |
493 abort (); | 499 abort (); |