1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
|
#ifdef MOTIF
# include <Xm/Xm.h>
# include <Xm/PushB.h>
# include <Xm/RowColumn.h>
# include <Xm/PanedW.h>
#else
# include <X11/Intrinsic.h>
# include <X11/StringDefs.h>
# include <X11/Xaw/Box.h>
# include <X11/Xaw/Paned.h>
# include <X11/Xaw/Command.h>
#endif
#include "config.h"
#include "utils.h"
#include "xrn.h"
#include "ButtonBox.h"
Widget ButtonBoxCreate(name, parent)
String name;
Widget parent;
{
Widget w;
#ifdef MOTIF
w = XtVaCreateWidget(name, xmRowColumnWidgetClass, parent,
XmNpacking, XmPACK_TIGHT,
XmNorientation, XmHORIZONTAL,
XmNallowResize, True,
XmNskipAdjust, True,
/* nothing for motif here, i think - kb
XtNresizeToPreferred, True,
XtNshowGrip, False,
*/
0);
#else
w = XtVaCreateWidget(name, boxWidgetClass, parent,
XtNallowResize, True,
XtNresizeToPreferred, True,
XtNshowGrip, False,
XtNskipAdjust, True,
0);
#endif
return w;
}
Widget ButtonBoxAddButton(name, callbacks, parent)
String name;
XtCallbackRec *callbacks;
Widget parent;
{
Widget w;
#ifdef MOTIF
w = XtVaCreateManagedWidget(name, xmPushButtonWidgetClass, parent,
XmNactivateCallback, callbacks, 0);
#else
w = XtVaCreateManagedWidget(name, commandWidgetClass, parent,
XtNcallback, callbacks, 0);
#endif
return w;
}
void ButtonBoxDoneAdding(w)
Widget w;
{
if (XtIsRealized(XtParent(w)))
XtRealizeWidget(w);
XtManageChild(w);
}
void ButtonBoxEmpty(w)
Widget w;
{
WidgetList children;
Cardinal num_children;
XtVaGetValues(w, XtNchildren, &children,
XtNnumChildren, &num_children, 0);
while (num_children-- >= 1)
XtDestroyWidget(children[num_children]);
}
void ButtonBoxDestroy(w)
Widget w;
{
XtDestroyWidget(w);
}
|