Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:15:25

0001 /*
0002  * Motif
0003  *
0004  * Copyright (c) 1987-2012, The Open Group. All rights reserved.
0005  *
0006  * These libraries and programs are free software; you can
0007  * redistribute them and/or modify them under the terms of the GNU
0008  * Lesser General Public License as published by the Free Software
0009  * Foundation; either version 2 of the License, or (at your option)
0010  * any later version.
0011  *
0012  * These libraries and programs are distributed in the hope that
0013  * they will be useful, but WITHOUT ANY WARRANTY; without even the
0014  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
0015  * PURPOSE. See the GNU Lesser General Public License for more
0016  * details.
0017  *
0018  * You should have received a copy of the GNU Lesser General Public
0019  * License along with these librararies and programs; if not, write
0020  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
0021  * Floor, Boston, MA 02110-1301 USA
0022  * 
0023  */
0024 
0025 #ifndef _XmFontSelectorP_h
0026 #define _XmFontSelectorP_h
0027 
0028 #if defined(VMS) || defined(__VMS)
0029 #include <X11/apienvset.h>
0030 #endif
0031 
0032 /************************************************************
0033  *      INCLUDE FILES
0034  *************************************************************/
0035 #include <Xm/ManagerP.h>
0036 #include <Xm/PanedP.h>
0037 #include <Xm/FontS.h>
0038 
0039 #ifdef __cplusplus
0040 extern "C" {
0041 #endif
0042 
0043 #define XmFontSelectorIndex (XmPanedIndex + 1)
0044 
0045 #define XmFontS_current_font(w) (((XmFontSelectorWidget)(w))->fs.current_font)
0046 #define XmFontS_show_font_name(w) (((XmFontSelectorWidget)(w))->fs.show_font_name)
0047 #define XmFontS_iso_fonts_only(w) (((XmFontSelectorWidget)(w))->fs.iso_fonts_only)
0048 #define XmFontS_use_scaling(w) (((XmFontSelectorWidget)(w))->fs.use_scaling)
0049 #define XmFontS_text_rows(w) (((XmFontSelectorWidget)(w))->fs.text_rows)
0050 #define XmFontS_font_changed_callback(w) (((XmFontSelectorWidget)(w))->fs.font_changed_callback)
0051 #define XmFontS_strings(w) (((XmFontSelectorWidget)(w))->fs.strings)
0052 #define XmFontS_xlfd_mode(w) (((XmFontSelectorWidget)(w))->fs.xlfd_mode)
0053 #define XmFontS_font_info(w) (((XmFontSelectorWidget)(w))->fs.font_info)
0054 #define XmFontS_text(w) (((XmFontSelectorWidget)(w))->fs.text)
0055 #define XmFontS_name_label(w) (((XmFontSelectorWidget)(w))->fs.name_label)
0056 #define XmFontS_middle_pane(w) (((XmFontSelectorWidget)(w))->fs.middle_pane)
0057 #define XmFontS_family_box(w) (((XmFontSelectorWidget)(w))->fs.family_box)
0058 #define XmFontS_size_box(w) (((XmFontSelectorWidget)(w))->fs.size_box)
0059 #define XmFontS_bold_toggle(w) (((XmFontSelectorWidget)(w))->fs.bold_toggle)
0060 #define XmFontS_italic_toggle(w) (((XmFontSelectorWidget)(w))->fs.italic_toggle)
0061 #define XmFontS_xlfd_toggle(w) (((XmFontSelectorWidget)(w))->fs.xlfd_toggle)
0062 #define XmFontS_other_toggle(w) (((XmFontSelectorWidget)(w))->fs.other_toggle)
0063 #define XmFontS_show_font_toggle(w) (((XmFontSelectorWidget)(w))->fs.show_font_toggle)
0064 #define XmFontS_use_scaling_toggle(w) (((XmFontSelectorWidget)(w))->fs.use_scaling_toggle)
0065 #define XmFontS_option_menu(w) (((XmFontSelectorWidget)(w))->fs.option_menu)
0066 #define XmFontS_encoding_menu_shell(w) (((XmFontSelectorWidget)(w))->fs.encoding_menu_shell)
0067 #define XmFontS_xlfd_only(w) (((XmFontSelectorWidget)(w))->fs.xlfd_only)
0068 #define XmFontS_xlfd_sensitive(w) (((XmFontSelectorWidget)(w))->fs.xlfd_sensitive)
0069 #define XmFontS_num_xlfd_only(w) (((XmFontSelectorWidget)(w))->fs.num_xlfd_only)
0070 #define XmFontS_num_xlfd_sensitive(w) (((XmFontSelectorWidget)(w))->fs.num_xlfd_sensitive)
0071 #define XmFontS_alloc_xlfd_only(w) (((XmFontSelectorWidget)(w))->fs.alloc_xlfd_only)
0072 #define XmFontS_alloc_xlfd_sensitive(w) (((XmFontSelectorWidget)(w))->fs.alloc_xlfd_sensitive)
0073 #define XmFontS_user_state(w) (((XmFontSelectorWidget)(w))->fs.user_state)
0074 #define XmFontS_current_text(w) (((XmFontSelectorWidget)(w))->fs.current_text)
0075 #define XmFontS_get_font(w) (((XmFontSelectorWidget)(w))->fs.get_font)
0076 #define XmFontS_encoding(w) (((XmFontSelectorWidget)(w))->fs.encoding)
0077 #define XmFontS_old_fontlist(w) (((XmFontSelectorWidget)(w))->fs.old_fontlist)
0078 #define XmFontS_old_fontdata(w) (((XmFontSelectorWidget)(w))->fs.old_fontdata)
0079 #define XmFontS_dpi75(w) (((XmFontSelectorWidget)(w))->fs.dpi75)
0080 #define XmFontS_dpi100(w) (((XmFontSelectorWidget)(w))->fs.dpi100)
0081 #define XmFontS_dpiAny(w) (((XmFontSelectorWidget)(w))->fs.dpiAny)
0082 #define XmFontS_proportional(w) (((XmFontSelectorWidget)(w))->fs.proportional)
0083 #define XmFontS_monospace(w) (((XmFontSelectorWidget)(w))->fs.monospace)
0084 #define XmFontS_any_spacing(w) (((XmFontSelectorWidget)(w))->fs.any_spacing)
0085 
0086 
0087 #define SAMPLE_TEXT(fsw)        (XmFontS_strings((fsw)).sample_text)
0088 #define ANY_STRING(fsw)     (XmFontS_strings((fsw)).any)
0089 #define LOWER_ANY_STRING(fsw)   (XmFontS_strings((fsw)).lower_any)
0090 #define FAMILY_STRING(fsw)  (XmFontS_strings((fsw)).family)
0091 #define SIZE_STRING(fsw)    (XmFontS_strings((fsw)).size)
0092 #define BOLD_STRING(fsw)    (XmFontS_strings((fsw)).bold)
0093 #define ITALIC_STRING(fsw)  (XmFontS_strings((fsw)).italic)
0094 
0095 #define OPTION_STRING(fsw)  (XmFontS_strings((fsw)).option)
0096 
0097 #define BOTH_STRING(fsw)    (XmFontS_strings((fsw)).both)
0098 #define MONO_SPACE_STRING(fsw)  (XmFontS_strings((fsw)).mono_space)
0099 #define PROPORTIONAL_STRING(fsw)(XmFontS_strings((fsw)).prop_space)
0100 
0101 #define XLFD_STRING(fsw)    (XmFontS_strings((fsw)).xlfd)
0102 #define OTHER_FONT_STRING(fsw)  (XmFontS_strings((fsw)).other_font)
0103 
0104 #define DPI75_STRING(fsw)   (XmFontS_strings((fsw)).dpi_75)
0105 #define DPI100_STRING(fsw)  (XmFontS_strings((fsw)).dpi_100)
0106 
0107 #define SCALING_STRING(fsw)   (XmFontS_strings((fsw)).scaling)
0108 #define SHOW_NAME_STRING(fsw)     (XmFontS_strings((fsw)).show_name)
0109 
0110 #define ENCODING_ONLY_STRING(fsw) (XmFontS_strings((fsw)).encoding_only)
0111 #define ENCODING_LIST(fsw)    (XmFontS_strings((fsw)).encoding_list)
0112 
0113 #define ENCODING_STRING(fsw)    XmFontS_encoding((fsw))
0114 
0115 /* this structure provides the table for font selection */
0116 
0117 #define WEIGHT_LEN    15
0118 #define SLANT_LEN      3
0119 #define SPACING_LEN    3
0120 
0121 typedef unsigned char Flag;
0122 typedef unsigned int LongFlag;
0123 
0124 #define FIXED       ((Flag) 1 << 0)
0125 #define BOLD        ((Flag) 1 << 1)
0126 #define ITALIC      ((Flag) 1 << 2)
0127 #define PROPORTIONAL    ((Flag) 1 << 3)
0128 #define SCALED_75       ((Flag) 1 << 4)
0129 #define SCALED_100  ((Flag) 1 << 5)
0130 #define DPI_75      ((Flag) 1 << 6)
0131 #define DPI_100     ((Flag) 1 << 7)
0132 
0133 /*
0134  * This allows me to reuse flag bits in the user_state since
0135  * ISO is never set in the user state.
0136  */
0137 
0138 #define USER_PROPORTIONAL       PROPORTIONAL
0139 #define USER_FIXED      FIXED
0140 
0141 typedef struct _FontData {
0142     XrmQuark familyq;       /* quarkified family name. */
0143     XrmQuark weightq;       /* quarkified weight name. */
0144     char slant[SLANT_LEN + 1];
0145     char spacing[SPACING_LEN + 1];
0146     short resolution_x, resolution_y;
0147     short point_size;
0148     XrmQuark encoding;
0149     Flag state;
0150 } FontData;
0151 
0152 typedef struct FamilyInfo {
0153     XrmQuark nameq;     /* quarkified family name. */
0154     XrmQuark bold_nameq, medium_nameq;
0155     XrmQuark italic_nameq, upright_nameq;
0156     char fixed_spacing[SPACING_LEN + 1];
0157     LongFlag sizes_75, sizes_100;
0158     Flag state;
0159     XrmQuark *encodings;
0160     int encoding_alloc;
0161 } FamilyInfo;
0162 
0163 typedef struct FontInfo {
0164     FontData *current_font;
0165     String *others;
0166     FamilyInfo *family_info;
0167     short num_others;
0168     short num_families;
0169     short resolution;
0170 } FontInfo;
0171 
0172 typedef struct _XmFontSelStringInfo {
0173     XmString sample_text;
0174     XmString any, lower_any;
0175     XmString family, size;
0176     XmString bold, italic, option, both;
0177     XmString mono_space, prop_space;
0178     XmString xlfd, other_font;
0179     XmString dpi_75, dpi_100;
0180     XmString scaling, encoding_only, show_name;
0181 
0182     String *encoding_list;
0183 } XmFontSelStringInfo;
0184 
0185 /************************************************************
0186  *      TYPEDEFS AND DEFINES
0187  *************************************************************/
0188 
0189 typedef struct _FontSelectorClassPart
0190 {
0191     XtPointer extension;    /* For later use. */
0192 } FontSelectorClassPart;
0193 
0194 typedef struct _XmFontSelectorClassRec
0195 {
0196     CoreClassPart       core_class;
0197     CompositeClassPart      composite_class;
0198     ConstraintClassPart     constraint_class;
0199     XmManagerClassPart      manager_class;
0200     XmPanedClassPart        paned_class;
0201     FontSelectorClassPart   font_selector_class;
0202 } XmFontSelectorClassRec;
0203 
0204 typedef struct _XmFontSelectorPart
0205 {   
0206     /* Resources */
0207     String      current_font;   /* The currently shown font. */
0208 
0209     Boolean         show_font_name; /* show the font name window? */
0210     Boolean     iso_fonts_only; /* show only iso fonts? */
0211     Boolean     use_scaling;    /* use font scaling? */
0212     
0213     Dimension       text_rows;  /* The number of text rows to display*/
0214 
0215     XtCallbackList  font_changed_callback; /* when font changes. */
0216 
0217     XmFontSelStringInfo strings; /* The font selectors external strings. */
0218 
0219     /* Private Data */
0220 
0221     Boolean xlfd_mode;      /* True if we are int xlfd mode. */
0222 
0223     FontInfo        *font_info;     /* The font information. */
0224     Widget text, name_label;    /* Text and label widget below top area. */
0225     Widget middle_pane;     /* The option info middle pane. */
0226     Widget family_box;      /* The family choices combo box. */
0227     Widget size_box;        /* The family choices combo box. */
0228     Widget bold_toggle, italic_toggle; /* The bold and italic toggle buttons */
0229     Widget xlfd_toggle, other_toggle; /* The xlfd and other font toggles. */
0230     Widget show_font_toggle, use_scaling_toggle;
0231     Widget option_menu;     /* The option menu. */
0232     Widget encoding_menu_shell; /* The menu shell associated with the */
0233                     /* encoding menu. */
0234 
0235     WidgetList xlfd_only;   /* Only visable when in xlfd mode. */
0236     WidgetList xlfd_sensitive;  /* Only sensitive when in xlfd mode. */
0237 
0238     char num_xlfd_only, num_xlfd_sensitive;
0239     char alloc_xlfd_only, alloc_xlfd_sensitive;
0240 
0241     Flag user_state;        /* The current user selections. */
0242 
0243     String current_text;    /* The current text in the text widget. */
0244     String get_font;        /* Where to store returned get values on
0245                    current_font. */
0246     String encoding;        /* The encoding, may change. */
0247 
0248     /* 
0249      * The previously set font_data, free when font changed, or widget
0250      * destroyed. 
0251      */
0252 
0253     XmFontList old_fontlist;    
0254     XFontStruct * old_fontdata;
0255 
0256     /*
0257      * These values were added 2/1/94
0258      */
0259     Widget dpi75, dpi100, dpiAny; /* DPI toggle buttons.        */
0260     Widget proportional, monospace, any_spacing;
0261                                 /* Spacing toggle buttons       */
0262 } XmFontSelectorPart;
0263 
0264 typedef struct _XmFontSelectorRec
0265 {
0266     CorePart        core;
0267     CompositePart   composite;
0268     ConstraintPart  constraint;
0269     XmManagerPart   manager;
0270     XmPanedPart     paned;
0271     XmFontSelectorPart  fs;
0272 } XmFontSelectorRec;
0273 
0274 typedef struct _XmFontSelectorConstraintsPart
0275 {
0276     XtPointer dummy;
0277 } XmFontSelectorConstraintsPart;
0278 
0279 typedef struct _XmFontSelectorConstraintsRec
0280 {
0281     XmManagerConstraintPart       manager;
0282     XmPanedConstraintsPart        paned;
0283     XmFontSelectorConstraintsPart fs;
0284 } XmFontSelectorConstraintsRec, *XmFontSelectorConstraints;
0285 
0286 /************************************************************
0287  *      MACROS
0288  *************************************************************/
0289 
0290 /************************************************************
0291  *      GLOBAL DECLARATIONS
0292  *************************************************************/
0293 
0294 /************************************************************
0295  *       EXTERNAL DECLARATIONS
0296  ************************************************************/
0297 
0298 /************************************************************
0299  *       STATIC DECLARATIONS
0300  ************************************************************/
0301 
0302 extern XmFontSelectorClassRec   xmFontSelectorClassRec;
0303 
0304 #ifdef __cplusplus
0305 }   /* Closes scope of 'extern "C"' declaration */
0306 #endif
0307 
0308 #if defined(VMS) || defined(__VMS)
0309 #include <X11/apienvrst.h>
0310 #endif
0311 
0312 #endif  /* _XmFontSelectorP_h - DON'T ADD STUFF AFTER THIS #endif */