#include <Xm/MainW.h>
#include <Xm/Label.h>

#define msg_label \
"Ceci est un texte trop grand\n\
Pour rentrer dans la MainWindow, alors des barres de\n\
scrolling sont apparues !"

main(int argc, char **argv)
{
    Widget toplevel, main_w, label;
    XtAppContext app;

    XtSetLanguageProc(NULL, NULL, NULL);

    toplevel = XtVaAppInitialize(&app, "Demos",
        NULL, 0, &argc, argv, NULL, NULL);

    /* La main window */
    main_w = XtVaCreateManagedWidget("main_window",
				     xmMainWindowWidgetClass,   toplevel,
				     XmNscrollingPolicy, XmAUTOMATIC,
				     XmNscrollBarDisplayPolicy, XmAS_NEEDED,
				     NULL);

   /* Un label dans la work area  */
    label = 
      XtVaCreateManagedWidget(msg_label, 
			      xmLabelWidgetClass, main_w,
			      XmNalignment,  XmALIGNMENT_BEGINNING,
			      NULL);

    /* Positionnement des attributs de la Main Window pour lui indiquer quels 
       widgets sont dans les differentes zones, et quelles sont leurs 
       positions rezpectives */
    XmMainWindowSetAreas(label, NULL, NULL, NULL, NULL, NULL);
    
    XtRealizeWidget(toplevel);
    XtAppMainLoop(app);
}
