1 /*----------------------------------------------------------------------------
2 --
3 --  Module:           xitCreCascPu
4 --
5 --  Project:          xit  - X Internal Toolkit
6 --  System:           xit  - X Internal Toolkit
7 --    Subsystem:      <>
8 --    Function block: <>
9 --
10 --  Description:
11 --    Creates a cascade button widget.
12 --
13 --  Filename:         xitCreCascPu.c
14 --
15 --  Authors:          Roger Larsson, Ulrika Bornetun
16 --  Creation date:    1991-10-20
17 --
18 --
19 --  (C) Copyright Ulrika Bornetun, Roger Larsson (1995)
20 --      All rights reserved
21 --
22 --  Permission to use, copy, modify, and distribute this software and its
23 --  documentation for any purpose and without fee is hereby granted,
24 --  provided that the above copyright notice appear in all copies. Ulrika
25 --  Bornetun and Roger Larsson make no representations about the usability
26 --  of this software for any purpose. It is provided "as is" without express
27 --  or implied warranty.
28 ----------------------------------------------------------------------------*/
29 
30 /* SCCS module identifier. */
31 static char SCCSID[] = "@(#) Module: xitCreCascPu.c, Version: 1.1, Date: 95/02/18 15:10:23";
32 
33 
34 /*----------------------------------------------------------------------------
35 --  Include files
36 ----------------------------------------------------------------------------*/
37 
38 #include <X11/Intrinsic.h>
39 #include <X11/Shell.h>
40 
41 #include <Xm/Xm.h>
42 #include <Xm/CascadeB.h>
43 
44 #include "xitTools.h"
45 
46 
47 /*----------------------------------------------------------------------------
48 --  Macro definitions
49 ----------------------------------------------------------------------------*/
50 
51 
52 /*----------------------------------------------------------------------------
53 --  Type declarations
54 ----------------------------------------------------------------------------*/
55 
56 
57 /*----------------------------------------------------------------------------
58 --  Global definitions
59 ----------------------------------------------------------------------------*/
60 
61 
62 /*----------------------------------------------------------------------------
63 --  Function prototypes
64 ----------------------------------------------------------------------------*/
65 
66 
67 
68 /*----------------------------------------------------------------------------
69 --  Functions
70 ----------------------------------------------------------------------------*/
71 
72 Widget
xitCreateCascadeButton(Widget parent,Widget submenu,XIT_CASCADE_STRUCT * cascade)73   xitCreateCascadeButton( Widget              parent,
74                           Widget              submenu,
75                           XIT_CASCADE_STRUCT  *cascade )
76 {
77 
78   /* Variables. */
79   Arg         args[ 5 ];
80   Cardinal    n;
81   Widget      w;
82   XmString    xstr = NULL;
83 
84 
85   /* Code. */
86 
87   n = 0;
88 
89   if( strlen( cascade -> title ) > 0 ) {
90     xstr = XmStringCreate( cascade -> title, CS );
91     XtSetArg( args[ n ], XmNlabelString, xstr ); n++;
92   }
93 
94   if( strlen( cascade -> mnemonic ) > 0 ) {
95     XtSetArg( args[ n ], XmNmnemonic, *cascade -> mnemonic ); n++;
96   }
97 
98   if( submenu != NULL ) {
99     XtSetArg( args[ n ], XmNsubMenuId, submenu ); n++;
100   }
101 
102   w = XmCreateCascadeButton( parent, cascade -> name, args, n );
103 
104   if( xstr != NULL )
105     XmStringFree( xstr );
106 
107 
108   return( w );
109 
110 } /* xitCreateCascadeButton */
111