/* PullDownT -- test program for PullDown widget */

#include <stdio.h>
#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <Xfwf/Board.h>
#include <Xfwf/RowCol.h>
#include <Xfwf/PullDown.h>

static String fallback_resources[] = {
    "PullDownT.width: 400",
    "PullDownT.height: 200",

    "*board.frameWidth: 2",
    "*board.frameType: sunken",

    "*menubar.location: 0 0 1.0 40",
    "*menubar.frameWidth: 2",
    "*menubar.frameType: raised",

    "*XfwfPullDown.location: 0 0 80 30",	/* For both buttons */

    "*menu1.label: menu 1",
    "*menu1.hotkey: Alt<Key>1",
    "*menu1.menu:\
	(item \"quit\" (action \"quit()\"))",

    "*menu2.label: menu 2",
    "*menu2.hotkey: Alt<Key>2",
    "*menu2.menu:\
	(item \"first item\" (action \"first_action()\"))\
	(item \"second item\" (action \"second_action()\"))\
	(item \"third item\" (action \"third_action()\"))\
	(item \"fourth item\" (action \"fourth_action()\"))",

    NULL,
};

static void quit(w, event, params, num_params)
    Widget w;
    XEvent *event;
    String *params;
    Cardinal *num_params;
{
    exit(0);
}

static XtActionsRec actions[] = {
    "quit", quit,
    /* other actions here */
};

static Widget toplevel, board, menubar, menu1, menu2;
static XtAppContext app_context;
Display *display;

int main(argc, argv)
    Cardinal argc;
    String *argv;
{
    toplevel = XtVaAppInitialize
	(&app_context, "PullDownT", NULL, 0, &argc, argv,
	 fallback_resources, NULL);
    display = XtDisplay(toplevel);
    (void) XSynchronize(display, True);
    XtAppAddActions(app_context, actions, XtNumber(actions));
    board = XtVaCreateManagedWidget
	("board", xfwfBoardWidgetClass, toplevel, NULL);
    menubar = XtVaCreateManagedWidget
	("menubar", xfwfRowColWidgetClass, board, NULL);
    menu1 = XtVaCreateManagedWidget
	("menu1", xfwfPullDownWidgetClass, menubar, NULL);
    menu2 = XtVaCreateManagedWidget
	("menu2", xfwfPullDownWidgetClass, menubar, NULL);
    XtRealizeWidget(toplevel);
    XtAppMainLoop(app_context);
}
