comparison lwlib/lwlib-Xaw.c @ 12:bcdc7deadc19 r19-15b7

Import from CVS: tag r19-15b7
author cvs
date Mon, 13 Aug 2007 08:48:16 +0200
parents 376386a54a3c
children 9ee227acff29
comparison
equal deleted inserted replaced
11:91ffe8bd52e4 12:bcdc7deadc19
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 GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
19 20
20 #include <stdio.h> 21 #include <stdio.h>
21 22
22 #include "lwlib-Xaw.h" 23 #include "lwlib-Xaw.h"
23 24
552 } 553 }
553 554
554 static Widget 555 static Widget
555 xaw_create_scrollbar (widget_instance *instance, int vertical) 556 xaw_create_scrollbar (widget_instance *instance, int vertical)
556 { 557 {
557 Arg av[20]; 558 Arg av[10];
558 int ac = 0; 559 int ac = 0;
559 Widget scrollbar; 560
561 static XtCallbackRec jumpCallbacks[2] =
562 { {xaw_scrollbar_jump, NULL}, {NULL, NULL} };
563
564 static XtCallbackRec scrollCallbacks[2] =
565 { {xaw_scrollbar_scroll, NULL}, {NULL, NULL} };
566
567 jumpCallbacks[0].closure = scrollCallbacks[0].closure = (XtPointer) instance;
560 568
561 /* #### This is tacked onto the with and height and completely 569 /* #### This is tacked onto the with and height and completely
562 screws our geometry management. We should probably make the 570 screws our geometry management. We should probably make the
563 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
564 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
565 worth the effort, at least not at the moment. */ 573 worth the effort, at least not at the moment. */
566 XtSetArg (av [ac], XtNborderWidth, 0); ac++; 574 XtSetArg (av [ac], XtNborderWidth, 0); ac++;
567 if (vertical) 575 XtSetArg (av [ac], XtNorientation,
568 { 576 vertical ? XtorientVertical : XtorientHorizontal); ac++;
569 XtSetArg (av [ac], XtNorientation, XtorientVertical); ac++; 577 XtSetArg (av [ac], "jumpProc", jumpCallbacks); ac++;
570 } 578 XtSetArg (av [ac], "scrollProc", scrollCallbacks); ac++;
571 else 579
572 { 580 return XtCreateWidget (instance->info->name, scrollbarWidgetClass,
573 XtSetArg (av [ac], XtNorientation, XtorientHorizontal); ac++; 581 instance->parent, av, ac);
574 }
575
576 scrollbar =
577 XtCreateWidget (instance->info->name, scrollbarWidgetClass,
578 instance->parent, av, ac);
579
580 XtRemoveAllCallbacks (scrollbar, "jumpProc");
581 XtRemoveAllCallbacks (scrollbar, "scrollProc");
582
583 XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump,
584 (XtPointer) instance);
585 XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll,
586 (XtPointer) instance);
587
588 return scrollbar;
589 } 582 }
590 583
591 static Widget 584 static Widget
592 xaw_create_vertical_scrollbar (widget_instance *instance) 585 xaw_create_vertical_scrollbar (widget_instance *instance)
593 { 586 {