1 /* 2 * Motif 3 * 4 * Copyright (c) 1987-2012, The Open Group. All rights reserved. 5 * 6 * These libraries and programs are free software; you can 7 * redistribute them and/or modify them under the terms of the GNU 8 * Lesser General Public License as published by the Free Software 9 * Foundation; either version 2 of the License, or (at your option) 10 * any later version. 11 * 12 * These libraries and programs are distributed in the hope that 13 * they will be useful, but WITHOUT ANY WARRANTY; without even the 14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 15 * PURPOSE. See the GNU Lesser General Public License for more 16 * details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with these librararies and programs; if not, write 20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 21 * Floor, Boston, MA 02110-1301 USA 22 * 23 */ 24 25 #ifndef _XmFontSelectorP_h 26 #define _XmFontSelectorP_h 27 28 #if defined(VMS) || defined(__VMS) 29 #include <X11/apienvset.h> 30 #endif 31 32 /************************************************************ 33 * INCLUDE FILES 34 *************************************************************/ 35 #include <Xm/ManagerP.h> 36 #include <Xm/PanedP.h> 37 #include <Xm/FontS.h> 38 39 #ifdef __cplusplus 40 extern "C" { 41 #endif 42 43 #define XmFontSelectorIndex (XmPanedIndex + 1) 44 45 #define XmFontS_current_font(w) (((XmFontSelectorWidget)(w))->fs.current_font) 46 #define XmFontS_show_font_name(w) (((XmFontSelectorWidget)(w))->fs.show_font_name) 47 #define XmFontS_iso_fonts_only(w) (((XmFontSelectorWidget)(w))->fs.iso_fonts_only) 48 #define XmFontS_use_scaling(w) (((XmFontSelectorWidget)(w))->fs.use_scaling) 49 #define XmFontS_text_rows(w) (((XmFontSelectorWidget)(w))->fs.text_rows) 50 #define XmFontS_font_changed_callback(w) (((XmFontSelectorWidget)(w))->fs.font_changed_callback) 51 #define XmFontS_strings(w) (((XmFontSelectorWidget)(w))->fs.strings) 52 #define XmFontS_xlfd_mode(w) (((XmFontSelectorWidget)(w))->fs.xlfd_mode) 53 #define XmFontS_font_info(w) (((XmFontSelectorWidget)(w))->fs.font_info) 54 #define XmFontS_text(w) (((XmFontSelectorWidget)(w))->fs.text) 55 #define XmFontS_name_label(w) (((XmFontSelectorWidget)(w))->fs.name_label) 56 #define XmFontS_middle_pane(w) (((XmFontSelectorWidget)(w))->fs.middle_pane) 57 #define XmFontS_family_box(w) (((XmFontSelectorWidget)(w))->fs.family_box) 58 #define XmFontS_size_box(w) (((XmFontSelectorWidget)(w))->fs.size_box) 59 #define XmFontS_bold_toggle(w) (((XmFontSelectorWidget)(w))->fs.bold_toggle) 60 #define XmFontS_italic_toggle(w) (((XmFontSelectorWidget)(w))->fs.italic_toggle) 61 #define XmFontS_xlfd_toggle(w) (((XmFontSelectorWidget)(w))->fs.xlfd_toggle) 62 #define XmFontS_other_toggle(w) (((XmFontSelectorWidget)(w))->fs.other_toggle) 63 #define XmFontS_show_font_toggle(w) (((XmFontSelectorWidget)(w))->fs.show_font_toggle) 64 #define XmFontS_use_scaling_toggle(w) (((XmFontSelectorWidget)(w))->fs.use_scaling_toggle) 65 #define XmFontS_option_menu(w) (((XmFontSelectorWidget)(w))->fs.option_menu) 66 #define XmFontS_encoding_menu_shell(w) (((XmFontSelectorWidget)(w))->fs.encoding_menu_shell) 67 #define XmFontS_xlfd_only(w) (((XmFontSelectorWidget)(w))->fs.xlfd_only) 68 #define XmFontS_xlfd_sensitive(w) (((XmFontSelectorWidget)(w))->fs.xlfd_sensitive) 69 #define XmFontS_num_xlfd_only(w) (((XmFontSelectorWidget)(w))->fs.num_xlfd_only) 70 #define XmFontS_num_xlfd_sensitive(w) (((XmFontSelectorWidget)(w))->fs.num_xlfd_sensitive) 71 #define XmFontS_alloc_xlfd_only(w) (((XmFontSelectorWidget)(w))->fs.alloc_xlfd_only) 72 #define XmFontS_alloc_xlfd_sensitive(w) (((XmFontSelectorWidget)(w))->fs.alloc_xlfd_sensitive) 73 #define XmFontS_user_state(w) (((XmFontSelectorWidget)(w))->fs.user_state) 74 #define XmFontS_current_text(w) (((XmFontSelectorWidget)(w))->fs.current_text) 75 #define XmFontS_get_font(w) (((XmFontSelectorWidget)(w))->fs.get_font) 76 #define XmFontS_encoding(w) (((XmFontSelectorWidget)(w))->fs.encoding) 77 #define XmFontS_old_fontlist(w) (((XmFontSelectorWidget)(w))->fs.old_fontlist) 78 #define XmFontS_old_fontdata(w) (((XmFontSelectorWidget)(w))->fs.old_fontdata) 79 #define XmFontS_dpi75(w) (((XmFontSelectorWidget)(w))->fs.dpi75) 80 #define XmFontS_dpi100(w) (((XmFontSelectorWidget)(w))->fs.dpi100) 81 #define XmFontS_dpiAny(w) (((XmFontSelectorWidget)(w))->fs.dpiAny) 82 #define XmFontS_proportional(w) (((XmFontSelectorWidget)(w))->fs.proportional) 83 #define XmFontS_monospace(w) (((XmFontSelectorWidget)(w))->fs.monospace) 84 #define XmFontS_any_spacing(w) (((XmFontSelectorWidget)(w))->fs.any_spacing) 85 86 87 #define SAMPLE_TEXT(fsw) (XmFontS_strings((fsw)).sample_text) 88 #define ANY_STRING(fsw) (XmFontS_strings((fsw)).any) 89 #define LOWER_ANY_STRING(fsw) (XmFontS_strings((fsw)).lower_any) 90 #define FAMILY_STRING(fsw) (XmFontS_strings((fsw)).family) 91 #define SIZE_STRING(fsw) (XmFontS_strings((fsw)).size) 92 #define BOLD_STRING(fsw) (XmFontS_strings((fsw)).bold) 93 #define ITALIC_STRING(fsw) (XmFontS_strings((fsw)).italic) 94 95 #define OPTION_STRING(fsw) (XmFontS_strings((fsw)).option) 96 97 #define BOTH_STRING(fsw) (XmFontS_strings((fsw)).both) 98 #define MONO_SPACE_STRING(fsw) (XmFontS_strings((fsw)).mono_space) 99 #define PROPORTIONAL_STRING(fsw)(XmFontS_strings((fsw)).prop_space) 100 101 #define XLFD_STRING(fsw) (XmFontS_strings((fsw)).xlfd) 102 #define OTHER_FONT_STRING(fsw) (XmFontS_strings((fsw)).other_font) 103 104 #define DPI75_STRING(fsw) (XmFontS_strings((fsw)).dpi_75) 105 #define DPI100_STRING(fsw) (XmFontS_strings((fsw)).dpi_100) 106 107 #define SCALING_STRING(fsw) (XmFontS_strings((fsw)).scaling) 108 #define SHOW_NAME_STRING(fsw) (XmFontS_strings((fsw)).show_name) 109 110 #define ENCODING_ONLY_STRING(fsw) (XmFontS_strings((fsw)).encoding_only) 111 #define ENCODING_LIST(fsw) (XmFontS_strings((fsw)).encoding_list) 112 113 #define ENCODING_STRING(fsw) XmFontS_encoding((fsw)) 114 115 /* this structure provides the table for font selection */ 116 117 #define WEIGHT_LEN 15 118 #define SLANT_LEN 3 119 #define SPACING_LEN 3 120 121 typedef unsigned char Flag; 122 typedef unsigned int LongFlag; 123 124 #define FIXED ((Flag) 1 << 0) 125 #define BOLD ((Flag) 1 << 1) 126 #define ITALIC ((Flag) 1 << 2) 127 #define PROPORTIONAL ((Flag) 1 << 3) 128 #define SCALED_75 ((Flag) 1 << 4) 129 #define SCALED_100 ((Flag) 1 << 5) 130 #define DPI_75 ((Flag) 1 << 6) 131 #define DPI_100 ((Flag) 1 << 7) 132 133 /* 134 * This allows me to reuse flag bits in the user_state since 135 * ISO is never set in the user state. 136 */ 137 138 #define USER_PROPORTIONAL PROPORTIONAL 139 #define USER_FIXED FIXED 140 141 typedef struct _FontData { 142 XrmQuark familyq; /* quarkified family name. */ 143 XrmQuark weightq; /* quarkified weight name. */ 144 char slant[SLANT_LEN + 1]; 145 char spacing[SPACING_LEN + 1]; 146 short resolution_x, resolution_y; 147 short point_size; 148 XrmQuark encoding; 149 Flag state; 150 } FontData; 151 152 typedef struct FamilyInfo { 153 XrmQuark nameq; /* quarkified family name. */ 154 XrmQuark bold_nameq, medium_nameq; 155 XrmQuark italic_nameq, upright_nameq; 156 char fixed_spacing[SPACING_LEN + 1]; 157 LongFlag sizes_75, sizes_100; 158 Flag state; 159 XrmQuark *encodings; 160 int encoding_alloc; 161 } FamilyInfo; 162 163 typedef struct FontInfo { 164 FontData *current_font; 165 String *others; 166 FamilyInfo *family_info; 167 short num_others; 168 short num_families; 169 short resolution; 170 } FontInfo; 171 172 typedef struct _XmFontSelStringInfo { 173 XmString sample_text; 174 XmString any, lower_any; 175 XmString family, size; 176 XmString bold, italic, option, both; 177 XmString mono_space, prop_space; 178 XmString xlfd, other_font; 179 XmString dpi_75, dpi_100; 180 XmString scaling, encoding_only, show_name; 181 182 String *encoding_list; 183 } XmFontSelStringInfo; 184 185 /************************************************************ 186 * TYPEDEFS AND DEFINES 187 *************************************************************/ 188 189 typedef struct _FontSelectorClassPart 190 { 191 XtPointer extension; /* For later use. */ 192 } FontSelectorClassPart; 193 194 typedef struct _XmFontSelectorClassRec 195 { 196 CoreClassPart core_class; 197 CompositeClassPart composite_class; 198 ConstraintClassPart constraint_class; 199 XmManagerClassPart manager_class; 200 XmPanedClassPart paned_class; 201 FontSelectorClassPart font_selector_class; 202 } XmFontSelectorClassRec; 203 204 typedef struct _XmFontSelectorPart 205 { 206 /* Resources */ 207 String current_font; /* The currently shown font. */ 208 209 Boolean show_font_name; /* show the font name window? */ 210 Boolean iso_fonts_only; /* show only iso fonts? */ 211 Boolean use_scaling; /* use font scaling? */ 212 213 Dimension text_rows; /* The number of text rows to display*/ 214 215 XtCallbackList font_changed_callback; /* when font changes. */ 216 217 XmFontSelStringInfo strings; /* The font selectors external strings. */ 218 219 /* Private Data */ 220 221 Boolean xlfd_mode; /* True if we are int xlfd mode. */ 222 223 FontInfo *font_info; /* The font information. */ 224 Widget text, name_label; /* Text and label widget below top area. */ 225 Widget middle_pane; /* The option info middle pane. */ 226 Widget family_box; /* The family choices combo box. */ 227 Widget size_box; /* The family choices combo box. */ 228 Widget bold_toggle, italic_toggle; /* The bold and italic toggle buttons */ 229 Widget xlfd_toggle, other_toggle; /* The xlfd and other font toggles. */ 230 Widget show_font_toggle, use_scaling_toggle; 231 Widget option_menu; /* The option menu. */ 232 Widget encoding_menu_shell; /* The menu shell associated with the */ 233 /* encoding menu. */ 234 235 WidgetList xlfd_only; /* Only visable when in xlfd mode. */ 236 WidgetList xlfd_sensitive; /* Only sensitive when in xlfd mode. */ 237 238 char num_xlfd_only, num_xlfd_sensitive; 239 char alloc_xlfd_only, alloc_xlfd_sensitive; 240 241 Flag user_state; /* The current user selections. */ 242 243 String current_text; /* The current text in the text widget. */ 244 String get_font; /* Where to store returned get values on 245 current_font. */ 246 String encoding; /* The encoding, may change. */ 247 248 /* 249 * The previously set font_data, free when font changed, or widget 250 * destroyed. 251 */ 252 253 XmFontList old_fontlist; 254 XFontStruct * old_fontdata; 255 256 /* 257 * These values were added 2/1/94 258 */ 259 Widget dpi75, dpi100, dpiAny; /* DPI toggle buttons. */ 260 Widget proportional, monospace, any_spacing; 261 /* Spacing toggle buttons */ 262 } XmFontSelectorPart; 263 264 typedef struct _XmFontSelectorRec 265 { 266 CorePart core; 267 CompositePart composite; 268 ConstraintPart constraint; 269 XmManagerPart manager; 270 XmPanedPart paned; 271 XmFontSelectorPart fs; 272 } XmFontSelectorRec; 273 274 typedef struct _XmFontSelectorConstraintsPart 275 { 276 XtPointer dummy; 277 } XmFontSelectorConstraintsPart; 278 279 typedef struct _XmFontSelectorConstraintsRec 280 { 281 XmManagerConstraintPart manager; 282 XmPanedConstraintsPart paned; 283 XmFontSelectorConstraintsPart fs; 284 } XmFontSelectorConstraintsRec, *XmFontSelectorConstraints; 285 286 /************************************************************ 287 * MACROS 288 *************************************************************/ 289 290 /************************************************************ 291 * GLOBAL DECLARATIONS 292 *************************************************************/ 293 294 /************************************************************ 295 * EXTERNAL DECLARATIONS 296 ************************************************************/ 297 298 /************************************************************ 299 * STATIC DECLARATIONS 300 ************************************************************/ 301 302 extern XmFontSelectorClassRec xmFontSelectorClassRec; 303 304 #ifdef __cplusplus 305 } /* Closes scope of 'extern "C"' declaration */ 306 #endif 307 308 #if defined(VMS) || defined(__VMS) 309 #include <X11/apienvrst.h> 310 #endif 311 312 #endif /* _XmFontSelectorP_h - DON'T ADD STUFF AFTER THIS #endif */ 313