/*
** Generated by X-Designer
*/
/*
**LIBS: -lXm -lXt -lX11
*/

#include <stdio.h>
#include <stdlib.h>
#include <X11/Xatom.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>

#include <Xm/Xm.h>
#include <Xm/RepType.h>
#include <Xm/DialogS.h>
#include <Xm/Form.h>
#include <Xm/List.h>
#include <Xm/ScrollBar.h>
#include <Xm/TextF.h>
#include <Xm/ComboBox.h>


#include "MonthComboBox.h"

#ifndef   _NO_PROTO
extern void selectionCallback(Widget, XtPointer, XtPointer) ;
#else  /* _NO_PROTO */
extern void selectionCallback() ;
#endif /* _NO_PROTO */

Widget shell = (Widget) NULL;
Widget form = (Widget) NULL;
Widget comboBox = (Widget) NULL;



void create_shell (Display *display, char *app_name, int app_argc, char **app_argv)
{
	Widget children[2];      /* Children to manage */
	Arg al[64];                    /* Arg List */
	register int ac = 0;           /* Arg Count */
	XtPointer tmp_value;             /* ditto */
	XmString *list_items[2];          /* For list items */

	XtSetArg(al[ac], XmNallowShellResize, TRUE); ac++;
	XtSetArg(al[ac], XmNargc, app_argc); ac++;
	XtSetArg(al[ac], XmNargv, app_argv); ac++;
	shell = XtAppCreateShell(app_name, (char *) "XApplication", sessionShellWidgetClass, display, al, ac);

	ac = 0;
	XtSetArg(al[ac], XmNautoUnmanage, FALSE); ac++;
	form = XmCreateForm ( shell, (char *) "form", al, ac );
	ac = 0;
	XtSetArg(al[ac], XmNitemCount, 12); ac++;
	list_items [0] = (XmString *) XtMalloc ( sizeof (XmString) * 13 );
	list_items[0][0] = XmStringGenerate("January", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][1] = XmStringGenerate("February", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][2] = XmStringGenerate("March", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][3] = XmStringGenerate("April", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][4] = XmStringGenerate("May", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][5] = XmStringGenerate("June", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][6] = XmStringGenerate("July", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][7] = XmStringGenerate("August", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][8] = XmStringGenerate("September", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][9] = XmStringGenerate("October", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][10] = XmStringGenerate("November", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][11] = XmStringGenerate("December", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL);
	list_items[0][12] = NULL;
	XtSetArg(al[ac], XmNitems, list_items[0]); ac++;
	comboBox = XmCreateDropDownList ( form, (char *) "comboBox", al, ac );
	ac = 0;
	while ( list_items[0][ac] )
		XmStringFree ( list_items[0][ac++] );
	ac = 0;
	XtFree ( (char *) list_items[0] );



	XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM); ac++;
	XtSetArg(al[ac], XmNleftAttachment, XmATTACH_FORM); ac++;
	XtSetValues ( comboBox,al, ac );
	ac = 0;
	if (comboBox)
		XtAddCallback( comboBox, XmNselectionCallback, selectionCallback, (XtPointer) 0 );
	if ((children[ac] = comboBox) != (Widget) 0) { ac++; }
	if (ac > 0) { XtManageChildren(children, ac); }
	ac = 0;
	if (form != (Widget) 0) { XtManageChild ( form); }
}


/* Global Declarations */

XtAppContext app_context = (XtAppContext) 0 ;
Display     *display     = (Display *)    0 ;

int main(int argc, char **argv)
{

	/* Enable Localisation of the Application */

	XtSetLanguageProc((XtAppContext) 0, (XtLanguageProc) 0, (XtPointer) 0) ;

	/* Initialise the X Toolkit */

	XtToolkitInitialize ();

	/* Create a Global Application Context */

	app_context = XtCreateApplicationContext ();

	/* Open the Display */

	display = XtOpenDisplay(app_context, (String) 0, argv[0], "XApplication",
	                       (XrmOptionDescRec *) 0, 0,
	                       &argc, argv);
	if (display == (Display *) 0) {
		printf("%s: can't open display, exiting...\n", argv[0]);
		exit (-1);
	}
	/* Call the Create Procedures for the Dialogs in the Application */

	create_shell ( display, argv[0], argc, argv );

	/* Display the Primary Application Shell */

	XtRealizeWidget (shell);

	/* Entering X Main Loop... */

	XtAppMainLoop (app_context);

	/* NOTREACHED */

	exit (0);
}

