#include "wbmainP.h"
#include "wb_include.h"

main(argc, argv)
     int argc;
     char *argv[];
 { Widget shell;
   Widget WBform;
   Widget box_label;          /* label for the Widget Builder main box */
   Widget box2_label;         /* label for the Widget Builder main box */

   /* Set up new widget actions */
   /* ------------------------- */
   if (actions_added == 0)
     { XtAddActions(action_list, num_actions);
       actions_added = 1;
     };

   /* Initialize a toplevel root shell widget */
   /* --------------------------------------- */
   shell = XtInitialize(argv[0],
		       "Widget-Builder",
		       NULL, 0,
			&argc, argv);
   XtSetValues(shell, box_args, XtNumber(box_args));

   /* Initialize a toplevel root shell widget */
   /* --------------------------------------- */
   shell = XtInitialize(argv[0],
		       "Widget-Builder",
		       NULL, 0,
			&argc, argv);
   XtSetValues(shell, box_args, XtNumber(box_args));

   the_display = XtDisplay(shell);     /* first get the display */

   if (actions_added == 0)
     { 
       /* Set the cursor to make editable things easily visible */
       /* ----------------------------------------------------- */
       the_cursor = XCreateFontCursor(the_display, XC_hand2);
       the_other_cursor = XCreateFontCursor(the_display, XC_star);
       
     };

   /* Load in necessary fonts */
   /* ----------------------- */
   timesRoman12 = XLoadQueryFont(the_display, "times-roman12");
   timesBold12 = XLoadQueryFont(the_display, "times-bold12");
   timesRoman14 = XLoadQueryFont(the_display, "times-roman14");
   timesBold14 = XLoadQueryFont(the_display, "times-bold14");
   fixedFont = XLoadQueryFont(the_display, "fixed");

   /* Create main (background) widget for the Widget Builder */
   /* ------------------------------------------------------ */
   WBform = XtCreateManagedWidget("Widget Builder form",
			       boxWidgetClass, shell,
			       box_args, XtNumber(box_args));
   box_label = XtCreateManagedWidget("Widget Builder", 
			       formWidgetClass, WBform,
			       widget_builder_label_arg_list,
			       XtNumber(widget_builder_label_arg_list));
   XtSetArg(arg_list[0], XtNcursor, the_cursor);
   XtSetValues(box_label, arg_list, 1);
   inverseVideo(box_label);    /* Highlight the Widget Builder label */
   box2_label = XtCreateManagedWidget("Widget Builder", 
			       labelWidgetClass, box_label,
			       widget_builder_label_arg_list,
			       XtNumber(widget_builder_label_arg_list));
   XtSetArg(arg_list[0], XtNcursor, the_cursor);
   XtSetValues(box2_label, arg_list, 1);
   inverseVideo(box2_label);    /* Highlight the Widget Builder label */

   /* Create the user's work area */
   /* --------------------------- */
   userArea = WBcreate_wb(WBform, box2_label, box_label);

   /* Place a widget a bottom of form to serve as a */
   /* display for useful documentation              */
   /* --------------------------------------------- */
   documentation_line_widget = XtCreateManagedWidget("Widget Builder", 
			       labelWidgetClass, WBform,
			       widget_builder_doc_arg_list,
			       XtNumber(widget_builder_doc_arg_list));
   documentation_line(
      "Mouse=> L: Edit Widget.  M: Resize Widget.  R: Move Widget.  Title-Bar: Add/Delete Widgets. ");
   /* Highlight the Widget Builder label */
   inverseVideo(documentation_line_widget);    

   /* Position documentation line at bottom */
   /* ------------------------------------- */
   XtSetArg(arg_list[0], XtNfromVert, box_label);
   XtSetArg(arg_list[1], XtNvertDistance, 0);
   XtSetValues(userArea, arg_list, 2);
   XtSetArg(arg_list[0], XtNfromVert, userArea);
   XtSetArg(arg_list[1], XtNvertDistance, 0);
   XtSetValues(documentation_line_widget, arg_list, 2);

   /* Attach Basic Functions popup menu to the box_label */
   make_mailer_buttons(
     make_saveCcode_buttons(make_edit_menu(box_label, WBform, 
     		          widget_builder_options, "Widget Builder")));

   XtRealizeWidget(shell);

   XtMainLoop();

 };        /* end of main() */
