comparison lwlib/lwlib-Xaw.c @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 9ee227acff29
children c7528f8e288d
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
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 XEmacs; 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, Inc., 59 Temple Place - Suite 330, 18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19 Boston, MA 02111-1307, USA. */
20 19
21 #include <stdio.h> 20 #include <stdio.h>
21 #include <stdlib.h>
22 22
23 #include "lwlib-Xaw.h" 23 #include "lwlib-Xaw.h"
24 24
25 #include <X11/StringDefs.h> 25 #include <X11/StringDefs.h>
26 #include <X11/IntrinsicP.h> 26 #include <X11/IntrinsicP.h>
282 } 282 }
283 283
284 override = XtParseTranslationTable (overrideTrans); 284 override = XtParseTranslationTable (overrideTrans);
285 285
286 ac = 0; 286 ac = 0;
287 XtSetArg (av[ac], XtNtitle, shell_title); ac++; 287 XtSetArg (av[ac], XtNtitle, shell_title); ac++;
288 XtSetArg (av[ac], XtNallowShellResize, True); ac++; 288 XtSetArg (av[ac], XtNallowShellResize, True); ac++;
289 XtSetArg (av[ac], XtNtransientFor, parent); ac++; 289 XtSetArg (av[ac], XtNtransientFor, parent); ac++;
290 shell = XtCreatePopupShell ("dialog", transientShellWidgetClass, 290 shell = XtCreatePopupShell ("dialog", transientShellWidgetClass,
291 parent, av, ac); 291 parent, av, ac);
292 XtOverrideTranslations (shell, override); 292 XtOverrideTranslations (shell, override);
293 293
294 ac = 0; 294 ac = 0;
297 bc = 0; 297 bc = 0;
298 button = 0; 298 button = 0;
299 for (i = 0; i < left_buttons; i++) 299 for (i = 0; i < left_buttons; i++)
300 { 300 {
301 ac = 0; 301 ac = 0;
302 XtSetArg (av [ac], XtNfromHoriz, button); ac++; 302 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
303 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; 303 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++;
304 XtSetArg (av [ac], XtNright, XtChainLeft); ac++; 304 XtSetArg (av [ac], XtNright, XtChainLeft); ac++;
305 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; 305 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
306 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; 306 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
307 XtSetArg (av [ac], XtNresizable, True); ac++; 307 XtSetArg (av [ac], XtNresizable, True); ac++;
308 sprintf (button_name, "button%d", ++bc); 308 sprintf (button_name, "button%d", ++bc);
309 button = XtCreateManagedWidget (button_name, commandWidgetClass, 309 button = XtCreateManagedWidget (button_name, commandWidgetClass,
310 dialog, av, ac); 310 dialog, av, ac);
311 } 311 }
312 if (right_buttons) 312 if (right_buttons)
317 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
318 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
319 window) but I can't seem to make it do it. 319 window) but I can't seem to make it do it.
320 */ 320 */
321 ac = 0; 321 ac = 0;
322 XtSetArg (av [ac], XtNfromHoriz, button); ac++; 322 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
323 /* XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */ 323 /* XtSetArg (av [ac], XtNfromVert, XtNameToWidget (dialog, "label")); ac++; */
324 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++; 324 XtSetArg (av [ac], XtNleft, XtChainLeft); ac++;
325 XtSetArg (av [ac], XtNright, XtChainRight); ac++; 325 XtSetArg (av [ac], XtNright, XtChainRight); ac++;
326 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; 326 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
327 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; 327 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
328 XtSetArg (av [ac], XtNlabel, ""); ac++; 328 XtSetArg (av [ac], XtNlabel, ""); ac++;
329 XtSetArg (av [ac], XtNwidth, 30); ac++; /* #### aaack!! */ 329 XtSetArg (av [ac], XtNwidth, 30); ac++; /* #### aaack!! */
330 XtSetArg (av [ac], XtNborderWidth, 0); ac++; 330 XtSetArg (av [ac], XtNborderWidth, 0); ac++;
331 XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++; 331 XtSetArg (av [ac], XtNshapeStyle, XmuShapeRectangle); ac++;
339 dialog, av, ac); 339 dialog, av, ac);
340 } 340 }
341 for (i = 0; i < right_buttons; i++) 341 for (i = 0; i < right_buttons; i++)
342 { 342 {
343 ac = 0; 343 ac = 0;
344 XtSetArg (av [ac], XtNfromHoriz, button); ac++; 344 XtSetArg (av [ac], XtNfromHoriz, button); ac++;
345 XtSetArg (av [ac], XtNleft, XtChainRight); ac++; 345 XtSetArg (av [ac], XtNleft, XtChainRight); ac++;
346 XtSetArg (av [ac], XtNright, XtChainRight); ac++; 346 XtSetArg (av [ac], XtNright, XtChainRight); ac++;
347 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++; 347 XtSetArg (av [ac], XtNtop, XtChainBottom); ac++;
348 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++; 348 XtSetArg (av [ac], XtNbottom, XtChainBottom); ac++;
349 XtSetArg (av [ac], XtNresizable, True); ac++; 349 XtSetArg (av [ac], XtNresizable, True); ac++;
350 sprintf (button_name, "button%d", ++bc); 350 sprintf (button_name, "button%d", ++bc);
351 button = XtCreateManagedWidget (button_name, commandWidgetClass, 351 button = XtCreateManagedWidget (button_name, commandWidgetClass,
352 dialog, av, ac); 352 dialog, av, ac);
353 } 353 }
354 354
553 } 553 }
554 554
555 static Widget 555 static Widget
556 xaw_create_scrollbar (widget_instance *instance, int vertical) 556 xaw_create_scrollbar (widget_instance *instance, int vertical)
557 { 557 {
558 Arg av[10]; 558 Arg av[20];
559 int ac = 0; 559 int ac = 0;
560 560 Widget scrollbar;
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;
568 561
569 /* #### This is tacked onto the with and height and completely 562 /* #### This is tacked onto the with and height and completely
570 screws our geometry management. We should probably make the 563 screws our geometry management. We should probably make the
571 top-level aware of this so that people could have a border but so 564 top-level aware of this so that people could have a border but so
572 few people use the Athena scrollbar now that it really isn't 565 few people use the Athena scrollbar now that it really isn't
573 worth the effort, at least not at the moment. */ 566 worth the effort, at least not at the moment. */
574 XtSetArg (av [ac], XtNborderWidth, 0); ac++; 567 XtSetArg (av [ac], XtNborderWidth, 0); ac++;
575 XtSetArg (av [ac], XtNorientation, 568 if (vertical)
576 vertical ? XtorientVertical : XtorientHorizontal); ac++; 569 {
577 XtSetArg (av [ac], "jumpProc", jumpCallbacks); ac++; 570 XtSetArg (av [ac], XtNorientation, XtorientVertical); ac++;
578 XtSetArg (av [ac], "scrollProc", scrollCallbacks); ac++; 571 }
579 572 else
580 return XtCreateWidget (instance->info->name, scrollbarWidgetClass, 573 {
581 instance->parent, av, ac); 574 XtSetArg (av [ac], XtNorientation, XtorientHorizontal); ac++;
575 }
576
577 scrollbar =
578 XtCreateWidget (instance->info->name, scrollbarWidgetClass,
579 instance->parent, av, ac);
580
581 XtRemoveAllCallbacks (scrollbar, "jumpProc");
582 XtRemoveAllCallbacks (scrollbar, "scrollProc");
583
584 XtAddCallback (scrollbar, "jumpProc", xaw_scrollbar_jump,
585 (XtPointer) instance);
586 XtAddCallback (scrollbar, "scrollProc", xaw_scrollbar_scroll,
587 (XtPointer) instance);
588
589 return scrollbar;
582 } 590 }
583 591
584 static Widget 592 static Widget
585 xaw_create_vertical_scrollbar (widget_instance *instance) 593 xaw_create_vertical_scrollbar (widget_instance *instance)
586 { 594 {