diff --git a/ChangeLog b/ChangeLog index fc0161ad0..0d4be0634 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-03-07 Fred Kiefer + + * Header/AppKit/NSCell.h: Moved NSControlSize definition to ... + * Header/AppKit/NSColor.h: ... here and added + NSMiniControlSize. For NSControlTint added NSBlueControlTint and + NSGraphiteControlTint. + * Header/AppKit/NSFont.h (+menuBarFontOfSize:, + +systemFontSizeForControlSize:, -numberOfGlyphs, + -coveredCharacterSet, -fontDescriptor): New MacOSX 10.3 methods. + * Source/NSFont.m: Added dummy implementations for the new methods. + 2005-03-05 Adrian Robert * Source/NSApplication.m (-_windowDidResignKey:) Unhide mouse. diff --git a/Headers/AppKit/NSCell.h b/Headers/AppKit/NSCell.h index b3f992225..ee6541aa0 100644 --- a/Headers/AppKit/NSCell.h +++ b/Headers/AppKit/NSCell.h @@ -113,11 +113,6 @@ enum { NSMixedState = -1 }; -typedef enum _NSControlSize { - NSRegularControlSize, - NSSmallControlSize -} NSControlSize; - @interface NSCell : NSObject { // Attributes diff --git a/Headers/AppKit/NSColor.h b/Headers/AppKit/NSColor.h index c6bed7bce..5400f36ca 100644 --- a/Headers/AppKit/NSColor.h +++ b/Headers/AppKit/NSColor.h @@ -39,9 +39,17 @@ typedef enum _NSControlTint { NSDefaultControlTint, - NSClearControlTint + NSClearControlTint, + NSBlueControlTint, + NSGraphiteControlTint } NSControlTint; +typedef enum _NSControlSize { + NSRegularControlSize, + NSSmallControlSize, + NSMiniControlSize +} NSControlSize; + /* * NSColor is an abstract super class of the class cluster of the real colour classes. * For each colour space exists a specific subclass that implements the behaviour for diff --git a/Headers/AppKit/NSFont.h b/Headers/AppKit/NSFont.h index c797032c8..01a99d627 100644 --- a/Headers/AppKit/NSFont.h +++ b/Headers/AppKit/NSFont.h @@ -34,8 +34,12 @@ #include #include #include +// For NSControlSize +#include @class NSDictionary; +@class NSCharacterSet; +@class NSFontDescriptor; typedef unsigned int NSGlyph; @@ -98,6 +102,7 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix; + (NSFont*) userFixedPitchFontOfSize: (float)fontSize; + (NSFont*) userFontOfSize: (float)fontSize; +#ifndef STRICT_OPENSTEP + (NSFont*) titleBarFontOfSize: (float)fontSize; + (NSFont*) menuFontOfSize: (float)fontSize; + (NSFont*) messageFontOfSize: (float)fontSize; @@ -105,13 +110,18 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix; + (NSFont*) toolTipsFontOfSize: (float)fontSize; + (NSFont*) controlContentFontOfSize: (float)fontSize; + (NSFont*) labelFontOfSize: (float)fontSize; ++ (NSFont*) menuBarFontOfSize: (float)fontSize; +#endif // // Font Sizes // +#ifndef STRICT_OPENSTEP + (float) labelFontSize; + (float) smallSystemFontSize; + (float) systemFontSize; ++ (float) systemFontSizeForControlSize: (NSControlSize)controlSize; +#endif // // Preferred Fonts @@ -155,6 +165,12 @@ APPKIT_EXPORT const float *NSFontIdentityMatrix; - (float) widthOfString: (NSString*)string; - (float) defaultLineHeightForFont; +#ifndef STRICT_OPENSTEP +- (unsigned) numberOfGlyphs; +- (NSCharacterSet*) coveredCharacterSet; +- (NSFontDescriptor*) fontDescriptor; +#endif + // // Manipulating Glyphs // diff --git a/Source/NSFont.m b/Source/NSFont.m index f044266d2..936eec9da 100644 --- a/Source/NSFont.m +++ b/Source/NSFont.m @@ -148,6 +148,7 @@ keyForFont(NSString *name, const float *matrix, BOOL fix, NSFont Helvetica (System Font) NSLabelFont System font NSMenuFont System font + NSMenuBarFont System font NSMessageFont System font NSPaletteFont System bold font NSTitleBarFont System bold font @@ -164,6 +165,7 @@ keyForFont(NSString *name, const float *matrix, BOOL fix, NSFontSize 12 (System Font Size) NSLabelFontSize (none) NSMenuFontSize (none) + NSMiniFontSize 6 NSMessageFontSize (none) NSPaletteFontSize (none) NSSmallFontSize 9 @@ -220,6 +222,7 @@ RolePaletteFont, RoleToolTipsFont, RoleControlContentFont, RoleLabelFont, +RoleMenuBarFont, RoleMax }; @@ -256,7 +259,8 @@ static font_role_info_t font_roles[RoleMax]={ {@"NSPaletteFont" , RoleBoldSystemFont, nil, nil}, {@"NSToolTipsFont" , RoleSystemFont , nil, nil}, {@"NSControlContentFont", RoleSystemFont , nil, nil}, - {@"NSLabelFont" , RoleSystemFont , nil, nil} + {@"NSLabelFont" , RoleSystemFont , nil, nil}, + {@"NSMenuBarFont" , RoleSystemFont , nil, nil} }; @@ -533,6 +537,11 @@ static void setNSFont(NSString *key, NSFont *font) return getNSFont(fontSize, RoleMenuFont); } ++ (NSFont*) menuBarFontOfSize: (float)fontSize +{ + return getNSFont(fontSize, RoleMenuBarFont); +} + + (NSFont*) titleBarFontOfSize: (float)fontSize { return getNSFont(fontSize, RoleTitleBarFont); @@ -592,6 +601,29 @@ static void setNSFont(NSString *key, NSFont *font) return fontSize; } ++ (float) systemFontSizeForControlSize: (NSControlSize)controlSize +{ + switch (controlSize) + { + case NSMiniControlSize: + { + float fontSize = [defaults floatForKey: @"NSMiniFontSize"]; + + if (fontSize == 0) + { + fontSize = 6; + } + + return fontSize; + } + case NSSmallControlSize: + return [self smallSystemFontSize]; + case NSRegularControlSize: + default: + return [self systemFontSize]; + } +} + /** * Returns an autoreleased font with name aFontName and matrix fontMatrix.
* The fontMatrix is a standard size element matrix as used in PostScript @@ -916,6 +948,24 @@ static BOOL flip_hack; return [fontInfo widthOfString: string]; } +- (unsigned) numberOfGlyphs +{ + // FIXME + return 0; +} + +- (NSCharacterSet*) coveredCharacterSet +{ + // FIXME + return nil; +} + +- (NSFontDescriptor*) fontDescriptor +{ + // FIXME + return nil; +} + /* The following methods have to be implemented by backends */ // @@ -1182,6 +1232,9 @@ static BOOL flip_hack; case RoleLabelFont: new = [NSFont labelFontOfSize: size]; break; + case RoleMenuBarFont: + new = [NSFont menuBarFontOfSize: size]; + break; default: NSDebugLLog(@"NSFont", @"unknown role %i", the_role);