/* Generated by wbuild from "PullDown.w"
** (generator version $Revision: 1.17 $ of $Date: 92/12/07 19:32:00 $)
*/
#include <X11/IntrinsicP.h>
#include <X11/StringDefs.h>
#line 185 "PullDown.w"
#include <Xfwf/EzMenu.h>
#line 187 "PullDown.w"
#include <stdio.h>
#include <Xfwf/PullDownP.h>
#line 81 "PullDown.w"
static void note(
#if NeedFunctionPrototypes
Widget,XEvent*,String*,Cardinal*
#endif
);
#line 103 "PullDown.w"
static void open_menu(
#if NeedFunctionPrototypes
Widget,XEvent*,String*,Cardinal*
#endif
);

static XtActionsRec actionsList[] = {
{"note", note},
{"open_menu", open_menu},
};

static char defaultTranslations[] = "\
<Btn1Down>: open_menu() \n\
Button1<Enter>: open_menu() \n\
<Key>Return: open_menu() \n\
";
static void _resolve_inheritance(
#if NeedFunctionPrototypes
WidgetClass
#endif
);
#line 127 "PullDown.w"
static void initialize(
#if NeedFunctionPrototypes
Widget ,Widget,ArgList ,Cardinal *
#endif
);
#line 137 "PullDown.w"
static Boolean  set_values(
#if NeedFunctionPrototypes
Widget ,Widget ,Widget,ArgList ,Cardinal *
#endif
);
#line 158 "PullDown.w"
static void create_menu(
#if NeedFunctionPrototypes
Widget
#endif
);
#line 170 "PullDown.w"
static void create_accelerator(
#if NeedFunctionPrototypes
Widget
#endif
);
#line 158 "PullDown.w"
/*ARGSUSED*/static void create_menu(self)Widget self;
{
    if (((XfwfPullDownWidget)self)->xfwfPullDown.popup) XtDestroyWidget(((XfwfPullDownWidget)self)->xfwfPullDown.popup);
    ((XfwfPullDownWidget)self)->xfwfPullDown.popup = XtVaCreatePopupShell("_menu", xfwfEzMenuWidgetClass, self,
				  XtNmenu, ((XfwfPullDownWidget)self)->xfwfPullDown.menu, XtNcursor, ((XfwfPullDownWidget)self)->xfwfPullDown.menuCursor,
				  NULL);
}
#line 170 "PullDown.w"
/*ARGSUSED*/static void create_accelerator(self)Widget self;
{
    char s[100];
    XtAccelerators a;

    (void) strcpy(s, ((XfwfPullDownWidget)self)->xfwfPullDown.hotkey);
    (void) strcat(s, ": open_menu()");
    a = XtParseAcceleratorTable(s);
    XtVaSetValues(self, XtNaccelerators, a, NULL);
}

static XtResource resources[] = {
#line 33 "PullDown.w"
{XtNpopup,XtCPopup,XtRWidget,sizeof(((XfwfPullDownRec*)NULL)->xfwfPullDown.popup),XtOffsetOf(XfwfPullDownRec,xfwfPullDown.popup),XtRImmediate,(XtPointer)NULL },
#line 39 "PullDown.w"
{XtNmenu,XtCMenu,XtRString,sizeof(((XfwfPullDownRec*)NULL)->xfwfPullDown.menu),XtOffsetOf(XfwfPullDownRec,xfwfPullDown.menu),XtRImmediate,(XtPointer)NULL },
#line 50 "PullDown.w"
{XtNhotkey,XtCHotkey,XtRString,sizeof(((XfwfPullDownRec*)NULL)->xfwfPullDown.hotkey),XtOffsetOf(XfwfPullDownRec,xfwfPullDown.hotkey),XtRImmediate,(XtPointer)NULL },
#line 56 "PullDown.w"
{XtNmenuCursor,XtCMenuCursor,XtRCursor,sizeof(((XfwfPullDownRec*)NULL)->xfwfPullDown.menuCursor),XtOffsetOf(XfwfPullDownRec,xfwfPullDown.menuCursor),XtRString,(XtPointer)"arrow"},
#line 61 "PullDown.w"
{XtNframeWidth,XtCFrameWidth,XtRDimension,sizeof(((XfwfPullDownRec*)NULL)->xfwfFrame.frameWidth),XtOffsetOf(XfwfPullDownRec,xfwfFrame.frameWidth),XtRImmediate,(XtPointer)0 },
#line 65 "PullDown.w"
{XtNshrinkToFit,XtCShrinkToFit,XtRBoolean,sizeof(((XfwfPullDownRec*)NULL)->xfwfLabel.shrinkToFit),XtOffsetOf(XfwfPullDownRec,xfwfLabel.shrinkToFit),XtRImmediate,(XtPointer)True },
};

XfwfPullDownClassRec xfwfPullDownClassRec = {
{ /* core_class part */
(WidgetClass) &xfwfButtonClassRec,
"XfwfPullDown",
sizeof(XfwfPullDownRec),
NULL,
_resolve_inheritance,
FALSE,
initialize,
NULL,
XtInheritRealize,
actionsList,
2,
resources,
6,
NULLQUARK,
False ,
FALSE ,
False ,
False ,
NULL,
XtInheritResize,
XtInheritExpose,
set_values,
NULL,
XtInheritSetValuesAlmost,
NULL,
XtInheritAcceptFocus,
XtVersion,
NULL,
defaultTranslations,
XtInheritQueryGeometry,
XtInheritDisplayAccelerator,
NULL 
},
{ /* composite_class part */
XtInheritGeometryManager,
XtInheritChangeManaged,
XtInheritInsertChild,
XtInheritDeleteChild,
NULL
},
{ /* XfwfCommon_class part */
XtInherit_compute_inside,
XtInherit_highlight_border,
XtInherit_unhighlight_border,
XtInherit_would_accept_focus,
XtInherit_traverse,
XtInherit_choose_color,
XtInherit_lighter_color,
XtInherit_darker_color,
NULL ,
},
{ /* XfwfFrame_class part */
0
},
{ /* XfwfBoard_class part */
XtInherit_set_abs_location,
},
{ /* XfwfLabel_class part */
XtInherit_set_label,
},
{ /* XfwfButton_class part */
0
},
{ /* XfwfPullDown_class part */
0
},
};
WidgetClass xfwfPullDownWidgetClass = (WidgetClass) &xfwfPullDownClassRec;
/*ARGSUSED*/
#line 81 "PullDown.w"
static void note(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params;
{
    static String Xeventname[] = {
	"", "", "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease",
	"MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn",
	"FocusOut", "KeymapNotify", "Expose", "GraphicsExpose",
	"NoExpose", "VisisbilityNotify", "CreateNotify", "DestroyNotify",
	"UnmapNotify", "MapNotify", "MapRequest", "ReparentNotify",
	"ConfigureNotify", "ConfigureRequest", "GravityNotify",
	"ResizeRequest", "CirculateNotify", "CirculateRequest",
	"PropertyNotify", "SelectionClear", "SelectionRequest",
	"SelectionNotify", "ColormapNotify", "ClientMessage",
	"MappingNotify", };
    (void) fprintf(stderr, "%s received %s\n",
		   XtName(self), Xeventname[event->type]);
}

/*ARGSUSED*/
#line 103 "PullDown.w"
static void open_menu(self,event,params,num_params)Widget self;XEvent*event;String*params;Cardinal*num_params;
{
    Position x, y;

    if (((XfwfPullDownWidget)self)->xfwfPullDown.popup == NULL) return;
    XtTranslateCoords(self, 0, ((XfwfPullDownWidget)self)->core.height, &x, &y);
    XtMoveWidget(((XfwfPullDownWidget)self)->xfwfPullDown.popup, x, y);
    XtPopupSpringLoaded(((XfwfPullDownWidget)self)->xfwfPullDown.popup);
    XtGrabPointer(((XfwfPullDownWidget)self)->xfwfPullDown.popup, True, EnterWindowMask | LeaveWindowMask |
		  ButtonPressMask | ButtonReleaseMask, GrabModeAsync,
		  GrabModeAsync, None, ((XfwfPullDownWidget)self)->xfwfFrame.cursor, CurrentTime);
    XtCallCallbackList(self, ((XfwfPullDownWidget)self)->xfwfButton.activate, event);
}

static void _resolve_inheritance(class)
WidgetClass class;
{
  XfwfPullDownWidgetClass c = (XfwfPullDownWidgetClass) class;
  XfwfPullDownWidgetClass super;
  if (class == xfwfPullDownWidgetClass) return;
  super = (XfwfPullDownWidgetClass) c->core_class.superclass;
}
#line 127 "PullDown.w"
/*ARGSUSED*/static void initialize(request,self,args,num_args)Widget  request;Widget self;ArgList  args;Cardinal * num_args;
{
    if (((XfwfPullDownWidget)self)->xfwfPullDown.popup == NULL && ((XfwfPullDownWidget)self)->xfwfPullDown.menu != NULL) create_menu(self);
    if (((XfwfPullDownWidget)self)->xfwfPullDown.popup != NULL && ((XfwfPullDownWidget)self)->xfwfPullDown.hotkey != NULL) create_accelerator(self);
}
#line 137 "PullDown.w"
/*ARGSUSED*/static Boolean  set_values(old,request,self,args,num_args)Widget  old;Widget  request;Widget self;ArgList  args;Cardinal * num_args;
{
    if (((XfwfPullDownWidget)old)->xfwfPullDown.popup != ((XfwfPullDownWidget)self)->xfwfPullDown.popup)
	XtDestroyWidget(((XfwfPullDownWidget)old)->xfwfPullDown.popup);
    else if (((XfwfPullDownWidget)old)->xfwfPullDown.menu != ((XfwfPullDownWidget)self)->xfwfPullDown.menu)
	create_menu(self);
    if (((XfwfPullDownWidget)old)->xfwfPullDown.menuCursor != ((XfwfPullDownWidget)self)->xfwfPullDown.menuCursor)
	if (((XfwfPullDownWidget)self)->xfwfPullDown.popup) XtVaSetValues(((XfwfPullDownWidget)self)->xfwfPullDown.popup, XtNcursor, ((XfwfPullDownWidget)self)->xfwfPullDown.menuCursor, NULL);
    if (((XfwfPullDownWidget)old)->xfwfPullDown.hotkey != ((XfwfPullDownWidget)self)->xfwfPullDown.hotkey)
	create_accelerator(self);
    return False;
}
