home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / xfe / XfeWidgets / tests / FontChooserTest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-08  |  2.9 KB  |  92 lines

  1. /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. /*-----------------------------------------*/
  19. /*                                                                        */
  20. /* Name:        FontChooserTest.c                                        */
  21. /* Description:    Test for XfeFontChooser widget.                            */
  22. /* Author:        Ramiro Estrugo <ramiro@netscape.com>                    */
  23. /*                                                                        */
  24. /*----------------------------------------------------------------------*/
  25.  
  26.  
  27.  
  28. #include <Xfe/XfeTest.h>
  29.  
  30. static String font_names[] = 
  31. {
  32.     "-adobe-courier-medium-r-normal--20-140-100-100-m-110-iso8859-1",
  33.     "-adobe-helvetica-medium-r-normal--20-140-100-100-p-100-iso8859-1",
  34.     "-adobe-new century schoolbook-medium-r-normal--20-140-100-100-p-103-iso8859-1",
  35.     "-adobe-symbol-medium-r-normal--20-140-100-100-p-107-adobe-fontspecific",
  36.     "-adobe-times-medium-r-normal--20-140-100-100-p-96-iso8859-1",
  37.     "-b&h-lucida-medium-r-normal-sans-20-140-100-100-p-114-iso8859-1",
  38.     "-b&h-lucidabright-medium-r-normal--20-140-100-100-p-114-iso8859-1",
  39.     "-b&h-lucidatypewriter-medium-r-normal-sans-20-140-100-100-m-120-iso8859-1",
  40.     "-misc-fixed-medium-r-normal--20-140-100-100-c-100-iso8859-1",
  41. };
  42.  
  43. static String label_names[] = 
  44. {
  45.     "Courier",
  46.     "Helvetica",
  47.     "New Century Schoolbook",
  48.     "Symbol",
  49.     "Times",
  50.     "Lucida",
  51.     "Lucidabright",
  52.     "Lucidatypewriter",
  53.     "Fixed",
  54. };
  55.  
  56. #define num_font_names XtNumber(font_names)
  57.  
  58. /*----------------------------------------------------------------------*/
  59. int
  60. main(int argc,char *argv[])
  61. {
  62.     Widget            form;
  63.     Widget            frame;
  64.     Widget            font_chooser;
  65.     XmString *        xm_string_table;
  66.     XmFontList *    font_list_table;
  67.     
  68.     XfeAppCreateSimple("FontChooserTest",&argc,argv,"MainFrame",&frame,&form);
  69.  
  70.     xm_string_table = XfeGetXmStringTable(label_names,num_font_names);
  71.  
  72.     font_list_table = XfeGetFontListTable(font_names,num_font_names);
  73.     
  74.     font_chooser = XtVaCreateManagedWidget("FontChooser",
  75.                                            xfeFontChooserWidgetClass,
  76.                                            form,
  77.                                            NULL);
  78.  
  79.     XtVaSetValues(font_chooser,
  80.                   XmNnumFontItems,        num_font_names,
  81.                   XmNfontItemLabels,    xm_string_table,
  82.                   XmNfontItemFonts,        font_list_table,
  83.                   NULL);
  84.     
  85.     XtPopup(frame,XtGrabNone);
  86.     
  87.     XfeAppMainLoop();
  88.  
  89.     return 0;
  90. }
  91. /*----------------------------------------------------------------------*/
  92.