home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / m / motifpg2.zip / ch05 / xcomstring.c < prev    next >
C/C++ Source or Header  |  1992-07-08  |  2KB  |  71 lines

  1. /*
  2.  * Copyright 1989, 1992 O'Reilly and Associates, Inc.
  3.  * See ../Copyright for complete rights and liability information.
  4.  */
  5.  
  6. /*
  7.  * xcomstring.c - simple test of compound strings, modifying fonts
  8.  */
  9.  
  10. /*
  11.  * Header files required for all Toolkit programs
  12.  */
  13. #include <X11/Intrinsic.h>     /* Intrinsics definitions */
  14. #include <Xm/Xm.h>    /* Standard Motif definitions */
  15.  
  16. /*
  17.  * Public header file for widgets we actually use in this file.
  18.  */
  19. #include <Xm/PushB.h>     /* Motif PushButton Widget */
  20.  
  21.  
  22. main(argc, argv)
  23. int argc;
  24. char **argv;
  25. {
  26.     XtAppContext app_context;
  27.     Widget topLevel;
  28.     XmString text;
  29.     XmString s1, s2, s3, s4;
  30.     Widget hello;
  31.     static String string1 = "Specify the ",
  32.                   string2 = "character set ",
  33.                   string3 = "in the code.";
  34.  
  35.     XtSetLanguageProc(NULL, (XtLanguageProc)NULL, NULL);
  36.  
  37.     topLevel = XtVaAppInitialize(
  38.             &app_context,       /* Application context */
  39.             "XComstring",       /* Application class */
  40.             NULL, 0,            /* command line option list */
  41.             &argc, argv,        /* command line args */
  42.             NULL,               /* for missing app-defaults file */
  43.             NULL);              /* terminate varargs list */
  44.  
  45.     s1 = XmStringCreate(string1, "tag1");
  46.     s2 = XmStringCreate(string2, "tag2");
  47.     s3 = XmStringCreate(string3, "tag1");
  48.  
  49.     s4 = XmStringConcat(s1, s2);
  50.     XmStringFree(s1);
  51.     XmStringFree(s2);
  52.  
  53.     text = XmStringConcat(s4, s3);
  54.     XmStringFree(s3);
  55.     XmStringFree(s4);
  56.  
  57.     hello = XtVaCreateManagedWidget(
  58.         "hello",            /* arbitrary widget name */
  59.         xmPushButtonWidgetClass,    /* widget class from PushButton.h */
  60.         topLevel,            /* parent widget */
  61.             XmNlabelString, text,
  62.         NULL);                  /* terminate varargs list */
  63.  
  64.     XmStringFree(text);
  65.  
  66.     XtRealizeWidget(topLevel);
  67.     
  68.     XtAppMainLoop(app_context);
  69. }
  70.  
  71.