home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / AppKit.framework / Versions / B / Headers / NSFontManager.h < prev    next >
Text File  |  1996-10-17  |  4KB  |  129 lines

  1. /*
  2.     NSFontManager.h
  3.     Application Kit
  4.     Copyright (c) 1994-1996, NeXT Software, Inc.
  5.     All rights reserved.
  6. */
  7.  
  8. #import <Foundation/Foundation.h>
  9.  
  10. @class NSFontPanel;
  11. @class NSFont;
  12. @class NSMenu;
  13. @class NSArray;
  14.  
  15. typedef unsigned int NSFontTraitMask;
  16.  
  17. /*
  18.  * Font Traits
  19.  *
  20.  * This list should be kept small since the more traits that are assigned
  21.  * to a given font, the harder it will be to map it to some other family.
  22.  * Some traits are mutually exclusive such as NSExpanded and NSCondensed.
  23.  */
  24.  
  25. enum {
  26.     NSItalicFontMask            = 0x00000001,
  27.     NSBoldFontMask            = 0x00000002,
  28.     NSUnboldFontMask            = 0x00000004,
  29.     NSNonStandardCharacterSetFontMask    = 0x00000008,
  30.     NSNarrowFontMask            = 0x00000010,
  31.     NSExpandedFontMask            = 0x00000020,
  32.     NSCondensedFontMask            = 0x00000040,
  33.     NSSmallCapsFontMask            = 0x00000080,
  34.     NSPosterFontMask            = 0x00000100,
  35.     NSCompressedFontMask        = 0x00000200,
  36.     NSFixedPitchFontMask        = 0x00000400,
  37.     NSUnitalicFontMask            = 0x01000000
  38. };
  39.  
  40. @interface NSFontManager : NSObject
  41. {
  42. @private
  43.     id                  _panel;
  44.     id                  _menu;
  45.     SEL                 _action;
  46.     int                 _whatToDo;
  47.     NSFontTraitMask     _traitToChange;
  48.     NSFont *            _selFont;
  49.     struct _fmFlags {
  50.     unsigned int        multipleFont:1;
  51.     unsigned int        disabled:1;
  52.     unsigned int        _RESERVED:14;
  53.     }                   _fmFlags;
  54.     unsigned short      _lastPos;
  55.     id                _delegate;
  56.     unsigned int        _reservedFMint2;
  57.     unsigned int        _reservedFMint3;
  58.     unsigned int        _reservedFMint4;
  59. }
  60.  
  61. + (void)setFontPanelFactory:(Class)factoryId;
  62. + (void)setFontManagerFactory:(Class)factoryId;
  63. + (NSFontManager *)sharedFontManager;
  64.  
  65. - (BOOL)isMultiple;
  66. - (NSFont *)selectedFont;
  67. - (void)setSelectedFont:(NSFont *)fontObj isMultiple:(BOOL)flag;
  68. - (void)setFontMenu:(NSMenu *)newMenu;
  69. - (NSMenu *)fontMenu:(BOOL)create;
  70. - (NSFontPanel *)fontPanel:(BOOL)create;
  71. - (NSFont *)fontWithFamily:(NSString *)family traits:(NSFontTraitMask)traits weight:(int)weight size:(float)size;
  72. - (NSFontTraitMask)traitsOfFont:(NSFont *)fontObj;
  73. - (int)weightOfFont:(NSFont *)fontObj;
  74. - (NSArray *)availableFonts;
  75. - (NSFont *)convertFont:(NSFont *)fontObj;
  76. - (NSFont *)convertFont:(NSFont *)fontObj toSize:(float)size;
  77. - (NSFont *)convertFont:(NSFont *)fontObj toFace:(NSString *)typeface;
  78. - (NSFont *)convertFont:(NSFont *)fontObj toFamily:(NSString *)family;
  79. - (NSFont *)convertFont:(NSFont *)fontObj toHaveTrait:(NSFontTraitMask)trait;
  80. - (NSFont *)convertFont:(NSFont *)fontObj toNotHaveTrait:(NSFontTraitMask)trait;
  81. - (NSFont *)convertWeight:(BOOL)upFlag ofFont:(NSFont *)fontObj;
  82. - (BOOL)isEnabled;
  83. - (void)setEnabled:(BOOL)flag;
  84. - (SEL)action;
  85. - (void)setAction:(SEL)aSelector;
  86. - (BOOL)sendAction;
  87. - (void)setDelegate:(id)anObject;
  88. - (id)delegate;
  89.  
  90. @end
  91.  
  92. @interface NSFontManager(NSFontManagerMenuActionMethods)
  93.  
  94. - (BOOL)fontNamed:(NSString *)fName hasTraits:(NSFontTraitMask)someTraits;
  95. - (NSArray *)availableFontNamesWithTraits:(NSFontTraitMask)someTraits;
  96.  
  97. /* These methods are action messages sent from Font Menu items:
  98. */
  99. - (void)addFontTrait:(id)sender;
  100. - (void)removeFontTrait:(id)sender;
  101. - (void)modifyFontViaPanel:(id)sender;
  102. - (void)modifyFont:(id)sender;
  103. - (void)orderFrontFontPanel:(id)sender;
  104.  
  105. @end
  106.  
  107. /* And these "actions" are really tag values in Font Menu cells which send any of the action messages listed above.  Normally, they're pre-defined in the font panel.
  108. */
  109. typedef enum _NSFontAction {
  110.     NSNoFontChangeAction        = 0,
  111.     NSViaPanelFontAction        = 1,
  112.     NSAddTraitFontAction        = 2,
  113.     NSSizeUpFontAction            = 3,
  114.     NSSizeDownFontAction        = 4,
  115.     NSHeavierFontAction            = 5,
  116.     NSLighterFontAction            = 6,
  117.     NSRemoveTraitFontAction        = 7
  118. } NSFontAction;
  119.  
  120. @interface NSObject(NSFontManagerDelegate)
  121. - (BOOL)fontManager:(id)sender willIncludeFont:(NSString *)fontName;
  122. @end
  123.  
  124. /* This is the message that's propagated up the responder chain.
  125. */
  126. @interface NSObject(NSFontManagerResponderMethod)
  127. - (void)changeFont:(id)sender;
  128. @end
  129.