Mercurial > hg > xemacs-beta
comparison lwlib/lwlib-Xaw.c @ 80:1ce6082ce73f r20-0b90
Import from CVS: tag r20-0b90
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:06:37 +0200 |
parents | c7528f8e288d |
children | 6a378aca36af |
comparison
equal
deleted
inserted
replaced
79:5b0a5bbffab6 | 80:1ce6082ce73f |
---|---|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 GNU General Public License for more details. | 14 GNU General Public License for more details. |
15 | 15 |
16 You should have received a copy of the GNU General Public License | 16 You should have received a copy of the GNU General Public License |
17 along with GNU Emacs; see the file COPYING. If not, write to | 17 along with XEmacs; see the file COPYING. If not, write to |
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 <stdio.h> | 21 #include <stdio.h> |
22 #include <stdlib.h> | |
23 | 22 |
24 #include "lwlib-Xaw.h" | 23 #include "lwlib-Xaw.h" |
25 | 24 |
26 #include <X11/StringDefs.h> | 25 #include <X11/StringDefs.h> |
27 #include <X11/IntrinsicP.h> | 26 #include <X11/IntrinsicP.h> |
283 } | 282 } |
284 | 283 |
285 override = XtParseTranslationTable (overrideTrans); | 284 override = XtParseTranslationTable (overrideTrans); |
286 | 285 |
287 ac = 0; | 286 ac = 0; |
288 XtSetArg (av[ac], XtNtitle, shell_title); ac++; | 287 XtSetArg (av[ac], XtNtitle, shell_title); ac++; |
289 XtSetArg (av[ac], XtNallowShellResize, True); ac++; | 288 XtSetArg (av[ac], XtNallowShellResize, True); ac++; |
290 XtSetArg (av[ac], XtNtransientFor, parent); ac++; | 289 XtSetArg (av[ac], XtNtransientFor, parent); ac++; |
291 shell = XtCreatePopupShell ("dialog", transientShellWidgetClass, | 290 shell = XtCreatePopupShell ("dialog", transientShellWidgetClass, |
292 parent, av, ac); | 291 parent, av, ac); |
293 XtOverrideTranslations (shell, override); | 292 XtOverrideTranslations (shell, override); |
294 | 293 |
295 ac = 0; | 294 ac = 0; |
298 bc = 0; | 297 bc = 0; |
299 button = 0; | 298 button = 0; |
300 for (i = 0; i < left_buttons; i++) | 299 for (i = 0; i < left_buttons; i++) |
301 { | 300 { |
302 ac = 0; | 301 ac = 0; |
303 XtSetArg (av [ac], XtNfromHoriz, button); ac++; | 302 XtSetArg (av [ac], XtNfromHoriz, button); ac++; |
304 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; | 303 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; |
305 XtSetArg (av [ac], XtNright, XtChainLeft); ac++; | 304 XtSetArg (av [ac], XtNright, XtChainLeft); ac++; |
306 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; | 305 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; |
307 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; | 306 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; |
308 XtSetArg (av [ac], XtNresizable, True); ac++; | 307 XtSetArg (av [ac], XtNresizable, True); ac++; |
309 sprintf (button_name, "button%d", ++bc); | 308 sprintf (button_name, "button%d", ++bc); |
310 button = XtCreateManagedWidget (button_name, commandWidgetClass, | 309 button = XtCreateManagedWidget (button_name, commandWidgetClass, |
311 dialog, av, ac); | 310 dialog, av, ac); |
312 } | 311 } |
313 if (right_buttons) | 312 if (right_buttons) |
318 the right and the buttons on the left (that is I want the buttons | 317 the right and the buttons on the left (that is I want the buttons |
319 after the separator to be packed against the right edge of the | 318 after the separator to be packed against the right edge of the |
320 window) but I can't seem to make it do it. | 319 window) but I can't seem to make it do it. |
321 */ | 320 */ |
322 ac = 0; | 321 ac = 0; |
323 XtSetArg (av [ac], XtNfromHoriz, button); ac++; | 322 XtSetArg (av [ac], XtNfromHoriz, button); ac++; |
324 /* XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */ | 323 /* XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */ |
325 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; | 324 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; |
326 XtSetArg (av [ac], XtNright, XtChainRight); ac++; | 325 XtSetArg (av [ac], XtNright, XtChainRight); ac++; |
327 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; | 326 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; |
328 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; | 327 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; |
329 XtSetArg (av [ac], XtNlabel, ""); ac++; | 328 XtSetArg (av [ac], XtNlabel, ""); ac++; |
330 XtSetArg (av [ac], XtNwidth, 30); ac++; /* #### aaack!! */ | 329 XtSetArg (av [ac], XtNwidth, 30); ac++; /* #### aaack!! */ |
331 XtSetArg (av [ac], XtNborderWidth, 0); ac++; | 330 XtSetArg (av [ac], XtNborderWidth, 0); ac++; |
332 XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++; | 331 XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++; |
340 dialog, av, ac); | 339 dialog, av, ac); |
341 } | 340 } |
342 for (i = 0; i < right_buttons; i++) | 341 for (i = 0; i < right_buttons; i++) |
343 { | 342 { |
344 ac = 0; | 343 ac = 0; |
345 XtSetArg (av [ac], XtNfromHoriz, button); ac++; | 344 XtSetArg (av [ac], XtNfromHoriz, button); ac++; |
346 XtSetArg (av [ac], XtNleft, XtChainRight); ac++; | 345 XtSetArg (av [ac], XtNleft, XtChainRight); ac++; |
347 XtSetArg (av [ac], XtNright, XtChainRight); ac++; | 346 XtSetArg (av [ac], XtNright, XtChainRight); ac++; |
348 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; | 347 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; |
349 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; | 348 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; |
350 XtSetArg (av [ac], XtNresizable, True); ac++; | 349 XtSetArg (av [ac], XtNresizable, True); ac++; |
351 sprintf (button_name, "button%d", ++bc); | 350 sprintf (button_name, "button%d", ++bc); |
352 button = XtCreateManagedWidget (button_name, commandWidgetClass, | 351 button = XtCreateManagedWidget (button_name, commandWidgetClass, |
353 dialog, av, ac); | 352 dialog, av, ac); |
354 } | 353 } |
355 | 354 |
556 static Widget | 555 static Widget |
557 xaw_create_scrollbar (widget_instance *instance, int vertical) | 556 xaw_create_scrollbar (widget_instance *instance, int vertical) |
558 { | 557 { |
559 Arg av[10]; | 558 Arg av[10]; |
560 int ac = 0; | 559 int ac = 0; |
561 | 560 |
562 static XtCallbackRec jumpCallbacks[2] = | 561 static XtCallbackRec jumpCallbacks[2] = |
563 { {xaw_scrollbar_jump, NULL}, {NULL, NULL} }; | 562 { {xaw_scrollbar_jump, NULL}, {NULL, NULL} }; |
564 | 563 |
565 static XtCallbackRec scrollCallbacks[2] = | 564 static XtCallbackRec scrollCallbacks[2] = |
566 { {xaw_scrollbar_scroll, NULL}, {NULL, NULL} }; | 565 { {xaw_scrollbar_scroll, NULL}, {NULL, NULL} }; |
571 screws our geometry management. We should probably make the | 570 screws our geometry management. We should probably make the |
572 top-level aware of this so that people could have a border but so | 571 top-level aware of this so that people could have a border but so |
573 few people use the Athena scrollbar now that it really isn't | 572 few people use the Athena scrollbar now that it really isn't |
574 worth the effort, at least not at the moment. */ | 573 worth the effort, at least not at the moment. */ |
575 XtSetArg (av [ac], XtNborderWidth, 0); ac++; | 574 XtSetArg (av [ac], XtNborderWidth, 0); ac++; |
576 if (vertical) | 575 XtSetArg (av [ac], XtNorientation, |
577 { | 576 vertical ? XtorientVertical : XtorientHorizontal); ac++; |
578 XtSetArg (av [ac], XtNorientation, XtorientVertical); ac++; | 577 XtSetArg (av [ac], "jumpProc", jumpCallbacks); ac++; |
579 } | 578 XtSetArg (av [ac], "scrollProc", scrollCallbacks); ac++; |
580 else | 579 |
581 { | 580 return XtCreateWidget (instance->info->name, scrollbarWidgetClass, |
582 XtSetArg (av [ac], XtNorientation, XtorientHorizontal); ac++; | 581 instance->parent, av, ac); |
583 } | |
584 | |
585 scrollbar = | |
586 XtCreateWidget (instance->info->name, scrollbarWidgetClass, | |
587 instance->parent, av, ac); | |
588 | |
589 XtRemoveAllCallbacks (scrollbar, "jumpProc"); | |
590 XtRemoveAllCallbacks (scrollbar, "scrollProc"); | |
591 | |
592 XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump, | |
593 (XtPointer) instance); | |
594 XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll, | |
595 (XtPointer) instance); | |
596 | |
597 return scrollbar; | |
598 } | 582 } |
599 | 583 |
600 static Widget | 584 static Widget |
601 xaw_create_vertical_scrollbar (widget_instance *instance) | 585 xaw_create_vertical_scrollbar (widget_instance *instance) |
602 { | 586 { |